libkdeconnect: Fixed some style issues.
Conflicts: libkdeconnect/devicesmodel.cpp libkdeconnect/devicesmodel.h libkdeconnect/notificationsmodel.cpp libkdeconnect/notificationsmodel.h
This commit is contained in:
parent
384b6d8be0
commit
8777cc9d76
4 changed files with 42 additions and 36 deletions
|
@ -55,7 +55,6 @@ DevicesModel::DevicesModel(QObject *parent)
|
|||
QHash<int, QByteArray> names = roleNames();
|
||||
names.insert(IdModelRole, "deviceId");
|
||||
setRoleNames(names);
|
||||
|
||||
}
|
||||
|
||||
DevicesModel::~DevicesModel()
|
||||
|
@ -83,6 +82,7 @@ void DevicesModel::deviceStatusChanged(const QString& id)
|
|||
//Q_EMIT dataChanged(index(0),index(rowCount()));
|
||||
refreshDeviceList();
|
||||
}
|
||||
|
||||
DevicesModel::StatusFlags DevicesModel::displayFilter() const
|
||||
{
|
||||
return m_displayFilter;
|
||||
|
@ -101,7 +101,6 @@ void DevicesModel::setDisplayFilter(DevicesModel::StatusFlags flags)
|
|||
|
||||
void DevicesModel::refreshDeviceList()
|
||||
{
|
||||
|
||||
if (!m_deviceList.isEmpty()) {
|
||||
beginRemoveRows(QModelIndex(), 0, m_deviceList.size() - 1);
|
||||
m_deviceList.clear();
|
||||
|
@ -130,7 +129,6 @@ void DevicesModel::refreshDeviceList()
|
|||
}
|
||||
|
||||
Q_EMIT dataChanged(index(0), index(m_deviceList.size()));
|
||||
|
||||
}
|
||||
|
||||
QVariant DevicesModel::data(const QModelIndex& index, int role) const
|
||||
|
@ -196,4 +194,3 @@ int DevicesModel::rowCount(const QModelIndex &parent) const
|
|||
|
||||
return m_deviceList.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#ifndef DEVICESMODEL_H
|
||||
#define DEVICESMODEL_H
|
||||
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractListModel>
|
||||
#include <QPixmap>
|
||||
|
|
|
@ -66,7 +66,10 @@ void NotificationsModel::setDeviceId(const QString& deviceId)
|
|||
{
|
||||
m_deviceId = deviceId;
|
||||
|
||||
if (m_dbusInterface) delete m_dbusInterface;
|
||||
if (m_dbusInterface) {
|
||||
delete m_dbusInterface;
|
||||
}
|
||||
|
||||
m_dbusInterface = new DeviceNotificationsDbusInterface(deviceId, this);
|
||||
|
||||
connect(m_dbusInterface, SIGNAL(notificationPosted(QString)),
|
||||
|
@ -95,7 +98,9 @@ void NotificationsModel::notificationRemoved(const QString& id)
|
|||
|
||||
void NotificationsModel::refreshNotificationList()
|
||||
{
|
||||
if (!m_dbusInterface) return;
|
||||
if (!m_dbusInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_notificationList.isEmpty()) {
|
||||
beginRemoveRows(QModelIndex(), 0, m_notificationList.size() - 1);
|
||||
|
@ -104,14 +109,20 @@ void NotificationsModel::refreshNotificationList()
|
|||
endRemoveRows();
|
||||
}
|
||||
|
||||
if (!m_dbusInterface->isValid()) return;
|
||||
if (!m_dbusInterface->isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QDBusPendingReply<QStringList> pendingNotificationIds = m_dbusInterface->activeNotifications();
|
||||
pendingNotificationIds.waitForFinished();
|
||||
if (pendingNotificationIds.isError()) return;
|
||||
if (pendingNotificationIds.isError()) {
|
||||
return;
|
||||
}
|
||||
const QStringList& notificationIds = pendingNotificationIds.value();
|
||||
|
||||
if (notificationIds.isEmpty()) return;
|
||||
if (notificationIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
beginInsertRows(QModelIndex(), 0, notificationIds.size() - 1);
|
||||
Q_FOREACH (const QString& notificationId, notificationIds) {
|
||||
|
@ -125,7 +136,6 @@ void NotificationsModel::refreshNotificationList()
|
|||
|
||||
QVariant NotificationsModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
|
||||
if (!index.isValid()
|
||||
|| index.row() < 0
|
||||
|| index.row() >= m_notificationList.count()
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
AppNameModelRole = Qt::UserRole + 1,
|
||||
IdModelRole = Qt::UserRole + 2,
|
||||
DismissableModelRole = Qt::UserRole + 3,
|
||||
DbusInterfaceRole = Qt::UserRole+4,
|
||||
DbusInterfaceRole = Qt::UserRole + 4
|
||||
};
|
||||
|
||||
NotificationsModel(QObject* parent = 0);
|
||||
|
|
Loading…
Reference in a new issue