Hello community,
here is the log from the commit of package powerdevil
checked in at Tue Nov 11 16:10:33 CET 2008.
--------
--- KDE/powerdevil/powerdevil.changes 2008-11-04 10:44:24.000000000 +0100
+++ /mounts/work_src_done/STABLE/powerdevil/powerdevil.changes 2008-11-11 11:54:44.000000000 +0100
@@ -1,0 +2,20 @@
+Tue Nov 11 11:54:00 CET 2008 - stbinner@suse.de
+
+- backport PowerManagementConnector
+
+-------------------------------------------------------------------
+Mon Nov 10 11:51:04 CET 2008 - stbinner@suse.de
+
+- update to 1.4.1: critical bugfixes
+
+-------------------------------------------------------------------
+Sun Nov 9 15:11:53 CET 2008 - stbinner@suse.de
+
+- backport r881597 to fix KDE crash at start-up (bnc#443124)
+
+-------------------------------------------------------------------
+Fri Nov 7 20:49:08 CET 2008 - stbinner@suse.de
+
+- split off -lang, reduce buildrequires
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
powerdevil-1.4.0-kde4.1.2.tar.bz2
New:
----
powerdevil-1.4.1-kde4.1.3.tar.bz2
PowerManagementConnector.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ powerdevil.spec ++++++
--- /var/tmp/diff_new_pack.I26856/_old 2008-11-11 16:10:25.000000000 +0100
+++ /var/tmp/diff_new_pack.I26856/_new 2008-11-11 16:10:25.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package powerdevil (Version 1.4.0)
+# spec file for package powerdevil (Version 1.4.1)
#
# Copyright (c) 2008 Buschmann.
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
@@ -18,20 +18,22 @@
# norootforbuild
-BuildRequires: kdebase4-workspace-devel libkonq-devel update-desktop-files
+BuildRequires: kdebase4-workspace-devel update-desktop-files
Name: powerdevil
Summary: KDE Power Management
Url: http://kde-apps.org/content/show.php/PowerDevil?content=85078
-Version: 1.4.0
+Version: 1.4.1
Release: 1
-%define rversion 4.1.2
+%define rversion 4.1.3
License: GPL v2 or later
Group: System/GUI/KDE
Source0: powerdevil-%version-kde%rversion.tar.bz2
Source1: po.tar.bz2
Patch: po.diff
+Patch1: PowerManagementConnector.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+Requires: %{name}-lang = %{version}
%kde4_runtime_requires
%description
@@ -44,9 +46,11 @@
--------
Dario Freddi
+%lang_package
%prep
%setup -n powerdevil-%version-kde%rversion -b 1
%patch
+%patch1
%build
%cmake_kde4 -d build
@@ -62,7 +66,9 @@
%clean
rm -rf $RPM_BUILD_ROOT
-%files -f powerdevil.lang
+%files lang -f %name.lang
+
+%files
%defattr(-,root,root)
%doc COPYING
%doc %lang(en) /usr/share/doc/kde/HTML/en/kcontrol/powerdevilconfig
@@ -76,6 +82,14 @@
/usr/share/kde4/services/powerdevilconfig.desktop
%changelog
+* Tue Nov 11 2008 stbinner@suse.de
+- backport PowerManagementConnector
+* Mon Nov 10 2008 stbinner@suse.de
+- update to 1.4.1: critical bugfixes
+* Sun Nov 09 2008 stbinner@suse.de
+- backport r881597 to fix KDE crash at start-up (bnc#443124)
+* Fri Nov 07 2008 stbinner@suse.de
+- split off -lang, reduce buildrequires
* Mon Nov 03 2008 stbinner@suse.de
- update to 1.4.0:
* mem leak fixes
++++++ po.tar.bz2 ++++++
++++++ powerdevil-1.4.0-kde4.1.2.tar.bz2 -> powerdevil-1.4.1-kde4.1.3.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/cmake/modules/FindPAM.cmake new/powerdevil-1.4.1-kde4.1.3/cmake/modules/FindPAM.cmake
--- old/powerdevil-1.4.0-kde4.1.2/cmake/modules/FindPAM.cmake 1970-01-01 01:00:00.000000000 +0100
+++ new/powerdevil-1.4.1-kde4.1.3/cmake/modules/FindPAM.cmake 2008-11-09 22:12:15.000000000 +0100
@@ -0,0 +1,74 @@
+# - Try to find the PAM libraries
+# Once done this will define
+#
+# PAM_FOUND - system has pam
+# PAM_INCLUDE_DIR - the pam include directory
+# PAM_LIBRARIES - libpam library
+
+if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+ # Already in cache, be silent
+ set(PAM_FIND_QUIETLY TRUE)
+endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+
+find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h)
+find_library(PAM_LIBRARY pam)
+find_library(DL_LIBRARY dl)
+
+if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+ set(PAM_FOUND TRUE)
+ if (DL_LIBRARY)
+ set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
+ else (DL_LIBRARY)
+ set(PAM_LIBRARIES ${PAM_LIBRARY})
+ endif (DL_LIBRARY)
+
+ if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
+ # darwin claims to be something special
+ set(HAVE_PAM_PAM_APPL_H 1)
+ endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
+
+ if (NOT DEFINED PAM_MESSAGE_CONST)
+ include(CheckCXXSourceCompiles)
+ # XXX does this work with plain c?
+ check_cxx_source_compiles("
+#if ${HAVE_PAM_PAM_APPL_H}+0
+# include
+#else
+# include
+#endif
+
+static int PAM_conv(
+ int num_msg,
+ const struct pam_message **msg, /* this is the culprit */
+ struct pam_response **resp,
+ void *ctx)
+{
+ return 0;
+}
+
+int main(void)
+{
+ struct pam_conv PAM_conversation = {
+ &PAM_conv, /* this bombs out if the above does not match */
+ 0
+ };
+
+ return 0;
+}
+" PAM_MESSAGE_CONST)
+ endif (NOT DEFINED PAM_MESSAGE_CONST)
+ set(PAM_MESSAGE_CONST ${PAM_MESSAGE_CONST} CACHE BOOL "PAM expects a conversation function with const pam_message")
+
+endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
+
+if (PAM_FOUND)
+ if (NOT PAM_FIND_QUIETLY)
+ message(STATUS "Found PAM: ${PAM_LIBRARIES}")
+ endif (NOT PAM_FIND_QUIETLY)
+else (PAM_FOUND)
+ if (PAM_FIND_REQUIRED)
+ message(FATAL_ERROR "PAM was not found")
+ endif(PAM_FIND_REQUIRED)
+endif (PAM_FOUND)
+
+mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY PAM_MESSAGE_CONST)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/cmake/modules/UnixAuth.cmake new/powerdevil-1.4.1-kde4.1.3/cmake/modules/UnixAuth.cmake
--- old/powerdevil-1.4.0-kde4.1.2/cmake/modules/UnixAuth.cmake 1970-01-01 01:00:00.000000000 +0100
+++ new/powerdevil-1.4.1-kde4.1.3/cmake/modules/UnixAuth.cmake 2008-11-09 22:12:15.000000000 +0100
@@ -0,0 +1,55 @@
+find_package(PAM)
+
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+include(CheckIncludeFiles)
+
+set(UNIXAUTH_LIBRARIES)
+set(UNIXAUTH_INCLUDE_DIRS)
+
+set(SHADOW_LIBRARIES)
+check_function_exists(getspnam found_getspnam)
+if (found_getspnam)
+ set(HAVE_GETSPNAM 1)
+else (found_getspnam)
+ macro_push_required_vars()
+ set(CMAKE_REQUIRED_LIBRARIES -lshadow)
+ check_function_exists(getspnam found_getspnam_shadow)
+ if (found_getspnam_shadow)
+ set(HAVE_GETSPNAM 1)
+ set(SHADOW_LIBRARIES shadow)
+ check_function_exists(pw_encrypt HAVE_PW_ENCRYPT) # ancient Linux shadow
+ else (found_getspnam_shadow)
+ set(CMAKE_REQUIRED_LIBRARIES -lgen) # UnixWare
+ check_function_exists(getspnam found_getspnam_gen)
+ if (found_getspnam_gen)
+ set(HAVE_GETSPNAM 1)
+ set(SHADOW_LIBRARIES gen)
+ endif (found_getspnam_gen)
+ endif (found_getspnam_shadow)
+ macro_pop_required_vars()
+endif (found_getspnam)
+
+set(CRYPT_LIBRARIES)
+check_library_exists(crypt crypt "" HAVE_CRYPT)
+if (HAVE_CRYPT)
+ set(CRYPT_LIBRARIES crypt)
+ check_include_files(crypt.h HAVE_CRYPT_H)
+endif (HAVE_CRYPT)
+
+if (PAM_FOUND)
+
+ set(HAVE_PAM 1)
+ set(UNIXAUTH_LIBRARIES ${PAM_LIBRARIES})
+ set(UNIXAUTH_INCLUDE_DIRS ${PAM_INCLUDE_DIR})
+
+else (PAM_FOUND)
+
+ if (HAVE_GETSPNAM)
+ set(UNIXAUTH_LIBRARIES ${SHADOW_LIBRARIES})
+ endif (HAVE_GETSPNAM)
+ if (NOT HAVE_PW_ENCRYPT)
+ set(UNIXAUTH_LIBRARIES ${UNIXAUTH_LIBRARIES} ${CRYPT_LIBRARIES})
+ endif (NOT HAVE_PW_ENCRYPT)
+
+endif (PAM_FOUND)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/CMakeLists.txt new/powerdevil-1.4.1-kde4.1.3/CMakeLists.txt
--- old/powerdevil-1.4.0-kde4.1.2/CMakeLists.txt 2008-10-27 14:51:16.000000000 +0100
+++ new/powerdevil-1.4.1-kde4.1.3/CMakeLists.txt 2008-11-09 22:12:15.000000000 +0100
@@ -1,6 +1,6 @@
project(PowerDevil)
-#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
find_package(KDE4 REQUIRED)
find_package(Plasma REQUIRED)
@@ -11,11 +11,10 @@
include(ConfigureChecks.cmake)
-configure_file(config-powerdevil.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-powerdevil.h )
+macro_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER)
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
+configure_file(config-powerdevil.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-powerdevil.h )
-macro_bool_to_01(X11_Xscreensaver_FOUND HAVE_XSCREENSAVER)
macro_log_feature(HAVE_XSCREENSAVER "libxss" "XScreenSaver Library"
"http://www.x.org/" FALSE ""
"Needed to enable idle detection in PowerDevil power manager")
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/daemon/PowerDevilDaemon.cpp new/powerdevil-1.4.1-kde4.1.3/daemon/PowerDevilDaemon.cpp
--- old/powerdevil-1.4.0-kde4.1.2/daemon/PowerDevilDaemon.cpp 2008-10-27 14:51:16.000000000 +0100
+++ new/powerdevil-1.4.1-kde4.1.3/daemon/PowerDevilDaemon.cpp 2008-11-09 22:18:26.000000000 +0100
@@ -79,6 +79,16 @@
#endif
+#define POLLER_CALL(Object, Method) \
+ if (Object != 0) { \
+ AbstractSystemPoller *t = qobject_cast(Object); \
+ if (t!=0) { \
+ t->Method; \
+ } \
+ } else { \
+ kWarning() << "WARNING: No poller system loaded, PowerDevil can not detect idle time"; \
+ }
+
K_PLUGIN_FACTORY(PowerDevilFactory,
registerPlugin<PowerDevilDaemon>();)
K_EXPORT_PLUGIN(PowerDevilFactory("powerdevildaemon"))
@@ -123,21 +133,7 @@
m_profilesConfig = KSharedConfig::openConfig("powerdevilprofilesrc", KConfig::SimpleConfig);
setAvailableProfiles(m_profilesConfig->groupList());
- /* You'll see some switches on m_battery. This is fundamental since PowerDevil might run
- * also on system without batteries. Most of modern desktop systems support CPU scaling,
- * so somebody might find PowerDevil handy, and we don't want it to crash on them. To put it
- * short, we simply bypass all adaptor and battery events if no batteries are found.
- */
-
- // Here we get our battery interface, it will be useful later.
- foreach(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) {
- Solid::Device d = device;
- Solid::Battery *b = qobject_castSolid::Battery* (d.asDeviceInterface(Solid::DeviceInterface::Battery));
- if (b->type() != Solid::Battery::PrimaryBattery) {
- continue;
- }
- m_battery = b;
- }
+ recacheBatteryPointer(true);
// Set up all needed DBus interfaces
m_screenSaverIface = new OrgFreedesktopScreenSaverInterface("org.freedesktop.ScreenSaver", "/ScreenSaver",
@@ -153,19 +149,6 @@
SLOT(emitCriticalNotification(const QString&, const QString&,
const char*, const QString&)));
- /* Those slots are relevant only if we're on a system that has a battery. If not, we simply don't care
- * about them.
- */
- if (m_battery) {
- connect(m_notifier, SIGNAL(acAdapterStateChanged(int)), this, SLOT(acAdapterStateChanged(int)));
-
- if (!connect(m_battery, SIGNAL(chargePercentChanged(int, const QString &)), this,
- SLOT(batteryChargePercentChanged(int, const QString &)))) {
- emitCriticalNotification("powerdevilerror", i18n("Could not connect to battery interface!\n"
- "Please check your system configuration"));
- }
- }
-
/* Time for setting up polling! We can have different methods, so
* let's check what we got.
*/
@@ -203,6 +186,56 @@
delete m_currentConfig;
}
+bool PowerDevilDaemon::recacheBatteryPointer(bool force)
+{
+ /* You'll see some switches on m_battery. This is fundamental since PowerDevil might run
+ * also on system without batteries. Most of modern desktop systems support CPU scaling,
+ * so somebody might find PowerDevil handy, and we don't want it to crash on them. To put it
+ * short, we simply bypass all adaptor and battery events if no batteries are found.
+ */
+
+ if (m_battery) {
+ if (m_battery->isValid() && !force) {
+ return true;
+ }
+ }
+
+ m_battery = 0;
+
+ // Here we get our battery interface, it will be useful later.
+ foreach(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) {
+ Solid::Device d = device;
+ Solid::Battery *b = qobject_castSolid::Battery* (d.asDeviceInterface(Solid::DeviceInterface::Battery));
+
+ if (b->type() != Solid::Battery::PrimaryBattery) {
+ continue;
+ }
+
+ if (b->isValid()) {
+ m_battery = b;
+ }
+ }
+
+ /* Those slots are relevant only if we're on a system that has a battery. If not, we simply don't care
+ * about them.
+ */
+ if (m_battery) {
+ connect(m_notifier, SIGNAL(acAdapterStateChanged(int)), this, SLOT(acAdapterStateChanged(int)));
+
+ if (!connect(m_battery, SIGNAL(chargePercentChanged(int, const QString &)), this,
+ SLOT(batteryChargePercentChanged(int, const QString &)))) {
+
+ emitCriticalNotification("powerdevilerror", i18n("Could not connect to battery interface!\n"
+ "Please check your system configuration"));
+ return false;
+ }
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
void PowerDevilDaemon::setUpPollingSystem()
{
if (!loadPollingSystem((AbstractSystemPoller::PollingType) PowerDevilSettings::pollingSystem())) {
@@ -277,8 +310,8 @@
Solid::Control::PowerManager::setBrightness(settings->readEntry("brightness").toInt());
- m_pollLoader->poller()->stopCatchingIdleEvents();
- m_pollLoader->poller()->forcePollRequest();
+ POLLER_CALL(m_pollLoader->poller(), stopCatchingIdleEvents());
+ POLLER_CALL(m_pollLoader->poller(), forcePollRequest());
}
void PowerDevilDaemon::refreshStatus()
@@ -365,7 +398,7 @@
Solid::Control::PowerManager::setScheme(settings->readEntry("scheme"));
- m_pollLoader->poller()->forcePollRequest();
+ POLLER_CALL(m_pollLoader->poller(), forcePollRequest());
}
void PowerDevilDaemon::setUpDPMS()
@@ -699,7 +732,7 @@
return;
}
- m_pollLoader->poller()->simulateUserActivity(); //prevent infinite suspension loops
+ POLLER_CALL(m_pollLoader->poller(), simulateUserActivity()); //prevent infinite suspension loops
if (PowerDevilSettings::configLockScreen()) {
lockScreen();
@@ -719,7 +752,7 @@
return;
}
- m_pollLoader->poller()->simulateUserActivity(); //prevent infinite suspension loops
+ POLLER_CALL(m_pollLoader->poller(), simulateUserActivity()); //prevent infinite suspension loops
if (PowerDevilSettings::configLockScreen()) {
lockScreen();
@@ -738,7 +771,7 @@
return;
}
- m_pollLoader->poller()->simulateUserActivity(); //prevent infinite suspension loops
+ POLLER_CALL(m_pollLoader->poller(), simulateUserActivity()); //prevent infinite suspension loops
if (PowerDevilSettings::configLockScreen()) {
lockScreen();
@@ -759,7 +792,7 @@
+ QChar('\n') + job->errorString()));
}
- m_pollLoader->poller()->simulateUserActivity(); //prevent infinite suspension loops
+ POLLER_CALL(m_pollLoader->poller(), simulateUserActivity()); //prevent infinite suspension loops
kDebug() << "Resuming from suspension";
@@ -787,7 +820,7 @@
if (!settings->readEntry("dimOnIdle", false) && !settings->readEntry("turnOffIdle", false) &&
settings->readEntry("idleAction").toInt() == None) {
kDebug() << "Stopping timer";
- m_pollLoader->poller()->stopCatchingTimeouts();
+ POLLER_CALL(m_pollLoader->poller(), stopCatchingTimeouts());
return;
}
@@ -815,7 +848,7 @@
if (idle < minTime) {
int remaining = minTime - idle;
- m_pollLoader->poller()->setNextTimeout(remaining * 1000);
+ POLLER_CALL(m_pollLoader->poller(), setNextTimeout(remaining * 1000));
kDebug() << "Nothing to do, next event in" << remaining << "seconds";
return;
}
@@ -833,23 +866,23 @@
switch (settings->readEntry("idleAction").toInt()) {
case Shutdown:
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
shutdownNotification(true);
break;
case S2Disk:
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
suspendToDiskNotification(true);
break;
case S2Ram:
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
suspendToRamNotification(true);
break;
case Standby:
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
standbyNotification(true);
break;
case Lock:
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
lockScreen();
break;
default:
@@ -860,20 +893,20 @@
} else if (settings->readEntry("dimOnIdle", false)
&& (idle >= dimOnIdleTime)) {
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
Solid::Control::PowerManager::setBrightness(0);
} else if (settings->readEntry("dimOnIdle", false)
&& (idle >= (dimOnIdleTime * 3 / 4))) {
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
float newBrightness = Solid::Control::PowerManager::brightness() / 4;
Solid::Control::PowerManager::setBrightness(newBrightness);
} else if (settings->readEntry("dimOnIdle", false) &&
(idle >= (dimOnIdleTime * 1 / 2))) {
- m_pollLoader->poller()->catchIdleEvent();
+ POLLER_CALL(m_pollLoader->poller(), catchIdleEvent());
float newBrightness = Solid::Control::PowerManager::brightness() / 2;
Solid::Control::PowerManager::setBrightness(newBrightness);
} else {
- m_pollLoader->poller()->stopCatchingIdleEvents();
+ POLLER_CALL(m_pollLoader->poller(), stopCatchingIdleEvents());
Solid::Control::PowerManager::setBrightness(settings->readEntry("brightness").toInt());
}
@@ -902,10 +935,10 @@
}
if (nextTimeout >= 0) {
- m_pollLoader->poller()->setNextTimeout(nextTimeout * 1000);
+ POLLER_CALL(m_pollLoader->poller(), setNextTimeout(nextTimeout * 1000));
kDebug() << "Next timeout in" << nextTimeout << "seconds";
} else {
- m_pollLoader->poller()->stopCatchingTimeouts();
+ POLLER_CALL(m_pollLoader->poller(), stopCatchingTimeouts());
kDebug() << "Stopping timer";
}
}
@@ -1039,7 +1072,7 @@
void PowerDevilDaemon::reloadProfile(int state)
{
- if (!m_battery) {
+ if (!recacheBatteryPointer()) {
setCurrentProfile(PowerDevilSettings::aCProfile());
} else {
if (state == -1) {
@@ -1084,7 +1117,7 @@
}
}
- m_pollLoader->poller()->forcePollRequest();
+ POLLER_CALL(m_pollLoader->poller(), forcePollRequest());
}
void PowerDevilDaemon::setProfile(const QString & profile)
@@ -1095,11 +1128,7 @@
* to be loaded!!
*/
- if (m_battery) {
- acAdapterStateChanged(Solid::Control::PowerManager::acAdapterState(), true);
- } else {
- applyProfile();
- }
+ applyProfile();
KConfigGroup * settings = getCurrentProfile();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/daemon/PowerDevilDaemon.h new/powerdevil-1.4.1-kde4.1.3/daemon/PowerDevilDaemon.h
--- old/powerdevil-1.4.0-kde4.1.2/daemon/PowerDevilDaemon.h 2008-10-27 14:51:16.000000000 +0100
+++ new/powerdevil-1.4.1-kde4.1.3/daemon/PowerDevilDaemon.h 2008-11-09 22:18:26.000000000 +0100
@@ -25,6 +25,7 @@
#include
#include <KComponentData>
#include <QStringList>
+#include <QPointer>
#include "AbstractSystemPoller.h"
@@ -141,6 +142,8 @@
bool loadPollingSystem(AbstractSystemPoller::PollingType type);
+ bool recacheBatteryPointer(bool force = false);
+
public:
enum IdleAction {
None = 0,
@@ -154,7 +157,7 @@
private:
Solid::Control::PowerManager::Notifier * m_notifier;
- Solid::Battery * m_battery;
+ QPointerSolid::Battery m_battery;
OrgFreedesktopScreenSaverInterface * m_screenSaverIface;
OrgKdeKSMServerInterfaceInterface * m_ksmServerIface;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/kcmodule/AssignmentPage.cpp new/powerdevil-1.4.1-kde4.1.3/kcmodule/AssignmentPage.cpp
--- old/powerdevil-1.4.0-kde4.1.2/kcmodule/AssignmentPage.cpp 2008-09-29 00:24:21.000000000 +0200
+++ new/powerdevil-1.4.1-kde4.1.3/kcmodule/AssignmentPage.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,121 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 by Dario Freddi *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#include "AssignmentPage.h"
-
-#include "PowerDevilSettings.h"
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-
-#include <KConfigGroup>
-#include <KLineEdit>
-#include <QCheckBox>
-#include <QFormLayout>
-#include <KDialog>
-#include <KFileDialog>
-#include <KMessageBox>
-#include <KIconButton>
-
-AssignmentPage::AssignmentPage(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-
- m_profilesConfig = KSharedConfig::openConfig("powerdevilprofilesrc", KConfig::SimpleConfig);
-
- fillUi();
-}
-
-AssignmentPage::~AssignmentPage()
-{
-}
-
-void AssignmentPage::fillUi()
-{
- reloadAvailableProfiles();
-
- // modified fields...
-
- connect(acProfile, SIGNAL(currentIndexChanged(int)), SLOT(emitChanged()));
- connect(lowProfile, SIGNAL(currentIndexChanged(int)), SLOT(emitChanged()));
- connect(warningProfile, SIGNAL(currentIndexChanged(int)), SLOT(emitChanged()));
- connect(batteryProfile, SIGNAL(currentIndexChanged(int)), SLOT(emitChanged()));
-}
-
-void AssignmentPage::load()
-{
- acProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::aCProfile()));
- lowProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::lowProfile()));
- warningProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::warningProfile()));
- batteryProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::batteryProfile()));
-}
-
-void AssignmentPage::save()
-{
- PowerDevilSettings::setACProfile(acProfile->currentText());
- PowerDevilSettings::setLowProfile(lowProfile->currentText());
- PowerDevilSettings::setWarningProfile(warningProfile->currentText());
- PowerDevilSettings::setBatteryProfile(batteryProfile->currentText());
-
- PowerDevilSettings::self()->writeConfig();
-}
-
-void AssignmentPage::emitChanged()
-{
- emit changed(true);
-}
-
-void AssignmentPage::reloadAvailableProfiles()
-{
- m_profilesConfig->reparseConfiguration();
-
- acProfile->clear();
- batteryProfile->clear();
- lowProfile->clear();
- warningProfile->clear();
-
- if (m_profilesConfig->groupList().isEmpty()) {
- kDebug() << "No available profiles!";
- return;
- }
-
- foreach(const QString &ent, m_profilesConfig->groupList()) {
- KConfigGroup *group = new KConfigGroup(m_profilesConfig, ent);
-
- acProfile->addItem(KIcon(group->readEntry("iconname")), ent);
- batteryProfile->addItem(KIcon(group->readEntry("iconname")), ent);
- lowProfile->addItem(KIcon(group->readEntry("iconname")), ent);
- warningProfile->addItem(KIcon(group->readEntry("iconname")), ent);
- }
-
- acProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::aCProfile()));
- lowProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::lowProfile()));
- warningProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::warningProfile()));
- batteryProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::batteryProfile()));
-
-}
-
-#include "AssignmentPage.moc"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/kcmodule/AssignmentPage.h new/powerdevil-1.4.1-kde4.1.3/kcmodule/AssignmentPage.h
--- old/powerdevil-1.4.0-kde4.1.2/kcmodule/AssignmentPage.h 2008-09-29 00:24:21.000000000 +0200
+++ new/powerdevil-1.4.1-kde4.1.3/kcmodule/AssignmentPage.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 by Dario Freddi *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#ifndef ASSIGNMENTPAGE_H
-#define ASSIGNMENTPAGE_H
-
-#include <QWidget>
-
-#include "ui_profileAssignmentPage.h"
-
-class AssignmentPage : public QWidget, private Ui_profileAssignmentPage
-{
- Q_OBJECT
-
-public:
- AssignmentPage(QWidget *parent = 0);
- ~AssignmentPage();
- void fillUi();
-
- void load();
- void save();
-
-signals:
- void changed(bool ch);
-
-private slots:
- void emitChanged();
-
- void reloadAvailableProfiles();
-
-private:
-
- KSharedConfig::Ptr m_profilesConfig;
- bool m_profileEdited;
-};
-
-#endif /* ASSIGNMENTPAGE_H_ */
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/kcmodule/CMakeLists.txt new/powerdevil-1.4.1-kde4.1.3/kcmodule/CMakeLists.txt
--- old/powerdevil-1.4.0-kde4.1.2/kcmodule/CMakeLists.txt 2008-10-02 01:18:11.000000000 +0200
+++ new/powerdevil-1.4.1-kde4.1.3/kcmodule/CMakeLists.txt 2008-11-09 22:12:15.000000000 +0100
@@ -2,7 +2,6 @@
PowerDevilKCM.cpp
ConfigWidget.cpp
GeneralPage.cpp
- AssignmentPage.cpp
EditPage.cpp
CapabilitiesPage.cpp
ErrorWidget.cpp
@@ -10,7 +9,6 @@
kde4_add_ui_files(kcm_powerdevil_SRCS
generalPage.ui
- profileAssignmentPage.ui
profileEditPage.ui
capabilitiesPage.ui
error.ui)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/powerdevil-1.4.0-kde4.1.2/kcmodule/profileAssignmentPage.ui new/powerdevil-1.4.1-kde4.1.3/kcmodule/profileAssignmentPage.ui
--- old/powerdevil-1.4.0-kde4.1.2/kcmodule/profileAssignmentPage.ui 2008-10-02 01:18:11.000000000 +0200
+++ new/powerdevil-1.4.1-kde4.1.3/kcmodule/profileAssignmentPage.ui 1970-01-01 01:00:00.000000000 +0100
@@ -1,123 +0,0 @@
-<ui version="4.0" >
- <class>profileAssignmentPage</class>
- <widget class="QWidget" name="profileAssignmentPage" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>177</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <property name="spacing" >
- <number>0</number>
- </property>
- <property name="margin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QGroupBox" name="groupBox_4" >
- <property name="title" >
- <string>Profiles</string>
- </property>
- <layout class="QFormLayout" name="formLayout_4" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>When AC Adaptor is plugged in</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="KComboBox" name="acProfile" >
- <property name="maximumSize" >
- <size>
- <width>280</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>When on battery Power</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="KComboBox" name="batteryProfile" >
- <property name="maximumSize" >
- <size>
- <width>280</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_8" >
- <property name="text" >
- <string>When battery is at low level</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="KComboBox" name="lowProfile" >
- <property name="maximumSize" >
- <size>
- <width>280</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_9" >
- <property name="text" >
- <string>When battery is at warning level</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1" >
- <widget class="KComboBox" name="warningProfile" >
- <property name="maximumSize" >
- <size>
- <width>280</width>
- <height>16777215</height>
- </size>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
++++++ PowerManagementConnector.diff ++++++
--- daemon/CMakeLists.txt 2008/11/11 10:25:42 1.1
+++ daemon/CMakeLists.txt 2008/11/11 10:42:00
@@ -11,6 +11,7 @@
TimerBasedPoller.cpp
PollSystemLoader.cpp
SuspensionLockHandler.cpp
+ PowerManagementConnector.cpp
)
kde4_add_kcfg_files(kded_powerdevil_SRCS ../PowerDevilSettings.kcfgc)
@@ -24,6 +25,9 @@
qt4_add_dbus_interface(kded_powerdevil_SRCS ${ksmserver_xml} ksmserver_interface )
qt4_add_dbus_adaptor( kded_powerdevil_SRCS org.kde.PowerDevil.xml PowerDevilDaemon.h PowerDevilDaemon )
+qt4_add_dbus_adaptor( kded_powerdevil_SRCS ${DBUS_INTERFACES_INSTALL_DIR}/org.kde.Solid.PowerManagement.xml PowerManagementConnector.h PowerManagementConnector )
+qt4_add_dbus_adaptor( kded_powerdevil_SRCS ${DBUS_INTERFACES_INSTALL_DIR}/org.kde.Solid.PowerManagement.Inhibit.xml PowerManagementConnector.h PowerManagementConnector powermanagementinhibitadaptor PowerManagementInhibitAdaptor )
+
kde4_add_plugin( kded_powerdevil
${kded_powerdevil_SRCS}
)
--- daemon/PowerDevilDaemon.cpp 2008/11/11 10:26:55 1.1
+++ daemon/PowerDevilDaemon.cpp 2008/11/11 10:28:13
@@ -41,6 +41,7 @@
#include "PowerDevilSettings.h"
#include "powerdeviladaptor.h"
+#include "PowerManagementConnector.h"
#include "PollSystemLoader.h"
#include "SuspensionLockHandler.h"
@@ -173,6 +174,7 @@
//DBus
new PowerDevilAdaptor(this);
+ new PowerManagementConnector(this);
// This gets registered to avoid double copies.
QDBusConnection::sessionBus().registerService("org.kde.powerdevilsystem");
--- daemon/PowerManagementConnector.h 2008/11/11 10:28:50 1.1
+++ daemon/PowerManagementConnector.h 2008/11/11 10:29:15
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * Copyright (C) 2008 by Kevin Ottens *
+ * Copyright (C) 2008 by Dario Freddi *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ ***************************************************************************/
+
+#ifndef POWERMANAGEMENTCONNECTOR_H
+#define POWERMANAGEMENTCONNECTOR_H
+
+#include
+#include
+#include
+
+#include
+
+#include "PowerDevilDaemon.h"
+
+class PowerManagementConnector : public QObject
+{
+ Q_OBJECT
+
+public:
+ PowerManagementConnector(PowerDevilDaemon *parent);
+
+ bool CanHibernate();
+ bool CanSuspend();
+
+ bool GetPowerSaveStatus();
+
+ void Suspend();
+ void Hibernate();
+
+ bool HasInhibit();
+
+ int Inhibit(const QString &application, const QString &reason);
+ void UnInhibit(int cookie);
+ void ForceUnInhibitAll();
+
+signals:
+ void CanSuspendChanged(bool canSuspend);
+ void CanHibernateChanged(bool canHibernate);
+ void PowerSaveStatusChanged(bool savePower);
+
+ void HasInhibitChanged(bool hasInhibit);
+
+private slots:
+ void _k_stateChanged(int battery, bool plugged);
+
+private:
+ PowerDevilDaemon *m_daemon;
+
+
+};
+
+#endif /*POWERMANAGEMENTCONNECTOR_H*/
--- daemon/PowerManagementConnector.cpp 2008/11/11 10:28:53 1.1
+++ daemon/PowerManagementConnector.cpp 2008/11/11 10:29:11
@@ -0,0 +1,107 @@
+/***************************************************************************
+ * Copyright (C) 2008 by Kevin Ottens *
+ * Copyright (C) 2008 by Dario Freddi *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
+ **************************************************************************/
+
+#include "PowerManagementConnector.h"
+
+#include "SuspensionLockHandler.h"
+
+#include
+
+#include "powermanagementadaptor.h"
+#include "powermanagementinhibitadaptor.h"
+
+PowerManagementConnector::PowerManagementConnector(PowerDevilDaemon *parent)
+ : QObject(parent), m_daemon(parent)
+{
+ new PowerManagementAdaptor(this);
+ new PowerManagementInhibitAdaptor(this);
+
+ QDBusConnection c = QDBusConnection::sessionBus();
+
+ c.registerService("org.kde.Solid.PowerManagement");
+ c.registerObject("/org/kde/Solid/PowerManagement", this);
+
+ c.registerService("org.kde.Solid.PowerManagement.Inhibit");
+ c.registerObject("/org/kde/Solid/PowerManagement/Inhibit", this);
+
+ connect(m_daemon, SIGNAL(stateChanged(int, bool)),
+ this, SLOT(_k_stateChanged(int, bool)));
+ connect(m_daemon->lockHandler(), SIGNAL(inhibitChanged(bool)),
+ this, SIGNAL(HasInhibitChanged(bool)));
+}
+
+bool PowerManagementConnector::CanHibernate()
+{
+ Solid::Control::PowerManager::SuspendMethods methods
+ = Solid::Control::PowerManager::supportedSuspendMethods();
+
+ return methods & Solid::Control::PowerManager::ToDisk;
+}
+
+bool PowerManagementConnector::CanSuspend()
+{
+ Solid::Control::PowerManager::SuspendMethods methods
+ = Solid::Control::PowerManager::supportedSuspendMethods();
+
+ return methods & Solid::Control::PowerManager::ToRam;
+}
+
+bool PowerManagementConnector::GetPowerSaveStatus()
+{
+ return Solid::Control::PowerManager::acAdapterState() == Solid::Control::PowerManager::Unplugged;
+}
+
+void PowerManagementConnector::Suspend()
+{
+ m_daemon->suspend(PowerDevilDaemon::S2Ram);
+}
+
+void PowerManagementConnector::Hibernate()
+{
+ m_daemon->suspend(PowerDevilDaemon::S2Disk);
+}
+
+bool PowerManagementConnector::HasInhibit()
+{
+ return m_daemon->lockHandler()->hasInhibit();
+}
+
+int PowerManagementConnector::Inhibit(const QString &application, const QString &reason)
+{
+ return m_daemon->lockHandler()->inhibit(application, reason);
+}
+
+void PowerManagementConnector::UnInhibit(int cookie)
+{
+ m_daemon->lockHandler()->releaseInhibiton(cookie);
+}
+
+void PowerManagementConnector::ForceUnInhibitAll()
+{
+ m_daemon->lockHandler()->releaseAllInhibitions();
+}
+
+void PowerManagementConnector::_k_stateChanged(int battery, bool plugged)
+{
+ Q_UNUSED(battery)
+ emit PowerSaveStatusChanged(!plugged);
+}
+
+#include "PowerManagementConnector.moc"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org