Commit e1784cbd authored by Luca Giambonini's avatar Luca Giambonini

replace qDebug with akabeiDebug and added more clear debug output text

parent 45173d67
...@@ -224,10 +224,10 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS) ...@@ -224,10 +224,10 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS)
d->callbackSlot = cS; d->callbackSlot = cS;
if (Config::instance()->needsPrivileges()) { if (Config::instance()->needsPrivileges()) {
qDebug() << "We need privileges to get lock"; akabeiDebug() << "We need privileges to get lock";
if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.filesystem.lock")) { if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.filesystem.lock")) {
setStatus(Backend::StatusWaitingForLock); setStatus(Backend::StatusWaitingForLock);
qDebug() << "Authorization granted"; akabeiDebug() << "Authorization granted";
if (!d->iface) { if (!d->iface) {
d->iface = new QDBusInterface("org.chakraproject.akabeicorehelper", "/filesystem", "org.chakraproject.akabeicorehelper.filesystem", QDBusConnection::systemBus()); d->iface = new QDBusInterface("org.chakraproject.akabeicorehelper", "/filesystem", "org.chakraproject.akabeicorehelper.filesystem", QDBusConnection::systemBus());
} }
...@@ -238,7 +238,7 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS) ...@@ -238,7 +238,7 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS)
d->iface->asyncCall("getLock", QCoreApplication::applicationPid()); d->iface->asyncCall("getLock", QCoreApplication::applicationPid());
} else { } else {
qDebug() << "Authorization not granted" << PolkitQt1::Authority::instance()->errorDetails(); akabeiDebug() << "Authorization not granted" << PolkitQt1::Authority::instance()->errorDetails();
Akabei::ErrorQueue::instance()->appendError(Error(Error::PermissionError, tr("An authorization error occurred: %1").arg(PolkitQt1::Authority::instance()->errorDetails()))); Akabei::ErrorQueue::instance()->appendError(Error(Error::PermissionError, tr("An authorization error occurred: %1").arg(PolkitQt1::Authority::instance()->errorDetails())));
setStatus(Backend::StatusBroken); setStatus(Backend::StatusBroken);
} }
...@@ -246,7 +246,7 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS) ...@@ -246,7 +246,7 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS)
AkabeiLogLine::initialize( Akabei::Config::instance()->useSyslog(), Akabei::Config::instance()->logFile() ); AkabeiLogLine::initialize( Akabei::Config::instance()->useSyslog(), Akabei::Config::instance()->logFile() );
return; return;
} else { } else {
qDebug() << "WE HERE"; akabeiDebug() << "We have privileges, now try get the lock";
if (!d->lockFileHandle) { if (!d->lockFileHandle) {
d->lockFileHandle = new QFile(Akabei::Config::instance()->rootDir().absoluteFilePath("var/local/akabei.lck")); d->lockFileHandle = new QFile(Akabei::Config::instance()->rootDir().absoluteFilePath("var/local/akabei.lck"));
...@@ -268,7 +268,7 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS) ...@@ -268,7 +268,7 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS)
setStatus(Backend::StatusWaitingForLock); setStatus(Backend::StatusWaitingForLock);
if (fcntl(d->lockFileHandle->handle(), F_SETLK, &lockinfo) == -1) { if (fcntl(d->lockFileHandle->handle(), F_SETLK, &lockinfo) == -1) {
akabeiDebug() << "No lock for us!"; akabeiDebug() << "Already locked, waiting for it...!";
connect(&d->lockWatcher, SIGNAL(finished()), this, SLOT(__k__lockGranted()));//TODO: Check if this works!!!!! connect(&d->lockWatcher, SIGNAL(finished()), this, SLOT(__k__lockGranted()));//TODO: Check if this works!!!!!
QFuture<void> lockF = QtConcurrent::run(d, &BackendPrivate::getLock); QFuture<void> lockF = QtConcurrent::run(d, &BackendPrivate::getLock);
d->lockWatcher.setFuture(lockF); d->lockWatcher.setFuture(lockF);
...@@ -281,14 +281,14 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS) ...@@ -281,14 +281,14 @@ void Backend::setStatus(Backend::Status s, QObject * cO, const char * cS)
return; return;
} else if (d->status == StatusOnTransaction) { } else if (d->status == StatusOnTransaction) {
if (Config::instance()->needsPrivileges()) { if (Config::instance()->needsPrivileges()) {
qDebug() << "We need privileges to remove lock"; akabeiDebug() << "We need privileges to remove lock";
if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.filesystem.lock")) { if (Akabei::Helpers::checkAuthorizationSync("org.chakraproject.akabeicorehelper.filesystem.lock")) {
qDebug() << "Authorization granted"; akabeiDebug() << "Authorization granted";
disconnect(d->iface, SIGNAL(lockGranted(qlonglong)), this, SLOT(__k__lockGranted(qlonglong))); disconnect(d->iface, SIGNAL(lockGranted(qlonglong)), this, SLOT(__k__lockGranted(qlonglong)));
QDBusMessage mes = d->iface->call("removeLock", QCoreApplication::applicationPid()); QDBusMessage mes = d->iface->call("removeLock", QCoreApplication::applicationPid());
} else { } else {
qDebug() << "Authorization not granted" << PolkitQt1::Authority::instance()->errorDetails(); akabeiDebug() << "Authorization not granted" << PolkitQt1::Authority::instance()->errorDetails();
setStatus(Backend::StatusBroken); setStatus(Backend::StatusBroken);
Akabei::ErrorQueue::instance()->appendError(Error(Error::PermissionError, PolkitQt1::Authority::instance()->errorDetails())); Akabei::ErrorQueue::instance()->appendError(Error(Error::PermissionError, PolkitQt1::Authority::instance()->errorDetails()));
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment