Suspend-Button-Patch f?r das Shutdown-Dialog von KDE
von napo- SNIPPET_TEXT:
-
- diff -Naur /daten/compile/temp/kdebase-3.4.2/ksmserver/server.cpp /daten/compile/kdebase/kdebase-3.4.2/ksmserver/server.cpp
- --- /daten/compile/temp/kdebase-3.4.2/ksmserver/server.cpp 2005-05-23 14:13:16.000000000 +0200
- +++ /daten/compile/kdebase/kdebase-3.4.2/ksmserver/server.cpp 2005-11-16 11:58:13.000000000 +0100
- @@ -972,6 +972,19 @@
- // TODO: turn the feedback widget into a list of apps to be closed,
- // with an indicator of the current status for each.
- KSMShutdownFeedback::stop(); // make the screen become normal again
- +
- + if ( sdtype == 3 ) {
- + QString suspend2disk = config->readEntry("suspend2disk", "");
- + KProcess *proc = new KProcess;
- + *proc << suspend2disk;
- + proc->start();
- + }
- + if ( sdtype == 4 ) {
- + QString suspend2ram = config->readEntry("suspend2ram", "");
- + KProcess *proc = new KProcess;
- + *proc << suspend2ram;
- + proc->start();
- + }
- }
- if ( logoutConfirmed ) {
- diff -Naur /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.cpp /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.cpp
- --- /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.cpp 2005-05-23 14:13:16.000000000 +0200
- +++ /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.cpp 2005-11-15 17:33:35.000000000 +0100
- @@ -35,6 +35,7 @@
- #include <kpixmapeffect.h>
- #include <kdialog.h>
- #include <kseparator.h>
- +#include <kprocess.h>
- #include <sys/types.h>
- #include <sys/utsname.h>
- @@ -138,6 +139,26 @@
- if ( sdtype == KApplication::ShutdownTypeReboot )
- btnReboot->setFocus();
- + buttonlay->addStretch( 1 );
- +
- + // Suspend to disk
- + KPushButton* btnSuspend2disk = new KPushButton( KGuiItem( i18n("&Suspend to disk"), "disk"), frame );
- + btnSuspend2disk->setFont( btnFont );
- + buttonlay->addWidget( btnSuspend2disk );
- +
- + connect(btnSuspend2disk, SIGNAL(clicked()), SLOT(slotSuspend2disk()));
- + if ( sdtype == 3 )
- + btnSuspend2disk->setFocus();
- +
- + // Suspend to ram
- + KPushButton* btnSuspend2ram = new KPushButton( KGuiItem( i18n("&Suspend to ram"), "ram"), frame );
- + btnSuspend2ram->setFont( btnFont );
- + buttonlay->addWidget( btnSuspend2ram );
- +
- + connect(btnSuspend2ram, SIGNAL(clicked()), SLOT(slotSuspend2ram()));
- + if ( sdtype == 4 )
- + btnSuspend2ram->setFocus();
- +
- int def, cur;
- if ( DM().bootOptions( rebootOptions, def, cur ) ) {
- targets = new QPopupMenu( frame );
- @@ -171,6 +192,18 @@
- }
- +void KSMShutdownDlg::slotSuspend2disk()
- +{
- + m_shutdownType = (KApplication::ShutdownType)3;
- + reject();
- +}
- +
- +void KSMShutdownDlg::slotSuspend2ram()
- +{
- + m_shutdownType = (KApplication::ShutdownType)4;
- + reject();
- +}
- +
- void KSMShutdownDlg::slotLogout()
- {
- m_shutdownType = KApplication::ShutdownTypeNone;
- diff -Naur /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.h /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.h
- --- /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.h 2005-05-23 14:13:16.000000000 +0200
- +++ /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.h 2005-11-15 17:32:01.000000000 +0100
- @@ -53,6 +53,8 @@
- void slotHalt();
- void slotReboot();
- void slotReboot(int);
- + void slotSuspend2disk();
- + void slotSuspend2ram();
- protected:
- ~KSMShutdownDlg() {};
Quellcode
Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN