|
发表于 2008-7-30 08:14:50
|
显示全部楼层
kdebase-3.4.2-ksm-sleep.patch
- diff -Nur kdebase-3.4.2/ksmserver/shutdown.cpp kdebase-3.4.2/ksmserver.orig/shutdown.cpp
- --- kdebase-3.4.2/ksmserver/shutdown.cpp 2005-05-23 20:13:16.000000000 +0800
- +++ kdebase-3.4.2/ksmserver.orig/shutdown.cpp 2006-08-01 11:00:02.000000000 +0800
- @@ -80,6 +80,11 @@
- // this is a WType_Popup on purpose. Do not change that! Not
- // having a popup here has severe side effects.
- {
- + /*
- + *Modifyed by lovewilliam<[email][email protected][/email]>
- + */
- + Get_ACPI_State();
- +
- QVBoxLayout* vbox = new QVBoxLayout( this );
- QFrame* frame = new QFrame( this );
- frame->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
- @@ -137,6 +142,17 @@
- connect(btnReboot, SIGNAL(clicked()), SLOT(slotReboot()));
- if ( sdtype == KApplication::ShutdownTypeReboot )
- btnReboot->setFocus();
- +
- + /*
- + *modifyed by lovewilliam<[email][email protected][/email]>
- + */
- + KSMDelayedPushButton *btnSleep = new KSMDelayedPushButton( KGuiItem( i18n("&Sleep"), "sleep"), frame );
- + if(SLEEP_SIGN.isNull()){
- + btnSleep->hide();
- + }
- + btnSleep->setFont( btnFont );
- + buttonlay->addWidget( btnSleep );
- + connect(btnSleep, SIGNAL(clicked()), SLOT(slotSleep()));
-
- int def, cur;
- if ( DM().bootOptions( rebootOptions, def, cur ) ) {
- @@ -202,6 +218,21 @@
- accept();
- }
-
- +/*
- + *Modifyed by lovewilliam<[email][email protected][/email]>
- + */
- +
- +void KSMShutdownDlg::slotSleep()
- +{
- + QString cmd;
- + cmd += "echo -n ";
- + cmd += SLEEP_SIGN;
- + cmd += ">>/sys/power/state";
- +// system((char)"echo -n "+ SLEEP_SIGN.latin1() +">>/sys/power/state");
- + system(cmd.latin1());
- + accept();
- +}
- +
-
- bool KSMShutdownDlg::confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, QString& bootOption )
- {
- @@ -225,6 +256,31 @@
- kapp->disableStyles();
- return result;
- }
- +/*
- + *Modifyed by lovewilliam <[email][email protected][/email]>
- + */
- +
- +void KSMShutdownDlg::Get_ACPI_State(){
- + QFile ACPI_SLEEP_INFO("/sys/power/state");
- + if ( ACPI_SLEEP_INFO.open( IO_ReadOnly )) {
- + ACPI_SLEEP_INFO.readLine ( SLEEP_SIGN , 255 ) ;
- + QStringList ACPI_SIGN;
- + ACPI_SIGN = QStringList::split( " ", SLEEP_SIGN );
- + SLEEP_SIGN = *ACPI_SIGN.begin();
- +
- + //Debug!
- + kdDebug()<<"ACPI SLEEP SIGN:"<<SLEEP_SIGN<<endl;
- +
- + ACPI_SLEEP_INFO.close();
- + }else{
- + SLEEP_SIGN = "";
- + //btnSleep->hide();
- + kdDebug()<<"Error while reading /sys/power/state"<<endl;
- + }
- +}
- +
- +
- +
-
- KSMDelayedPushButton::KSMDelayedPushButton( const KGuiItem &item,
- QWidget *parent,
- diff -Nur kdebase-3.4.2/ksmserver/shutdown.h kdebase-3.4.2/ksmserver.orig/shutdown.h
- --- kdebase-3.4.2/ksmserver/shutdown.h 2005-05-23 20:13:16.000000000 +0800
- +++ kdebase-3.4.2/ksmserver.orig/shutdown.h 2006-08-01 10:36:17.000000000 +0800
- @@ -9,6 +9,11 @@
-
- #include <qpixmap.h>
- #include <qdialog.h>
- +/*
- + *Modifyed by lovewilliam <[email][email protected][/email]>
- + */
- +#include <qfile.h>
- +
- #include <kpushbutton.h>
- class QPushButton;
- class QVButtonGroup;
- @@ -48,11 +53,20 @@
- public:
- static bool confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, QString& bopt );
-
- +/*
- + *Modifyed by lovewilliam <[email][email protected][/email]>
- + */
- + void Get_ACPI_State();
- +
- public slots:
- void slotLogout();
- void slotHalt();
- void slotReboot();
- void slotReboot(int);
- + /*
- + *modifyed by lovewilliam<[email][email protected][/email]>
- + */
- + void slotSleep();
-
- protected:
- ~KSMShutdownDlg() {};
- @@ -60,9 +74,15 @@
- private:
- KSMShutdownDlg( QWidget* parent, bool maysd, KApplication::ShutdownType sdtype );
- KApplication::ShutdownType m_shutdownType;
- + /*
- + *modifyed by lovewilliam<[email][email protected][/email]>
- + */
- + //KSMDelayedPushButton *btnSleep;
- +
- QString m_bootOption;
- QPopupMenu *targets;
- QStringList rebootOptions;
- + QString SLEEP_SIGN;
- };
-
- class KSMDelayedPushButton : public KPushButton
复制代码
这个是kde 3.4.2 的patch 你自己改以下可以手动patch 一下可以用到当前版本的kde 上 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
×
|