void Ut_NotificationListModel::testSignalConnections() { NotificationListModel model; QCOMPARE(disconnect(NotificationManager::instance(), SIGNAL(notificationModified(uint)), &model, SLOT(updateNotification(uint))), true); QCOMPARE(disconnect(NotificationManager::instance(), SIGNAL(notificationRemoved(uint)), &model, SLOT(removeNotification(uint))), true); QCOMPARE(disconnect(&model, SIGNAL(clearRequested()), NotificationManager::instance(), SLOT(removeUserRemovableNotifications())), true); }
void Ut_NotificationPreviewPresenter::testSignalConnections() { NotificationPreviewPresenter presenter; QCOMPARE(disconnect(NotificationManager::instance(), SIGNAL(notificationModified(uint)), &presenter, SLOT(updateNotification(uint))), true); QCOMPARE(disconnect(NotificationManager::instance(), SIGNAL(notificationRemoved(uint)), &presenter, SLOT(removeNotification(uint))), true); QCOMPARE(disconnect(&presenter, SIGNAL(notificationPresented(uint)), presenter.notificationFeedbackPlayer, SLOT(addNotification(uint))), true); }
NotificationListModel::NotificationListModel(QObject *parent) : QObjectListModel(parent) { connect(NotificationManager::instance(), SIGNAL(notificationModified(uint)), this, SLOT(updateNotification(uint))); connect(NotificationManager::instance(), SIGNAL(notificationRemoved(uint)), this, SLOT(removeNotification(uint))); connect(this, SIGNAL(clearRequested()), NotificationManager::instance(), SLOT(removeUserRemovableNotifications())); QTimer::singleShot(0, this, SLOT(init())); }
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))); refreshNotificationList(); Q_EMIT deviceIdChanged(deviceId); }
NotificationPreviewPresenter::NotificationPreviewPresenter(QObject *parent) : QObject(parent), window(0), currentNotification(0), notificationFeedbackPlayer(new NotificationFeedbackPlayer(this)), locks(new MeeGo::QmLocks(this)), displayState(new MeeGo::QmDisplayState(this)) { connect(NotificationManager::instance(), SIGNAL(notificationModified(uint)), this, SLOT(updateNotification(uint))); connect(NotificationManager::instance(), SIGNAL(notificationRemoved(uint)), this, SLOT(removeNotification(uint))); connect(this, SIGNAL(notificationPresented(uint)), notificationFeedbackPlayer, SLOT(addNotification(uint))); QTimer::singleShot(0, this, SLOT(createWindowIfNecessary())); }
void Ut_Sysuid::cleanup() { delete sysuid; gStatusIndicatorMenuBusinessLogicStub->stubReset(); } void Ut_Sysuid::testInitialization() { QCOMPARE(gNotificationManagerStub->stubCallCount("initializeStore"), 1); } void Ut_Sysuid::testSignalConnections() { QVERIFY(disconnect(sysuid->statusIndicatorMenuBusinessLogic, SIGNAL(statusIndicatorMenuVisibilityChanged(bool)), sysuid, SLOT(updateCompositorNotificationSinkEnabledStatus()))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(notificationUpdated (const Notification &)), sysuid->mCompositorNotificationSink, SLOT(addNotification (const Notification &)))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(notificationRemoved(uint)), sysuid->mCompositorNotificationSink, SLOT(removeNotification(uint)))); QVERIFY(disconnect(sysuid->mCompositorNotificationSink, SIGNAL(notificationRemovalRequested(uint)), sysuid->notificationManager, SLOT(removeNotification(uint)))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(notificationUpdated (const Notification &)), sysuid->ngfNotificationSink, SLOT(addNotification (const Notification &)))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(notificationRemoved(uint)), sysuid->ngfNotificationSink, SLOT(removeNotification(uint)))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(notificationUpdated(const Notification &)), sysuid->notificationStatusIndicatorSink_, SLOT(addNotification(const Notification &)))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(notificationRemoved(uint)), sysuid->notificationStatusIndicatorSink_, SLOT(removeNotification(uint)))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(notificationRestored(const Notification &)), sysuid->notificationStatusIndicatorSink_, SLOT(addNotification(const Notification &)))); QVERIFY(disconnect(sysuid->notificationManager, SIGNAL(groupUpdated(uint, const NotificationParameters &)), sysuid->notificationStatusIndicatorSink_, SLOT(addGroup(uint, const NotificationParameters &)))); QVERIFY(disconnect(sysuid->screenLockBusinessLogic, SIGNAL(screenIsLocked(bool)), sysuid, SLOT(updateCompositorNotificationSinkEnabledStatus()))); QVERIFY(disconnect(sysuid->screenLockBusinessLogic, SIGNAL(screenIsLocked(bool)), sysuid->mCompositorNotificationSink, SLOT(setTouchScreenLockActive(bool)))); QVERIFY(disconnect(sysuid->screenLockBusinessLogic, SIGNAL(screenIsLocked(bool)), sysuid->batteryBusinessLogic, SLOT(setTouchScreenLockActive(bool)))); QVERIFY(disconnect(sysuid->usbUi, SIGNAL(dialogShown()), sysuid->screenLockBusinessLogic, SLOT(unlockScreen()))); #ifdef HAVE_QMSYSTEM QVERIFY(disconnect(&sysuid->qmLocks, SIGNAL(stateChanged (MeeGo::QmLocks::Lock, MeeGo::QmLocks::State)), sysuid, SLOT(updateCompositorNotificationSinkEnabledStatus()))); #endif
Sysuid::Sysuid(QObject* parent) : QObject(parent) { instance_ = this; // Load translations of System-UI loadTranslations(); // D-Bus registration QDBusConnection bus = QDBusConnection::sessionBus(); if (!bus.registerService(SYSTEMUI_DBUS_SERVICE)) { qCritical("Unable to register system-ui D-Bus service %s: %s", SYSTEMUI_DBUS_SERVICE, bus.lastError().message().toUtf8().constData()); abort(); } if (!bus.registerObject(SYSTEMUI_DBUS_PATH, instance())) { qCritical("Unable to register system-ui object at path %s: %s", SYSTEMUI_DBUS_PATH, bus.lastError().message().toUtf8().constData()); abort(); } // Initialize notification system notificationManager = new NotificationManager(NOTIFICATION_RELAY_INTERVAL); mCompositorNotificationSink = new MCompositorNotificationSink; ngfNotificationSink = new NGFNotificationSink; notificationStatusIndicatorSink_ = new NotificationStatusIndicatorSink; // Connect the notification signals for the compositor notification sink connect(notificationManager, SIGNAL(notificationUpdated(const Notification &)), mCompositorNotificationSink, SLOT(addNotification(const Notification &))); connect(notificationManager, SIGNAL(notificationRemoved(uint)), mCompositorNotificationSink, SLOT(removeNotification(uint))); connect(mCompositorNotificationSink, SIGNAL(notificationRemovalRequested(uint)), notificationManager, SLOT(removeNotification(uint))); // Connect the notification signals for the feedback notification sink connect(notificationManager, SIGNAL(notificationUpdated(const Notification &)), ngfNotificationSink, SLOT(addNotification(const Notification &))); connect(notificationManager, SIGNAL(notificationRemoved(uint)), ngfNotificationSink, SLOT(removeNotification(uint))); // Connect the notification signals for the notification status indicator sink connect(notificationManager, SIGNAL(notificationUpdated(const Notification &)), notificationStatusIndicatorSink_, SLOT(addNotification(const Notification &))); connect(notificationManager, SIGNAL(notificationRemoved(uint)), notificationStatusIndicatorSink_, SLOT(removeNotification(uint))); connect(notificationManager, SIGNAL(notificationRestored(const Notification &)), notificationStatusIndicatorSink_, SLOT(addNotification(const Notification &))); connect(notificationManager, SIGNAL(groupUpdated(uint, const NotificationParameters &)), notificationStatusIndicatorSink_, SLOT(addGroup(uint, const NotificationParameters &))); // Subscribe to a context property for getting information about the video recording status ContextFrameworkContext context; useMode = QSharedPointer<ContextItem>(context.createContextItem("/com/nokia/policy/camera")); useMode.data()->subscribe(); connect(useMode.data(), SIGNAL(contentsChanged()), this, SLOT(applyUseMode())); applyUseMode(); // Create shut down UI shutdownBusinessLogic = new ShutdownBusinessLogic(this); new ShutdownBusinessLogicAdaptor(this, shutdownBusinessLogic); // Create a status area renderer for rendering the shared status area pixmap statusAreaRenderer = new StatusAreaRenderer(this); new StatusAreaRendererAdaptor(statusAreaRenderer); bus.registerService("com.meego.core.MStatusBar"); bus.registerObject("/statusbar", statusAreaRenderer); // Create a status indicator menu statusIndicatorMenuBusinessLogic = new StatusIndicatorMenuBusinessLogic(this); connect(statusIndicatorMenuBusinessLogic, SIGNAL(statusIndicatorMenuVisibilityChanged(bool)), this, SLOT(updateCompositorNotificationSinkEnabledStatus())); new StatusIndicatorMenuAdaptor(statusIndicatorMenuBusinessLogic); bus.registerService("com.meego.core.MStatusIndicatorMenu"); bus.registerObject("/statusindicatormenu", statusIndicatorMenuBusinessLogic); // Create screen lock business logic screenLockBusinessLogic = new ScreenLockBusinessLogic(this); new ScreenLockBusinessLogicAdaptor(screenLockBusinessLogic); connect(screenLockBusinessLogic, SIGNAL(screenIsLocked(bool)), this, SLOT(updateCompositorNotificationSinkEnabledStatus())); connect(screenLockBusinessLogic, SIGNAL(screenIsLocked(bool)), mCompositorNotificationSink, SLOT(setTouchScreenLockActive(bool))); // MCE expects the service to be registered on the system bus QDBusConnection systemBus = QDBusConnection::systemBus(); if (!systemBus.registerService(SCREENLOCK_DBUS_SERVICE)) { qWarning("Unable to register screen lock D-Bus service %s: %s", SCREENLOCK_DBUS_SERVICE, systemBus.lastError().message().toUtf8().constData()); } if (!systemBus.registerObject(SCREENLOCK_DBUS_PATH, screenLockBusinessLogic)) { qWarning("Unable to register screen lock object at path %s: %s", SCREENLOCK_DBUS_PATH, systemBus.lastError().message().toUtf8().constData()); } // Update the enabled status of compositor notification sink based on screen and device locks #ifdef HAVE_QMSYSTEM connect(&qmLocks, SIGNAL(stateChanged(MeeGo::QmLocks::Lock, MeeGo::QmLocks::State)), this, SLOT(updateCompositorNotificationSinkEnabledStatus())); #endif updateCompositorNotificationSinkEnabledStatus(); // Create an extension area for the volume extension volumeExtensionArea = new MApplicationExtensionArea("com.meego.core.VolumeExtensionInterface/0.20"); volumeExtensionArea->setInProcessFilter(QRegExp("/sysuid-volume.desktop$")); volumeExtensionArea->setOutOfProcessFilter(QRegExp("$^")); volumeExtensionArea->init(); // Initialize notifications store after all the signal connections are made to the notification sinks but before any components that may send/remove notifications notificationManager->initializeStore(); // Create components that may create or remove notifications batteryBusinessLogic = new BatteryBusinessLogic(this); connect(screenLockBusinessLogic, SIGNAL(screenIsLocked(bool)), batteryBusinessLogic, SLOT(setTouchScreenLockActive(bool))); usbUi = new UsbUi(this); new DiskSpaceNotifier(this); // Unlock the touch screen lock when displaying the USB dialog connect(usbUi, SIGNAL(dialogShown()), screenLockBusinessLogic, SLOT(unlockScreen())); }