summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrançois Andriot <albator78@libertysurf.fr>2014-09-20 14:05:53 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2014-09-20 14:05:53 +0900
commit5a0695b39107650840062ccf46682e7c3074f005 (patch)
tree140d5830da2f86b25561e8c3cf2b9dd50bd93602
parent10e8d4c0a4113ffe90ea92dc0a63977a3b2e7306 (diff)
downloadtdebase-5a0695b39107650840062ccf46682e7c3074f005.tar.gz
tdebase-5a0695b39107650840062ccf46682e7c3074f005.zip
Fixed detecting tdepowersave in tdecmshell energy. This resolves bug 2122.
-rw-r--r--kcontrol/energy/energy.cpp35
-rw-r--r--kcontrol/energy/energy.h3
2 files changed, 30 insertions, 8 deletions
diff --git a/kcontrol/energy/energy.cpp b/kcontrol/energy/energy.cpp
index 9dc899e7e..5129e365d 100644
--- a/kcontrol/energy/energy.cpp
+++ b/kcontrol/energy/energy.cpp
@@ -143,6 +143,7 @@ KEnergy::KEnergy(TQWidget *parent, const char *name)
m_Off = DFLT_OFF;
m_bDPMS = false;
m_bKPowersave = false;
+ m_bTDEPowersave = false;
m_bMaintainSanity = true;
setQuickHelp( i18n("<h1>Display Power Control</h1> If your display supports"
@@ -164,6 +165,13 @@ KEnergy::KEnergy(TQWidget *parent, const char *name)
m_bKPowersave = managingDPMS;
m_bDPMS = !m_bKPowersave;
}
+
+ DCOPRef tdepowersave("tdepowersave", "tdepowersaveIface");
+ managingDPMS = tdepowersave.call("currentSchemeManagesDPMS()");
+ if (managingDPMS.isValid()) {
+ m_bTDEPowersave = managingDPMS;
+ m_bDPMS = !m_bTDEPowersave;
+ }
#endif
TQVBoxLayout *top = new TQVBoxLayout(this, 0, KDialog::spacingHint());
@@ -181,7 +189,7 @@ KEnergy::KEnergy(TQWidget *parent, const char *name)
TQWhatsThis::add( m_pCBEnable, i18n("Check this option to enable the"
" power saving features of your display.") );
// ###
- } else if(m_bKPowersave) {
+ } else if(m_bKPowersave || m_bTDEPowersave) {
m_pCBEnable = new TQCheckBox(i18n("&Enable specific display power management"), this);
hbox->addWidget(m_pCBEnable);
m_bEnabled = false;
@@ -203,7 +211,7 @@ connect(logo, TQT_SIGNAL(leftClickedURL(const TQString&)), TQT_SLOT(openURL(cons
hbox->addWidget(logo);
// Sliders
- if (!m_bKPowersave) {
+ if (!m_bKPowersave && !m_bTDEPowersave) {
m_pStandbySlider = new KIntNumInput(m_Standby, this);
m_pStandbySlider->setLabel(i18n("&Standby after:"));
m_pStandbySlider->setRange(0, 120, 10);
@@ -243,10 +251,18 @@ connect(logo, TQT_SIGNAL(leftClickedURL(const TQString&)), TQT_SLOT(openURL(cons
m_pStandbySlider = 0;
m_pSuspendSlider = 0;
m_pOffSlider = 0;
- TQPushButton* btnKPowersave = new TQPushButton(this);
- btnKPowersave->setText(i18n("Configure KPowersave..."));
- connect(btnKPowersave, TQT_SIGNAL(clicked()), TQT_SLOT(slotLaunchKPowersave()));
- top->addWidget(btnKPowersave);
+ if(m_bKPowersave) {
+ TQPushButton* btnKPowersave = new TQPushButton(this);
+ btnKPowersave->setText(i18n("Configure KPowersave..."));
+ connect(btnKPowersave, TQT_SIGNAL(clicked()), TQT_SLOT(slotLaunchKPowersave()));
+ top->addWidget(btnKPowersave);
+ }
+ if(m_bTDEPowersave) {
+ TQPushButton* btnTDEPowersave = new TQPushButton(this);
+ btnTDEPowersave->setText(i18n("Configure TDEPowersave..."));
+ connect(btnTDEPowersave, TQT_SIGNAL(clicked()), TQT_SLOT(slotLaunchTDEPowersave()));
+ top->addWidget(btnTDEPowersave);
+ }
}
top->addStretch();
@@ -337,6 +353,11 @@ void KEnergy::slotLaunchKPowersave()
r.send("openConfigureDialog()");
}
+void KEnergy::slotLaunchTDEPowersave()
+{
+ DCOPRef r("tdepowersave", "tdepowersaveIface");
+ r.send("openConfigureDialog()");
+}
void KEnergy::showSettings()
{
@@ -346,7 +367,7 @@ void KEnergy::showSettings()
m_pCBEnable->setChecked(m_bEnabled);
}
- if (!m_bKPowersave) {
+ if (!m_bKPowersave && !m_bTDEPowersave) {
m_pStandbySlider->setEnabled(m_bEnabled);
m_pStandbySlider->setValue(m_Standby);
m_pSuspendSlider->setEnabled(m_bEnabled);
diff --git a/kcontrol/energy/energy.h b/kcontrol/energy/energy.h
index 54005dfb0..765fdb2b9 100644
--- a/kcontrol/energy/energy.h
+++ b/kcontrol/energy/energy.h
@@ -45,6 +45,7 @@ private slots:
void slotChangeSuspend(int);
void slotChangeOff(int);
void slotLaunchKPowersave();
+ void slotLaunchTDEPowersave();
void openURL(const TQString &);
private:
@@ -55,7 +56,7 @@ private:
static void applySettings(bool, int, int, int);
friend void init_energy();
- bool m_bChanged, m_bDPMS, m_bKPowersave, m_bEnabled, m_bMaintainSanity;
+ bool m_bChanged, m_bDPMS, m_bKPowersave, m_bTDEPowersave, m_bEnabled, m_bMaintainSanity;
int m_Standby, m_Suspend, m_Off;
int m_StandbyDesired, m_SuspendDesired, m_OffDesired;