[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [PATCH] powerdevil-fix-SetPowerSave.patch
From:       Dario Freddi <drf54321 () gmail ! com>
Date:       2010-03-24 15:26:06
Message-ID: 201003241626.11308.drf54321 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


I would wait for Kevin's input/ok for this one. Ok for me, but please wait 
until Kevin says ok as well.

On Wednesday 24 March 2010 16:24:46 Holger Macht wrote:
> On So 07. Mär - 23:57:52, Holger Macht wrote:
> > Current powerdevil and solid implementation has the concept of schemes,
> > not to be confused with profiles, which is currently hard coded to
> > "powersave" and "performance". The only thing this is doing is to map
> > powersave/performance to the SetPowerSave HAL method which either
> > enabled or disables certain system level power management
> > functionality. I have no idea why this was implemented in this way and
> > lacks any basis for me. The SetPowerSave HAL method is not intended, and
> > will never be used for any kind of scheme methodology. Even more recent
> > system application like DeviceKit-power/upower lack things of this
> > kind. With this patch I propose to remove the "scheme"-stuff and
> > implement the pure SetPowerSave method to be just a toggle, on or
> > off. This will result in a more comprehensible implementation.
> 
> How about this one? Ok to commit?
> 
> Thanks,
>  Holger
> 
> PS: Thanks for committing the other patches.
> 
> PSS: Meanwhile I have a KDE SVN account.
> 
> > Regards,
> > 
> >  Holger
> > 
> > Index: KDE/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.cpp
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.cpp
> > +++ KDE/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.cpp
> > @@ -361,7 +361,7 @@ void PowerDevilDaemon::applyProfile()
> > 
> >      Solid::Control::PowerManager::setBrightness(settings->readEntry("bri
> >      ghtness").toInt()); d->brightness =
> >      settings->readEntry("brightness").toInt();
> > 
> > -   
> > Solid::Control::PowerManager::setScheme(settings->readEntry("scheme"));
> > +   
> > Solid::Control::PowerManager::setPowerSave(settings->readEntry("setPower
> > Save", true));
> > 
> >      // Compositing!!
> > 
> > @@ -1169,18 +1169,13 @@ QVariantMap PowerDevilDaemon::getSupport
> > 
> >      return retlist;
> >  
> >  }
> > 
> > -QStringList PowerDevilDaemon::getSupportedSchemes()
> > -{
> > -    return Solid::Control::PowerManager::supportedSchemes();
> > -}
> > -
> > -void PowerDevilDaemon::setPowersavingScheme(const QString &scheme)
> > +void PowerDevilDaemon::setPowerSave(bool powersave)
> > 
> >  {
> >  
> >      if (!checkIfCurrentSessionActive()) {
> >      
> >          return;
> >      
> >      }
> > 
> > -    Solid::Control::PowerManager::setScheme(scheme);
> > +    Solid::Control::PowerManager::setPowerSave(powersave);
> > 
> >  }
> >  
> >  void PowerDevilDaemon::suspend(int method)
> > 
> > Index: KDE/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.h
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.h
> > +++ KDE/kdebase/workspace/powerdevil/daemon/PowerDevilDaemon.h
> > 
> > @@ -46,7 +46,7 @@ public Q_SLOTS:
> >      void streamData();
> >      
> >      void suspend(int method);
> > 
> > -    void setPowersavingScheme(const QString &scheme);
> > +    void setPowerSave(bool powersave);
> > 
> >      void setBrightness(int value);
> >      void turnOffScreen();
> > 
> > @@ -54,7 +54,6 @@ public Q_SLOTS:
> >          deleteLater();
> >      
> >      }
> > 
> > -    QStringList getSupportedSchemes();
> > 
> >      QVariantMap getSupportedSuspendMethods();
> >      
> >      SuspensionLockHandler *lockHandler();
> > 
> > Index: KDE/kdebase/workspace/powerdevil/daemon/org.kde.PowerDevil.xml
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/daemon/org.kde.PowerDevil.xml
> > +++ KDE/kdebase/workspace/powerdevil/daemon/org.kde.PowerDevil.xml
> > @@ -19,8 +19,8 @@
> > 
> >      <method name="suspend">
> >      
> >        <arg type="i" direction="in" />
> >      
> >      </method>
> > 
> > -    <method name="setPowersavingScheme">
> > -      <arg type="s" direction="in" />
> > +    <method name="setPowerSave">
> > +      <arg type="b" direction="in" />
> > 
> >      </method>
> >      <method name="setBrightness">
> >      
> >        <arg type="i" direction="in" />
> > 
> > @@ -31,9 +31,6 @@
> > 
> >        <arg type="a{sv}" direction="out" />
> >        <annotation name="com.trolltech.QtDBus.QtTypeName.Out0"
> >        value="QVariantMap" />
> >      
> >      </method>
> > 
> > -    <method name="getSupportedSchemes">
> > -      <arg type="as" direction="out" />
> > -    </method>
> > 
> >      <signal name="lidClosed">
> >      
> >        <arg type="i" direction="out" />
> > 
> > Index: KDE/kdebase/workspace/powerdevil/default.powerdevilprofiles
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/default.powerdevilprofiles
> > +++ KDE/kdebase/workspace/powerdevil/default.powerdevilprofiles
> > @@ -16,7 +16,7 @@ idleTime=10
> > 
> >  lidAction=2
> >  name=Aggressive Powersave
> >  powerButtonAction=2
> > 
> > -scheme=powersaving
> > +setPowerSave=true
> > 
> >  scriptpath=
> >  sleepButtonAction=2
> >  turnOffIdle=true
> > 
> > @@ -40,7 +40,7 @@ idleTime=99
> > 
> >  lidAction=16
> >  name=Performance
> >  powerButtonAction=32
> > 
> > -scheme=performance
> > +setPowerSave=false
> > 
> >  scriptpath=
> >  sleepButtonAction=2
> >  turnOffIdle=false
> > 
> > @@ -64,7 +64,7 @@ idleTime=15
> > 
> >  lidAction=2
> >  name=Powersave
> >  powerButtonAction=32
> > 
> > -scheme=powersaving
> > +setPowerSave=true
> > 
> >  scriptpath=
> >  sleepButtonAction=2
> >  turnOffIdle=true
> > 
> > @@ -87,7 +87,7 @@ idleAction=0
> > 
> >  idleTime=50
> >  lidAction=0
> >  powerButtonAction=0
> > 
> > -scheme=powersaving
> > +setPowerSave=true
> > 
> >  scriptpath=
> >  sleepButtonAction=0
> >  turnOffIdle=false
> > 
> > @@ -111,7 +111,7 @@ idleTime=5
> > 
> >  lidAction=2
> >  name=Xtreme Powersave
> >  powerButtonAction=2
> > 
> > -scheme=powersaving
> > +setPowerSave=true
> > 
> >  scriptpath=
> >  sleepButtonAction=2
> >  turnOffIdle=true
> > 
> > Index: KDE/kdebase/workspace/powerdevil/kcmodule/capabilitiesPage.ui
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/kcmodule/capabilitiesPage.ui
> > +++ KDE/kdebase/workspace/powerdevil/kcmodule/capabilitiesPage.ui
> > @@ -65,34 +65,20 @@
> > 
> >         </widget>
> >        
> >        </item>
> >        <item row="3" column="0">
> > 
> > -       <widget class="QLabel" name="label_13">
> > -        <property name="text">
> > -         <string>Scheme support</string>
> > -        </property>
> > -       </widget>
> > -      </item>
> > -      <item row="3" column="1">
> > -       <widget class="QLabel" name="isSchemeSupported">
> > -        <property name="text">
> > -         <string/>
> > -        </property>
> > -       </widget>
> > -      </item>
> > -      <item row="4" column="0">
> > 
> >         <widget class="Line" name="line_3">
> >         
> >          <property name="orientation">
> >          
> >           <enum>Qt::Horizontal</enum>
> >          
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="5" column="0">
> > +      <item row="4" column="0">
> > 
> >         <widget class="QLabel" name="label_17">
> >         
> >          <property name="text">
> >          
> >           <string>Supported suspend methods</string>
> >          
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="5" column="1">
> > +      <item row="4" column="1">
> > 
> >         <widget class="QLabel" name="supportedMethods">
> >         
> >          <property name="text">
> >          
> >           <string/>
> > 
> > @@ -105,28 +91,14 @@
> > 
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="6" column="0">
> > -       <widget class="QLabel" name="label_18">
> > -        <property name="text">
> > -         <string>Supported schemes</string>
> > -        </property>
> > -       </widget>
> > -      </item>
> > -      <item row="6" column="1">
> > -       <widget class="QLabel" name="supportedSchemes">
> > -        <property name="text">
> > -         <string/>
> > -        </property>
> > -       </widget>
> > -      </item>
> > -      <item row="7" column="0">
> > +      <item row="5" column="0">
> > 
> >         <widget class="Line" name="line">
> >         
> >          <property name="orientation">
> >          
> >           <enum>Qt::Horizontal</enum>
> >          
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="8" column="0">
> > +      <item row="6" column="0">
> > 
> >         <widget class="QLabel" name="label_4">
> >         
> >          <property name="toolTip">
> >          
> >           <string>Support for DPMS</string>
> > 
> > @@ -139,14 +111,14 @@
> > 
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="8" column="1">
> > +      <item row="6" column="1">
> > 
> >         <widget class="QLabel" name="dpmsSupport">
> >         
> >          <property name="text">
> >          
> >           <string/>
> >          
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="9" column="0">
> > +      <item row="7" column="0">
> > 
> >         <widget class="QLabel" name="label_6">
> >         
> >          <property name="toolTip">
> >          
> >           <string>Checks if ConsoleKit is active on your system</string>
> > 
> > @@ -159,28 +131,28 @@
> > 
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="9" column="1">
> > +      <item row="7" column="1">
> > 
> >         <widget class="QLabel" name="ckSupport">
> >         
> >          <property name="text">
> >          
> >           <string/>
> >          
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="10" column="0">
> > +      <item row="8" column="0">
> > 
> >         <widget class="Line" name="line_4">
> >         
> >          <property name="orientation">
> >          
> >           <enum>Qt::Horizontal</enum>
> >          
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="11" column="0">
> > +      <item row="9" column="0">
> > 
> >         <widget class="QLabel" name="label_3">
> >         
> >          <property name="text">
> >          
> >           <string>Status</string>
> >          
> >          </property>
> >         
> >         </widget>
> >        
> >        </item>
> > 
> > -      <item row="11" column="1">
> > +      <item row="9" column="1">
> > 
> >         <layout class="QVBoxLayout" name="statusLayout"/>
> >        
> >        </item>
> >       
> >       </layout>
> > 
> > Index: KDE/kdebase/workspace/powerdevil/kcmodule/EditPage.cpp
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/kcmodule/EditPage.cpp
> > +++ KDE/kdebase/workspace/powerdevil/kcmodule/EditPage.cpp
> > @@ -143,8 +143,6 @@ void EditPage::fillUi()
> > 
> >          powerButtonCombo->addItem(KIcon("system-suspend"),
> >          i18n("Standby"), (int) Standby);
> >      
> >      }
> > 
> > -   
> > schemeCombo->addItems(Solid::Control::PowerManager::supportedSchemes());
> > -
> > 
> >      reloadAvailableProfiles();
> >      
> >      tabWidget->setTabIcon(0,
> >      KIcon("preferences-system-session-services"));
> > 
> > @@ -180,7 +178,7 @@ void EditPage::fillUi()
> > 
> >      connect(dimDisplayOnIdle, SIGNAL(stateChanged(int)),
> >      SLOT(enableBoxes()));
> > 
> > -    connect(schemeCombo, SIGNAL(currentIndexChanged(int)),
> > SLOT(setProfileChanged())); +    connect(SetPowerSaveCheckBox,
> > SIGNAL(stateChanged(int)), SLOT(setProfileChanged()));
> > 
> >      connect(scriptRequester, SIGNAL(textChanged(const QString&)),
> >      SLOT(setProfileChanged()));
> >  
> >  #ifdef HAVE_DPMS
> > 
> > @@ -273,7 +271,8 @@ void EditPage::loadProfile()
> > 
> >      dimOnIdleTime->setValue(group->readEntry("dimOnIdleTime").toInt());
> >      idleTime->setValue(group->readEntry("idleTime").toInt());
> >      idleCombo->setCurrentIndex(idleCombo->findData(group->readEntry("idl
> >      eAction").toInt()));
> > 
> > -   
> > schemeCombo->setCurrentIndex(schemeCombo->findText(group->readEntry("sch
> > eme"))); +   
> > SetPowerSaveCheckBox->setChecked(group->readEntry("setPowerSave",
> > true)); +
> > 
> >      scriptRequester->setUrl(KUrl::fromPath(group->readEntry("scriptpath"
> >      )));
> >      
> >      laptopClosedCombo->setCurrentIndex(laptopClosedCombo->findData(group
> >      ->readEntry("lidAction").toInt()));
> > 
> > @@ -325,7 +324,7 @@ void EditPage::saveProfile(const QString
> > 
> >      group->writeEntry("lidAction",
> >      laptopClosedCombo->itemData(laptopClosedCombo->currentIndex()).toIn
> >      t()); group->writeEntry("sleepButtonAction",
> >      sleepButtonCombo->itemData(sleepButtonCombo->currentIndex()).toInt(
> >      )); group->writeEntry("powerButtonAction",
> >      powerButtonCombo->itemData(powerButtonCombo->currentIndex()).toInt(
> >      ));
> > 
> > -    group->writeEntry("scheme", schemeCombo->currentText());
> > +    group->writeEntry("setPowerSave",
> > SetPowerSaveCheckBox->isChecked());
> > 
> >      group->writeEntry("scriptpath", scriptRequester->url().path());
> >      group->writeEntry("disableCompositing",
> >      disableCompositing->isChecked());
> > 
> > Index: KDE/kdebase/workspace/powerdevil/kcmodule/profileEditPage.ui
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/kcmodule/profileEditPage.ui
> > +++ KDE/kdebase/workspace/powerdevil/kcmodule/profileEditPage.ui
> > @@ -471,20 +471,29 @@
> > 
> >             <property name="fieldGrowthPolicy">
> >             
> >              <enum>QFormLayout::ExpandingFieldsGrow</enum>
> >             
> >             </property>
> > 
> > -           <item row="1" column="0">
> > -            <widget class="QLabel" name="label_19">
> > +           <item row="5" column="0">
> > +            <widget class="QCheckBox" name="SetPowerSaveCheckBox">
> > +             <property name="enabled">
> > +              <bool>true</bool>
> > +             </property>
> > +             <property name="layoutDirection">
> > +              <enum>Qt::LeftToRight</enum>
> > +             </property>
> > 
> >               <property name="text">
> > 
> > -              <string>System powersaving scheme:</string>
> > +              <string>Enable system power saving</string>
> > 
> >               </property>
> > 
> > -             <property name="buddy">
> > -              <cstring>schemeCombo</cstring>
> > +             <property name="checkable">
> > +              <bool>true</bool>
> > +             </property>
> > +             <property name="checked">
> > +              <bool>false</bool>
> > 
> >               </property>
> >              
> >              </widget>
> >             
> >             </item>
> > 
> > -           <item row="1" column="1">
> > -            <widget class="KComboBox" name="schemeCombo">
> > +           <item row="6" column="1">
> > +            <widget class="KUrlRequester" name="scriptRequester">
> > 
> >               <property name="sizePolicy">
> > 
> > -              <sizepolicy hsizetype="MinimumExpanding"
> > vsizetype="Fixed"> +              <sizepolicy
> > hsizetype="MinimumExpanding" vsizetype="Preferred">
> > 
> >                 <horstretch>0</horstretch>
> >                 <verstretch>0</verstretch>
> >                
> >                </sizepolicy>
> > 
> > @@ -497,7 +506,7 @@
> > 
> >               </property>
> >              
> >              </widget>
> >             
> >             </item>
> > 
> > -           <item row="2" column="0">
> > +           <item row="6" column="0">
> > 
> >              <widget class="QLabel" name="label_20">
> >              
> >               <property name="text">
> >               
> >                <string>When loading profile execute:</string>
> > 
> > @@ -507,27 +516,7 @@
> > 
> >               </property>
> >              
> >              </widget>
> >             
> >             </item>
> > 
> > -           <item row="2" column="1">
> > -            <widget class="KUrlRequester" name="scriptRequester">
> > -             <property name="sizePolicy">
> > -              <sizepolicy hsizetype="MinimumExpanding"
> > vsizetype="Preferred"> -               <horstretch>0</horstretch>
> > -               <verstretch>0</verstretch>
> > -              </sizepolicy>
> > -             </property>
> > -             <property name="maximumSize">
> > -              <size>
> > -               <width>250</width>
> > -               <height>16777215</height>
> > -              </size>
> > -             </property>
> > -            </widget>
> > -           </item>
> > 
> >            </layout>
> > 
> > -          <zorder>schemeCombo</zorder>
> > -          <zorder>label_20</zorder>
> > -          <zorder>label_19</zorder>
> > -          <zorder>scriptRequester</zorder>
> > 
> >           </widget>
> >          
> >          </widget>
> >         
> >         </item>
> > 
> > Index: KDE/kdebase/workspace/libs/solid/control/ifaces/powermanager.h
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/libs/solid/control/ifaces/powermanager.h
> > +++ KDE/kdebase/workspace/libs/solid/control/ifaces/powermanager.h
> > @@ -58,39 +58,6 @@ namespace Ifaces
> > 
> >           */
> >          
> >          virtual ~PowerManager();
> > 
> > -
> > -        /**
> > -         * Retrieves the list of power management schemes available on
> > this system. -         *
> > -         * @return the available power management schemes
> > -         */
> > -        virtual QStringList supportedSchemes() const = 0;
> > -
> > -        /**
> > -         * Retrieves a localized description corresponding to the given
> > scheme. -         *
> > -         * @param schemeName the name of the scheme we request the
> > description for -         * @return the associated description
> > -         */
> > -        virtual QString schemeDescription(const QString &schemeName)
> > const = 0; -
> > -        /**
> > -         * Retrieves the name of the current power management scheme
> > used -         * by the system.
> > -         *
> > -         * @return the current scheme
> > -         */
> > -        virtual QString scheme() const = 0;
> > -
> > -        /**
> > -         * Changes the current power management scheme.
> > -         *
> > -         * @param name the name of the new scheme
> > -         * @return true if the scheme change succeeded, false otherwise
> > -         */
> > -        virtual bool setScheme(const QString &name) = 0;
> > -
> > -
> > 
> >          /**
> >          
> >           * Retrieves the current state of the system battery.
> >           *
> > 
> > @@ -158,6 +125,15 @@ namespace Ifaces
> > 
> >          virtual Solid::Control::PowerManager::CpuFreqPolicy
> >          cpuFreqPolicy() const = 0;
> >          
> >          /**
> > 
> > +         * Changes the current power management policy of the system.
> > +         *
> > +         * @param powersave if powersaving should be anabled
> > +         * @return true if the policy change succeeded, false otherwise
> > +         * @see Solid::Control::PowerManager::setPowerSave
> > +         */
> > +        virtual bool setPowerSave(bool powersave) = 0;
> > +
> > +        /**
> > 
> >           * Changes the current CPU frequency policy of the system.
> >           *
> >           * @param newPolicy the new policy
> > 
> > @@ -209,13 +185,6 @@ namespace Ifaces
> > 
> >      Q_SIGNALS:
> >          /**
> > 
> > -         * This signal is emitted when the power management scheme has
> > changed. -         *
> > -         * @param newScheme the new scheme name
> > -         */
> > -        void schemeChanged(QString newScheme);
> > -
> > -        /**
> > 
> >           * This signal is emitted when the AC adapter is plugged or
> >           unplugged. *
> >           * @param newState the new state of the AC adapter, it's one of
> >           the
> > 
> > Index: KDE/kdebase/workspace/libs/solid/control/powermanager.cpp
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/libs/solid/control/powermanager.cpp
> > +++ KDE/kdebase/workspace/libs/solid/control/powermanager.cpp
> > @@ -34,8 +34,6 @@ Solid::Control::PowerManagerPrivate::Pow
> > 
> >      loadBackend("Power Management", "SolidPowerManager",
> >      "Solid::Control::Ifaces::PowerManager");
> >      
> >      if (managerBackend()!=0) {
> > 
> > -        connect(managerBackend(), SIGNAL(schemeChanged(QString)),
> > -                this, SIGNAL(schemeChanged(QString)));
> > 
> >          connect(managerBackend(), SIGNAL(acAdapterStateChanged(int)),
> >          
> >                  this, SIGNAL(acAdapterStateChanged(int)));
> >          
> >          connect(managerBackend(), SIGNAL(batteryStateChanged(int)),
> > 
> > @@ -53,27 +51,10 @@ Solid::Control::PowerManagerPrivate::~Po
> > 
> >  {
> >  }
> > 
> > -QStringList Solid::Control::PowerManager::supportedSchemes()
> > +bool Solid::Control::PowerManager::setPowerSave(bool powersave)
> > 
> >  {
> >  
> >      return_SOLID_CALL(Ifaces::PowerManager *,
> >      globalPowerManager->managerBackend(),
> > 
> > -                      QStringList(), supportedSchemes());
> > -}
> > -
> > -QString Solid::Control::PowerManager::schemeDescription(const QString
> > &schemeName) -{
> > -    return_SOLID_CALL(Ifaces::PowerManager *,
> > globalPowerManager->managerBackend(), -                      QString(),
> > schemeDescription(schemeName)); -}
> > -
> > -QString Solid::Control::PowerManager::scheme()
> > -{
> > -    return_SOLID_CALL(Ifaces::PowerManager *,
> > globalPowerManager->managerBackend(), QString(), scheme()); -}
> > -
> > -bool Solid::Control::PowerManager::setScheme(const QString &name)
> > -{
> > -    return_SOLID_CALL(Ifaces::PowerManager *,
> > globalPowerManager->managerBackend(), -                      false,
> > setScheme(name));
> > +                      false, setPowerSave(powersave));
> > 
> >  }
> >  
> >  Solid::Control::PowerManager::BatteryState
> >  Solid::Control::PowerManager::batteryState()
> > 
> > Index: KDE/kdebase/workspace/libs/solid/control/powermanager.h
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/libs/solid/control/powermanager.h
> > +++ KDE/kdebase/workspace/libs/solid/control/powermanager.h
> > @@ -119,37 +119,13 @@ namespace Control
> > 
> >          typedef QHash<QString, BrightnessControlType>
> >          BrightnessControlsList;
> > 
> > -
> > -        /**
> > -         * Retrieves the list of power management schemes available on
> > this system. -         *
> > -         * @return the available power management schemes
> > -         */
> > -        SOLIDCONTROL_EXPORT QStringList supportedSchemes();
> > -
> > -        /**
> > -         * Retrieves a localized description corresponding to the given
> > scheme. -         *
> > -         * @param schemeName the name of the scheme we request the
> > description for -         * @return the associated description
> > -         */
> > -        SOLIDCONTROL_EXPORT QString schemeDescription(const QString
> > &schemeName); -
> > 
> >          /**
> > 
> > -         * Retrieves the name of the current power management scheme
> > used -         * by the system.
> > +         * Changes the current power management policy of the system
> > 
> >           *
> > 
> > -         * @return the current scheme
> > -         */
> > -        SOLIDCONTROL_EXPORT QString scheme();
> > -
> > -        /**
> > -         * Changes the current power management scheme.
> > -         *
> > -         * @param name the name of the new scheme
> > -         * @return true if the scheme change succeeded, false otherwise
> > +         * @param true if powersaving should be enabled
> > +         * @return true if the policy change succeeded, false otherwise
> > 
> >           */
> > 
> > -        SOLIDCONTROL_EXPORT bool setScheme(const QString &name);
> > +        SOLIDCONTROL_EXPORT bool setPowerSave(bool powersave);
> > 
> >          /**
> > 
> > @@ -273,13 +249,6 @@ namespace Control
> > 
> >              Q_OBJECT
> >          
> >          Q_SIGNALS:
> >              /**
> > 
> > -             * This signal is emitted when the power management scheme
> > has changed. -             *
> > -             * @param newScheme the new scheme name
> > -             */
> > -            void schemeChanged(QString newScheme);
> > -
> > -            /**
> > 
> >               * This signal is emitted when the AC adapter is plugged or
> >               unplugged. *
> >               * @param newState the new state of the AC adapter, it's one
> >               of the
> > 
> > Index: KDE/kdebase/workspace/powerdevil/kcmodule/CapabilitiesPage.cpp
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/powerdevil/kcmodule/CapabilitiesPage.cpp
> > +++ KDE/kdebase/workspace/powerdevil/kcmodule/CapabilitiesPage.cpp
> > @@ -132,26 +132,6 @@ void CapabilitiesPage::fillCapabilities(
> > 
> >      supportedMethods->setText(sMethods);
> > 
> > -    if (!Solid::Control::PowerManager::supportedSchemes().isEmpty()) {
> > -        isSchemeSupported->setPixmap(KIcon("dialog-ok-apply").pixmap(16,
> > 16)); -    } else {
> > -        isSchemeSupported->setPixmap(KIcon("dialog-cancel").pixmap(16,
> > 16)); -    }
> > -
> > -    QString schemes;
> > -
> > -    foreach(const QString &scheme,
> > Solid::Control::PowerManager::supportedSchemes()) { -       
> > schemes.append(scheme + QString(", "));
> > -    }
> > -
> > -    if (!schemes.isEmpty()) {
> > -        schemes.remove(schemes.length() - 2, 2);
> > -    } else {
> > -        schemes = i18nc("None", "No methods found");
> > -    }
> > -
> > -    supportedSchemes->setText(schemes);
> > -
> > 
> >      bool dpms = false;
> >  
> >  #ifdef HAVE_DPMS
> > 
> > Index: KDE/kdebase/workspace/solid/hal/halpower.cpp
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/solid/hal/halpower.cpp
> > +++ KDE/kdebase/workspace/solid/hal/halpower.cpp
> > @@ -72,52 +72,8 @@ HalPower::~HalPower()
> > 
> >      qDeleteAll(m_buttons);
> >  
> >  }
> > 
> > -QStringList HalPower::supportedSchemes() const
> > +bool HalPower::setPowerSave(bool powersave)
> > 
> >  {
> > 
> > -    return QStringList() << "performance" << "powersaving";
> > -}
> > -
> > -QString HalPower::schemeDescription(const QString &schemeName) const
> > -{
> > -    if (schemeName=="performance")
> > -    {
> > -        return "Use all the performances of the system";
> > -    }
> > -    else if (schemeName=="powersaving")
> > -    {
> > -        return "Try to keep as much power as possible to improve battery
> > life"; -    }
> > -    else
> > -    {
> > -        return QString();
> > -    }
> > -
> > -    return QString();
> > -}
> > -
> > -QString HalPower::scheme() const
> > -{
> > -    // FIXME: We miss an accessor in HAL to make scheme management
> > useful -    return QString();
> > -}
> > -
> > -bool HalPower::setScheme(const QString &name)
> > -{
> > -    bool powersave;
> > -
> > -    if (name=="powersaving")
> > -    {
> > -        powersave = true;
> > -    }
> > -    else if (name=="performance")
> > -    {
> > -        powersave = false;
> > -    }
> > -    else
> > -    {
> > -        return false;
> > -    }
> > -
> > 
> >      QDBusReply<int> reply = m_halPowerManagement.call("SetPowerSave",
> >      powersave);
> >      
> >      if (reply.isValid())
> > 
> > Index: KDE/kdebase/workspace/solid/hal/halpower.h
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/solid/hal/halpower.h
> > +++ KDE/kdebase/workspace/solid/hal/halpower.h
> > 
> > @@ -40,10 +40,7 @@ public:
> >      HalPower(QObject *parent, const QVariantList &args);
> >      virtual ~HalPower();
> > 
> > -    virtual QStringList supportedSchemes() const;
> > -    virtual QString schemeDescription(const QString &schemeName) const;
> > -    virtual QString scheme() const;
> > -    virtual bool setScheme(const QString &name);
> > +    virtual bool setPowerSave(bool powersave);
> > 
> >      virtual Solid::Control::PowerManager::BatteryState batteryState()
> >      const; virtual int batteryChargePercent() const;
> > 
> > Index: KDE/kdebase/workspace/solid/solidshell/solid-powermanagement.cpp
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/solid/solidshell/solid-powermanagement.cpp
> > +++ KDE/kdebase/workspace/solid/solidshell/solid-powermanagement.cpp
> > @@ -196,19 +196,15 @@ int main(int argc, char **argv)
> > 
> >        cout << endl << i18n("Syntax:") << endl << endl;
> > 
> > -      cout << "  solid-powermanagement query (suspend|scheme|cpufreq)"
> > << endl; +      cout << "  solid-powermanagement query
> > (suspend|cpufreq)" << endl;
> > 
> >        cout << i18n("             # List a particular set of information
> >        regarding power management.\n"
> >        
> >                      "             # - If the 'suspend' option is
> >                      specified, give the list of suspend\n" "           
> >                       # methods supported by the system\n"
> > 
> > -                    "             # - If the 'scheme' option is
> > specified, give the list of\n" -                    "             #
> > power management schemes supported by this system\n"
> > 
> >                      "             # - If the 'cpufreq' option is
> >                      specified, give the list of\n" "             #
> >                      supported CPU frequency policies\n") << endl;
> > 
> > -      cout << "  solid-powermanagement set (scheme|cpufreq) 'value'" <<
> > endl; +      cout << "  solid-powermanagement set (cpufreq) 'value'" <<
> > endl;
> > 
> >        cout << i18n("             # Set power management options of the
> >        system.\n"
> > 
> > -                    "             # - If the 'scheme' option is
> > specified, the power management\n" -                    "             #
> > scheme set corresponds to 'value'\n"
> > 
> >                      "             # - If the 'cpufreq' option is
> >                      specified, the CPU frequency policy\n" "           
> >                       # set corresponds to 'value'\n") << endl;
> > 
> > @@ -257,10 +253,6 @@ bool SolidPowermanagement::doIt()
> > 
> >          {
> >          
> >              return shell.powerQuerySuspendMethods();
> >          
> >          }
> > 
> > -        else if (type == "scheme")
> > -        {
> > -            return shell.powerQuerySchemes();
> > -        }
> > 
> >          else if (type == "cpufreq")
> >          {
> >          
> >              return shell.powerQueryCpuPolicies();
> > 
> > @@ -276,11 +268,7 @@ bool SolidPowermanagement::doIt()
> > 
> >          QString type(args->arg(1));
> >          QString value(args->arg(2));
> > 
> > -        if (type == "scheme")
> > -        {
> > -            return shell.powerChangeScheme(value);
> > -        }
> > -        else if (type == "cpufreq")
> > +        if (type == "cpufreq")
> > 
> >          {
> >          
> >              return shell.powerChangeCpuPolicy(value);
> >          
> >          }
> > 
> > @@ -380,41 +368,6 @@ bool SolidPowermanagement::powerSuspend(
> > 
> >      }
> >  
> >  }
> > 
> > -bool SolidPowermanagement::powerQuerySchemes()
> > -{
> > -    QString current = Solid::Control::PowerManager::scheme();
> > -    QStringList schemes =
> > Solid::Control::PowerManager::supportedSchemes(); -
> > -    foreach (const QString& scheme, schemes)
> > -    {
> > -        cout << scheme << " (" <<
> > Solid::Control::PowerManager::schemeDescription(scheme) << ")"; -
> > -        if (scheme==current)
> > -        {
> > -            cout << " [*]" << endl;
> > -        }
> > -        else
> > -        {
> > -            cout << endl;
> > -        }
> > -    }
> > -
> > -    return true;
> > -}
> > -
> > -bool SolidPowermanagement::powerChangeScheme(const QString &schemeName)
> > -{
> > -    QStringList supported =
> > Solid::Control::PowerManager::supportedSchemes(); -
> > -    if (!supported.contains(schemeName))
> > -    {
> > -        cerr << i18n("Unsupported scheme: %1" , schemeName) << endl;
> > -        return false;
> > -    }
> > -
> > -    return Solid::Control::PowerManager::setScheme(schemeName);
> > -}
> > -
> > 
> >  bool SolidPowermanagement::powerQueryCpuPolicies()
> >  {
> >  
> >      Solid::Control::PowerManager::CpuFreqPolicy current =
> >      Solid::Control::PowerManager::cpuFreqPolicy();
> > 
> > Index: KDE/kdebase/workspace/solid/solidshell/solid-powermanagement.h
> > ===================================================================
> > --- KDE.orig/kdebase/workspace/solid/solidshell/solid-powermanagement.h
> > +++ KDE/kdebase/workspace/solid/solidshell/solid-powermanagement.h
> > 
> > @@ -45,9 +45,6 @@ public:
> >      bool powerQuerySuspendMethods();
> >      bool powerSuspend(const QString &method);
> > 
> > -    bool powerQuerySchemes();
> > -    bool powerChangeScheme(const QString &schemeName);
> > -
> > 
> >      bool powerQueryCpuPolicies();
> >      bool powerChangeCpuPolicy(const QString &policyName);
> > >> 
> > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> > >> unsubscribe <<
> >> 
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<

-- 
-------------------

Dario Freddi
KDE Developer
GPG Key Signature: 511A9A3B

["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic