summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kcontrol/keys/main.cpp1
-rw-r--r--kcontrol/keys/shortcuts.cpp1
-rw-r--r--kdesktop/desktop.cpp28
-rw-r--r--kdesktop/desktop.h4
-rw-r--r--kdesktop/kdesktopbindings.cpp21
5 files changed, 53 insertions, 2 deletions
diff --git a/kcontrol/keys/main.cpp b/kcontrol/keys/main.cpp
index bba777adb..db7416c28 100644
--- a/kcontrol/keys/main.cpp
+++ b/kcontrol/keys/main.cpp
@@ -26,6 +26,7 @@
#include <kdebug.h>
#include <tdelocale.h>
#include <ksimpleconfig.h>
+#include <dcopref.h>
#include "commandShortcuts.h"
#include "main.h"
diff --git a/kcontrol/keys/shortcuts.cpp b/kcontrol/keys/shortcuts.cpp
index 18f6803ab..4fb58a9b5 100644
--- a/kcontrol/keys/shortcuts.cpp
+++ b/kcontrol/keys/shortcuts.cpp
@@ -41,6 +41,7 @@
#include <tdeshortcutlist.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
+#include <dcopref.h>
ShortcutsModule::ShortcutsModule( TQWidget *parent, const char *name )
: TQWidget( parent, name )
diff --git a/kdesktop/desktop.cpp b/kdesktop/desktop.cpp
index e7681b1f2..fac03a185 100644
--- a/kdesktop/desktop.cpp
+++ b/kdesktop/desktop.cpp
@@ -113,7 +113,7 @@ bool KRootWidget::eventFilter ( TQObject *, TQEvent * e )
else if ( e->type() == TQEvent::Drop )
{
TQDropEvent* de = static_cast<TQDropEvent*>( e );
- if ( KColorDrag::canDecode( de ) )
+ if ( KColorDrag::canDecode( de ) )
emit colorDropEvent( de );
else if ( TQImageDrag::canDecode( de ) )
emit imageDropEvent( de );
@@ -215,7 +215,7 @@ KDesktop::initRoot()
Display *dpy = tqt_xdisplay();
Window root = RootWindow(dpy, kdesktop_screen_number);
XDefineCursor(dpy, root, cursor().handle());
-
+
m_bDesktopEnabled = KDesktopSettings::desktopEnabled();
if ( !m_bDesktopEnabled && !m_pRootWidget )
{
@@ -1064,6 +1064,30 @@ void KDesktop::slotRebootNoCnf()
TDEApplication::ShutdownTypeReboot );
}
+void KDesktop::slotFreeze()
+{
+ DCOPRef r("ksmserver", "ksmserver");
+ r.send("suspend", 1);
+}
+
+void KDesktop::slotSuspend()
+{
+ DCOPRef r("ksmserver", "ksmserver");
+ r.send("suspend", 3);
+}
+
+void KDesktop::slotHibernate()
+{
+ DCOPRef r("ksmserver", "ksmserver");
+ r.send("suspend", 4);
+}
+
+void KDesktop::slotHybridSuspend()
+{
+ DCOPRef r("ksmserver", "ksmserver");
+ r.send("suspend", 5);
+}
+
void KDesktop::setVRoot( bool enable )
{
if ( enable == set_vroot )
diff --git a/kdesktop/desktop.h b/kdesktop/desktop.h
index c85e8b577..ca1eefc61 100644
--- a/kdesktop/desktop.h
+++ b/kdesktop/desktop.h
@@ -135,6 +135,10 @@ private slots:
void slotLogoutNoCnf();
void slotHaltNoCnf();
void slotRebootNoCnf();
+ void slotFreeze();
+ void slotSuspend();
+ void slotHibernate();
+ void slotHybridSuspend();
/** Connected to KSycoca */
void slotDatabaseChanged();
diff --git a/kdesktop/kdesktopbindings.cpp b/kdesktop/kdesktopbindings.cpp
index 17b27fc65..5f4fb24cd 100644
--- a/kdesktop/kdesktopbindings.cpp
+++ b/kdesktop/kdesktopbindings.cpp
@@ -49,6 +49,27 @@
}
#endif
+ // Only add these options if supported by ksmserver
+ DCOPRef ksmref("ksmserver", "ksmserver");
+ DCOPReply reply = ksmref.call("suspendOptions");
+
+ TQStringList suspendOptions;
+ if (reply.isValid()) {
+ reply.get(suspendOptions);
+ }
+
+ if (suspendOptions.contains("freeze"))
+ DEF( I18N_NOOP("Freeze"), TDEShortcut(), TDEShortcut(), slotFreeze() );
+
+ if (suspendOptions.contains("suspend"))
+ DEF( I18N_NOOP("Suspend"), TDEShortcut(TQString("XF86Sleep")), TDEShortcut(TQString("XF86Sleep")), slotSuspend() );
+
+ if (suspendOptions.contains("hibernate"))
+ DEF( I18N_NOOP("Hibernate"), TDEShortcut(), TDEShortcut(), slotHibernate() );
+
+ if (suspendOptions.contains("hybridSuspend"))
+ DEF( I18N_NOOP("Hybrid Suspend"), TDEShortcut(), TDEShortcut(), slotHybridSuspend() );
+
#undef DEF
#undef DEF2
#undef WIN