summaryrefslogtreecommitdiffstats
path: root/ksmserver/shutdowndlg.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-05-20 18:22:04 -0500
committerTimothy Pearson <[email protected]>2012-05-20 18:22:04 -0500
commit193d9afcdb186902317c5bef5d6c769fc8933f1a (patch)
tree7634b1ddfbef08527a9fc55841ccbbdac2de7cae /ksmserver/shutdowndlg.cpp
parent2f2f32d31cb1548defcd7aa84187ac7df6479cce (diff)
downloadtdebase-193d9afcdb186902317c5bef5d6c769fc8933f1a.tar.gz
tdebase-193d9afcdb186902317c5bef5d6c769fc8933f1a.zip
Fix desktop lock not engaging on suspend
This closes Bug 1003
Diffstat (limited to 'ksmserver/shutdowndlg.cpp')
-rw-r--r--ksmserver/shutdowndlg.cpp59
1 files changed, 15 insertions, 44 deletions
diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp
index 35cae6537..3b1e27f68 100644
--- a/ksmserver/shutdowndlg.cpp
+++ b/ksmserver/shutdowndlg.cpp
@@ -674,14 +674,17 @@ void KSMShutdownIPFeedback::slotPaintEffect()
//////
KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent,
- bool maysd, KApplication::ShutdownType sdtype )
- : TQDialog( parent, 0, TRUE, (WFlags)WType_Popup ), targets(0)
+ bool maysd, KApplication::ShutdownType sdtype, int* 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.
{
TQVBoxLayout* vbox = new TQVBoxLayout( this );
+ if (m_selection) {
+ *m_selection = 0;
+ }
TQFrame* frame = new TQFrame( this );
frame->setFrameStyle( TQFrame::StyledPanel | TQFrame::Raised );
@@ -1104,27 +1107,12 @@ void KSMShutdownDlg::slotHalt()
void KSMShutdownDlg::slotSuspend()
{
-#ifdef WITH_UPOWER
- if (m_lockOnResume) {
- DCOPRef("kdesktop", "KScreensaverIface").send("lock");
- }
+ *m_selection = 1; // Suspend
- if( m_dbusConn.isConnected() ) {
- TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower",
- "org.freedesktop.UPower",
- "Suspend");
- m_dbusConn.sendWithReply(msg);
- }
-
- reject(); // continue on resume
+#ifdef WITH_UPOWER
+ // Handled in shutdown.cpp
#else
#ifdef COMPILE_HALBACKEND
- if (m_lockOnResume) {
- DCOPRef("kdesktop", "KScreensaverIface").send("lock");
- }
-
if (m_dbusConn)
{
DBusMessage *msg = dbus_message_new_method_call(
@@ -1140,35 +1128,19 @@ void KSMShutdownDlg::slotSuspend()
dbus_message_unref(msg);
}
-
- reject(); // continue on resume
#endif
#endif // WITH_UPOWER
+ reject(); // continue on resume
}
void KSMShutdownDlg::slotHibernate()
{
-#ifdef WITH_UPOWER
- if (m_lockOnResume) {
- DCOPRef("kdesktop", "KScreensaverIface").send("lock");
- }
-
- if( m_dbusConn.isConnected() ) {
- TQT_DBusMessage msg = TQT_DBusMessage::methodCall(
- "org.freedesktop.UPower",
- "/org/freedesktop/UPower",
- "org.freedesktop.UPower",
- "Hibernate");
- m_dbusConn.sendWithReply(msg);
- }
+ *m_selection = 2; // Hibernate
- reject(); // continue on resume
+#ifdef WITH_UPOWER
+ // Handled in shutdown.cpp
#else
#ifdef COMPILE_HALBACKEND
- if (m_lockOnResume) {
- DCOPRef("kdesktop", "KScreensaverIface").send("lock");
- }
-
if (m_dbusConn)
{
DBusMessage *msg = dbus_message_new_method_call(
@@ -1181,18 +1153,17 @@ void KSMShutdownDlg::slotHibernate()
dbus_message_unref(msg);
}
-
- reject(); // continue on resume
#endif
#endif // WITH_UPOWER
+ reject(); // continue on resume
}
-bool KSMShutdownDlg::confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bootOption )
+bool KSMShutdownDlg::confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bootOption, int* selection )
{
kapp->enableStyles();
KSMShutdownDlg* l = new KSMShutdownDlg( 0,
//KSMShutdownFeedback::self(),
- maysd, sdtype );
+ maysd, sdtype, selection );
// Show dialog (will save the background in showEvent)
TQSize sh = l->sizeHint();