[PATCH] logout dialog

Oswald Buddenhagen ossi at kde.org
Thu Aug 12 21:23:38 BST 2004


moin,

the attached patch makes ksmserver present the "konqy dialog" even if
system shutdown is not available. it's sort of more consistent this way,
but otoh the dialog looks "hollow". comments?

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
-------------- next part --------------
Index: shutdown.cpp
===================================================================
RCS file: /home/kde/kdebase/ksmserver/shutdown.cpp,v
retrieving revision 1.49
diff -U2 -w -r1.49 shutdown.cpp
--- shutdown.cpp	19 Jul 2004 21:57:16 -0000	1.49
+++ shutdown.cpp	12 Aug 2004 20:19:14 -0000
@@ -94,6 +94,4 @@
     vbox->addWidget( label, 0, AlignHCenter );
 
-    if (maysd)
-    {
         QHBoxLayout* hbox = new QHBoxLayout( vbox, 2 * KDialog::spacingHint() );
 
@@ -113,7 +111,5 @@
         buttonlay->setAlignment( Qt::AlignHCenter );
 
-        QSpacerItem* item1 = new QSpacerItem(
-            0, KDialog::marginHint(), QSizePolicy::MinimumExpanding );
-        buttonlay->addItem( item1 );
+    buttonlay->addStretch( 1 );
 
         // End session
@@ -121,4 +117,7 @@
         QFont btnFont = btnLogout->font();
         buttonlay->addWidget( btnLogout );
+    connect(btnLogout, SIGNAL(clicked()), SLOT(slotLogout()));
+
+    if (maysd) {
 
         // Shutdown
@@ -126,4 +125,7 @@
         btnHalt->setFont( btnFont );
         buttonlay->addWidget( btnHalt );
+        connect(btnHalt, SIGNAL(clicked()), SLOT(slotHalt()));
+        if ( sdtype == KApplication::ShutdownTypeHalt )
+            btnHalt->setFocus();
 
         // Reboot
@@ -131,61 +133,20 @@
         btnReboot->setFont( btnFont );
         buttonlay->addWidget( btnReboot );
+        connect(btnReboot, SIGNAL(clicked()), SLOT(slotReboot()));
+        if ( sdtype == KApplication::ShutdownTypeReboot )
+            btnReboot->setFocus();
+
+    }
+
+    buttonlay->addStretch( 1 );
 
         // Separator
-        QSpacerItem* item2 = new QSpacerItem( 0, KDialog::spacingHint(), QSizePolicy::MinimumExpanding );
-        buttonlay->addItem( item2 );
-        KSeparator* sep = new KSeparator( frame );
-        buttonlay->addWidget( sep );
+    buttonlay->addWidget( new KSeparator( frame ) );
 
         // Back to Desktop
         KPushButton* btnBack = new KPushButton( KStdGuiItem::cancel(), frame );
         buttonlay->addWidget( btnBack );
+    connect(btnBack, SIGNAL(clicked()), SLOT(reject()));
 
-        QObject::connect(btnLogout, SIGNAL(clicked()),
-                         this, SLOT(slotLogout()));
-        QObject::connect(btnHalt, SIGNAL(clicked()),
-                         this, SLOT(slotHalt()));
-        QObject::connect(btnReboot, SIGNAL(clicked()),
-                         this, SLOT(slotReboot()));
-        QObject::connect(btnBack, SIGNAL(clicked()),
-                         this, SLOT(reject()));
-
-        if ( sdtype == KApplication::ShutdownTypeHalt )
-            btnHalt->setFocus();
-        else if ( sdtype == KApplication::ShutdownTypeReboot )
-            btnReboot->setFocus();
-        else
-            btnLogout->setFocus();
-
- #if 0
-        mgrp = new QVButtonGroup( i18n("Shutdown Mode"), frame );
-        rSched = new QRadioButton( i18n("Sch&edule"), mgrp );
-        if (maynuke)
-            rForce = new QRadioButton( i18n("&Force now"), mgrp );
-        rTry = new QRadioButton( i18n("&Try now"), mgrp );
-        hbox->addWidget( mgrp, AlignTop );
- #endif
-    }
-
-    vbox->addStretch();
-
-    if ( !maysd ) {
-        QHBoxLayout* hbox = new QHBoxLayout( vbox );
-        hbox->addStretch();
-
-        // logout
-        KPushButton* btnLogout = new KPushButton( i18n("&Logout"), frame );
-        btnLogout->setIconSet( QIconSet( SmallIconSet("exit") ) );
-        btnLogout->setFocus();
-        connect( btnLogout, SIGNAL( clicked() ), SLOT( slotLogout() ) );
-        hbox->addWidget( btnLogout );
-        hbox->addStretch();
-
-       // cancel
-       KPushButton* cancel = new KPushButton( KStdGuiItem::cancel(), frame );
-       connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) );
-       hbox->addWidget( cancel );
-       hbox->addStretch();
-    }
 }
 


More information about the kde-core-devel mailing list