MWidgetAvialability::MWidgetAvialability(QGraphicsItem *parent): MWidget(parent) { m_layout = new MLayout(this); m_layout->setContentsMargins(0,0,0,0); m_layout->setMaximumWidth(480); m_mainLayout = new MFlowLayoutPolicy(m_layout); m_mainLayout->setContentsMargins(10,0,0,0); m_mainLayout->setSpacing(12); m_mainLayout->setVerticalSpacing(16); registerDBusObject(); Tp::registerTypes(); const QDBusConnection &bus = QDBusConnection::sessionBus(); accountFactory = Tp::AccountFactory::create(bus, Tp::Features() << Tp::Account::FeatureCore << Tp::Account::FeatureAvatar << Tp::Account::FeatureCapabilities << Tp::Account::FeatureProfile << Tp::Account::FeatureProtocolInfo); connectionFactory = Tp::ConnectionFactory::create(bus, Tp::Features() << Tp::Connection::FeatureConnected << Tp::Connection::FeatureCore << Tp::Connection::FeatureRoster << Tp::Connection::FeatureSimplePresence << Tp::Connection::FeatureRosterGroups); channelFactory = Tp::ChannelFactory::create(bus); contactFactory = Tp::ContactFactory::create( Tp::Features() << Tp::Contact::FeatureAlias << Tp::Contact::FeatureAvatarToken << Tp::Contact::FeatureAvatarData << Tp::Contact::FeatureSimplePresence << Tp::Contact::FeatureInfo << Tp::Contact::FeatureLocation << Tp::Contact::FeatureCapabilities); mAM = Tp::AccountManager::create(bus, accountFactory, connectionFactory, channelFactory, contactFactory); connect(mAM->becomeReady(Tp::AccountManager::FeatureCore), SIGNAL(finished(Tp::PendingOperation*)), SLOT(onReadyLoad(Tp::PendingOperation*))); }
HomeApplication::HomeApplication(int &argc, char **argv, const QString &qmlPath) : QGuiApplication(argc, argv) , _mainWindowInstance(0) , _qmlPath(qmlPath) , originalSigIntHandler(signal(SIGINT, quitSignalHandler)) , originalSigTermHandler(signal(SIGTERM, quitSignalHandler)) , updatesEnabled(true) , homeReadySent(false) , onUpdatesDisabledUnfocusedWindowId(0) { setApplicationName("Lipstick"); // TODO: autogenerate this from tags setApplicationVersion(VERSION); QTranslator *engineeringEnglish = new QTranslator(this); engineeringEnglish->load("lipstick_eng_en", "/usr/share/translations"); installTranslator(engineeringEnglish); QTranslator *translator = new QTranslator(this); translator->load(QLocale(), "lipstick", "-", "/usr/share/translations"); installTranslator(translator); // Initialize the QML engine qmlEngine = new QQmlEngine(this); // Initialize the notification manager NotificationManager::instance(); new NotificationPreviewPresenter(this); // Create screen lock logic - not parented to "this" since destruction happens too late in that case screenLock = new ScreenLock; LipstickSettings::instance()->setScreenLock(screenLock); new ScreenLockAdaptor(screenLock); deviceLock = new DeviceLock(this); new DeviceLockAdaptor(deviceLock); volumeControl = new VolumeControl; new BatteryNotifier(this); new DiskSpaceNotifier(this); new ThermalNotifier(this); usbModeSelector = new USBModeSelector(this); connect(usbModeSelector, SIGNAL(dialogShown()), screenLock, SLOT(unlockScreen())); shutdownScreen = new ShutdownScreen(this); new ShutdownScreenAdaptor(shutdownScreen); connectionSelector = new ConnectionSelector(this); // MCE and usb-moded expect services to be registered on the system bus QDBusConnection systemBus = QDBusConnection::systemBus(); if (!systemBus.registerService(LIPSTICK_DBUS_SERVICE_NAME)) { qWarning("Unable to register D-Bus service %s: %s", LIPSTICK_DBUS_SERVICE_NAME, systemBus.lastError().message().toUtf8().constData()); } new HomeApplicationAdaptor(this); registerDBusObject(systemBus, LIPSTICK_DBUS_PATH, this); registerDBusObject(systemBus, LIPSTICK_DBUS_SCREENLOCK_PATH, screenLock); registerDBusObject(systemBus, LIPSTICK_DBUS_DEVICELOCK_PATH, deviceLock); registerDBusObject(systemBus, LIPSTICK_DBUS_SHUTDOWN_PATH, shutdownScreen); ScreenshotService *screenshotService = new ScreenshotService(this); new ScreenshotServiceAdaptor(screenshotService); QDBusConnection sessionBus = QDBusConnection::sessionBus(); registerDBusObject(sessionBus, LIPSTICK_DBUS_SCREENSHOT_PATH, screenshotService); connect(this, SIGNAL(homeReady()), this, SLOT(sendStartupNotifications())); }