NoPaste

Suspend-Button-Patch f?r das Shutdown-Dialog von KDE

von napo

SNIPPET_TEXT:
  1. diff -Naur /daten/compile/temp/kdebase-3.4.2/ksmserver/server.cpp /daten/compile/kdebase/kdebase-3.4.2/ksmserver/server.cpp
  2. --- /daten/compile/temp/kdebase-3.4.2/ksmserver/server.cpp      2005-05-23 14:13:16.000000000 +0200
  3. +++ /daten/compile/kdebase/kdebase-3.4.2/ksmserver/server.cpp   2005-11-16 11:58:13.000000000 +0100
  4. @@ -972,6 +972,19 @@
  5.          // TODO: turn the feedback widget into a list of apps to be closed,
  6.          // with an indicator of the current status for each.
  7.          KSMShutdownFeedback::stop(); // make the screen become normal again
  8. +
  9. +        if ( sdtype == 3 ) {
  10. +            QString suspend2disk = config->readEntry("suspend2disk", "");
  11. +            KProcess *proc = new KProcess;
  12. +            *proc << suspend2disk;
  13. +            proc->start();
  14. +        }
  15. +        if ( sdtype == 4 ) {
  16. +            QString suspend2ram = config->readEntry("suspend2ram", "");
  17. +            KProcess *proc = new KProcess;
  18. +            *proc << suspend2ram;
  19. +            proc->start();
  20. +        }
  21.      }
  22.  
  23.      if ( logoutConfirmed ) {
  24. diff -Naur /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.cpp /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.cpp
  25. --- /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.cpp    2005-05-23 14:13:16.000000000 +0200
  26. +++ /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.cpp 2005-11-15 17:33:35.000000000 +0100
  27. @@ -35,6 +35,7 @@
  28.  #include <kpixmapeffect.h>
  29.  #include <kdialog.h>
  30.  #include <kseparator.h>
  31. +#include <kprocess.h>
  32.  
  33.  #include <sys/types.h>
  34.  #include <sys/utsname.h>
  35. @@ -138,6 +139,26 @@
  36.          if ( sdtype == KApplication::ShutdownTypeReboot )
  37.              btnReboot->setFocus();
  38.  
  39. +        buttonlay->addStretch( 1 );
  40. +
  41. +        // Suspend to disk
  42. +        KPushButton* btnSuspend2disk = new KPushButton( KGuiItem( i18n("&Suspend to disk"), "disk"), frame );
  43. +        btnSuspend2disk->setFont( btnFont );
  44. +        buttonlay->addWidget( btnSuspend2disk );
  45. +
  46. +        connect(btnSuspend2disk, SIGNAL(clicked()), SLOT(slotSuspend2disk()));
  47. +        if ( sdtype == 3 )
  48. +            btnSuspend2disk->setFocus();
  49. +
  50. +        // Suspend to ram
  51. +        KPushButton* btnSuspend2ram = new KPushButton( KGuiItem( i18n("&Suspend to ram"), "ram"), frame );
  52. +        btnSuspend2ram->setFont( btnFont );
  53. +        buttonlay->addWidget( btnSuspend2ram );
  54. +
  55. +        connect(btnSuspend2ram, SIGNAL(clicked()), SLOT(slotSuspend2ram()));
  56. +        if ( sdtype == 4 )
  57. +            btnSuspend2ram->setFocus();
  58. +
  59.          int def, cur;
  60.          if ( DM().bootOptions( rebootOptions, def, cur ) ) {
  61.           targets = new QPopupMenu( frame );
  62. @@ -171,6 +192,18 @@
  63.  }
  64.  
  65.  
  66. +void KSMShutdownDlg::slotSuspend2disk()
  67. +{
  68. +    m_shutdownType = (KApplication::ShutdownType)3;
  69. +    reject();
  70. +}
  71. +
  72. +void KSMShutdownDlg::slotSuspend2ram()
  73. +{
  74. +    m_shutdownType = (KApplication::ShutdownType)4;
  75. +    reject();
  76. +}
  77. +
  78.  void KSMShutdownDlg::slotLogout()
  79.  {
  80.      m_shutdownType = KApplication::ShutdownTypeNone;
  81. diff -Naur /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.h /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.h
  82. --- /daten/compile/temp/kdebase-3.4.2/ksmserver/shutdown.h      2005-05-23 14:13:16.000000000 +0200
  83. +++ /daten/compile/kdebase/kdebase-3.4.2/ksmserver/shutdown.h   2005-11-15 17:32:01.000000000 +0100
  84. @@ -53,6 +53,8 @@
  85.      void slotHalt();
  86.      void slotReboot();
  87.      void slotReboot(int);
  88. +    void slotSuspend2disk();
  89. +    void slotSuspend2ram();
  90.  
  91.  protected:
  92.      ~KSMShutdownDlg() {};

Quellcode

Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN