Added some debug info to devices and notifications models

This commit is contained in:
Albert Vaca 2014-07-01 01:25:30 +02:00
parent cabb0f2f7b
commit 12411da360
2 changed files with 14 additions and 7 deletions

View file

@ -26,9 +26,10 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <KIcon> #include <KIcon>
#include "kdebugnamespace.h" #include <core/kdebugnamespace.h>
#include "dbusinterfaces.h"
// #include "modeltest.h" // #include "modeltest.h"
#include "interfaces/dbusinterfaces.h"
DevicesModel::DevicesModel(QObject *parent) DevicesModel::DevicesModel(QObject *parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
@ -105,16 +106,19 @@ void DevicesModel::refreshDeviceList()
} }
if (!m_dbusInterface->isValid()) { if (!m_dbusInterface->isValid()) {
kDebug(debugArea()) << "dbus interface not valid";
return; return;
} }
bool onlyPaired = (m_displayFilter & StatusPaired); bool onlyPaired = (m_displayFilter & StatusPaired);
bool onlyReachable = (m_displayFilter & StatusReachable); bool onlyReachable = (m_displayFilter & StatusReachable);
QDBusPendingReply<QStringList> pendingDeviceIds = m_dbusInterface->devices(onlyReachable, onlyPaired); QDBusPendingReply<QStringList> pendingDeviceIds = m_dbusInterface->devices(onlyReachable, onlyPaired);
pendingDeviceIds.waitForFinished(); pendingDeviceIds.waitForFinished();
if (pendingDeviceIds.isError()) return; if (pendingDeviceIds.isError()) {
kDebug(debugArea()) << pendingDeviceIds.error();
return;
}
const QStringList& deviceIds = pendingDeviceIds.value(); const QStringList& deviceIds = pendingDeviceIds.value();
Q_FOREACH(const QString& id, deviceIds) { Q_FOREACH(const QString& id, deviceIds) {

View file

@ -26,8 +26,10 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <KIcon> #include <KIcon>
#include "modeltest.h" #include <core/kdebugnamespace.h>
#include "kdebugnamespace.h"
//#include "modeltest.h"
NotificationsModel::NotificationsModel(QObject* parent) NotificationsModel::NotificationsModel(QObject* parent)
: QAbstractListModel(parent) : QAbstractListModel(parent)
@ -110,12 +112,14 @@ void NotificationsModel::refreshNotificationList()
} }
if (!m_dbusInterface->isValid()) { if (!m_dbusInterface->isValid()) {
kDebug(debugArea()) << "dbus interface not valid";
return; return;
} }
QDBusPendingReply<QStringList> pendingNotificationIds = m_dbusInterface->activeNotifications(); QDBusPendingReply<QStringList> pendingNotificationIds = m_dbusInterface->activeNotifications();
pendingNotificationIds.waitForFinished(); pendingNotificationIds.waitForFinished();
if (pendingNotificationIds.isError()) { if (pendingNotificationIds.isError()) {
kDebug(debugArea()) << pendingNotificationIds.error();
return; return;
} }
const QStringList& notificationIds = pendingNotificationIds.value(); const QStringList& notificationIds = pendingNotificationIds.value();
@ -205,7 +209,6 @@ bool NotificationsModel::isAnyDimissable() const
return false; return false;
} }
void NotificationsModel::dismissAll() void NotificationsModel::dismissAll()
{ {
Q_FOREACH (NotificationDbusInterface* notification, m_notificationList) { Q_FOREACH (NotificationDbusInterface* notification, m_notificationList) {