|
|
|
@ -30,6 +30,7 @@
|
|
|
|
|
#include <knotifydialog.h>
|
|
|
|
|
#include <kpassivepopup.h>
|
|
|
|
|
#include <tdepopupmenu.h>
|
|
|
|
|
#include <kglobalaccel.h>
|
|
|
|
|
|
|
|
|
|
// other TQt headers:
|
|
|
|
|
#include <tqcursor.h>
|
|
|
|
@ -114,6 +115,17 @@ tdepowersave::tdepowersave( bool force_acpi_check, bool trace_func ) : KSystemTr
|
|
|
|
|
connect(autoDimm, TQT_SIGNAL(inactivityTimeExpired()), this, TQT_SLOT(do_downDimm()));
|
|
|
|
|
connect(autoDimm, TQT_SIGNAL(UserIsActiveAgain()), this, TQT_SLOT(do_upDimm()));
|
|
|
|
|
|
|
|
|
|
// connect to hotkeys
|
|
|
|
|
m_globalAccel = new TDEGlobalAccel( TQT_TQOBJECT(this) );
|
|
|
|
|
m_globalAccel->insert( "Power button", i18n( "Execute configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86PowerOff")), TDEShortcut(TQString("XF86PowerOff")), TQT_TQOBJECT(this), TQT_SLOT( handlePowerButtonEvent() ) );
|
|
|
|
|
m_globalAccel->insert( "Sleep button", i18n( "Sleep configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86Sleep")), TDEShortcut(TQString("XF86Sleep")), TQT_TQOBJECT(this), TQT_SLOT( handleSleepButtonEvent() ) );
|
|
|
|
|
m_globalAccel->insert( "Hibernate button", i18n( "Hibernate configured power button action"), TQString(),
|
|
|
|
|
TDEShortcut(TQString("XF86Suspend")), TDEShortcut(TQString("XF86Suspend")), TQT_TQOBJECT(this), TQT_SLOT( handleS2DiskButtonEvent() ) );
|
|
|
|
|
m_globalAccel->readSettings();
|
|
|
|
|
m_globalAccel->updateConnections();
|
|
|
|
|
|
|
|
|
|
config->sync();
|
|
|
|
|
|
|
|
|
|
config_dialog_shown = false;
|
|
|
|
@ -1982,7 +1994,7 @@ void tdepowersave::handleActionCall ( action action, int value , bool checkAC, b
|
|
|
|
|
if (hwinfo->currentSessionIsActive()) {
|
|
|
|
|
switch (action) {
|
|
|
|
|
case GO_SHUTDOWN:
|
|
|
|
|
// to be shure if we really need the shutdown
|
|
|
|
|
// confirm that we really need/want to shutdown
|
|
|
|
|
if ((checkAC && !hwinfo->getAcAdapter()) || !checkAC ) {
|
|
|
|
|
DCOPRef shutdown = DCOPRef( "ksmserver", "ksmserver" );
|
|
|
|
|
shutdown.send("logout", 0, 2, 2);
|
|
|
|
@ -1990,9 +2002,23 @@ void tdepowersave::handleActionCall ( action action, int value , bool checkAC, b
|
|
|
|
|
break;
|
|
|
|
|
case LOGOUT_DIALOG:
|
|
|
|
|
{
|
|
|
|
|
// Do not display the logout dialog if the screen saver/lock system is active
|
|
|
|
|
bool saving = true;
|
|
|
|
|
TQString _method;
|
|
|
|
|
DCOPRef dcop_ref = DCOPRef( "kdesktop", "KScreensaverIface" );
|
|
|
|
|
_method = "isBlanked()";
|
|
|
|
|
DCOPReply reply = dcop_ref.call(_method.latin1());
|
|
|
|
|
if ( reply.isValid() ) {
|
|
|
|
|
if (!reply.get(saving)) {
|
|
|
|
|
saving = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!saving) {
|
|
|
|
|
DCOPRef shutdown = DCOPRef( "ksmserver", "ksmserver" );
|
|
|
|
|
shutdown.send("logout", 1, 2, 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GO_SUSPEND2RAM:
|
|
|
|
|
TQTimer::singleShot(100, this, TQT_SLOT(do_suspend2ram()));
|
|
|
|
|