diff options
Diffstat (limited to 'ksmserver')
-rw-r--r-- | ksmserver/CMakeLists.txt | 5 | ||||
-rw-r--r-- | ksmserver/KSMServerInterface.h | 9 | ||||
-rw-r--r-- | ksmserver/Makefile.am | 6 | ||||
-rw-r--r-- | ksmserver/global.h | 4 | ||||
-rw-r--r-- | ksmserver/legacy.cpp | 2 | ||||
-rw-r--r-- | ksmserver/main.cpp | 8 | ||||
-rw-r--r-- | ksmserver/server.cpp | 69 | ||||
-rw-r--r-- | ksmserver/server.h | 32 | ||||
-rw-r--r-- | ksmserver/shutdown.cpp | 130 | ||||
-rw-r--r-- | ksmserver/shutdowndlg.cpp | 294 | ||||
-rw-r--r-- | ksmserver/shutdowndlg.h | 44 | ||||
-rwxr-xr-x[-rw-r--r--] | ksmserver/shutdownkonq.png | bin | 62689 -> 81087 bytes | |||
-rw-r--r-- | ksmserver/startup.cpp | 20 | ||||
-rw-r--r-- | ksmserver/startupdlg.cpp | 4 | ||||
-rw-r--r-- | ksmserver/startupdlg.h | 2 |
15 files changed, 284 insertions, 345 deletions
diff --git a/ksmserver/CMakeLists.txt b/ksmserver/CMakeLists.txt index 8578b01c1..aa6681f28 100644 --- a/ksmserver/CMakeLists.txt +++ b/ksmserver/CMakeLists.txt @@ -25,13 +25,10 @@ include_directories( ${CMAKE_SOURCE_DIR}/tdmlib ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS} - ${DBUS_TQT_INCLUDE_DIRS} - ${HAL_INCLUDE_DIRS} ) link_directories( ${TQT_LIBRARY_DIRS} - ${DBUS_TQT_LIBRARY_DIRS} ) @@ -50,5 +47,5 @@ tde_add_tdeinit_executable( ksmserver AUTOMOC main.cpp server.cpp shutdowndlg.cpp startupdlg.cpp legacy.cpp startup.cpp shutdown.cpp client.cpp KSMServerInterface.skel server.skel timed.ui - LINK dmctl-static tdeui-shared tdersync-shared ${HAL_LIBRARIES} ${DBUS_TQT_LIBRARIES} + LINK dmctl-static tdeui-shared tdersync-shared ${TDEHW_LIBRARIES} ) diff --git a/ksmserver/KSMServerInterface.h b/ksmserver/KSMServerInterface.h index a628b92ba..3645eb84a 100644 --- a/ksmserver/KSMServerInterface.h +++ b/ksmserver/KSMServerInterface.h @@ -10,6 +10,11 @@ class KSMServerInterface : virtual public DCOPObject k_dcop: virtual void logout(int, int, int ) = 0; + virtual void logoutTimed( int, int, TQString ) = 0; + virtual bool suspend(int) = 0; + + virtual TQStringList suspendOptions() = 0; + virtual void restoreSessionInternal() = 0; virtual void restoreSessionDoneInternal() = 0; virtual TQStringList sessionList() = 0; @@ -19,11 +24,11 @@ k_dcop: virtual void saveCurrentSessionAs( TQString ) = 0; virtual void autoStart2() = 0; - + virtual void suspendStartup( TQCString ) = 0; virtual void resumeStartup( TQCString ) = 0; - virtual void logoutTimed( int, int, TQString ) = 0; + virtual void reconfigure() = 0; }; #endif diff --git a/ksmserver/Makefile.am b/ksmserver/Makefile.am index 8f1a236e4..2c2fa237d 100644 --- a/ksmserver/Makefile.am +++ b/ksmserver/Makefile.am @@ -17,7 +17,7 @@ SUBDIRS = . -INCLUDES= -I$(top_srcdir)/tdmlib $(all_includes) $(HAL_INCS) $(DBUS_INCS) +INCLUDES= -I$(top_srcdir)/tdmlib $(all_includes) bin_PROGRAMS = lib_LTLIBRARIES = @@ -31,7 +31,7 @@ ksmserver_la_SOURCES = main.cpp server.cpp shutdowndlg.cpp \ KSMServerInterface.skel server.skel timed.ui ksmserver_la_LDFLAGS = $(all_libraries) -avoid-version -module -ksmserver_la_LIBADD = ../tdmlib/libdmctl.la $(LIB_TDEUI) $(HAL_LIBS) $(DBUS_LIBS) +ksmserver_la_LIBADD = ../tdmlib/libdmctl.la $(LIB_TDEUI) picsdir = $(kde_datadir)/ksmserver/pics pics_DATA = shutdownkonq.png @@ -44,7 +44,7 @@ updatedir = $(kde_datadir)/tdeconf_update EXTRA_PROGRAMS = testsh testsh_SOURCES = test.cpp timed.ui testsh_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor -testsh_LDADD = $(LIB_TDEUI) shutdowndlg.lo ../tdmlib/libdmctl.la $(HAL_LIBS) $(DBUS_LIBS) +testsh_LDADD = $(LIB_TDEUI) shutdowndlg.lo ../tdmlib/libdmctl.la messages: $(XGETTEXT) *.cpp -o $(podir)/ksmserver.pot diff --git a/ksmserver/global.h b/ksmserver/global.h index b76a8b363..326587ac6 100644 --- a/ksmserver/global.h +++ b/ksmserver/global.h @@ -10,8 +10,4 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org> #define KSMVendorString "KDE" #define KSMReleaseString "1.0" -#ifdef USE_QT4 -#define NO_QT3_DBUS_SUPPORT -#endif - #endif diff --git a/ksmserver/legacy.cpp b/ksmserver/legacy.cpp index 80f4e0984..1fbba6c3b 100644 --- a/ksmserver/legacy.cpp +++ b/ksmserver/legacy.cpp @@ -151,7 +151,7 @@ void KSMServer::performLegacySessionSave() ev.xclient.message_type = wm_protocols; ev.xclient.format = 32; ev.xclient.data.l[0] = wm_save_yourself; - ev.xclient.data.l[1] = GET_QT_X_TIME(); + ev.xclient.data.l[1] = get_tqt_x_time(); XSelectInput(newdisplay, w, PropertyChangeMask|StructureNotifyMask); XSendEvent(newdisplay, w, False, 0, &ev); } diff --git a/ksmserver/main.cpp b/ksmserver/main.cpp index 977ba02e0..d095b1df7 100644 --- a/ksmserver/main.cpp +++ b/ksmserver/main.cpp @@ -172,7 +172,7 @@ void sanity_check( int argc, char* argv[] ) } } -extern "C" KDE_EXPORT int kdemain( int argc, char* argv[] ) +extern "C" TDE_EXPORT int kdemain( int argc, char* argv[] ) { sanity_check(argc, argv); @@ -192,8 +192,8 @@ extern "C" KDE_EXPORT int kdemain( int argc, char* argv[] ) TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - kapp->dcopClient()->registerAs("ksmserver", false); - if (!kapp->dcopClient()->isRegistered()) + tdeApp->dcopClient()->registerAs("ksmserver", false); + if (!tdeApp->dcopClient()->isRegistered()) { tqWarning("[KSMServer] Could not register with DCOPServer. Aborting."); return 1; @@ -217,7 +217,7 @@ extern "C" KDE_EXPORT int kdemain( int argc, char* argv[] ) #endif KSMServer *server = new KSMServer( TQString::fromLatin1(wm), TQString::fromLatin1(wmaddargs), only_local); - kapp->dcopClient()->setDefaultObject( server->objId() ); + tdeApp->dcopClient()->setDefaultObject( server->objId() ); IceSetIOErrorHandler( IoErrorHandler ); diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index 505865c54..b41adc551 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -69,12 +69,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tdelocale.h> #include <tdeglobal.h> #include <tdeconfig.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <unistd.h> #include <tdeapplication.h> #include <kstaticdeleter.h> #include <tdetempfile.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <dcopclient.h> #include <dcopref.h> @@ -514,8 +514,8 @@ static void sighandler(int sig) delete server; } - if (kapp) { - kapp->quit(); + if (tdeApp) { + tdeApp->quit(); } //::exit(0); } @@ -599,13 +599,13 @@ KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManag clientInteracting = 0; xonCommand = config->readEntry( "xonCommand", "xon" ); -#ifdef __TDE_HAVE_TDEHWLIB +#ifdef WITH_TDEHWLIB hwDevices = TDEGlobal::hardwareDevices(); #endif - connect( &knotifyTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( knotifyTimeout())); - connect( &startupSuspendTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( startupSuspendTimeout())); - connect( &pendingShutdown, TQT_SIGNAL( timeout()), TQT_SLOT( pendingShutdownTimeout())); + connect( &knotifyTimeoutTimer, TQ_SIGNAL( timeout()), TQ_SLOT( knotifyTimeout())); + connect( &startupSuspendTimeoutTimer, TQ_SIGNAL( timeout()), TQ_SLOT( startupSuspendTimeout())); + connect( &pendingShutdown, TQ_SIGNAL( timeout()), TQ_SLOT( pendingShutdownTimeout())); only_local = _only_local; #ifdef HAVE__ICETRANSNOLISTEN @@ -676,7 +676,7 @@ KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManag for ( int i = 0; i < numTransports; i++) { con = new KSMListener( listenObjs[i] ); listener.append( con ); - connect( con, TQT_SIGNAL( activated(int) ), this, TQT_SLOT( newConnection(int) ) ); + connect( con, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( newConnection(int) ) ); } signal(SIGHUP, sighandler); @@ -684,11 +684,13 @@ KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManag signal(SIGINT, sighandler); signal(SIGPIPE, SIG_IGN); - connect( ¬ificationTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( notificationTimeout() ) ); - connect( &protectionTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( protectionTimerTick() ) ); - connect( &restoreTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( tryRestoreNext() ) ); - connect( &shutdownTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( timeoutQuit() ) ); - connect( kapp, TQT_SIGNAL( shutDown() ), this, TQT_SLOT( cleanUp() ) ); + connect( ¬ificationTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( notificationTimeout() ) ); + connect( &protectionTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( protectionTimerTick() ) ); + connect( &restoreTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( tryRestoreNext() ) ); + connect( &shutdownTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( timeoutQuit() ) ); + connect( tdeApp, TQ_SIGNAL( shutDown() ), this, TQ_SLOT( cleanUp() ) ); + + reconfigure(); } KSMServer::~KSMServer() @@ -697,6 +699,16 @@ KSMServer::~KSMServer() cleanUp(); } +void KSMServer::reconfigure() +{ + // respect lock on resume & disable suspend/hibernate settings + // from power-manager + TDEConfig cfg("power-managerrc"); + m_disableSuspend = cfg.readBoolEntry("disableSuspend", false); + m_disableHibernate = cfg.readBoolEntry("disableHibernate", false); + m_lockOnResume = cfg.readBoolEntry("lockOnResume", true); +} + void KSMServer::cleanUp() { if (clean) return; @@ -723,7 +735,7 @@ void KSMServer::cleanUp() DM().shutdown( shutdownType, shutdownMode, bootOption ); } else { -#ifdef __TDE_HAVE_TDEHWLIB +#ifdef WITH_TDEHWLIB TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); if (rootDevice) { if (shutdownType == TDEApplication::ShutdownTypeHalt) { @@ -742,7 +754,7 @@ void KSMServer::cleanUp() void* KSMServer::watchConnection( IceConn iceConn ) { KSMConnection* conn = new KSMConnection( iceConn ); - connect( conn, TQT_SIGNAL( activated(int) ), this, TQT_SLOT( processData(int) ) ); + connect( conn, TQ_SIGNAL( activated(int) ), this, TQ_SLOT( processData(int) ) ); return (void*) conn; } @@ -919,6 +931,29 @@ void KSMServer::storeSession() config->sync(); } +TQStringList KSMServer::suspendOptions() +{ + reconfigure(); + + TQStringList sopt; + +#ifdef WITH_TDEHWLIB + TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); + if (rootDevice->canFreeze() && !m_disableSuspend) + sopt << "freeze"; + + if (rootDevice->canSuspend() && !m_disableSuspend) + sopt << "suspend"; + + if (rootDevice->canHibernate() && !m_disableHibernate) + sopt << "hibernate"; + + if (rootDevice->canHybridSuspend() && !m_disableSuspend && !m_disableHibernate) + sopt << "hybridSuspend"; +#endif + + return sopt; +} TQStringList KSMServer::sessionList() { @@ -995,4 +1030,4 @@ bool KSMServer::defaultSession() const bool KSMServer::startupCompleted() { return m_startupCompleted; -} +}
\ No newline at end of file diff --git a/ksmserver/server.h b/ksmserver/server.h index 7273f057e..511013dc7 100644 --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -21,7 +21,7 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org> #include <tqtimer.h> #include <dcopobject.h> -#ifdef __TDE_HAVE_TDEHWLIB +#ifdef WITH_TDEHWLIB #include <tdehardwaredevices.h> #endif @@ -37,6 +37,17 @@ class KSMListener; class KSMConnection; class KSMClient; +namespace SuspendType { + enum SuspendType { + NotSpecified = 0, + Freeze, + Standby, // not implemented + Suspend, + Hibernate, + HybridSuspend + }; +}; + enum SMType { SM_ERROR, SM_WMCOMMAND, SM_WMSAVEYOURSELF }; struct SMData { @@ -49,7 +60,7 @@ typedef TQMap<WId,SMData> WindowMap; class KSMServer : public TQObject, public KSMServerInterface { -Q_OBJECT +TQ_OBJECT K_DCOP k_dcop: void notifySlot(TQString,TQString,TQString,TQString,TQString,int,int,int,int); @@ -103,6 +114,7 @@ public: public slots: void cleanUp(); + void reconfigure(); private slots: void newConnection( int socket ); @@ -172,6 +184,8 @@ private: TDEApplication::ShutdownMode sdmode, TQString bootOption = TQString::null ); + void suspendInternal(int state); + void performLegacySessionSave(); void storeLegacySession( TDEConfig* config ); void restoreLegacySession( TDEConfig* config ); @@ -186,12 +200,14 @@ private: void resumeStartupInternal(); // public dcop interface - void logout( int, int, int ); - virtual void logoutTimed( int, int, TQString ); + void logout(int, int, int); + virtual void logoutTimed(int, int, TQString); + bool suspend(int); + TQStringList suspendOptions(); TQStringList sessionList(); TQString currentSession(); void saveCurrentSession(); - void saveCurrentSessionAs( TQString ); + void saveCurrentSessionAs(TQString); TQWidget* startupNotifierIPDlg; TQWidget* shutdownNotifierIPDlg; @@ -240,6 +256,10 @@ private: TDEApplication::ShutdownType pendingShutdown_sdtype; TDEApplication::ShutdownMode pendingShutdown_sdmode; + bool m_disableSuspend; + bool m_disableHibernate; + bool m_lockOnResume; + // ksplash interface void upAndRunning( const TQString& msg ); void publishProgress( int progress, bool max = false ); @@ -253,7 +273,7 @@ private: WindowMap legacyWindows; -#ifdef __TDE_HAVE_TDEHWLIB +#ifdef WITH_TDEHWLIB TDEHardwareDevices* hwDevices; #endif int initialClientCount; diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index 8b14ceaf1..4b30d5cf4 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -69,12 +69,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tdelocale.h> #include <tdeglobal.h> #include <tdeconfig.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <unistd.h> #include <tdeapplication.h> #include <kstaticdeleter.h> #include <tdetempfile.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <dcopclient.h> #include <dcopref.h> #include <dmctl.h> @@ -152,7 +152,7 @@ bool KSMServer::checkStatus( bool &logoutConfirmed, bool &maysd, bool &mayrb, mayrb = true; } else { -#ifdef __TDE_HAVE_TDEHWLIB +#ifdef WITH_TDEHWLIB TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); if (rootDevice) { if (rootDevice->canPowerOff()) { @@ -222,45 +222,13 @@ void KSMServer::shutdownInternal( TDEApplication::ShutdownConfirm confirm, if ( !logoutConfirmed ) { int selection; KSMShutdownFeedback::start(); // make the screen gray - logoutConfirmed = - KSMShutdownDlg::confirmShutdown( maysd, mayrb, sdtype, bopt, &selection ); + logoutConfirmed = KSMShutdownDlg::confirmShutdown( maysd, mayrb, sdtype, bopt, &selection ); // ###### We can't make the screen remain gray while talking to the apps, // because this prevents interaction ("do you want to save", etc.) // TODO: turn the feedback widget into a list of apps to be closed, // with an indicator of the current status for each. KSMShutdownFeedback::stop(); // make the screen become normal again - if (selection != SuspendType::NotSpecified) { - // respect lock on resume & disable suspend/hibernate settings - // from power-manager - TDEConfig config("power-managerrc"); - bool lockOnResume = config.readBoolEntry("lockOnResume", true); - if (lockOnResume) { - TQCString replyType; - TQByteArray replyData; - // Block here until lock is complete - // If this is not done the desktop of the locked session will be shown after suspend/hibernate until the lock fully engages! - kapp->dcopClient()->call("kdesktop", "KScreensaverIface", "lock()", TQCString(""), replyType, replyData); - } -#ifdef __TDE_HAVE_TDEHWLIB - TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); - if (rootDevice) { - switch (selection) { - case SuspendType::Freeze: - rootDevice->setPowerState(TDESystemPowerState::Freeze); - break; - case SuspendType::Suspend: - rootDevice->setPowerState(TDESystemPowerState::Suspend); - break; - case SuspendType::Hibernate: - rootDevice->setPowerState(TDESystemPowerState::Hibernate); - break; - case SuspendType::HybridSuspend: - rootDevice->setPowerState(TDESystemPowerState::HybridSuspend); - break; - } - } -#endif - } + suspend(selection); } if ( logoutConfirmed ) { @@ -272,8 +240,8 @@ void KSMServer::shutdownInternal( TDEApplication::ShutdownConfirm confirm, if (showLogoutStatusDlg) { shutdownNotifierIPDlg = KSMShutdownIPDlg::showShutdownIP(); if (shutdownNotifierIPDlg) { - connect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); - connect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); + connect(shutdownNotifierIPDlg, TQ_SIGNAL(abortLogoutClicked()), this, TQ_SLOT(cancelShutdown())); + connect(shutdownNotifierIPDlg, TQ_SIGNAL(skipNotificationClicked()), this, TQ_SLOT(forceSkipSaveYourself())); static_cast<KSMShutdownIPDlg*>(shutdownNotifierIPDlg)->setStatusMessage(i18n("Notifying applications of logout request...")); notificationTimer.start( KSMSERVER_NOTIFICATION_MANUAL_OPTIONS_TIMEOUT, true ); } @@ -289,7 +257,7 @@ void KSMServer::shutdownInternal( TDEApplication::ShutdownConfirm confirm, // Set the real desktop background to black so that exit looks // clean regardless of what was on "our" desktop. if (!showLogoutStatusDlg) { - TQT_TQWIDGET(kapp->desktop())->setBackgroundColor( Qt::black ); + tdeApp->desktop()->setBackgroundColor( TQt::black ); } state = Shutdown; wmPhase1WaitingCount = 0; @@ -343,6 +311,70 @@ void KSMServer::shutdown( TDEApplication::ShutdownConfirm confirm, shutdownInternal( confirm, sdtype, sdmode ); } +void KSMServer::suspendInternal(int state) +{ + if (m_lockOnResume) { + TQCString replyType; + TQByteArray replyData; + // Block here until lock is complete + // If this is not done the desktop of the locked session will be shown after suspend/hibernate until the lock fully engages! + tdeApp->dcopClient()->call("kdesktop", "KScreensaverIface", "lock()", TQCString(""), replyType, replyData); + } + +#ifdef WITH_TDEHWLIB + TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); + rootDevice->setPowerState((TDESystemPowerState::TDESystemPowerState)state); +#endif +} + +bool KSMServer::suspend(int stype) +{ + if (stype == SuspendType::NotSpecified) + return false; + + reconfigure(); + +#ifdef WITH_TDEHWLIB + TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); + if (rootDevice) { + switch (stype) { + case SuspendType::Freeze: + if (rootDevice->canFreeze() && !m_disableSuspend) + { + suspendInternal(TDESystemPowerState::Freeze); + return true; + } + break; + + case SuspendType::Suspend: + if (rootDevice->canSuspend() && !m_disableSuspend) + { + suspendInternal(TDESystemPowerState::Suspend); + return true; + } + break; + + case SuspendType::Hibernate: + if (rootDevice->canHibernate() && !m_disableHibernate) + { + suspendInternal(TDESystemPowerState::Hibernate); + return true; + } + break; + + case SuspendType::HybridSuspend: + if (rootDevice->canHybridSuspend() && !m_disableSuspend && !m_disableHibernate) + { + suspendInternal(TDESystemPowerState::HybridSuspend); + return true; + } + break; + } + } +#endif + return false; +} + #include <tdemessagebox.h> void KSMServer::logoutTimed( int sdtype, int sdmode, TQString bootOption ) @@ -764,8 +796,8 @@ void KSMServer::completeShutdownOrCheckpoint() if (!shutdownNotifierIPDlg) { shutdownNotifierIPDlg = KSMShutdownIPDlg::showShutdownIP(); if (shutdownNotifierIPDlg) { - connect(shutdownNotifierIPDlg, SIGNAL(abortLogoutClicked()), this, SLOT(cancelShutdown())); - connect(shutdownNotifierIPDlg, SIGNAL(skipNotificationClicked()), this, SLOT(forceSkipSaveYourself())); + connect(shutdownNotifierIPDlg, TQ_SIGNAL(abortLogoutClicked()), this, TQ_SLOT(cancelShutdown())); + connect(shutdownNotifierIPDlg, TQ_SIGNAL(skipNotificationClicked()), this, TQ_SLOT(forceSkipSaveYourself())); } } while (!KSMShutdownIPFeedback::ispainted()) { @@ -801,12 +833,12 @@ void KSMServer::completeShutdownOrCheckpoint() if ( state == Shutdown ) { bool waitForKNotify = true; - if( !kapp->dcopClient()->connectDCOPSignal( "knotify", "", + if( !tdeApp->dcopClient()->connectDCOPSignal( "knotify", "", "notifySignal(TQString,TQString,TQString,TQString,TQString,int,int,int,int)", "ksmserver", "notifySlot(TQString,TQString,TQString,TQString,TQString,int,int,int,int)", false )) { waitForKNotify = false; } - if( !kapp->dcopClient()->connectDCOPSignal( "knotify", "", + if( !tdeApp->dcopClient()->connectDCOPSignal( "knotify", "", "playingFinished(int,int)", "ksmserver", "logoutSoundFinished(int,int)", false )) { waitForKNotify = false; @@ -876,14 +908,14 @@ void KSMServer::startKilling() kdDebug( 1218 ) << " We killed all clients. We have now clients.count()=" << clients.count() << endl; completeKilling(); - shutdownTimer.start( KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT, TRUE ); + shutdownTimer.start( KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT, true ); } void KSMServer::completeKilling() { // Activity detected; reset forcible shutdown timer... if (shutdownTimer.isActive()) { - shutdownTimer.start( KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT, TRUE ); + shutdownTimer.start( KSMSERVER_SHUTDOWN_CLIENT_UNRESPONSIVE_TIMEOUT, true ); } SHUTDOWN_MARKER("completeKilling"); kdDebug( 1218 ) << "KSMServer::completeKilling clients.count()=" << clients.count() << endl; @@ -963,7 +995,7 @@ void KSMServer::killWM() } if( iswm ) { completeKillingWM(); - TQTimer::singleShot( 5000, this, TQT_SLOT( timeoutWMQuit() ) ); + TQTimer::singleShot( 5000, this, TQ_SLOT( timeoutWMQuit() ) ); } else { killingCompleted(); @@ -992,7 +1024,7 @@ void KSMServer::killingCompleted() pid_t child; child = fork(); if (child != 0) { - kapp->quit(); + tdeApp->quit(); } else if (child == 0) { // If any remaining client(s) do not exit quickly (e.g. drkonqui) terminate so that they can be seen and interacted with @@ -1001,7 +1033,7 @@ void KSMServer::killingCompleted() } } else { - kapp->quit(); + tdeApp->quit(); } } diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index dc1d4dfcb..b8a91d3f4 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -6,7 +6,12 @@ Copyright (C) 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net> Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org> ******************************************************************/ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "shutdowndlg.h" +#include "server.h" #include <tqapplication.h> #include <tqlayout.h> @@ -33,7 +38,7 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org> #include <tdelocale.h> #include <tdeconfig.h> #include <tdeapplication.h> -#ifdef __TDE_HAVE_TDEHWLIB +#ifdef WITH_TDEHWLIB #include <tdehardwaredevices.h> #endif #include <kdebug.h> @@ -73,15 +78,15 @@ KSMShutdownFeedback::KSMShutdownFeedback() m_currentY( 0 ), m_grayOpacity( 0.0f ), m_compensation( 0.0f ), - m_fadeBackwards( FALSE ), + m_fadeBackwards( false ), m_unfadedImage(), m_grayImage(), m_fadeTime(), m_pmio(), - m_greyImageCreated( FALSE ) + m_greyImageCreated( false ) { - if (kapp->isX11CompositionAvailable()) { + if (tdeApp->isX11CompositionAvailable()) { m_grayImage = TQImage( TQApplication::desktop()->width(), TQApplication::desktop()->height(), 32 ); m_grayImage = m_grayImage.convertDepth(32); m_grayImage.setAlphaBuffer(false); @@ -101,14 +106,14 @@ KSMShutdownFeedback::KSMShutdownFeedback() m_unfadedImage = m_grayImage; resize(0, 0); setShown(true); - TQTimer::singleShot( 500, this, TQT_SLOT( slotPaintEffect() ) ); + TQTimer::singleShot( 500, this, TQ_SLOT( slotPaintEffect() ) ); } // called after stopping shutdown-feedback -> smooth fade-back to color-mode void KSMShutdownFeedback::fadeBack( void ) { m_fadeTime.restart(); - m_fadeBackwards = TRUE; + m_fadeBackwards = true; // its possible that we have to fade back, before all is completely gray, so we cannot start // with completely gray when fading back... m_compensation = 1.0f - m_grayOpacity; @@ -127,12 +132,12 @@ void KSMShutdownFeedback::slotPaintEffect() float doFancyLogoutFadeTime = (float)TDEConfigGroup(TDEGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutFadeTime", 4000); float doFancyLogoutFadeBackTime = (float)TDEConfigGroup(TDEGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutFadeBackTime", 1000); - if (kapp->isX11CompositionAvailable()) { + if (tdeApp->isX11CompositionAvailable()) { // We can do this in a different (simpler) manner because we have compositing support! // if slotPaintEffect() is called first time, we have to initialize the gray image // we also could do that in the constructor, but then the displaying of the // logout-UI would be too much delayed... - if ( m_greyImageCreated == false ) + if ( !m_greyImageCreated ) { m_greyImageCreated = true; @@ -165,11 +170,11 @@ void KSMShutdownFeedback::slotPaintEffect() } // return if fading is completely done... - if ( ( m_grayOpacity >= 1.0f && m_fadeBackwards == FALSE ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards == TRUE ) ) + if ( ( m_grayOpacity >= 1.0f && !m_fadeBackwards ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards ) ) return; - if ( m_fadeBackwards == FALSE ) + if ( !m_fadeBackwards ) { m_grayOpacity = m_fadeTime.elapsed() / doFancyLogoutFadeTime; if ( m_grayOpacity > 1.0f ) @@ -196,7 +201,7 @@ void KSMShutdownFeedback::slotPaintEffect() if( y2 > imgHeight ) y2 = imgHeight; - if( m_fadeBackwards == FALSE ) + if( !m_fadeBackwards ) { if( y1 > 0 && y1 < imgHeight && y1-m_rowsDone > 0 && m_rowsDone < imgHeight ) { @@ -239,13 +244,13 @@ void KSMShutdownFeedback::slotPaintEffect() bitBlt( this, 0, start_y1, &img ); } - TQTimer::singleShot( 5, this, TQT_SLOT( slotPaintEffect() ) ); + TQTimer::singleShot( 5, this, TQ_SLOT( slotPaintEffect() ) ); } else { // if slotPaintEffect() is called first time, we have to initialize the gray image // we also could do that in the constructor, but then the displaying of the // logout-UI would be too much delayed... - if ( m_greyImageCreated == false ) + if ( !m_greyImageCreated ) { m_greyImageCreated = true; @@ -273,11 +278,11 @@ void KSMShutdownFeedback::slotPaintEffect() } // return if fading is completely done... - if ( ( m_grayOpacity >= 1.0f && m_fadeBackwards == FALSE ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards == TRUE ) ) + if ( ( m_grayOpacity >= 1.0f && !m_fadeBackwards ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards ) ) return; - if ( m_fadeBackwards == FALSE ) + if ( !m_fadeBackwards ) { m_grayOpacity = m_fadeTime.elapsed() / doFancyLogoutFadeTime; if ( m_grayOpacity > 1.0f ) @@ -304,7 +309,7 @@ void KSMShutdownFeedback::slotPaintEffect() if( y2 > imgHeight ) y2 = imgHeight; - if( m_fadeBackwards == FALSE ) + if( !m_fadeBackwards ) { if( y1 > 0 && y1 < imgHeight && y1-m_rowsDone > 0 && m_rowsDone < imgHeight ) { @@ -366,18 +371,18 @@ void KSMShutdownFeedback::slotPaintEffect() bitBlt( this, 0, start_y1, &img ); } - TQTimer::singleShot( 5, this, TQT_SLOT( slotPaintEffect() ) ); + TQTimer::singleShot( 5, this, TQ_SLOT( slotPaintEffect() ) ); } } else { if (TDEConfigGroup(TDEGlobal::config(), "Logout").readBoolEntry("doFadeaway", true)) { // standard logout fade - if (kapp->isX11CompositionAvailable()) { + if (tdeApp->isX11CompositionAvailable()) { // We can do this in a different (simpler) manner because we have compositing support! // The end effect will be very similar to the old style logout float doFancyLogoutFadeTime = 1000; float doFancyLogoutFadeBackTime = 0; - if ( m_greyImageCreated == false ) { + if ( !m_greyImageCreated ) { m_greyImageCreated = true; // eliminate nasty flicker on first show @@ -409,11 +414,11 @@ void KSMShutdownFeedback::slotPaintEffect() } // return if fading is completely done... - if ( ( m_grayOpacity >= 1.0f && m_fadeBackwards == FALSE ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards == TRUE ) ) { + if ( ( m_grayOpacity >= 1.0f && !m_fadeBackwards ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards ) ) { return; } - if ( m_fadeBackwards == FALSE ) { + if ( !m_fadeBackwards ) { m_grayOpacity = m_fadeTime.elapsed() / doFancyLogoutFadeTime; if ( m_grayOpacity > 1.0f ) m_grayOpacity = 1.0f; @@ -440,7 +445,7 @@ void KSMShutdownFeedback::slotPaintEffect() y2 = imgHeight; } - if( m_fadeBackwards == FALSE ) + if( !m_fadeBackwards ) { if( y1 > 0 && y1 < imgHeight && y1-m_rowsDone > 0 && m_rowsDone < imgHeight ) { @@ -482,7 +487,7 @@ void KSMShutdownFeedback::slotPaintEffect() bitBlt( this, 0, start_y1, &img ); } - TQTimer::singleShot( 1, this, TQT_SLOT( slotPaintEffect() ) ); + TQTimer::singleShot( 1, this, TQ_SLOT( slotPaintEffect() ) ); } else { if ( m_currentY >= height() ) { @@ -507,13 +512,13 @@ void KSMShutdownFeedback::slotPaintEffect() KPixmap pixmap; pixmap = TQPixmap(TQPixmap::grabWindow( tqt_xrootwin(), 0, m_currentY, width(), 10 )); TQImage image = pixmap.convertToImage(); - KImageEffect::blend( Qt::black, image, 0.4 ); + KImageEffect::blend( TQt::black, image, 0.4 ); KImageEffect::toGray( image, true ); pixmap.convertFromImage( image ); bitBlt( this, 0, m_currentY, &pixmap ); bitBlt( &m_root, 0, m_currentY, &pixmap ); m_currentY += 10; - TQTimer::singleShot( 1, this, TQT_SLOT( slotPaintEffect() ) ); + TQTimer::singleShot( 1, this, TQ_SLOT( slotPaintEffect() ) ); } } } @@ -525,7 +530,7 @@ void KSMShutdownFeedback::slotPaintEffect() KSMShutdownIPFeedback * KSMShutdownIPFeedback::s_pSelf = 0L; KSMShutdownIPFeedback::KSMShutdownIPFeedback() -: TQWidget( 0L, "systemmodaldialogclass", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop ), m_timeout(0), m_isPainted(false), m_paintedFromSharedRootPixmap(false), m_sharedRootPixmap(NULL), mPixmapTimeout(0) +: TQWidget( 0L, "systemmodaldialogclass", TQt::WStyle_Customize | TQt::WStyle_NoBorder | TQt::WStyle_StaysOnTop ), m_timeout(0), m_isPainted(false), m_paintedFromSharedRootPixmap(false), m_sharedRootPixmap(NULL), mPixmapTimeout(0) { setShown(false); @@ -535,7 +540,7 @@ KSMShutdownIPFeedback::KSMShutdownIPFeedback() m_sharedRootPixmap = new KRootPixmap(this); m_sharedRootPixmap->setCustomPainting(true); - connect(m_sharedRootPixmap, TQT_SIGNAL(backgroundUpdated(const TQPixmap &)), this, TQT_SLOT(slotSetBackgroundPixmap(const TQPixmap &))); + connect(m_sharedRootPixmap, TQ_SIGNAL(backgroundUpdated(const TQPixmap &)), this, TQ_SLOT(slotSetBackgroundPixmap(const TQPixmap &))); if (TQPaintDevice::x11AppDepth() == 32) { // The shared pixmap is 24 bits, but we are 32 bits @@ -567,15 +572,15 @@ void KSMShutdownIPFeedback::showNow() if (!m_isPainted) { setGeometry( TQApplication::desktop()->geometry() ); - TQTimer::singleShot( 0, this, SLOT(slotPaintEffect()) ); + TQTimer::singleShot( 0, this, TQ_SLOT(slotPaintEffect()) ); } } void KSMShutdownIPFeedback::enableExports() { -#ifdef Q_WS_X11 +#ifdef TQ_WS_X11 kdDebug(270) << k_lineinfo << "activating background exports.\n"; - DCOPClient *client = kapp->dcopClient(); + DCOPClient *client = tdeApp->dcopClient(); if (!client->isAttached()) { client->attach(); } @@ -628,7 +633,7 @@ void KSMShutdownIPFeedback::slotPaintEffect() m_sharedRootPixmap->start(); } - TQTimer::singleShot( 100, this, SLOT(slotPaintEffect()) ); + TQTimer::singleShot( 100, this, TQ_SLOT(slotPaintEffect()) ); mPixmapTimeout++; return; } @@ -641,15 +646,15 @@ void KSMShutdownIPFeedback::slotPaintEffect() pm = TQPixmap(); } } - if ((pm.isNull()) || (pm.width() != kapp->desktop()->width()) || (pm.height() != kapp->desktop()->height())) { + if ((pm.isNull()) || (pm.width() != tdeApp->desktop()->width()) || (pm.height() != tdeApp->desktop()->height())) { if (mPixmapTimeout < 10) { - TQTimer::singleShot( 100, this, SLOT(slotPaintEffect()) ); + TQTimer::singleShot( 100, this, TQ_SLOT(slotPaintEffect()) ); mPixmapTimeout++; return; } else { - pm = TQPixmap(kapp->desktop()->width(), kapp->desktop()->height()); - pm.fill(Qt::black); + pm = TQPixmap(tdeApp->desktop()->width(), tdeApp->desktop()->height()); + pm.fill(TQt::black); m_paintedFromSharedRootPixmap = false; } } @@ -699,7 +704,7 @@ void KSMShutdownIPFeedback::slotPaintEffect() KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, bool maysd, bool mayrb, TDEApplication::ShutdownType sdtype, int* selection ) - : TQDialog( parent, 0, TRUE, (WFlags)WType_Popup ), targets(0), m_selection(selection) + : TQDialog( parent, 0, true, (WFlags)WType_Popup ), targets(0), m_selection(selection) // this is a WType_Popup on purpose. Do not change that! Not // having a popup here has severe side effects. @@ -753,7 +758,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, { // first line of buttons hbuttonbox = new TQHBoxLayout( hbox, factor * KDialog::spacingHint() ); - hbuttonbox->setAlignment( Qt::AlignHCenter ); + hbuttonbox->setAlignment( TQt::AlignHCenter ); // End session FlatButton* btnLogout = new FlatButton( frame ); btnLogout->setTextLabel( TQString("&") + i18n("Log out"), false ); @@ -762,7 +767,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, int i = btnLogout->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnLogout->setAccel( "ALT+" + btnLogout->textLabel().lower()[i+1] ) ; hbuttonbox->addWidget ( btnLogout ); - connect(btnLogout, TQT_SIGNAL(clicked()), TQT_SLOT(slotLogout())); + connect(btnLogout, TQ_SIGNAL(clicked()), TQ_SLOT(slotLogout())); } else { @@ -772,7 +777,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, hbox->addWidget( lfrm, AlignCenter ); buttonlay = new TQVBoxLayout( hbox, factor * KDialog::spacingHint() ); - buttonlay->setAlignment( Qt::AlignHCenter ); + buttonlay->setAlignment( TQt::AlignHCenter ); TQLabel* icon = new TQLabel( lfrm ); if (TDEConfigGroup(TDEGlobal::config(), "Logout").readBoolEntry("doNotUseKonqyPicture", false)) { @@ -790,13 +795,9 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, TQToolTip::add( btnLogout, i18n( "<qt><p>Log out of the current session to login as a different user.</p></qt>" ) ); btnFont = btnLogout->font(); buttonlay->addWidget( btnLogout ); - connect(btnLogout, TQT_SIGNAL(clicked()), TQT_SLOT(slotLogout())); + connect(btnLogout, TQ_SIGNAL(clicked()), TQ_SLOT(slotLogout())); } -#ifdef COMPILE_HALBACKEND - m_halCtx = NULL; -#endif - if ((maysd) || (mayrb)) { // respect lock on resume & disable suspend/hibernate settings @@ -804,77 +805,13 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, TDEConfig config("power-managerrc"); bool disableSuspend = config.readBoolEntry("disableSuspend", false); bool disableHibernate = config.readBoolEntry("disableHibernate", false); - m_lockOnResume = config.readBoolEntry("lockOnResume", true); bool canFreeze = false; bool canSuspend = false; bool canHibernate = false; bool canHybridSuspend = false; -#if defined(COMPILE_HALBACKEND) - // Query HAL for suspend/resume support - m_halCtx = libhal_ctx_new(); - - DBusError error; - dbus_error_init(&error); - m_dbusConn = dbus_connection_open_private(DBUS_SYSTEM_BUS, &error); - if (!m_dbusConn) - { - dbus_error_free(&error); - libhal_ctx_free(m_halCtx); - m_halCtx = NULL; - } - else - { - dbus_bus_register(m_dbusConn, &error); - if (dbus_error_is_set(&error)) - { - dbus_error_free(&error); - libhal_ctx_free(m_halCtx); - m_dbusConn = NULL; - m_halCtx = NULL; - } - else - { - libhal_ctx_set_dbus_connection(m_halCtx, m_dbusConn); - if (!libhal_ctx_init(m_halCtx, &error)) - { - if (dbus_error_is_set(&error)) - dbus_error_free(&error); - libhal_ctx_free(m_halCtx); - m_dbusConn = NULL; - m_halCtx = NULL; - } - } - } - - if (m_halCtx) - { - if (libhal_device_get_property_bool(m_halCtx, - "/org/freedesktop/Hal/devices/computer", - "power_management.can_suspend", - NULL)) - { - canSuspend = true; - } - - if (libhal_device_get_property_bool(m_halCtx, - "/org/freedesktop/Hal/devices/computer", - "power_management.can_hibernate", - NULL)) - { - canHibernate = true; - } - - if (libhal_device_get_property_bool(m_halCtx, - "/org/freedesktop/Hal/devices/computer", - "power_management.can_suspend_hybrid", - NULL)) - { - canHybridSuspend = true; - } - } -#elif defined(__TDE_HAVE_TDEHWLIB) // COMPILE_HALBACKEND +#if defined(WITH_TDEHWLIB) TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); if (rootDevice) { canFreeze = rootDevice->canFreeze(); @@ -888,7 +825,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, canHibernate = false; canHybridSuspend = false; } -#endif // COMPILE_HALBACKEND +#endif if(doUbuntuLogout) { // Ubuntu style logout window @@ -904,7 +841,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, int i = btnFreeze->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnFreeze->setAccel( "ALT+" + btnFreeze->textLabel().lower()[i+1] ) ; hbuttonbox->addWidget ( btnFreeze ); - connect(btnFreeze, TQT_SIGNAL(clicked()), TQT_SLOT(slotFreeze())); + connect(btnFreeze, TQ_SIGNAL(clicked()), TQ_SLOT(slotFreeze())); } if (canSuspend && !disableSuspend) @@ -920,7 +857,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, int i = btnSuspend->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnSuspend->setAccel( "ALT+" + btnSuspend->textLabel().lower()[i+1] ) ; hbuttonbox->addWidget ( btnSuspend ); - connect(btnSuspend, TQT_SIGNAL(clicked()), TQT_SLOT(slotSuspend())); + connect(btnSuspend, TQ_SIGNAL(clicked()), TQ_SLOT(slotSuspend())); } if (canHibernate && !disableHibernate) @@ -935,7 +872,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, int i = btnHibernate->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnHibernate->setAccel( "ALT+" + btnHibernate->textLabel().lower()[i+1] ) ; hbuttonbox->addWidget ( btnHibernate ); - connect(btnHibernate, TQT_SIGNAL(clicked()), TQT_SLOT(slotHibernate())); + connect(btnHibernate, TQ_SIGNAL(clicked()), TQ_SLOT(slotHibernate())); } if (canHybridSuspend && !disableSuspend && !disableHibernate) @@ -953,15 +890,15 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, int i = btnHybridSuspend->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnHybridSuspend->setAccel( "ALT+" + btnHybridSuspend->textLabel().lower()[i+1] ) ; hbuttonbox->addWidget ( btnHybridSuspend ); - connect(btnHybridSuspend, TQT_SIGNAL(clicked()), TQT_SLOT(slotHybridSuspend())); + connect(btnHybridSuspend, TQ_SIGNAL(clicked()), TQ_SLOT(slotHybridSuspend())); } - + // Separator (within buttonlay) vbox->addWidget( new KSeparator( frame ) ); // bottom buttons TQHBoxLayout* hbuttonbox2 = new TQHBoxLayout( vbox, factor * KDialog::spacingHint() ); - hbuttonbox2->setAlignment( Qt::AlignHCenter ); + hbuttonbox2->setAlignment( TQt::AlignHCenter ); if (mayrb) { // Reboot @@ -972,7 +909,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, int i = btnReboot->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnReboot->setAccel( "ALT+" + btnReboot->textLabel().lower()[i+1] ) ; hbuttonbox2->addWidget ( btnReboot); - connect(btnReboot, TQT_SIGNAL(clicked()), TQT_SLOT(slotReboot())); + connect(btnReboot, TQ_SIGNAL(clicked()), TQ_SLOT(slotReboot())); if ( sdtype == TDEApplication::ShutdownTypeReboot ) { btnReboot->setFocus(); } @@ -999,7 +936,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, } btnReboot->setPopup(targets); - connect( targets, TQT_SIGNAL(activated(int)), TQT_SLOT(slotReboot(int)) ); + connect( targets, TQ_SIGNAL(activated(int)), TQ_SLOT(slotReboot(int)) ); } // BAD KARMA .. this code is copied line by line from standard konqy dialog [EOF] } @@ -1013,7 +950,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, int i = btnHalt->textLabel().find( TQRegExp("\\&"), 0 ); // i == 1 btnHalt->setAccel( "ALT+" + btnHalt->textLabel().lower()[i+1] ) ; hbuttonbox2->addWidget ( btnHalt ); - connect(btnHalt, TQT_SIGNAL(clicked()), TQT_SLOT(slotHalt())); + connect(btnHalt, TQ_SIGNAL(clicked()), TQ_SLOT(slotHalt())); if ( sdtype == TDEApplication::ShutdownTypeHalt ) { btnHalt->setFocus(); } @@ -1021,12 +958,12 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, // cancel buttonbox TQHBoxLayout* hbuttonbox3 = new TQHBoxLayout( vbox, factor * KDialog::spacingHint() ); - hbuttonbox3->setAlignment( Qt::AlignRight ); + hbuttonbox3->setAlignment( TQt::AlignRight ); // Back to Desktop KSMPushButton* btnBack = new KSMPushButton( KStdGuiItem::cancel(), frame ); hbuttonbox3->addWidget( btnBack ); - connect(btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + connect(btnBack, TQ_SIGNAL(clicked()), TQ_SLOT(reject())); } else @@ -1038,7 +975,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, TQToolTip::add( btnHalt, i18n( "<qt><p>Log out of the current session and turn off the computer.</p></qt>" ) ); btnHalt->setFont( btnFont ); buttonlay->addWidget( btnHalt ); - connect(btnHalt, TQT_SIGNAL(clicked()), TQT_SLOT(slotHalt())); + connect(btnHalt, TQ_SIGNAL(clicked()), TQ_SLOT(slotHalt())); if ( sdtype == TDEApplication::ShutdownTypeHalt || getenv("TDM_AUTOLOGIN") ) { btnHalt->setFocus(); } @@ -1051,7 +988,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, btnReboot->setFont( btnFont ); buttonlay->addWidget( btnReboot ); - connect(btnReboot, TQT_SIGNAL(clicked()), TQT_SLOT(slotReboot())); + connect(btnReboot, TQ_SIGNAL(clicked()), TQ_SLOT(slotReboot())); if ( sdtype == TDEApplication::ShutdownTypeReboot ) { btnReboot->setFocus(); } @@ -1077,7 +1014,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, } btnReboot->setPopup(targets); - connect( targets, TQT_SIGNAL(activated(int)), TQT_SLOT(slotReboot(int)) ); + connect( targets, TQ_SIGNAL(activated(int)), TQ_SLOT(slotReboot(int)) ); } } @@ -1089,7 +1026,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, " almost instantly.</p><p>This correspond to ACPI S0 mode.</p></qt>")); btnFreeze->setFont( btnFont ); buttonlay->addWidget( btnFreeze ); - connect(btnFreeze, TQT_SIGNAL(clicked()), TQT_SLOT(slotFreeze())); + connect(btnFreeze, TQ_SIGNAL(clicked()), TQ_SLOT(slotFreeze())); } if (canSuspend && !disableSuspend) @@ -1101,7 +1038,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, "<p>Also known as Suspend-to-RAM mode.</p></qt>")); btnSuspend->setFont( btnFont ); buttonlay->addWidget( btnSuspend ); - connect(btnSuspend, TQT_SIGNAL(clicked()), TQT_SLOT(slotSuspend())); + connect(btnSuspend, TQ_SIGNAL(clicked()), TQ_SLOT(slotSuspend())); } if (canHibernate && !disableHibernate) @@ -1112,7 +1049,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, " considerable time is required to reactivate the system again.</p><p>This correspond to ACPI S4 mode.</p><p>Also known as Suspend-to-Disk mode.</p></qt>")); btnHibernate->setFont( btnFont ); buttonlay->addWidget( btnHibernate ); - connect(btnHibernate, TQT_SIGNAL(clicked()), TQT_SLOT(slotHibernate())); + connect(btnHibernate, TQ_SIGNAL(clicked()), TQ_SLOT(slotHibernate())); } if (canHybridSuspend && !disableSuspend && !disableHibernate) @@ -1126,9 +1063,9 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, "<p>Also known as Suspend-to-RAM + Suspend-to-Disk mode.</p></qt>")); btnHybridSuspend->setFont( btnFont ); buttonlay->addWidget( btnHybridSuspend ); - connect(btnHybridSuspend, TQT_SIGNAL(clicked()), TQT_SLOT(slotHybridSuspend())); + connect(btnHybridSuspend, TQ_SIGNAL(clicked()), TQ_SLOT(slotHybridSuspend())); } - + buttonlay->addStretch( 1 ); // Separator @@ -1137,7 +1074,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, // Back to Desktop KPushButton* btnBack = new KPushButton( KStdGuiItem::cancel(), frame ); buttonlay->addWidget( btnBack ); - connect(btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + connect(btnBack, TQ_SIGNAL(clicked()), TQ_SLOT(reject())); } } else { @@ -1146,13 +1083,13 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, { // cancel buttonbox TQHBoxLayout* hbuttonbox3 = new TQHBoxLayout( vbox, factor * KDialog::spacingHint() ); - hbuttonbox3->setAlignment( Qt::AlignRight ); + hbuttonbox3->setAlignment( TQt::AlignRight ); // Back to Desktop KSMPushButton* btnBack = new KSMPushButton( KStdGuiItem::cancel(), frame ); hbuttonbox3->addWidget( btnBack ); - connect(btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + connect(btnBack, TQ_SIGNAL(clicked()), TQ_SLOT(reject())); } else { @@ -1163,7 +1100,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, KPushButton* btnBack = new KPushButton( KStdGuiItem::cancel(), frame ); buttonlay->addWidget( btnBack ); - connect(btnBack, TQT_SIGNAL(clicked()), TQT_SLOT(reject())); + connect(btnBack, TQ_SIGNAL(clicked()), TQ_SLOT(reject())); } } } @@ -1171,15 +1108,6 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, KSMShutdownDlg::~KSMShutdownDlg() { -#ifdef COMPILE_HALBACKEND - if (m_halCtx) - { - DBusError error; - dbus_error_init(&error); - libhal_ctx_shutdown(m_halCtx, &error); - libhal_ctx_free(m_halCtx); - } -#endif } @@ -1216,46 +1144,13 @@ void KSMShutdownDlg::slotHalt() void KSMShutdownDlg::slotSuspend() { -#ifndef COMPILE_HALBACKEND *m_selection = SuspendType::Suspend; -#else - if (m_dbusConn) - { - DBusMessage *msg = dbus_message_new_method_call( - "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - "Suspend"); - - int wakeup=0; - dbus_message_append_args(msg, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID); - - dbus_connection_send(m_dbusConn, msg, NULL); - - dbus_message_unref(msg); - } -#endif reject(); // continue on resume } void KSMShutdownDlg::slotHibernate() { -#ifndef COMPILE_HALBACKEND *m_selection = SuspendType::Hibernate; -#else - if (m_dbusConn) - { - DBusMessage *msg = dbus_message_new_method_call( - "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - "Hibernate"); - - dbus_connection_send(m_dbusConn, msg, NULL); - - dbus_message_unref(msg); - } -#endif reject(); // continue on resume } @@ -1267,28 +1162,13 @@ void KSMShutdownDlg::slotFreeze() void KSMShutdownDlg::slotHybridSuspend() { -#ifndef COMPILE_HALBACKEND *m_selection = SuspendType::HybridSuspend; -#else - if (m_dbusConn) - { - DBusMessage *msg = dbus_message_new_method_call( - "org.freedesktop.Hal", - "/org/freedesktop/Hal/devices/computer", - "org.freedesktop.Hal.Device.SystemPowerManagement", - "SuspendHybrid"); - - dbus_connection_send(m_dbusConn, msg, NULL); - - dbus_message_unref(msg); - } -#endif reject(); // continue on resume } bool KSMShutdownDlg::confirmShutdown( bool maysd, bool mayrb, TDEApplication::ShutdownType& sdtype, TQString& bootOption, int* selection ) { - kapp->enableStyles(); + tdeApp->enableStyles(); KSMShutdownDlg* l = new KSMShutdownDlg( 0 /*KSMShutdownFeedback::self()*/, maysd, mayrb, sdtype, selection ); // Show dialog (will save the background in showEvent) @@ -1302,16 +1182,16 @@ bool KSMShutdownDlg::confirmShutdown( bool maysd, bool mayrb, TDEApplication::Sh delete l; - kapp->disableStyles(); + tdeApp->disableStyles(); return result; } TQWidget* KSMShutdownIPDlg::showShutdownIP() { - kapp->enableStyles(); + tdeApp->enableStyles(); KSMShutdownIPDlg* l = new KSMShutdownIPDlg( 0 ); - kapp->disableStyles(); + tdeApp->disableStyles(); return l; } @@ -1366,8 +1246,8 @@ KSMShutdownIPDlg::KSMShutdownIPDlg(TQWidget* parent) setNotificationActionButtonsSkipText(i18n("Skip Notification")); m_button2->setText(i18n("Abort Logout")); - connect(m_button1, SIGNAL(clicked()), this, SIGNAL(skipNotificationClicked())); - connect(m_button2, SIGNAL(clicked()), this, SIGNAL(abortLogoutClicked())); + connect(m_button1, TQ_SIGNAL(clicked()), this, TQ_SIGNAL(skipNotificationClicked())); + connect(m_button2, TQ_SIGNAL(clicked()), this, TQ_SIGNAL(abortLogoutClicked())); show(); setActiveWindow(); @@ -1384,10 +1264,10 @@ KSMDelayedPushButton::KSMDelayedPushButton( const KGuiItem &item, const char *name) : KPushButton( item, parent, name), pop(0), popt(0) { - connect(this, TQT_SIGNAL(pressed()), TQT_SLOT(slotPressed())); - connect(this, TQT_SIGNAL(released()), TQT_SLOT(slotReleased())); + connect(this, TQ_SIGNAL(pressed()), TQ_SLOT(slotPressed())); + connect(this, TQ_SIGNAL(released()), TQ_SLOT(slotReleased())); popt = new TQTimer(this); - connect(popt, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout())); + connect(popt, TQ_SIGNAL(timeout()), TQ_SLOT(slotTimeout())); } void KSMDelayedPushButton::setPopup(TQPopupMenu *p) @@ -1449,7 +1329,7 @@ KSMDelayedMessageBox::KSMDelayedMessageBox( TDEApplication::ShutdownType sdtype, } TQTimer *timer = new TQTimer( this ); timer->start( 1000 ); - connect( timer, TQT_SIGNAL( timeout() ), TQT_SLOT( updateText() ) ); + connect( timer, TQ_SIGNAL( timeout() ), TQ_SLOT( updateText() ) ); KDialog::centerOnScreen(this); } @@ -1466,7 +1346,7 @@ void KSMDelayedMessageBox::updateText() bool KSMDelayedMessageBox::showTicker( TDEApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay ) { - kapp->enableStyles(); + tdeApp->enableStyles(); KSMDelayedMessageBox msg( sdtype, bootOption, confirmDelay ); TQSize sh = msg.sizeHint(); TQRect rect = TDEGlobalSettings::desktopGeometry(TQCursor::pos()); @@ -1475,7 +1355,7 @@ bool KSMDelayedMessageBox::showTicker( TDEApplication::ShutdownType sdtype, cons rect.y() + (rect.height() - sh.height())/2); bool result = msg.exec(); - kapp->disableStyles(); + tdeApp->disableStyles(); return result; } @@ -1497,7 +1377,7 @@ switch ( e->key() ) case Key_Enter: case Key_Return: case Key_Space: - m_pressed = TRUE; + m_pressed = true; setDown(true); emit pressed(); break; @@ -1522,7 +1402,7 @@ void KSMPushButton::keyReleaseEvent( TQKeyEvent* e ) if ( m_pressed ) { setDown(false); - m_pressed = FALSE; + m_pressed = false; emit released(); emit clicked(); } @@ -1556,7 +1436,7 @@ void FlatButton::init() setUsesBigPixmap(true); setAutoRaise(true); setTextPosition( TQToolButton::Under ); - setFocusPolicy(TQ_StrongFocus); + setFocusPolicy(TQWidget::StrongFocus); } @@ -1567,7 +1447,7 @@ void FlatButton::keyPressEvent( TQKeyEvent* e ) case Key_Enter: case Key_Return: case Key_Space: - m_pressed = TRUE; + m_pressed = true; setDown(true); emit pressed(); break; @@ -1592,7 +1472,7 @@ void FlatButton::keyReleaseEvent( TQKeyEvent* e ) if ( m_pressed ) { setDown(false); - m_pressed = FALSE; + m_pressed = false; emit released(); emit clicked(); } diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h index 25ee60f77..5a9d652f2 100644 --- a/ksmserver/shutdowndlg.h +++ b/ksmserver/shutdowndlg.h @@ -18,7 +18,7 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org> #include <kguiitem.h> #include <tqtoolbutton.h> #include <krootpixmap.h> -#include <ntqprogressbar.h> +#include <tqprogressbar.h> class TQPushButton; class TQVButtonGroup; @@ -34,31 +34,10 @@ class TDEAction; #include <config.h> -#ifdef COMPILE_HALBACKEND - #ifndef NO_QT3_DBUS_SUPPORT - /* We acknowledge the the dbus API is unstable */ - #define DBUS_API_SUBJECT_TO_CHANGE - #include <dbus/connection.h> - #endif // NO_QT3_DBUS_SUPPORT - - #include <hal/libhal.h> -#endif // COMPILE_HALBACKEND - -namespace SuspendType { -enum SuspendType { - NotSpecified = 0, - Freeze, - Standby, - Suspend, - Hibernate, - HybridSuspend -}; -}; - // The (singleton) widget that makes/fades the desktop gray. class KSMShutdownFeedback : public TQWidget { - Q_OBJECT + TQ_OBJECT public: static void start() { s_pSelf = new KSMShutdownFeedback(); } @@ -92,7 +71,7 @@ private: // The (singleton) widget that shows either pretty pictures or a black screen during logout class KSMShutdownIPFeedback : public TQWidget { - Q_OBJECT + TQ_OBJECT public: static void start() { s_pSelf = new KSMShutdownIPFeedback(); } @@ -135,7 +114,7 @@ private: // The confirmation dialog class KSMShutdownDlg : public TQDialog { - Q_OBJECT + TQ_OBJECT public: static bool confirmShutdown( bool maysd, bool mayrb, TDEApplication::ShutdownType& sdtype, TQString& bopt, int* selection=0 ); @@ -159,18 +138,13 @@ private: TQString m_bootOption; TQPopupMenu *targets; TQStringList rebootOptions; -#ifdef COMPILE_HALBACKEND - LibHalContext* m_halCtx; - DBusConnection *m_dbusConn; -#endif - bool m_lockOnResume; int* m_selection; }; // The shutdown-in-progress dialog class KSMShutdownIPDlg : public KSMModalDialog { - Q_OBJECT + TQ_OBJECT public: static TQWidget* showShutdownIP(); @@ -196,7 +170,7 @@ private: class KSMDelayedPushButton : public KPushButton { - Q_OBJECT + TQ_OBJECT public: @@ -215,7 +189,7 @@ private: class KSMPushButton : public KPushButton { - Q_OBJECT + TQ_OBJECT public: @@ -235,7 +209,7 @@ private: class FlatButton : public TQToolButton { - Q_OBJECT + TQ_OBJECT public: @@ -264,7 +238,7 @@ class TQLabel; class KSMDelayedMessageBox : public TimedLogoutDlg { - Q_OBJECT + TQ_OBJECT public: KSMDelayedMessageBox( TDEApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay ); diff --git a/ksmserver/shutdownkonq.png b/ksmserver/shutdownkonq.png Binary files differindex aab647bee..fddefc63c 100644..100755 --- a/ksmserver/shutdownkonq.png +++ b/ksmserver/shutdownkonq.png diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp index fb9e696ec..8e02643eb 100644 --- a/ksmserver/startup.cpp +++ b/ksmserver/startup.cpp @@ -68,12 +68,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <tdelocale.h> #include <tdeglobal.h> #include <tdeconfig.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <unistd.h> #include <tdeapplication.h> #include <kstaticdeleter.h> #include <tdetempfile.h> -#include <kprocess.h> +#include <tdeprocess.h> #include <dcopclient.h> #include <dcopref.h> #include <twinmodule.h> @@ -87,8 +87,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kdebug.h> // shall we show a nice fancy login screen? -bool showFancyLogin = FALSE; -bool trinity_startup_main_sequence_done = FALSE; +bool showFancyLogin = false; +bool trinity_startup_main_sequence_done = false; /*! Restores the previous session. Ensures the window manager is running (if specified). @@ -145,7 +145,7 @@ void KSMServer::restoreSession( TQString sessionName ) if ((showFancyLogin) && (!startupNotifierIPDlg)) { startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP(); } - TQTimer::singleShot( 4000, this, TQT_SLOT( autoStart0() ) ); + TQTimer::singleShot( 4000, this, TQ_SLOT( autoStart0() ) ); } else { if ((showFancyLogin) && (!startupNotifierIPDlg)) { startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP(); @@ -192,7 +192,7 @@ void KSMServer::startDefaultSession() if ((showFancyLogin) && (!startupNotifierIPDlg)) { startupNotifierIPDlg = KSMStartupIPDlg::showStartupIP(); } - TQTimer::singleShot( 4000, this, TQT_SLOT( autoStart0() ) ); + TQTimer::singleShot( 4000, this, TQ_SLOT( autoStart0() ) ); } @@ -226,7 +226,7 @@ void KSMServer::autoStart0Done() connectDCOPSignal( "kcminit", "kcminit", "phase1Done()", "kcmPhase1Done()", true); state = KcmInitPhase1; - TQTimer::singleShot( 10000, this, TQT_SLOT( kcmPhase1Timeout())); // protection + TQTimer::singleShot( 10000, this, TQ_SLOT( kcmPhase1Timeout())); // protection DCOPRef( "kcminit", "kcminit" ).send( "runPhase1" ); } @@ -307,7 +307,7 @@ void KSMServer::tryRestoreNext() config->readEntry( TQString("userId")+n )); lastIdStarted = config->readEntry( TQString("clientId")+n ); if ( !lastIdStarted.isEmpty() ) { - restoreTimer.start( 2000, TRUE ); + restoreTimer.start( 2000, true ); return; // we get called again from the clientRegistered handler } } @@ -333,7 +333,7 @@ void KSMServer::autoStart2() DCOPRef( "kdesktop", "KDesktopIface" ).send( "runAutoStart" ); connectDCOPSignal( "kcminit", "kcminit", "phase2Done()", "kcmPhase2Done()", true); - TQTimer::singleShot( 10000, this, TQT_SLOT( kcmPhase2Timeout())); // protection + TQTimer::singleShot( 10000, this, TQ_SLOT( kcmPhase2Timeout())); // protection DCOPRef( "kcminit", "kcminit" ).send( "runPhase2" ); if( !defaultSession()) restoreLegacySession( TDEGlobal::config()); @@ -462,7 +462,7 @@ void KSMServer::upAndRunning( const TQString& msg ) if (startupNotifierIPDlg) { static_cast<KSMStartupIPDlg*>(startupNotifierIPDlg)->setStartupPhase(msg); if (msg == TQString("session ready")) { - trinity_startup_main_sequence_done = TRUE; + trinity_startup_main_sequence_done = true; } } DCOPRef( "ksplash" ).send( "upAndRunning", msg ); diff --git a/ksmserver/startupdlg.cpp b/ksmserver/startupdlg.cpp index e236ddfee..8bd196ab0 100644 --- a/ksmserver/startupdlg.cpp +++ b/ksmserver/startupdlg.cpp @@ -63,10 +63,10 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org> TQWidget* KSMStartupIPDlg::showStartupIP() { - kapp->enableStyles(); + tdeApp->enableStyles(); KSMStartupIPDlg* l = new KSMStartupIPDlg( 0 ); - kapp->disableStyles(); + tdeApp->disableStyles(); return l; } diff --git a/ksmserver/startupdlg.h b/ksmserver/startupdlg.h index a18a121d6..bc9327a09 100644 --- a/ksmserver/startupdlg.h +++ b/ksmserver/startupdlg.h @@ -34,7 +34,7 @@ class TDEAction; // The startup-in-progress dialog class KSMStartupIPDlg : public KSMModalDialog { - Q_OBJECT + TQ_OBJECT public: static TQWidget* showStartupIP(); |