[Kde-hardware-devel] [kde-workspace/heenamahour/window-list] powerdevil/kcmodule/profiles: Early exit battery loop. Disregard non-powersupply batteries for profile config.

Àlex Fiestas afiestas at kde.org
Fri Jun 28 12:39:10 UTC 2013


Hey, first of all thanks for the contribution.

Next time please, submit the patch to reviewboard instead of pushing+CCMAIL.

Thanks !
On Friday 28 June 2013 07:26:38 heena mahour wrote:
> Git commit 418bc96f257aa3bc20930a5061a88ac2e94f825f by heena mahour, on
> behalf of Kai Uwe Broulik. Committed on 13/06/2013 at 14:12.
> Pushed by heenamahour into branch 'heenamahour/window-list'.
> 
> Early exit battery loop. Disregard non-powersupply batteries for profile
> config.
> 
> CCMAIL: kde-hardware-devel at kde.org
> 
> M  +5    -6    powerdevil/kcmodule/profiles/EditPage.cpp
> 
> http://commits.kde.org/kde-workspace/418bc96f257aa3bc20930a5061a88ac2e94f825
> f
> 
> diff --git a/powerdevil/kcmodule/profiles/EditPage.cpp
> b/powerdevil/kcmodule/profiles/EditPage.cpp index 4f89adb..0865b90 100644
> --- a/powerdevil/kcmodule/profiles/EditPage.cpp
> +++ b/powerdevil/kcmodule/profiles/EditPage.cpp
> @@ -127,17 +127,16 @@ EditPage::EditPage(QWidget *parent, const QVariantList
> &args) connect(watcher, SIGNAL(serviceRegistered(QString)), this,
> SLOT(onServiceRegistered(QString))); connect(watcher,
> SIGNAL(serviceUnregistered(QString)), this,
> SLOT(onServiceUnregistered(QString)));
> 
> -    int batteryCount = 0;
> -
> +    bool hasBattery = false;
>      foreach(const Solid::Device &device,
> Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) {
> const Solid::Battery *b = qobject_cast<const Solid::Battery*>
> (device.asDeviceInterface(Solid::DeviceInterface::Battery)); -       
> if(b->type() != Solid::Battery::PrimaryBattery && b->type() !=
> Solid::Battery::UpsBattery) { -            continue;
> +        if (b->isPowerSupply() && (b->type() ==
> Solid::Battery::PrimaryBattery || b->type() == Solid::Battery::UpsBattery))
> { +            hasBattery = true;
> +            break;
>          }
> -        ++batteryCount;
>      }
> 
> -    if (batteryCount == 0) {
> +    if (!hasBattery) {
>          tabWidget->setTabEnabled(1, false);
>          tabWidget->setTabEnabled(2, false);
>          tabWidget->setTabBarHidden(true);



More information about the Kde-hardware-devel mailing list