void SystemMonitor::initialize() { d = new SystemMonitorPrivate(this); QAbstractEventDispatcher::instance()->installNativeEventFilter(d); connect(&d->network, SIGNAL(online()), this, SIGNAL(online())); connect(&d->network, SIGNAL(offline()), this, SIGNAL(offline())); connect(&d->screen, SIGNAL(screenLocked()), this, SIGNAL(screenLocked())); connect(&d->screen, SIGNAL(screenUnlocked()), this, SIGNAL(screenUnlocked())); connect(&d->screen, SIGNAL(screenSaverStarted()), this, SIGNAL(screenSaverStarted())); connect(&d->screen, SIGNAL(screenSaverStopped()), this, SIGNAL(screenSaverStopped())); }
Amor::Amor() : mAmor( 0 ), mBubble( 0 ), mForceHideAmorWidget( false ) { new AmorAdaptor( this ); QDBusConnection::sessionBus().registerObject( QLatin1String( "/Amor" ), this ); if( !readConfig() ) { qApp->quit(); } mTargetWin = 0; mNextTarget = 0; mAmorDialog = 0; mMenu = 0; mCurrAnim = mBaseAnim; mPosition = mCurrAnim->hotspot().x(); mState = Normal; mWin = KWindowSystem::self(); connect( mWin, SIGNAL(activeWindowChanged(WId)), this, SLOT(slotWindowActivate(WId)) ); connect( mWin, SIGNAL(windowRemoved(WId)), this, SLOT(slotWindowRemove(WId)) ); connect( mWin, SIGNAL(stackingOrderChanged()), this, SLOT(slotStackingChanged()) ); connect( mWin, SIGNAL(windowChanged(WId,const ulong*)), this, SLOT(slotWindowChange(WId,const ulong*)) ); connect( mWin, SIGNAL(currentDesktopChanged(int)), this, SLOT(slotDesktopChange(int)) ); mAmor = new AmorWidget; connect( mAmor, SIGNAL(mouseClicked(QPoint)), SLOT(slotMouseClicked(QPoint)) ); connect( mAmor, SIGNAL(dragged(QPoint,bool)), SLOT(slotWidgetDragged(QPoint,bool)) ); mAmor->resize(mTheme.maximumSize()); mTimer = new QTimer( this ); connect( mTimer, SIGNAL(timeout()), SLOT(slotTimeout()) ); mStackTimer = new QTimer( this ); connect( mStackTimer, SIGNAL(timeout()), SLOT(restack()) ); mBubbleTimer = new QTimer( this ); connect( mBubbleTimer, SIGNAL(timeout()), SLOT(slotBubbleTimeout()) ); std::time( &mActiveTime ); mCursPos = QCursor::pos(); mCursorTimer = new QTimer( this ); connect( mCursorTimer, SIGNAL(timeout()), SLOT(slotCursorTimeout()) ); mCursorTimer->start( 500 ); if( mWin->activeWindow() ) { mNextTarget = mWin->activeWindow(); selectAnimation( Focus ); mTimer->setSingleShot( true ); mTimer->start( 0 ); } if( !QDBusConnection::sessionBus().connect( QString(), QString(), QLatin1String( "org.kde.amor" ), QLatin1String( "KDE_stop_screensaver" ), this, SLOT(screenSaverStopped()) ) ) { kDebug(10000) << "Could not attach DBus signal: KDE_stop_screensaver()"; } if( !QDBusConnection::sessionBus().connect( QString(), QString(), QLatin1String( "org.kde.amor" ), QLatin1String( "KDE_start_screensaver" ), this, SLOT(screenSaverStarted()) ) ) { kDebug(10000) << "Could not attach DBus signal: KDE_start_screensaver()"; } KStartupInfo::appStarted(); }