//Clears all the state information. void JsonDbSortingListModelPrivate::reset() { Q_Q(JsonDbSortingListModel); q->beginResetModel(); clearNotifications(); objects.clear(); objectUuids.clear(); objectSortValues.clear(); q->endResetModel(); emit q->rowCountChanged(0); state = JsonDbSortingListModel::None; emit q->stateChanged(state); }
void NotificationsModel::receivedNotifications(QDBusPendingCallWatcher* watcher) { watcher->deleteLater(); clearNotifications(); QDBusPendingReply<QStringList> pendingNotificationIds = *watcher; clearNotifications(); if (pendingNotificationIds.isError()) { qCWarning(KDECONNECT_INTERFACES) << pendingNotificationIds.error(); return; } const QStringList notificationIds = pendingNotificationIds.value(); if (notificationIds.isEmpty()) { return; } beginInsertRows(QModelIndex(), 0, notificationIds.size() - 1); Q_FOREACH (const QString& notificationId, notificationIds) { NotificationDbusInterface* dbusInterface = new NotificationDbusInterface(m_deviceId, notificationId, this); m_notificationList.append(dbusInterface); }
void NotificationsModel::refreshNotificationList() { if (!m_dbusInterface) { return; } clearNotifications(); if (!m_dbusInterface->isValid()) { qCWarning(KDECONNECT_INTERFACES) << "dbus interface not valid"; return; } QDBusPendingReply<QStringList> pendingNotificationIds = m_dbusInterface->activeNotifications(); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingNotificationIds, this); QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(receivedNotifications(QDBusPendingCallWatcher*))); }
void NotificationsModel::setDeviceId(const QString& deviceId) { m_deviceId = deviceId; if (m_dbusInterface) { delete m_dbusInterface; } m_dbusInterface = new DeviceNotificationsDbusInterface(deviceId, this); connect(m_dbusInterface, SIGNAL(notificationPosted(QString)), this, SLOT(notificationAdded(QString))); connect(m_dbusInterface, SIGNAL(notificationRemoved(QString)), this, SLOT(notificationRemoved(QString))); connect(m_dbusInterface, SIGNAL(allNotificationsRemoved()), this, SLOT(clearNotifications())); refreshNotificationList(); Q_EMIT deviceIdChanged(deviceId); }
TrayIcon::TrayIcon(MainWindow* parent) : QObject(parent) , MainWindow_(parent) , Icon_(new QSystemTrayIcon(this)) , Menu_(new ContextMenu(0)) , MessageAlert_(new RecentMessagesAlert(new Logic::RecentItemDelegate(this))) , Base_(new QIcon(":/resources/main_window/appicon.ico")) , Unreads_(new QIcon(":/resources/main_window/appicon_unread.ico")) #ifdef _WIN32 , TrayBase_(new QIcon(":/resources/main_window/appicon_tray.ico")) , TrayUnreads_(new QIcon(":/resources/main_window/appicon_tray_unread.ico")) #else , TrayBase_(new QIcon(":/resources/main_window/appicon.ico")) , TrayUnreads_(new QIcon(":/resources/main_window/appicon_unread.ico")) #endif //_WIN32 , TaskBarOverlay_(new QPixmap(":/resources/main_window/appicon_overlay.png")) , HaveUnreads_(false) #ifdef _WIN32 , ptbl(0) #endif //_WIN32 { #ifdef _WIN32 if (QSysInfo().windowsVersion() >= QSysInfo::WV_WINDOWS7) { HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&ptbl)); if (FAILED(hr)) ptbl = 0; } #endif //_WIN32 init(); connect(Ui::GetDispatcher(), SIGNAL(login_complete()), this, SLOT(loggedIn()), Qt::QueuedConnection); connect(MessageAlert_, SIGNAL(messageClicked(QString)), this, SLOT(messageClicked(QString)), Qt::QueuedConnection); connect(Logic::GetContactListModel(), SIGNAL(selectedContactChanged(QString)), this, SLOT(clearNotifications(QString)), Qt::QueuedConnection); connect(Logic::GetContactListModel(), SIGNAL(contactChanged(QString)), this, SLOT(updateIcon()), Qt::QueuedConnection); connect(Ui::GetDispatcher(), SIGNAL(myInfo()), this, SLOT(myInfo())); connect(Ui::GetDispatcher(), SIGNAL(needLogin()), this, SLOT(loggedOut()), Qt::QueuedConnection); }
void WebNotificationManagerProxy::clearNotifications(WebPageProxy* webPage, const Vector<uint64_t>& pageNotificationIDs) { clearNotifications(webPage, pageNotificationIDs, pageAndNotificationIDsMatch); }
void WebNotificationManagerProxy::clearNotifications(WebPageProxy* webPage) { clearNotifications(webPage, Vector<uint64_t>(), pageIDsMatch); }
JsonDbSortingListModelPrivate::~JsonDbSortingListModelPrivate() { // Why do we need to do this while destroying the object clearNotifications(); }