Fixed detecting tdepowersave in tdecmshell energy. This resolves bug 2122.

pull/2/head
François Andriot 10 years ago committed by Michele Calgaro
parent 10e8d4c0a4
commit 5a0695b391

@ -143,6 +143,7 @@ KEnergy::KEnergy(TQWidget *parent, const char *name)
m_Off = DFLT_OFF; m_Off = DFLT_OFF;
m_bDPMS = false; m_bDPMS = false;
m_bKPowersave = false; m_bKPowersave = false;
m_bTDEPowersave = false;
m_bMaintainSanity = true; m_bMaintainSanity = true;
setQuickHelp( i18n("<h1>Display Power Control</h1> If your display supports" 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_bKPowersave = managingDPMS;
m_bDPMS = !m_bKPowersave; m_bDPMS = !m_bKPowersave;
} }
DCOPRef tdepowersave("tdepowersave", "tdepowersaveIface");
managingDPMS = tdepowersave.call("currentSchemeManagesDPMS()");
if (managingDPMS.isValid()) {
m_bTDEPowersave = managingDPMS;
m_bDPMS = !m_bTDEPowersave;
}
#endif #endif
TQVBoxLayout *top = new TQVBoxLayout(this, 0, KDialog::spacingHint()); 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" TQWhatsThis::add( m_pCBEnable, i18n("Check this option to enable the"
" power saving features of your display.") ); " 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); m_pCBEnable = new TQCheckBox(i18n("&Enable specific display power management"), this);
hbox->addWidget(m_pCBEnable); hbox->addWidget(m_pCBEnable);
m_bEnabled = false; m_bEnabled = false;
@ -203,7 +211,7 @@ connect(logo, TQT_SIGNAL(leftClickedURL(const TQString&)), TQT_SLOT(openURL(cons
hbox->addWidget(logo); hbox->addWidget(logo);
// Sliders // Sliders
if (!m_bKPowersave) { if (!m_bKPowersave && !m_bTDEPowersave) {
m_pStandbySlider = new KIntNumInput(m_Standby, this); m_pStandbySlider = new KIntNumInput(m_Standby, this);
m_pStandbySlider->setLabel(i18n("&Standby after:")); m_pStandbySlider->setLabel(i18n("&Standby after:"));
m_pStandbySlider->setRange(0, 120, 10); 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_pStandbySlider = 0;
m_pSuspendSlider = 0; m_pSuspendSlider = 0;
m_pOffSlider = 0; m_pOffSlider = 0;
TQPushButton* btnKPowersave = new TQPushButton(this); if(m_bKPowersave) {
btnKPowersave->setText(i18n("Configure KPowersave...")); TQPushButton* btnKPowersave = new TQPushButton(this);
connect(btnKPowersave, TQT_SIGNAL(clicked()), TQT_SLOT(slotLaunchKPowersave())); btnKPowersave->setText(i18n("Configure KPowersave..."));
top->addWidget(btnKPowersave); 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(); top->addStretch();
@ -337,6 +353,11 @@ void KEnergy::slotLaunchKPowersave()
r.send("openConfigureDialog()"); r.send("openConfigureDialog()");
} }
void KEnergy::slotLaunchTDEPowersave()
{
DCOPRef r("tdepowersave", "tdepowersaveIface");
r.send("openConfigureDialog()");
}
void KEnergy::showSettings() void KEnergy::showSettings()
{ {
@ -346,7 +367,7 @@ void KEnergy::showSettings()
m_pCBEnable->setChecked(m_bEnabled); m_pCBEnable->setChecked(m_bEnabled);
} }
if (!m_bKPowersave) { if (!m_bKPowersave && !m_bTDEPowersave) {
m_pStandbySlider->setEnabled(m_bEnabled); m_pStandbySlider->setEnabled(m_bEnabled);
m_pStandbySlider->setValue(m_Standby); m_pStandbySlider->setValue(m_Standby);
m_pSuspendSlider->setEnabled(m_bEnabled); m_pSuspendSlider->setEnabled(m_bEnabled);

@ -45,6 +45,7 @@ private slots:
void slotChangeSuspend(int); void slotChangeSuspend(int);
void slotChangeOff(int); void slotChangeOff(int);
void slotLaunchKPowersave(); void slotLaunchKPowersave();
void slotLaunchTDEPowersave();
void openURL(const TQString &); void openURL(const TQString &);
private: private:
@ -55,7 +56,7 @@ private:
static void applySettings(bool, int, int, int); static void applySettings(bool, int, int, int);
friend void init_energy(); 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_Standby, m_Suspend, m_Off;
int m_StandbyDesired, m_SuspendDesired, m_OffDesired; int m_StandbyDesired, m_SuspendDesired, m_OffDesired;

Loading…
Cancel
Save