|
|
@ -30,6 +30,7 @@
|
|
|
|
#include <knotifydialog.h>
|
|
|
|
#include <knotifydialog.h>
|
|
|
|
#include <kpassivepopup.h>
|
|
|
|
#include <kpassivepopup.h>
|
|
|
|
#include <tdepopupmenu.h>
|
|
|
|
#include <tdepopupmenu.h>
|
|
|
|
|
|
|
|
#include <kglobalaccel.h>
|
|
|
|
|
|
|
|
|
|
|
|
// other TQt headers:
|
|
|
|
// other TQt headers:
|
|
|
|
#include <tqcursor.h>
|
|
|
|
#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(inactivityTimeExpired()), this, TQT_SLOT(do_downDimm()));
|
|
|
|
connect(autoDimm, TQT_SIGNAL(UserIsActiveAgain()), this, TQT_SLOT(do_upDimm()));
|
|
|
|
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->sync();
|
|
|
|
|
|
|
|
|
|
|
|
config_dialog_shown = false;
|
|
|
|
config_dialog_shown = false;
|
|
|
@ -1982,7 +1994,7 @@ void tdepowersave::handleActionCall ( action action, int value , bool checkAC, b
|
|
|
|
if (hwinfo->currentSessionIsActive()) {
|
|
|
|
if (hwinfo->currentSessionIsActive()) {
|
|
|
|
switch (action) {
|
|
|
|
switch (action) {
|
|
|
|
case GO_SHUTDOWN:
|
|
|
|
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 ) {
|
|
|
|
if ((checkAC && !hwinfo->getAcAdapter()) || !checkAC ) {
|
|
|
|
DCOPRef shutdown = DCOPRef( "ksmserver", "ksmserver" );
|
|
|
|
DCOPRef shutdown = DCOPRef( "ksmserver", "ksmserver" );
|
|
|
|
shutdown.send("logout", 0, 2, 2);
|
|
|
|
shutdown.send("logout", 0, 2, 2);
|
|
|
@ -1990,8 +2002,22 @@ void tdepowersave::handleActionCall ( action action, int value , bool checkAC, b
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case LOGOUT_DIALOG:
|
|
|
|
case LOGOUT_DIALOG:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DCOPRef shutdown = DCOPRef( "ksmserver", "ksmserver" );
|
|
|
|
// Do not display the logout dialog if the screen saver/lock system is active
|
|
|
|
shutdown.send("logout", 1, 2, 2);
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
case GO_SUSPEND2RAM:
|
|
|
|
case GO_SUSPEND2RAM:
|
|
|
|