From 079aede0ec117aaaa38df94bbbb8ae50552715b8 Mon Sep 17 00:00:00 2001 From: Jaroslav Barton Date: Wed, 29 Apr 2009 18:17:54 +0200 Subject: [PATCH] - removed debug output - better handling getDefaultDevice when no device found --- src/FMDbusConn.cpp | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/src/FMDbusConn.cpp b/src/FMDbusConn.cpp index 7e236ae..d7fb219 100644 --- a/src/FMDbusConn.cpp +++ b/src/FMDbusConn.cpp @@ -16,7 +16,7 @@ FMDbusConn* FMDbusConn::getConn() { conn = new FMDbusConn(); } ocount++; - qDebug("Number of references: %d", ocount); +// qDebug("Number of references: %d", ocount); return(conn); } @@ -26,10 +26,10 @@ FMDbusConn* FMDbusConn::getConn() { void FMDbusConn::releaseConn() { if (ocount > 0) { ocount--; - qDebug("Number of references: %d", ocount); +// qDebug("Number of references: %d", ocount); } if (ocount == 0){ - qDebug("Deleting instance"); +// qDebug("Deleting instance"); delete this; } } @@ -56,17 +56,15 @@ FMDbusConn::~FMDbusConn() { */ QDBusInterface* FMDbusConn::getManagerIface(int retr = INTERFACE_ACQUIRE_RETRY) { if (!retr) { - qDebug("Manager interface doesn't found!"); +// qDebug("Manager interface doesn't found!"); return(0); } if (managerIface && managerIface->isValid()) { - qDebug("Returning existing manager interface"); +// qDebug("Returning existing manager interface"); return(managerIface); } - qDebug("getManagerConnection try: %d", retr); - // Connect to Fprint manager on system bus QDBusConnection bus = QDBusConnection::systemBus(); QDBusInterface *iface = new QDBusInterface("net.reactivated.Fprint", @@ -129,10 +127,11 @@ FingerManagerDevicesModel* FMDbusConn::getDevices() { model->addDevice(device.path(), getDeviceName(device.path())); } } - - QDBusReply defaultDevice = iface->call("GetDefaultDevice"); - if (defaultDevice.isValid()) { - model->setDefault(defaultDevice.value().path()); + if (model->rowCount(QModelIndex()) > 0) { // found at least one device + QDBusReply defaultDevice = iface->call("GetDefaultDevice"); + if (defaultDevice.isValid()) { + model->setDefault(defaultDevice.value().path()); + } } } else { qDebug("D-Bus interface cannot be acquired! :-("); @@ -147,7 +146,6 @@ FingerManagerDevicesModel* FMDbusConn::getDevices() { * @return QStringList */ QStringList FMDbusConn::getFingers(QString device, QString username) { - qDebug("getFingers:"); QDBusInterface *iface = getDeviceInterface(device); QStringList result; if (iface && iface->isValid()) { @@ -191,9 +189,7 @@ bool FMDbusConn::deleteAllEnrolledFingers(QString device, QString username) { */ int FMDbusConn::getEnrollStages() { int stages = 3; - qDebug() << "getEnrollStages"; if (isDeviceClaimed()) { - qDebug() << " device claimed..."; // QDBusInterface cannot access properties with dashes in name, // so access must be done in other way QDBusInterface *iface = new QDBusInterface("net.reactivated.Fprint", @@ -206,7 +202,6 @@ int FMDbusConn::getEnrollStages() { "net.reactivated.Fprint.Device", "num-enroll-stages"); int s = r.value().toInt(); - qDebug("Device enroll stages: %d", s); if (s > 0) { stages = s; } @@ -286,16 +281,15 @@ void FMDbusConn::claimDevice(QString device, QString username) { delete(iface); } } - } else { + } /*else { qDebug("Device is allready claimed!"); - } + }*/ } /** * releaseDevice - release claimed device */ void FMDbusConn::releaseDevice() { - qDebug() << __func__; if (claimedDevice) { if (claimedDevice->isValid()) { if (!isEnrollStopped) enrollStop(); @@ -335,14 +329,13 @@ void FMDbusConn::enrollCallback(QString status, bool result) { * @param finger selected finger */ void FMDbusConn::enrollStart(QString finger) { - qDebug() << __func__; if (isDeviceClaimed()) { if (isEnrollStopped) { isEnrollStopped = false; claimedDevice->call("EnrollStart", finger); - } else { + }/* else { qDebug(" Enrollment allready started..."); - } + }*/ } } @@ -350,13 +343,12 @@ void FMDbusConn::enrollStart(QString finger) { * enrollStop - stop enrollment */ void FMDbusConn::enrollStop() { - qDebug() << __func__; if (isDeviceClaimed()) { if (!isEnrollStopped) { isEnrollStopped = true; claimedDevice->call("EnrollStop"); - } else { + }/* else { qDebug(" Enrollment allready stopped..."); - } + }*/ } } -- 2.11.4.GIT