From 08ead1253f193f84e0786359247bb48296fc031a Mon Sep 17 00:00:00 2001 From: philm Date: Sat, 11 Dec 2010 04:23:48 +0000 Subject: [PATCH 01/11] fix some issues in tribe --- tools-pkg-tribe/PKGBUILD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools-pkg-tribe/PKGBUILD b/tools-pkg-tribe/PKGBUILD index ae53b1b5d..abc74f18f 100644 --- a/tools-pkg-tribe/PKGBUILD +++ b/tools-pkg-tribe/PKGBUILD @@ -9,7 +9,7 @@ # pkgname=tribe pkgver=0.3.45.5 -pkgrel=1 +pkgrel=2 pkgdesc="Tribe - Chakra LiveCD Installer" url="http://git.chakra-project.org/chakra/" license="GPL" @@ -22,7 +22,7 @@ conflicts=('chakra-tribe' 'tribe-svn' 'kdemod-partitionmanager' 'kdemod-tribe' ' options=('!splithdr' '!splitdbg') source=("http://chakra-project.org/sources/tribe/tribe-${pkgver}.tar.gz" 'http://chakra-project.org/sources/tribe/mirrorlist') -md5sums=('e7071e76cbd95100fa05a2991fa284e3' +md5sums=('024a37d8eb8d4e53bba555d605c7b83f' 'dfb3c82b5b1fbc2fccba8725c74dab7a') groups=('kde-uninstall') @@ -69,5 +69,5 @@ build() find $startdir/pkg/ -name ".git" -type d -exec rm -fr {} + # remove release notes - #rm -v $pkgdir/usr/share/tribe/config/RELEASE_NOTES.html + rm -v $pkgdir/usr/share/tribe/config/RELEASE_NOTES.html } From 4a83fb5525091ca41f0579cdb5d2ef9471ba6cbf Mon Sep 17 00:00:00 2001 From: philm Date: Sun, 12 Dec 2010 00:55:52 +0000 Subject: [PATCH 02/11] add stable changes to tribe --- tools-pkg-tribe/PKGBUILD | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools-pkg-tribe/PKGBUILD b/tools-pkg-tribe/PKGBUILD index abc74f18f..c92e3e9dd 100644 --- a/tools-pkg-tribe/PKGBUILD +++ b/tools-pkg-tribe/PKGBUILD @@ -8,8 +8,8 @@ # package info # pkgname=tribe -pkgver=0.3.45.5 -pkgrel=2 +pkgver=0.3.45.6 +pkgrel=1 pkgdesc="Tribe - Chakra LiveCD Installer" url="http://git.chakra-project.org/chakra/" license="GPL" @@ -22,7 +22,7 @@ conflicts=('chakra-tribe' 'tribe-svn' 'kdemod-partitionmanager' 'kdemod-tribe' ' options=('!splithdr' '!splitdbg') source=("http://chakra-project.org/sources/tribe/tribe-${pkgver}.tar.gz" 'http://chakra-project.org/sources/tribe/mirrorlist') -md5sums=('024a37d8eb8d4e53bba555d605c7b83f' +md5sums=('d2729edab1c98f499493ac312f5f4a46' 'dfb3c82b5b1fbc2fccba8725c74dab7a') groups=('kde-uninstall') @@ -38,7 +38,6 @@ build() # fixes #cd "${srcdir}/chakra-$pkgname" #patch -Np1 -i ${srcdir}/fix.patch || return 1 - #patch -Np1 -i ${srcdir}/drake#2.patch || return 1 cd "${srcdir}/chakra-$pkgname" From 0fa01ba270c7acc09967071dca89f0491731c158 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Sun, 12 Dec 2010 12:23:49 +0000 Subject: [PATCH 03/11] Added italian translations to *.desktop files --- kde-common/Chakra-Bugs.desktop | 2 ++ kde-common/Chakra-ChangeLog.desktop | 2 ++ kde-common/Chakra-Code.desktop | 2 ++ kde-common/Chakra-Documentation.desktop | 4 +++- kde-common/Chakra-Donate.desktop | 2 ++ kde-common/Chakra-Forum.desktop | 2 ++ kde-common/Chakra-Homepage.desktop | 1 + kde-common/Chakra-backup.desktop | 1 + 8 files changed, 15 insertions(+), 1 deletion(-) diff --git a/kde-common/Chakra-Bugs.desktop b/kde-common/Chakra-Bugs.desktop index 853c9ed82..be6b2f380 100644 --- a/kde-common/Chakra-Bugs.desktop +++ b/kde-common/Chakra-Bugs.desktop @@ -1,10 +1,12 @@ [Desktop Entry] Comment=Chakra Bug Tracking System Comment[ca]=Sistema de seguiment d'errors de Chakra +Comment[it]=Sistema di tracciatura errori di Chakra Exec=xdg-open http://www.chakra-project.org/bugs/ Icon=kbugbuster Name=Bugs Name[ca]=Errors +Name[it]=Errori StartupNotify=true Terminal=false Type=Application diff --git a/kde-common/Chakra-ChangeLog.desktop b/kde-common/Chakra-ChangeLog.desktop index 79fe8d215..ae186e5c3 100644 --- a/kde-common/Chakra-ChangeLog.desktop +++ b/kde-common/Chakra-ChangeLog.desktop @@ -1,10 +1,12 @@ [Desktop Entry] Comment=Chakra Package ChangeLogs Comment[ca]=Registre de canvis a paquets de Chakra +Comment[it]=Registro cambiamenti nei pacchetti di Chakra Exec=xdg-open http://gitorious.org/chakra-packages Icon=utilities-log-viewer Name=Package ChangeLogs Name[ca]=Registre de canvis a paquets +Name[it]=Registro cambiamenti nei pacchetti StartupNotify=true Terminal=false Type=Application diff --git a/kde-common/Chakra-Code.desktop b/kde-common/Chakra-Code.desktop index dee783080..ec001b13b 100644 --- a/kde-common/Chakra-Code.desktop +++ b/kde-common/Chakra-Code.desktop @@ -1,10 +1,12 @@ [Desktop Entry] Comment=Chakra Code Repository Comment[ca]=Repostiori de codi de Chakra +Comment[it]=Repository del Codice di Chakra Exec=xdg-open http://www.chakra-project.org/code/ Icon=preferences-system Name=Code Name[ca]=Codi +Name[it]=Codice StartupNotify=true Terminal=false Type=Application diff --git a/kde-common/Chakra-Documentation.desktop b/kde-common/Chakra-Documentation.desktop index 30bf24681..779e114ed 100644 --- a/kde-common/Chakra-Documentation.desktop +++ b/kde-common/Chakra-Documentation.desktop @@ -1,10 +1,12 @@ [Desktop Entry] Comment=Chakra Documentation Comment[ca]=Documentació de Chakra +Comment[it]=Documentazione di Chakra Exec=xdg-open http://www.chakra-project.org/wiki/ Icon=system-help Name=Documentation -Name[ca]=Documentació +Name[ca]=Documentaci +Name[it]=Documentazione StartupNotify=true Terminal=false Type=Application diff --git a/kde-common/Chakra-Donate.desktop b/kde-common/Chakra-Donate.desktop index 2d83b1e71..399314ec1 100644 --- a/kde-common/Chakra-Donate.desktop +++ b/kde-common/Chakra-Donate.desktop @@ -1,10 +1,12 @@ [Desktop Entry] Comment=Chakra Donations Comment[ca]=Donacions a Chakra +Comment[it]=Donazioni per Chakra Exec=xdg-open http://www.chakra-project.org/donate.html Icon=applications-toys Name=Donate Name[ca]=Donacions +Name[it]=Donazioni StartupNotify=true Terminal=false Type=Application diff --git a/kde-common/Chakra-Forum.desktop b/kde-common/Chakra-Forum.desktop index d18a9a5da..73193575e 100644 --- a/kde-common/Chakra-Forum.desktop +++ b/kde-common/Chakra-Forum.desktop @@ -1,9 +1,11 @@ [Desktop Entry] Comment=Chakra Forums Comment[ca]=Forums de Chakra +Comment[it]=Forum di Chakra Exec=xdg-open http://www.chakra-project.org/bbs/ Icon=system-users Name=Forums +Name[it]=Forum StartupNotify=true Terminal=false Type=Application diff --git a/kde-common/Chakra-Homepage.desktop b/kde-common/Chakra-Homepage.desktop index a2df1391e..5f1497eca 100644 --- a/kde-common/Chakra-Homepage.desktop +++ b/kde-common/Chakra-Homepage.desktop @@ -1,6 +1,7 @@ [Desktop Entry] Comment=Chakra Homepage Comment[ca]=Lloc web de Chakra +Comment[it]=Homepage di Chakra Exec=xdg-open http://www.chakra-project.org Icon=chakra-flat Name=Homepage diff --git a/kde-common/Chakra-backup.desktop b/kde-common/Chakra-backup.desktop index 6d43a0518..81a685ef1 100644 --- a/kde-common/Chakra-backup.desktop +++ b/kde-common/Chakra-backup.desktop @@ -4,6 +4,7 @@ Exec=/usr/bin/chakra-backup Name=miniBackup GenericName=Backup your most important KDE files GenericName[ca]=Còpia de seguretad dels fitxers més importants +GenericName[it]=Copia di sicurezza dei file più importanti di KDE X-KDE-StartupNotify=false Icon=application-x-tarz Terminal=false From 231aa64ac5e24fa9b16ae4336f71b04c6a7b0ddd Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Sun, 12 Dec 2010 12:35:13 +0000 Subject: [PATCH 04/11] updated md5sums in PKGBUILD --- kde-common/PKGBUILD | 20 ++++++++++---------- kde-common/servicemenu-copy-path.desktop | 7 +++++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/kde-common/PKGBUILD b/kde-common/PKGBUILD index 44fbeaf9e..5e439041e 100644 --- a/kde-common/PKGBUILD +++ b/kde-common/PKGBUILD @@ -20,7 +20,7 @@ _origname=common pkgname=kde-common arch=(i686 x86_64) pkgver=${_kdever} -pkgrel=1 +pkgrel=2 pkgdesc="KDE SC - Common Configuration Files, Scripts and Artwork" url="http://www.kde.org" @@ -65,16 +65,16 @@ source=(http://www.kde-apps.org/CONTENT/content-files/48411-rootactions_servicem agent-shutdown.sh) md5sums=('2afd86671ad0db31718157aecd46d528' # 48411-rootactions_servicemenu_2.4.10.tar.gz - '170a7675d1ee15d9d9d622de3eaa42a3' # servicemenu-copy-path.desktop + 'a4108e264667380876ffa7e9842892f4' # servicemenu-copy-path.desktop '630ffe7118eef8608a9e5e393a0b1e12' # 102825-compressattach.desktop.bz2 '75a91d82f262a2ad4625c55996ec5b82' # servicemenu-rootactions.patch - 'd8c49b6344f08ca7b15fa4a1a0ac337f' # Chakra-Bugs.desktop - 'fbc9bf83a6fa1fcef218ee3099e0d3d8' # Chakra-ChangeLog.desktop - 'b51b1ee5e92d6c427fb5af7a321e16c9' # Chakra-Code.desktop - '06580ed0b0b79da5ed06c25444bb4511' # Chakra-Documentation.desktop - '514a0dc5883feb9a25335f2928e5066f' # Chakra-Donate.desktop - 'd42617831b545d152f978c76aa6ac68d' # Chakra-Forum.desktop - '883231b91a7e03025f7f21ba3e9890b0' # Chakra-Homepage.desktop + '3f775e8c5626c216ac9a3e2f5c336a6b' # Chakra-Bugs.desktop + '35f4bd7a1ae4f1741e056a6f5715d822' # Chakra-ChangeLog.desktop + '50da3d602ce65df9350e94c1e35a4885' # Chakra-Code.desktop + '7342f9acdbb689ad7ab22dcb825a7f18' # Chakra-Documentation.desktop + 'f84921b4be3029efdcf6d8a176be84f6' # Chakra-Donate.desktop + '1be911f58eeef76fe920b8ebe0941464' # Chakra-Forum.desktop + 'bbd1e161559013dca5600c9f25fd6285' # Chakra-Homepage.desktop 'd314d4b658c7664efa407af3317ae0cd' # Chakra.directory '0688a20010ad27e35755e77c26c94d2c' # kdm.daemon '535501ac9f3ad05ddd18f8cfee4a2e06' # chakra-config-updater.sh @@ -85,7 +85,7 @@ md5sums=('2afd86671ad0db31718157aecd46d528' # 48411-rootactions_servicemenu_2.4 '4e974016ca509f187b4549d95877bacc' # chakra-update-user-sycoca.sh '2b0aaf209d35e1e8c660db66e61d13c7' # chakra-sysinfo.sh '660a7650478e5b7115fbb71811b5d9ee' # chakra-backup.sh - '931b22a8c53c9b02caac70dafc257bab' # Chakra-backup.desktop + 'f2ab6538277002028f1263fa7841e2e6' # Chakra-backup.desktop '466d7fc7cab5738d674df45fdeee4eb0' # updates.conf '1c85260174e58fc6efaa8d2cac947761' # chakra-icons.tar.gz '7daec96c125e1e238a35f31ea4a476f0' # agent-startup.sh diff --git a/kde-common/servicemenu-copy-path.desktop b/kde-common/servicemenu-copy-path.desktop index 0a83d8a20..c5a784e93 100644 --- a/kde-common/servicemenu-copy-path.desktop +++ b/kde-common/servicemenu-copy-path.desktop @@ -12,7 +12,8 @@ X-KDE-Submenu[de]=Pfad kopieren X-KDE-Submenu[el]=Αντιγραφή Διαδρομής X-KDE-Submenu[es]=Copiar ruta X-KDE-Submenu[fr]=Copie de chemin -X-KDE-Submenu[sv]=Kopiera sökväg +X-KDE-Submenu[it]=Copia Percorso +X-KDE-Submenu[sv]=Kopiera sökv [Desktop Action wholePath] Name=copy whole path @@ -21,6 +22,7 @@ Name[de]=kopiere Pfad Name[el]=Αντιγραφή ολόκληρης διαδρομής Name[es]=Copiar ruta completa Name[fr]=copier le chemin complet +Name[it]=copia l'intero percorso Name[sv]=Kopiera hela sökvägen Icon=klipper Exec=qdbus org.kde.klipper /klipper setClipboardContents %U @@ -32,6 +34,7 @@ Name[de]=kmail Anhang Name[el]=Eπισύναψη στο kmail Name[es]=Adjuntar en kmail Name[fr]=envoyer avec kmail +Name[it]=allega a kmail Name[sv]=Bifoga till KMail Icon=internet-mail -Exec=kmail --attach %U \ No newline at end of file +Exec=kmail --attach %U From 83af3788bea6b8bcacccd8ba2a88ddf67154edae Mon Sep 17 00:00:00 2001 From: Manuel Tortosa Date: Sun, 12 Dec 2010 18:50:24 +0100 Subject: [PATCH 05/11] Update version of kde-common to 4.5.85 beta2 --- kde-common/kde-common.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kde-common/kde-common.install b/kde-common/kde-common.install index 733f0603f..09006bb1e 100644 --- a/kde-common/kde-common.install +++ b/kde-common/kde-common.install @@ -3,7 +3,7 @@ # post_install() { echo " " - echo " > KDE Software Compilation 4.6 (beta1 - 4.5.80)" + echo " > KDE Software Compilation 4.6 (beta2 - 4.5.85)" echo " > packaged by the Chakra Project" echo " " echo " Installation Prefix : /usr" From b1b59eb0f166d377235e16c2c08d293a0fd7ea4c Mon Sep 17 00:00:00 2001 From: Manuel Tortosa Date: Sun, 12 Dec 2010 21:57:56 +0100 Subject: [PATCH 06/11] Reset pkgrel --- kde-common/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kde-common/PKGBUILD b/kde-common/PKGBUILD index 5e439041e..0d343861b 100644 --- a/kde-common/PKGBUILD +++ b/kde-common/PKGBUILD @@ -20,7 +20,7 @@ _origname=common pkgname=kde-common arch=(i686 x86_64) pkgver=${_kdever} -pkgrel=2 +pkgrel=1 pkgdesc="KDE SC - Common Configuration Files, Scripts and Artwork" url="http://www.kde.org" From cdb2e897278f808275223e6e29b69b9ea2801a1b Mon Sep 17 00:00:00 2001 From: Manuel Tortosa Date: Sun, 12 Dec 2010 23:46:25 +0100 Subject: [PATCH 07/11] Add langpacks to md5sums --- kde-sc.md5 | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/kde-sc.md5 b/kde-sc.md5 index d82131744..b00e4816b 100644 --- a/kde-sc.md5 +++ b/kde-sc.md5 @@ -8,6 +8,61 @@ dc7d5ae0713aed7e422f9e2ae067b6d4 kdebase-workspace-4.5.85.tar.bz2 267c7cc15f861fd97ecd65dc0bfe5f36 kdeedu-4.5.85.tar.bz2 de05e67bcc991e0a1de6c67ffbd12de2 kdegames-4.5.85.tar.bz2 d118404768b3f7b801b7c1bc4cc04cd4 kdegraphics-4.5.85.tar.bz2 +bae43888d7f16f7da79c4da263f1e356 kde-l10n-ar-4.5.85.tar.bz2 +f628cb9f566eb243110a4d2eef88f8fa kde-l10n-bg-4.5.85.tar.bz2 +236befe34e86d931bf81f0bf4b7cfe5b kde-l10n-ca-4.5.85.tar.bz2 +c512f45c9dd05e6ec6b3654e17ea9fec kde-l10n-ca@valencia-4.5.85.tar.bz2 +fd40c7049d6a476d015d5aba98394ef4 kde-l10n-cs-4.5.85.tar.bz2 +e6314f384b7dac4f312bf7f4bc190d61 kde-l10n-da-4.5.85.tar.bz2 +235a5fd712ac0f8c3be49ad47c0ffc3d kde-l10n-de-4.5.85.tar.bz2 +b3e530d967db3a9d02cc0fa13b51754d kde-l10n-el-4.5.85.tar.bz2 +2ef50faaa8a955ca59881f9aff7ac39b kde-l10n-en_GB-4.5.85.tar.bz2 +1ee5ad5eef20cbe2eb923ca58de4aad7 kde-l10n-eo-4.5.85.tar.bz2 +324211072c4105afd0b59b6a2b216f95 kde-l10n-es-4.5.85.tar.bz2 +f126ccd75acc8f27c491b2340218faa8 kde-l10n-et-4.5.85.tar.bz2 +659dac88af82925c2d11d34a11afb016 kde-l10n-eu-4.5.85.tar.bz2 +53d685f87f249eaef53ba33e92c37847 kde-l10n-fi-4.5.85.tar.bz2 +b13ca9b2b044cb14fd60c38db9bf10b5 kde-l10n-fr-4.5.85.tar.bz2 +a014980ab331a55e71b9e35345a0b5bf kde-l10n-fy-4.5.85.tar.bz2 +7230f81f70d2fd006caf473029f24eaa kde-l10n-ga-4.5.85.tar.bz2 +f580e539bac87847337a97ce898b8c45 kde-l10n-gl-4.5.85.tar.bz2 +e029c7ff3b2960ccc8667e446dccdbe2 kde-l10n-gu-4.5.85.tar.bz2 +6ac2276c35fecfd712da763be4300299 kde-l10n-he-4.5.85.tar.bz2 +8e93e3b3dec2849172c53e9309087f7a kde-l10n-hi-4.5.85.tar.bz2 +09b0f4bdfc8e025af6d0de0bcf120191 kde-l10n-hr-4.5.85.tar.bz2 +3f001eca1be7ece19bf8c9e2df71bad9 kde-l10n-hu-4.5.85.tar.bz2 +063b2328afd5812d55d55f78753d854f kde-l10n-ia-4.5.85.tar.bz2 +75c15e4f3113b01a151e7b6ce14f8581 kde-l10n-id-4.5.85.tar.bz2 +c744e3edef01a75f0aff54c79d0d7ad4 kde-l10n-is-4.5.85.tar.bz2 +40c17caf1992a90f0dc88ddc80b58a46 kde-l10n-it-4.5.85.tar.bz2 +17fc98d6ab2558788c61f3400dfbf5d8 kde-l10n-ja-4.5.85.tar.bz2 +672f601ba664b0cf94f8b2d8f4d8d927 kde-l10n-kk-4.5.85.tar.bz2 +03f998a0b6fdc5178c6913253a7656ba kde-l10n-km-4.5.85.tar.bz2 +e5b54fe34d853a1b03212303e3e6c380 kde-l10n-kn-4.5.85.tar.bz2 +20da0e73245240ff1d6c0d5b8b5fefa3 kde-l10n-ko-4.5.85.tar.bz2 +f947fb2a87e738a48591467d76b3a4ff kde-l10n-lt-4.5.85.tar.bz2 +fd59acb94c743490708bccb24fa8df71 kde-l10n-lv-4.5.85.tar.bz2 +f39dab97fcfd29a8aaa3ed5ed350594b kde-l10n-ml-4.5.85.tar.bz2 +7f4ba07103c43a4a261029a669140798 kde-l10n-nb-4.5.85.tar.bz2 +316300129f951420f10391129865b670 kde-l10n-nds-4.5.85.tar.bz2 +6647b7664e0540ea2efea41b4e76442d kde-l10n-nl-4.5.85.tar.bz2 +53fa33a5bce20558ecaaf5e152a97eb0 kde-l10n-nn-4.5.85.tar.bz2 +c16ac50d7691f3f539b893d2afb3373a kde-l10n-pa-4.5.85.tar.bz2 +9323a0e81abd5459d1287b0271b7d2b7 kde-l10n-pl-4.5.85.tar.bz2 +e565eec0dadd2d518cd61555523066b5 kde-l10n-pt-4.5.85.tar.bz2 +3d5eaba44d3392cedc56d73dbb07235c kde-l10n-pt_BR-4.5.85.tar.bz2 +5d91988dfc06bd7d8302ca7826aa35ee kde-l10n-ro-4.5.85.tar.bz2 +f653b5096aebf28acf7b78ab44fcf941 kde-l10n-ru-4.5.85.tar.bz2 +54d930a8a7e3f78c96f9d5dacfbceb3d kde-l10n-sk-4.5.85.tar.bz2 +7aa3398d577133363feb1a942e9e8af6 kde-l10n-sl-4.5.85.tar.bz2 +72aa7b20e90fb5f552be1012815e4f9f kde-l10n-sr-4.5.85.tar.bz2 +ade75a60efd6e5efda385da2a79c0b6c kde-l10n-sv-4.5.85.tar.bz2 +67dd9f76e2938d6228e218af3102c936 kde-l10n-th-4.5.85.tar.bz2 +69bea749796a5f63717370219b17f61a kde-l10n-tr-4.5.85.tar.bz2 +c09d00489c8361e68401d46f4e6d497d kde-l10n-uk-4.5.85.tar.bz2 +c7555abefff9e3d8fe902282c0ee41a5 kde-l10n-wa-4.5.85.tar.bz2 +a525902907a2af5c8aae3c1848c74892 kde-l10n-zh_CN-4.5.85.tar.bz2 +201dabf1c0ae6b0cd93f95023a8f765d kde-l10n-zh_TW-4.5.85.tar.bz2 bf826cdc8a1bc1e54af0341cdf548dd1 kdelibs-4.5.85.tar.bz2 ad518eed76ea9124b51ce545c6b6f105 kdemultimedia-4.5.85.tar.bz2 b866efcd24d1a643dfd7b6d161ed44aa kdenetwork-4.5.85.tar.bz2 @@ -20,4 +75,3 @@ ac07bee04420ab355c86dc8935083e61 kdetoys-4.5.85.tar.bz2 4f94cc2bbde27e79d39cef840a8b17f4 kdeutils-4.5.85.tar.bz2 c5e0748a91cb64f58600928ee714b1a5 kdewebdev-4.5.85.tar.bz2 7587a1e5aed2cb899dda1f0a03bd0fb9 oxygen-icons-4.5.85.tar.bz2 - From 71f6621527030054184330b2e1c1742659a7644b Mon Sep 17 00:00:00 2001 From: Manuel Date: Sun, 12 Dec 2010 22:54:10 +0000 Subject: [PATCH 08/11] Fix kdebindings --- kdebindings/PKGBUILD | 11 ++++------- kdebindings/perl-qtdbus.patch | 22 ---------------------- 2 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 kdebindings/perl-qtdbus.patch diff --git a/kdebindings/PKGBUILD b/kdebindings/PKGBUILD index 369ef0297..1df0d6e89 100644 --- a/kdebindings/PKGBUILD +++ b/kdebindings/PKGBUILD @@ -42,12 +42,10 @@ options=('docs' '!splithdr' 'splitdbg') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" 'pyqt>=4.8.1' 'ruby' 'mono' "kdegraphics-okular>=${_kdever}" "kdegraphics-common>=${_kdever}" "kdepim-runtime>=${_kdever}") -source=($_mirror/${_origname}-$_kdever.tar.bz2 - perl-qtdbus.patch) -md5sums=(`grep ${_origname}-$_kdever.tar.bz2 ../kde-sc.md5 | cut -d" " -f1` - 42a6ecd926b051b6c7a23d3988c7ebcf) - +source=($_mirror/${_origname}-$_kdever.tar.bz2) +md5sums=(`grep ${_origname}-$_kdever.tar.bz2 ../kde-sc.md5 | cut -d" " -f1`) + # # build function # @@ -55,8 +53,7 @@ build() { cd ${srcdir}/${_origname}-${pkgver} - msg "applying upstream patches ..." - patch -Np3 -i ${startdir}/perl-qtdbus.patch || return 1 +# msg "applying upstream patches ..." #fix ruby for f in `find ruby -name CMakeLists.txt`; do diff --git a/kdebindings/perl-qtdbus.patch b/kdebindings/perl-qtdbus.patch deleted file mode 100644 index 6f23c2b2c..000000000 --- a/kdebindings/perl-qtdbus.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- trunk/KDE/kdebindings/perl/qtdbus/tools/qdbusxml2perl/qdbusintrospection_p.h 2010/11/23 18:59:15 1200042 -+++ trunk/KDE/kdebindings/perl/qtdbus/tools/qdbusxml2perl/qdbusintrospection_p.h 2010/11/23 19:00:56 1200043 -@@ -63,7 +63,7 @@ - - QT_BEGIN_NAMESPACE - --class Q_DBUS_EXPORT QDBusIntrospection -+class Q_DECL_EXPORT QDBusIntrospection - { - public: - // forward declarations --- trunk/KDE/kdebindings/perl/qtdbus/tools/qdbusxml2perl/qdbusmetaobject_p.h 2010/11/18 00:55:20 1198257 -+++ trunk/KDE/kdebindings/perl/qtdbus/tools/qdbusxml2perl/qdbusmetaobject_p.h 2010/11/23 19:00:56 1200043 -@@ -62,7 +62,7 @@ - class QDBusError; - - struct QDBusMetaObjectPrivate; --struct Q_DBUS_EXPORT QDBusMetaObject: public QMetaObject -+struct Q_DECL_EXPORT QDBusMetaObject: public QMetaObject - { - bool cached; - From 7542250ec93ab8adc3e072a1e7f37020cfb327cb Mon Sep 17 00:00:00 2001 From: Manuel Tortosa Date: Mon, 13 Dec 2010 21:19:06 +0100 Subject: [PATCH 09/11] Fix m5sums for kdenetwork --- kde-sc.md5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kde-sc.md5 b/kde-sc.md5 index b00e4816b..3359ea619 100644 --- a/kde-sc.md5 +++ b/kde-sc.md5 @@ -65,7 +65,7 @@ a525902907a2af5c8aae3c1848c74892 kde-l10n-zh_CN-4.5.85.tar.bz2 201dabf1c0ae6b0cd93f95023a8f765d kde-l10n-zh_TW-4.5.85.tar.bz2 bf826cdc8a1bc1e54af0341cdf548dd1 kdelibs-4.5.85.tar.bz2 ad518eed76ea9124b51ce545c6b6f105 kdemultimedia-4.5.85.tar.bz2 -b866efcd24d1a643dfd7b6d161ed44aa kdenetwork-4.5.85.tar.bz2 +5180ed2d3e04a1160dd4520e0d3c5a46 kdenetwork-4.5.85.tar.bz2 b31328c6438782f19d81a556ec492576 kdepim-4.5.85.tar.bz2 274a16916336d19831325f6d78f3676a kdepimlibs-4.5.85.tar.bz2 d48195314533e30897db8c5dd2189d58 kdepim-runtime-4.5.85.tar.bz2 From 11b94f75d59800fbbc0cb247f6848587efe5b012 Mon Sep 17 00:00:00 2001 From: Manuel Date: Tue, 14 Dec 2010 23:18:31 +0000 Subject: [PATCH 10/11] Add new kdegames dependence for palapeli qhull --- kdegames/PKGBUILD | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kdegames/PKGBUILD b/kdegames/PKGBUILD index 695a788fd..b234b5129 100644 --- a/kdegames/PKGBUILD +++ b/kdegames/PKGBUILD @@ -47,7 +47,7 @@ pkgname=('kdegames-common' 'kdegames-konquest' 'kdegames-kpat' 'kdegames-kreversi' -# 'kdegames-ksame' + 'kdegames-ksame' 'kdegames-kshisen' 'kdegames-ksirk' 'kdegames-kspaceduel' @@ -70,7 +70,7 @@ license=('GPL' 'LGPL' 'FDL') options=('docs' '!splithdr' 'splitdbg') -makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" "kdebase-runtime>=${_kdever}" 'qca' 'ggz-client-libs' 'gnugo' 'twisted') +makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" "kdebase-runtime>=${_kdever}" 'qca' 'ggz-client-libs' 'gnugo' 'twisted' 'openal') source=("$_mirror/${_origname}-$_kdever.tar.bz2") md5sums=(`grep ${_origname}-$_kdever.tar.bz2 ../kde-sc.md5 | cut -d" " -f1`) @@ -178,7 +178,7 @@ package_kdegames-bovo() package_kdegames-granatier() { pkgdesc="Granatier is a clone of the classic Bomberman game, inspired by the work of the Clanbomber clone." - depends=("${_origname}-common>=${_kdever}") + depends=("${_origname}-common>=${_kdever}" 'openal') conflicts=("kdemod-${_origname}-granatier") groups=("kde-complete" "${_origname}" "kde-uninstall") install=${_origname}.install @@ -723,4 +723,4 @@ package_kdegames-palapeli() cd ${srcdir}/${_origname}-${pkgver}/${i} make DESTDIR=${pkgdir} install || return 1 done -} \ No newline at end of file +} From 47e7fb1d56b84c4fc828846862f1454cb44118a3 Mon Sep 17 00:00:00 2001 From: philm Date: Wed, 15 Dec 2010 14:51:53 +0000 Subject: [PATCH 11/11] reenable log-pkgs, fix upower/udisk bug in workspace --- kdeaccessibility/PKGBUILD | 2 +- kdeadmin/PKGBUILD | 2 +- kdebase-runtime/PKGBUILD | 2 +- kdebase-workspace/PKGBUILD | 17 +- kdebase-workspace/trunk_powerdevil.patch | 15712 +++++++++++++++++++++ kdebase/PKGBUILD | 2 +- kdebindings/PKGBUILD | 2 +- kdeedu/PKGBUILD | 2 +- kdegames/PKGBUILD | 2 +- kdegraphics/PKGBUILD | 2 +- kdemultimedia/PKGBUILD | 2 +- kdenetwork/PKGBUILD | 2 +- kdesdk/PKGBUILD | 2 +- kdetoys/PKGBUILD | 2 +- kdeutils/PKGBUILD | 2 +- 15 files changed, 15737 insertions(+), 18 deletions(-) create mode 100644 kdebase-workspace/trunk_powerdevil.patch diff --git a/kdeaccessibility/PKGBUILD b/kdeaccessibility/PKGBUILD index d154ea4cd..3abf6c6f8 100644 --- a/kdeaccessibility/PKGBUILD +++ b/kdeaccessibility/PKGBUILD @@ -39,7 +39,7 @@ url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') install=${_origname}.install -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdebase-runtime>=${_kdever}" "kdelibs>=${_kdever}" "speech-dispatcher>=0.6.7") diff --git a/kdeadmin/PKGBUILD b/kdeadmin/PKGBUILD index fcd9639d0..071dc0f2d 100644 --- a/kdeadmin/PKGBUILD +++ b/kdeadmin/PKGBUILD @@ -36,7 +36,7 @@ url="http://www.kde.org/" license=('GPL' 'LGPL' 'FDL') install=kdeadmin.install -options=('!splithdr' 'splitdbg') +options=('!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdepimlibs>=${_kdever}" "kdebase-runtime>=${_kdever}" "kdebindings-python>=${_kdever}" 'system-config-printer-common' "kdepim-runtime>=${_kdever}") diff --git a/kdebase-runtime/PKGBUILD b/kdebase-runtime/PKGBUILD index 307fcb88d..f719ac9b6 100644 --- a/kdebase-runtime/PKGBUILD +++ b/kdebase-runtime/PKGBUILD @@ -29,7 +29,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdepimlibs>=${_kdever}" 'openslp' 'xine-lib' 'libpulse' 'libssh' 'ntrack') diff --git a/kdebase-workspace/PKGBUILD b/kdebase-workspace/PKGBUILD index 5c1bfd349..452e43fe2 100644 --- a/kdebase-workspace/PKGBUILD +++ b/kdebase-workspace/PKGBUILD @@ -26,13 +26,13 @@ pkgname=('kdebase-workspace' arch=('i686' 'x86_64') pkgver=${_kdever} -pkgrel=1 +pkgrel=2 pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') # NOTE keep in sync with kdebase-workspace-depends depends=('polkit-kde' "kdepimlibs>=${_kdever}" 'qimageblitz' @@ -76,7 +76,10 @@ source=($_mirror/${_origname}-$_kdever.tar.bz2 fix_kdm_configdef.patch # "fix" some sytemsettings modules that need root access - fix_root-only-kcms.patch) + fix_root-only-kcms.patch + + # fix powerdevil + trunk_powerdevil.patch) # experimental, software transparency for plasma panels # feature_plasma-transparent-panel-v4-rb#472.patch @@ -116,7 +119,10 @@ md5sums=(`grep ${_origname}-$_kdever.tar.bz2 ../kde-sc.md5 | cut -d" " -f1` '814350c52c135d6f7bdada1e29223d38' # fix_terminate-server.patch # '5d752cf39a28306438bb6d82db6e1696' # fix_ck-shutdown.patch '97a5eb51e6f9d460f0d61bb322a1db5e' # fix_kdm_configdef.patch - '5f963f80a026f0600edae1b1c70411e5') # fix_root-only-kcms.patch + '5f963f80a026f0600edae1b1c70411e5' # fix_root-only-kcms.patch + + 'c6b58eb228d16c77d692df655046ee9f' # trunk_powerdevil.patch + # '13c3203589143e9e2fc757c17375227a' # feature_plasma-transparent-panel-v4-rb#472.patch # '7361012da217f9aeeca61f0e9956e1d0' # feature_brightness-osd.patch @@ -169,7 +175,8 @@ build() # patch -Np1 -i ${srcdir}/feature_history-notifications-enable-disable-kde#119207.patch || return 1 # patch -Np1 -i ${srcdir}/feature_kdm-plymouth.patch || return 1 - #msg "applying upstream patches ..." + msg "applying upstream patches ..." + patch -Np1 -i ${srcdir}/trunk_powerdevil.patch || return 1 #msg "applying arch patches ..." diff --git a/kdebase-workspace/trunk_powerdevil.patch b/kdebase-workspace/trunk_powerdevil.patch new file mode 100644 index 000000000..e156f4240 --- /dev/null +++ b/kdebase-workspace/trunk_powerdevil.patch @@ -0,0 +1,15712 @@ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/handlebuttoneventsconfig.cpp ../powerdevil/daemon/actions/bundled/handlebuttoneventsconfig.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/handlebuttoneventsconfig.cpp 2010-11-11 06:40:47.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/handlebuttoneventsconfig.cpp 2010-12-12 14:48:46.873333334 -0800 +@@ -54,8 +54,8 @@ + + void HandleButtonEventsConfig::load() + { +- m_lidCloseCombo->setCurrentIndex(configGroup().readEntry< uint >("lidAction", 0)); +- m_powerButtonCombo->setCurrentIndex(configGroup().readEntry< uint >("powerButtonAction", 0)); ++ m_lidCloseCombo->setCurrentIndex(m_lidCloseCombo->findData(QVariant::fromValue(configGroup().readEntry< uint >("lidAction", 0)))); ++ m_powerButtonCombo->setCurrentIndex(m_powerButtonCombo->findData(QVariant::fromValue(configGroup().readEntry< uint >("powerButtonAction", 0)))); + } + + QList< QPair< QString, QWidget* > > HandleButtonEventsConfig::buildUi() +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/powerdevilhandlebuttoneventsaction.desktop ../powerdevil/daemon/actions/bundled/powerdevilhandlebuttoneventsaction.desktop +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/powerdevilhandlebuttoneventsaction.desktop 2010-12-01 14:22:39.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/powerdevilhandlebuttoneventsaction.desktop 2010-12-12 14:48:46.873333334 -0800 +@@ -46,6 +46,7 @@ + Comment[pt]=Efectua uma acção quando carregar num botão + Comment[pt_BR]=Executa uma ação sempre que um botão é pressionado + Comment[sv]=Utför en åtgärd så fort en knapp trycks ner ++Comment[th]=ดำเนินการการกระทำเมื่อกดปุ่ม + Comment[uk]=Виконання дій у відповідь на натискання кнопки + Comment[x-test]=xxPerforms an action whenever a button is pressedxx + Comment[zh_TW]=按鍵被按下時執行動作 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/suspendsession.cpp ../powerdevil/daemon/actions/bundled/suspendsession.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/suspendsession.cpp 2010-11-11 06:40:47.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/suspendsession.cpp 2010-12-12 14:48:46.876666667 -0800 +@@ -20,6 +20,7 @@ + #include "suspendsession.h" + + #include "powerdevilbackendinterface.h" ++#include "powerdevilcore.h" + + #include + #include +@@ -110,6 +111,7 @@ + KWorkSpace::requestShutDown(KWorkSpace::ShutdownConfirmYes); + break; + case LockScreenMode: ++ core()->emitNotification("doingjob", i18n("The screen is being locked")); + lockScreenAndWait(); + break; + default: +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/entries ../powerdevil/daemon/actions/bundled/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/entries 2010-12-12 14:48:46.876666667 -0800 +@@ -0,0 +1,1082 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon/actions/bundled ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-09T05:34:09.191991Z ++1204797 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++runscript.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++5625be6611a24206cbf75cfb545cd48a ++2010-10-29T15:00:43.557175Z ++1191092 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2132 ++ ++brightnesscontrolconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++0b4c58c87a65fc5ee3c27d1a741f362c ++2010-11-08T09:08:33.709679Z ++1194096 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2709 ++ ++dimdisplay.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++3aa14c2670277ced9e3f824d30a36d51 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3110 ++ ++disabledesktopeffects.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++b57e999493f9f71c74a769835c3a49d0 ++2010-10-29T15:00:43.557175Z ++1191092 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2179 ++ ++handlebuttoneventsconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++99809427027ac82ceb47153fdfe0a3bd ++2010-11-10T10:01:56.124027Z ++1195058 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2119 ++ ++brightnesscontrol.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++b0efe613ffb9b72eae1359e60f5836cc ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2497 ++ ++runscriptconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++47bc01c10c53df864bff8ef156ed4343 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4073 ++ ++suspendsessionconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++e115e50311b06d0093ec1c79038c45e2 ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2099 ++ ++handlebuttonevents.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++8e3f3f293359f30e64dd6517a2662967 ++2010-11-10T10:02:04.157628Z ++1195062 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2424 ++ ++disabledesktopeffectsconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++3b593e27d04419fab407fb55b448ff82 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3682 ++ ++runscript.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++ac95b93f370aa1ca4e001b5912734849 ++2010-11-08T09:08:33.709679Z ++1194096 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2774 ++ ++suspendsession.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++e2e31fe1976d634aeb86fcc450e58cc6 ++2010-11-10T10:02:04.157628Z ++1195062 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2367 ++ ++dimdisplayconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++08bcb4db5191de0c2e7381169ca5876e ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2021 ++ ++CMakeLists.txt ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++967e861cfcfdccc22fc199a83bd959b9 ++2010-10-20T23:31:30.456937Z ++1187988 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++980 ++ ++disabledesktopeffects.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++4226ab435ed5f4d8b435605dff509ea2 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3278 ++ ++powerdevilbrightnesscontrolaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++6d1ab1277d20d6536ad79677a7284e91 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2511 ++ ++powerdevilhandlebuttoneventsaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++d20ccb967f5fb23d28c50f1e03e0151c ++2010-12-09T05:34:09.191991Z ++1204797 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2954 ++ ++handlebuttoneventsconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++2528cbf0fe3fa61f5b2f976f557343bf ++2010-12-04T00:01:55.649001Z ++1203437 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4506 ++ ++brightnesscontrolconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++74a7681037d54333fd4291811b48b95d ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2094 ++ ++dimdisplay.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++b0fd9c0215c5809ffe858a3e52fa3e94 ++2010-10-29T15:00:43.557175Z ++1191092 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2188 ++ ++suspendsessionconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++2d169a3ac50b310b4b9a7e9ef319165a ++2010-11-10T10:02:04.157628Z ++1195062 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4042 ++ ++powerdevilsuspendsessionaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.873333Z ++11cb9c9fd4a407b3a6764a1ac3ada28f ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2244 ++ ++handlebuttonevents.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++843da447a9e47a616bd6148b2526cd9f ++2010-11-10T10:02:04.157628Z ++1195062 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++5361 ++ ++brightnesscontrol.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++726985c8452cc4549dddda5da7fafe23 ++2010-10-29T15:00:43.557175Z ++1191092 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2160 ++ ++powerdevilrunscriptaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++f80d49ab49a597bfc1f91783513ab9cd ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2490 ++ ++powerdevildisabledesktopeffectsaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++7ba1306928f7ab04cd2ef09fe62779d5 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3467 ++ ++runscriptconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++06ed784b35c042adcba61ba21883b4b1 ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2180 ++ ++suspendsession.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++6a4a11ca351d417be7fdb74d601b7fc4 ++2010-12-08T22:53:37.211048Z ++1204752 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4624 ++ ++powerdevildimdisplayaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++b29733d41798d15643218074ff261130 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2749 ++ ++dimdisplayconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++39efb1de257ed8ec830b60dcf56d4406 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2640 ++ ++disabledesktopeffectsconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++b1a9cd636125766b687b97139fc3614f ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2211 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.cpp.svn-base 2010-12-12 14:48:46.860000001 -0800 +@@ -0,0 +1,73 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "brightnesscontrolconfig.h" ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilBrightnessControlConfigFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilBrightnessControlConfigFactory("powerdevilbrightnesscontrolaction_config")) ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++BrightnessControlConfig::BrightnessControlConfig(QObject *parent, const QVariantList& ) ++ : ActionConfig(parent) ++{ ++ ++} ++ ++BrightnessControlConfig::~BrightnessControlConfig() ++{ ++ ++} ++ ++void BrightnessControlConfig::save() ++{ ++ configGroup().writeEntry("value", m_slider->value()); ++ configGroup().sync(); ++} ++ ++void BrightnessControlConfig::load() ++{ ++ m_slider->setValue(configGroup().readEntry("value", 50)); ++} ++ ++QList< QPair< QString, QWidget* > > BrightnessControlConfig::buildUi() ++{ ++ QList< QPair< QString, QWidget* > > retlist; ++ m_slider = new QSlider(Qt::Horizontal); ++ m_slider->setMaximumWidth(300); ++ retlist.append(qMakePair< QString, QWidget* >(i18nc("Brightness level, label for the slider", "Level"), m_slider)); ++ ++ connect(m_slider, SIGNAL(sliderMoved(int)), this, SLOT(setChanged())); ++ ++ return retlist; ++} ++ ++ ++} ++} ++ ++#include "brightnesscontrolconfig.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrolconfig.h.svn-base 2010-12-12 14:48:46.863333335 -0800 +@@ -0,0 +1,52 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_BRIGHTNESSCONTROLCONFIG_H ++#define POWERDEVIL_BUNDLEDACTIONS_BRIGHTNESSCONTROLCONFIG_H ++ ++#include ++ ++#include ++ ++class QSlider; ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class KDE_EXPORT BrightnessControlConfig : public PowerDevil::ActionConfig ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(BrightnessControlConfig) ++public: ++ BrightnessControlConfig(QObject*, const QVariantList&); ++ virtual ~BrightnessControlConfig(); ++ ++ virtual void save(); ++ virtual void load(); ++ virtual QList< QPair< QString, QWidget* > > buildUi(); ++ ++private: ++ QSlider *m_slider; ++}; ++ ++} ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_BRIGHTNESSCONTROLCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrol.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrol.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrol.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrol.cpp.svn-base 2010-12-12 14:48:46.863333335 -0800 +@@ -0,0 +1,82 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "brightnesscontrol.h" ++ ++#include ++ ++#include ++#include ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++BrightnessControl::BrightnessControl(QObject* parent) ++ : Action(parent) ++{ ++ setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings); ++} ++ ++BrightnessControl::~BrightnessControl() ++{ ++ ++} ++ ++void BrightnessControl::onProfileUnload() ++{ ++ // ++} ++ ++void BrightnessControl::onWakeupFromIdle() ++{ ++ // ++} ++ ++void BrightnessControl::onIdleTimeout(int msec) ++{ ++ Q_UNUSED(msec); ++} ++ ++void BrightnessControl::onProfileLoad() ++{ ++ if (m_defaultValue > 0) { ++ QVariantMap args; ++ args["Value"] = QVariant::fromValue((float)m_defaultValue); ++ trigger(args); ++ } ++} ++ ++void BrightnessControl::triggerImpl(const QVariantMap& args) ++{ ++ backend()->setBrightness(args["Value"].toFloat()); ++} ++ ++bool BrightnessControl::loadAction(const KConfigGroup& config) ++{ ++ if (config.hasKey("value")) { ++ m_defaultValue = config.readEntry("value", 50); ++ } else { ++ m_defaultValue = -1; ++ } ++ ++ return true; ++} ++ ++} ++} +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrol.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrol.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/brightnesscontrol.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/brightnesscontrol.h.svn-base 2010-12-12 14:48:46.866666668 -0800 +@@ -0,0 +1,57 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_BRIGHTNESSCONTROL_H ++#define POWERDEVIL_BUNDLEDACTIONS_BRIGHTNESSCONTROL_H ++ ++#include ++ ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class BrightnessControl : public PowerDevil::Action ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(BrightnessControl) ++ ++public: ++ explicit BrightnessControl(QObject* parent); ++ virtual ~BrightnessControl(); ++ ++protected: ++ virtual void onProfileUnload(); ++ virtual void onWakeupFromIdle(); ++ virtual void onIdleTimeout(int msec); ++ virtual void onProfileLoad(); ++ virtual void triggerImpl(const QVariantMap& args); ++ ++public: ++ virtual bool loadAction(const KConfigGroup& config); ++ ++private: ++ int m_defaultValue; ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_BRIGHTNESSCONTROL_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/CMakeLists.txt.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/CMakeLists.txt.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/CMakeLists.txt.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/CMakeLists.txt.svn-base 2010-12-12 14:48:46.873333334 -0800 +@@ -0,0 +1,19 @@ ++function(add_powerdevil_bundled_action _name) ++ set(actionconfig_SRCS ${_name}config.cpp) ++ kde4_add_plugin(powerdevil${_name}action_config ++ ${actionconfig_SRCS}) ++ target_link_libraries(powerdevil${_name}action_config ++ ${KDE4_KDECORE_LIBS} ++ ${KDE4_KDEUI_LIBS} ++ powerdevilui ++ ${ARGN}) ++ install(TARGETS powerdevil${_name}action_config DESTINATION ${PLUGIN_INSTALL_DIR}) ++ install(FILES powerdevil${_name}action.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ++endfunction(add_powerdevil_bundled_action _name) ++ ++add_powerdevil_bundled_action(brightnesscontrol) ++add_powerdevil_bundled_action(dimdisplay) ++add_powerdevil_bundled_action(disabledesktopeffects) ++add_powerdevil_bundled_action(runscript ${KDE4_KIO_LIBS}) ++add_powerdevil_bundled_action(suspendsession ${KDE4_KIO_LIBS} ${KDE4_SOLID_LIBS}) ++add_powerdevil_bundled_action(handlebuttonevents ${KDE4_SOLID_LIBS}) +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplayconfig.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplayconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplayconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplayconfig.cpp.svn-base 2010-12-12 14:48:46.870000001 -0800 +@@ -0,0 +1,72 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "dimdisplayconfig.h" ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilDimDisplayConfigFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilDimDisplayConfigFactory("powerdevildimdisplayaction_config")) ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++DimDisplayConfig::DimDisplayConfig(QObject *parent, const QVariantList& ) ++ : ActionConfig(parent) ++{ ++ ++} ++ ++DimDisplayConfig::~DimDisplayConfig() ++{ ++ ++} ++ ++void DimDisplayConfig::save() ++{ ++ configGroup().writeEntry("idleTime", m_spinBox->value() * 60 * 1000); ++} ++ ++void DimDisplayConfig::load() ++{ ++ m_spinBox->setValue((configGroup().readEntry("idleTime", 600000) / 60) / 1000); ++} ++ ++QList< QPair< QString, QWidget* > > DimDisplayConfig::buildUi() ++{ ++ QList< QPair< QString, QWidget* > > retlist; ++ m_spinBox = new KIntSpinBox(0, 180, 1, 0, 0); ++ m_spinBox->setMaximumWidth(150); ++ m_spinBox->setSuffix(i18n(" min")); ++ retlist.append(qMakePair< QString, QWidget* >(i18n("After"), m_spinBox)); ++ ++ connect(m_spinBox, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); ++ ++ return retlist; ++} ++ ++} ++} ++ ++#include "dimdisplayconfig.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplayconfig.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplayconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplayconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplayconfig.h.svn-base 2010-12-12 14:48:46.873333334 -0800 +@@ -0,0 +1,51 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_DIMDISPLAYCONFIG_H ++#define POWERDEVIL_BUNDLEDACTIONS_DIMDISPLAYCONFIG_H ++ ++#include ++ ++class KIntSpinBox; ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class DimDisplayConfig : public PowerDevil::ActionConfig ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(DimDisplayConfig) ++public: ++ DimDisplayConfig(QObject *, const QVariantList&); ++ virtual ~DimDisplayConfig(); ++ ++ virtual void save(); ++ virtual void load(); ++ virtual QList< QPair< QString, QWidget* > > buildUi(); ++ ++private: ++ KIntSpinBox *m_spinBox; ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_DIMDISPLAYCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplay.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplay.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplay.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplay.cpp.svn-base 2010-12-12 14:48:46.860000001 -0800 +@@ -0,0 +1,97 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "dimdisplay.h" ++ ++#include ++ ++#include ++#include ++#include ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++DimDisplay::DimDisplay(QObject* parent) ++ : Action(parent) ++{ ++ setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings); ++} ++ ++DimDisplay::~DimDisplay() ++{ ++ ++} ++ ++void DimDisplay::onProfileUnload() ++{ ++} ++ ++void DimDisplay::onWakeupFromIdle() ++{ ++ setBrightnessHelper(m_oldBrightness); ++} ++ ++void DimDisplay::onIdleTimeout(int msec) ++{ ++ if (msec == m_dimOnIdleTime) { ++ setBrightnessHelper(0); ++ } else if (msec == (m_dimOnIdleTime * 3 / 4)) { ++ float newBrightness = backend()->brightness() / 4; ++ setBrightnessHelper(newBrightness); ++ } else if (msec == (m_dimOnIdleTime * 1 / 2)) { ++ m_oldBrightness = backend()->brightness(); ++ float newBrightness = backend()->brightness() / 2; ++ setBrightnessHelper(newBrightness); ++ } ++} ++ ++void DimDisplay::onProfileLoad() ++{ ++ // ++} ++ ++void DimDisplay::setBrightnessHelper(float brightness) ++{ ++ QVariantMap args; ++ args["_BrightnessValue"] = QVariant::fromValue(brightness); ++ trigger(args); ++} ++ ++void DimDisplay::triggerImpl(const QVariantMap& args) ++{ ++ backend()->setBrightness(args["_BrightnessValue"].toFloat()); ++} ++ ++bool DimDisplay::loadAction(const KConfigGroup& config) ++{ ++ kDebug(); ++ if (config.hasKey("idleTime")) { ++ m_dimOnIdleTime = config.readEntry("idleTime", 10000000); ++ kDebug() << "Loading timeouts with " << m_dimOnIdleTime; ++ registerIdleTimeout(m_dimOnIdleTime * 3 / 4); ++ registerIdleTimeout(m_dimOnIdleTime / 2); ++ registerIdleTimeout(m_dimOnIdleTime); ++ } ++ ++ return true; ++} ++ ++} ++} +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplay.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplay.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/dimdisplay.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/dimdisplay.h.svn-base 2010-12-12 14:48:46.863333335 -0800 +@@ -0,0 +1,60 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_DIMDISPLAY_H ++#define POWERDEVIL_BUNDLEDACTIONS_DIMDISPLAY_H ++ ++#include ++ ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class DimDisplay : public PowerDevil::Action ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(DimDisplay) ++ ++public: ++ explicit DimDisplay(QObject *parent); ++ virtual ~DimDisplay(); ++ ++protected: ++ virtual void onProfileUnload(); ++ virtual void onWakeupFromIdle(); ++ virtual void onIdleTimeout(int msec); ++ virtual void onProfileLoad(); ++ virtual void triggerImpl(const QVariantMap& args); ++ ++public: ++ virtual bool loadAction(const KConfigGroup& config); ++ ++private: ++ void setBrightnessHelper(float brightness); ++ ++ int m_dimOnIdleTime; ++ float m_oldBrightness; ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_DIMDISPLAY_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.cpp.svn-base 2010-12-12 14:48:46.866666668 -0800 +@@ -0,0 +1,97 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "disabledesktopeffectsconfig.h" ++ ++#include ++ ++#include ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilDisableDesktopEffectsConfigFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilDisableDesktopEffectsConfigFactory("powerdevildisabledesktopeffectsaction_config")) ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++DisableDesktopEffectsConfig::DisableDesktopEffectsConfig(QObject* parent, const QVariantList& ) ++ : ActionConfig(parent) ++{ ++ ++} ++ ++DisableDesktopEffectsConfig::~DisableDesktopEffectsConfig() ++{ ++ ++} ++ ++void DisableDesktopEffectsConfig::save() ++{ ++ configGroup().writeEntry("onIdle", m_comboBox->currentIndex() == 1); ++ configGroup().writeEntry("idleTime", m_idleTime->value() * 60 * 1000); ++ ++ configGroup().sync(); ++} ++ ++void DisableDesktopEffectsConfig::load() ++{ ++ m_comboBox->setCurrentIndex(configGroup().readEntry("onIdle", false) ? 1 : 0); ++ m_idleTime->setValue((configGroup().readEntry("idleTime", 600000) / 60) / 1000); ++} ++ ++QList< QPair< QString, QWidget* > > DisableDesktopEffectsConfig::buildUi() ++{ ++ QWidget *tempWidget = new QWidget; ++ QHBoxLayout *hlay = new QHBoxLayout; ++ m_comboBox = new KComboBox; ++ m_idleTime = new KIntSpinBox(0, 180, 1, 0, 0); ++ m_idleTime->setMaximumWidth(150); ++ m_idleTime->setSuffix(i18n(" min")); ++ m_idleTime->setDisabled(true); ++ m_comboBox->addItem(i18n("On Profile Load")); ++ m_comboBox->addItem(i18n("After")); ++ connect(m_comboBox, SIGNAL(currentIndexChanged(QString)), ++ this, SLOT(onIndexChanged(QString))); ++ ++ hlay->addWidget(m_comboBox); ++ hlay->addWidget(m_idleTime); ++ hlay->addStretch(); ++ ++ tempWidget->setLayout(hlay); ++ ++ QList< QPair< QString, QWidget* > > retlist; ++ retlist.append(qMakePair< QString, QWidget* >(i18n("Disable effects"), tempWidget)); ++ ++ connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); ++ connect(m_idleTime, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); ++ ++ return retlist; ++} ++ ++void DisableDesktopEffectsConfig::onIndexChanged(const QString &text) ++{ ++ m_idleTime->setEnabled(text == i18n("After")); ++} ++ ++} ++} ++ ++#include "disabledesktopeffectsconfig.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffectsconfig.h.svn-base 2010-12-12 14:48:46.870000001 -0800 +@@ -0,0 +1,55 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_DISABLEDESKTOPEFFECTSCONFIG_H ++#define POWERDEVIL_BUNDLEDACTIONS_DISABLEDESKTOPEFFECTSCONFIG_H ++ ++#include ++ ++class KIntSpinBox; ++class KComboBox; ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class DisableDesktopEffectsConfig : public PowerDevil::ActionConfig ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(DisableDesktopEffectsConfig) ++public: ++ DisableDesktopEffectsConfig(QObject *parent, const QVariantList&); ++ virtual ~DisableDesktopEffectsConfig(); ++ ++ virtual void save(); ++ virtual void load(); ++ virtual QList< QPair< QString, QWidget* > > buildUi(); ++ ++private: ++ KComboBox *m_comboBox; ++ KIntSpinBox *m_idleTime; ++ ++private Q_SLOTS: ++ void onIndexChanged(const QString&); ++}; ++ ++} ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_DISABLEDESKTOPEFFECTSCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffects.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffects.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffects.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffects.cpp.svn-base 2010-12-12 14:48:46.873333334 -0800 +@@ -0,0 +1,105 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "disabledesktopeffects.h" ++ ++#include ++#include ++ ++#include ++#include ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++DisableDesktopEffects::DisableDesktopEffects(QObject* parent) ++ : Action(parent) ++{ ++ setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings); ++} ++ ++DisableDesktopEffects::~DisableDesktopEffects() ++{ ++ ++} ++ ++void DisableDesktopEffects::onProfileUnload() ++{ ++ if (!m_hasIdleTime) { ++ QVariantMap args; ++ args["Enable"] = QVariant::fromValue(true); ++ trigger(args); ++ } ++} ++ ++void DisableDesktopEffects::onWakeupFromIdle() ++{ ++ QVariantMap args; ++ args["Enable"] = QVariant::fromValue(true); ++ trigger(args); ++} ++ ++void DisableDesktopEffects::onIdleTimeout(int msec) ++{ ++ Q_UNUSED(msec) ++ ++ QVariantMap args; ++ args["Enable"] = QVariant::fromValue(false); ++ trigger(args); ++} ++ ++void DisableDesktopEffects::onProfileLoad() ++{ ++ if (!m_hasIdleTime) { ++ QVariantMap args; ++ args["Enable"] = QVariant::fromValue(false); ++ trigger(args); ++ } ++} ++ ++void DisableDesktopEffects::triggerImpl(const QVariantMap& args) ++{ ++ bool enabled = args["Enable"].toBool(); ++ QDBusInterface kwiniface("org.kde.kwin", "/KWin", "org.kde.KWin", QDBusConnection::sessionBus()); ++ ++ QDBusPendingReply state = kwiniface.call("compositingActive"); ++ state.waitForFinished(); ++ ++ if (state.value() != enabled) { ++ kwiniface.asyncCall("toggleCompositing"); ++ } else { ++ } ++} ++ ++bool DisableDesktopEffects::loadAction(const KConfigGroup& config) ++{ ++ if (config.readEntry("onIdle", false) && config.hasKey("idleTime")) { ++ m_hasIdleTime = true; ++ registerIdleTimeout(config.readEntry("idleTime", 10000000)); ++ } else { ++ m_hasIdleTime = false; ++ } ++ ++ return true; ++} ++ ++} ++} ++ ++#include "disabledesktopeffects.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffects.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffects.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/disabledesktopeffects.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/disabledesktopeffects.h.svn-base 2010-12-12 14:48:46.860000001 -0800 +@@ -0,0 +1,55 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_DISABLEDESKTOPEFFECTS_H ++#define POWERDEVIL_BUNDLEDACTIONS_DISABLEDESKTOPEFFECTS_H ++ ++#include ++ ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class DisableDesktopEffects : public PowerDevil::Action ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(DisableDesktopEffects) ++public: ++ explicit DisableDesktopEffects(QObject* parent); ++ virtual ~DisableDesktopEffects(); ++ ++ virtual bool loadAction(const KConfigGroup& config); ++ ++protected: ++ virtual void onProfileUnload(); ++ virtual void onWakeupFromIdle(); ++ virtual void onIdleTimeout(int msec); ++ virtual void onProfileLoad(); ++ virtual void triggerImpl(const QVariantMap& args); ++ ++private: ++ bool m_hasIdleTime; ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_DISABLEDESKTOPEFFECTS_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.cpp.svn-base 2010-12-12 14:48:46.860000001 -0800 +@@ -0,0 +1,104 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "handlebuttoneventsconfig.h" ++ ++#include ++ ++#include ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilSuspendSessionConfigFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilSuspendSessionConfigFactory("powerdevilhandlebuttoneventsaction_config")) ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++HandleButtonEventsConfig::HandleButtonEventsConfig(QObject* parent, const QVariantList& ) ++ : ActionConfig(parent) ++{ ++ ++} ++ ++HandleButtonEventsConfig::~HandleButtonEventsConfig() ++{ ++ ++} ++ ++ ++void HandleButtonEventsConfig::save() ++{ ++ configGroup().writeEntry< uint >("lidAction", m_lidCloseCombo->itemData(m_lidCloseCombo->currentIndex()).toUInt()); ++ configGroup().writeEntry< uint >("powerButtonAction", m_powerButtonCombo->itemData(m_powerButtonCombo->currentIndex()).toUInt()); ++ ++ configGroup().sync(); ++} ++ ++void HandleButtonEventsConfig::load() ++{ ++ m_lidCloseCombo->setCurrentIndex(m_lidCloseCombo->findData(QVariant::fromValue(configGroup().readEntry< uint >("lidAction", 0)))); ++ m_powerButtonCombo->setCurrentIndex(m_powerButtonCombo->findData(QVariant::fromValue(configGroup().readEntry< uint >("powerButtonAction", 0)))); ++} ++ ++QList< QPair< QString, QWidget* > > HandleButtonEventsConfig::buildUi() ++{ ++ // Create the boxes ++ m_lidCloseCombo = new KComboBox; ++ m_powerButtonCombo = new KComboBox; ++ ++ // Fill the boxes with options! ++ { ++ QList< KComboBox* > boxes; ++ boxes << m_lidCloseCombo << m_powerButtonCombo; ++ ++ QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); ++ ++ foreach (KComboBox *box, boxes) { ++ box->addItem(KIcon("dialog-cancel"), i18n("Do nothing"), (uint)0); ++ if (methods.contains(Solid::PowerManagement::SuspendState)) { ++ box->addItem(KIcon("system-suspend"), i18n("Sleep"), (uint)1); ++ } ++ if (methods.contains(Solid::PowerManagement::HibernateState)) { ++ box->addItem(KIcon("system-suspend-hibernate"), i18n("Hibernate"), (uint)2); ++ } ++ box->addItem(KIcon("system-shutdown"), i18n("Shutdown"), (uint)3); ++ box->addItem(KIcon("system-lock-screen"), i18n("Lock screen"), (uint)4); ++ if (box != m_lidCloseCombo) { ++ box->addItem(KIcon("system-log-out"), i18n("Prompt log out dialog"), (uint)5); ++ } ++ box->addItem(KIcon("preferences-desktop-screensaver"), i18n("Turn off screen"), (uint)6); ++ } ++ } ++ ++ connect(m_lidCloseCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); ++ connect(m_powerButtonCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); ++ ++ QList< QPair< QString, QWidget* > > retlist; ++ retlist.append(qMakePair< QString, QWidget* >(i18n("When laptop lid closed"), m_lidCloseCombo)); ++ retlist.append(qMakePair< QString, QWidget* >(i18n("When power button pressed"), m_powerButtonCombo)); ++ ++ return retlist; ++} ++ ++} ++} ++ ++#include "handlebuttoneventsconfig.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttoneventsconfig.h.svn-base 2010-12-12 14:48:46.863333335 -0800 +@@ -0,0 +1,51 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTSCONFIG_H ++#define POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTSCONFIG_H ++ ++#include ++ ++class KComboBox; ++namespace PowerDevil { ++namespace BundledActions { ++ ++class HandleButtonEventsConfig : public PowerDevil::ActionConfig ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(HandleButtonEventsConfig) ++ ++public: ++ HandleButtonEventsConfig(QObject* parent, const QVariantList&); ++ virtual ~HandleButtonEventsConfig(); ++ ++ virtual void save(); ++ virtual void load(); ++ virtual QList< QPair< QString, QWidget* > > buildUi(); ++ ++private: ++ KComboBox *m_lidCloseCombo; ++ KComboBox *m_powerButtonCombo; ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTSCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttonevents.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttonevents.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttonevents.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttonevents.cpp.svn-base 2010-12-12 14:48:46.863333335 -0800 +@@ -0,0 +1,169 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "handlebuttonevents.h" ++ ++#include ++ ++#include ++#include ++ ++#include "screensaver_interface.h" ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++HandleButtonEvents::HandleButtonEvents(QObject* parent) ++ : Action(parent) ++ , m_lidAction(0) ++ , m_powerButtonAction(0) ++{ ++ // We enforce no policies here - after all, we just call other actions - which have their policies. ++ setRequiredPolicies(PowerDevil::PolicyAgent::None); ++ connect(backend(), SIGNAL(buttonPressed(PowerDevil::BackendInterface::ButtonType)), ++ this, SLOT(onButtonPressed(PowerDevil::BackendInterface::ButtonType))); ++} ++ ++HandleButtonEvents::~HandleButtonEvents() ++{ ++ ++} ++ ++void HandleButtonEvents::onProfileUnload() ++{ ++ m_lidAction = 0; ++ m_powerButtonAction = 0; ++} ++ ++void HandleButtonEvents::onWakeupFromIdle() ++{ ++ // ++} ++ ++void HandleButtonEvents::onIdleTimeout(int msec) ++{ ++ Q_UNUSED(msec) ++} ++ ++void HandleButtonEvents::onProfileLoad() ++{ ++ // ++} ++ ++void HandleButtonEvents::onButtonPressed(BackendInterface::ButtonType type) ++{ ++ switch (type) { ++ case BackendInterface::LidClose: ++ processAction(m_lidAction); ++ break; ++ case BackendInterface::LidOpen: ++ // In this case, let's send a wakeup event ++ KIdleTime::instance()->simulateUserActivity(); ++ break; ++ case BackendInterface::PowerButton: ++ processAction(m_powerButtonAction); ++ break; ++ default: ++ break; ++ } ++} ++ ++void HandleButtonEvents::processAction(uint action) ++{ ++ // Basically, we simply trigger other actions :) ++ switch (action) { ++ case 1: ++ // Sleep ++ triggerAction("SuspendSession", qVariantFromValue< uint >(1)); ++ break; ++ case 2: ++ // Hibernate ++ triggerAction("SuspendSession", qVariantFromValue< uint >(2)); ++ break; ++ case 3: ++ // Turn off PC ++ triggerAction("SuspendSession", qVariantFromValue< uint >(8)); ++ break; ++ case 4: ++ // Lock ++ triggerAction("SuspendSession", qVariantFromValue< uint >(32)); ++ break; ++ case 5: ++ // Shutdown dialog ++ triggerAction("SuspendSession", qVariantFromValue< uint >(16)); ++ break; ++ case 6: ++ // Turn off screen ++ triggerAction("DPMSControl", qVariantFromValue< QString >("TurnOff")); ++ break; ++ default: ++ // Do nothing ++ break; ++ } ++} ++ ++void HandleButtonEvents::triggerAction(const QString& action, const QVariant &type) ++{ ++ PowerDevil::Action *helperAction = ActionPool::instance()->loadAction(action, KConfigGroup(), core()); ++ if (helperAction) { ++ QVariantMap args; ++ args["Type"] = type; ++ // Being these actions a button press, they are always explicit ++ args["Explicit"] = true; ++ helperAction->trigger(args); ++ } ++} ++ ++void HandleButtonEvents::triggerImpl(const QVariantMap& args) ++{ ++ // For now, let's just accept the phantomatic "32" button. ++ if (args["Button"].toInt() == 32) { ++ switch (args["Button"].toUInt()) { ++ case 1: ++ // Sleep ++ triggerAction("SuspendSession", qVariantFromValue< uint >(1)); // To RAM ++ break; ++ case 2: ++ // Hibernate ++ triggerAction("SuspendSession", qVariantFromValue< uint >(2)); // To disk ++ break; ++ case 3: ++ // Turn off PC ++ triggerAction("SuspendSession", qVariantFromValue< uint >(8)); // Shutdown ++ break; ++ default: ++ // Do nothing ++ break; ++ } ++ } ++} ++ ++bool HandleButtonEvents::loadAction(const KConfigGroup& config) ++{ ++ // Read configs ++ m_lidAction = config.readEntry("lidAction", 0); ++ m_powerButtonAction = config.readEntry("powerButtonAction", 0); ++ ++ return true; ++} ++ ++} ++} ++ ++#include "handlebuttonevents.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttonevents.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttonevents.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/handlebuttonevents.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/handlebuttonevents.h.svn-base 2010-12-12 14:48:46.866666668 -0800 +@@ -0,0 +1,63 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTS_H ++#define POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTS_H ++ ++#include ++#include ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class HandleButtonEvents : public PowerDevil::Action ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(HandleButtonEvents) ++ ++public: ++ explicit HandleButtonEvents(QObject* parent); ++ virtual ~HandleButtonEvents(); ++ ++ virtual bool loadAction(const KConfigGroup& config); ++ ++protected: ++ virtual void triggerImpl(const QVariantMap& args); ++ virtual void onProfileUnload(); ++ virtual void onWakeupFromIdle(); ++ virtual void onIdleTimeout(int msec); ++ virtual void onProfileLoad(); ++ ++private Q_SLOTS: ++ void onButtonPressed(PowerDevil::BackendInterface::ButtonType type); ++ ++private: ++ void processAction(uint action); ++ void triggerAction(const QString &action, const QVariant &type); ++ ++ uint m_lidAction; ++ uint m_powerButtonAction; ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_HANDLEBUTTONEVENTS_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilbrightnesscontrolaction.desktop.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilbrightnesscontrolaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilbrightnesscontrolaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilbrightnesscontrolaction.desktop.svn-base 2010-12-12 14:48:46.860000001 -0800 +@@ -0,0 +1,60 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevil/Action ++X-KDE-Library=powerdevilbrightnesscontrolaction_config ++Icon=preferences-system-power-management ++Name=Display Brightness ++Name[ast]=Brillu de la pantalla ++Name[ca]=Mostra la lluminositat ++Name[da]=Skærmens lysstyrke ++Name[de]=Bildschirmhelligkeit ++Name[en_GB]=Display Brightness ++Name[es]=Brillo de la pantalla ++Name[et]=Monitori heledus ++Name[hr]=Osvjetljenje ekrana ++Name[ia]=Monstrar Brillantia ++Name[kk]=Дисплейдің жарықтығы ++Name[km]=ពន្លឺ​នៃ​ការ​បង្ហាញ ++Name[ko]=디스플레이 밝기 ++Name[lt]=Ekrano šviesumas ++Name[nb]=Skjermlysstyrke ++Name[nds]=Helligkeit ++Name[nl]=Helderheid van het beeldscherm ++Name[pa]=ਡਿਸਪਲੇਅ ਚਮਕ ++Name[pt]=Brilho do Ecrã ++Name[pt_BR]=Brilho da tela ++Name[sv]=Bildskärmens ljusstyrka ++Name[th]=ความสว่างของการแสดงผล ++Name[uk]=Яскравість дисплея ++Name[x-test]=xxDisplay Brightnessxx ++Name[zh_TW]=顯示亮度 ++Comment=Basic Controls for brightness ++Comment[ast]=Control básicu del brillu ++Comment[ca]=Controls bàsics per la lluminositat ++Comment[da]=Basal kontrol af lysstyrke ++Comment[de]=Grundeinstellungen zur Bildschirmhelligkeit ++Comment[en_GB]=Basic Controls for brightness ++Comment[es]=Control básico del brillo ++Comment[et]=Heleduse lihtne juhtimine ++Comment[ia]=Controlos basic pro brillantia ++Comment[kk]=Жарықтығының негізгі тұтқалары ++Comment[km]=ការ​ត្រួតពិនិត្យ​ពន្លឺ​ជា​មូលដ្ឋាន ++Comment[ko]=기본 밝기 제어 ++Comment[lt]=Pagrindiniai šviesumo valdikliai ++Comment[nb]=Grunnleggende lysstyrkestyring ++Comment[nds]=Eenfach Helligkeit-Instellen ++Comment[nl]=Basisbesturing voor helderheid ++Comment[pa]=ਚਮਕ ਲਈ ਮੁੱਢਲੇ ਕੰਟਰੋਲ ++Comment[pt]=Controlos básicos do brilho ++Comment[pt_BR]=Controles básicos do brilho ++Comment[sv]=Grundkontroller för ljusstyrka ++Comment[th]=การควบคุมพื้นฐานสำหรับความสว่าง ++Comment[tr]=Parlaklık için temel kontroller ++Comment[uk]=Базове керування яскравістю ++Comment[x-test]=xxBasic Controls for brightnessxx ++Comment[zh_TW]=基本亮度控制 ++ ++X-KDE-PowerDevil-Action-ID=BrightnessControl ++X-KDE-PowerDevil-Action-IsBundled=true ++X-KDE-PowerDevil-Action-UIComponentLibrary=powerdevilbrightnesscontrolaction_config ++X-KDE-PowerDevil-Action-ConfigPriority=100 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevildimdisplayaction.desktop.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevildimdisplayaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevildimdisplayaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevildimdisplayaction.desktop.svn-base 2010-12-12 14:48:46.870000001 -0800 +@@ -0,0 +1,58 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevil/Action ++# X-KDE-Library=powerdevildimdisplayaction ++Icon=preferences-desktop-display ++Name=Dim Display ++Name[ast]=Atenuación de pantalla ++Name[ca]=Atenuació de la pantalla ++Name[da]=Dæmp skærmen ++Name[de]=Bildschirm dimmen ++Name[en_GB]=Dim Display ++Name[es]=Atenuación de pantalla ++Name[et]=Heleduse tumendamine ++Name[ia]=Obscurar Monstrator ++Name[ja]=ディスプレイを暗くする ++Name[kk]=Дисплей жарықтығын азайту ++Name[km]=ការ​បង្ហាញ​ព្រិលៗ ++Name[ko]=화면 어둡게 하기 ++Name[lt]=Pritemdyti ekraną ++Name[nb]=Mørklegg skjermen ++Name[nds]=Schirm afdüüstern ++Name[nl]=Beeldscherm dimmen ++Name[pa]=ਡਿਸਪਲੇਅ ਡਿਮ ++Name[pt]=Escurecer o Ecrã ++Name[pt_BR]=Escurecer a tela ++Name[sv]=Dämpa bildskärm ++Name[th]=การแสดงผลแบบสลัว ++Name[uk]=Зменшити яскравість дисплея ++Name[x-test]=xxDim Displayxx ++Name[zh_TW]=變暗顯示 ++Comment=Dims gradually the display on a time basis ++Comment[ast]=Atenúa la pantalla gradualmente según pasa'l tiempu ++Comment[ca]=Atenua gradualment la pantalla en funció del temps ++Comment[da]=Dæmper skærmen gradvist baseret på tid ++Comment[de]=Dunkelt den Bildschirm zeitgesteuert ab ++Comment[en_GB]=Dims gradually the display on a time basis ++Comment[es]=Atenúa la pantalla gradualmente según pasa el tiempo ++Comment[et]=Kuva järkjärguline tumendamine aega arvestades ++Comment[ia]=Obscurar gradualmente le monstrator usante como base le tempore ++Comment[ja]=ディスプレイを時間とともに徐々に暗くする ++Comment[kk]=Дисплей жарықтығын біртіндеп азайту ++Comment[km]=ធ្វើ​ឲ្យ​​ការ​បង្ហាញ​ព្រិល​ៗ​ទៅ​តាម​​ពេលវេលា​ ++Comment[ko]=밝기를 단계적으로 어둡게 합니다 ++Comment[lt]=Laikui bėgant, dalinai pritamsina ekraną ++Comment[nb]=Mørklegger skjermen gradvis etter som tiden går ++Comment[nds]=Maakt de Schirm na en vörinstellt Tiet düüsterer ++Comment[nl]=Dimt geleidelijk het beeldscherm op basis van tijd ++Comment[pt]=Escurece gradualmente o ecrã durante um dado período ++Comment[pt_BR]=Escurece gradualmente a tela durante um período ++Comment[sv]=Dämpa bildskärmen gradvis baserat på tid ++Comment[uk]=Поступове зменшення яскравості дисплея з часом ++Comment[x-test]=xxDims gradually the display on a time basisxx ++Comment[zh_TW]=依時間逐漸讓顯示變暗 ++ ++X-KDE-PowerDevil-Action-ID=DimDisplay ++X-KDE-PowerDevil-Action-IsBundled=true ++X-KDE-PowerDevil-Action-UIComponentLibrary=powerdevildimdisplayaction_config ++X-KDE-PowerDevil-Action-ConfigPriority=99 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevildisabledesktopeffectsaction.desktop.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevildisabledesktopeffectsaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevildisabledesktopeffectsaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevildisabledesktopeffectsaction.desktop.svn-base 2010-12-12 14:48:46.866666668 -0800 +@@ -0,0 +1,62 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevil/Action ++# X-KDE-Library=powerdevildisabledesktopeffectsaction ++Icon=preferences-desktop-screensaver ++Name=Disable Desktop Effects ++Name[ast]=Desactivar efeutos del escritoriu ++Name[ca]=Deshabilita els efectes d'escriptori ++Name[da]=Deaktivér skrivebordseffekter ++Name[de]=Arbeitsflächeneffekte aussetzen ++Name[en_GB]=Disable Desktop Effects ++Name[es]=Desactivar efectos del escritorio ++Name[et]=Töölauaefektide keelamine ++Name[hu]=Asztali effektek kikapcsolása ++Name[ia]=Dis-habilitar Effectos de Scriptorio ++Name[ja]=デスクトップ効果を無効にする ++Name[kk]=Үстел эффекттерін бұғаттау ++Name[km]=បិទ​បែបផែន​ផ្ទៃ​តុ​ ++Name[ko]=데스크톱 효과 끄기 ++Name[lt]=Išjungti darbastalio efektus ++Name[nb]=Slå av skrivebordseffekter ++Name[nds]=Schriefdischeffekten utmaken ++Name[nl]=Bureaubladeffecten uitschakelen ++Name[pa]=ਡੈਸਕਟਾਪ ਪਰਭਾਵ ਬੰਦ ਕਰੋ ++Name[pt]=Desactivar os Efeitos do Ecrã ++Name[pt_BR]=Desabilitar os efeitos da área de trabalho ++Name[sv]=Inaktivera skrivbordseffekter ++Name[th]=ปิดลูกเล่นของพื้นที่ทำงาน ++Name[uk]=Вимкнути ефекти стільниці ++Name[x-test]=xxDisable Desktop Effectsxx ++Name[zh_TW]=關閉桌面效果 ++Comment=Temporary disables KWin's desktop effects ++Comment[ast]=Desactiva temporalmente los efectos d'escritoriu de KWin ++Comment[ca]=Deshabilita temporalment els efectes d'escriptori del KWin ++Comment[da]=Deaktiverer KWins skrivebordseffekter midlertidigt ++Comment[de]=Setzt die Arbeitsflächeneffekte von KWin temporär aus ++Comment[en_GB]=Temporary disables KWin's desktop effects ++Comment[es]=Desactiva temporalmente los efectos de escritorio de KWin ++Comment[et]=KWini töölauaefektide ajutine väljalülitamine ++Comment[hr]=Privremeno onemogućuje KWinove efekte radne površine ++Comment[ia]=Temporaneemente il dis-habilita effectos de scriptorio de KWin ++Comment[ja]=一時的に KWin のデスクトップ効果を無効にします ++Comment[kk]=KWin үстел эффекттерін уақытша доғару ++Comment[km]=បិទ​បែបផែន​ផ្ទៃតុ​របស់ KWin ជា​បណ្ដោះអាសន្ន ++Comment[ko]=KWin의 데스크톱 효과를 잠시 끕니다 ++Comment[lt]=Laikinai išjungia KWin darbastalio efektus ++Comment[nb]=Slår av KWins skrivebordseffekter midlertidig ++Comment[nds]=De KWin-Schriefdischeffekten en tietlang utmaken ++Comment[nl]=Bureaubladeffecten van KWin tijdelijk uitschakelen ++Comment[pa]=ਆਰਜ਼ੀ ਰੂਪ ਵਿੱਚ ਕੇਵਿਨ ਦੇ ਡੈਸਕਟਾਪ ਪਰਭਾਵ ਬੰਦ ਕਰੋ ++Comment[pt]=Desactiva temporariamente os efeitos do ecrã do KWin ++Comment[pt_BR]=Desabilita temporariamente os efeitos de área de trabalho do KWin ++Comment[sv]=Inaktiverar Kwins skrivbordseffekter tillfälligt ++Comment[th]=ปิดลูกเล่นพื้นที่ทำงานของ KWin ชั่วคราว ++Comment[uk]=Тимчасово вимикання ефекти стільниці KWin ++Comment[x-test]=xxTemporary disables KWin's desktop effectsxx ++Comment[zh_TW]=暫時關閉 KWin 的桌面效果 ++ ++X-KDE-PowerDevil-Action-ID=DisableDesktopEffects ++X-KDE-PowerDevil-Action-IsBundled=true ++X-KDE-PowerDevil-Action-UIComponentLibrary=powerdevildisabledesktopeffectsaction_config ++X-KDE-PowerDevil-Action-ConfigPriority=80 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilhandlebuttoneventsaction.desktop.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilhandlebuttoneventsaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilhandlebuttoneventsaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilhandlebuttoneventsaction.desktop.svn-base 2010-12-12 14:48:46.860000001 -0800 +@@ -0,0 +1,57 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevil/Action ++# X-KDE-Library=powerdevilhandlebuttoneventsaction ++Icon=system-suspend ++ ++Name=Button events handling ++Name[ast]=Remanar eventos botón ++Name[ca]=Gestió d'esdeveniments de botons ++Name[da]=Håndtering af knaphændelser ++Name[en_GB]=Button events handling ++Name[es]=Gestión de eventos de botón ++Name[et]=Nupusündmuste kohtlemine ++Name[ia]=Button maneante de eventos ++Name[kk]=Батырма басуға көңіл болу ++Name[km]=ការ​គ្រប់គ្រង​ប៊ូតុង​​ព្រឹត្តិការណ៍​​ ++Name[ko]=단추 이벤트 처리 ++Name[lt]=Mygtukų įvykių valdymas ++Name[nb]=Håndtering av knappehendelser ++Name[nds]=Knoop för't Ümgahn mit Begeefnissen ++Name[nl]=Knop voor afhandelen van evenementen ++Name[pa]=ਬਟਨ ਈਵੈਂਟ ਹੈਡਲਿੰਗ ++Name[pt]=Tratamento dos eventos dos botões ++Name[pt_BR]=Tratamento dos eventos dos botões ++Name[sv]=Händelsehantering för knappar ++Name[uk]=Обробка натискань кнопок ++Name[x-test]=xxButton events handlingxx ++Name[zh_TW]=按鍵事件處理 ++ ++Comment=Performs an action whenever a button is pressed ++Comment[ast]=Facer aiciones cuando se calque un botón ++Comment[ca]=Porta a terme una acció quan es prem un botó ++Comment[da]=Udfører en handling når der trykke på en knap ++Comment[en_GB]=Performs an action whenever a button is pressed ++Comment[es]=Realiza una acción cuando se presiona un botón ++Comment[et]=Toimingu sooritamine, kui vajutatakse nuppu ++Comment[ia]=Il executa un action quando un button es pressate ++Comment[kk]=Әрқашанда батырмасы басылғанда әрекетін орындау ++Comment[km]=អនុវត្ត​សកម្មភាព​នៅពេល​ដែល​ចុច​ប៊ូតុង ++Comment[ko]=단추가 눌렸을 때 동작을 실행합니다 ++Comment[lt]=Įvykdo veiksmą kiekvieną kartą paspaudus mygtuką ++Comment[nb]=Utfører en handling hver gang en knapp trykkes ++Comment[nds]=Föhrt en Akschoon ut, wenn en Knoop drückt warrt ++Comment[nl]=Voer een actie uit als er een knop wordt ingedrukt ++Comment[pa]=ਜਦੋਂ ਬਟਨ ਦੱਬਿਆ ਜਾਵੇ ਤਾਂ ਕਾਰਵਾਈ ਕਰੋ ++Comment[pt]=Efectua uma acção quando carregar num botão ++Comment[pt_BR]=Executa uma ação sempre que um botão é pressionado ++Comment[sv]=Utför en åtgärd så fort en knapp trycks ner ++Comment[th]=ดำเนินการการกระทำเมื่อกดปุ่ม ++Comment[uk]=Виконання дій у відповідь на натискання кнопки ++Comment[x-test]=xxPerforms an action whenever a button is pressedxx ++Comment[zh_TW]=按鍵被按下時執行動作 ++ ++X-KDE-PowerDevil-Action-ID=HandleButtonEvents ++X-KDE-PowerDevil-Action-IsBundled=true ++X-KDE-PowerDevil-Action-UIComponentLibrary=powerdevilhandlebuttoneventsaction_config ++X-KDE-PowerDevil-Action-ConfigPriority=80 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilrunscriptaction.desktop.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilrunscriptaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilrunscriptaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilrunscriptaction.desktop.svn-base 2010-12-12 14:48:46.866666668 -0800 +@@ -0,0 +1,64 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevil/Action ++# X-KDE-Library=powerdevilrunscriptaction ++Icon=system-run ++Name=Run Script ++Name[ast]=Executar guión ++Name[ca]=Executa un script ++Name[da]=Kør script ++Name[de]=Skript ausführen ++Name[en_GB]=Run Script ++Name[es]=Ejecutar guión ++Name[et]=Skripti käivitamine ++Name[hr]=Pokreni skriptu ++Name[hu]=Parancsfájl futtatása ++Name[ia]=Exequer Script ++Name[ja]=スクリプトを実行 ++Name[kk]=Скриптті орындау ++Name[km]=ដំណើរការ​ស្គ្រីប ++Name[ko]=스크립트 실행 ++Name[lt]=Paleisti scenarijų ++Name[nb]=Kjør skript ++Name[nds]=Skript utföhren ++Name[nl]=Script uitvoeren ++Name[pa]=ਸਕ੍ਰਿਪਟ ਚਲਾਓ ++Name[pt]=Executar um Programa ++Name[pt_BR]=Executar script ++Name[sv]=Kör skript ++Name[th]=ให้สคริปต์ทำงาน ++Name[uk]=Виконати скрипт ++Name[x-test]=xxRun Scriptxx ++Name[zh_TW]=執行文稿 ++Comment=Runs a custom script ++Comment[ast]=Executa un guión personalizáu ++Comment[ca]=Executa un script personalitzat ++Comment[da]=Kører et brugerdefineret script ++Comment[de]=Führt ein benutzerdefiniertes Skript aus ++Comment[en_GB]=Runs a custom script ++Comment[es]=Ejecuta un guión personalizado ++Comment[et]=Kohandatud skripti käivitamine ++Comment[hr]=Pokreće prilagođene skripte ++Comment[hu]=Egyéni parancsfájl futtatása ++Comment[ia]=Il exeque un script personalisate ++Comment[ja]=カスタムスクリプトを実行 ++Comment[kk]=Пайдаланушының скриптін орындау ++Comment[km]=ដំណើរការ​ស្គ្រីប​ផ្ទាល់ខ្លួន ++Comment[ko]=사용자 정의 스크립트를 실행합니다 ++Comment[lt]=Paleisti savo scenarijų ++Comment[nb]=Kjører et egendefinert skript ++Comment[nds]=Föhrt en egen Skript ut ++Comment[nl]=Een eigen script uitvoeren ++Comment[pa]=ਪਸੰਦੀਦਾ ਸਕ੍ਰਿਪਟ ਚਲਾਓ ++Comment[pt]=Executa um programa personalizado ++Comment[pt_BR]=Executa um script personalizado ++Comment[sv]=Kör ett eget skript ++Comment[th]=ให้สคริปตท์ที่กำหนดเองทำงาน ++Comment[uk]=Запускає вказаний користувачем скрипт ++Comment[x-test]=xxRuns a custom scriptxx ++Comment[zh_TW]=執行自訂文稿 ++ ++X-KDE-PowerDevil-Action-ID=RunScript ++X-KDE-PowerDevil-Action-IsBundled=true ++X-KDE-PowerDevil-Action-UIComponentLibrary=powerdevilrunscriptaction_config ++X-KDE-PowerDevil-Action-ConfigPriority=70 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilsuspendsessionaction.desktop.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilsuspendsessionaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/powerdevilsuspendsessionaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/powerdevilsuspendsessionaction.desktop.svn-base 2010-12-12 14:48:46.863333335 -0800 +@@ -0,0 +1,64 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevil/Action ++# X-KDE-Library=powerdevilsuspendsessionaction ++Icon=system-shutdown ++Name=Suspend Session ++Name[ast]=Suspender la sesión ++Name[ca]=Suspèn la sessió ++Name[da]=Suspendér session ++Name[de]=Sitzung in den Ruhezustand versetzen ++Name[en_GB]=Suspend Session ++Name[es]=Suspender la sesión ++Name[et]=Seansi peatamine ++Name[hr]=Obustavljanje sesije ++Name[hu]=Munkamenet felfüggesztése ++Name[ia]=Suspender Session ++Name[ja]=セッションをサスペンド ++Name[kk]=Сеансын аялдату ++Name[km]=ផ្អាក​សម័យ ++Name[ko]=세션 일시 중지 ++Name[lt]=Užlaikyti sesiją ++Name[nb]=Suspender økt ++Name[nds]=Törn utsetten ++Name[nl]=Sessie onderbreken ++Name[pa]=ਸ਼ੈਸ਼ਨ ਸਸਪੈਂਡ ++Name[pt]=Suspender a Sessão ++Name[pt_BR]=Suspender sessão ++Name[sv]=Stoppa tillfälligt session ++Name[th]=หยุดวาระ ++Name[uk]=Призупинити сеанс ++Name[x-test]=xxSuspend Sessionxx ++Name[zh_TW]=暫停工作階段 ++Comment=Suspends the session ++Comment[ast]=Suspende la sesión ++Comment[ca]=Suspèn la sessió ++Comment[da]=Suspenderer sessionen ++Comment[de]=Versetzt die Sitzung in den Ruhezustand ++Comment[en_GB]=Suspends the session ++Comment[es]=Suspende la sesión ++Comment[et]=Seansi peatamine ++Comment[hr]=Obustavljanje ove sesije ++Comment[hu]=A munkamenet felfüggesztése ++Comment[ia]=Il suspende le session ++Comment[ja]=セッションをサスペンドします ++Comment[kk]=Сеансын тоқтата тұру ++Comment[km]=ផ្អាក​សម័យ ++Comment[ko]=세션을 일시 중단합니다 ++Comment[lt]=Užlaiko sesiją ++Comment[nb]=Suspenderer økta ++Comment[nds]=Sett den Törn ut ++Comment[nl]=De sessie onderbreken ++Comment[pa]=ਸ਼ੈਸ਼ਨ ਸਸਪੈਂਡ ਕਰੋ ++Comment[pt]=Suspende a sessão ++Comment[pt_BR]=Suspende a sessão ++Comment[sv]=Stoppar sessionen tillfälligt ++Comment[th]=หยุดวาระ ++Comment[uk]=Призупиняє сеанс ++Comment[x-test]=xxSuspends the sessionxx ++Comment[zh_TW]=暫停工作階段 ++ ++X-KDE-PowerDevil-Action-ID=SuspendSession ++X-KDE-PowerDevil-Action-IsBundled=true ++X-KDE-PowerDevil-Action-UIComponentLibrary=powerdevilsuspendsessionaction_config ++X-KDE-PowerDevil-Action-ConfigPriority=90 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscriptconfig.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/runscriptconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscriptconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/runscriptconfig.cpp.svn-base 2010-12-12 14:48:46.866666668 -0800 +@@ -0,0 +1,108 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "runscriptconfig.h" ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilRunScriptConfigFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilRunScriptConfigFactory("powerdevilrunscriptaction_config")) ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++RunScriptConfig::RunScriptConfig(QObject* parent, const QVariantList&) ++ : ActionConfig(parent) ++{ ++ ++} ++ ++RunScriptConfig::~RunScriptConfig() ++{ ++ ++} ++ ++void RunScriptConfig::save() ++{ ++ configGroup().writeEntry("scriptCommand", m_urlRequester->text()); ++ configGroup().writeEntry("scriptPhase", m_comboBox->currentIndex()); ++ configGroup().writeEntry("idleTime", m_idleTime->value() * 60 * 1000); ++ ++ configGroup().sync(); ++} ++ ++void RunScriptConfig::load() ++{ ++ m_urlRequester->setText(configGroup().readEntry("scriptCommand", QString())); ++ m_comboBox->setCurrentIndex(configGroup().readEntry("scriptPhase", 0)); ++ m_idleTime->setValue((configGroup().readEntry("idleTime", 600000) / 60) / 1000); ++} ++ ++QList< QPair< QString, QWidget* > > RunScriptConfig::buildUi() ++{ ++ QList< QPair< QString, QWidget* > > retlist; ++ m_urlRequester = new KUrlRequester(); ++ m_urlRequester->setMode(KFile::File | KFile::LocalOnly | KFile::ExistingOnly); ++ m_urlRequester->setMaximumWidth(300); ++ retlist.append(qMakePair< QString, QWidget* >(i18n("Script"), m_urlRequester)); ++ ++ QWidget *tempWidget = new QWidget; ++ QHBoxLayout *hlay = new QHBoxLayout; ++ m_comboBox = new KComboBox; ++ m_idleTime = new KIntSpinBox(0, 180, 1, 0, 0); ++ m_idleTime->setMaximumWidth(150); ++ m_idleTime->setDisabled(true); ++ m_idleTime->setSuffix(i18n(" min")); ++ m_comboBox->addItem(i18n("On Profile Load")); ++ m_comboBox->addItem(i18n("On Profile Unload")); ++ m_comboBox->addItem(i18n("After")); ++ connect(m_comboBox, SIGNAL(currentIndexChanged(QString)), ++ this, SLOT(onIndexChanged(QString))); ++ ++ hlay->addWidget(m_comboBox); ++ hlay->addWidget(m_idleTime); ++ hlay->addStretch(); ++ ++ tempWidget->setLayout(hlay); ++ ++ retlist.append(qMakePair< QString, QWidget* >(i18n("Run script"), tempWidget)); ++ ++ connect(m_urlRequester, SIGNAL(textChanged(QString)), this, SLOT(setChanged())); ++ connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); ++ connect(m_idleTime, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); ++ ++ return retlist; ++} ++ ++void RunScriptConfig::onIndexChanged(const QString &text) ++{ ++ m_idleTime->setEnabled(text == i18n("After")); ++} ++ ++} ++} ++ ++#include "runscriptconfig.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscriptconfig.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/runscriptconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscriptconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/runscriptconfig.h.svn-base 2010-12-12 14:48:46.870000001 -0800 +@@ -0,0 +1,58 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_RUNSCRIPTCONFIG_H ++#define POWERDEVIL_BUNDLEDACTIONS_RUNSCRIPTCONFIG_H ++ ++#include ++ ++class KIntSpinBox; ++class KComboBox; ++class KUrlRequester; ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class RunScriptConfig : public PowerDevil::ActionConfig ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(RunScriptConfig) ++ ++public: ++ RunScriptConfig(QObject* parent, const QVariantList&); ++ virtual ~RunScriptConfig(); ++ ++ virtual void save(); ++ virtual void load(); ++ virtual QList< QPair< QString, QWidget* > > buildUi(); ++ ++private: ++ KUrlRequester *m_urlRequester; ++ KComboBox *m_comboBox; ++ KIntSpinBox *m_idleTime; ++ ++private Q_SLOTS: ++ void onIndexChanged(const QString&); ++}; ++ ++} ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_RUNSCRIPTCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscript.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/runscript.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscript.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/runscript.cpp.svn-base 2010-12-12 14:48:46.870000001 -0800 +@@ -0,0 +1,88 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "runscript.h" ++ ++#include ++ ++#include ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++RunScript::RunScript(QObject* parent) ++ : Action(parent) ++{ ++ // TODO: Which policy should we enforce here? Let's go for the less restrictive one ++ setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings); ++} ++ ++RunScript::~RunScript() ++{ ++ ++} ++ ++void RunScript::onProfileUnload() ++{ ++ if (m_scriptPhase == 1) { ++ QProcess::startDetached(m_scriptCommand); ++ } ++} ++ ++void RunScript::onWakeupFromIdle() ++{ ++ // ++} ++ ++void RunScript::onIdleTimeout(int msec) ++{ ++ Q_UNUSED(msec); ++ QProcess::startDetached(m_scriptCommand); ++} ++ ++void RunScript::onProfileLoad() ++{ ++ if (m_scriptPhase == 0) { ++ QProcess::startDetached(m_scriptCommand); ++ } ++} ++ ++void RunScript::triggerImpl(const QVariantMap& args) ++{ ++ Q_UNUSED(args); ++} ++ ++bool RunScript::loadAction(const KConfigGroup& config) ++{ ++ if (config.hasKey("scriptCommand") && config.hasKey("scriptPhase")) { ++ m_scriptCommand = config.readEntry("scriptCommand", QString()); ++ m_scriptPhase = config.readEntry("scriptPhase", 0); ++ if (m_scriptPhase == 2) { ++ if (!config.hasKey("idleTime")) { ++ return false; ++ } ++ registerIdleTimeout(config.readEntry("idleTime", 10000000)); ++ } ++ } ++ ++ return true; ++} ++ ++} ++} +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscript.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/runscript.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/runscript.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/runscript.h.svn-base 2010-12-12 14:48:46.856666667 -0800 +@@ -0,0 +1,58 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_RUNSCRIPT_H ++#define POWERDEVIL_BUNDLEDACTIONS_RUNSCRIPT_H ++ ++#include ++ ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class RunScript : public PowerDevil::Action ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(RunScript) ++ ++public: ++ explicit RunScript(QObject* parent); ++ virtual ~RunScript(); ++ ++protected: ++ virtual void onProfileUnload(); ++ virtual void onWakeupFromIdle(); ++ virtual void onIdleTimeout(int msec); ++ virtual void onProfileLoad(); ++ virtual void triggerImpl(const QVariantMap& args); ++ ++public: ++ virtual bool loadAction(const KConfigGroup& config); ++ ++private: ++ int m_scriptPhase; ++ QString m_scriptCommand; ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_RUNSCRIPT_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsessionconfig.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsessionconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsessionconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsessionconfig.cpp.svn-base 2010-12-12 14:48:46.863333335 -0800 +@@ -0,0 +1,102 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "suspendsessionconfig.h" ++ ++#include ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include "suspendsession.h" ++ ++K_PLUGIN_FACTORY(PowerDevilSuspendSessionConfigFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilSuspendSessionConfigFactory("powerdevilsuspendsessionaction_config")) ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++SuspendSessionConfig::SuspendSessionConfig(QObject* parent, const QVariantList&) ++ : ActionConfig(parent) ++{ ++ ++} ++ ++SuspendSessionConfig::~SuspendSessionConfig() ++{ ++ ++} ++ ++void SuspendSessionConfig::save() ++{ ++ configGroup().writeEntry< uint >("suspendType", m_comboBox->itemData(m_comboBox->currentIndex()).toUInt()); ++ configGroup().writeEntry("idleTime", m_idleTime->value() * 60 * 1000); ++ ++ configGroup().sync(); ++} ++ ++void SuspendSessionConfig::load() ++{ ++ uint suspendType = configGroup().readEntry< uint >("suspendType", 0); ++ m_comboBox->setCurrentIndex(m_comboBox->findData(suspendType)); ++ m_idleTime->setValue((configGroup().readEntry("idleTime", 600000) / 60) / 1000); ++} ++ ++QList< QPair< QString, QWidget* > > SuspendSessionConfig::buildUi() ++{ ++ QWidget *tempWidget = new QWidget; ++ QHBoxLayout *hlay = new QHBoxLayout; ++ m_comboBox = new KComboBox; ++ m_idleTime = new KIntSpinBox(0, 180, 1, 0, 0); ++ m_idleTime->setMaximumWidth(150); ++ m_idleTime->setSuffix(i18n(" min")); ++ ++ QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); ++ ++ if (methods.contains(Solid::PowerManagement::SuspendState)) { ++ m_comboBox->addItem(KIcon("system-suspend"), i18n("Sleep"), (uint)SuspendSession::ToRamMode); ++ } ++ if (methods.contains(Solid::PowerManagement::HibernateState)) { ++ m_comboBox->addItem(KIcon("system-suspend-hibernate"), i18n("Hibernate"), (uint)SuspendSession::ToDiskMode); ++ } ++ m_comboBox->addItem(KIcon("system-shutdown"), i18n("Shutdown"), (uint)SuspendSession::ShutdownMode); ++ m_comboBox->addItem(KIcon("system-lock-screen"), i18n("Lock screen"), (uint)SuspendSession::LockScreenMode); ++ ++ hlay->addWidget(m_idleTime); ++ hlay->addWidget(m_comboBox); ++ hlay->addStretch(); ++ ++ tempWidget->setLayout(hlay); ++ ++ QList< QPair< QString, QWidget* > > retlist; ++ retlist.append(qMakePair< QString, QWidget* >(i18n("After"), tempWidget)); ++ ++ connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged())); ++ connect(m_idleTime, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); ++ ++ return retlist; ++} ++ ++} ++} +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsessionconfig.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsessionconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsessionconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsessionconfig.h.svn-base 2010-12-12 14:48:46.866666668 -0800 +@@ -0,0 +1,52 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_SUSPENDSESSIONCONFIG_H ++#define POWERDEVIL_BUNDLEDACTIONS_SUSPENDSESSIONCONFIG_H ++ ++#include ++ ++class KComboBox; ++class KIntSpinBox; ++ ++namespace PowerDevil { ++namespace BundledActions { ++ ++class SuspendSessionConfig : public PowerDevil::ActionConfig ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(SuspendSessionConfig) ++public: ++ SuspendSessionConfig(QObject* parent, const QVariantList&); ++ virtual ~SuspendSessionConfig(); ++ ++ virtual void save(); ++ virtual void load(); ++ virtual QList< QPair< QString, QWidget* > > buildUi(); ++ ++private: ++ KIntSpinBox *m_idleTime; ++ KComboBox *m_comboBox; ++}; ++ ++} ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_SUSPENDSESSIONCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsession.cpp.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsession.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsession.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsession.cpp.svn-base 2010-12-12 14:48:46.870000001 -0800 +@@ -0,0 +1,149 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "suspendsession.h" ++ ++#include "powerdevilbackendinterface.h" ++#include "powerdevilcore.h" ++ ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "screensaver_interface.h" ++#include ++ ++namespace PowerDevil ++{ ++namespace BundledActions ++{ ++ ++SuspendSession::SuspendSession(QObject* parent) ++ : Action(parent) ++{ ++ setRequiredPolicies(PowerDevil::PolicyAgent::InterruptSession); ++} ++ ++SuspendSession::~SuspendSession() ++{ ++ ++} ++ ++void SuspendSession::onProfileUnload() ++{ ++ // Nothing to do ++} ++ ++void SuspendSession::onWakeupFromIdle() ++{ ++ // Nothing to do ++} ++ ++void SuspendSession::onIdleTimeout(int msec) ++{ ++ Q_UNUSED(msec); ++ QVariantMap args; ++ args.insert("Type", m_autoType); ++ trigger(args); ++} ++ ++void SuspendSession::onProfileLoad() ++{ ++ // Nothing to do ++} ++ ++void SuspendSession::triggerImpl(const QVariantMap& args) ++{ ++ kDebug() << "Triggered with " << args["Type"].toString(); ++ ++ // Switch for screen lock ++ QVariantMap recallArgs; ++ switch ((Mode) (args["Type"].toUInt())) { ++ case ToRamMode: ++ case ToDiskMode: ++ case SuspendHybridMode: ++ // Do we want to lock the screen? ++ if (PowerDevilSettings::configLockScreen()) { ++ // Yeah, we do. ++ recallArgs["Type"] = (uint)LockScreenMode; ++ triggerImpl(recallArgs); ++ } ++ break; ++ default: ++ break; ++ } ++ ++ // Switch for real action ++ KJob *suspendJob = 0; ++ switch ((Mode) (args["Type"].toUInt())) { ++ case ToRamMode: ++ suspendJob = backend()->suspend(PowerDevil::BackendInterface::ToRam); ++ break; ++ case ToDiskMode: ++ suspendJob = backend()->suspend(PowerDevil::BackendInterface::ToDisk); ++ break; ++ case SuspendHybridMode: ++ suspendJob = backend()->suspend(PowerDevil::BackendInterface::HybridSuspend); ++ break; ++ case ShutdownMode: ++ KWorkSpace::requestShutDown(KWorkSpace::ShutdownConfirmNo, KWorkSpace::ShutdownTypeHalt); ++ break; ++ case LogoutDialogMode: ++ KWorkSpace::requestShutDown(KWorkSpace::ShutdownConfirmYes); ++ break; ++ case LockScreenMode: ++ core()->emitNotification("doingjob", i18n("The screen is being locked")); ++ lockScreenAndWait(); ++ break; ++ default: ++ break; ++ } ++ ++ if (suspendJob) { ++ suspendJob->start(); ++ } ++} ++ ++void SuspendSession::lockScreenAndWait() ++{ ++ OrgFreedesktopScreenSaverInterface iface("org.freedesktop.ScreenSaver", ++ "/ScreenSaver", ++ QDBusConnection::sessionBus()); ++ QDBusPendingReply< void > reply = iface.Lock(); ++ reply.waitForFinished(); ++} ++ ++bool SuspendSession::loadAction(const KConfigGroup& config) ++{ ++ if (config.isValid() && config.hasKey("idleTime") && config.hasKey("suspendType")) { ++ // Add the idle timeout ++ registerIdleTimeout(config.readEntry("idleTime", 0)); ++ m_autoType = config.readEntry("suspendType", 0); ++ } ++ ++ return true; ++} ++ ++} ++} ++ ++#include "suspendsession.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsession.h.svn-base ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsession.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/bundled/.svn/text-base/suspendsession.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/bundled/.svn/text-base/suspendsession.h.svn-base 2010-12-12 14:48:46.873333334 -0800 +@@ -0,0 +1,69 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BUNDLEDACTIONS_SUSPENDSESSION_H ++#define POWERDEVIL_BUNDLEDACTIONS_SUSPENDSESSION_H ++ ++#include ++ ++namespace PowerDevil ++{ ++namespace BundledActions ++{ ++ ++class SuspendSession : public PowerDevil::Action ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(SuspendSession) ++ ++public: ++ enum Mode { ++ None = 0, ++ ToRamMode = 1, ++ ToDiskMode = 2, ++ SuspendHybridMode = 4, ++ ShutdownMode = 8, ++ LogoutDialogMode = 16, ++ LockScreenMode = 32 ++ }; ++ ++ explicit SuspendSession(QObject *parent); ++ virtual ~SuspendSession(); ++ ++ virtual bool loadAction(const KConfigGroup& config); ++ ++protected: ++ virtual void onProfileUnload(); ++ virtual void onWakeupFromIdle(); ++ virtual void onIdleTimeout(int msec); ++ virtual void onProfileLoad(); ++ virtual void triggerImpl(const QVariantMap& args); ++ ++private: ++ uint m_autoType; ++ ++ void lockScreenAndWait(); ++}; ++ ++} ++ ++} ++ ++#endif // POWERDEVIL_BUNDLEDACTIONS_SUSPENDSESSION_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/entries ../powerdevil/daemon/actions/dpms/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/dpms/.svn/entries 2010-12-12 14:48:46.856666667 -0800 +@@ -0,0 +1,232 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon/actions/dpms ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++powerdevildpmsaction.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.856666Z ++ce4012254fcf20a2d90c1c50f221e24a ++2010-11-08T09:08:33.709679Z ++1194096 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4743 ++ ++powerdevildpmsaction.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.856666Z ++a9bf91d520b32c0506c78778a14425b7 ++2010-11-08T09:08:33.709679Z ++1194096 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2125 ++ ++powerdevildpmsactionconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.856666Z ++bbd8cb9918193c60b562b9baabb7d1d5 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2596 ++ ++powerdevildpmsaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.856666Z ++9ed99d6006edac762eb7844a62b097a5 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2429 ++ ++CMakeLists.txt ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.856666Z ++8dc22e7eeb53d2bbf31e79c5bff1cc09 ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++965 ++ ++powerdevildpmsactionconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.856666Z ++e9df3f2a55a7d897ceaeb5bb5e3fe204 ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1961 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/CMakeLists.txt.svn-base ../powerdevil/daemon/actions/dpms/.svn/text-base/CMakeLists.txt.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/CMakeLists.txt.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/dpms/.svn/text-base/CMakeLists.txt.svn-base 2010-12-12 14:48:46.853333334 -0800 +@@ -0,0 +1,24 @@ ++include_directories(${CMAKE_CURRENT_SOURCE_DIR} ++ ${CMAKE_CURRENT_BINARY_DIR} ++ ${X11_dpms_INCLUDE_PATH}) ++ ++set(powerdevildpmsaction_SRCS powerdevildpmsaction.cpp) ++ ++kde4_add_plugin(powerdevildpmsaction ${powerdevildpmsaction_SRCS}) ++target_link_libraries(powerdevildpmsaction ++ ${X11_LIBRARIES} ++ ${KDE4_KDECORE_LIBS} ++ ${QT_QTGUI_LIBRARY} ++ powerdevilcore) ++install(TARGETS powerdevildpmsaction DESTINATION ${PLUGIN_INSTALL_DIR}) ++install(FILES powerdevildpmsaction.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ++ ++# Action config ++set(dpmsconfig_SRCS powerdevildpmsactionconfig.cpp) ++kde4_add_plugin(powerdevildpmsaction_config ++ ${dpmsconfig_SRCS}) ++target_link_libraries(powerdevildpmsaction_config ++ ${KDE4_KDECORE_LIBS} ++ ${KDE4_KDEUI_LIBS} ++ powerdevilui) ++install(TARGETS powerdevildpmsaction_config DESTINATION ${PLUGIN_INSTALL_DIR}) +\ No newline at end of file +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.cpp.svn-base ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.cpp.svn-base 2010-12-12 14:48:46.853333334 -0800 +@@ -0,0 +1,64 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevildpmsactionconfig.h" ++ ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilDPMSConfigFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilDPMSConfigFactory("powerdevildpmsaction_config")) ++ ++PowerDevilDPMSActionConfig::PowerDevilDPMSActionConfig(QObject* parent, const QVariantList& ) ++ : ActionConfig(parent) ++{ ++ ++} ++PowerDevilDPMSActionConfig::~PowerDevilDPMSActionConfig() ++{ ++ ++} ++ ++void PowerDevilDPMSActionConfig::save() ++{ ++ configGroup().writeEntry("idleTime", m_spinBox->value() * 60 * 1000); ++ ++ configGroup().sync(); ++} ++ ++void PowerDevilDPMSActionConfig::load() ++{ ++ m_spinBox->setValue((configGroup().readEntry("idleTime", 600000) / 60) / 1000); ++} ++ ++QList< QPair< QString, QWidget* > > PowerDevilDPMSActionConfig::buildUi() ++{ ++ QList< QPair< QString, QWidget* > > retlist; ++ ++ m_spinBox = new KIntSpinBox(0, 180, 1, 0, 0); ++ m_spinBox->setMaximumWidth(150); ++ m_spinBox->setSuffix(i18n(" min")); ++ retlist.append(qMakePair< QString, QWidget* >(i18n("Switch off after"), m_spinBox)); ++ ++ connect(m_spinBox, SIGNAL(valueChanged(int)), this, SLOT(setChanged())); ++ ++ return retlist; ++} ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.h.svn-base ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsactionconfig.h.svn-base 2010-12-12 14:48:46.853333334 -0800 +@@ -0,0 +1,43 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVILDPMSACTIONCONFIG_H ++#define POWERDEVILDPMSACTIONCONFIG_H ++ ++#include ++ ++class KIntSpinBox; ++class PowerDevilDPMSActionConfig : public PowerDevil::ActionConfig ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(PowerDevilDPMSActionConfig) ++public: ++ PowerDevilDPMSActionConfig(QObject* parent, const QVariantList&); ++ virtual ~PowerDevilDPMSActionConfig(); ++ ++ virtual void save(); ++ virtual void load(); ++ virtual QList< QPair< QString, QWidget* > > buildUi(); ++ ++private: ++ KIntSpinBox *m_spinBox; ++}; ++ ++#endif // POWERDEVILDPMSACTIONCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.cpp.svn-base ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.cpp.svn-base 2010-12-12 14:48:46.853333334 -0800 +@@ -0,0 +1,173 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevildpmsaction.h" ++ ++#include ++ ++#include ++ ++#include ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++extern "C" { ++#include ++ int __kde_do_not_unload = 1; ++ ++#ifndef HAVE_DPMSCAPABLE_PROTO ++ Bool DPMSCapable(Display *); ++#endif ++ ++#ifndef HAVE_DPMSINFO_PROTO ++ Status DPMSInfo(Display *, CARD16 *, BOOL *); ++#endif ++ ++int dropError(Display *, XErrorEvent *); ++typedef int (*XErrFunc)(Display *, XErrorEvent *); ++} ++ ++int dropError(Display *, XErrorEvent *) ++{ ++ return 0; ++} ++ ++class PowerDevilDPMSAction::Private ++{ ++public: ++ XErrorHandler defaultHandler; ++}; ++ ++K_PLUGIN_FACTORY(PowerDevilDPMSActionFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN(PowerDevilDPMSActionFactory("powerdevildpmsaction")) ++ ++PowerDevilDPMSAction::PowerDevilDPMSAction(QObject* parent, const QVariantList& ) ++ : Action(parent) ++ , d(new Private) ++{ ++ setRequiredPolicies(PowerDevil::PolicyAgent::ChangeScreenSettings); ++} ++ ++PowerDevilDPMSAction::~PowerDevilDPMSAction() ++{ ++ delete d; ++} ++ ++void PowerDevilDPMSAction::onProfileUnload() ++{ ++ Display *dpy = QX11Info::display(); ++ if (m_hasDPMS) { ++ DPMSDisable(dpy); ++ } ++} ++ ++void PowerDevilDPMSAction::onWakeupFromIdle() ++{ ++ // ++} ++ ++void PowerDevilDPMSAction::onIdleTimeout(int msec) ++{ ++ Q_UNUSED(msec); ++} ++ ++void PowerDevilDPMSAction::onProfileLoad() ++{ ++ Display *dpy = QX11Info::display(); ++ if (m_hasDPMS) { ++ DPMSEnable(dpy); ++ } else { ++ return; ++ } ++ ++ XFlush(dpy); ++ XSetErrorHandler(d->defaultHandler); ++ ++ DPMSSetTimeouts(dpy, m_idleTime, (int)(m_idleTime * 1.5), m_idleTime * 2); ++ ++ XFlush(dpy); ++ XSetErrorHandler(d->defaultHandler); ++} ++ ++void PowerDevilDPMSAction::triggerImpl(const QVariantMap& args) ++{ ++ CARD16 dummy; ++ BOOL enabled; ++ Display *dpy = QX11Info::display(); ++ DPMSInfo(dpy, &dummy, &enabled); ++ ++ // Let's pretend we're resuming ++ core()->onResumeFromSuspend(); ++ ++ if (args["Type"].toString() == "TurnOff") { ++ if (enabled) { ++ DPMSForceLevel(dpy, DPMSModeOff); ++ } else { ++ DPMSEnable(dpy); ++ DPMSForceLevel(dpy, DPMSModeOff); ++ } ++ } else if (args["Type"].toString() == "Standby") { ++ if (enabled) { ++ DPMSForceLevel(dpy, DPMSModeStandby); ++ } else { ++ DPMSEnable(dpy); ++ DPMSForceLevel(dpy, DPMSModeStandby); ++ } ++ } else if (args["Type"].toString() == "Suspend") { ++ if (enabled) { ++ DPMSForceLevel(dpy, DPMSModeSuspend); ++ } else { ++ DPMSEnable(dpy); ++ DPMSForceLevel(dpy, DPMSModeSuspend); ++ } ++ } ++} ++ ++bool PowerDevilDPMSAction::loadAction(const KConfigGroup& config) ++{ ++ d->defaultHandler = XSetErrorHandler(dropError); ++ ++ Display *dpy = QX11Info::display(); ++ ++ int dummy; ++ m_hasDPMS = true; ++ ++ if (!DPMSQueryExtension(dpy, &dummy, &dummy) || !DPMSCapable(dpy)) { ++ m_hasDPMS = false; ++ XSetErrorHandler(d->defaultHandler); ++ } ++ ++ if (config.hasKey("idleTime")) { ++ m_idleTime = config.readEntry("idleTime", 100000000); ++ } else { ++ m_hasDPMS = false; ++ } ++ ++ return true; ++} ++ ++#include "powerdevildpmsaction.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.desktop.svn-base ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.desktop.svn-base 2010-12-12 14:48:46.853333334 -0800 +@@ -0,0 +1,59 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevil/Action ++X-KDE-Library=powerdevildpmsaction ++Icon=preferences-desktop-screensaver ++Name=Screen Energy Saving ++Name[ast]=Aforru d'enerxía de la pantalla ++Name[ca]=Estalvi d'energia de pantalla ++Name[da]=Strømbesparelse for skærm ++Name[de]=Bildschirm-Energieverwaltung ++Name[en_GB]=Screen Energy Saving ++Name[es]=Ahorro de energía de la pantalla ++Name[et]=Ekraanisäästja ++Name[ia]=Sparnio de Energia de Schermo ++Name[kk]=Экран қуатын үнемдеу ++Name[km]=សន្សំ​ថាមពល​អេក្រង់ ++Name[ko]=화면 에너지 절약 ++Name[lt]=Ekrano energijos taupymas ++Name[nb]=Energisparing for skjerm ++Name[nds]=Monitor-Stroomspoorbedrief ++Name[nl]=Energiebesparing bij het beeldscherm ++Name[pa]=ਸਕਰੀਨ ਊਰਜਾ ਬਚਾਉਣੀ ++Name[pt]=Configuração da Energia do Ecrã ++Name[pt_BR]=Configurações da energia da tela ++Name[sv]=Strömsparhantering av bildskärmen ++Name[th]=การรักษาพลังงานของหน้าจอ ++Name[uk]=Заощадження енергії екраном ++Name[x-test]=xxScreen Energy Savingxx ++Name[zh_TW]=螢幕節能 ++Comment=Controls DPMS settings ++Comment[ast]=Configuraciones control DPMS ++Comment[ca]=Controla l'arranjament del DPMS ++Comment[da]=Styrer DPMS-indstillinger ++Comment[de]=DPMS-Einstellungen ++Comment[en_GB]=Controls DPMS settings ++Comment[et]=Monitori toiteseadistused ++Comment[hr]=Kontrola DPMS postavki ++Comment[ia]=Preferentias de Controlos DPMS ++Comment[ja]=DPMS の設定 ++Comment[kk]=DPMS параметрлерін басқару ++Comment[km]=ការ​កំណត់​វត្ថុ​បញ្ជា DPMS ++Comment[ko]=DPMS 설정 ++Comment[lt]=Valdo DPMS nustatymus ++Comment[nb]=Styrer DPMS-innstillinger ++Comment[nds]=Monitor-Stroomspoorbedrief instellen ++Comment[nl]=DPMS-instellingen besturen ++Comment[pa]=DPMS ਕੰਟਰੋਲ ਕਰੋ ++Comment[pt]=Controla a configuração do DPMS ++Comment[pt_BR]=Controla as configurações do DPMS ++Comment[sv]=Styr DPMS-inställningar ++Comment[th]=ควบคุมการตั้งค่า DPMS ++Comment[uk]=Керування параметрами DPMS ++Comment[x-test]=xxControls DPMS settingsxx ++Comment[zh_TW]=控制 DPMS 設定 ++ ++X-KDE-PowerDevil-Action-ID=DPMSControl ++X-KDE-PowerDevil-Action-IsBundled=false ++X-KDE-PowerDevil-Action-UIComponentLibrary=powerdevildpmsaction_config ++X-KDE-PowerDevil-Action-ConfigPriority=98 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.h.svn-base ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/dpms/.svn/text-base/powerdevildpmsaction.h.svn-base 2010-12-12 14:48:46.853333334 -0800 +@@ -0,0 +1,53 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVILDPMSACTION_H ++#define POWERDEVILDPMSACTION_H ++ ++#include ++ ++class PowerDevilDPMSAction : public PowerDevil::Action ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(PowerDevilDPMSAction) ++ ++public: ++ explicit PowerDevilDPMSAction(QObject* parent, const QVariantList&); ++ virtual ~PowerDevilDPMSAction(); ++ ++protected: ++ virtual void onProfileUnload(); ++ virtual void onWakeupFromIdle(); ++ virtual void onIdleTimeout(int msec); ++ virtual void onProfileLoad(); ++ virtual void triggerImpl(const QVariantMap& args); ++ ++public: ++ virtual bool loadAction(const KConfigGroup& config); ++ ++private: ++ bool m_hasDPMS; ++ int m_idleTime; ++ ++ class Private; ++ Private * const d; ++}; ++ ++#endif // POWERDEVILDPMSACTION_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/.svn/entries ../powerdevil/daemon/actions/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/.svn/entries 2010-12-12 14:48:46.880000001 -0800 +@@ -0,0 +1,102 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon/actions ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-09T05:34:09.191991Z ++1204797 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++dpms ++dir ++ ++powerdevilaction.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++6ebad60b9ef5dcfb53c205f94773182b ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1736 ++ ++bundled ++dir ++ ++CMakeLists.txt ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.876666Z ++4342c7fa50d9cb8e085c556aafdd90b8 ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++164 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/.svn/text-base/CMakeLists.txt.svn-base ../powerdevil/daemon/actions/.svn/text-base/CMakeLists.txt.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/.svn/text-base/CMakeLists.txt.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/.svn/text-base/CMakeLists.txt.svn-base 2010-12-12 14:48:46.856666667 -0800 +@@ -0,0 +1,6 @@ ++install(FILES powerdevilaction.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) ++ ++add_subdirectory(bundled) ++if(HAVE_DPMS) ++ add_subdirectory(dpms) ++endif(HAVE_DPMS) +\ No newline at end of file +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/actions/.svn/text-base/powerdevilaction.desktop.svn-base ../powerdevil/daemon/actions/.svn/text-base/powerdevilaction.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/actions/.svn/text-base/powerdevilaction.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/actions/.svn/text-base/powerdevilaction.desktop.svn-base 2010-12-12 14:48:46.856666667 -0800 +@@ -0,0 +1,36 @@ ++[Desktop Entry] ++Type=ServiceType ++X-KDE-ServiceType=PowerDevil/Action ++ ++Comment=Power Management Action Extension ++Comment[ast]=Estensión aiciones xestión d'enerxía ++Comment[ca]=Extensió d'accions de gestió d'energia ++Comment[da]=Udvidelse af strømstyringshandling ++Comment[de]=Erweiterung für Energieverwaltungs-Aktionen ++Comment[en_GB]=Power Management Action Extension ++Comment[et]=Toitehalduse laiendus ++Comment[ia]=Extension de Action de Gestion de energia ++Comment[kk]=Қуаттандыруды басқару әрекетін кеңейтуі ++Comment[km]=ផ្នែក​បន្ថែម​សកម្មភាព​គ្រប់គ្រង​ថាមពល ++Comment[ko]=전력 관리 동작 확장 ++Comment[lt]=Energijos valdymo veiksmų plėtinys ++Comment[nb]=Handlingsutvidelse for strømstyring ++Comment[nds]=Verwiedern för Stroomkuntrullakschonen ++Comment[nl]=Uitbreiding voor energiebeheeractie ++Comment[pa]=ਪਾਵਰ ਮੈਨਿਜਮੈਂਟ ਐਕਸ਼ਣ ਇਕਸਟੈਸ਼ਨ ++Comment[pt]=Extensão da Acção de Gestão da Energia ++Comment[pt_BR]=Extensão da ação do gerenciamento de energia ++Comment[sv]=Åtgärdsutökning för strömsparhantering ++Comment[th]=ส่วนขยายการกระทำเกี่ยวกับการจัดการพลังงาน ++Comment[uk]=Розширення дій керування живленням ++Comment[x-test]=xxPower Management Action Extensionxx ++Comment[zh_TW]=電源管理動作延伸 ++ ++[PropertyDef::X-KDE-PowerDevil-Action-ID] ++Type=QString ++[PropertyDef::X-KDE-PowerDevil-Action-IsBundled] ++Type=bool ++[PropertyDef::X-KDE-PowerDevil-Action-UIComponentLibrary] ++Type=QString ++[PropertyDef::X-KDE-PowerDevil-Action-ConfigPriority] ++Type=int +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/powerdevilhalbackend.cpp ../powerdevil/daemon/backends/hal/powerdevilhalbackend.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/powerdevilhalbackend.cpp 2010-11-25 09:40:32.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/powerdevilhalbackend.cpp 2010-12-12 14:48:46.893333334 -0800 +@@ -22,6 +22,7 @@ + #include "powerdevilhalbackend.h" + #include + #include ++#include + #include + #include "halsuspendjob.h" + #include +@@ -63,7 +64,7 @@ + + bool PowerDevilHALBackend::isAvailable() + { +- return m_halPowerManagement.isValid(); ++ return QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.Hal"); + } + + void PowerDevilHALBackend::init() +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/powerdevilhalbackend.h ../powerdevil/daemon/backends/hal/powerdevilhalbackend.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/powerdevilhalbackend.h 2010-11-25 09:40:32.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/powerdevilhalbackend.h 2010-12-12 14:48:46.893333334 -0800 +@@ -46,7 +46,7 @@ + virtual ~PowerDevilHALBackend(); + + virtual void init(); +- virtual bool isAvailable(); ++ static bool isAvailable(); + + virtual float brightness(BrightnessControlType type = Screen) const; + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/entries ../powerdevil/daemon/backends/hal/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/.svn/entries 2010-12-12 14:48:46.893333334 -0800 +@@ -0,0 +1,198 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon/backends/hal ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-07T17:03:49.380344Z ++1204505 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++halsuspendjob.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.893333Z ++3c9a5e35501d5641f38a0d89c88b276c ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3907 ++ ++powerdevilhalbackend.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.893333Z ++bd96b65c6d13e94382d163360c38c4be ++2010-12-07T17:03:49.380344Z ++1204505 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2897 ++ ++powerdevilhalbackend.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.893333Z ++cbf1c79eb2351d8b3ac4cf671d246ec5 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3702 ++ ++halsuspendjob.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.893333Z ++2a462cfda0e87bec1b573faa0c52ddb9 ++2010-10-03T02:18:31.610405Z ++1182025 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1568 ++ ++powerdevilhalbackend.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.893333Z ++fefcf1ff3f5c08032d99b5e96dc161f2 ++2010-12-07T17:03:49.380344Z ++1204505 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++19296 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/halsuspendjob.cpp.svn-base ../powerdevil/daemon/backends/hal/.svn/text-base/halsuspendjob.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/halsuspendjob.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/.svn/text-base/halsuspendjob.cpp.svn-base 2010-12-12 14:48:46.893333334 -0800 +@@ -0,0 +1,136 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++#include "halsuspendjob.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++HalSuspendJob::HalSuspendJob(QDBusInterface &powermanagement, QDBusInterface &computer, ++ PowerDevil::BackendInterface::SuspendMethod method, ++ PowerDevil::BackendInterface::SuspendMethods supported) ++ : KJob(), m_halPowerManagement(powermanagement), m_halComputer(computer) ++{ ++ if (supported & method) ++ { ++ QDBusReply reply; ++ ++ switch(method) ++ { ++ case PowerDevil::BackendInterface::ToRam: ++ reply = m_halComputer.call("GetPropertyBoolean", "power_management.can_suspend_hybrid"); ++ ++ if (reply.isValid()) ++ { ++ bool can_hybrid = reply; ++ if (can_hybrid) ++ { ++ // Temporary: let's check if system is configured to use Hybrid suspend. Default is no. ++ KConfig sconf("suspendpreferencesrc"); ++ KConfigGroup group(&sconf, "Preferences"); ++ if (group.readEntry("use_hybrid", false)) { ++ m_dbusMethod = "SuspendHybrid"; ++ } else { ++ m_dbusMethod = "Suspend"; ++ } ++ } ++ else ++ { ++ m_dbusMethod = "Suspend"; ++ } ++ } ++ else ++ { ++ m_dbusMethod = "Suspend"; ++ } ++ m_dbusParam = 0; ++ break; ++ case PowerDevil::BackendInterface::ToDisk: ++ m_dbusMethod = "Hibernate"; ++ m_dbusParam = -1; ++ break; ++ default: ++ break; ++ } ++ } ++} ++ ++HalSuspendJob::~HalSuspendJob() ++{ ++ ++} ++ ++void HalSuspendJob::start() ++{ ++ QTimer::singleShot(0, this, SLOT(doStart())); ++} ++ ++void HalSuspendJob::kill(bool /*quietly */) ++{ ++ ++} ++ ++void HalSuspendJob::doStart() ++{ ++ if (m_dbusMethod.isEmpty()) ++ { ++ setError(1); ++ setErrorText("Unsupported suspend method"); ++ emitResult(); ++ return; ++ } ++ ++ QList args; ++ ++ if (m_dbusParam>=0) ++ { ++ args << m_dbusParam; ++ } ++ ++ if (!m_halPowerManagement.callWithCallback(m_dbusMethod, args, ++ this, SLOT(resumeDone(const QDBusMessage &)))) ++ { ++ setError(1); ++ setErrorText(m_halPowerManagement.lastError().name()+": " ++ +m_halPowerManagement.lastError().message()); ++ emitResult(); ++ } ++} ++ ++ ++void HalSuspendJob::resumeDone(const QDBusMessage &reply) ++{ ++ if (reply.type() == QDBusMessage::ErrorMessage) ++ { ++ // We ignore the NoReply error, since we can timeout anyway ++ // if the computer is suspended for too long. ++ if (reply.errorName() != "org.freedesktop.DBus.Error.NoReply") ++ { ++ setError(1); ++ setErrorText(reply.errorName()+": "+reply.arguments().at(0).toString()); ++ } ++ } ++ ++ emitResult(); ++} ++ ++#include "halsuspendjob.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/halsuspendjob.h.svn-base ../powerdevil/daemon/backends/hal/.svn/text-base/halsuspendjob.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/halsuspendjob.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/.svn/text-base/halsuspendjob.h.svn-base 2010-12-12 14:48:46.893333334 -0800 +@@ -0,0 +1,52 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++#ifndef HALSUSPENDJOB_H ++#define HALSUSPENDJOB_H ++ ++#include ++#include ++#include ++ ++#include "powerdevilhalbackend.h" ++ ++class HalSuspendJob : public KJob ++{ ++ Q_OBJECT ++public: ++ HalSuspendJob(QDBusInterface &powermanagement, QDBusInterface &computer, ++ PowerDevil::BackendInterface::SuspendMethod method, ++ PowerDevil::BackendInterface::SuspendMethods supported); ++ virtual ~HalSuspendJob(); ++ ++ void start(); ++ void kill(bool quietly); ++ ++private Q_SLOTS: ++ void doStart(); ++ void resumeDone(const QDBusMessage &reply); ++ ++private: ++ QDBusInterface &m_halPowerManagement; ++ QDBusInterface &m_halComputer; ++ QString m_dbusMethod; ++ int m_dbusParam; ++}; ++ ++#endif +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/powerdevilhalbackend.cpp.svn-base ../powerdevil/daemon/backends/hal/.svn/text-base/powerdevilhalbackend.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/powerdevilhalbackend.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/.svn/text-base/powerdevilhalbackend.cpp.svn-base 2010-12-12 14:48:46.893333334 -0800 +@@ -0,0 +1,503 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ Copyright (C) 2008-2010 Dario Freddi ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++ ++#include "powerdevilhalbackend.h" ++#include ++#include ++#include ++#include ++#include "halsuspendjob.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++PowerDevilHALBackend::PowerDevilHALBackend(QObject* parent) ++ : BackendInterface(parent), ++ m_brightnessInHardware(true), ++ m_halComputer("org.freedesktop.Hal", ++ "/org/freedesktop/Hal/devices/computer", ++ "org.freedesktop.Hal.Device", ++ QDBusConnection::systemBus()), ++ m_halPowerManagement("org.freedesktop.Hal", ++ "/org/freedesktop/Hal/devices/computer", ++ "org.freedesktop.Hal.Device.SystemPowerManagement", ++ QDBusConnection::systemBus()), ++ m_halCpuFreq("org.freedesktop.Hal", ++ "/org/freedesktop/Hal/devices/computer", ++ "org.freedesktop.Hal.Device.CPUFreq", ++ QDBusConnection::systemBus()), ++ m_halManager("org.freedesktop.Hal", ++ "/org/freedesktop/Hal/Manager", ++ "org.freedesktop.Hal.Manager", ++ QDBusConnection::systemBus()) ++{ ++} ++ ++PowerDevilHALBackend::~PowerDevilHALBackend() ++{ ++ qDeleteAll(m_acAdapters); ++ qDeleteAll(m_batteries); ++ qDeleteAll(m_buttons); ++} ++ ++bool PowerDevilHALBackend::isAvailable() ++{ ++ return QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.Hal"); ++} ++ ++void PowerDevilHALBackend::init() ++{ ++ connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(const QString &)), ++ this, SLOT(slotDeviceRemoved(const QString &))); ++ connect(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(const QString &)), ++ this, SLOT(slotDeviceAdded(const QString &))); ++ ++ m_pluggedAdapterCount = 0; ++ computeAcAdapters(); ++ ++ computeBatteries(); ++ updateBatteryStats(); ++ ++ computeButtons(); ++ ++ // Brightness Control available ++ BrightnessControlsList controls; ++ { ++ QDBusPendingReply reply = m_halManager.asyncCall("FindDeviceByCapability", "laptop_panel"); ++ reply.waitForFinished(); ++ if (reply.isValid()) { ++ foreach(const QString &name, reply.value()) { ++ controls.insert(name, Screen); ++ } ++ } ++ reply = m_halManager.call("FindDeviceByCapability", "keyboard_backlight"); ++ if (reply.isValid()) { ++ foreach(const QString &name, reply.value()) { ++ controls.insert(name, Keyboard); ++ } ++ } ++ } ++ ++ QList screenControls = controls.keys(Screen); ++ ++ if (!screenControls.isEmpty()) { ++ m_cachedBrightness = brightness(Screen); ++ ++ QDBusInterface deviceInterface("org.freedesktop.Hal", ++ screenControls.at(0), ++ "org.freedesktop.Hal.Device", ++ QDBusConnection::systemBus()); ++ QDBusReply replyInHardware = deviceInterface.call("GetPropertyBoolean", ++ "laptop_panel.brightness_in_hardware"); ++ if (replyInHardware.isValid()) { ++ m_brightnessInHardware = replyInHardware; ++ } ++ } ++ ++ // Supported suspend methods ++ SuspendMethods supported = UnknownSuspendMethod; ++ { ++ QDBusPendingReply reply = m_halComputer.asyncCall("GetPropertyBoolean", "power_management.can_suspend"); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) { ++ bool can_suspend = reply; ++ if (can_suspend) { ++ supported |= ToRam; ++ } ++ } else { ++ kDebug() << reply.error().name() << ": " << reply.error().message(); ++ } ++ ++ reply = m_halComputer.asyncCall("GetPropertyBoolean", "power_management.can_hibernate"); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) { ++ bool can_hibernate = reply; ++ if (can_hibernate) { ++ supported |= ToDisk; ++ } ++ } else { ++ kDebug() << reply.error().name() << ": " << reply.error().message(); ++ } ++ } ++ ++ // Battery capacity ++ { ++ foreach (Solid::Device *d, m_batteries) { ++ Solid::GenericInterface *interface = d->as(); ++ ++ if (interface == 0) continue; ++ ++ if (interface->property("battery.reporting.design").toInt() > 0) { ++ uint capacity = ((float)(interface->property("battery.reporting.last_full").toInt()) / ++ (float)(interface->property("battery.reporting.design").toInt())) * 100; ++ ++ if (capacity > 0) { ++ setCapacityForBattery(d->udi(), capacity); ++ } else { ++ // Not supported, set capacity to 100% ++ setCapacityForBattery(d->udi(), 100); ++ } ++ } else { ++ // Not supported, set capacity to 100% ++ setCapacityForBattery(d->udi(), 100); ++ } ++ } ++ } ++ ++ setBackendIsReady(controls, supported); ++} ++ ++void PowerDevilHALBackend::brightnessKeyPressed(PowerDevil::BackendInterface::BrightnessKeyType type) ++{ ++ BrightnessControlsList controls = brightnessControlsAvailable(); ++ QList screenControls = controls.keys(Screen); ++ ++ if (screenControls.isEmpty()) { ++ return; // ignore as we are not able to determine the brightness level ++ } ++ ++ float currentBrightness = brightness(Screen); ++ ++ if (qFuzzyCompare(currentBrightness, m_cachedBrightness) && !m_brightnessInHardware) { ++ float newBrightness; ++ if (type == Increase) { ++ newBrightness = qMin(100.0f, currentBrightness + 10); ++ } else { ++ newBrightness = qMax(0.0f, currentBrightness - 10); ++ } ++ ++ setBrightness(newBrightness, Screen); ++ } else { ++ m_cachedBrightness = currentBrightness; ++ } ++} ++ ++float PowerDevilHALBackend::brightness(PowerDevil::BackendInterface::BrightnessControlType type) const ++{ ++ float brightness; ++ if (type == Screen) { ++ QDBusPendingReply reply = m_halManager.asyncCall("FindDeviceByCapability", "laptop_panel"); ++ reply.waitForFinished(); ++ if(reply.isValid()) { ++ foreach (const QString &device, reply.value()) { ++ QDBusInterface deviceInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device.LaptopPanel", QDBusConnection::systemBus()); ++ QDBusReply brightnessReply = deviceInterface.call("GetBrightness"); ++ if(!brightnessReply.isValid()) { ++ return 0.0; ++ } ++ brightness = brightnessReply; ++ ++ QDBusInterface propertyInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device", QDBusConnection::systemBus()); ++ QDBusReply levelsReply = propertyInterface.call("GetProperty", "laptop_panel.num_levels"); ++ if (levelsReply.isValid()) { ++ int levels = levelsReply; ++ return (float)(100*(brightness/(levels-1))); ++ } ++ } ++ } ++ } else { ++ QDBusPendingReply reply = m_halManager.asyncCall("FindDeviceByCapability", "keyboard_backlight"); ++ reply.waitForFinished(); ++ if(reply.isValid()) { ++ foreach (const QString &device, reply.value()) { ++ //TODO - I do not have a backlight enabled keyboard, so I'm guessing a bit here. Could someone please check this. ++ QDBusInterface deviceInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device.KeyboardBacklight", QDBusConnection::systemBus()); ++ ++ QDBusReply brightnessReply = deviceInterface.call("GetBrightness"); ++ if (!brightnessReply.isValid()) { ++ return 0.0; ++ } ++ brightness = brightnessReply; ++ ++ QDBusInterface propertyInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device", QDBusConnection::systemBus()); ++ QDBusReply levelsReply = propertyInterface.call("GetProperty", "keyboard_backlight.num_levels"); ++ if (levelsReply.isValid()) { ++ int levels = levelsReply; ++ return (float)(100*(brightness/(levels-1))); ++ } ++ } ++ } ++ } ++ return 0.0; ++} ++ ++bool PowerDevilHALBackend::setBrightness(float brightnessValue, PowerDevil::BackendInterface::BrightnessControlType type) ++{ ++ if (type == Screen) { ++ QDBusPendingReply reply = m_halManager.asyncCall("FindDeviceByCapability", "laptop_panel"); ++ reply.waitForFinished(); ++ if(reply.isValid()) { ++ foreach (const QString &device, reply.value()) { ++ QDBusInterface propertyInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device", QDBusConnection::systemBus()); ++ int levels = propertyInterface.call("GetProperty", "laptop_panel.num_levels").arguments().at(0).toInt(); ++ QDBusInterface deviceInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device.LaptopPanel", QDBusConnection::systemBus()); ++ deviceInterface.call("SetBrightness", qRound((levels-1)*(brightnessValue/100.0))); // .0? The right way? Feels hackish. ++ if (!deviceInterface.lastError().isValid()) { ++ float newBrightness = brightness(Screen); ++ if (!qFuzzyCompare(newBrightness, m_cachedBrightness)) { ++ m_cachedBrightness = newBrightness; ++ onBrightnessChanged(Screen, m_cachedBrightness); ++ } ++ return true; ++ } ++ } ++ } ++ } else { ++ QDBusPendingReply reply = m_halManager.asyncCall("FindDeviceByCapability", "keyboard_backlight"); ++ reply.waitForFinished(); ++ if(reply.isValid()) { ++ foreach (const QString &device, reply.value()) { ++ QDBusInterface propertyInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device", QDBusConnection::systemBus()); ++ int levels = propertyInterface.call("GetProperty", "keyboard_backlight.num_levels").arguments().at(0).toInt(); ++ //TODO - I do not have a backlight enabled keyboard, so I'm guessing a bit here. Could someone please check this. ++ QDBusInterface deviceInterface("org.freedesktop.Hal", device, ++ "org.freedesktop.Hal.Device.KeyboardBacklight", QDBusConnection::systemBus()); ++ ++ deviceInterface.call("SetBrightness", qRound((levels-1)*(brightnessValue/100.0))); ++ if(!deviceInterface.lastError().isValid()) { ++ float newBrightness = brightness(Keyboard); ++ if (!qFuzzyCompare(newBrightness, m_cachedBrightness)) { ++ m_cachedBrightness = newBrightness; ++ onBrightnessChanged(Screen, m_cachedBrightness); ++ } ++ return true; ++ } ++ } ++ } ++ } ++ return false; ++} ++ ++KJob* PowerDevilHALBackend::suspend(PowerDevil::BackendInterface::SuspendMethod method) ++{ ++ // Ok, that's not cool, but it's all HAL really gives us, so. ++ QTimer::singleShot(0, this, SLOT(setResumeFromSuspend())); ++ return new HalSuspendJob(m_halPowerManagement, m_halComputer, ++ method, supportedSuspendMethods()); ++} ++ ++void PowerDevilHALBackend::computeAcAdapters() ++{ ++ QList adapters ++ = Solid::Device::listFromType(Solid::DeviceInterface::AcAdapter); ++ ++ foreach (const Solid::Device &adapter, adapters) { ++ m_acAdapters[adapter.udi()] = new Solid::Device(adapter); ++ connect(m_acAdapters[adapter.udi()]->as(), SIGNAL(plugStateChanged(bool, const QString &)), ++ this, SLOT(slotPlugStateChanged(bool))); ++ ++ if (m_acAdapters[adapter.udi()]->as()!=0 ++ && m_acAdapters[adapter.udi()]->as()->isPlugged()) { ++ m_pluggedAdapterCount++; ++ } ++ } ++ ++ if (m_pluggedAdapterCount > 0) { ++ setAcAdapterState(Plugged); ++ } else { ++ setAcAdapterState(Unplugged); ++ } ++} ++ ++void PowerDevilHALBackend::computeBatteries() ++{ ++ QList batteries ++ = Solid::Device::listFromQuery("Battery.type == 'PrimaryBattery'"); ++ ++ foreach (const Solid::Device &battery, batteries) { ++ m_batteries[battery.udi()] = new Solid::Device(battery); ++ connect(m_batteries[battery.udi()]->as(), SIGNAL(chargePercentChanged(int, const QString &)), ++ this, SLOT(updateBatteryStats())); ++ connect(m_batteries[battery.udi()]->as(), SIGNAL(propertyChanged(const QMap &)), ++ this, SLOT(slotBatteryPropertyChanged(const QMap &))); ++ } ++ ++ updateBatteryStats(); ++} ++ ++void PowerDevilHALBackend::computeButtons() ++{ ++ QList buttons ++ = Solid::Device::listFromType(Solid::DeviceInterface::Button); ++ ++ foreach (const Solid::Device &button, buttons) { ++ m_buttons[button.udi()] = new Solid::Device(button); ++ connect(m_buttons[button.udi()]->as(), SIGNAL(pressed(Solid::Button::ButtonType, const QString &)), ++ this, SLOT(slotButtonPressed(Solid::Button::ButtonType))); ++ } ++} ++ ++void PowerDevilHALBackend::slotPlugStateChanged(bool newState) ++{ ++ if (newState) { ++ if(m_pluggedAdapterCount == 0) { ++ setAcAdapterState(Plugged); ++ } ++ m_pluggedAdapterCount++; ++ } else { ++ if(m_pluggedAdapterCount == 1) { ++ setAcAdapterState(Unplugged); ++ } ++ m_pluggedAdapterCount--; ++ } ++} ++ ++void PowerDevilHALBackend::slotButtonPressed(Solid::Button::ButtonType type) ++{ ++ Solid::Button *button = qobject_cast(sender()); ++ ++ if (button == 0) return; ++ ++ switch(type) { ++ case Solid::Button::PowerButton: ++ emit buttonPressed(PowerButton); ++ break; ++ case Solid::Button::SleepButton: ++ emit buttonPressed(SleepButton); ++ break; ++ case Solid::Button::LidButton: ++ if (button->stateValue()) { ++ emit buttonPressed(LidClose); ++ } else { ++ emit buttonPressed(LidOpen); ++ } ++ break; ++ default: ++ //kWarning() << "Unknown button type"; ++ break; ++ } ++} ++ ++void PowerDevilHALBackend::slotDeviceAdded(const QString &udi) ++{ ++ Solid::Device *device = new Solid::Device(udi); ++ if (device->is()) { ++ m_acAdapters[udi] = device; ++ connect(m_acAdapters[udi]->as(), SIGNAL(plugStateChanged(bool, const QString &)), ++ this, SLOT(slotPlugStateChanged(bool))); ++ ++ if (m_acAdapters[udi]->as()!=0 ++ && m_acAdapters[udi]->as()->isPlugged()) { ++ m_pluggedAdapterCount++; ++ } ++ } else if (device->is()) { ++ m_batteries[udi] = device; ++ connect(m_batteries[udi]->as(), SIGNAL(chargePercentChanged(int, const QString &)), ++ this, SLOT(updateBatteryStats())); ++ connect(m_batteries[udi]->as(), SIGNAL(propertyChanged(const QMap &)), ++ this, SLOT(slotBatteryPropertyChanged(const QMap &))); ++ } else if (device->is()) { ++ m_buttons[udi] = device; ++ connect(m_buttons[udi]->as(), SIGNAL(pressed(int, const QString &)), ++ this, SLOT(slotButtonPressed(int))); ++ } else { ++ delete device; ++ } ++} ++ ++void PowerDevilHALBackend::slotDeviceRemoved(const QString &udi) ++{ ++ Solid::Device *device = 0; ++ ++ device = m_acAdapters.take(udi); ++ ++ if (device != 0) { ++ delete device; ++ ++ m_pluggedAdapterCount = 0; ++ ++ foreach (Solid::Device *d, m_acAdapters) { ++ if (d->as()!=0 ++ && d->as()->isPlugged()) { ++ m_pluggedAdapterCount++; ++ } ++ } ++ ++ return; ++ } ++ ++ device = m_batteries.take(udi); ++ ++ if (device!=0) { ++ delete device; ++ updateBatteryStats(); ++ return; ++ } ++ ++ device = m_buttons.take(udi); ++ ++ if (device!=0) { ++ delete device; ++ return; ++ } ++} ++ ++void PowerDevilHALBackend::slotBatteryPropertyChanged(const QMap &changes) ++{ ++ /* This slot catches property changes on battery devices. At ++ * the moment it is used to find out remaining time on batteries. ++ */ ++ ++ if (changes.contains("battery.remaining_time")) { ++ updateBatteryStats(); ++ ++ setBatteryRemainingTime(m_estimatedBatteryTime); ++ } ++} ++ ++void PowerDevilHALBackend::updateBatteryStats() ++{ ++ m_currentBatteryCharge = 0; ++ m_maxBatteryCharge = 0; ++ m_warningBatteryCharge = 0; ++ m_lowBatteryCharge = 0; ++ m_criticalBatteryCharge = 0; ++ m_estimatedBatteryTime = 0; ++ ++ foreach (Solid::Device *d, m_batteries) { ++ Solid::GenericInterface *interface = d->as(); ++ ++ if (interface == 0) continue; ++ ++ m_currentBatteryCharge += interface->property("battery.charge_level.current").toInt(); ++ m_maxBatteryCharge += interface->property("battery.charge_level.last_full").toInt(); ++ m_warningBatteryCharge += interface->property("battery.charge_level.warning").toInt(); ++ m_lowBatteryCharge += interface->property("battery.charge_level.low").toInt(); ++ m_estimatedBatteryTime += interface->property("battery.remaining_time").toInt() * 1000; ++ } ++ ++ m_criticalBatteryCharge = m_lowBatteryCharge/2; ++} ++ ++#include "powerdevilhalbackend.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/powerdevilhalbackend.desktop.svn-base ../powerdevil/daemon/backends/hal/.svn/text-base/powerdevilhalbackend.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/powerdevilhalbackend.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/.svn/text-base/powerdevilhalbackend.desktop.svn-base 2010-12-12 14:48:46.893333334 -0800 +@@ -0,0 +1,55 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevilBackend ++X-KDE-Library=powerdevilhalbackend ++InitialPreference=100 ++Icon=preferences-system-power-management ++Name=HAL PowerDevil Backend ++Name[ast]=HAL PowerDevil Backend ++Name[ca]=Dorsal de HAL per al PowerDevil ++Name[da]=HAL-motor til PowerDevil ++Name[de]=HAL-PowerDevil-Backend ++Name[en_GB]=HAL PowerDevil Backend ++Name[es]=Motor HAL para PowerDevil ++Name[et]=HAL-i PowerDevili taustaprogramm ++Name[ia]=HAL PowerDevil Backend (retro-parte de PowerDevil de HAL) ++Name[ja]=HAL PowerDevil バックエンド ++Name[kk]=HAL PowerDevil тетігі ++Name[km]=កម្មវិធី​ខាងក្រោយ HAL PowerDevil ++Name[ko]=HAL PowerDevil 백엔드 ++Name[lt]=HAL PowerDevil programinė sąsaja ++Name[nb]=HAL PowerDevil-motor ++Name[nds]=Hülpprogramm för den HAL-Stroomdüvel ++Name[nl]=Backend voor HAL PowerDevil ++Name[pa]=HAL ਪਾਵਰ-ਡੀਵਿਲ ਬੈਕਐਂਡ ++Name[pt]=Infra-Estrutura de HAL para o PowerDevil ++Name[pt_BR]=Infraestrutura de HAL para o PowerDevil ++Name[sv]=HAL Powerdevil-gränssnitt ++Name[th]=โปรแกรมเบื้องหลัง HAL PowerDevil ++Name[uk]=Сервер PowerDevil HAL ++Name[x-test]=xxHAL PowerDevil Backendxx ++Name[zh_TW]=HAL PowerDevil 後端介面 ++Comment=Use KDE Power Management system through freedesktop.org HAL daemon ++Comment[ast]=Usar la xestión de enerxía del sistema KDE a traviés del degorriu HAL de freedesktop.org ++Comment[ca]=Usa el sistema de gestió d'energia del KDE mitjançant el dimoni HAL del freedesktop.org ++Comment[da]=Brug KDE strømstyring via HAL-dæmonen fra freedesktop.org ++Comment[de]=Das KDE-Energieverwaltungsystem mit Hilfe des HAL-Dienstes von freedesktop.org verwenden ++Comment[en_GB]=Use KDE Power Management system through freedesktop.org HAL dæmon ++Comment[es]=Usar el sistema de gestión de energía de KDE mediante el demonio HAL de freedesktop.org ++Comment[et]=KDE toitehalduse süsteemi kasutamine freedesktop.org-i HAL-deemoni abil ++Comment[ia]=Usar systema de Gestion de Energia de KDE usante demone HAL de freedesktop.org ++Comment[kk]=freedesktop.org HAL қызметі көмегімен KDE қуаттандыру жүйесін басқару ++Comment[km]=ប្រើ​ប្រព័ន្ធ​គ្រប់គ្រង​ថាមពល​របស់ KDE តាមរយៈ​ដេមិន freedesktop.org HAL ++Comment[ko]=freedesktop.org HAL 데몬을 사용하는 KDE 전력 관리 시스템 ++Comment[lt]=Naudoti KDE energijos valdymo sistemą, naudojant freedesktop.org HAL tarnybą ++Comment[nb]=Bruk KDE strømstyringssystem med HAL-nissen fra freedesktop.org ++Comment[nds]=Den HAL-Dämoon vun freedesktop.org för de KDE-Stroomkuntrull bruken ++Comment[nl]=KDE energiebeheer gebruiken via de HAL-daemon van freedesktop.org ++Comment[pa]=freedesktop.org HAL ਡੈਮਨ ਦੀ ਵਰਤੋਂ ਨਾਲ KDE ਪਾਵਰ ਮੈਨਿਜਮੈਂਟ ਸਿਸਟਮ ++Comment[pt]=Usar o sistema de gestão de energia do KDE através do servidor de HAL do freedesktop.org ++Comment[pt_BR]=Usar o sistema de gerenciamento de energia do KDE através do daemon HAL do freedesktop.org ++Comment[sv]=Använd KDE:s strömsparhantering via HAL-demon från freedesktop.org ++Comment[th]=ใช้ระบบจัดการพลังงานของ KDE โดยใช้ดีมอน HAL จาก freedesktop.org ++Comment[uk]=Використання системи керування живленням KDE за допомогою фонової служби HAL freedesktop.org ++Comment[x-test]=xxUse KDE Power Management system through freedesktop.org HAL daemonxx ++Comment[zh_TW]=透過 freedesktop.org 的 HAL 伺服程式使用 KDE 電源管理系統 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/powerdevilhalbackend.h.svn-base ../powerdevil/daemon/backends/hal/.svn/text-base/powerdevilhalbackend.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/hal/.svn/text-base/powerdevilhalbackend.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/hal/.svn/text-base/powerdevilhalbackend.h.svn-base 2010-12-12 14:48:46.893333334 -0800 +@@ -0,0 +1,93 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ Copyright (C) 2008-2010 Dario Freddi ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++#ifndef POWERDEVILHALBACKEND_H ++#define POWERDEVILHALBACKEND_H ++ ++#include ++ ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++ ++namespace Solid { ++class Device; ++} ++ ++ ++class KDE_EXPORT PowerDevilHALBackend : public PowerDevil::BackendInterface ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(PowerDevilHALBackend) ++public: ++ explicit PowerDevilHALBackend(QObject* parent); ++ virtual ~PowerDevilHALBackend(); ++ ++ virtual void init(); ++ static bool isAvailable(); ++ ++ virtual float brightness(BrightnessControlType type = Screen) const; ++ ++ virtual void brightnessKeyPressed(PowerDevil::BackendInterface::BrightnessKeyType type); ++ virtual bool setBrightness(float brightness, PowerDevil::BackendInterface::BrightnessControlType type = Screen); ++ virtual KJob* suspend(PowerDevil::BackendInterface::SuspendMethod method); ++ ++private: ++ void computeAcAdapters(); ++ void computeBatteries(); ++ void computeButtons(); ++ ++private slots: ++ void updateBatteryStats(); ++ void slotPlugStateChanged(bool newState); ++ void slotButtonPressed(Solid::Button::ButtonType type); ++ void slotDeviceAdded(const QString &udi); ++ void slotDeviceRemoved(const QString &udi); ++ void slotBatteryPropertyChanged(const QMap &changes); ++ ++private: ++ QMap m_acAdapters; ++ QMap m_batteries; ++ QMap m_buttons; ++ ++ int m_pluggedAdapterCount; ++ ++ int m_currentBatteryCharge; ++ int m_maxBatteryCharge; ++ int m_warningBatteryCharge; ++ int m_lowBatteryCharge; ++ int m_criticalBatteryCharge; ++ int m_estimatedBatteryTime; ++ ++ bool m_brightnessInHardware; ++ float m_cachedBrightness; ++ ++ mutable QDBusInterface m_halComputer; ++ mutable QDBusInterface m_halPowerManagement; ++ mutable QDBusInterface m_halCpuFreq; ++ mutable QDBusInterface m_halManager; ++}; ++ ++#endif // POWERDEVILHALBACKEND_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/.svn/entries ../powerdevil/daemon/backends/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/.svn/entries 2010-12-12 14:48:46.920000000 -0800 +@@ -0,0 +1,34 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon/backends ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-12T14:52:17.769717Z ++1205791 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++upower ++dir ++ ++hal ++dir ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/entries ../powerdevil/daemon/backends/upower/dbus/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/dbus/.svn/entries 2010-12-12 14:48:46.890000001 -0800 +@@ -0,0 +1,130 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon/backends/upower/dbus ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-11-08T13:20:44.276314Z ++1194255 ++lukas ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++org.freedesktop.UPower.xml ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.886666Z ++23efba659ef6ab4a3d1125d79e64f162 ++2010-10-13T00:03:19.327839Z ++1185337 ++afiestas ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1572 ++ ++org.freedesktop.UPower.KbdBacklight.xml ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.886666Z ++7da3a9f60c84ab9d1e5f541490e9f483 ++2010-11-08T13:20:44.276314Z ++1194255 ++lukas ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3227 ++ ++org.freedesktop.UPower.Device.xml ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.886666Z ++b18ef41b6d37f685295906c5021dadc7 ++2010-10-25T13:22:42.020117Z ++1189640 ++lukas ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++20277 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.Device.xml.svn-base ../powerdevil/daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.Device.xml.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.Device.xml.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.Device.xml.svn-base 2010-12-12 14:48:46.886666668 -0800 +@@ -0,0 +1,613 @@ ++ ++]> ++ ++ ++ ++ ++ ++ Objects implementing this interface are usually discovered through ++ the org.freedesktop.UPower interface on ++ the /org/freedesktop/UPower object on ++ the D-Bus system bus service with the well-known ++ name org.freedesktop.UPower using ++ the ++ EnumerateDevices ++ method. ++ ++ ++ ++ ++$ dbus-send --print-reply \ ++ --system \ ++ --dest=org.freedesktop.UPower \ ++ /org/freedesktop/UPower/devices/battery_BAT0 \ ++ org.freedesktop.DBus.Properties.GetAll \ ++ string:org.freedesktop.UPower.Device ++ ++method return sender=:1.386 -> dest=:1.477 reply_serial=2 ++ array [ ++ dict entry( ++ string "native-path" ++ variant string "/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0" ++ ) ++ dict entry( ++ string "vendor" ++ variant string "SONY" ++ ) ++ dict entry( ++ string "model" ++ variant string "42T4568" ++ ) ++ dict entry( ++ string "serial" ++ variant string "4179" ++ ) ++ dict entry( ++ string "update-time" ++ variant uint64 1226417875 ++ ) ++ dict entry( ++ string "type" ++ variant uint 2 ++ ) ++ dict entry( ++ string "power-supply" ++ variant boolean true ++ ) ++ dict entry( ++ string "has-history" ++ variant boolean true ++ ) ++ dict entry( ++ string "has-statistics" ++ variant boolean true ++ ) ++ dict entry( ++ string "online" ++ variant boolean false ++ ) ++ dict entry( ++ string "energy" ++ variant double 72.85 ++ ) ++ dict entry( ++ string "energy-empty" ++ variant double 0 ++ ) ++ dict entry( ++ string "energy-full" ++ variant double 74.55 ++ ) ++ dict entry( ++ string "energy-full-design" ++ variant double 74.88 ++ ) ++ dict entry( ++ string "energy-rate" ++ variant double 0 ++ ) ++ dict entry( ++ string "voltage" ++ variant double 16.415 ++ ) ++ dict entry( ++ string "time-to-empty" ++ variant int64 0 ++ ) ++ dict entry( ++ string "time-to-full" ++ variant int64 0 ++ ) ++ dict entry( ++ string "percentage" ++ variant double 97.7197 ++ ) ++ dict entry( ++ string "is-present" ++ variant boolean true ++ ) ++ dict entry( ++ string "state" ++ variant uint 3 ++ ) ++ dict entry( ++ string "is-rechargeable" ++ variant boolean true ++ ) ++ dict entry( ++ string "capacity" ++ variant double 100 ++ ) ++ dict entry( ++ string "technology" ++ variant uint 1 ++ ) ++ ] ++ ++ ++ ++ ++ Unless otherwise noted, an empty string or the value 0 in a ++ property on this interface means not set. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Refreshes the data collected from the power source. ++ ++ ++ Callers need the org.freedesktop.upower.refresh-power-source authorization ++ ++ if an error occured while refreshing ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Some value on the power source changed. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ OS specific native path of the power source. On Linux this ++ is the sysfs path, for ++ example /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0. Is ++ blank if the device is being driven by a user space ++ driver. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Name of the vendor of the battery. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Name of the model of this battery. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Unique serial number of the battery. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The point in time (seconds since the Epoch Jan 1, 1970 ++ 0:00 UTC) that data was read from the power source. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Type of power source. ++ ++ ++ ++ 0Unknown ++ ++ ++ 1Line Power ++ ++ ++ 2Battery ++ ++ ++ 3Ups ++ ++ ++ 4Monitor ++ ++ ++ 5Mouse ++ ++ ++ 6Keyboard ++ ++ ++ 7Pda ++ ++ ++ 8Phone ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ If the power device is used to supply the system. ++ This would be set TRUE for laptop batteries and UPS devices, ++ but set FALSE for wireless mice or PDAs. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ If the power device has history. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ If the power device has statistics. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Whether power is currently being provided through line power. ++ This property is only valid if the property ++ type ++ has the value "line-power". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Amount of energy (measured in Wh) currently available in ++ the power source. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Amount of energy (measured in Wh) in the power source when ++ it's considered to be empty. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Amount of energy (measured in Wh) in the power source when ++ it's considered full. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Amount of energy (measured in Wh) the power source is ++ designed to hold when it's considered full. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Amount of energy being drained from the source, measured ++ in W. If positive, the source is being discharged, if ++ negative it's being charged. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Voltage in the Cell or being recorded by the meter. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Number of seconds until the power source is considered empty. ++ Is set to 0 if unknown. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Number of seconds until the power source is considered full. ++ Is set to 0 if unknown. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The amount of energy left in the power source expressed as ++ a percentage between 0 and 100. Typically this is the same as ++ (energy - ++ energy-empty) / ++ (energy-full - ++ energy-empty). ++ However, some primitive power sources are capable of only ++ reporting percentages and in this case the energy-* ++ properties will be unset while this property is set. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ If the power source is present in the bay. ++ This field is required as some batteries are hot-removable, for example ++ expensive UPS and most laptop batteries. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The battery power state. ++ ++ ++ ++ 0Unknown ++ ++ ++ 1Charging ++ ++ ++ 2Discharging ++ ++ ++ 3Empty ++ ++ ++ 4Fully charged ++ ++ ++ 5Pending charge ++ ++ ++ 6Pending discharge ++ ++ ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ If the power source is rechargeable. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The capacity of the power source expressed as a percentage between 0 and 100. ++ The capacity of the battery will reduce with age. ++ A capacity value less than 75% is usually a sign that you should renew your battery. ++ Typically this value is the same as ++ (full-design / ++ full) * 100. ++ However, some primitive power sources are not capable reporting capacity ++ and in this case the capacity property will be unset. ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Technology used in the battery: ++ ++ ++ ++ 0Unknown ++ ++ ++ 1Lithium ion ++ ++ ++ 2Lithium polymer ++ ++ ++ 3Lithium iron phosphate ++ ++ ++ 4Lead acid ++ ++ ++ 5Nickel cadmium ++ ++ ++ 6Nickel metal hydride ++ ++ ++ ++ This property is only valid if the property ++ type ++ has the value "battery". ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ If the device may have been recalled by the vendor due to a suspected ++ fault. ++ This key does not imply the device is faulty, only that it approximatly ++ matches the description from the vendor of units that were recalled. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The vendor that is handling the hardware recall. ++ ++ ++ This property is only valid if the property recall-notice is true. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The URL to visit about the hardware recall. ++ ++ ++ This property is only valid if the property recall-notice is true. ++ ++ ++ ++ ++ ++ ++ ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.KbdBacklight.xml.svn-base ../powerdevil/daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.KbdBacklight.xml.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.KbdBacklight.xml.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.KbdBacklight.xml.svn-base 2010-12-12 14:48:46.886666668 -0800 +@@ -0,0 +1,101 @@ ++ ++]> ++ ++ ++ ++ ++ ++ org.freedesktop.UPower.KbdBacklight is a DBus interface implimented ++ by UPower. ++ It allows the keyboard backlight (if present) to be controlled. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The maximum value of the keyboard backlight brightness. ++ ++ ++ ++ ++ ++ ++ Get the maximum brightness level for the keyboard backlight. ++ ++ ++ ++ if an error occured while getting the maximum brightness ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The current value of the keyboard backlight brightness. ++ ++ ++ ++ ++ ++ ++ Get the brightness level of the keyboard backlight. ++ ++ ++ ++ if an error occured while getting the brightness ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The value to set the KbdBacklight brightness. ++ ++ ++ ++ ++ ++ ++ Set the brightness level of the keyboard backlight. ++ ++ ++ ++ if an error occured while setting the brightness ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ The new brightness value of the keyboard backlight. ++ ++ ++ ++ ++ ++ ++ The keyboard backlight brightness level has changed. ++ ++ ++ ++ ++ ++ ++ ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.xml.svn-base ../powerdevil/daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.xml.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.xml.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/dbus/.svn/text-base/org.freedesktop.UPower.xml.svn-base 2010-12-12 14:48:46.886666668 -0800 +@@ -0,0 +1,43 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/powerdevilupowerbackend.cpp ../powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/powerdevilupowerbackend.cpp 2010-11-25 09:40:32.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp 2010-12-12 14:48:46.890000001 -0800 +@@ -33,28 +33,59 @@ + + PowerDevilUPowerBackend::PowerDevilUPowerBackend(QObject* parent) + : BackendInterface(parent), +- m_brightNessControl(new XRandrBrightness()), +- m_upowerInterface(new OrgFreedesktopUPowerInterface(UPOWER_SERVICE, "/org/freedesktop/UPower", QDBusConnection::systemBus(), parent)), +- m_kbdBacklight(new OrgFreedesktopUPowerKbdBacklightInterface(UPOWER_SERVICE, "/org/freedesktop/UPower/KbdBacklight", QDBusConnection::systemBus(), parent)), ++ m_brightNessControl(0), + m_lidIsPresent(false), m_lidIsClosed(false), m_onBattery(false) + { + } + + PowerDevilUPowerBackend::~PowerDevilUPowerBackend() + { +- qDeleteAll(m_devices); +- delete m_upowerInterface; + delete m_brightNessControl; +- delete m_kbdBacklight; + } + + bool PowerDevilUPowerBackend::isAvailable() + { +- return m_upowerInterface->isValid(); ++ if (!QDBusConnection::systemBus().interface()->isServiceRegistered(UPOWER_SERVICE)) { ++ // Is it pending activation? ++ kDebug() << "UPower service, " << UPOWER_SERVICE << ", is not registered on the bus. Trying to find out if it is activated."; ++ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.DBus", ++ "/org/freedesktop/DBus", ++ "org.freedesktop.DBus", ++ "ListActivatableNames"); ++ ++ QDBusPendingReply< QStringList > reply = QDBusConnection::systemBus().asyncCall(message); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) { ++ if (reply.value().contains(UPOWER_SERVICE)) { ++ kDebug() << "UPower was found, activating service..."; ++ QDBusConnection::systemBus().interface()->startService(UPOWER_SERVICE); ++ return true; ++ } else { ++ kDebug() << "UPower cannot be found on this system."; ++ return false; ++ } ++ } else { ++ kWarning() << "Could not request activatable names to DBus!"; ++ return false; ++ } ++ } else { ++ return true; ++ } + } + + void PowerDevilUPowerBackend::init() + { ++ // interfaces ++ if (!QDBusConnection::systemBus().interface()->isServiceRegistered(UPOWER_SERVICE)) { ++ // Activate it. ++ QDBusConnection::systemBus().interface()->startService(UPOWER_SERVICE); ++ } ++ ++ m_upowerInterface = new OrgFreedesktopUPowerInterface(UPOWER_SERVICE, "/org/freedesktop/UPower", QDBusConnection::systemBus(), this); ++ m_kbdBacklight = new OrgFreedesktopUPowerKbdBacklightInterface(UPOWER_SERVICE, "/org/freedesktop/UPower/KbdBacklight", QDBusConnection::systemBus(), this); ++ m_brightNessControl = new XRandrBrightness(); ++ + // devices + enumerateDevices(); + connect(m_upowerInterface, SIGNAL(Changed()), this, SLOT(slotPropertyChanged())); +@@ -147,7 +178,7 @@ + kDebug() << "Screen brightness: " << m_brightNessControl->brightness(); + return m_brightNessControl->brightness(); + } else if (type == Keyboard) { +- kDebug() << "Kbd backlight: " << m_brightNessControl->brightness(); ++ kDebug() << "Kbd backlight brightness: " << m_kbdBacklight->GetBrightness(); + return m_kbdBacklight->GetBrightness() / m_kbdBacklight->GetMaxBrightness() * 100; + } + +@@ -242,9 +273,9 @@ + bool lidIsClosed = m_upowerInterface->lidIsClosed(); + if (lidIsClosed != m_lidIsClosed) { + if (lidIsClosed) +- emit buttonPressed(LidClose); ++ setButtonPressed(LidClose); + else +- emit buttonPressed(LidOpen); ++ setButtonPressed(LidOpen); + } + m_lidIsClosed = lidIsClosed; + } +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/powerdevilupowerbackend.h ../powerdevil/daemon/backends/upower/powerdevilupowerbackend.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/powerdevilupowerbackend.h 2010-11-25 09:40:32.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/powerdevilupowerbackend.h 2010-12-12 14:48:46.890000001 -0800 +@@ -46,7 +46,7 @@ + virtual ~PowerDevilUPowerBackend(); + + virtual void init(); +- virtual bool isAvailable(); ++ static bool isAvailable(); + + virtual float brightness(BrightnessControlType type = Screen) const; + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/entries ../powerdevil/daemon/backends/upower/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/entries 2010-12-12 14:48:46.890000001 -0800 +@@ -0,0 +1,269 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon/backends/upower ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-12T14:52:17.769717Z ++1205791 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++upowersuspendjob.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.890000Z ++e2b6c9e760bf6fb4261fba01f719e7ac ++2010-11-08T09:08:33.709679Z ++1194096 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2488 ++ ++powerdevilupowerbackend.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.890000Z ++1d89301d30b7ea791e4e5b5f080a4fc0 ++2010-12-07T17:03:49.380344Z ++1204505 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2669 ++ ++powerdevilupowerbackend.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.890000Z ++8edf5b3bf2d1dad1f8c8fde2086ce554 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3738 ++ ++upowersuspendjob.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.890000Z ++ff724667e0e9cbc40834ed9654c185ab ++2010-10-27T16:33:56.700168Z ++1190433 ++lukas ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1717 ++ ++xrandrbrightness.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.890000Z ++4ad11dc00e770c7d44bfb8c2cf2ff12d ++2010-12-07T17:03:47.043084Z ++1204504 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4998 ++ ++powerdevilupowerbackend.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.890000Z ++be7157419f9dbd06f3c67965ecd156e8 ++2010-12-12T14:52:17.769717Z ++1205791 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++10364 ++ ++dbus ++dir ++ ++xrandrbrightness.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.890000Z ++fbbe4dd44d5c543563355b28474edfd7 ++2010-11-08T09:08:33.709679Z ++1194096 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1404 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.cpp.svn-base ../powerdevil/daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.cpp.svn-base 2010-12-12 14:48:46.883333335 -0800 +@@ -0,0 +1,295 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ Copyright (C) 2008-2010 Dario Freddi ++ Copyright (C) 2010 Alejandro Fiestas ++ Copyright (C) 2010 Lukas Tinkl ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++#include "powerdevilupowerbackend.h" ++ ++#include ++#include ++ ++#include ++#include ++ ++#include "xrandrbrightness.h" ++#include "upowersuspendjob.h" ++ ++PowerDevilUPowerBackend::PowerDevilUPowerBackend(QObject* parent) ++ : BackendInterface(parent), ++ m_brightNessControl(0), ++ m_lidIsPresent(false), m_lidIsClosed(false), m_onBattery(false) ++{ ++} ++ ++PowerDevilUPowerBackend::~PowerDevilUPowerBackend() ++{ ++ delete m_brightNessControl; ++} ++ ++bool PowerDevilUPowerBackend::isAvailable() ++{ ++ if (!QDBusConnection::systemBus().interface()->isServiceRegistered(UPOWER_SERVICE)) { ++ // Is it pending activation? ++ kDebug() << "UPower service, " << UPOWER_SERVICE << ", is not registered on the bus. Trying to find out if it is activated."; ++ QDBusMessage message = QDBusMessage::createMethodCall("org.freedesktop.DBus", ++ "/org/freedesktop/DBus", ++ "org.freedesktop.DBus", ++ "ListActivatableNames"); ++ ++ QDBusPendingReply< QStringList > reply = QDBusConnection::systemBus().asyncCall(message); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) { ++ if (reply.value().contains(UPOWER_SERVICE)) { ++ kDebug() << "UPower was found, activating service..."; ++ QDBusConnection::systemBus().interface()->startService(UPOWER_SERVICE); ++ return true; ++ } else { ++ kDebug() << "UPower cannot be found on this system."; ++ return false; ++ } ++ } else { ++ kWarning() << "Could not request activatable names to DBus!"; ++ return false; ++ } ++ } else { ++ return true; ++ } ++} ++ ++void PowerDevilUPowerBackend::init() ++{ ++ // interfaces ++ if (!QDBusConnection::systemBus().interface()->isServiceRegistered(UPOWER_SERVICE)) { ++ // Activate it. ++ QDBusConnection::systemBus().interface()->startService(UPOWER_SERVICE); ++ } ++ ++ m_upowerInterface = new OrgFreedesktopUPowerInterface(UPOWER_SERVICE, "/org/freedesktop/UPower", QDBusConnection::systemBus(), this); ++ m_kbdBacklight = new OrgFreedesktopUPowerKbdBacklightInterface(UPOWER_SERVICE, "/org/freedesktop/UPower/KbdBacklight", QDBusConnection::systemBus(), this); ++ m_brightNessControl = new XRandrBrightness(); ++ ++ // devices ++ enumerateDevices(); ++ connect(m_upowerInterface, SIGNAL(Changed()), this, SLOT(slotPropertyChanged())); ++ connect(m_upowerInterface, SIGNAL(DeviceAdded(const QString &)), this, SLOT(slotDeviceAdded(const QString &))); ++ connect(m_upowerInterface, SIGNAL(DeviceRemoved(const QString &)), this, SLOT(slotDeviceRemoved(const QString &))); ++ connect(m_upowerInterface, SIGNAL(DeviceChanged(const QString &)), this, SLOT(slotDeviceChanged(const QString &))); ++ ++ // Brightness Controls available ++ BrightnessControlsList controls; ++ if (m_brightNessControl->isSupported()) { ++ controls.insert(QLatin1String("LVDS1"), Screen); ++ } ++ ++ if (m_kbdBacklight->isValid()) ++ controls.insert(QLatin1String("KBD"), Keyboard); ++ ++ if (!controls.isEmpty()) { ++ m_cachedBrightness = brightness(Screen); ++ kDebug() << "current screen brightness: " << m_cachedBrightness; ++ } ++ ++ // Supported suspend methods ++ SuspendMethods supported = UnknownSuspendMethod; ++ { ++ if (m_upowerInterface->canSuspend()) { ++ kDebug() << "Can suspend"; ++ supported |= ToRam; ++ } ++ ++ if (m_upowerInterface->canHibernate()) { ++ kDebug() << "Can hibernate"; ++ supported |= ToDisk; ++ } ++ } ++ ++ connect(m_upowerInterface, SIGNAL(Resuming()), this, SIGNAL(resumeFromSuspend())); ++ ++ // battery ++ QList recallList; ++ foreach(OrgFreedesktopUPowerDeviceInterface * upowerDevice, m_devices) { ++ if (upowerDevice->type() == 2 && upowerDevice->powerSupply()) { ++ QString udi = upowerDevice->path(); ++ setCapacityForBattery(udi, qRound(upowerDevice->capacity())); // acknowledge capacity ++ ++ if (upowerDevice->recallNotice()) { // check for recall notices ++ RecallNotice notice; ++ notice.batteryId = udi; ++ notice.url = upowerDevice->recallUrl(); ++ notice.vendor = upowerDevice->recallVendor(); ++ ++ recallList.append(notice); ++ } ++ } ++ } ++ if (!recallList.isEmpty()) ++ setRecallNotices(recallList); ++ ++ // backend ready ++ setBackendIsReady(controls, supported); ++} ++ ++void PowerDevilUPowerBackend::brightnessKeyPressed(PowerDevil::BackendInterface::BrightnessKeyType type) ++{ ++ BrightnessControlsList controls = brightnessControlsAvailable(); ++ QList screenControls = controls.keys(Screen); ++ ++ if (screenControls.isEmpty()) { ++ return; // ignore as we are not able to determine the brightness level ++ } ++ ++ float currentBrightness = brightness(Screen); ++ ++ if (qFuzzyCompare(currentBrightness, m_cachedBrightness)) { ++ float newBrightness; ++ if (type == Increase) { ++ newBrightness = qMin(100.0f, currentBrightness + 10); ++ } else { ++ newBrightness = qMax(0.0f, currentBrightness - 10); ++ } ++ ++ setBrightness(newBrightness, Screen); ++ } else { ++ m_cachedBrightness = currentBrightness; ++ } ++} ++ ++float PowerDevilUPowerBackend::brightness(PowerDevil::BackendInterface::BrightnessControlType type) const ++{ ++ if (type == Screen) { ++ kDebug() << "Screen brightness: " << m_brightNessControl->brightness(); ++ return m_brightNessControl->brightness(); ++ } else if (type == Keyboard) { ++ kDebug() << "Kbd backlight brightness: " << m_kbdBacklight->GetBrightness(); ++ return m_kbdBacklight->GetBrightness() / m_kbdBacklight->GetMaxBrightness() * 100; ++ } ++ ++ return 0.0; ++} ++ ++bool PowerDevilUPowerBackend::setBrightness(float brightnessValue, PowerDevil::BackendInterface::BrightnessControlType type) ++{ ++ if (type == Screen) { ++ kDebug() << "set screen brightness: " << brightnessValue; ++ m_brightNessControl->setBrightness(brightnessValue); ++ float newBrightness = brightness(Screen); ++ if (!qFuzzyCompare(newBrightness, m_cachedBrightness)) { ++ m_cachedBrightness = newBrightness; ++ onBrightnessChanged(Screen, m_cachedBrightness); ++ } ++ return true; ++ } else if (type == Keyboard) { ++ kDebug() << "set kbd backlight: " << brightnessValue; ++ m_kbdBacklight->SetBrightness(brightnessValue / 100 * m_kbdBacklight->GetMaxBrightness()); ++ return true; ++ } ++ ++ return false; ++} ++ ++KJob* PowerDevilUPowerBackend::suspend(PowerDevil::BackendInterface::SuspendMethod method) ++{ ++ return new UPowerSuspendJob(m_upowerInterface, method, supportedSuspendMethods()); ++} ++ ++void PowerDevilUPowerBackend::enumerateDevices() ++{ ++ m_lidIsPresent = m_upowerInterface->lidIsPresent(); ++ m_lidIsClosed = m_upowerInterface->lidIsClosed(); ++ m_onBattery = m_upowerInterface->onBattery(); ++ ++ QList deviceList = m_upowerInterface->EnumerateDevices(); ++ foreach (const QDBusObjectPath & device, deviceList) ++ slotDeviceAdded(device.path()); ++ ++ if (m_onBattery) ++ setAcAdapterState(Unplugged); ++ else ++ setAcAdapterState(Plugged); ++} ++ ++void PowerDevilUPowerBackend::slotDeviceAdded(const QString & device) ++{ ++ OrgFreedesktopUPowerDeviceInterface * upowerDevice = ++ new OrgFreedesktopUPowerDeviceInterface(UPOWER_SERVICE, device, QDBusConnection::systemBus(), this); ++ m_devices.insert(device, upowerDevice); ++ ++ updateDeviceProps(); ++} ++ ++void PowerDevilUPowerBackend::slotDeviceRemoved(const QString & device) ++{ ++ OrgFreedesktopUPowerDeviceInterface * upowerDevice = m_devices.take(device); ++ ++ if (upowerDevice) ++ delete upowerDevice; ++ ++ updateDeviceProps(); ++} ++ ++void PowerDevilUPowerBackend::slotDeviceChanged(const QString & /*device*/) ++{ ++ updateDeviceProps(); ++} ++ ++void PowerDevilUPowerBackend::updateDeviceProps() ++{ ++ qlonglong remainingTime = 0; ++ ++ foreach(OrgFreedesktopUPowerDeviceInterface * upowerDevice, m_devices) { ++ if (upowerDevice->type() == 2 && upowerDevice->powerSupply()) { ++ if (upowerDevice->state() == 1) // charging ++ remainingTime += upowerDevice->timeToFull(); ++ else if (upowerDevice->state() == 2) //discharging ++ remainingTime += upowerDevice->timeToEmpty(); ++ } ++ } ++ ++ setBatteryRemainingTime(remainingTime * 1000); ++} ++ ++void PowerDevilUPowerBackend::slotPropertyChanged() ++{ ++ // check for lid button changes ++ if (m_lidIsPresent) { ++ bool lidIsClosed = m_upowerInterface->lidIsClosed(); ++ if (lidIsClosed != m_lidIsClosed) { ++ if (lidIsClosed) ++ setButtonPressed(LidClose); ++ else ++ setButtonPressed(LidOpen); ++ } ++ m_lidIsClosed = lidIsClosed; ++ } ++ ++ // check for AC adapter changes ++ bool onBattery = m_upowerInterface->onBattery(); ++ if (m_onBattery != onBattery) { ++ if (onBattery) ++ setAcAdapterState(Unplugged); ++ else ++ setAcAdapterState(Plugged); ++ } ++ ++ m_onBattery = onBattery; ++} ++ ++#include "powerdevilupowerbackend.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.desktop.svn-base ../powerdevil/daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.desktop.svn-base 2010-12-12 14:48:46.883333335 -0800 +@@ -0,0 +1,54 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=PowerDevilBackend ++X-KDE-Library=powerdevilupowerbackend ++InitialPreference=200 ++Icon=preferences-system-power-management ++Name=UPower PowerDevil Backend ++Name[ast]=UPower PowerDevil Backend ++Name[ca]=Dorsal d'UPower per al PowerDevil ++Name[da]=UPower-motor til PowerDevil ++Name[de]=UPower-PowerDevil-Modul ++Name[en_GB]=UPower PowerDevil Backend ++Name[es]=Motor UPower para PowerDevil ++Name[et]=UPoweri PowerDevili taustaprogramm ++Name[ia]=UPower PowerDevil Backend (RetroParte de Powerdevil de UPower) ++Name[ja]=UPower PowerDevil バックエンド ++Name[kk]=UPower PowerDevil тетігі ++Name[km]=កម្មវិធី​ខាងក្រោយ UPower PowerDevil ++Name[ko]=UPower PowerDevil 백엔드 ++Name[lt]=UPower PowerDevil programinė sąsaja ++Name[nb]=UPower PowerDevil-motor ++Name[nds]=Hülpprogramm för den UPower-Stroomdüvel ++Name[nl]=Backend voor UPower PowerDevil ++Name[pa]=UPower ਪਾਵਰ-ਡੀਵਿਲ ਬੈਕਐਂਡ ++Name[pt]=Infra-Estrutura de UPower para o PowerDevil ++Name[pt_BR]=Infraestrutura de UPower para o PowerDevil ++Name[sv]=Upower Powerdevil-gränssnitt ++Name[th]=โปรแกรมเบื้องหลัง PowerDevil ของ UPower ++Name[uk]=Сервер PowerDevil UPower ++Name[x-test]=xxUPower PowerDevil Backendxx ++Name[zh_TW]=UPower PowerDevil 後端介面 ++Comment=Use KDE Power Management system through freedesktop.org upower daemon ++Comment[ast]=Usar la xestión d'enerxía del sistema KDE a traviés del degorriu HAL de freedesktop.org sobre'l degorriu ++Comment[ca]=Usa el sistema de gestió d'energia del KDE mitjançant el dimoni upower del freedesktop.org ++Comment[da]=Brug KDE strømstyring via upower-dæmonen fra freedesktop.org ++Comment[en_GB]=Use KDE Power Management system through freedesktop.org upower dæmon ++Comment[es]=Usar el sistema de gestión de energía de KDE mediante el demonio UPower de freedesktop.org ++Comment[et]=KDE toitehalduse süsteemi kasutamine freedesktop.org-i upoweri deemoni abil ++Comment[ia]=Usar systema de Gestion de Energia de KDE usante demone upower de freedesktop.org ++Comment[kk]=freedesktop.org upower қызметі көмегімен KDE қуаттандыру жүйесін басқару ++Comment[km]=ប្រើ​ប្រព័ន្ធ​គ្រប់គ្រង​ថាមពល​របស់ KDE តាមរយៈ​ដេមិន freedesktop.org upower ++Comment[ko]=freedesktop.org UPower 데몬을 사용하는 KDE 전력 관리 시스템 ++Comment[lt]=Naudoti KDE energijos valdymo sistyemą, naudojant freedesktop.org HAL tarnybą ++Comment[nb]=Bruk KDE strømstyringssystem med upower-nissen fra freedesktop.org ++Comment[nds]=Den UPower-Dämoon vun freedesktop.org för de KDE-Stroomkuntrull bruken ++Comment[nl]=KDE energiebeheer gebruiken via de upower-daemon van freedesktop.org ++Comment[pa]=freedesktop.org upower ਡੈਮਨ ਰਾਹੀਂ KDE ਪਾਵਰ ਪਰਬੰਧ ਵਰਤੋਂ ++Comment[pt]=Usar o sistema de gestão de energia do KDE através do servidor 'upower' do freedesktop.org ++Comment[pt_BR]=Usar o sistema de gerenciamento de energia do KDE através do daemon upower do freedesktop.org ++Comment[sv]=Använd KDE:s strömsparhantering via Upower-demon från freedesktop.org ++Comment[th]=ใช้ระบบจัดการพลังงานของ KDE โดยใช้ดีมอน upower จาก freedesktop.org ++Comment[uk]=Використання системи керування живленням KDE за допомогою фонової служби upower freedesktop.org ++Comment[x-test]=xxUse KDE Power Management system through freedesktop.org upower daemonxx ++Comment[zh_TW]=透過 freedesktop.org 的 upower 伺服程式使用 KDE 電源管理系統 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.h.svn-base ../powerdevil/daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/text-base/powerdevilupowerbackend.h.svn-base 2010-12-12 14:48:46.883333335 -0800 +@@ -0,0 +1,83 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ Copyright (C) 2008-2010 Dario Freddi ++ Copyright (C) 2010 Alejandro Fiestas ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++#ifndef POWERDEVILUPOWERBACKEND_H ++#define POWERDEVILUPOWERBACKEND_H ++ ++#include ++ ++#include ++#include ++ ++#include ++ ++#include "upower_device_interface.h" ++#include "upower_interface.h" ++#include "upower_kbdbacklight_interface.h" ++ ++#define UPOWER_SERVICE "org.freedesktop.UPower" ++ ++class XRandrBrightness; ++ ++class KDE_EXPORT PowerDevilUPowerBackend : public PowerDevil::BackendInterface ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(PowerDevilUPowerBackend) ++public: ++ explicit PowerDevilUPowerBackend(QObject* parent); ++ virtual ~PowerDevilUPowerBackend(); ++ ++ virtual void init(); ++ static bool isAvailable(); ++ ++ virtual float brightness(BrightnessControlType type = Screen) const; ++ ++ virtual void brightnessKeyPressed(PowerDevil::BackendInterface::BrightnessKeyType type); ++ virtual bool setBrightness(float brightness, PowerDevil::BackendInterface::BrightnessControlType type = Screen); ++ virtual KJob* suspend(PowerDevil::BackendInterface::SuspendMethod method); ++ ++private: ++ void enumerateDevices(); ++ ++private slots: ++ void updateDeviceProps(); ++ void slotDeviceAdded(const QString &); ++ void slotDeviceRemoved(const QString &); ++ void slotDeviceChanged(const QString &); ++ void slotPropertyChanged(); ++ ++private: ++ // upower devices ++ QMap m_devices; ++ ++ // brightness ++ float m_cachedBrightness; ++ XRandrBrightness *m_brightNessControl; ++ OrgFreedesktopUPowerInterface *m_upowerInterface; ++ OrgFreedesktopUPowerKbdBacklightInterface *m_kbdBacklight; ++ ++ // buttons ++ bool m_lidIsPresent; ++ bool m_lidIsClosed; ++ bool m_onBattery; ++}; ++ ++#endif // POWERDEVILUPOWERBACKEND_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/upowersuspendjob.cpp.svn-base ../powerdevil/daemon/backends/upower/.svn/text-base/upowersuspendjob.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/upowersuspendjob.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/text-base/upowersuspendjob.cpp.svn-base 2010-12-12 14:48:46.883333335 -0800 +@@ -0,0 +1,89 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ Copyright (C) 2010 Alejandro Fiestas ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++#include "upowersuspendjob.h" ++ ++#include "upower_interface.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++UPowerSuspendJob::UPowerSuspendJob(OrgFreedesktopUPowerInterface *upowerInterface, ++ PowerDevil::BackendInterface::SuspendMethod method, ++ PowerDevil::BackendInterface::SuspendMethods supported) ++ : KJob(), m_upowerInterface(upowerInterface) ++{ ++ kDebug() << "Stancing Suspend job"; ++ m_method = method; ++ m_supported = supported; ++ ++ connect(m_upowerInterface, SIGNAL(Resuming()), this, SLOT(resumeDone())); ++} ++ ++UPowerSuspendJob::~UPowerSuspendJob() ++{ ++ ++} ++ ++void UPowerSuspendJob::start() ++{ ++ QTimer::singleShot(0, this, SLOT(doStart())); ++} ++ ++void UPowerSuspendJob::kill(bool /*quietly */) ++{ ++ ++} ++ ++void UPowerSuspendJob::doStart() ++{ ++ if (m_supported & m_method) ++ { ++ switch(m_method) ++ { ++ case PowerDevil::BackendInterface::ToRam: ++ m_upowerInterface->AboutToSleep(); ++ m_upowerInterface->Suspend(); ++ break; ++ case PowerDevil::BackendInterface::ToDisk: ++ m_upowerInterface->AboutToSleep(); ++ m_upowerInterface->Hibernate(); ++ break; ++ default: ++ kDebug() << "This backend doesn't support hybrid mode"; ++ setError(1); ++ setErrorText(i18n("Unsupported suspend method")); ++ break; ++ } ++ emitResult(); ++ } ++} ++ ++ ++void UPowerSuspendJob::resumeDone() ++{ ++ emitResult(); ++} ++ ++#include "upowersuspendjob.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/upowersuspendjob.h.svn-base ../powerdevil/daemon/backends/upower/.svn/text-base/upowersuspendjob.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/upowersuspendjob.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/text-base/upowersuspendjob.h.svn-base 2010-12-12 14:48:46.883333335 -0800 +@@ -0,0 +1,54 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2006 Kevin Ottens ++ Copyright (C) 2010 Alejandro Fiestas ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public ++ License version 2 as published by the Free Software Foundation. ++ ++ This library 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 ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public License ++ along with this library; see the file COPYING.LIB. If not, write to ++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ Boston, MA 02110-1301, USA. ++ ++*/ ++ ++#ifndef UPOWERSUSPENDJOB_H ++#define UPOWERSUSPENDJOB_H ++ ++#include ++#include ++#include ++ ++#include "powerdevilupowerbackend.h" ++ ++class OrgFreedesktopUPowerInterface; ++ ++class UPowerSuspendJob : public KJob ++{ ++ Q_OBJECT ++public: ++ UPowerSuspendJob(OrgFreedesktopUPowerInterface *upowerInterface, ++ PowerDevil::BackendInterface::SuspendMethod method, ++ PowerDevil::BackendInterface::SuspendMethods supported); ++ virtual ~UPowerSuspendJob(); ++ ++ void start(); ++ void kill(bool quietly); ++ ++private Q_SLOTS: ++ void doStart(); ++ void resumeDone(); ++ ++private: ++ OrgFreedesktopUPowerInterface *m_upowerInterface; ++ PowerDevil::BackendInterface::SuspendMethod m_method; ++ PowerDevil::BackendInterface::SuspendMethods m_supported; ++}; ++ ++#endif //UPOWERSUSPENDJOB_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/xrandrbrightness.cpp.svn-base ../powerdevil/daemon/backends/upower/.svn/text-base/xrandrbrightness.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/xrandrbrightness.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/text-base/xrandrbrightness.cpp.svn-base 2010-12-12 14:48:46.883333335 -0800 +@@ -0,0 +1,171 @@ ++/* This file is part of the KDE project ++ * Copyright (C) 2010 Lukas Tinkl ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License version 2 as published by the Free Software Foundation. ++ * ++ * This library 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 ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public License ++ * along with this library; see the file COPYING.LIB. If not, write to ++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ * Boston, MA 02110-1301, USA. ++ * ++ */ ++ ++#include "xrandrbrightness.h" ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++XRandrBrightness::XRandrBrightness() ++ : m_backlight(None), m_resources(0) ++{ ++ // init ++ int major, minor; ++ if (!XRRQueryVersion (QX11Info::display(), &major, &minor)) ++ { ++ qWarning("RandR extension missing"); ++ return; ++ } ++ ++ if (major < 1 || (major == 1 && minor < 2)) ++ { ++ qWarning("RandR version %d.%d too old", major, minor); ++ return; ++ } ++ ++ m_backlight = XInternAtom(QX11Info::display(), "Backlight", True); ++ if (m_backlight == None) ++ m_backlight = XInternAtom(QX11Info::display(), "BACKLIGHT", True); // try with legacy atom ++ ++ if (m_backlight == None) ++ { ++ qWarning("No outputs have backlight property"); ++ return; ++ } ++ ++ if (minor > 2) ++ m_resources = XRRGetScreenResourcesCurrent(QX11Info::display(), QX11Info::appRootWindow()); // version 1.3, faster version ++ else ++ m_resources = XRRGetScreenResources(QX11Info::display(), QX11Info::appRootWindow()); ++ ++ if (!m_resources) ++ { ++ qWarning("No available Randr resources"); ++ return; ++ } ++} ++ ++XRandrBrightness::~XRandrBrightness() ++{ ++ if (m_resources) { ++ XRRFreeScreenResources(m_resources); ++ } ++} ++ ++bool XRandrBrightness::isSupported() const ++{ ++ return (m_resources != 0); ++} ++ ++float XRandrBrightness::brightness() const ++{ ++ float result = 0; ++ ++ if (!m_resources) ++ return result; ++ ++ for (int o = 0; o < m_resources->noutput; o++) ++ { ++ RROutput output = m_resources->outputs[o]; ++ double cur = backlight_get(output); ++ if (cur != -1) ++ { ++ XRRPropertyInfo * info = XRRQueryOutputProperty(QX11Info::display(), output, m_backlight); ++ if (info) ++ { ++ if (info->range && info->num_values == 2) ++ { ++ double min = info->values[0]; ++ double max = info->values[1]; ++ ++ // FIXME for now just return the first output's value ++ result = (cur - min) * 100 / (max - min); ++ break; ++ } ++ XFree(info); ++ } ++ } ++ } ++ ++ return result; ++} ++ ++void XRandrBrightness::setBrightness(float brightness) ++{ ++ if (!m_resources) ++ return; ++ ++ for (int o = 0; o < m_resources->noutput; o++) ++ { ++ RROutput output = m_resources->outputs[o]; ++ double cur = backlight_get(output); ++ if (cur != -1) ++ { ++ XRRPropertyInfo * info = XRRQueryOutputProperty(QX11Info::display(), output, m_backlight); ++ if (info) ++ { ++ if (info->range && info->num_values == 2) ++ { ++ double min = info->values[0]; ++ double max = info->values[1]; ++ ++ // FIXME for now just set the first output's value ++ double value = min + (brightness * (max - min) / 100); ++ backlight_set(output, (long) value); ++ } ++ XFree(info); ++ } ++ } ++ } ++ ++ XSync(QX11Info::display(), False); ++} ++ ++long XRandrBrightness::backlight_get(RROutput output) const ++{ ++ unsigned long nitems; ++ unsigned long bytes_after; ++ unsigned char *prop; ++ Atom actual_type; ++ int actual_format; ++ long value; ++ ++ if (!m_backlight || XRRGetOutputProperty (QX11Info::display(), output, m_backlight, ++ 0, 4, False, False, None, ++ &actual_type, &actual_format, ++ &nitems, &bytes_after, &prop) != Success) ++ return -1; ++ ++ if (actual_type != XA_INTEGER || nitems != 1 || actual_format != 32) ++ value = -1; ++ else ++ value = *((long *) prop); ++ XFree (prop); ++ return value; ++} ++ ++void XRandrBrightness::backlight_set(RROutput output, long value) ++{ ++ XRRChangeOutputProperty (QX11Info::display(), output, m_backlight, XA_INTEGER, 32, ++ PropModeReplace, (unsigned char *) &value, 1); ++} +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/xrandrbrightness.h.svn-base ../powerdevil/daemon/backends/upower/.svn/text-base/xrandrbrightness.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/.svn/text-base/xrandrbrightness.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/.svn/text-base/xrandrbrightness.h.svn-base 2010-12-12 14:48:46.890000001 -0800 +@@ -0,0 +1,46 @@ ++/* This file is part of the KDE project ++ * Copyright (C) 2010 Lukas Tinkl ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License version 2 as published by the Free Software Foundation. ++ * ++ * This library 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 ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public License ++ * along with this library; see the file COPYING.LIB. If not, write to ++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ++ * Boston, MA 02110-1301, USA. ++ * ++ */ ++ ++#ifndef XRANDRBRIGHTNESS_H ++#define XRANDRBRIGHTNESS_H ++ ++#include ++ ++#include ++#include ++#include ++ ++class XRandrBrightness ++{ ++public: ++ XRandrBrightness(); ++ ~XRandrBrightness(); ++ bool isSupported() const; ++ float brightness() const; ++ void setBrightness(float brightness); ++ ++private: ++ long backlight_get(RROutput output) const; ++ void backlight_set(RROutput output, long value); ++ ++ Atom m_backlight; ++ XRRScreenResources *m_resources; ++}; ++ ++#endif // XRANDRBRIGHTNESS_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/xrandrbrightness.cpp ../powerdevil/daemon/backends/upower/xrandrbrightness.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/backends/upower/xrandrbrightness.cpp 2010-11-11 06:40:47.000000000 -0800 ++++ ../powerdevil/daemon/backends/upower/xrandrbrightness.cpp 2010-12-12 14:48:46.890000001 -0800 +@@ -67,7 +67,9 @@ + + XRandrBrightness::~XRandrBrightness() + { +- XRRFreeScreenResources(m_resources); ++ if (m_resources) { ++ XRRFreeScreenResources(m_resources); ++ } + } + + bool XRandrBrightness::isSupported() const +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/CMakeLists.txt ../powerdevil/daemon/CMakeLists.txt +--- kdebase-workspace-4.5.85/powerdevil//daemon/CMakeLists.txt 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/daemon/CMakeLists.txt 2010-12-12 14:48:46.923333334 -0800 +@@ -18,54 +18,56 @@ + actions/bundled/handlebuttonevents.cpp + ) + +-# Backends +-include(BackendConfig.cmake) +- + # target no.1 - powerdevil core library + set(powerdevilcore_SRCS + powerdevilaction.cpp + powerdevilactionpool.cpp + powerdevilbackendinterface.cpp +- powerdevilbackendloader.cpp + powerdevilcore.cpp +- powerdevilfdoconnector.cpp + powerdevilpolicyagent.cpp + powerdevilprofilegenerator.cpp + ) + + kde4_add_kcfg_files(powerdevilcore_SRCS ../PowerDevilSettings.kcfgc) + +-qt4_add_dbus_adaptor(powerdevilcore_SRCS org.kde.Solid.PowerManagement.xml powerdevilcore.h PowerDevil::Core) +-qt4_add_dbus_adaptor(powerdevilcore_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.kde.Solid.PowerManagement.PolicyAgent.xml +- powerdevilpolicyagent.h PowerDevil::PolicyAgent +- powermanagementpolicyagentadaptor PowerManagementPolicyAgentAdaptor) +- + set(screensaver_xml "${KDEBASE_WORKSPACE_SOURCE_DIR}/krunner/dbus/org.freedesktop.ScreenSaver.xml") + qt4_add_dbus_interface(powerdevilcore_SRCS ${screensaver_xml} screensaver_interface ) + +-qt4_add_dbus_adaptor(powerdevilcore_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.freedesktop.PowerManagement.xml powerdevilfdoconnector.h PowerDevil::FdoConnector powermanagementfdoadaptor PowerManagementFdoAdaptor) +-qt4_add_dbus_adaptor(powerdevilcore_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.freedesktop.PowerManagement.Inhibit.xml powerdevilfdoconnector.h PowerDevil::FdoConnector powermanagementinhibitadaptor PowerManagementInhibitAdaptor) +- +-kde4_add_library(powerdevilcore SHARED ${powerdevilcore_SRCS} ${powerdevil_bundled_actions_SRCS} ${POWERDEVIL_BACKEND_SRCS}) ++kde4_add_library(powerdevilcore SHARED ${powerdevilcore_SRCS} ${powerdevil_bundled_actions_SRCS}) + set_target_properties(powerdevilcore PROPERTIES VERSION ${POWERDEVIL_CORE_VERSION_STRING} SOVERSION ${POWERDEVIL_CORE_VERSION_MAJOR}) + + target_link_libraries(powerdevilcore + ${KDE4_KDECORE_LIBS} + ${KDE4_SOLID_LIBS} + ${KDE4_KIDLETIME_LIBS} +- ${POWERDEVIL_BACKEND_LIBS} + kworkspace + ) + + # target no.2 - powerdevil kded module + set(kded_powerdevil_SRCS + kdedpowerdevil.cpp ++ powerdevilbackendloader.cpp ++ powerdevilfdoconnector.cpp + ) + +-kde4_add_plugin(kded_powerdevil ${kded_powerdevil_SRCS}) ++# DBus Adaptors ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS org.kde.Solid.PowerManagement.xml powerdevilcore.h PowerDevil::Core) ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.kde.Solid.PowerManagement.PolicyAgent.xml ++ powerdevilpolicyagent.h PowerDevil::PolicyAgent ++ powermanagementpolicyagentadaptor PowerManagementPolicyAgentAdaptor) ++ ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.freedesktop.PowerManagement.xml powerdevilfdoconnector.h PowerDevil::FdoConnector powermanagementfdoadaptor PowerManagementFdoAdaptor) ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.freedesktop.PowerManagement.Inhibit.xml powerdevilfdoconnector.h PowerDevil::FdoConnector powermanagementinhibitadaptor PowerManagementInhibitAdaptor) ++ ++ ++# Backends ++include(BackendConfig.cmake) ++ ++kde4_add_plugin(kded_powerdevil ${kded_powerdevil_SRCS} ${POWERDEVIL_BACKEND_SRCS}) + + target_link_libraries(kded_powerdevil + ${KDE4_KDECORE_LIBS} ++ ${POWERDEVIL_BACKEND_LIBS} + powerdevilcore + ) + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/kdedpowerdevil.cpp ../powerdevil/daemon/kdedpowerdevil.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/kdedpowerdevil.cpp 2010-11-05 03:47:16.000000000 -0700 ++++ ../powerdevil/daemon/kdedpowerdevil.cpp 2010-12-12 14:48:46.920000000 -0800 +@@ -19,11 +19,20 @@ + + #include "kdedpowerdevil.h" + ++#include "powerdevilfdoconnector.h" ++#include "powermanagementadaptor.h" ++#include "powermanagementpolicyagentadaptor.h" ++ ++#include "powerdevilbackendloader.h" + #include "powerdevilcore.h" + + #include + ++#include ++#include ++ + #include ++#include + #include + + K_PLUGIN_FACTORY( PowerDevilFactory, +@@ -56,7 +65,48 @@ + aboutData.addAuthor(ki18n( "Dario Freddi" ), ki18n("Maintainer"), "drf@kde.org", + "http://drfav.wordpress.com"); + +- new PowerDevil::Core(this, KComponentData(aboutData)); ++ if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.PowerManagement") || ++ QDBusConnection::systemBus().interface()->isServiceRegistered("com.novell.powersave") || ++ QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.Policy.Power")) { ++ kError() << "KDE Power Management system not initialized, another power manager has been detected"; ++ return; ++ } ++ ++ m_core = new PowerDevil::Core(this, KComponentData(aboutData)); ++ ++ connect(m_core, SIGNAL(coreReady()), this, SLOT(onCoreReady())); ++ ++ // Before doing anything, let's set up our backend ++ PowerDevil::BackendInterface *interface = PowerDevil::BackendLoader::loadBackend(m_core); ++ ++ if (!interface) { ++ // Ouch ++ kError() << "KDE Power Management System init failed!"; ++ m_core->loadCore(0); ++ } else { ++ // Let's go! ++ kDebug() << "Backend loaded, loading core"; ++ m_core->loadCore(interface); ++ } ++} ++ ++void KDEDPowerDevil::onCoreReady() ++{ ++ kDebug() << "Core is ready, registering various services on the bus..."; ++ //DBus logic for the core ++ new PowerManagementAdaptor(m_core); ++ new PowerDevil::FdoConnector(m_core); ++ ++ QDBusConnection::sessionBus().registerService("org.kde.Solid.PowerManagement"); ++ QDBusConnection::sessionBus().registerObject("/org/kde/Solid/PowerManagement", m_core); ++ ++ QDBusConnection::systemBus().interface()->registerService("org.freedesktop.Policy.Power"); ++ ++ // Start the Policy Agent service ++ new PowerManagementPolicyAgentAdaptor(PowerDevil::PolicyAgent::instance()); ++ ++ QDBusConnection::sessionBus().registerService("org.kde.Solid.PowerManagement.PolicyAgent"); ++ QDBusConnection::sessionBus().registerObject("/org/kde/Solid/PowerManagement/PolicyAgent", PowerDevil::PolicyAgent::instance()); + } + + #include "kdedpowerdevil.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/kdedpowerdevil.h ../powerdevil/daemon/kdedpowerdevil.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/kdedpowerdevil.h 2010-10-05 04:38:56.000000000 -0700 ++++ ../powerdevil/daemon/kdedpowerdevil.h 2010-12-12 14:48:46.923333334 -0800 +@@ -23,6 +23,10 @@ + #include + #include + ++namespace PowerDevil { ++ class Core; ++} ++ + class KDEDPowerDevil : public KDEDModule + { + Q_OBJECT +@@ -34,6 +38,10 @@ + + private Q_SLOTS: + void init(); ++ void onCoreReady(); ++ ++private: ++ PowerDevil::Core *m_core; + }; + + #endif // KDEDPOWERDEVIL_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/org.kde.Solid.PowerManagement.xml ../powerdevil/daemon/org.kde.Solid.PowerManagement.xml +--- kdebase-workspace-4.5.85/powerdevil//daemon/org.kde.Solid.PowerManagement.xml 2010-11-19 02:51:12.000000000 -0800 ++++ ../powerdevil/daemon/org.kde.Solid.PowerManagement.xml 2010-12-12 14:48:46.920000000 -0800 +@@ -11,6 +11,10 @@ + + + ++ ++ ++ ++ + + + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendinterface.cpp ../powerdevil/daemon/powerdevilbackendinterface.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendinterface.cpp 2010-11-11 06:40:47.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilbackendinterface.cpp 2010-12-12 14:48:46.920000000 -0800 +@@ -50,6 +50,7 @@ + + BackendInterface::~BackendInterface() + { ++ delete d; + } + + BackendInterface::AcAdapterState BackendInterface::acAdapterState() const +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendinterface.h ../powerdevil/daemon/powerdevilbackendinterface.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendinterface.h 2010-11-25 09:40:32.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilbackendinterface.h 2010-12-12 14:48:46.923333334 -0800 +@@ -112,8 +112,6 @@ + + virtual void init() = 0; + +- virtual bool isAvailable() = 0; +- + /** + * Retrieves the current state of the system battery. + * +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendloader.cpp ../powerdevil/daemon/powerdevilbackendloader.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendloader.cpp 2010-11-25 09:40:32.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilbackendloader.cpp 2010-12-12 14:48:46.923333334 -0800 +@@ -23,27 +23,31 @@ + #include "backends/upower/powerdevilupowerbackend.h" + #include "backends/hal/powerdevilhalbackend.h" + ++#include ++ + namespace PowerDevil { + namespace BackendLoader { + + BackendInterface* loadBackend(QObject *parent) + { +- BackendInterface *interface; + // Check UPower first +- interface = new PowerDevilUPowerBackend(parent); +- if (interface->isAvailable()) { +- return interface; ++ kDebug() << "Loading UPower backend..."; ++ if (PowerDevilUPowerBackend::isAvailable()) { ++ kDebug() << "Success!"; ++ return new PowerDevilUPowerBackend(parent); + } + ++ kDebug() << "Failed!"; ++ + // If we are here, try HAL +- interface->deleteLater(); +- interface = new PowerDevilHALBackend(parent); +- if (interface->isAvailable()) { +- return interface; ++ kDebug() << "Loading HAL backend..."; ++ if (PowerDevilHALBackend::isAvailable()) { ++ kDebug() << "Success!"; ++ return new PowerDevilHALBackend(parent); + } + + // Fail... +- interface->deleteLater(); ++ kDebug() << "Failed!"; + return 0; + } + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendloader.h ../powerdevil/daemon/powerdevilbackendloader.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilbackendloader.h 2010-11-25 09:40:32.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilbackendloader.h 2010-12-12 14:48:46.923333334 -0800 +@@ -29,7 +29,7 @@ + namespace BackendLoader + { + BackendInterface *loadBackend(QObject *parent); +-}; ++} + + } + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilcore.cpp ../powerdevil/daemon/powerdevilcore.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilcore.cpp 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilcore.cpp 2010-12-12 14:48:46.923333334 -0800 +@@ -20,14 +20,11 @@ + #include "powerdevilcore.h" + + #include "PowerDevilSettings.h" +-#include "powermanagementadaptor.h" + #include "screensaver_interface.h" + + #include "powerdevilaction.h" + #include "powerdevilactionpool.h" + #include "powerdevilbackendinterface.h" +-#include "powerdevilbackendloader.h" +-#include "powerdevilfdoconnector.h" + #include "powerdevilpolicyagent.h" + #include "powerdevilprofilegenerator.h" + +@@ -58,20 +55,6 @@ + , m_applicationData(componentData) + , m_criticalBatteryTimer(new QTimer(this)) + { +- // Before doing anything, let's set up our backend +- m_backend = PowerDevil::BackendLoader::loadBackend(this); +- +- if (!m_backend) { +- // Ouch +- kError() << "KDE Power Management System init failed!"; +- onBackendError(i18n("No valid Power Management backend plugins are available. " +- "A new installation might solve this problem.")); +- } else { +- // Async backend init - so that KDED gets a bit of a speed up +- connect(m_backend, SIGNAL(backendReady()), this, SLOT(onBackendReady())); +- connect(m_backend, SIGNAL(backendError(QString)), this, SLOT(onBackendError(QString))); +- m_backend->init(); +- } + } + + Core::~Core() +@@ -80,23 +63,41 @@ + ActionPool::instance()->unloadAllActiveActions(); + } + +-void Core::onBackendReady() ++void Core::loadCore(BackendInterface* backend) + { +- kDebug() << "Backend is ready, KDE Power Management system initialized"; +- +- if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.PowerManagement") || +- QDBusConnection::systemBus().interface()->isServiceRegistered("com.novell.powersave") || +- QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.Policy.Power")) { +- kError() << "KDE Power Management system not initialized, another power manager has been detected"; ++ if (!backend) { ++ onBackendError(i18n("No valid Power Management backend plugins are available. " ++ "A new installation might solve this problem.")); + return; + } + ++ m_backend = backend; ++ ++ // Async backend init - so that KDED gets a bit of a speed up ++ kDebug() << "Core loaded, initializing backend"; ++ connect(m_backend, SIGNAL(backendReady()), this, SLOT(onBackendReady())); ++ connect(m_backend, SIGNAL(backendError(QString)), this, SLOT(onBackendError(QString))); ++ m_backend->init(); ++ ++ // Register DBus Metatypes ++ qDBusRegisterMetaType< StringStringMap >(); ++} ++ ++void Core::onBackendReady() ++{ ++ kDebug() << "Backend is ready, KDE Power Management system initialized"; ++ + m_profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig); + + // Is it brand new? + if (m_profilesConfig->groupList().isEmpty()) { + // Generate defaults +- ProfileGenerator::generateProfiles(); ++ if (ProfileGenerator::generateProfiles(true) == ProfileGenerator::ResultUpgraded) { ++ // Notify the user ++ emitNotification("warningnot", i18n("Your Power Profiles have been updated to be used with the new KDE Power " ++ "Management System. You can tweak them or generate a new set of defaults from " ++ "System Settings."), "system-software-update"); ++ } + m_profilesConfig->reparseConfiguration(); + } + +@@ -130,15 +131,6 @@ + // Set up the policy agent + PowerDevil::PolicyAgent::instance()->init(); + +- //DBus +- new PowerManagementAdaptor(this); +- new FdoConnector(this); +- +- QDBusConnection::sessionBus().registerService("org.kde.Solid.PowerManagement"); +- QDBusConnection::sessionBus().registerObject("/org/kde/Solid/PowerManagement", this); +- +- QDBusConnection::systemBus().interface()->registerService("org.freedesktop.Policy.Power"); +- + // Set up the critical battery timer + m_criticalBatteryTimer->setSingleShot(true); + m_criticalBatteryTimer->setInterval(30000); +@@ -148,6 +140,7 @@ + QTimer::singleShot(30000, this, SLOT(checkBatteryStatus())); + + // All systems up Houston, let's go! ++ emit coreReady(); + refreshStatus(); + + KActionCollection* actionCollection = new KActionCollection( this ); +@@ -250,6 +243,29 @@ + emit configurationReloaded(); + } + ++StringStringMap Core::availableProfiles() const ++{ ++ QMap< QString, QString > retmap; ++ foreach (const QString &ent, m_profilesConfig->groupList()) { ++ if (ent == "Performance") { ++ retmap.insert(ent, i18nc("Name of a power profile", "Performance")); ++ } else if (ent == "Powersave") { ++ retmap.insert(ent, i18nc("Name of a power profile", "Powersave")); ++ } else if (ent == "Aggressive powersave") { ++ retmap.insert(ent, i18nc("Name of a power profile", "Aggressive powersave")); ++ } else { ++ KConfigGroup group(m_profilesConfig, ent); ++ if (group.hasKey("name")) { ++ retmap.insert(ent, group.readEntry("name")); ++ } else { ++ retmap.insert(ent, ent); ++ } ++ } ++ } ++ ++ return retmap; ++} ++ + void Core::reloadProfile(int state) + { + if (m_loadedBatteriesUdi.isEmpty()) { +@@ -278,7 +294,7 @@ + } + } + +-void Core::loadProfile(const QString& name) ++void Core::loadProfile(const QString& id) + { + // Policy check + if (PolicyAgent::instance()->requirePolicyCheck(PolicyAgent::ChangeProfile) != PolicyAgent::None) { +@@ -290,12 +306,12 @@ + ActionPool::instance()->unloadAllActiveActions(); + + // Now, let's retrieve our profile +- KConfigGroup config(m_profilesConfig, name); ++ KConfigGroup config(m_profilesConfig, id); + + if (!config.isValid() || config.groupList().isEmpty()) { + emitNotification("powerdevilerror", i18n("The profile \"%1\" has been selected, " + "but it does not exist.\nPlease check your PowerDevil configuration.", +- name), "dialog-error"); ++ id), "dialog-error"); + return; + } + +@@ -309,13 +325,13 @@ + emitNotification("powerdevilerror", i18n("The profile \"%1\" tried to activate %2, " + "a non existent action. This is usually due to an installation problem" + " or to a configuration problem.", +- name, actionName), "dialog-warning"); +- } ++ id, actionName), "dialog-warning"); ++ } + } + + // Set the current profile. Notify if different. +- if (m_currentProfile != name) { +- m_currentProfile = name; ++ if (m_currentProfile != id) { ++ m_currentProfile = id; + emit profileChanged(m_currentProfile); + } + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilcore.h ../powerdevil/daemon/powerdevilcore.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilcore.h 2010-11-19 02:51:12.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilcore.h 2010-12-12 14:48:46.920000000 -0800 +@@ -28,6 +28,8 @@ + + #include + ++typedef QMap< QString, QString > StringStringMap; ++ + class KDirWatch; + class QTimer; + class KNotification; +@@ -57,16 +59,19 @@ + const QString &iconname = "dialog-ok-apply"); + + BackendInterface *backend(); +- ++ + // More... + + public Q_SLOTS: ++ void loadCore(PowerDevil::BackendInterface *backend); + // Set of common action - useful for the DBus interface + void refreshStatus(); + void reloadProfile(); + void reloadCurrentProfile(); + void reparseConfiguration(); + ++ StringStringMap availableProfiles() const; ++ + void loadProfile(const QString &name); + QString currentProfile() const; + +@@ -85,6 +90,7 @@ + void onResumeFromSuspend(); + + Q_SIGNALS: ++ void coreReady(); + void profileChanged(const QString &newProfile); + void configurationReloaded(); + void brightnessChanged(int percent); +@@ -134,4 +140,6 @@ + + } + ++Q_DECLARE_METATYPE(StringStringMap) ++ + #endif // POWERDEVILCORE_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilfdoconnector.cpp ../powerdevil/daemon/powerdevilfdoconnector.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilfdoconnector.cpp 2010-11-11 06:40:47.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilfdoconnector.cpp 2010-12-12 14:48:46.923333334 -0800 +@@ -101,7 +101,7 @@ + + void FdoConnector::onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState newstate) + { +- emit PowerSaveStatusChanged(newstate == PowerDevil::BackendInterface::Plugged); ++ emit PowerSaveStatusChanged(newstate == PowerDevil::BackendInterface::Unplugged); + } + + void FdoConnector::onUnavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies newpolicies) +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilpolicyagent.cpp ../powerdevil/daemon/powerdevilpolicyagent.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilpolicyagent.cpp 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilpolicyagent.cpp 2010-12-12 14:48:46.923333334 -0800 +@@ -29,8 +29,6 @@ + #include + #include + +-#include "powermanagementpolicyagentadaptor.h" +- + namespace PowerDevil + { + +@@ -72,12 +70,6 @@ + + void PolicyAgent::init() + { +- // Start the DBus service +- new PowerManagementPolicyAgentAdaptor(this); +- +- QDBusConnection::sessionBus().registerService("org.kde.Solid.PowerManagement.PolicyAgent"); +- QDBusConnection::sessionBus().registerObject("/org/kde/Solid/PowerManagement/PolicyAgent", this); +- + // Let's cache the needed information to check if our session is actually active + if (!QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.ConsoleKit")) { + // No way to determine if we are on the current session, simply suppose we are +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilpolicyagent.h ../powerdevil/daemon/powerdevilpolicyagent.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilpolicyagent.h 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilpolicyagent.h 2010-12-12 14:48:46.923333334 -0800 +@@ -27,13 +27,15 @@ + + #include + ++#include ++ + class QDBusServiceWatcher; + class QDBusInterface; + + namespace PowerDevil + { + +-class PolicyAgent : public QObject, protected QDBusContext ++class KDE_EXPORT PolicyAgent : public QObject, protected QDBusContext + { + Q_OBJECT + Q_DISABLE_COPY(PolicyAgent) +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilprofilegenerator.cpp ../powerdevil/daemon/powerdevilprofilegenerator.cpp +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilprofilegenerator.cpp 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilprofilegenerator.cpp 2010-12-12 14:48:46.920000000 -0800 +@@ -36,8 +36,16 @@ + + namespace PowerDevil { + +-void ProfileGenerator::generateProfiles() ++ProfileGenerator::GeneratorResult ProfileGenerator::generateProfiles(bool tryUpgrade) + { ++ if (tryUpgrade) { ++ KSharedConfigPtr oldProfilesConfig = KSharedConfig::openConfig("powerdevilprofilesrc", KConfig::SimpleConfig); ++ if (!oldProfilesConfig->groupList().isEmpty()) { ++ // We can upgrade, let's do that. ++ upgradeProfiles(); ++ return ResultUpgraded; ++ } ++ } + QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); + + // Let's change some defaults +@@ -58,7 +66,7 @@ + } + + // Let's start: performance profile before anything else +- KConfigGroup performance(profilesConfig, i18nc("Name of a power profile", "Performance")); ++ KConfigGroup performance(profilesConfig, "Performance"); + performance.writeEntry("icon", "preferences-system-performance"); + + // We want to dim the screen after a while, definitely +@@ -108,7 +116,7 @@ + } + + // Powersave +- KConfigGroup powersave(profilesConfig, i18nc("Name of a power profile", "Powersave")); ++ KConfigGroup powersave(profilesConfig, "Powersave"); + powersave.writeEntry("icon", "preferences-system-power-management"); + // Less brightness. + { +@@ -150,7 +158,7 @@ + + + // Ok, now for aggressive powersave +- KConfigGroup aggrPowersave(profilesConfig, i18nc("Name of a power profile", "Aggressive powersave")); ++ KConfigGroup aggrPowersave(profilesConfig, "Aggressive powersave"); + aggrPowersave.writeEntry("icon", "battery-low"); + // Less brightness. + { +@@ -199,6 +207,8 @@ + // Save and be happy + PowerDevilSettings::self()->writeConfig(); + profilesConfig->sync(); ++ ++ return ResultGenerated; + } + + void ProfileGenerator::upgradeProfiles() +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilprofilegenerator.h ../powerdevil/daemon/powerdevilprofilegenerator.h +--- kdebase-workspace-4.5.85/powerdevil//daemon/powerdevilprofilegenerator.h 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/daemon/powerdevilprofilegenerator.h 2010-12-12 14:48:46.923333334 -0800 +@@ -25,7 +25,13 @@ + + namespace ProfileGenerator + { +- void generateProfiles(); ++ enum GeneratorResult { ++ ResultFailed = 0, ++ ResultGenerated = 1, ++ ResultUpgraded = 2 ++ }; ++ ++ GeneratorResult generateProfiles(bool tryUpgrade = false); + void upgradeProfiles(); + } + +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/entries ../powerdevil/daemon/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/entries 2010-12-12 14:48:46.923333334 -0800 +@@ -0,0 +1,884 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/daemon ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-12T18:22:09.038834Z ++1205832 ++woebbe ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++powerdevilcore.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++b3b8cc11a61008b1b45d5e18512c42aa ++2010-12-09T07:22:27.874116Z ++1204817 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4506 ++ ++Messages.sh ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++3b2bbc89860032189974b3577e1518e7 ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++has-props ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++177 ++ ++powerdevilactionconfig.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++39ac57c412d476c2b16470aac1c29163 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1922 ++ ++powerdevil.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++90e7d7a58c556995048bb9b2cd95d02c ++2010-11-18T09:23:34.868491Z ++1198396 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++7505 ++ ++powerdevilactionpool.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++37a9ee6e45163048b7518bc8481ac2b5 ++2010-10-21T11:22:34.856865Z ++1188084 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++5164 ++ ++org.kde.Solid.PowerManagement.xml ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++c7df17ee876c9f4389c808f881606b92 ++2010-12-09T07:22:18.493675Z ++1204813 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1811 ++ ++kdedpowerdevil.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++16907301944b07a8ac8c58362d261db1 ++2010-12-09T07:22:27.874116Z ++1204817 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4757 ++ ++powerdevilprofilegenerator.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++fdcde945d1e389c76ac9314bcbc79720 ++2010-12-09T07:22:18.493675Z ++1204813 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++13688 ++ ++powerdevilbackendinterface.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++511d9710505100c8179aa065e2402cb3 ++2010-12-08T12:43:04.955161Z ++1204623 ++mlaurent ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4923 ++ ++powerdevilactionconfig.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++886de8c439b0a9489c746ff329296409 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2139 ++ ++BackendConfig.cmake ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.920000Z ++f6825cbf7b0c01b1d4901769e577175d ++2010-11-20T18:23:16.232641Z ++1199129 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2012 ++ ++kdedpowerdevil.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++edf6ac266ac98a48fd749eaa2bbb6584 ++2010-12-09T07:22:27.874116Z ++1204817 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1857 ++ ++powerdevilprofilegenerator.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++f3833a582583432a923ea52a7ab15696 ++2010-12-09T07:22:14.928705Z ++1204812 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1794 ++ ++powerdevilactionpool.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++d4dc0018cedff2b19fa12004941a20a1 ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1986 ++ ++powerdevilbackendinterface.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++7a0dd31d34014680e616d1cc72c7105a ++2010-12-07T17:03:49.380344Z ++1204505 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++9647 ++ ++powerdevilaction.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++32bb22be58d1fd5267539fa425b4f9f0 ++2010-11-11T17:16:16.536720Z ++1195638 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3355 ++ ++actions ++dir ++ ++powerdevilbackendloader.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++9c49f4e7d464ad6c5fe676c8fb897b79 ++2010-12-07T17:03:49.380344Z ++1204505 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2158 ++ ++powerdevilpolicyagent.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++dcdab68f3e99646dea4c6d20e3d8704e ++2010-12-09T07:22:27.874116Z ++1204817 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++9911 ++ ++powerdevilaction.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++804ab5c3892c5ce677aa375ed76ab04e ++2010-10-31T12:31:49.407553Z ++1191557 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2691 ++ ++powerdevilbackendloader.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++e4142d0c3babf93542f87708405add3a ++2010-12-12T18:22:09.038834Z ++1205832 ++woebbe ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1655 ++ ++powerdevilfdoconnector.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++ed35b743099edf47c45c4eb2bfbda435 ++2010-12-07T12:08:11.699210Z ++1204464 ++lukas ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++4474 ++ ++powerdevilpolicyagent.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++948dbba60645a136d279a6fc3be8ed98 ++2010-12-09T07:22:27.874116Z ++1204817 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3781 ++ ++backends ++dir ++ ++powerdevilcore.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++e4e6098ae09e1cc6875b4ded5d4422f9 ++2010-12-09T07:22:27.874116Z ++1204817 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++25576 ++ ++powerdevilfdoconnector.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++cb98c176881e20c91be4dcdd912d3f61 ++2010-11-08T23:31:07.624619Z ++1194434 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2724 ++ ++CMakeLists.txt ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.923333Z ++f67bd441371aaed8c61fc499c8e11efc ++2010-12-09T07:22:27.874116Z ++1204817 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3320 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/prop-base/Messages.sh.svn-base ../powerdevil/daemon/.svn/prop-base/Messages.sh.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/prop-base/Messages.sh.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/prop-base/Messages.sh.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,5 @@ ++K 14 ++svn:executable ++V 1 ++* ++END +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/BackendConfig.cmake.svn-base ../powerdevil/daemon/.svn/text-base/BackendConfig.cmake.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/BackendConfig.cmake.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/BackendConfig.cmake.svn-base 2010-12-12 14:48:46.850000001 -0800 +@@ -0,0 +1,51 @@ ++# This files sets the needed sources for powerdevil's backend ++# TODO 4.7: Compile only one backend instead of doing runtime checks ++ ++ ++########################## UPower Backend ##################################### ++include_directories(${CMAKE_CURRENT_SOURCE_DIR}/backends/upower ++ ${CMAKE_CURRENT_BINARY_DIR}/backends/upower ++ ${X11_INCLUDE_DIR} ++ ${X11_Xrandr_INCLUDE_PATH}) ++ ++set(powerdevilupowerbackend_SRCS ++ backends/upower/upowersuspendjob.cpp ++ backends/upower/powerdevilupowerbackend.cpp ++ backends/upower/xrandrbrightness.cpp ++) ++ ++set_source_files_properties( ++ ${CMAKE_CURRENT_SOURCE_DIR}/backends/upower/dbus/org.freedesktop.UPower.xml ++ ${CMAKE_CURRENT_SOURCE_DIR}/backends/upower/dbus/org.freedesktop.UPower.Device.xml ++ PROPERTIES NO_NAMESPACE TRUE) ++ ++qt4_add_dbus_interface(powerdevilupowerbackend_SRCS ++${CMAKE_CURRENT_SOURCE_DIR}/backends/upower/dbus/org.freedesktop.UPower.xml ++upower_interface) ++ ++qt4_add_dbus_interface(powerdevilupowerbackend_SRCS ++${CMAKE_CURRENT_SOURCE_DIR}/backends/upower/dbus/org.freedesktop.UPower.Device.xml ++upower_device_interface) ++ ++qt4_add_dbus_interface(powerdevilupowerbackend_SRCS ++${CMAKE_CURRENT_SOURCE_DIR}/backends/upower/dbus/org.freedesktop.UPower.KbdBacklight.xml ++upower_kbdbacklight_interface) ++ ++set(powerdevilupowerbackend_LIBS ${X11_LIBRARIES} ${QT_QTGUI_LIBRARY} ${X11_Xrandr_LIB}) ++ ++########################## HAL Backend ##################################### ++ ++include_directories(${CMAKE_CURRENT_SOURCE_DIR}/backends/hal ++ ${CMAKE_CURRENT_BINARY_DIR}/backends/hal) ++ ++set(powerdevilhalbackend_SRCS ++ backends/hal/halsuspendjob.cpp ++ backends/hal/powerdevilhalbackend.cpp ++) ++ ++set(powerdevilhalbackend_LIBS ${KDE4_SOLID_LIBS}) ++ ++########################## Daemon variables ################################ ++ ++set(POWERDEVIL_BACKEND_SRCS ${powerdevilupowerbackend_SRCS} ${powerdevilhalbackend_SRCS}) ++set(POWERDEVIL_BACKEND_LIBS ${powerdevilupowerbackend_LIBS} ${powerdevilhalbackend_LIBS}) +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/CMakeLists.txt.svn-base ../powerdevil/daemon/.svn/text-base/CMakeLists.txt.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/CMakeLists.txt.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/CMakeLists.txt.svn-base 2010-12-12 14:48:46.920000000 -0800 +@@ -0,0 +1,90 @@ ++include_directories(${CMAKE_CURRENT_SOURCE_DIR} ++ ${CMAKE_CURRENT_BINARY_DIR}) ++ ++add_subdirectory(actions) ++ ++set(POWERDEVIL_CORE_VERSION_MAJOR 0) ++set(POWERDEVIL_CORE_VERSION_MINOR 1) ++set(POWERDEVIL_CORE_VERSION_MICRO 0) ++set(POWERDEVIL_CORE_VERSION_STRING ${POWERDEVIL_CORE_VERSION_MAJOR}.${POWERDEVIL_CORE_VERSION_MINOR}.${POWERDEVIL_CORE_VERSION_MICRO}) ++ ++# Add bundled actions ++set(powerdevil_bundled_actions_SRCS ++ actions/bundled/suspendsession.cpp ++ actions/bundled/disabledesktopeffects.cpp ++ actions/bundled/brightnesscontrol.cpp ++ actions/bundled/dimdisplay.cpp ++ actions/bundled/runscript.cpp ++ actions/bundled/handlebuttonevents.cpp ++) ++ ++# target no.1 - powerdevil core library ++set(powerdevilcore_SRCS ++ powerdevilaction.cpp ++ powerdevilactionpool.cpp ++ powerdevilbackendinterface.cpp ++ powerdevilcore.cpp ++ powerdevilpolicyagent.cpp ++ powerdevilprofilegenerator.cpp ++) ++ ++kde4_add_kcfg_files(powerdevilcore_SRCS ../PowerDevilSettings.kcfgc) ++ ++set(screensaver_xml "${KDEBASE_WORKSPACE_SOURCE_DIR}/krunner/dbus/org.freedesktop.ScreenSaver.xml") ++qt4_add_dbus_interface(powerdevilcore_SRCS ${screensaver_xml} screensaver_interface ) ++ ++kde4_add_library(powerdevilcore SHARED ${powerdevilcore_SRCS} ${powerdevil_bundled_actions_SRCS}) ++set_target_properties(powerdevilcore PROPERTIES VERSION ${POWERDEVIL_CORE_VERSION_STRING} SOVERSION ${POWERDEVIL_CORE_VERSION_MAJOR}) ++ ++target_link_libraries(powerdevilcore ++ ${KDE4_KDECORE_LIBS} ++ ${KDE4_SOLID_LIBS} ++ ${KDE4_KIDLETIME_LIBS} ++ kworkspace ++) ++ ++# target no.2 - powerdevil kded module ++set(kded_powerdevil_SRCS ++ kdedpowerdevil.cpp ++ powerdevilbackendloader.cpp ++ powerdevilfdoconnector.cpp ++) ++ ++# DBus Adaptors ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS org.kde.Solid.PowerManagement.xml powerdevilcore.h PowerDevil::Core) ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.kde.Solid.PowerManagement.PolicyAgent.xml ++ powerdevilpolicyagent.h PowerDevil::PolicyAgent ++ powermanagementpolicyagentadaptor PowerManagementPolicyAgentAdaptor) ++ ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.freedesktop.PowerManagement.xml powerdevilfdoconnector.h PowerDevil::FdoConnector powermanagementfdoadaptor PowerManagementFdoAdaptor) ++qt4_add_dbus_adaptor(kded_powerdevil_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.freedesktop.PowerManagement.Inhibit.xml powerdevilfdoconnector.h PowerDevil::FdoConnector powermanagementinhibitadaptor PowerManagementInhibitAdaptor) ++ ++ ++# Backends ++include(BackendConfig.cmake) ++ ++kde4_add_plugin(kded_powerdevil ${kded_powerdevil_SRCS} ${POWERDEVIL_BACKEND_SRCS}) ++ ++target_link_libraries(kded_powerdevil ++ ${KDE4_KDECORE_LIBS} ++ ${POWERDEVIL_BACKEND_LIBS} ++ powerdevilcore ++) ++ ++install(TARGETS kded_powerdevil DESTINATION ${PLUGIN_INSTALL_DIR}) ++install(TARGETS powerdevilcore ${INSTALL_TARGETS_DEFAULT_ARGS}) ++ ++# target no.3 - powerdevil ui library ++set(powerdevilui_SRCS ++ powerdevilactionconfig.cpp ++) ++ ++kde4_add_library(powerdevilui SHARED ${powerdevilui_SRCS}) ++ ++target_link_libraries(powerdevilui ++ ${KDE4_KDECORE_LIBS} ++ ${QT_QTGUI_LIBRARY} ++) ++ ++install(TARGETS powerdevilui ${INSTALL_TARGETS_DEFAULT_ARGS}) ++install(FILES powerdevil.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded) +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/kdedpowerdevil.cpp.svn-base ../powerdevil/daemon/.svn/text-base/kdedpowerdevil.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/kdedpowerdevil.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/kdedpowerdevil.cpp.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,112 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "kdedpowerdevil.h" ++ ++#include "powerdevilfdoconnector.h" ++#include "powermanagementadaptor.h" ++#include "powermanagementpolicyagentadaptor.h" ++ ++#include "powerdevilbackendloader.h" ++#include "powerdevilcore.h" ++ ++#include ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY( PowerDevilFactory, ++ registerPlugin(); ) ++K_EXPORT_PLUGIN( PowerDevilFactory( "powerdevildaemon" ) ) ++ ++#define POWERDEVIL_VERSION "1.99" ++ ++KDEDPowerDevil::KDEDPowerDevil(QObject* parent, const QVariantList &) ++ : KDEDModule(parent) ++{ ++ QTimer::singleShot(0, this, SLOT(init())); ++} ++ ++KDEDPowerDevil::~KDEDPowerDevil() ++{ ++} ++ ++void KDEDPowerDevil::init() ++{ ++ KGlobal::locale()->insertCatalog("powerdevil"); ++ ++ KAboutData aboutData("powerdevil", "powerdevil", ki18n("KDE Power Management System"), ++ POWERDEVIL_VERSION, ki18n("KDE Power Management System is PowerDevil, an " ++ "advanced, modular and lightweight Power Management " ++ "daemon"), ++ KAboutData::License_GPL, ki18n("(c) 2010 MetalWorkers Co."), ++ KLocalizedString(), "http://www.kde.org"); ++ ++ aboutData.addAuthor(ki18n( "Dario Freddi" ), ki18n("Maintainer"), "drf@kde.org", ++ "http://drfav.wordpress.com"); ++ ++ if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.PowerManagement") || ++ QDBusConnection::systemBus().interface()->isServiceRegistered("com.novell.powersave") || ++ QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.Policy.Power")) { ++ kError() << "KDE Power Management system not initialized, another power manager has been detected"; ++ return; ++ } ++ ++ m_core = new PowerDevil::Core(this, KComponentData(aboutData)); ++ ++ connect(m_core, SIGNAL(coreReady()), this, SLOT(onCoreReady())); ++ ++ // Before doing anything, let's set up our backend ++ PowerDevil::BackendInterface *interface = PowerDevil::BackendLoader::loadBackend(m_core); ++ ++ if (!interface) { ++ // Ouch ++ kError() << "KDE Power Management System init failed!"; ++ m_core->loadCore(0); ++ } else { ++ // Let's go! ++ kDebug() << "Backend loaded, loading core"; ++ m_core->loadCore(interface); ++ } ++} ++ ++void KDEDPowerDevil::onCoreReady() ++{ ++ kDebug() << "Core is ready, registering various services on the bus..."; ++ //DBus logic for the core ++ new PowerManagementAdaptor(m_core); ++ new PowerDevil::FdoConnector(m_core); ++ ++ QDBusConnection::sessionBus().registerService("org.kde.Solid.PowerManagement"); ++ QDBusConnection::sessionBus().registerObject("/org/kde/Solid/PowerManagement", m_core); ++ ++ QDBusConnection::systemBus().interface()->registerService("org.freedesktop.Policy.Power"); ++ ++ // Start the Policy Agent service ++ new PowerManagementPolicyAgentAdaptor(PowerDevil::PolicyAgent::instance()); ++ ++ QDBusConnection::sessionBus().registerService("org.kde.Solid.PowerManagement.PolicyAgent"); ++ QDBusConnection::sessionBus().registerObject("/org/kde/Solid/PowerManagement/PolicyAgent", PowerDevil::PolicyAgent::instance()); ++} ++ ++#include "kdedpowerdevil.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/kdedpowerdevil.h.svn-base ../powerdevil/daemon/.svn/text-base/kdedpowerdevil.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/kdedpowerdevil.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/kdedpowerdevil.h.svn-base 2010-12-12 14:48:46.850000001 -0800 +@@ -0,0 +1,47 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 KDEDPOWERDEVIL_H ++#define KDEDPOWERDEVIL_H ++ ++#include ++#include ++ ++namespace PowerDevil { ++ class Core; ++} ++ ++class KDEDPowerDevil : public KDEDModule ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(KDEDPowerDevil) ++ ++public: ++ explicit KDEDPowerDevil(QObject* parent, const QVariantList &); ++ virtual ~KDEDPowerDevil(); ++ ++private Q_SLOTS: ++ void init(); ++ void onCoreReady(); ++ ++private: ++ PowerDevil::Core *m_core; ++}; ++ ++#endif // KDEDPOWERDEVIL_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/Messages.sh.svn-base ../powerdevil/daemon/.svn/text-base/Messages.sh.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/Messages.sh.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/Messages.sh.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,5 @@ ++#! /bin/sh ++$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11 ++$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/powerdevil.pot ++rm -f rc.cpp ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/org.kde.Solid.PowerManagement.xml.svn-base ../powerdevil/daemon/.svn/text-base/org.kde.Solid.PowerManagement.xml.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/org.kde.Solid.PowerManagement.xml.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/org.kde.Solid.PowerManagement.xml.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,56 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionconfig.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilactionconfig.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionconfig.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilactionconfig.cpp.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,60 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilactionconfig.h" ++ ++namespace PowerDevil ++{ ++ ++class ActionConfig::Private ++{ ++public: ++ KConfigGroup config; ++}; ++ ++ActionConfig::ActionConfig(QObject *parent) ++ : QObject(parent) ++ , d(new Private) ++{ ++ ++} ++ ++ActionConfig::~ActionConfig() ++{ ++ delete d; ++} ++ ++KConfigGroup ActionConfig::configGroup() const ++{ ++ return d->config; ++} ++ ++void ActionConfig::setConfigGroup(const KConfigGroup& group) ++{ ++ d->config = group; ++} ++ ++void ActionConfig::setChanged() ++{ ++ emit changed(); ++} ++ ++} ++ ++#include "powerdevilactionconfig.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionconfig.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilactionconfig.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionconfig.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilactionconfig.h.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,62 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_POWERDEVILACTIONCONFIG_H ++#define POWERDEVIL_POWERDEVILACTIONCONFIG_H ++ ++#include ++ ++#include ++ ++#include ++ ++namespace PowerDevil { ++ ++class KDE_EXPORT ActionConfig : public QObject ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(ActionConfig) ++ ++public: ++ ActionConfig(QObject *parent); ++ virtual ~ActionConfig(); ++ ++ KConfigGroup configGroup() const; ++ void setConfigGroup(const KConfigGroup &group); ++ ++ virtual QList< QPair< QString, QWidget* > > buildUi() = 0; ++ ++ virtual void load() = 0; ++ virtual void save() = 0; ++ ++protected Q_SLOTS: ++ void setChanged(); ++ ++Q_SIGNALS: ++ void changed(); ++ ++private: ++ class Private; ++ Private * const d; ++}; ++ ++} ++ ++#endif // POWERDEVIL_POWERDEVILACTIONCONFIG_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilaction.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilaction.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilaction.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilaction.cpp.svn-base 2010-12-12 14:48:46.850000001 -0800 +@@ -0,0 +1,107 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilaction.h" ++ ++#include "powerdevilcore.h" ++ ++namespace PowerDevil ++{ ++ ++class Action::Private ++{ ++public: ++ Private() {} ++ ~Private() {} ++ ++ PowerDevil::Core *core; ++ ++ QList< int > registeredIdleTimeouts; ++ PowerDevil::PolicyAgent::RequiredPolicies requiredPolicies; ++}; ++ ++Action::Action(QObject* parent) ++ : QObject(parent) ++ , d(new Private) ++{ ++ d->core = qobject_cast(parent); ++} ++ ++Action::~Action() ++{ ++ delete d; ++} ++ ++void Action::registerIdleTimeout(int msec) ++{ ++ d->registeredIdleTimeouts.append(msec); ++ d->core->registerActionTimeout(this, msec); ++} ++ ++bool Action::unloadAction() ++{ ++ // Remove all registered idle timeouts, if any ++ d->core->unregisterActionTimeouts(this); ++ d->registeredIdleTimeouts.clear(); ++ ++ // Ok, let's see if the action has to do something for being unloaded ++ return onUnloadAction(); ++} ++ ++bool Action::onUnloadAction() ++{ ++ // Usually nothing has to be done, so let's just happily return true ++ return true; ++} ++ ++BackendInterface* Action::backend() ++{ ++ return d->core->backend(); ++} ++ ++Core* Action::core() ++{ ++ return d->core; ++} ++ ++void Action::trigger(const QVariantMap& args) ++{ ++ if (args.contains("Explicit") && args["Explicit"].toBool()) { ++ // The action was explicitely triggered by the user, hence any policy check is bypassed. ++ triggerImpl(args); ++ } else { ++ // The action was taken automatically: let's check if we have the rights to do that ++ PolicyAgent::RequiredPolicies unsatisfiablePolicies = PolicyAgent::instance()->requirePolicyCheck(d->requiredPolicies); ++ if (unsatisfiablePolicies == PolicyAgent::None) { ++ // Ok, let's trigger the action ++ triggerImpl(args); ++ } else { ++ // TODO: Notify somehow? ++ } ++ } ++} ++ ++void Action::setRequiredPolicies(PolicyAgent::RequiredPolicies requiredPolicies) ++{ ++ d->requiredPolicies = requiredPolicies; ++} ++ ++} ++ ++#include "powerdevilaction.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilaction.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilaction.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilaction.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilaction.h.svn-base 2010-12-12 14:48:46.880000001 -0800 +@@ -0,0 +1,81 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_POWERDEVILACTION_H ++#define POWERDEVIL_POWERDEVILACTION_H ++ ++#include "powerdevilpolicyagent.h" ++ ++#include ++#include ++ ++#include ++ ++class KConfigGroup; ++ ++namespace PowerDevil ++{ ++class BackendInterface; ++class Core; ++ ++class KDE_EXPORT Action : public QObject ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(Action) ++ ++public: ++ explicit Action(QObject *parent); ++ virtual ~Action(); ++ ++ virtual bool loadAction(const KConfigGroup &config) = 0; ++ virtual bool unloadAction(); ++ ++ void trigger(const QVariantMap &args); ++ ++protected: ++ void registerIdleTimeout(int msec); ++ void setRequiredPolicies(PowerDevil::PolicyAgent::RequiredPolicies requiredPolicies); ++ ++ virtual void triggerImpl(const QVariantMap &args) = 0; ++ ++ PowerDevil::BackendInterface *backend(); ++ PowerDevil::Core *core(); ++ ++protected Q_SLOTS: ++ virtual void onProfileLoad() = 0; ++ virtual void onIdleTimeout(int msec) = 0; ++ virtual void onWakeupFromIdle() = 0; ++ virtual void onProfileUnload() = 0; ++ virtual bool onUnloadAction(); ++ ++Q_SIGNALS: ++ void actionTriggered(bool result, const QString &error = QString()); ++ ++private: ++ class Private; ++ Private * const d; ++ ++ friend class Core; ++ friend class ActionPool; ++}; ++ ++} ++ ++#endif // POWERDEVIL_POWERDEVILACTION_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionpool.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilactionpool.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionpool.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilactionpool.cpp.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,162 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilactionpool.h" ++ ++#include "powerdevilaction.h" ++#include "powerdevilcore.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++// Bundled actions: ++#include "actions/bundled/suspendsession.h" ++#include "actions/bundled/disabledesktopeffects.h" ++#include "actions/bundled/brightnesscontrol.h" ++#include "actions/bundled/dimdisplay.h" ++#include "actions/bundled/runscript.h" ++#include "actions/bundled/handlebuttonevents.h" ++ ++namespace PowerDevil ++{ ++ ++class ActionPoolHelper ++{ ++public: ++ ActionPoolHelper() : q(0) {} ++ ~ActionPoolHelper() { ++ delete q; ++ } ++ ActionPool *q; ++}; ++ ++K_GLOBAL_STATIC(ActionPoolHelper, s_globalActionPool) ++ ++ActionPool *ActionPool::instance() ++{ ++ if (!s_globalActionPool->q) { ++ new ActionPool; ++ } ++ ++ return s_globalActionPool->q; ++} ++ ++ActionPool::ActionPool() ++{ ++ Q_ASSERT(!s_globalActionPool->q); ++ s_globalActionPool->q = this; ++} ++ ++ActionPool::~ActionPool() ++{ ++ ++} ++ ++Action* ActionPool::loadAction(const QString& actionId, const KConfigGroup& group, PowerDevil::Core *parent) ++{ ++ // If it's cached, easy game. ++ if (m_cachedPool.contains(actionId)) { ++ Action *retaction = m_cachedPool[actionId]; ++ if (group.isValid()) { ++ retaction->loadAction(group); ++ } ++ m_activeActions.append(actionId); ++ return retaction; ++ } ++ ++ // Is it one of the bundled actions? ++ Action *retaction = 0; ++ ++ if (actionId == "SuspendSession") { ++ retaction = new BundledActions::SuspendSession(parent); ++ } else if (actionId == "DisableDesktopEffects") { ++ retaction = new BundledActions::DisableDesktopEffects(parent); ++ } else if (actionId == "BrightnessControl") { ++ retaction = new BundledActions::BrightnessControl(parent); ++ } else if (actionId == "DimDisplay") { ++ retaction = new BundledActions::DimDisplay(parent); ++ } else if (actionId == "RunScript") { ++ retaction = new BundledActions::RunScript(parent); ++ } else if (actionId == "ForceInhibition") { ++ ++ } else if (actionId == "HandleButtonEvents") { ++ retaction = new BundledActions::HandleButtonEvents(parent); ++ } ++ ++ if (retaction) { ++ if (group.isValid()) { ++ retaction->loadAction(group); ++ } ++ // Cache ++ m_cachedPool.insert(actionId, retaction); ++ m_activeActions.append(actionId); ++ // Go ++ return retaction; ++ } ++ ++ // Otherwise, ask KService for the action itself ++ KService::List offers = KServiceTypeTrader::self()->query("PowerDevil/Action"); ++ foreach (KService::Ptr offer, offers) { ++ if (offer->property("X-KDE-PowerDevil-Action-ID", QVariant::String).toString() != actionId) { ++ continue; ++ } ++ ++ kDebug() << "Got a valid offer for " << actionId; ++ //try to load the specified library ++ retaction = offer->createInstance< PowerDevil::Action >(parent); ++ ++ if (!retaction) { ++ // Troubles... ++ kWarning() << "failed to load" << offer->desktopEntryName(); ++ break; ++ } ++ ++ // All fine, let's break the cycle (cit.) ++ break; ++ } ++ ++ if (retaction) { ++ if (group.isValid()) { ++ retaction->loadAction(group); ++ } ++ // Cache ++ m_cachedPool.insert(actionId, retaction); ++ m_activeActions.append(actionId); ++ // Go ++ return retaction; ++ } ++ ++ // Hmm... troubles in configuration. Np, let's just return 0 and let the core handle this ++ return 0; ++} ++ ++void ActionPool::unloadAllActiveActions() ++{ ++ foreach (const QString &action, m_activeActions) { ++ m_cachedPool[action]->onProfileUnload(); ++ m_cachedPool[action]->unloadAction(); ++ } ++ m_activeActions.clear(); ++} ++ ++} +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionpool.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilactionpool.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilactionpool.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilactionpool.h.svn-base 2010-12-12 14:48:46.850000001 -0800 +@@ -0,0 +1,54 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_POWERDEVILACTIONPOOL_H ++#define POWERDEVIL_POWERDEVILACTIONPOOL_H ++ ++#include ++#include ++ ++class KConfigGroup; ++namespace PowerDevil ++{ ++ ++class Core; ++class Action; ++ ++class ActionPool ++{ ++public: ++ static ActionPool *instance(); ++ ++ virtual ~ActionPool(); ++ ++ Action *loadAction(const QString &actionId, const KConfigGroup &group, PowerDevil::Core *parent); ++ ++ void unloadAllActiveActions(); ++ ++private: ++ ActionPool(); ++ ++ QHash< QString, Action* > m_cachedPool; ++ QStringList m_activeActions; ++}; ++ ++} ++ ++#endif // POWERDEVIL_POWERDEVILACTIONPOOL_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendinterface.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilbackendinterface.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendinterface.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilbackendinterface.cpp.svn-base 2010-12-12 14:48:46.850000001 -0800 +@@ -0,0 +1,167 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilbackendinterface.h" ++ ++namespace PowerDevil ++{ ++ ++class BackendInterface::Private ++{ ++public: ++ Private() : isReady(false), isError(false), isLidClosed(false) {} ++ ~Private() {} ++ ++ AcAdapterState acAdapterState; ++ qulonglong batteryRemainingTime; ++ BatteryState batteryState; ++ QHash< BrightnessControlType, float > brightness; ++ BrightnessControlsList brightnessControlsAvailable; ++ SuspendMethods suspendMethods; ++ QString errorString; ++ bool isReady; ++ bool isError; ++ bool isLidClosed; ++ QHash< QString, uint > capacities; ++ QList< RecallNotice > recallNotices; ++}; ++ ++BackendInterface::BackendInterface(QObject* parent) ++ : QObject(parent) ++ , d(new Private) ++{ ++} ++ ++BackendInterface::~BackendInterface() ++{ ++ delete d; ++} ++ ++BackendInterface::AcAdapterState BackendInterface::acAdapterState() const ++{ ++ return d->acAdapterState; ++} ++ ++qulonglong BackendInterface::batteryRemainingTime() const ++{ ++ return d->batteryRemainingTime; ++} ++ ++BackendInterface::BatteryState BackendInterface::batteryState() const ++{ ++ return d->batteryState; ++} ++ ++float BackendInterface::brightness(BackendInterface::BrightnessControlType type) const ++{ ++ return d->brightness[type]; ++} ++ ++BackendInterface::BrightnessControlsList BackendInterface::brightnessControlsAvailable() const ++{ ++ return d->brightnessControlsAvailable; ++} ++ ++QHash< QString, uint > BackendInterface::capacities() const ++{ ++ return d->capacities; ++} ++ ++QList< BackendInterface::RecallNotice > BackendInterface::recallNotices() const ++{ ++ return d->recallNotices; ++} ++ ++BackendInterface::SuspendMethods BackendInterface::supportedSuspendMethods() const ++{ ++ return d->suspendMethods; ++} ++ ++bool BackendInterface::isLidClosed() const ++{ ++ return d->isLidClosed; ++} ++ ++void BackendInterface::setAcAdapterState(PowerDevil::BackendInterface::AcAdapterState state) ++{ ++ d->acAdapterState = state; ++ emit acAdapterStateChanged(state); ++} ++ ++void BackendInterface::setBackendHasError(const QString& errorDetails) ++{ ++ Q_UNUSED(errorDetails) ++} ++ ++void BackendInterface::setBackendIsReady(BrightnessControlsList availableBrightnessControls, ++ BackendInterface::SuspendMethods supportedSuspendMethods) ++{ ++ d->brightnessControlsAvailable = availableBrightnessControls; ++ d->suspendMethods = supportedSuspendMethods; ++ d->isReady = true; ++ ++ emit backendReady(); ++} ++ ++void BackendInterface::setBatteryRemainingTime(qulonglong time) ++{ ++ d->batteryRemainingTime = time; ++ emit batteryRemainingTimeChanged(time); ++} ++ ++void BackendInterface::setBatteryState(PowerDevil::BackendInterface::BatteryState state) ++{ ++ d->batteryState = state; ++ emit batteryStateChanged(state); ++} ++ ++void BackendInterface::setButtonPressed(PowerDevil::BackendInterface::ButtonType type) ++{ ++ if (type == LidClose) { ++ d->isLidClosed = true; ++ } else if (type == LidOpen) { ++ d->isLidClosed = false; ++ } ++ emit buttonPressed(type); ++} ++ ++void BackendInterface::setCapacityForBattery(const QString& batteryId, uint percent) ++{ ++ d->capacities.insert(batteryId, percent); ++} ++ ++void BackendInterface::setRecallNotices(const QList< BackendInterface::RecallNotice >& notices) ++{ ++ d->recallNotices = notices; ++} ++ ++void BackendInterface::onBrightnessChanged(BackendInterface::BrightnessControlType device, float brightness) ++{ ++ d->brightness[device] = brightness; ++ emit brightnessChanged(brightness, device); ++} ++ ++void BackendInterface::setResumeFromSuspend() ++{ ++ emit resumeFromSuspend(); ++} ++ ++} ++ ++#include "powerdevilbackendinterface.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendinterface.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilbackendinterface.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendinterface.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilbackendinterface.h.svn-base 2010-12-12 14:48:46.850000001 -0800 +@@ -0,0 +1,265 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BACKENDINTERFACE_H ++#define POWERDEVIL_BACKENDINTERFACE_H ++ ++#include ++#include ++ ++#include ++ ++class KJob; ++ ++namespace PowerDevil { ++ ++class KDE_EXPORT BackendInterface : public QObject ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(BackendInterface) ++ ++public: ++ explicit BackendInterface(QObject* parent = 0); ++ virtual ~BackendInterface(); ++ ++ /** ++ * This enum type defines the different states of the system battery. ++ * ++ * - NoBatteryState: No battery available ++ * - Normal: The battery is at its normal charge level ++ * - Warning: The battery is at its warning charge level ++ * - Low: The battery is at its low charge level ++ * - Critical: The battery is at its critical charge level ++ */ ++ enum BatteryState{ NoBatteryState, Normal, Warning, Low, Critical }; ++ ++ /** ++ * This enum type defines the different states of the AC adapter. ++ * ++ * - UnknownAcAdapterState: The AC adapter has an unknown state ++ * - Plugged: The AC adapter is plugged ++ * - Unplugged: The AC adapter is unplugged ++ */ ++ enum AcAdapterState{ UnknownAcAdapterState, Plugged, Unplugged }; ++ ++ /** ++ * This enum type defines the types of system button events. ++ * ++ * - UnknownButtonType: An unknown button ++ * - PowerButton: A power button pressed event, generally used to turn on or off the system ++ * - SleepButton: A sleep button pressed event, generally used to make the system asleep ++ * - LidOpen: A laptop lid open event ++ * - LidClose: A laptop lid close event ++ */ ++ enum ButtonType{ UnknownButtonType, PowerButton, SleepButton, LidOpen, LidClose }; ++ ++ /** ++ * This enum type defines the different suspend methods. ++ * ++ * - UnknownSuspendMethod: The name says it all ++ * - Standby: Processes are stopped, some hardware is deactivated (ACPI S1) ++ * - ToRam: Most devices are deactivated, only RAM is powered (ACPI S3) ++ * - ToDisk: State of the machine is saved to disk, and it's powered down (ACPI S4) ++ */ ++ enum SuspendMethod{ UnknownSuspendMethod = 0, Standby = 1, ToRam = 2, ToDisk = 4, HybridSuspend = 8 }; ++ ++ /** ++ * This type stores an OR combination of SuspendMethod values. ++ */ ++ Q_DECLARE_FLAGS(SuspendMethods, SuspendMethod) ++ ++ /** ++ * This enum defines the different types of brightness controls. ++ * ++ * - UnknownBrightnessControl: Unknown ++ * - Screen: Brightness control for a monitor or laptop panel ++ * - Keyboard: Brightness control for a keyboard backlight ++ */ ++ enum BrightnessControlType{ UnknownBrightnessControl = 0, Screen = 1, Keyboard = 2 }; ++ ++ typedef QHash BrightnessControlsList; ++ ++ /** ++ * This enum defines the different types brightness keys. ++ * ++ * - Increase: Key to increase brightness (Qt::Key_MonBrightnessUp) ++ * - Decrease: Key to decrease brightness (Qt::Key_MonBrightnessDown) ++ */ ++ enum BrightnessKeyType{ Increase, Decrease }; ++ ++ struct RecallNotice { ++ QString batteryId; ++ QString vendor; ++ QString url; ++ }; ++ ++ virtual void init() = 0; ++ ++ /** ++ * Retrieves the current state of the system battery. ++ * ++ * @return the current battery state ++ * @see Solid::Control::PowerManager::BatteryState ++ */ ++ BatteryState batteryState() const; ++ ++ /** ++ * Retrieves the current estimated remaining time of the system batteries ++ * ++ * @return the current global estimated remaining time in milliseconds ++ */ ++ qulonglong batteryRemainingTime() const; ++ ++ /** ++ * Retrieves the current state of the system AC adapter. ++ * ++ * @return the current AC adapter state ++ * @see Solid::Control::PowerManager::AcAdapterState ++ */ ++ AcAdapterState acAdapterState() const; ++ ++ ++ /** ++ * Retrieves the set of suspend methods supported by the system. ++ * ++ * @return the suspend methods supported by this system ++ * @see Solid::Control::PowerManager::SuspendMethod ++ * @see Solid::Control::PowerManager::SuspendMethods ++ */ ++ SuspendMethods supportedSuspendMethods() const; ++ ++ /** ++ * Requests a suspend of the system. ++ * ++ * @param method the suspend method to use ++ * @return the job handling the operation ++ */ ++ virtual KJob *suspend(SuspendMethod method) = 0; ++ ++ /** ++ * Checks if brightness controls are enabled on this system. ++ * ++ * @return a list of the devices available to control ++ */ ++ BrightnessControlsList brightnessControlsAvailable() const; ++ ++ /** ++ * Gets the screen brightness. ++ * ++ * @param device the name of the device that you would like to control ++ * @return the brightness of the device, as a percentage ++ */ ++ virtual float brightness(BrightnessControlType type = Screen) const; ++ ++ bool isLidClosed() const; ++ ++ /** ++ * Sets the screen brightness. ++ * ++ * @param brightness the desired screen brightness, as a percentage ++ * @param device the name of the device that you would like to control ++ * @return true if the brightness change succeeded, false otherwise ++ */ ++ virtual bool setBrightness(float brightness, BrightnessControlType type = Screen) = 0; ++ ++ /** ++ * Should be called when the user presses a brightness key. ++ * ++ * @param type the type of the brightness key press ++ * @see Solid::Control::PowerManager::BrightnessKeyType ++ */ ++ virtual void brightnessKeyPressed(BrightnessKeyType type) = 0; ++ ++ QHash< QString, uint > capacities() const; ++ ++ QList< RecallNotice > recallNotices() const; ++ ++Q_SIGNALS: ++ /** ++ * 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 ++ * type @see Solid::Control::PowerManager::AcAdapterState ++ */ ++ void acAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState newState); ++ ++ /** ++ * This signal is emitted when the system battery state changed. ++ * ++ * @param newState the new state of the system battery, it's one of the ++ * type @see Solid::Control::PowerManager::BatteryState ++ */ ++ void batteryStateChanged(PowerDevil::BackendInterface::BatteryState newState); ++ ++ /** ++ * This signal is emitted when a button has been pressed. ++ * ++ * @param buttonType the pressed button type, it's one of the ++ * type @see Solid::Control::PowerManager::ButtonType ++ */ ++ void buttonPressed(PowerDevil::BackendInterface::ButtonType buttonType); ++ ++ /** ++ * This signal is emitted when the brightness changes. ++ * ++ * @param brightness the new brightness level ++ */ ++ void brightnessChanged(float brightness, PowerDevil::BackendInterface::BrightnessControlType type); ++ ++ /** ++ * This signal is emitted when the estimated battery remaining time changes. ++ * ++ * @param time the new remaining time ++ */ ++ void batteryRemainingTimeChanged(qulonglong time); ++ ++ void backendReady(); ++ ++ void backendError(const QString &error); ++ ++ void resumeFromSuspend(); ++ ++protected: ++ void onBrightnessChanged(BrightnessControlType device, float brightness); ++ void setBatteryRemainingTime(qulonglong time); ++ void setButtonPressed(PowerDevil::BackendInterface::ButtonType type); ++ void setBatteryState(PowerDevil::BackendInterface::BatteryState state); ++ void setAcAdapterState(PowerDevil::BackendInterface::AcAdapterState state); ++ ++ void setCapacityForBattery(const QString &batteryId, uint percent); ++ void setRecallNotices(const QList< RecallNotice > ¬ices); ++ ++ void setBackendIsReady(BrightnessControlsList availableBrightnessControls, SuspendMethods supportedSuspendMethods); ++ void setBackendHasError(const QString &errorDetails); ++ ++protected slots: ++ // This function is actually here due to HAL ++ void setResumeFromSuspend(); ++ ++private: ++ class Private; ++ Private * const d; ++ ++ friend class Core; ++}; ++ ++} ++ ++#endif // POWERDEVIL_BACKENDINTERFACE_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendloader.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilbackendloader.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendloader.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilbackendloader.cpp.svn-base 2010-12-12 14:48:46.880000001 -0800 +@@ -0,0 +1,56 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilbackendloader.h" ++ ++#include "backends/upower/powerdevilupowerbackend.h" ++#include "backends/hal/powerdevilhalbackend.h" ++ ++#include ++ ++namespace PowerDevil { ++namespace BackendLoader { ++ ++BackendInterface* loadBackend(QObject *parent) ++{ ++ // Check UPower first ++ kDebug() << "Loading UPower backend..."; ++ if (PowerDevilUPowerBackend::isAvailable()) { ++ kDebug() << "Success!"; ++ return new PowerDevilUPowerBackend(parent); ++ } ++ ++ kDebug() << "Failed!"; ++ ++ // If we are here, try HAL ++ kDebug() << "Loading HAL backend..."; ++ if (PowerDevilHALBackend::isAvailable()) { ++ kDebug() << "Success!"; ++ return new PowerDevilHALBackend(parent); ++ } ++ ++ // Fail... ++ kDebug() << "Failed!"; ++ return 0; ++} ++ ++} ++} ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendloader.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilbackendloader.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilbackendloader.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilbackendloader.h.svn-base 2010-12-12 14:48:46.880000001 -0800 +@@ -0,0 +1,36 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_BACKENDLOADER_H ++#define POWERDEVIL_BACKENDLOADER_H ++ ++class QObject; ++namespace PowerDevil { ++ ++class BackendInterface; ++ ++ ++namespace BackendLoader ++{ ++ BackendInterface *loadBackend(QObject *parent); ++} ++ ++} ++ ++#endif // POWERDEVIL_POWERDEVILBACKENDLOADER_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilcore.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilcore.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilcore.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilcore.cpp.svn-base 2010-12-12 14:48:46.920000000 -0800 +@@ -0,0 +1,672 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilcore.h" ++ ++#include "PowerDevilSettings.h" ++#include "screensaver_interface.h" ++ ++#include "powerdevilaction.h" ++#include "powerdevilactionpool.h" ++#include "powerdevilbackendinterface.h" ++#include "powerdevilpolicyagent.h" ++#include "powerdevilprofilegenerator.h" ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++namespace PowerDevil ++{ ++ ++Core::Core(QObject* parent, const KComponentData &componentData) ++ : QObject(parent) ++ , m_backend(0) ++ , m_applicationData(componentData) ++ , m_criticalBatteryTimer(new QTimer(this)) ++{ ++} ++ ++Core::~Core() ++{ ++ // Unload all actions before exiting ++ ActionPool::instance()->unloadAllActiveActions(); ++} ++ ++void Core::loadCore(BackendInterface* backend) ++{ ++ if (!backend) { ++ onBackendError(i18n("No valid Power Management backend plugins are available. " ++ "A new installation might solve this problem.")); ++ return; ++ } ++ ++ m_backend = backend; ++ ++ // Async backend init - so that KDED gets a bit of a speed up ++ kDebug() << "Core loaded, initializing backend"; ++ connect(m_backend, SIGNAL(backendReady()), this, SLOT(onBackendReady())); ++ connect(m_backend, SIGNAL(backendError(QString)), this, SLOT(onBackendError(QString))); ++ m_backend->init(); ++ ++ // Register DBus Metatypes ++ qDBusRegisterMetaType< StringStringMap >(); ++} ++ ++void Core::onBackendReady() ++{ ++ kDebug() << "Backend is ready, KDE Power Management system initialized"; ++ ++ m_profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig); ++ ++ // Is it brand new? ++ if (m_profilesConfig->groupList().isEmpty()) { ++ // Generate defaults ++ if (ProfileGenerator::generateProfiles(true) == ProfileGenerator::ResultUpgraded) { ++ // Notify the user ++ emitNotification("warningnot", i18n("Your Power Profiles have been updated to be used with the new KDE Power " ++ "Management System. You can tweak them or generate a new set of defaults from " ++ "System Settings."), "system-software-update"); ++ } ++ m_profilesConfig->reparseConfiguration(); ++ } ++ ++ // Get the battery devices ready ++ { ++ using namespace Solid; ++ connect(DeviceNotifier::instance(), SIGNAL(deviceAdded(QString)), ++ this, SLOT(onDeviceAdded(QString))); ++ connect(DeviceNotifier::instance(), SIGNAL(deviceRemoved(QString)), ++ this, SLOT(onDeviceRemoved(QString))); ++ ++ // Force the addition of already existent batteries ++ foreach (const Device &device, Device::listFromType(DeviceInterface::Battery, QString())) { ++ onDeviceAdded(device.udi()); ++ } ++ } ++ ++ connect(m_backend, SIGNAL(brightnessChanged(float,PowerDevil::BackendInterface::BrightnessControlType)), ++ this, SLOT(onBrightnessChanged(float))); ++ connect(m_backend, SIGNAL(acAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState)), ++ this, SLOT(onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState))); ++ connect(m_backend, SIGNAL(batteryRemainingTimeChanged(qulonglong)), ++ this, SLOT(onBatteryRemainingTimeChanged(qulonglong))); ++ connect(m_backend, SIGNAL(resumeFromSuspend()), ++ this, SLOT(onResumeFromSuspend())); ++ connect(KIdleTime::instance(), SIGNAL(timeoutReached(int,int)), ++ this, SLOT(onKIdleTimeoutReached(int,int))); ++ connect(KIdleTime::instance(), SIGNAL(resumingFromIdle()), ++ this, SLOT(onResumingFromIdle())); ++ ++ // Set up the policy agent ++ PowerDevil::PolicyAgent::instance()->init(); ++ ++ // Set up the critical battery timer ++ m_criticalBatteryTimer->setSingleShot(true); ++ m_criticalBatteryTimer->setInterval(30000); ++ connect(m_criticalBatteryTimer, SIGNAL(timeout()), this, SLOT(onCriticalBatteryTimerExpired())); ++ ++ // In 30 seconds (so we are sure the user sees eventual notifications), check the battery state ++ QTimer::singleShot(30000, this, SLOT(checkBatteryStatus())); ++ ++ // All systems up Houston, let's go! ++ emit coreReady(); ++ refreshStatus(); ++ ++ KActionCollection* actionCollection = new KActionCollection( this ); ++ ++ KAction* globalAction = actionCollection->addAction("Increase Screen Brightness"); ++ globalAction->setText(i18nc("Global shortcut", "Increase Screen Brightness")); ++ globalAction->setGlobalShortcut(KShortcut(Qt::Key_MonBrightnessUp), ++ KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), ++ KAction::NoAutoloading); ++ connect(globalAction, SIGNAL(triggered(bool)), SLOT(increaseBrightness())); ++ ++ globalAction = actionCollection->addAction("Decrease Screen Brightness"); ++ globalAction->setText(i18nc("Global shortcut", "Decrease Screen Brightness")); ++ globalAction->setGlobalShortcut(KShortcut(Qt::Key_MonBrightnessDown), ++ KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), ++ KAction::NoAutoloading); ++ connect(globalAction, SIGNAL(triggered(bool)), SLOT(decreaseBrightness())); ++ ++ globalAction = actionCollection->addAction("Sleep"); ++ globalAction->setText(i18nc("Global shortcut", "Sleep")); ++ globalAction->setGlobalShortcut(KShortcut(Qt::Key_Sleep), ++ KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), ++ KAction::NoAutoloading); ++ connect(globalAction, SIGNAL(triggered(bool)), SLOT(suspendToRam())); ++ ++ globalAction = actionCollection->addAction("Hibernate"); ++ globalAction->setText(i18nc("Global shortcut", "Hibernate")); ++ globalAction->setGlobalShortcut(KShortcut(Qt::Key_Hibernate), ++ KAction::ShortcutTypes(KAction::ActiveShortcut | KAction::DefaultShortcut), ++ KAction::NoAutoloading); ++ connect(globalAction, SIGNAL(triggered(bool)), SLOT(suspendToDisk())); ++} ++ ++void Core::checkBatteryStatus() ++{ ++ // Any batteries below 50% of capacity? ++ for (QHash< QString, uint >::const_iterator i = m_backend->capacities().constBegin(); ++ i != m_backend->capacities().constEnd(); ++i) { ++ if (i.value() < 50) { ++ // Notify, we have a broken battery. ++ emitNotification("brokenbattery", i18np("Your battery capacity is %2%. This means your battery is broken " ++ "and needs a replacement. Please contact your hardware vendor for more details.", ++ ++ "One of your batteries (ID %3) has a capacity of %2%. This means it is broken " ++ "and needs a replacement. Please contact your hardware vendor for more details.", ++ m_loadedBatteriesUdi.size(), i.value(), i.key()), ++ "dialog-warning"); ++ } ++ } ++ ++ // Any recalled batteries? ++ foreach (const BackendInterface::RecallNotice ¬ice, m_backend->recallNotices()) { ++ // Notify, a battery has been recalled ++ emitNotification("brokenbattery", i18np("Your battery might have been recalled by %2. Usually, when vendors recall the " ++ "hardware, it is because of factory defects which are usually eligible for a " ++ "free repair or substitution. Please check %2's website to " ++ "verify if your battery is faulted.", ++ ++ "One of your batteries (ID %4) might have been recalled by %2. " ++ "Usually, when vendors recall the hardware, it is because of factory defects " ++ "which are usually eligible for a free repair or substitution. " ++ "Please check %2's website to " ++ "verify if your battery is faulted.", ++ m_loadedBatteriesUdi.size(), notice.vendor, notice.url, notice.batteryId), ++ "dialog-warning"); ++ } ++} ++ ++void Core::refreshStatus() ++{ ++ /* The configuration could have changed if this function was called, so ++ * let's resync it. ++ */ ++ reparseConfiguration(); ++ ++ reloadProfile(); ++} ++ ++void Core::reloadProfile() ++{ ++ reloadProfile(m_backend->acAdapterState()); ++} ++ ++void Core::reloadCurrentProfile() ++{ ++ /* The configuration could have changed if this function was called, so ++ * let's resync it. ++ */ ++ reparseConfiguration(); ++ ++ loadProfile(m_currentProfile); ++} ++ ++void Core::reparseConfiguration() ++{ ++ PowerDevilSettings::self()->readConfig(); ++ m_profilesConfig->reparseConfiguration(); ++ ++ // Config reloaded ++ emit configurationReloaded(); ++} ++ ++StringStringMap Core::availableProfiles() const ++{ ++ QMap< QString, QString > retmap; ++ foreach (const QString &ent, m_profilesConfig->groupList()) { ++ if (ent == "Performance") { ++ retmap.insert(ent, i18nc("Name of a power profile", "Performance")); ++ } else if (ent == "Powersave") { ++ retmap.insert(ent, i18nc("Name of a power profile", "Powersave")); ++ } else if (ent == "Aggressive powersave") { ++ retmap.insert(ent, i18nc("Name of a power profile", "Aggressive powersave")); ++ } else { ++ KConfigGroup group(m_profilesConfig, ent); ++ if (group.hasKey("name")) { ++ retmap.insert(ent, group.readEntry("name")); ++ } else { ++ retmap.insert(ent, ent); ++ } ++ } ++ } ++ ++ return retmap; ++} ++ ++void Core::reloadProfile(int state) ++{ ++ if (m_loadedBatteriesUdi.isEmpty()) { ++ kDebug() << "No batteries found, loading AC"; ++ loadProfile(PowerDevilSettings::aCProfile()); ++ } else { ++ // Compute the previous and current global percentage ++ int percent = 0; ++ for (QHash::const_iterator i = m_batteriesPercent.constBegin(); i != m_batteriesPercent.constEnd(); ++i) { ++ percent += i.value(); ++ } ++ ++ if (state == BackendInterface::Plugged) { ++ kDebug() << "Loading profile for plugged AC"; ++ loadProfile(PowerDevilSettings::aCProfile()); ++ } else if (percent <= PowerDevilSettings::batteryWarningLevel()) { ++ loadProfile(PowerDevilSettings::warningProfile()); ++ kDebug() << "Loading profile for warning battery"; ++ } else if (percent <= PowerDevilSettings::batteryLowLevel()) { ++ loadProfile(PowerDevilSettings::lowProfile()); ++ kDebug() << "Loading profile for low battery"; ++ } else { ++ loadProfile(PowerDevilSettings::batteryProfile()); ++ kDebug() << "Loading profile for unplugged AC"; ++ } ++ } ++} ++ ++void Core::loadProfile(const QString& id) ++{ ++ // Policy check ++ if (PolicyAgent::instance()->requirePolicyCheck(PolicyAgent::ChangeProfile) != PolicyAgent::None) { ++ kDebug() << "Policy Agent prevention: on"; ++ return; ++ } ++ ++ // First of all, let's clean the old actions. This will also call the onProfileUnload callback ++ ActionPool::instance()->unloadAllActiveActions(); ++ ++ // Now, let's retrieve our profile ++ KConfigGroup config(m_profilesConfig, id); ++ ++ if (!config.isValid() || config.groupList().isEmpty()) { ++ emitNotification("powerdevilerror", i18n("The profile \"%1\" has been selected, " ++ "but it does not exist.\nPlease check your PowerDevil configuration.", ++ id), "dialog-error"); ++ return; ++ } ++ ++ // Cool, now let's load the needed actions ++ foreach (const QString &actionName, config.groupList()) { ++ Action *action = ActionPool::instance()->loadAction(actionName, config.group(actionName), this); ++ if (action) { ++ action->onProfileLoad(); ++ } else { ++ // Ouch, error. But let's just warn and move on anyway ++ emitNotification("powerdevilerror", i18n("The profile \"%1\" tried to activate %2, " ++ "a non existent action. This is usually due to an installation problem" ++ " or to a configuration problem.", ++ id, actionName), "dialog-warning"); ++ } ++ } ++ ++ // Set the current profile. Notify if different. ++ if (m_currentProfile != id) { ++ m_currentProfile = id; ++ emit profileChanged(m_currentProfile); ++ } ++ ++ // If the lid is closed, retrigger the lid close signal ++ if (m_backend->isLidClosed()) { ++ emit m_backend->buttonPressed(PowerDevil::BackendInterface::LidClose); ++ } ++} ++ ++void Core::onDeviceAdded(const QString& udi) ++{ ++ if (m_loadedBatteriesUdi.contains(udi)) { ++ // We already know about this device ++ return; ++ } ++ ++ using namespace Solid; ++ Device device(udi); ++ Battery *b = qobject_cast(device.asDeviceInterface(DeviceInterface::Battery)); ++ ++ if (!b) { ++ // Not interesting to us ++ return; ++ } ++ ++ if (b->type() != Solid::Battery::PrimaryBattery && b->type() != Solid::Battery::UpsBattery) { ++ // Not interesting to us ++ return; ++ } ++ ++ if (!connect(b, SIGNAL(chargePercentChanged(int,QString)), ++ this, SLOT(onBatteryChargePercentChanged(int,QString)))) { ++ emitNotification("powerdevilerror", i18n("Could not connect to battery interface.\n" ++ "Please check your system configuration"), "dialog-error"); ++ } ++ ++ kDebug() << "A new battery was detected"; ++ ++ m_batteriesPercent[udi] = b->chargePercent(); ++ m_loadedBatteriesUdi.append(udi); ++} ++ ++void Core::onDeviceRemoved(const QString& udi) ++{ ++ if (!m_loadedBatteriesUdi.contains(udi)) { ++ // We don't know about this device ++ return; ++ } ++ ++ using namespace Solid; ++ Device device(udi); ++ Battery *b = qobject_cast(device.asDeviceInterface(DeviceInterface::Battery)); ++ ++ if (!b) { ++ // Not interesting to us ++ return; ++ } ++ ++ if (b->type() != Solid::Battery::PrimaryBattery && b->type() != Solid::Battery::UpsBattery) { ++ // Not interesting to us ++ return; ++ } ++ ++ disconnect(b, SIGNAL(chargePercentChanged(int,QString)), ++ this, SLOT(onBatteryChargePercentChanged(int,QString))); ++ ++ kDebug() << "An existing battery has been removed"; ++ ++ m_batteriesPercent.remove(udi); ++ m_loadedBatteriesUdi.removeOne(udi); ++} ++ ++void Core::emitNotification(const QString &evid, const QString &message, const QString &iconname) ++{ ++ KNotification::event(evid, message, KIcon(iconname).pixmap(20, 20), ++ 0, KNotification::CloseOnTimeout, m_applicationData); ++} ++ ++void Core::onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState state) ++{ ++ kDebug(); ++ // Fake an activity event - usually adapters don't plug themselves out :) ++ KIdleTime::instance()->simulateUserActivity(); ++ reloadProfile(state); ++ ++ if (state == BackendInterface::Plugged) { ++ // If the AC Adaptor has been plugged in, let's clear some pending suspend actions ++ if (m_criticalBatteryTimer->isActive()) { ++ m_criticalBatteryTimer->stop(); ++ emitNotification("criticalbattery", ++ i18n("The power adaptor has been plugged in - all pending suspend actions have been cancelled")); ++ } else { ++ emitNotification("pluggedin", i18n("The power adaptor has been plugged in.")); ++ } ++ } else { ++ emitNotification("unplugged", i18n("The power adaptor has been unplugged.")); ++ } ++} ++ ++void Core::onBackendError(const QString& error) ++{ ++ emitNotification("powerdevilerror", i18n("KDE Power Management System could not be initialized. " ++ "The backend reported the following error: %1\n" ++ "Please check your system configuration", error), "dialog-error"); ++} ++ ++void Core::onBatteryChargePercentChanged(int percent, const QString &udi) ++{ ++ // Compute the previous and current global percentage ++ int previousPercent = 0; ++ for (QHash::const_iterator i = m_batteriesPercent.constBegin(); i != m_batteriesPercent.constEnd(); ++i) { ++ previousPercent += i.value(); ++ } ++ int currentPercent = previousPercent - (m_batteriesPercent[udi] - percent); ++ ++ // Update the battery percentage ++ m_batteriesPercent[udi] = percent; ++ ++ // And check if we need to do stuff ++ if (m_backend->acAdapterState() == BackendInterface::Plugged) { ++ return; ++ } ++ ++ if (currentPercent <= PowerDevilSettings::batteryCriticalLevel() && ++ previousPercent > PowerDevilSettings::batteryCriticalLevel()) { ++ switch (PowerDevilSettings::batteryCriticalAction()) { ++ case 3: ++ emitNotification("criticalbattery", ++ i18n("Your battery level is critical, the computer will be halted in 30 seconds."), ++ "dialog-warning"); ++ break; ++ case 2: ++ emitNotification("criticalbattery", ++ i18n("Your battery level is critical, the computer will be hibernated in 30 seconds."), ++ "dialog-warning"); ++ break; ++ case 1: ++ emitNotification("criticalbattery", ++ i18n("Your battery level is critical, the computer will be suspended in 30 seconds."), ++ "dialog-warning"); ++ break; ++ default: ++ emitNotification("criticalbattery", ++ i18n("Your battery level is critical: save your work as soon as possible."), ++ "dialog-warning"); ++ break; ++ } ++ } else if (currentPercent <= PowerDevilSettings::batteryWarningLevel() && ++ previousPercent > PowerDevilSettings::batteryWarningLevel()) { ++ emitNotification("warningbattery", i18n("Your battery has reached the warning level."), ++ "dialog-warning"); ++ refreshStatus(); ++ } else if (currentPercent <= PowerDevilSettings::batteryLowLevel() && ++ previousPercent > PowerDevilSettings::batteryLowLevel()) { ++ emitNotification("lowbattery", i18n("Your battery has reached a low level."), ++ "dialog-warning"); ++ refreshStatus(); ++ } ++} ++ ++void Core::onCriticalBatteryTimerExpired() ++{ ++ // Do that only if we're not on AC ++ if (m_backend->acAdapterState() == BackendInterface::Unplugged) { ++ // We consider this as a very special button ++ PowerDevil::Action *helperAction = ActionPool::instance()->loadAction("HandleButtonEvents", KConfigGroup(), this); ++ if (helperAction) { ++ QVariantMap args; ++ args["Button"] = 32; ++ args["Type"] = QVariant::fromValue(PowerDevilSettings::batteryCriticalAction()); ++ helperAction->trigger(args); ++ } ++ } ++} ++ ++void Core::onBatteryRemainingTimeChanged(qulonglong time) ++{ ++ emit batteryRemainingTimeChanged(time); ++} ++ ++void Core::onBrightnessChanged(float brightness) ++{ ++ emit brightnessChanged(brightness); ++} ++ ++void Core::onResumeFromSuspend() ++{ ++ // Notify the screensaver ++ OrgFreedesktopScreenSaverInterface iface("org.freedesktop.ScreenSaver", ++ "/ScreenSaver", ++ QDBusConnection::sessionBus()); ++ iface.SimulateUserActivity(); ++ ++ emit resumingFromSuspend(); ++} ++ ++void Core::onKIdleTimeoutReached(int identifier, int msec) ++{ ++ // Find which action(s) requested this idle timeout ++ for (QHash< Action*, QList< int > >::const_iterator i = m_registeredActionTimeouts.constBegin(); ++ i != m_registeredActionTimeouts.constEnd(); ++i) { ++ foreach (int timeoutId, i.value()) { ++ if (timeoutId == identifier) { ++ // Yep. ++ i.key()->onIdleTimeout(msec); ++ // And it will need to be awaken ++ if (!m_pendingResumeFromIdleActions.contains(i.key())) { ++ m_pendingResumeFromIdleActions.append(i.key()); ++ } ++ } ++ } ++ } ++ ++ // Catch the next resume event if some actions require it ++ if (!m_pendingResumeFromIdleActions.isEmpty()) { ++ KIdleTime::instance()->catchNextResumeEvent(); ++ } ++} ++ ++void Core::registerActionTimeout(Action* action, int timeout) ++{ ++ int identifier = -1; ++ // Are there any registered timeouts with the same value? ++ if (m_registeredIdleTimeouts.contains(timeout)) { ++ // Easy game ++ identifier = m_registeredIdleTimeouts[timeout]; ++ } else { ++ // Register the timeout with KIdleTime ++ identifier = KIdleTime::instance()->addIdleTimeout(timeout); ++ // And add it to the hash ++ m_registeredIdleTimeouts.insert(timeout, identifier); ++ } ++ ++ // Add the identifier to the action hash ++ QList< int > timeouts = m_registeredActionTimeouts[action]; ++ timeouts.append(identifier); ++ m_registeredActionTimeouts[action] = timeouts; ++} ++ ++void Core::unregisterActionTimeouts(Action* action) ++{ ++ // Clear all timeouts from the action: if the timeouts are not used anywhere else, just remove ++ // them from KIdleTime as well. ++ QList< int > timeoutsToClean = m_registeredActionTimeouts[action]; ++ m_registeredActionTimeouts.remove(action); ++ for (QHash< Action*, QList< int > >::const_iterator i = m_registeredActionTimeouts.constBegin(); ++ i != m_registeredActionTimeouts.constEnd(); ++i) { ++ foreach (int timeoutId, i.value()) { ++ if (timeoutsToClean.contains(timeoutId)) { ++ timeoutsToClean.removeOne(timeoutId); ++ } ++ } ++ } ++ ++ // Clean the remaining ones ++ foreach (int id, timeoutsToClean) { ++ KIdleTime::instance()->removeIdleTimeout(id); ++ m_registeredIdleTimeouts.remove(m_registeredIdleTimeouts.key(id)); ++ } ++} ++ ++void Core::onResumingFromIdle() ++{ ++ // Wake up the actions in which an idle action was triggered ++ QList< Action* >::iterator i = m_pendingResumeFromIdleActions.begin(); ++ while (i != m_pendingResumeFromIdleActions.end()) { ++ (*i)->onWakeupFromIdle(); ++ i = m_pendingResumeFromIdleActions.erase(i); ++ } ++} ++ ++void Core::increaseBrightness() ++{ ++ m_backend->brightnessKeyPressed(BackendInterface::Increase); ++} ++ ++void Core::decreaseBrightness() ++{ ++ m_backend->brightnessKeyPressed(BackendInterface::Decrease); ++} ++ ++BackendInterface* Core::backend() ++{ ++ return m_backend; ++} ++ ++void Core::suspendHybrid() ++{ ++ triggerSuspendSession(4); ++} ++ ++void Core::suspendToDisk() ++{ ++ triggerSuspendSession(2); ++} ++ ++void Core::suspendToRam() ++{ ++ triggerSuspendSession(1); ++} ++ ++qulonglong Core::batteryRemainingTime() const ++{ ++ return m_backend->batteryRemainingTime(); ++} ++ ++int Core::brightness() const ++{ ++ return m_backend->brightness(); ++} ++ ++QString Core::currentProfile() const ++{ ++ return m_currentProfile; ++} ++ ++void Core::setBrightness(int percent) ++{ ++ QVariantMap args; ++ args["Value"] = QVariant::fromValue((float)percent); ++ args["Explicit"] = true; ++ ActionPool::instance()->loadAction("BrightnessControl", KConfigGroup(), this)->trigger(args); ++} ++ ++void Core::triggerSuspendSession(uint action) ++{ ++ PowerDevil::Action *helperAction = ActionPool::instance()->loadAction("SuspendSession", KConfigGroup(), this); ++ if (helperAction) { ++ QVariantMap args; ++ args["Type"] = action; ++ args["Explicit"] = true; ++ helperAction->trigger(args); ++ } ++} ++ ++} ++ ++#include "powerdevilcore.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilcore.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilcore.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilcore.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilcore.h.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,145 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVILCORE_H ++#define POWERDEVILCORE_H ++ ++#include "powerdevilbackendinterface.h" ++ ++#include ++#include ++ ++#include ++ ++typedef QMap< QString, QString > StringStringMap; ++ ++class KDirWatch; ++class QTimer; ++class KNotification; ++namespace Solid { ++class Battery; ++} ++ ++namespace PowerDevil ++{ ++ ++class BackendInterface; ++class Action; ++ ++class KDE_EXPORT Core : public QObject ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(Core) ++ Q_CLASSINFO("D-Bus Interface", "org.kde.Solid.PowerManagement") ++ ++public: ++ explicit Core(QObject* parent, const KComponentData &componentData); ++ virtual ~Core(); ++ ++ void reloadProfile(int state); ++ ++ void emitNotification(const QString &evid, const QString &message = QString(), ++ const QString &iconname = "dialog-ok-apply"); ++ ++ BackendInterface *backend(); ++ ++ // More... ++ ++public Q_SLOTS: ++ void loadCore(PowerDevil::BackendInterface *backend); ++ // Set of common action - useful for the DBus interface ++ void refreshStatus(); ++ void reloadProfile(); ++ void reloadCurrentProfile(); ++ void reparseConfiguration(); ++ ++ StringStringMap availableProfiles() const; ++ ++ void loadProfile(const QString &name); ++ QString currentProfile() const; ++ ++ int brightness() const; ++ void setBrightness(int percent); ++ ++ qulonglong batteryRemainingTime() const; ++ ++ void increaseBrightness(); ++ void decreaseBrightness(); ++ ++ void suspendToRam(); ++ void suspendToDisk(); ++ void suspendHybrid(); ++ ++ void onResumeFromSuspend(); ++ ++Q_SIGNALS: ++ void coreReady(); ++ void profileChanged(const QString &newProfile); ++ void configurationReloaded(); ++ void brightnessChanged(int percent); ++ void batteryRemainingTimeChanged(qulonglong time); ++ void resumingFromSuspend(); ++ ++private: ++ void registerActionTimeout(Action *action, int timeout); ++ void unregisterActionTimeouts(Action *action); ++ ++ void triggerSuspendSession(uint action); ++ ++ friend class Action; ++ ++ BackendInterface *m_backend; ++ QStringList m_loadedBatteriesUdi; ++ ++ QWeakPointer< KNotification > notification; ++ KComponentData m_applicationData; ++ KSharedConfigPtr m_profilesConfig; ++ ++ QString m_currentProfile; ++ ++ QHash< QString, int > m_batteriesPercent; ++ ++ QTimer *m_criticalBatteryTimer; ++ ++ // Idle time management ++ QHash< int, int > m_registeredIdleTimeouts; ++ QHash< Action*, QList< int > > m_registeredActionTimeouts; ++ QList< Action* > m_pendingResumeFromIdleActions; ++ ++private Q_SLOTS: ++ void onBackendReady(); ++ void onBackendError(const QString &error); ++ void onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState); ++ void onBatteryChargePercentChanged(int,const QString&); ++ void onBrightnessChanged(float); ++ void onBatteryRemainingTimeChanged(qulonglong); ++ void onKIdleTimeoutReached(int,int); ++ void onResumingFromIdle(); ++ void onDeviceAdded(const QString &udi); ++ void onDeviceRemoved(const QString &udi); ++ void onCriticalBatteryTimerExpired(); ++ void checkBatteryStatus(); ++}; ++ ++} ++ ++Q_DECLARE_METATYPE(StringStringMap) ++ ++#endif // POWERDEVILCORE_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevil.desktop.svn-base ../powerdevil/daemon/.svn/text-base/powerdevil.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevil.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevil.desktop.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,134 @@ ++[Desktop Entry] ++Type=Service ++Icon=preferences-system-power-management ++X-KDE-ServiceTypes=KDEDModule ++X-KDE-Library=powerdevil ++X-KDE-DBus-ModuleName=powerdevil ++X-KDE-Kded-autoload=true ++X-KDE-Kded-load-on-demand=false ++X-KDE-Kded-phase=1 ++ ++Name=Power Management ++Name[ar]=إدارة الطاقة ++Name[ast]=Xestión d'enerxía ++Name[be@latin]=Kiravańnie enerhijaj ++Name[bg]=Захранване ++Name[bn]=পাওয়ার ব্যবস্থাপনা ++Name[bn_IN]=বিদ্যুৎ সরবরাহ পরিচালনা ++Name[ca]=Gestió d'energia ++Name[ca@valencia]=Gestió d'energia ++Name[cs]=Správa napájení ++Name[csb]=Sprôwianié mòcą ++Name[da]=Strømstyring ++Name[de]=Energieverwaltung ++Name[el]=Διαχείριση ενέργειας ++Name[en_GB]=Power Management ++Name[eo]=Energiadministrado ++Name[es]=Gestión de energía ++Name[et]=Toitehaldus ++Name[eu]=Energia kudeaketa ++Name[fi]=Virranhallinta ++Name[fr]=Gestion de l'énergie ++Name[fy]=Enerzjybehear ++Name[ga]=Bainisteoireacht Cumhachta ++Name[gl]=Xestión da enerxía ++Name[gu]=પાવર વ્યવસ્થાપક ++Name[he]=ניהול צריכת חשמל ++Name[hi]=बिज़ली प्रबंधन ++Name[hne]=पावर प्रबंधन ++Name[hr]=Upravljanje potrošnjom energije ++Name[hu]=Energiakezelő ++Name[ia]=Gestion de Energia ++Name[id]=Manajemen Daya ++Name[is]=Orkustjórnun ++Name[it]=Gestione energetica ++Name[ja]=電源管理 ++Name[kk]=Қуаттандыруды басқару ++Name[km]=ការ​គ្រប់គ្រង​ថាមពល ++Name[kn]=ವಿದ್ಯುಚ್ಛಕ್ತಿ ವ್ಯವಸ್ಥಾಪನೆ ++Name[ko]=전력 관리 ++Name[ku]=Gerînendeyê hêzê ++Name[lt]=Energijos valdymas ++Name[lv]=Energokontrole ++Name[mai]=पावर मैनेजमेंट ++Name[mk]=Менаџмент на енергија ++Name[ml]=വൈദ്യുതി നടത്തിപ്പു് ++Name[mr]=पावर व्यवस्थापन ++Name[nb]=Strømstyring ++Name[nds]=Stroomkuntrull ++Name[nl]=Energiebeheer ++Name[nn]=Straumstyring ++Name[or]=ଶକ୍ତି ପରିଚାଳନା ++Name[pa]=ਪਾਵਰ ਮੈਨਿਜਮੈਂਟ ++Name[pl]=Zarządzanie energią ++Name[pt]=Gestão de Energia ++Name[pt_BR]=Gerenciamento de energia ++Name[ro]=Gestiune energie ++Name[ru]=Управление питанием ++Name[si]=බල පරිපාලනය ++Name[sk]=Správa napájania ++Name[sl]=Upravljanje z energijo ++Name[sr]=Управљање напајањем ++Name[sr@ijekavian]=Управљање напајањем ++Name[sr@ijekavianlatin]=Upravljanje napajanjem ++Name[sr@latin]=Upravljanje napajanjem ++Name[sv]=Strömsparhantering ++Name[ta]=Power Management ++Name[tg]=Идоракунии барқ ++Name[th]=การจัดการพลังงาน ++Name[tr]=Güç Yönetimi ++Name[uk]=Керування живленням ++Name[wa]=Manaedjmint di l' enerdjeye ++Name[x-test]=xxPower Managementxx ++Name[zh_CN]=电源管理 ++Name[zh_TW]=電源管理 ++ ++Comment=Battery, Display and CPU power management and notification ++Comment[ar]=إدارة طاقة وإشعارات البطارية والشاشة والمعالج ++Comment[ast]=Xestión y notificaciones d'enerxía de la batería, pantalla y CPU ++Comment[ca]=Gestió d'energia i notificació de la bateria, pantalla i CPU ++Comment[ca@valencia]=Gestió d'energia i notificació de la bateria, pantalla i CPU ++Comment[cs]=Správa a oznamování baterie, zobrazení a výkonu CPU ++Comment[da]=Bekendtgørelser om strømstyring for batteri, skærm og CPU ++Comment[de]=Akku-, Anzeige- und Prozessorleistungsverwaltung und -benachrichtigung ++Comment[el]=Μπαταρία, Εμφάνιση και διαχείριση ενέργειας και ειδοποιήσεων ΚΜΕ ++Comment[en_GB]=Battery, Display and CPU power management and notification ++Comment[es]=Gestión y notificaciones de energía de la batería, pantalla y CPU ++Comment[et]=Aku, monitori ja protsessori toitehaldus ja märguanded ++Comment[eu]=Bateria, pantaila eta PUZ energia kudeaketa eta jakinarazpena ++Comment[fi]=Akun, näytön ja suorittimen virranhallinta ja huomautukset ++Comment[fr]=Gestion et notifications pour les batteries, l'affichage et la gestion de l'énergie du processeur ++Comment[he]=ניהול והתרעות הספק סוללה, תצוגה ומעבד ++Comment[hr]=Upravljanje potrošnjom energije baterije, ekrana i CPU-a i pripadajućim obavijestima. ++Comment[ia]=Batteria, Monstrator, Gestion de energia e notification ++Comment[id]=Baterai, Tampilan dan manajemen daya CPU dan notifikasi ++Comment[it]=Gestione e notifica di batteria, schermo e consumo del processore ++Comment[ja]=バッテリ、ディスプレイ、CPU の電源管理と通知 ++Comment[kk]=Батарея, дисплей, процесорын қуаттаныруын басқару және олs туралы құлақтандыру ++Comment[km]=ថ្ម បង្ហាញ​ការ​ជូនដំណឹង និង​គ្រប់គ្រង​ថាមពល​ស៊ីភីយូ ++Comment[ko]=배터리, 디스플레이, CPU 전원 관리 및 알림 ++Comment[lt]=Baterijos, Monitoriaus ir CPU energijos valdymas ir pranešimai ++Comment[lv]=Baterijas, ekrāna un procesora enerģijas pārvaldība un paziņojumi ++Comment[nb]=Håndtering og varsling for strømstyring av batteri, skjerm og prosessor ++Comment[nds]=Batterie-, Schirm- un Perzesser-Stroomkuntrull un -Bescheden ++Comment[nl]=Energiebeheer voor batterij, scherm en CPU en meldingen ++Comment[pa]=ਬੈਟਰੀ, ਡਿਸਪਲੇਅ ਤੇ CPU ਪਾਵਰ ਪਰਬੰਧ ਤੇ ਨੋਟੀਫਿਕੇਸ਼ਨ ++Comment[pl]=Zarządzanie i powiadomienia o stanie akumulatora, wyświetlacza i zasilania procesora ++Comment[pt]=Gestão e notificação da energia, do ecrã e do CPU ++Comment[pt_BR]=Gerenciamento e notificação de energia, da tela e do CPU ++Comment[ru]=Настройка яркости экрана, режима ожидания и питания ++Comment[si]=බැටරි, ප්‍රදර්ශන සහ CPU බලශක්ති කළමනාකරනය සහ දැනුම්දීම ++Comment[sk]=Správa napájania a upozornenia batérie, obrazovky a CPU ++Comment[sl]=Upravljanje in obveščanje o porabi energije baterije, zaslona in procesorja ++Comment[sr]=Обавештавање и управљање батеријом и напајањем екрана и процесора ++Comment[sr@ijekavian]=Обавјештавање и управљање батеријом и напајањем екрана и процесора ++Comment[sr@ijekavianlatin]=Obavještavanje i upravljanje baterijom i napajanjem ekrana i procesora ++Comment[sr@latin]=Obaveštavanje i upravljanje baterijom i napajanjem ekrana i procesora ++Comment[sv]=Hantering och underrättelser om batteri, skärm och processorkraft ++Comment[tg]=Батарея, Экран ва идоракунии манбаъи CPU ва огоҳӣ ++Comment[th]=การจัดการพลังงานของ แบตเตอรี, ส่วนแสดงผล และซีพียู รวมถึงการแจ้งให้ทราบ ++Comment[tr]=Pil, Ekran ve CPU güç yönetimi ve bildirimler ++Comment[uk]=Керування та сповіщення про стан акумуляторів та живлення дисплея і процесора ++Comment[x-test]=xxBattery, Display and CPU power management and notificationxx ++Comment[zh_CN]=电池、显示器和 CPU 电源管理及通知 ++Comment[zh_TW]=電池、顯示與 CPU 電力管理與通知 +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilfdoconnector.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilfdoconnector.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilfdoconnector.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilfdoconnector.cpp.svn-base 2010-12-12 14:48:46.880000001 -0800 +@@ -0,0 +1,114 @@ ++/*************************************************************************** ++ * Copyright (C) 2008 by Kevin Ottens * ++ * Copyright (C) 2008-2010 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 "powerdevilfdoconnector.h" ++ ++#include "powerdevilcore.h" ++ ++#include "powermanagementfdoadaptor.h" ++#include "powermanagementinhibitadaptor.h" ++ ++namespace PowerDevil { ++ ++FdoConnector::FdoConnector(PowerDevil::Core *parent) ++ : QObject(parent), m_core(parent) ++{ ++ new PowerManagementFdoAdaptor(this); ++ new PowerManagementInhibitAdaptor(this); ++ ++ QDBusConnection c = QDBusConnection::sessionBus(); ++ ++ c.registerService("org.freedesktop.PowerManagement"); ++ c.registerObject("/org/freedesktop/PowerManagement", this); ++ ++ c.registerService("org.freedesktop.PowerManagement.Inhibit"); ++ c.registerObject("/org/freedesktop/PowerManagement/Inhibit", this); ++ ++ connect(m_core->backend(), SIGNAL(acAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState)), ++ this, SLOT(onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState))); ++ connect(PolicyAgent::instance(), SIGNAL(unavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies)), ++ this, SLOT(onUnavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies))); ++} ++ ++bool FdoConnector::CanHibernate() ++{ ++ return m_core->backend()->supportedSuspendMethods() & PowerDevil::BackendInterface::ToDisk; ++} ++ ++bool FdoConnector::CanSuspend() ++{ ++ return m_core->backend()->supportedSuspendMethods() & PowerDevil::BackendInterface::ToRam; ++} ++ ++bool FdoConnector::GetPowerSaveStatus() ++{ ++ return m_core->backend()->acAdapterState() == PowerDevil::BackendInterface::Unplugged; ++} ++ ++void FdoConnector::Suspend() ++{ ++ m_core->suspendToRam(); ++} ++ ++void FdoConnector::Hibernate() ++{ ++ m_core->suspendToDisk(); ++} ++ ++bool FdoConnector::HasInhibit() ++{ ++ return PolicyAgent::instance()->requirePolicyCheck(PolicyAgent::InterruptSession) != PolicyAgent::None; ++} ++ ++int FdoConnector::Inhibit(const QString &application, const QString &reason) ++{ ++ // Inhibit here means we cannot interrupt the session. ++ // If we've been called from DBus, use PolicyAgent's service watching system ++ if (calledFromDBus()) { ++ return PolicyAgent::instance()->addInhibitionWithExplicitDBusService((uint)PolicyAgent::InterruptSession, ++ application, reason, message().service()); ++ } else { ++ return PolicyAgent::instance()->AddInhibition((uint)PolicyAgent::InterruptSession, application, reason); ++ } ++} ++ ++void FdoConnector::UnInhibit(int cookie) ++{ ++ PolicyAgent::instance()->ReleaseInhibition(cookie); ++} ++ ++void FdoConnector::ForceUnInhibitAll() ++{ ++ PolicyAgent::instance()->releaseAllInhibitions(); ++} ++ ++void FdoConnector::onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState newstate) ++{ ++ emit PowerSaveStatusChanged(newstate == PowerDevil::BackendInterface::Unplugged); ++} ++ ++void FdoConnector::onUnavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies newpolicies) ++{ ++ emit HasInhibitChanged(newpolicies & PowerDevil::PolicyAgent::InterruptSession); ++} ++ ++} ++ ++#include "powerdevilfdoconnector.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilfdoconnector.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilfdoconnector.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilfdoconnector.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilfdoconnector.h.svn-base 2010-12-12 14:48:46.920000000 -0800 +@@ -0,0 +1,74 @@ ++/*************************************************************************** ++ * Copyright (C) 2008 by Kevin Ottens * ++ * Copyright (C) 2008-2010 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 POWERDEVILFDOCONNECTOR_H ++#define POWERDEVILFDOCONNECTOR_H ++ ++#include ++ ++#include "powerdevilbackendinterface.h" ++#include "powerdevilpolicyagent.h" ++ ++namespace PowerDevil { ++class Core; ++ ++class FdoConnector : public QObject, protected QDBusContext ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(FdoConnector) ++ ++ Q_CLASSINFO("D-Bus Interface", "org.freedesktop.PowerManagement") ++ Q_CLASSINFO("D-Bus Interface", "org.freedesktop.PowerManagement.Inhibit") ++ ++public: ++ FdoConnector(PowerDevil::Core *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(); ++ ++Q_SIGNALS: ++ void CanSuspendChanged(bool canSuspend); ++ void CanHibernateChanged(bool canHibernate); ++ void PowerSaveStatusChanged(bool savePower); ++ ++ void HasInhibitChanged(bool hasInhibit); ++ ++private Q_SLOTS: ++ void onAcAdapterStateChanged(PowerDevil::BackendInterface::AcAdapterState); ++ void onUnavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies); ++ ++private: ++ PowerDevil::Core *m_core; ++}; ++ ++} ++ ++#endif /*POWERDEVILFDOCONNECTOR_H*/ +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilpolicyagent.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilpolicyagent.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilpolicyagent.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilpolicyagent.cpp.svn-base 2010-12-12 14:48:46.880000001 -0800 +@@ -0,0 +1,306 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilpolicyagent.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++namespace PowerDevil ++{ ++ ++class PolicyAgentHelper ++{ ++public: ++ PolicyAgentHelper() : q(0) {} ++ ~PolicyAgentHelper() { ++ delete q; ++ } ++ PolicyAgent *q; ++}; ++ ++K_GLOBAL_STATIC(PolicyAgentHelper, s_globalPolicyAgent) ++ ++PolicyAgent *PolicyAgent::instance() ++{ ++ if (!s_globalPolicyAgent->q) { ++ new PolicyAgent; ++ } ++ ++ return s_globalPolicyAgent->q; ++} ++ ++PolicyAgent::PolicyAgent(QObject* parent) ++ : QObject(parent) ++ , m_sessionIsBeingInterrupted(false) ++ , m_lastCookie(0) ++ , m_busWatcher(new QDBusServiceWatcher(this)) ++{ ++ Q_ASSERT(!s_globalPolicyAgent->q); ++ s_globalPolicyAgent->q = this; ++} ++ ++PolicyAgent::~PolicyAgent() ++{ ++ ++} ++ ++void PolicyAgent::init() ++{ ++ // Let's cache the needed information to check if our session is actually active ++ if (!QDBusConnection::systemBus().interface()->isServiceRegistered("org.freedesktop.ConsoleKit")) { ++ // No way to determine if we are on the current session, simply suppose we are ++ kDebug() << "Can't contact ck"; ++ m_ckAvailable = false; ++ return; ++ } else { ++ m_ckAvailable = true; ++ } ++ ++ // Otherwise, let's ask ConsoleKit ++ QDBusInterface ckiface("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", ++ "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus()); ++ ++ QDBusPendingReply sessionPath = ckiface.asyncCall("GetCurrentSession"); ++ ++ sessionPath.waitForFinished(); ++ ++ if (!sessionPath.isValid() || sessionPath.value().path().isEmpty()) { ++ kDebug() << "The session is not registered with ck"; ++ m_ckAvailable = false; ++ return; ++ } ++ ++ m_ckSessionInterface = new QDBusInterface("org.freedesktop.ConsoleKit", sessionPath.value().path(), ++ "org.freedesktop.ConsoleKit.Session", QDBusConnection::systemBus()); ++ ++ if (!m_ckSessionInterface->isValid()) { ++ // As above ++ kDebug() << "Can't contact iface"; ++ m_ckAvailable = false; ++ return; ++ } ++ ++ // Now set up our service watcher ++ m_busWatcher.data()->setConnection(QDBusConnection::sessionBus()); ++ m_busWatcher.data()->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); ++ ++ connect(m_busWatcher.data(), SIGNAL(serviceUnregistered(QString)), ++ this, SLOT(onServiceUnregistered(QString))); ++} ++ ++void PolicyAgent::onServiceUnregistered(const QString& serviceName) ++{ ++ if (m_cookieToBusService.values().contains(serviceName)) { ++ // Ouch - the application quit or crashed without releasing its inhibitions. Let's fix that. ++ ReleaseInhibition(m_cookieToBusService.key(serviceName)); ++ } ++} ++ ++PolicyAgent::RequiredPolicies PolicyAgent::unavailablePolicies() ++{ ++ RequiredPolicies retpolicies = None; ++ ++ if (!m_typesToCookie[ChangeProfile].isEmpty()) { ++ retpolicies |= ChangeProfile; ++ } ++ if (!m_typesToCookie[ChangeScreenSettings].isEmpty()) { ++ retpolicies |= ChangeScreenSettings; ++ } ++ if (!m_typesToCookie[InterruptSession].isEmpty()) { ++ retpolicies |= InterruptSession; ++ } ++ ++ return retpolicies; ++} ++ ++PolicyAgent::RequiredPolicies PolicyAgent::requirePolicyCheck(PolicyAgent::RequiredPolicies policies) ++{ ++ if (!m_ckAvailable) { ++ // No way to determine if we are on the current session, simply suppose we are ++ kDebug() << "Can't contact ck"; ++ } else { ++ QDBusPendingReply< bool > rp = m_ckSessionInterface->asyncCall("IsActive"); ++ rp.waitForFinished(); ++ ++ if (!rp.value()) { ++ return policies; ++ } ++ } ++ ++ // Ok, let's go then ++ RequiredPolicies retpolicies = None; ++ ++ if (policies & ChangeProfile) { ++ if (!m_typesToCookie[ChangeProfile].isEmpty()) { ++ retpolicies |= ChangeProfile; ++ } ++ } ++ if (policies & ChangeScreenSettings) { ++ if (!m_typesToCookie[ChangeScreenSettings].isEmpty()) { ++ retpolicies |= ChangeScreenSettings; ++ } ++ } ++ if (policies & InterruptSession) { ++ if (m_sessionIsBeingInterrupted || !m_typesToCookie[InterruptSession].isEmpty()) { ++ retpolicies |= InterruptSession; ++ } ++ } ++ ++ return retpolicies; ++} ++ ++void PolicyAgent::startSessionInterruption() ++{ ++ m_sessionIsBeingInterrupted = true; ++} ++ ++void PolicyAgent::finishSessionInterruption() ++{ ++ m_sessionIsBeingInterrupted = false; ++} ++ ++uint PolicyAgent::addInhibitionWithExplicitDBusService(uint types, const QString& appName, ++ const QString& reason, const QString& service) ++{ ++ ++m_lastCookie; ++ ++ m_cookieToAppName.insert(m_lastCookie, qMakePair(appName, reason)); ++ ++ if (!m_busWatcher.isNull() && !service.isEmpty()) { ++ m_cookieToBusService.insert(m_lastCookie, service); ++ m_busWatcher.data()->addWatchedService(service); ++ } ++ ++ addInhibitionTypeHelper(m_lastCookie, static_cast< PolicyAgent::RequiredPolicies >(types)); ++ ++ return m_lastCookie; ++} ++ ++uint PolicyAgent::AddInhibition(uint types, ++ const QString& appName, ++ const QString& reason) ++{ ++ ++m_lastCookie; ++ ++ m_cookieToAppName.insert(m_lastCookie, qMakePair(appName, reason)); ++ ++ // Retrieve the service, if we've been called from DBus ++ if (calledFromDBus() && !m_busWatcher.isNull()) { ++ if (!message().service().isEmpty()) { ++ m_cookieToBusService.insert(m_lastCookie, message().service()); ++ m_busWatcher.data()->addWatchedService(message().service()); ++ } ++ } ++ ++ addInhibitionTypeHelper(m_lastCookie, static_cast< PolicyAgent::RequiredPolicies >(types)); ++ ++ return m_lastCookie; ++} ++ ++void PolicyAgent::addInhibitionTypeHelper(uint cookie, PolicyAgent::RequiredPolicies types) ++{ ++ // Look through all of the inhibition types ++ bool notify = false; ++ if (types & ChangeProfile) { ++ // Check if we have to notify ++ if (m_typesToCookie[ChangeProfile].isEmpty()) { ++ notify = true; ++ } ++ m_typesToCookie[ChangeProfile].append(cookie); ++ } ++ if (types & ChangeScreenSettings) { ++ // Check if we have to notify ++ if (m_typesToCookie[ChangeScreenSettings].isEmpty()) { ++ notify = true; ++ } ++ m_typesToCookie[ChangeScreenSettings].append(cookie); ++ } ++ if (types & ChangeProfile) { ++ // Check if we have to notify ++ if (m_typesToCookie[InterruptSession].isEmpty()) { ++ notify = true; ++ } ++ m_typesToCookie[InterruptSession].append(cookie); ++ } ++ ++ if (notify) { ++ // Emit the signal - inhibition has changed ++ emit unavailablePoliciesChanged(unavailablePolicies()); ++ } ++} ++ ++void PolicyAgent::ReleaseInhibition(uint cookie) ++{ ++ m_cookieToAppName.remove(cookie); ++ if (m_cookieToBusService.contains(cookie)) { ++ if (!m_busWatcher.isNull()) { ++ m_busWatcher.data()->removeWatchedService(m_cookieToBusService[cookie]); ++ } ++ m_cookieToBusService.remove(cookie); ++ } ++ ++ // Look through all of the inhibition types ++ bool notify = false; ++ if (m_typesToCookie[ChangeProfile].contains(cookie)) { ++ m_typesToCookie[ChangeProfile].removeOne(cookie); ++ // Check if we have to notify ++ if (m_typesToCookie[ChangeProfile].isEmpty()) { ++ notify = true; ++ } ++ } ++ if (m_typesToCookie[ChangeScreenSettings].contains(cookie)) { ++ m_typesToCookie[ChangeScreenSettings].removeOne(cookie); ++ // Check if we have to notify ++ if (m_typesToCookie[ChangeScreenSettings].isEmpty()) { ++ notify = true; ++ } ++ } ++ if (m_typesToCookie[InterruptSession].contains(cookie)) { ++ m_typesToCookie[InterruptSession].removeOne(cookie); ++ // Check if we have to notify ++ if (m_typesToCookie[InterruptSession].isEmpty()) { ++ notify = true; ++ } ++ } ++ ++ if (notify) { ++ // Emit the signal - inhibition has changed ++ emit unavailablePoliciesChanged(unavailablePolicies()); ++ } ++} ++ ++void PolicyAgent::releaseAllInhibitions() ++{ ++ QList< uint > allCookies = m_cookieToAppName.keys(); ++ foreach (uint cookie, allCookies) { ++ ReleaseInhibition(cookie); ++ } ++} ++ ++} ++ ++#include "powerdevilpolicyagent.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilpolicyagent.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilpolicyagent.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilpolicyagent.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilpolicyagent.h.svn-base 2010-12-12 14:48:46.880000001 -0800 +@@ -0,0 +1,110 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_POWERDEVILPOLICYAGENT_H ++#define POWERDEVIL_POWERDEVILPOLICYAGENT_H ++ ++#include ++#include ++#include ++ ++#include ++ ++#include ++ ++class QDBusServiceWatcher; ++class QDBusInterface; ++ ++namespace PowerDevil ++{ ++ ++class KDE_EXPORT PolicyAgent : public QObject, protected QDBusContext ++{ ++ Q_OBJECT ++ Q_DISABLE_COPY(PolicyAgent) ++ ++ Q_CLASSINFO("D-Bus Interface", "org.kde.Solid.PowerManagement.PolicyAgent") ++ ++public: ++ enum RequiredPolicy { ++ None = 0, ++ InterruptSession = 1, ++ ChangeProfile = 2, ++ ChangeScreenSettings = 4 ++ }; ++ Q_DECLARE_FLAGS(RequiredPolicies, RequiredPolicy) ++ ++ static PolicyAgent *instance(); ++ ++ virtual ~PolicyAgent(); ++ ++ /** ++ * This function performs a policy check on given policies, and returns a set of unsatisfiable policies, ++ * or \c None if all the policies are satisfiable and the action can be carried on. ++ */ ++ RequiredPolicies requirePolicyCheck(RequiredPolicies policies); ++ ++ RequiredPolicies unavailablePolicies(); ++ ++public Q_SLOTS: ++ // Exported slots ++ uint AddInhibition(uint types, const QString &appName, const QString &reason); ++ void ReleaseInhibition(uint cookie); ++ ++ void releaseAllInhibitions(); ++ ++Q_SIGNALS: ++ void unavailablePoliciesChanged(PowerDevil::PolicyAgent::RequiredPolicies newpolicies); ++ ++private Q_SLOTS: ++ void onServiceUnregistered(const QString &serviceName); ++ ++private: ++ explicit PolicyAgent(QObject* parent = 0); ++ ++ void init(); ++ void startSessionInterruption(); ++ void finishSessionInterruption(); ++ ++ void addInhibitionTypeHelper(uint cookie, RequiredPolicies types); ++ ++ // This function serves solely for fd.o connector ++ uint addInhibitionWithExplicitDBusService(uint types, const QString &appName, ++ const QString &reason, const QString &service); ++ ++ bool m_ckAvailable; ++ QDBusInterface *m_ckSessionInterface; ++ bool m_sessionIsBeingInterrupted; ++ ++ QHash< uint, QPair< QString, QString > > m_cookieToAppName; ++ QHash< uint, QString > m_cookieToBusService; ++ QHash< RequiredPolicy, QList< uint > > m_typesToCookie; ++ ++ uint m_lastCookie; ++ ++ QWeakPointer< QDBusServiceWatcher > m_busWatcher; ++ ++ friend class Core; ++ friend class FdoConnector; ++}; ++ ++} ++ ++#endif // POWERDEVIL_POWERDEVILPOLICYAGENT_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilprofilegenerator.cpp.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilprofilegenerator.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilprofilegenerator.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilprofilegenerator.cpp.svn-base 2010-12-12 14:48:46.846666668 -0800 +@@ -0,0 +1,304 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 "powerdevilprofilegenerator.h" ++ ++#include ++ ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace PowerDevil { ++ ++ProfileGenerator::GeneratorResult ProfileGenerator::generateProfiles(bool tryUpgrade) ++{ ++ if (tryUpgrade) { ++ KSharedConfigPtr oldProfilesConfig = KSharedConfig::openConfig("powerdevilprofilesrc", KConfig::SimpleConfig); ++ if (!oldProfilesConfig->groupList().isEmpty()) { ++ // We can upgrade, let's do that. ++ upgradeProfiles(); ++ return ResultUpgraded; ++ } ++ } ++ QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); ++ ++ // Let's change some defaults ++ if (!methods.contains(Solid::PowerManagement::SuspendState)) { ++ if (!methods.contains(Solid::PowerManagement::HibernateState)) { ++ PowerDevilSettings::setBatteryCriticalAction(0); ++ } else { ++ PowerDevilSettings::setBatteryCriticalAction(2); ++ } ++ } ++ ++ // Ok, let's get our config file. ++ KSharedConfigPtr profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig); ++ ++ // And clear it ++ foreach (const QString &group, profilesConfig->groupList()) { ++ profilesConfig->deleteGroup(group); ++ } ++ ++ // Let's start: performance profile before anything else ++ KConfigGroup performance(profilesConfig, "Performance"); ++ performance.writeEntry("icon", "preferences-system-performance"); ++ ++ // We want to dim the screen after a while, definitely ++ { ++ KConfigGroup dimDisplay(&performance, "DimDisplay"); ++ dimDisplay.writeEntry< int >("idleTime", 1800000); ++ } ++ // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) ++ { ++ KConfigGroup handleButtonEvents(&performance, "HandleButtonEvents"); ++ handleButtonEvents.writeEntry< uint >("powerButtonAction", 5); ++ if (methods.contains(Solid::PowerManagement::SuspendState)) { ++ handleButtonEvents.writeEntry< uint >("sleepButtonAction", 1); ++ handleButtonEvents.writeEntry< uint >("lidAction", 1); ++ } else { ++ handleButtonEvents.writeEntry< uint >("sleepButtonAction", 0); ++ handleButtonEvents.writeEntry< uint >("lidAction", 6); ++ } ++ } ++ // And we also want to turn off the screen after another long while ++ { ++ KConfigGroup dpmsControl(&performance, "DPMSControl"); ++ dpmsControl.writeEntry< uint >("idleTime", 3600000); ++ } ++ ++ // Assign the profile, of course! ++ PowerDevilSettings::setACProfile(performance.name()); ++ ++ // Easy part done. Now, any batteries? ++ int batteryCount = 0; ++ ++ foreach(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) { ++ Solid::Device dev = device; ++ Solid::Battery *b = qobject_cast (dev.asDeviceInterface(Solid::DeviceInterface::Battery)); ++ if (b->type() != Solid::Battery::PrimaryBattery && b->type() != Solid::Battery::UpsBattery) { ++ continue; ++ } ++ ++batteryCount; ++ } ++ ++ if (batteryCount > 0) { ++ // Ok, we need a pair more profiles: powersave and aggressive powersave. ++ // Also, now we want to handle brightness in performance. ++ { ++ KConfigGroup brightnessControl(&performance, "BrightnessControl"); ++ brightnessControl.writeEntry< int >("value", 90); ++ } ++ ++ // Powersave ++ KConfigGroup powersave(profilesConfig, "Powersave"); ++ powersave.writeEntry("icon", "preferences-system-power-management"); ++ // Less brightness. ++ { ++ KConfigGroup brightnessControl(&powersave, "BrightnessControl"); ++ brightnessControl.writeEntry< int >("value", 60); ++ } ++ // We want to dim the screen after a while, definitely ++ { ++ KConfigGroup dimDisplay(&powersave, "DimDisplay"); ++ dimDisplay.writeEntry< int >("idleTime", 300000); ++ } ++ // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) ++ { ++ KConfigGroup handleButtonEvents(&powersave, "HandleButtonEvents"); ++ handleButtonEvents.writeEntry< uint >("powerButtonAction", 5); ++ if (methods.contains(Solid::PowerManagement::SuspendState)) { ++ handleButtonEvents.writeEntry< uint >("sleepButtonAction", 1); ++ handleButtonEvents.writeEntry< uint >("lidAction", 1); ++ } else { ++ handleButtonEvents.writeEntry< uint >("sleepButtonAction", 0); ++ handleButtonEvents.writeEntry< uint >("lidAction", 6); ++ } ++ } ++ // We want to turn off the screen after another while ++ { ++ KConfigGroup dpmsControl(&powersave, "DPMSControl"); ++ dpmsControl.writeEntry< uint >("idleTime", 600000); ++ } ++ // Last but not least, we want to suspend after a rather long period of inactivity ++ if (methods.contains(Solid::PowerManagement::SuspendState) || methods.contains(Solid::PowerManagement::HibernateState)) { ++ KConfigGroup suspendSession(&powersave, "SuspendSession"); ++ suspendSession.writeEntry< uint >("idleTime", 900000); ++ if (!methods.contains(Solid::PowerManagement::SuspendState)) { ++ suspendSession.writeEntry< uint >("suspendType", 2); ++ } else { ++ suspendSession.writeEntry< uint >("suspendType", 1); ++ } ++ } ++ ++ ++ // Ok, now for aggressive powersave ++ KConfigGroup aggrPowersave(profilesConfig, "Aggressive powersave"); ++ aggrPowersave.writeEntry("icon", "battery-low"); ++ // Less brightness. ++ { ++ KConfigGroup brightnessControl(&aggrPowersave, "BrightnessControl"); ++ brightnessControl.writeEntry< int >("value", 30); ++ } ++ // We want to dim the screen after a while, definitely ++ { ++ KConfigGroup dimDisplay(&aggrPowersave, "DimDisplay"); ++ dimDisplay.writeEntry< int >("idleTime", 120000); ++ } ++ // Show the dialog when power button is pressed and suspend on suspend button pressed and lid closed (if supported) ++ { ++ KConfigGroup handleButtonEvents(&aggrPowersave, "HandleButtonEvents"); ++ handleButtonEvents.writeEntry< uint >("powerButtonAction", 5); ++ if (methods.contains(Solid::PowerManagement::SuspendState)) { ++ handleButtonEvents.writeEntry< uint >("sleepButtonAction", 1); ++ handleButtonEvents.writeEntry< uint >("lidAction", 1); ++ } else { ++ handleButtonEvents.writeEntry< uint >("sleepButtonAction", 0); ++ handleButtonEvents.writeEntry< uint >("lidAction", 6); ++ } ++ } ++ // We want to turn off the screen after another while ++ { ++ KConfigGroup dpmsControl(&aggrPowersave, "DPMSControl"); ++ dpmsControl.writeEntry< uint >("idleTime", 300000); ++ } ++ // Last but not least, we want to suspend after a rather long period of inactivity ++ if (methods.contains(Solid::PowerManagement::SuspendState) || methods.contains(Solid::PowerManagement::HibernateState)) { ++ KConfigGroup suspendSession(&aggrPowersave, "SuspendSession"); ++ suspendSession.writeEntry< uint >("idleTime", 600000); ++ if (!methods.contains(Solid::PowerManagement::SuspendState)) { ++ suspendSession.writeEntry< uint >("suspendType", 2); ++ } else { ++ suspendSession.writeEntry< uint >("suspendType", 1); ++ } ++ } ++ ++ // Assign profiles ++ PowerDevilSettings::setBatteryProfile(powersave.name()); ++ PowerDevilSettings::setLowProfile(aggrPowersave.name()); ++ PowerDevilSettings::setWarningProfile(aggrPowersave.name()); ++ } ++ ++ // Save and be happy ++ PowerDevilSettings::self()->writeConfig(); ++ profilesConfig->sync(); ++ ++ return ResultGenerated; ++} ++ ++void ProfileGenerator::upgradeProfiles() ++{ ++ QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); ++ ++ // Let's change some defaults ++ if (!methods.contains(Solid::PowerManagement::SuspendState)) { ++ if (!methods.contains(Solid::PowerManagement::HibernateState)) { ++ PowerDevilSettings::setBatteryCriticalAction(0); ++ } else { ++ PowerDevilSettings::setBatteryCriticalAction(2); ++ } ++ } ++ ++ // Ok, let's get our config file. ++ KSharedConfigPtr profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig); ++ KSharedConfigPtr oldProfilesConfig = KSharedConfig::openConfig("powerdevilprofilesrc", KConfig::SimpleConfig); ++ ++ // And clear it ++ foreach (const QString &group, profilesConfig->groupList()) { ++ profilesConfig->deleteGroup(group); ++ } ++ ++ foreach (const QString &group, oldProfilesConfig->groupList()) { ++ KConfigGroup oldGroup = oldProfilesConfig->group(group); ++ KConfigGroup newGroup(profilesConfig, oldGroup.readEntry< QString >("name", QString())); ++ ++ // Read stuff ++ // Brightness. ++ { ++ KConfigGroup brightnessControl(&newGroup, "BrightnessControl"); ++ brightnessControl.writeEntry< int >("value", oldGroup.readEntry< int >("brightness", 100)); ++ } ++ // Dim screen ++ if (oldGroup.readEntry< bool >("dimOnIdle", false)) { ++ KConfigGroup dimDisplay(&newGroup, "DimDisplay"); ++ dimDisplay.writeEntry< int >("idleTime", oldGroup.readEntry< int >("dimOnIdleTime", 30) * 60 * 1000); ++ } ++ // DPMS ++ if (oldGroup.readEntry< bool >("DPMSEnabled", false) && oldGroup.readEntry< int >("DPMSPowerOff", 0) > 0) { ++ KConfigGroup dpmsControl(&newGroup, "DPMSControl"); ++ dpmsControl.writeEntry< uint >("idleTime", oldGroup.readEntry< int >("DPMSPowerOff", 30) * 60 * 1000); ++ } ++ // Script ++ if (!oldGroup.readEntry< QString >("scriptpath", QString()).isEmpty()) { ++ KConfigGroup runScript(&newGroup, "RunScript"); ++ runScript.writeEntry< QString >("scriptCommand", oldGroup.readEntry< QString >("scriptpath", QString())); ++ runScript.writeEntry< uint >("scriptPhase", 0); ++ } ++ // SuspendSession ++ if (oldGroup.readEntry< int >("idleAction", 0) > 0) { ++ KConfigGroup suspendSession(&newGroup, "SuspendSession"); ++ suspendSession.writeEntry< uint >("idleTime", oldGroup.readEntry< int >("idleTime", 30) * 60 * 1000); ++ if (!methods.contains(Solid::PowerManagement::SuspendState)) { ++ suspendSession.writeEntry< uint >("suspendType", 2); ++ } else { ++ suspendSession.writeEntry< uint >("suspendType", 1); ++ } ++ } ++ // Buttons ++ if (oldGroup.readEntry< int >("powerButtonAction", 0) > 0 || oldGroup.readEntry< int >("lidAction", 0) > 0) { ++ KConfigGroup suspendSession(&newGroup, "SuspendSession"); ++ suspendSession.writeEntry< uint >("idleTime", oldGroup.readEntry< int >("idleTime", 30) * 60 * 1000); ++ if (!methods.contains(Solid::PowerManagement::SuspendState)) { ++ suspendSession.writeEntry< uint >("suspendType", 2); ++ } else { ++ suspendSession.writeEntry< uint >("suspendType", 1); ++ } ++ } ++ } ++ ++ // Save and be happy ++ profilesConfig->sync(); ++ ++ // We also want to backup and erase the old profiles. ++ QString oldProfilesFile = KGlobal::dirs()->findResource("config", "powerdevilprofilesrc"); ++ if (!oldProfilesFile.isEmpty()) { ++ // Backup ++ QString bkProfilesFile = oldProfilesFile; ++ bkProfilesFile.append(".old"); ++ KConfig *bkConfig = oldProfilesConfig->copyTo(bkProfilesFile); ++ if (bkConfig != 0) { ++ bkConfig->sync(); ++ delete bkConfig; ++ ++ // Delete the old profiles now. ++ QFile::remove(oldProfilesFile); ++ } ++ } ++} ++ ++} +diff -Naur kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilprofilegenerator.h.svn-base ../powerdevil/daemon/.svn/text-base/powerdevilprofilegenerator.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//daemon/.svn/text-base/powerdevilprofilegenerator.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/daemon/.svn/text-base/powerdevilprofilegenerator.h.svn-base 2010-12-12 14:48:46.850000001 -0800 +@@ -0,0 +1,40 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 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 POWERDEVIL_PROFILEGENERATOR_H ++#define POWERDEVIL_PROFILEGENERATOR_H ++ ++class KComponentData; ++namespace PowerDevil { ++ ++namespace ProfileGenerator ++{ ++ enum GeneratorResult { ++ ResultFailed = 0, ++ ResultGenerated = 1, ++ ResultUpgraded = 2 ++ }; ++ ++ GeneratorResult generateProfiles(bool tryUpgrade = false); ++ void upgradeProfiles(); ++} ++ ++} ++ ++#endif // POWERDEVIL_PROFILEGENERATOR_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/GeneralPage.cpp ../powerdevil/kcmodule/global/GeneralPage.cpp +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/GeneralPage.cpp 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/kcmodule/global/GeneralPage.cpp 2010-12-12 14:48:46.930000002 -0800 +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -39,9 +40,14 @@ + ) + K_EXPORT_PLUGIN(PowerDevilGeneralKCMFactory("powerdevilglobalconfig","powerdevil")) + ++typedef QMap< QString, QString > StringStringMap; ++Q_DECLARE_METATYPE(StringStringMap) ++ + GeneralPage::GeneralPage(QWidget *parent, const QVariantList &args) + : KCModule(PowerDevilGeneralKCMFactory::componentData(), parent, args) + { ++ qDBusRegisterMetaType< StringStringMap >(); ++ + setButtons(Apply | Help); + + KAboutData *about = +@@ -139,10 +145,10 @@ + + BatteryCriticalCombo->setCurrentIndex(BatteryCriticalCombo->findData(PowerDevilSettings::batteryCriticalAction())); + +- acProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::aCProfile())); +- lowProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::lowProfile())); +- warningProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::warningProfile())); +- batteryProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::batteryProfile())); ++ acProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::aCProfile())); ++ lowProfile->setCurrentIndex(lowProfile->findData(PowerDevilSettings::lowProfile())); ++ warningProfile->setCurrentIndex(warningProfile->findData(PowerDevilSettings::warningProfile())); ++ batteryProfile->setCurrentIndex(batteryProfile->findData(PowerDevilSettings::batteryProfile())); + } + + void GeneralPage::configureNotifications() +@@ -160,10 +166,10 @@ + + PowerDevilSettings::setBatteryCriticalAction(BatteryCriticalCombo->itemData(BatteryCriticalCombo->currentIndex()).toInt()); + +- PowerDevilSettings::setACProfile(acProfile->currentText()); +- PowerDevilSettings::setLowProfile(lowProfile->currentText()); +- PowerDevilSettings::setWarningProfile(warningProfile->currentText()); +- PowerDevilSettings::setBatteryProfile(batteryProfile->currentText()); ++ PowerDevilSettings::setACProfile(acProfile->itemData(acProfile->currentIndex()).toString()); ++ PowerDevilSettings::setLowProfile(lowProfile->itemData(lowProfile->currentIndex()).toString()); ++ PowerDevilSettings::setWarningProfile(warningProfile->itemData(warningProfile->currentIndex()).toString()); ++ PowerDevilSettings::setBatteryProfile(batteryProfile->itemData(batteryProfile->currentIndex()).toString()); + + PowerDevilSettings::self()->writeConfig(); + } +@@ -172,6 +178,24 @@ + { + KSharedConfigPtr profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig); + ++ // Request profiles to the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "availableProfiles"); ++ QDBusPendingReply< StringStringMap > reply = QDBusConnection::sessionBus().asyncCall(call); ++ reply.waitForFinished(); ++ ++ if (!reply.isValid()) { ++ kDebug() << "Error contacting the daemon!"; ++ return; ++ } ++ ++ StringStringMap profiles = reply.value(); ++ ++ if (profiles.isEmpty()) { ++ kDebug() << "No available profiles!"; ++ return; ++ } ++ + acProfile->clear(); + batteryProfile->clear(); + lowProfile->clear(); +@@ -182,20 +206,19 @@ + return; + } + +- foreach(const QString &ent, profilesConfig->groupList()) { +- KConfigGroup *group = new KConfigGroup(profilesConfig, ent); ++ for (StringStringMap::const_iterator i = profiles.constBegin(); i != profiles.constEnd(); ++i) { ++ KConfigGroup group(profilesConfig, i.key()); + +- acProfile->addItem(KIcon(group->readEntry("icon")), ent); +- batteryProfile->addItem(KIcon(group->readEntry("icon")), ent); +- lowProfile->addItem(KIcon(group->readEntry("icon")), ent); +- warningProfile->addItem(KIcon(group->readEntry("icon")), ent); +- delete group; ++ acProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); ++ batteryProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); ++ lowProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); ++ warningProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); + } + +- acProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::aCProfile())); +- lowProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::lowProfile())); +- warningProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::warningProfile())); +- batteryProfile->setCurrentIndex(acProfile->findText(PowerDevilSettings::batteryProfile())); ++ acProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::aCProfile())); ++ lowProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::lowProfile())); ++ warningProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::warningProfile())); ++ batteryProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::batteryProfile())); + + } + +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/entries ../powerdevil/kcmodule/global/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/entries 2010-12-12 14:48:46.930000002 -0800 +@@ -0,0 +1,232 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/kcmodule/global ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-09T07:22:18.493675Z ++1204813 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++powerdevilglobalconfig.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.926666Z ++6e00bb73ed25e7eb2cb23ad4d201adf2 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3058 ++ ++GeneralPage.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.926666Z ++54189d16c9d733628c81ac03da236195 ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1856 ++ ++Messages.sh ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.926666Z ++1e8e49420cd32111e8a239b9ccecb8fa ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++has-props ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++189 ++ ++generalPage.ui ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.926666Z ++c4f3014f5c0faabff7751539d5571814 ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++15489 ++ ++GeneralPage.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.930000Z ++0a7a80aba2742afce064bd4f9d0341a0 ++2010-12-09T07:22:18.493675Z ++1204813 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++9650 ++ ++CMakeLists.txt ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.930000Z ++61751c2fa51ba36a9804117dcc8d20d2 ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++630 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/prop-base/Messages.sh.svn-base ../powerdevil/kcmodule/global/.svn/prop-base/Messages.sh.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/prop-base/Messages.sh.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/prop-base/Messages.sh.svn-base 2010-12-12 14:48:46.926666668 -0800 +@@ -0,0 +1,5 @@ ++K 14 ++svn:executable ++V 1 ++* ++END +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/CMakeLists.txt.svn-base ../powerdevil/kcmodule/global/.svn/text-base/CMakeLists.txt.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/CMakeLists.txt.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/text-base/CMakeLists.txt.svn-base 2010-12-12 14:48:46.926666668 -0800 +@@ -0,0 +1,22 @@ ++ ++set( kcm_powerdevil_global_SRCS ++ GeneralPage.cpp ++) ++ ++kde4_add_ui_files(kcm_powerdevil_global_SRCS ++ generalPage.ui) ++ ++kde4_add_kcfg_files(kcm_powerdevil_global_SRCS ../../PowerDevilSettings.kcfgc) ++ ++kde4_add_plugin(kcm_powerdevilglobalconfig ${kcm_powerdevil_global_SRCS}) ++ ++target_link_libraries(kcm_powerdevilglobalconfig ++ ${KDE4_KDECORE_LIBS} ++ ${KDE4_KDEUI_LIBRARY} ++ ${KDE4_KIO_LIBS} ++ ${KDE4_SOLID_LIBS} ++ ${KDE4_KNOTIFYCONFIG_LIBRARY} ++) ++ ++install(TARGETS kcm_powerdevilglobalconfig DESTINATION ${PLUGIN_INSTALL_DIR} ) ++install( FILES powerdevilglobalconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/GeneralPage.cpp.svn-base ../powerdevil/kcmodule/global/.svn/text-base/GeneralPage.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/GeneralPage.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/text-base/GeneralPage.cpp.svn-base 2010-12-12 14:48:46.926666668 -0800 +@@ -0,0 +1,230 @@ ++/*************************************************************************** ++ * 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 "GeneralPage.h" ++ ++#include "PowerDevilSettings.h" ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilGeneralKCMFactory, ++ registerPlugin(); ++ ) ++K_EXPORT_PLUGIN(PowerDevilGeneralKCMFactory("powerdevilglobalconfig","powerdevil")) ++ ++typedef QMap< QString, QString > StringStringMap; ++Q_DECLARE_METATYPE(StringStringMap) ++ ++GeneralPage::GeneralPage(QWidget *parent, const QVariantList &args) ++ : KCModule(PowerDevilGeneralKCMFactory::componentData(), parent, args) ++{ ++ qDBusRegisterMetaType< StringStringMap >(); ++ ++ setButtons(Apply | Help); ++ ++ KAboutData *about = ++ new KAboutData("powerdevilglobalconfig", "powerdevilglobalconfig", ki18n("Global Power Management Configuration"), ++ "", ki18n("A global power management configurator for KDE Power Management System"), ++ KAboutData::License_GPL, ki18n("(c), 2010 Dario Freddi"), ++ ki18n("From this module, you can configure the main Power Management daemon, assign profiles to " ++ "states, and do some advanced fine tuning on battery handling")); ++ ++ about->addAuthor(ki18n("Dario Freddi"), ki18n("Maintainer") , "drf@kde.org", ++ "http://drfav.wordpress.com"); ++ ++ setAboutData(about); ++ ++ setupUi(this); ++ ++ fillUi(); ++ ++ // Connect to daemon's signal ++ QDBusConnection::sessionBus().connect("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "configurationReloaded", ++ this, SLOT(reloadAvailableProfiles())); ++} ++ ++GeneralPage::~GeneralPage() ++{ ++} ++ ++void GeneralPage::fillUi() ++{ ++ int batteryCount = 0; ++ ++ foreach(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::Battery, QString())) { ++ const Solid::Battery *b = qobject_cast (device.asDeviceInterface(Solid::DeviceInterface::Battery)); ++ if(b->type() != Solid::Battery::PrimaryBattery) { ++ continue; ++ } ++ ++batteryCount; ++ } ++ ++ eventsIconLabel->setPixmap(KIcon("preferences-desktop-notification").pixmap(24)); ++ profileIconLabel->setPixmap(KIcon("preferences-system-power-management").pixmap(24)); ++ ++ reloadAvailableProfiles(); ++ ++ tabWidget->setTabIcon(0, KIcon("preferences-other")); ++ tabWidget->setTabIcon(1, KIcon("battery")); ++ ++ QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates(); ++ ++ BatteryCriticalCombo->addItem(KIcon("dialog-cancel"), i18n("Do nothing"), 0); ++ if (methods.contains(Solid::PowerManagement::SuspendState)) { ++ BatteryCriticalCombo->addItem(KIcon("system-suspend"), i18n("Sleep"), 1); ++ } ++ if (methods.contains(Solid::PowerManagement::HibernateState)) { ++ BatteryCriticalCombo->addItem(KIcon("system-suspend-hibernate"), i18n("Hibernate"), 2); ++ } ++ BatteryCriticalCombo->addItem(KIcon("system-shutdown"), i18n("Shutdown"), 3); ++ ++ notificationsButton->setIcon(KIcon("preferences-desktop-notification")); ++ ++ // modified fields... ++ ++ connect(lockScreenOnResume, SIGNAL(stateChanged(int)), SLOT(changed())); ++ ++ connect(notificationsButton, SIGNAL(clicked()), SLOT(configureNotifications())); ++ ++ connect(lowSpin, SIGNAL(valueChanged(int)), SLOT(changed())); ++ connect(warningSpin, SIGNAL(valueChanged(int)), SLOT(changed())); ++ connect(criticalSpin, SIGNAL(valueChanged(int)), SLOT(changed())); ++ ++ connect(BatteryCriticalCombo, SIGNAL(currentIndexChanged(int)), SLOT(changed())); ++ ++ connect(acProfile, SIGNAL(currentIndexChanged(int)), SLOT(changed())); ++ connect(lowProfile, SIGNAL(currentIndexChanged(int)), SLOT(changed())); ++ connect(warningProfile, SIGNAL(currentIndexChanged(int)), SLOT(changed())); ++ connect(batteryProfile, SIGNAL(currentIndexChanged(int)), SLOT(changed())); ++ ++ // Disable stuff, eventually ++ if (batteryCount == 0) { ++ batteryProfile->setEnabled(false); ++ lowProfile->setEnabled(false); ++ warningProfile->setEnabled(false); ++ tabWidget->setTabEnabled(1, false); ++ } ++} ++ ++void GeneralPage::load() ++{ ++ lockScreenOnResume->setChecked(PowerDevilSettings::configLockScreen()); ++ ++ lowSpin->setValue(PowerDevilSettings::batteryLowLevel()); ++ warningSpin->setValue(PowerDevilSettings::batteryWarningLevel()); ++ criticalSpin->setValue(PowerDevilSettings::batteryCriticalLevel()); ++ ++ BatteryCriticalCombo->setCurrentIndex(BatteryCriticalCombo->findData(PowerDevilSettings::batteryCriticalAction())); ++ ++ acProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::aCProfile())); ++ lowProfile->setCurrentIndex(lowProfile->findData(PowerDevilSettings::lowProfile())); ++ warningProfile->setCurrentIndex(warningProfile->findData(PowerDevilSettings::warningProfile())); ++ batteryProfile->setCurrentIndex(batteryProfile->findData(PowerDevilSettings::batteryProfile())); ++} ++ ++void GeneralPage::configureNotifications() ++{ ++ KNotifyConfigWidget::configure(this, "powerdevil"); ++} ++ ++void GeneralPage::save() ++{ ++ PowerDevilSettings::setConfigLockScreen(lockScreenOnResume->isChecked()); ++ ++ PowerDevilSettings::setBatteryLowLevel(lowSpin->value()); ++ PowerDevilSettings::setBatteryWarningLevel(warningSpin->value()); ++ PowerDevilSettings::setBatteryCriticalLevel(criticalSpin->value()); ++ ++ PowerDevilSettings::setBatteryCriticalAction(BatteryCriticalCombo->itemData(BatteryCriticalCombo->currentIndex()).toInt()); ++ ++ PowerDevilSettings::setACProfile(acProfile->itemData(acProfile->currentIndex()).toString()); ++ PowerDevilSettings::setLowProfile(lowProfile->itemData(lowProfile->currentIndex()).toString()); ++ PowerDevilSettings::setWarningProfile(warningProfile->itemData(warningProfile->currentIndex()).toString()); ++ PowerDevilSettings::setBatteryProfile(batteryProfile->itemData(batteryProfile->currentIndex()).toString()); ++ ++ PowerDevilSettings::self()->writeConfig(); ++} ++ ++void GeneralPage::reloadAvailableProfiles() ++{ ++ KSharedConfigPtr profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig); ++ ++ // Request profiles to the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "availableProfiles"); ++ QDBusPendingReply< StringStringMap > reply = QDBusConnection::sessionBus().asyncCall(call); ++ reply.waitForFinished(); ++ ++ if (!reply.isValid()) { ++ kDebug() << "Error contacting the daemon!"; ++ return; ++ } ++ ++ StringStringMap profiles = reply.value(); ++ ++ if (profiles.isEmpty()) { ++ kDebug() << "No available profiles!"; ++ return; ++ } ++ ++ acProfile->clear(); ++ batteryProfile->clear(); ++ lowProfile->clear(); ++ warningProfile->clear(); ++ ++ if (profilesConfig->groupList().isEmpty()) { ++ kDebug() << "No available profiles!"; ++ return; ++ } ++ ++ for (StringStringMap::const_iterator i = profiles.constBegin(); i != profiles.constEnd(); ++i) { ++ KConfigGroup group(profilesConfig, i.key()); ++ ++ acProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); ++ batteryProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); ++ lowProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); ++ warningProfile->addItem(KIcon(group.readEntry("icon")), i.value(), i.key()); ++ } ++ ++ acProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::aCProfile())); ++ lowProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::lowProfile())); ++ warningProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::warningProfile())); ++ batteryProfile->setCurrentIndex(acProfile->findData(PowerDevilSettings::batteryProfile())); ++ ++} ++ ++void GeneralPage::defaults() ++{ ++ KCModule::defaults(); ++} ++ ++#include "GeneralPage.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/GeneralPage.h.svn-base ../powerdevil/kcmodule/global/.svn/text-base/GeneralPage.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/GeneralPage.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/text-base/GeneralPage.h.svn-base 2010-12-12 14:48:46.926666668 -0800 +@@ -0,0 +1,45 @@ ++/*************************************************************************** ++ * 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 GENERALPAGE_H ++#define GENERALPAGE_H ++ ++#include ++ ++#include "ui_generalPage.h" ++ ++class GeneralPage : public KCModule, private Ui_generalPage ++{ ++ Q_OBJECT ++ ++public: ++ GeneralPage(QWidget *parent, const QVariantList &args); ++ virtual ~GeneralPage(); ++ void fillUi(); ++ ++ void load(); ++ void save(); ++ virtual void defaults(); ++ ++private slots: ++ void configureNotifications(); ++ void reloadAvailableProfiles(); ++}; ++ ++#endif /* GENERALPAGE_H */ +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/generalPage.ui.svn-base ../powerdevil/kcmodule/global/.svn/text-base/generalPage.ui.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/generalPage.ui.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/text-base/generalPage.ui.svn-base 2010-12-12 14:48:46.926666668 -0800 +@@ -0,0 +1,476 @@ ++ ++ ++ generalPage ++ ++ ++ ++ 0 ++ 0 ++ 761 ++ 436 ++ ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ ++ Settings and Profile ++ ++ ++ ++ ++ ++ 4 ++ ++ ++ ++ ++ ++ 24 ++ 24 ++ ++ ++ ++ ++ 16 ++ 16777215 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <b>Events</b> ++ ++ ++ ++ ++ ++ ++ ++ ++ 30 ++ ++ ++ ++ ++ Lock screen on resume ++ ++ ++ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter ++ ++ ++ lockScreenOnResume ++ ++ ++ ++ ++ ++ ++ Locks screen when waking up from suspension ++ ++ ++ ++ ++ ++ You will be asked for a password when resuming from sleep state ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ ++ 16777215 ++ 16777215 ++ ++ ++ ++ Configure Notifications... ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 24 ++ 24 ++ ++ ++ ++ ++ 24 ++ 24 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> ++<html><head><meta name="qrichtext" content="1" /><style type="text/css"> ++p, li { white-space: pre-wrap; } ++</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> ++<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Profile Assignment</span></p></body></html> ++ ++ ++ ++ ++ ++ ++ ++ ++ 30 ++ ++ ++ ++ ++ When AC Adaptor is plugged in ++ ++ ++ acProfile ++ ++ ++ ++ ++ ++ ++ ++ 280 ++ 16777215 ++ ++ ++ ++ ++ ++ ++ ++ When AC Adaptor is unplugged ++ ++ ++ batteryProfile ++ ++ ++ ++ ++ ++ ++ ++ 280 ++ 16777215 ++ ++ ++ ++ ++ ++ ++ ++ When battery is at low level ++ ++ ++ lowProfile ++ ++ ++ ++ ++ ++ ++ ++ 280 ++ 16777215 ++ ++ ++ ++ ++ ++ ++ ++ When battery is at warning level ++ ++ ++ warningProfile ++ ++ ++ ++ ++ ++ ++ ++ 280 ++ 16777215 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ ++ Advanced Battery Settings ++ ++ ++ ++ ++ ++ ++ ++ When battery remaining is critical ++ ++ ++ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter ++ ++ ++ false ++ ++ ++ BatteryCriticalCombo ++ ++ ++ ++ ++ ++ ++ ++ 300 ++ 16777215 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 369 ++ 26 ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ QSizePolicy::Fixed ++ ++ ++ ++ 20 ++ 10 ++ ++ ++ ++ ++ ++ ++ ++ Battery Levels ++ ++ ++ ++ QFormLayout::AllNonFixedFieldsGrow ++ ++ ++ ++ ++ Battery is at low level at ++ ++ ++ lowSpin ++ ++ ++ ++ ++ ++ ++ ++ 100 ++ 16777215 ++ ++ ++ ++ Low battery level ++ ++ ++ Battery will be considered low when it reaches this level ++ ++ ++ % ++ ++ ++ 100 ++ ++ ++ ++ ++ ++ ++ Battery is at warning level at ++ ++ ++ warningSpin ++ ++ ++ ++ ++ ++ ++ ++ 100 ++ 16777215 ++ ++ ++ ++ Warning battery level ++ ++ ++ Battery will be considered at warning level when it reaches this level ++ ++ ++ % ++ ++ ++ 100 ++ ++ ++ ++ ++ ++ ++ Battery is at critical level at ++ ++ ++ criticalSpin ++ ++ ++ ++ ++ ++ ++ ++ 100 ++ 16777215 ++ ++ ++ ++ Critical battery level ++ ++ ++ Battery will be considered critical when it reaches this level ++ ++ ++ % ++ ++ ++ 100 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 119 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ KIntSpinBox ++ QSpinBox ++
knuminput.h
++
++ ++ KComboBox ++ QComboBox ++
kcombobox.h
++
++ ++ KTabWidget ++ QTabWidget ++
ktabwidget.h
++ 1 ++
++
++ ++ ++
+diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/Messages.sh.svn-base ../powerdevil/kcmodule/global/.svn/text-base/Messages.sh.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/Messages.sh.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/text-base/Messages.sh.svn-base 2010-12-12 14:48:46.926666668 -0800 +@@ -0,0 +1,5 @@ ++#! /bin/sh ++$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11 ++$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/powerdevilglobalconfig.pot ++rm -f rc.cpp ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/powerdevilglobalconfig.desktop.svn-base ../powerdevil/kcmodule/global/.svn/text-base/powerdevilglobalconfig.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/global/.svn/text-base/powerdevilglobalconfig.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/global/.svn/text-base/powerdevilglobalconfig.desktop.svn-base 2010-12-12 14:48:46.926666668 -0800 +@@ -0,0 +1,65 @@ ++[Desktop Entry] ++Exec=kcmshell4 powerdevilglobalconfig ++Icon=preferences-other ++Type=Service ++X-KDE-ServiceTypes=KCModule ++X-DocPath=kcontrol/powerdevil/index.html ++ ++X-KDE-Library=kcm_powerdevilglobalconfig ++X-KDE-ParentApp=kcontrol ++ ++X-KDE-System-Settings-Parent-Category=power-management ++ ++Name=Global settings ++Name[ast]=Preferencies globales ++Name[ca]=Arranjament global ++Name[da]=Globale indstillinger ++Name[de]=Globale Einstellungen ++Name[en_GB]=Global settings ++Name[es]=Preferencias globales ++Name[et]=Globaalsed seadistused ++Name[hr]=Globalne postavke ++Name[hu]=Globális beállítások ++Name[ia]=Preferentias Global ++Name[kk]=:Жалпы жүйелік параметрлері ++Name[km]=ការ​កំណត់​សកល ++Name[ko]=전역 설정 ++Name[lt]=Bendrieji nustatymai ++Name[nb]=Globale innstillinger ++Name[nds]=Globale Instellen ++Name[nl]=Globale instellingen ++Name[pa]=ਗਲੋਬਲ ਸੈਟਿੰਗ ++Name[pt]=Configuração global ++Name[pt_BR]=Configurações globais ++Name[sv]=Allmänna inställningar ++Name[th]=ตั้งค่าทั่วไป ++Name[uk]=Загальні параметри ++Name[x-test]=xxGlobal settingsxx ++Name[zh_TW]=全域設定 ++ ++Comment=Configure global Power Management settings ++Comment[ast]=Configuración de les preferencies globales de la xestión d'enerxía ++Comment[ca]=Configura l'arranjament global de gestió d'energia ++Comment[da]=Indstil strømstyring globalt ++Comment[de]=Globale Energieprofile einrichten ++Comment[en_GB]=Configure global Power Management settings ++Comment[es]=Configuración de las preferencias globales de la gestión de energía ++Comment[et]=Toitehalduse globaalsed seadistused ++Comment[ia]=Configurar preferentias global de gestion de Energia ++Comment[kk]=:Жалпы жүйелік қуаттандыру параметрлерін баптау ++Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​​ការ​កំណត់​​​ក្នុង​ការ​​គ្រប់គ្រង​​ថាមពល​សកល ++Comment[ko]=전역 전원 관리 설정 ++Comment[lt]=Konfigūruoti bendrus energijos valdymo nustatymus ++Comment[nb]=Sett opp globale strømstyringsinnstillinger ++Comment[nds]=Globale Stroomkuntrullprofilen instellen ++Comment[nl]=Instellen voor globaal energiebeheer instellen ++Comment[pa]=ਗਲੋਬਲ ਪਾਵਰ ਪਰਬੰਧ ਸੈਟਿੰਗ ਸੰਰਚਨਾ ++Comment[pt]=Configurar as opções globais de Gestão de Energia ++Comment[pt_BR]=Configura as opções globais do gerenciamento de energia ++Comment[sv]=Anpassa allmänna inställningar av strömhantering ++Comment[th]=ปรับแต่งการตั้งค่าทั่วไปของการจัดการพลังงาน ++Comment[uk]=Налаштування загальних параметрів керування живленням ++Comment[x-test]=xxConfigure global Power Management settingsxx ++Comment[zh_TW]=設定全域電源管理 ++ ++X-KDE-Keywords=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/EditPage.cpp ../powerdevil/kcmodule/profiles/EditPage.cpp +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/EditPage.cpp 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/EditPage.cpp 2010-12-12 14:48:46.933333335 -0800 +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -53,11 +54,16 @@ + ) + K_EXPORT_PLUGIN(PowerDevilProfilesKCMFactory("powerdevilprofilesconfig","powerdevil")) + ++typedef QMap< QString, QString > StringStringMap; ++Q_DECLARE_METATYPE(StringStringMap) ++ + EditPage::EditPage(QWidget *parent, const QVariantList &args) + : KCModule(PowerDevilProfilesKCMFactory::componentData(), parent, args) + , m_profileEdited(false) + { +- setButtons(Apply | Help); ++ qDBusRegisterMetaType< StringStringMap >(); ++ ++ setButtons(Apply | Help | Default); + + KAboutData *about = + new KAboutData("powerdevilprofilesconfig", "powerdevilprofilesconfig", ki18n("Power Profiles Configuration"), +@@ -85,24 +91,32 @@ + listLayout->addWidget(m_toolBar); + + m_toolBar->addAction(actionNewProfile); ++ m_toolBar->addAction(actionEditProfile); + m_toolBar->addAction(actionDeleteProfile); + m_toolBar->addSeparator(); + m_toolBar->addAction(actionImportProfiles); + m_toolBar->addAction(actionExportProfiles); ++ m_toolBar->addAction(actionRestoreDefaultProfiles); + m_toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); + + actionNewProfile->setIcon(KIcon("document-new")); ++ actionEditProfile->setIcon(KIcon("document-edit")); + actionDeleteProfile->setIcon(KIcon("edit-delete-page")); + actionImportProfiles->setIcon(KIcon("document-import")); + actionExportProfiles->setIcon(KIcon("document-export")); ++ actionRestoreDefaultProfiles->setIcon(KIcon("document-revert")); + + connect(profilesList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), + SLOT(switchProfile(QListWidgetItem*, QListWidgetItem*))); ++ connect(this, SIGNAL(changed(bool)), ++ this, SLOT(onChanged(bool))); + + connect(actionDeleteProfile, SIGNAL(triggered()), SLOT(deleteCurrentProfile())); ++ connect(actionEditProfile, SIGNAL(triggered(bool)), SLOT(editProfile())); + connect(actionNewProfile, SIGNAL(triggered()), SLOT(createProfile())); + connect(actionImportProfiles, SIGNAL(triggered()), SLOT(importProfiles())); + connect(actionExportProfiles, SIGNAL(triggered()), SLOT(exportProfiles())); ++ connect(actionRestoreDefaultProfiles, SIGNAL(triggered(bool)), SLOT(restoreDefaultProfiles())); + + reloadAvailableProfiles(); + ActionConfigWidget *actionConfigWidget = new ActionConfigWidget(0); +@@ -162,6 +176,11 @@ + { + } + ++void EditPage::onChanged(bool changed) ++{ ++ m_profileEdited = changed; ++} ++ + void EditPage::load() + { + loadProfile(); +@@ -169,31 +188,43 @@ + + void EditPage::save() + { +- QString profile = profilesList->currentItem()->text(); +- saveProfile(); ++ QString profile = profilesList->currentItem()->data(Qt::UserRole).toString(); ++ saveProfile(profile); + // Notify the daemon +- QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", +- "org.kde.Solid.PowerManagement", "currentProfile"); +- QDBusPendingReply< QString > reply = QDBusConnection::sessionBus().asyncCall(call); +- reply.waitForFinished(); ++ notifyDaemon(profile); ++} + +- if (reply.isValid()) { +- if (reply.value() == profile) { +- // Ask to reload the profile +- kDebug() << "Active profile edited, reloading profile"; +- call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", +- "org.kde.Solid.PowerManagement", "reloadCurrentProfile"); ++void EditPage::notifyDaemon(const QString &editedProfile) ++{ ++ QDBusMessage call; ++ if (!editedProfile.isNull()) { ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "currentProfile"); ++ QDBusPendingReply< QString > reply = QDBusConnection::sessionBus().asyncCall(call); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) { ++ if (reply.value() == editedProfile) { ++ // Ask to reload the profile ++ kDebug() << "Active profile edited, reloading profile"; ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reloadCurrentProfile"); ++ } else { ++ // Ask to reparse config ++ kDebug() << "Inactive profile edited, reparsing configuration"; ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reparseConfiguration"); ++ } + } else { +- // Ask to reparse config +- kDebug() << "Inactive profile edited, reparsing configuration"; ++ kWarning() << "Invalid reply from daemon when asking for current profile!"; ++ // To be sure, reload profile + call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", +- "org.kde.Solid.PowerManagement", "reparseConfiguration"); ++ "org.kde.Solid.PowerManagement", "reloadCurrentProfile"); + } + } else { +- kWarning() << "Invalid reply from daemon when asking for current profile!"; +- // To be sure, reload profile ++ // Refresh status + call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", +- "org.kde.Solid.PowerManagement", "reloadCurrentProfile"); ++ "org.kde.Solid.PowerManagement", "refreshStatus"); + } + + // Perform call +@@ -204,12 +235,23 @@ + { + kDebug() << "Loading a profile"; + +- if (!profilesList->currentItem()) ++ if (!profilesList->currentItem()) { + return; ++ } + +- kDebug() << profilesList->currentItem()->text(); ++ // Check if the profile is not reserved ++ QString profileId = profilesList->currentItem()->data(Qt::UserRole).toString(); ++ if (profileId == "Performance" || profileId == "Powersave" || profileId == "Aggressive powersave") { ++ actionDeleteProfile->setEnabled(false); ++ actionEditProfile->setEnabled(false); ++ } else { ++ actionDeleteProfile->setEnabled(true); ++ actionEditProfile->setEnabled(true); ++ } + +- KConfigGroup group(m_profilesConfig, profilesList->currentItem()->text()); ++ kDebug() << profileId; ++ ++ KConfigGroup group(m_profilesConfig, profileId); + + if (!group.isValid()) { + return; +@@ -238,7 +280,7 @@ + QString profile; + + if (p.isEmpty()) { +- profile = profilesList->currentItem()->text(); ++ profile = profilesList->currentItem()->data(Qt::UserRole).toString(); + } else { + profile = p; + } +@@ -270,18 +312,31 @@ + { + profilesList->clear(); + +- m_profilesConfig->reparseConfiguration(); ++ // Request profiles to the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "availableProfiles"); ++ QDBusPendingReply< StringStringMap > reply = QDBusConnection::sessionBus().asyncCall(call); ++ reply.waitForFinished(); + +- if (m_profilesConfig->groupList().isEmpty()) { ++ if (!reply.isValid()) { ++ kDebug() << "Error contacting the daemon!"; ++ return; ++ } ++ ++ StringStringMap profiles = reply.value(); ++ ++ if (profiles.isEmpty()) { + kDebug() << "No available profiles!"; + return; + } + +- foreach (const QString &ent, m_profilesConfig->groupList()) { +- KConfigGroup *group = new KConfigGroup(m_profilesConfig, ent); +- QListWidgetItem *itm = new QListWidgetItem(KIcon(group->readEntry("icon")), ent); ++ m_profilesConfig->reparseConfiguration(); ++ ++ for (StringStringMap::const_iterator i = profiles.constBegin(); i != profiles.constEnd(); ++i) { ++ KConfigGroup group(m_profilesConfig, i.key()); ++ QListWidgetItem *itm = new QListWidgetItem(KIcon(group.readEntry("icon")), i.value()); ++ itm->setData(Qt::UserRole, i.key()); + profilesList->addItem(itm); +- delete group; + } + + profilesList->setCurrentRow(0); +@@ -289,22 +344,22 @@ + + void EditPage::deleteCurrentProfile() + { +- if (!profilesList->currentItem() || profilesList->currentItem()->text().isEmpty()) { ++ if (!profilesList->currentItem()) { + return; + } + + // We're deleting it, we don't care anymore +- m_profileEdited = false; ++ emit changed(false); + +- m_profilesConfig->deleteGroup(profilesList->currentItem()->text()); ++ m_profilesConfig->deleteGroup(profilesList->currentItem()->data(Qt::UserRole).toString()); + m_profilesConfig->sync(); + +- reloadAvailableProfiles(); +- + // Notify the daemon + QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", + "org.kde.Solid.PowerManagement", "reparseConfiguration"); + QDBusConnection::sessionBus().asyncCall(call); ++ ++ reloadAvailableProfiles(); + } + + void EditPage::createProfile(const QString &name, const QString &icon) +@@ -314,15 +369,16 @@ + } + KConfigGroup group(m_profilesConfig, name); + group.writeEntry("icon", icon); ++ group.writeEntry("name", name); + + group.sync(); + +- reloadAvailableProfiles(); +- + // Notify the daemon + QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", + "org.kde.Solid.PowerManagement", "reparseConfiguration"); + QDBusConnection::sessionBus().asyncCall(call); ++ ++ reloadAvailableProfiles(); + } + + void EditPage::createProfile() +@@ -358,26 +414,30 @@ + delete dialog; + } + +-void EditPage::editProfile(const QString &prevname, const QString &icon) ++void EditPage::editProfile(const QString &id, const QString &name, const QString &icon) + { +- if (prevname.isEmpty()) ++ if (id.isEmpty() || !m_profilesConfig->hasGroup(id)) { + return; ++ } + +- KConfigGroup group(m_profilesConfig, prevname); ++ KConfigGroup group(m_profilesConfig, id); + + group.writeEntry("icon", icon); ++ group.writeEntry("name", name); + + group.sync(); + +- reloadAvailableProfiles(); +- ++ // Notify the daemon ++ notifyDaemon(id); + ++ reloadAvailableProfiles(); + } + + void EditPage::editProfile() + { +- if (!profilesList->currentItem()) ++ if (!profilesList->currentItem()) { + return; ++ } + + KDialog *dialog = new KDialog(this); + QWidget *wg = new QWidget(); +@@ -395,13 +455,11 @@ + + ed->setToolTip(i18n("The name for the new profile")); + ed->setWhatsThis(i18n("Enter here the name for the profile you are creating")); +- ed->setEnabled(false); + +- ed->setText(profilesList->currentItem()->text()); ++ KConfigGroup group(m_profilesConfig, profilesList->currentItem()->data(Qt::UserRole).toString()); + +- KConfigGroup *group = new KConfigGroup(m_profilesConfig, profilesList->currentItem()->text()); +- +- ibt->setIcon(group->readEntry("icon")); ++ ibt->setIcon(group.readEntry("icon")); ++ ed->setText(group.readEntry("name")); + + lay->addRow(lb); + lay->addRow(ibt, ed); +@@ -412,11 +470,10 @@ + ed->setFocus(); + + if (dialog->exec() == KDialog::Accepted) { +- editProfile(profilesList->currentItem()->text(), ibt->icon()); ++ editProfile(profilesList->currentItem()->data(Qt::UserRole).toString(), ed->text(), ibt->icon()); + } + + delete dialog; +- delete group; + } + + void EditPage::importProfiles() +@@ -439,6 +496,11 @@ + + m_profilesConfig->sync(); + ++ // Notify the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reparseConfiguration"); ++ QDBusConnection::sessionBus().asyncCall(call); ++ + reloadAvailableProfiles(); + } + +@@ -460,6 +522,24 @@ + delete toExport; + } + ++void EditPage::restoreDefaultProfiles() ++{ ++ // Confirm ++ int ret = KMessageBox::warningContinueCancel(this, i18n("The KDE Power Management System will now generate a set of default " ++ "profiles based on your computer's capabilities. This will also erase " ++ "all existing profiles. " ++ "Are you sure you want to continue?"), i18n("Restore Default Profiles")); ++ if (ret == KMessageBox::Continue) { ++ kDebug() << "Restoring defaults."; ++ PowerDevil::ProfileGenerator::generateProfiles(); ++ ++ // Notify the daemon ++ notifyDaemon(); ++ ++ reloadAvailableProfiles(); ++ } ++} ++ + void EditPage::switchProfile(QListWidgetItem *current, QListWidgetItem *previous) + { + Q_UNUSED(current) +@@ -481,7 +561,7 @@ + "Do you want to save it?"), i18n("Save Profile")); + + if (result == KMessageBox::Yes) { +- saveProfile(previous->text()); ++ saveProfile(previous->data(Qt::UserRole).toString()); + loadProfile(); + } else if (result == KMessageBox::No) { + loadProfile(); +@@ -502,7 +582,7 @@ + + void EditPage::defaults() + { +- KCModule::defaults(); ++ restoreDefaultProfiles(); + } + + #include "EditPage.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/EditPage.h ../powerdevil/kcmodule/profiles/EditPage.h +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/EditPage.h 2010-11-11 06:40:47.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/EditPage.h 2010-12-12 14:48:46.933333335 -0800 +@@ -44,18 +44,22 @@ + virtual void defaults(); + + private slots: ++ void onChanged(bool changed); + void loadProfile(); + void saveProfile(const QString &p = QString()); + void switchProfile(QListWidgetItem *current, QListWidgetItem *previous); + void reloadAvailableProfiles(); + void createProfile(const QString &name, const QString &icon); +- void editProfile(const QString &prevname, const QString &icon); ++ void editProfile(const QString &id, const QString &name, const QString &icon); + void deleteCurrentProfile(); + void createProfile(); + void editProfile(); + + void importProfiles(); + void exportProfiles(); ++ void restoreDefaultProfiles(); ++ ++ void notifyDaemon(const QString &editedProfile = QString()); + + void openUrl(const QString &url); + +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/profileEditPage.ui ../powerdevil/kcmodule/profiles/profileEditPage.ui +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/profileEditPage.ui 2010-10-27 12:54:59.000000000 -0700 ++++ ../powerdevil/kcmodule/profiles/profileEditPage.ui 2010-12-12 14:48:46.933333335 -0800 +@@ -76,6 +76,16 @@ + Export Profiles + + ++ ++ ++ Restore Default Profiles ++ ++ ++ ++ ++ Edit Profile ++ ++ + + + +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/entries ../powerdevil/kcmodule/profiles/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/entries 2010-12-12 14:48:46.933333335 -0800 +@@ -0,0 +1,300 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/kcmodule/profiles ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-09T07:22:25.427202Z ++1204816 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++profileEditPage.ui ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++b0c1c90e8413a7a32fd20ff631015fad ++2010-12-09T07:22:21.537606Z ++1204814 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2501 ++ ++Messages.sh ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++1807bb7069087252e9871bd06554bedd ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++has-props ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++191 ++ ++powerdevilprofilesconfig.desktop ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++41efaeb5a03a092cd9e995a66add6a90 ++2010-11-29T06:29:28.997905Z ++1201913 ++scripty ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2810 ++ ++EditPage.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++151d7f52a3102ea1eb5211b236fb4ecf ++2010-12-09T07:22:25.427202Z ++1204816 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++20880 ++ ++EditPage.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++dce955ce994a37834e59b5259e56057f ++2010-12-09T07:22:25.427202Z ++1204816 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++2706 ++ ++actionconfigwidget.cpp ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++035ac4a1437b428276c98c769f5b8880 ++2010-10-30T00:58:49.873153Z ++1191212 ++adawit ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++3624 ++ ++CMakeLists.txt ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++a560e9a4392a1a0755fad26df9f2d6a5 ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++707 ++ ++actionconfigwidget.h ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++83c14eabff173868dbb69b0a242f306a ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++1821 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/prop-base/Messages.sh.svn-base ../powerdevil/kcmodule/profiles/.svn/prop-base/Messages.sh.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/prop-base/Messages.sh.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/prop-base/Messages.sh.svn-base 2010-12-12 14:48:46.930000002 -0800 +@@ -0,0 +1,5 @@ ++K 14 ++svn:executable ++V 1 ++* ++END +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/actionconfigwidget.cpp.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/actionconfigwidget.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/actionconfigwidget.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/actionconfigwidget.cpp.svn-base 2010-12-12 14:48:46.933333335 -0800 +@@ -0,0 +1,88 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 by Sebastian Kugler * ++ * * ++ * 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 "actionconfigwidget.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ActionConfigWidget::ActionConfigWidget(QWidget* parent) : QWidget(parent) ++{ ++ m_gridLayout = new QGridLayout(this); ++ /* ++ QLabel* l = new QLabel( this ); ++ l->setText( "Hello World!" ); ++ ++ m_gridLayout->addWidget(l, 0, 0); ++ */ ++} ++ ++ActionConfigWidget::~ActionConfigWidget() ++{} ++ ++ ++void ActionConfigWidget::addWidgets(QList > configMap) ++{ ++ int row = m_gridLayout->rowCount(); ++ row++; ++ ++ QCheckBox* currentSectionCheckbox = 0; ++ /* ++ //Clean the values ++ QList::const_iterator it; ++ for (it = list.constBegin(); it != list.constEnd(); ++it) { ++ QString tempString = *it; ++ tempString = tempString.trimmed(); ++ tempString = tempString.mid(1, tempString.length()-2); ++ versionList.append(tempString); ++ } ++ */ ++ QList >::const_iterator it; ++ for (it = configMap.constBegin(); it != configMap.constEnd(); ++it) { ++ //foreach (QPair line, configMap) { ++ QPair line = *it; ++ if (line.first.isEmpty()) { ++ // A title checkbox ++ currentSectionCheckbox = qobject_cast(line.second); ++ currentSectionCheckbox->setChecked(true); ++ currentSectionCheckbox->setStyleSheet("font-weight: bold;"); ++ m_gridLayout->addWidget(line.second, row, 0, 1, 3); ++ } else { ++ // connect enabled / disabled ++ QLabel* label = new QLabel(this); ++ label->setText(line.first); ++ ++ m_gridLayout->addItem(new QSpacerItem(50 ,3), row, 0); ++ m_gridLayout->addWidget(label, row, 1, Qt::AlignRight); ++ m_gridLayout->addWidget(line.second, row, 2); ++ ++ connect(currentSectionCheckbox, SIGNAL(toggled(bool)), ++ label, SLOT(setEnabled(bool))); ++ connect(currentSectionCheckbox, SIGNAL(toggled(bool)), ++ line.second, SLOT(setEnabled(bool))); ++ } ++ row++; ++ } ++} ++ ++#include "actionconfigwidget.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/actionconfigwidget.h.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/actionconfigwidget.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/actionconfigwidget.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/actionconfigwidget.h.svn-base 2010-12-12 14:48:46.933333335 -0800 +@@ -0,0 +1,43 @@ ++/*************************************************************************** ++ * Copyright (C) 2010 by Sebastian Kugler * ++ * * ++ * 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 ACTIONCONFIG_H ++#define ACTIONCONFIG_H ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++class ActionConfigWidget : public QWidget ++{ ++Q_OBJECT ++public: ++ ActionConfigWidget(QWidget* parent); ++ ~ActionConfigWidget(); ++ ++ void addWidgets(QList > configMap); ++ ++private: ++ QGridLayout* m_gridLayout; ++}; ++ ++#endif // ActionConfigWidget_H +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/CMakeLists.txt.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/CMakeLists.txt.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/CMakeLists.txt.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/CMakeLists.txt.svn-base 2010-12-12 14:48:46.933333335 -0800 +@@ -0,0 +1,24 @@ ++ ++set( kcm_powerdevil_profiles_SRCS ++ EditPage.cpp ++ actionconfigwidget.cpp ++ ../../daemon/powerdevilprofilegenerator.cpp ++) ++ ++kde4_add_ui_files(kcm_powerdevil_profiles_SRCS ++ profileEditPage.ui) ++ ++kde4_add_kcfg_files(kcm_powerdevil_profiles_SRCS ../../PowerDevilSettings.kcfgc) ++ ++kde4_add_plugin(kcm_powerdevilprofilesconfig ${kcm_powerdevil_profiles_SRCS}) ++ ++target_link_libraries(kcm_powerdevilprofilesconfig ++ ${KDE4_KDECORE_LIBS} ++ ${KDE4_KDEUI_LIBRARY} ++ ${KDE4_KIO_LIBS} ++ ${KDE4_SOLID_LIBS} ++ powerdevilui ++) ++ ++install(TARGETS kcm_powerdevilprofilesconfig DESTINATION ${PLUGIN_INSTALL_DIR} ) ++install( FILES powerdevilprofilesconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/EditPage.cpp.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/EditPage.cpp.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/EditPage.cpp.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/EditPage.cpp.svn-base 2010-12-12 14:48:46.930000002 -0800 +@@ -0,0 +1,588 @@ ++/*************************************************************************** ++ * Copyright (C) 2008-2010 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 "EditPage.h" ++ ++#include "actionconfigwidget.h" ++ ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY(PowerDevilProfilesKCMFactory, ++ registerPlugin(); ++ ) ++K_EXPORT_PLUGIN(PowerDevilProfilesKCMFactory("powerdevilprofilesconfig","powerdevil")) ++ ++typedef QMap< QString, QString > StringStringMap; ++Q_DECLARE_METATYPE(StringStringMap) ++ ++EditPage::EditPage(QWidget *parent, const QVariantList &args) ++ : KCModule(PowerDevilProfilesKCMFactory::componentData(), parent, args) ++ , m_profileEdited(false) ++{ ++ qDBusRegisterMetaType< StringStringMap >(); ++ ++ setButtons(Apply | Help | Default); ++ ++ KAboutData *about = ++ new KAboutData("powerdevilprofilesconfig", "powerdevilprofilesconfig", ki18n("Power Profiles Configuration"), ++ "", ki18n("A profile configurator for KDE Power Management System"), ++ KAboutData::License_GPL, ki18n("(c), 2010 Dario Freddi"), ++ ki18n("From this module, you can manage KDE Power Management System's power profiles, by tweaking " ++ "existing ones or creating new ones.")); ++ ++ about->addAuthor(ki18n("Dario Freddi"), ki18n("Maintainer") , "drf@kde.org", ++ "http://drfav.wordpress.com"); ++ ++ setAboutData(about); ++ ++ setupUi(this); ++ ++ m_profilesConfig = KSharedConfig::openConfig("powerdevil2profilesrc", KConfig::SimpleConfig); ++ ++ if (m_profilesConfig->groupList().isEmpty()) { ++ // Use the generator ++ PowerDevil::ProfileGenerator::generateProfiles(); ++ m_profilesConfig->reparseConfiguration(); ++ } ++ ++ m_toolBar = new KToolBar(this); ++ listLayout->addWidget(m_toolBar); ++ ++ m_toolBar->addAction(actionNewProfile); ++ m_toolBar->addAction(actionEditProfile); ++ m_toolBar->addAction(actionDeleteProfile); ++ m_toolBar->addSeparator(); ++ m_toolBar->addAction(actionImportProfiles); ++ m_toolBar->addAction(actionExportProfiles); ++ m_toolBar->addAction(actionRestoreDefaultProfiles); ++ m_toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); ++ ++ actionNewProfile->setIcon(KIcon("document-new")); ++ actionEditProfile->setIcon(KIcon("document-edit")); ++ actionDeleteProfile->setIcon(KIcon("edit-delete-page")); ++ actionImportProfiles->setIcon(KIcon("document-import")); ++ actionExportProfiles->setIcon(KIcon("document-export")); ++ actionRestoreDefaultProfiles->setIcon(KIcon("document-revert")); ++ ++ connect(profilesList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), ++ SLOT(switchProfile(QListWidgetItem*, QListWidgetItem*))); ++ connect(this, SIGNAL(changed(bool)), ++ this, SLOT(onChanged(bool))); ++ ++ connect(actionDeleteProfile, SIGNAL(triggered()), SLOT(deleteCurrentProfile())); ++ connect(actionEditProfile, SIGNAL(triggered(bool)), SLOT(editProfile())); ++ connect(actionNewProfile, SIGNAL(triggered()), SLOT(createProfile())); ++ connect(actionImportProfiles, SIGNAL(triggered()), SLOT(importProfiles())); ++ connect(actionExportProfiles, SIGNAL(triggered()), SLOT(exportProfiles())); ++ connect(actionRestoreDefaultProfiles, SIGNAL(triggered(bool)), SLOT(restoreDefaultProfiles())); ++ ++ reloadAvailableProfiles(); ++ ActionConfigWidget *actionConfigWidget = new ActionConfigWidget(0); ++ QMap< int, QList > > widgets; ++ ++ // Load all the services ++ KService::List offers = KServiceTypeTrader::self()->query("PowerDevil/Action", "(Type == 'Service')"); ++ ++ foreach (const KService::Ptr &offer, offers) { ++ //try to load the specified library ++ KPluginFactory *factory = KPluginLoader(offer->property("X-KDE-PowerDevil-Action-UIComponentLibrary", ++ QVariant::String).toString()).factory(); ++ ++ if (!factory) { ++ kError() << "KPluginFactory could not load the plugin:" << offer->property("X-KDE-PowerDevil-Action-UIComponentLibrary", ++ QVariant::String).toString(); ++ continue; ++ } ++ ++ PowerDevil::ActionConfig *actionConfig = factory->create(); ++ if (!actionConfig) { ++ kError() << "KPluginFactory could not load the plugin:" << offer->property("X-KDE-PowerDevil-Action-UIComponentLibrary", ++ QVariant::String).toString(); ++ continue; ++ } ++ ++ connect(actionConfig, SIGNAL(changed()), this, SLOT(changed())); ++ ++ QCheckBox *checkbox = new QCheckBox(offer->name()); ++ if (!offer->icon().isEmpty()) { ++ checkbox->setIcon(KIcon(offer->icon())); ++ } ++ connect(checkbox, SIGNAL(stateChanged(int)), this, SLOT(changed())); ++ m_actionsHash.insert(offer->property("X-KDE-PowerDevil-Action-ID", QVariant::String).toString(), checkbox); ++ m_actionsConfigHash.insert(offer->property("X-KDE-PowerDevil-Action-ID", QVariant::String).toString(), actionConfig); ++ ++ QList > offerWidgets = actionConfig->buildUi(); ++ offerWidgets.prepend(qMakePair(QString(), checkbox)); ++ widgets.insert(100 - offer->property("X-KDE-PowerDevil-Action-ConfigPriority", QVariant::Int).toInt(), ++ offerWidgets); ++ } ++ ++ for (QMap< int, QList > >::const_iterator i = widgets.constBegin(); i != widgets.constEnd(); ++i) { ++ actionConfigWidget->addWidgets(i.value()); ++ } ++ ++ // Add a proxy widget to prevent vertical fuck ups ++ QWidget *tw = new QWidget; ++ QVBoxLayout *lay = new QVBoxLayout; ++ lay->addWidget(actionConfigWidget); ++ lay->addStretch(); ++ tw->setLayout(lay); ++ scrollArea->setWidget(tw); ++} ++ ++EditPage::~EditPage() ++{ ++} ++ ++void EditPage::onChanged(bool changed) ++{ ++ m_profileEdited = changed; ++} ++ ++void EditPage::load() ++{ ++ loadProfile(); ++} ++ ++void EditPage::save() ++{ ++ QString profile = profilesList->currentItem()->data(Qt::UserRole).toString(); ++ saveProfile(profile); ++ // Notify the daemon ++ notifyDaemon(profile); ++} ++ ++void EditPage::notifyDaemon(const QString &editedProfile) ++{ ++ QDBusMessage call; ++ if (!editedProfile.isNull()) { ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "currentProfile"); ++ QDBusPendingReply< QString > reply = QDBusConnection::sessionBus().asyncCall(call); ++ reply.waitForFinished(); ++ ++ if (reply.isValid()) { ++ if (reply.value() == editedProfile) { ++ // Ask to reload the profile ++ kDebug() << "Active profile edited, reloading profile"; ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reloadCurrentProfile"); ++ } else { ++ // Ask to reparse config ++ kDebug() << "Inactive profile edited, reparsing configuration"; ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reparseConfiguration"); ++ } ++ } else { ++ kWarning() << "Invalid reply from daemon when asking for current profile!"; ++ // To be sure, reload profile ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reloadCurrentProfile"); ++ } ++ } else { ++ // Refresh status ++ call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "refreshStatus"); ++ } ++ ++ // Perform call ++ QDBusConnection::sessionBus().asyncCall(call); ++} ++ ++void EditPage::loadProfile() ++{ ++ kDebug() << "Loading a profile"; ++ ++ if (!profilesList->currentItem()) { ++ return; ++ } ++ ++ // Check if the profile is not reserved ++ QString profileId = profilesList->currentItem()->data(Qt::UserRole).toString(); ++ if (profileId == "Performance" || profileId == "Powersave" || profileId == "Aggressive powersave") { ++ actionDeleteProfile->setEnabled(false); ++ actionEditProfile->setEnabled(false); ++ } else { ++ actionDeleteProfile->setEnabled(true); ++ actionEditProfile->setEnabled(true); ++ } ++ ++ kDebug() << profileId; ++ ++ KConfigGroup group(m_profilesConfig, profileId); ++ ++ if (!group.isValid()) { ++ return; ++ } ++ kDebug() << "Ok, KConfigGroup ready"; ++ ++ // Iterate over the possible actions ++ for (QHash< QString, QCheckBox* >::const_iterator i = m_actionsHash.constBegin(); i != m_actionsHash.constEnd(); ++i) { ++ i.value()->setChecked(group.groupList().contains(i.key())); ++ ++ KConfigGroup actionGroup = group.group(i.key()); ++ m_actionsConfigHash[i.key()]->setConfigGroup(actionGroup); ++ m_actionsConfigHash[i.key()]->load(); ++ } ++ ++ emit changed(false); ++} ++ ++void EditPage::saveProfile(const QString &p) ++{ ++ if (!profilesList->currentItem() && p.isEmpty()) { ++ kDebug() << "Could not perform a save operation"; ++ return; ++ } ++ ++ QString profile; ++ ++ if (p.isEmpty()) { ++ profile = profilesList->currentItem()->data(Qt::UserRole).toString(); ++ } else { ++ profile = p; ++ } ++ ++ KConfigGroup group(m_profilesConfig, profile); ++ ++ if (!group.isValid()) { ++ kDebug() << "Could not perform a save operation, group is not valid!"; ++ return; ++ } ++ ++ // Iterate over the possible actions ++ for (QHash< QString, QCheckBox* >::const_iterator i = m_actionsHash.constBegin(); i != m_actionsHash.constEnd(); ++i) { ++ if (i.value()->isChecked()) { ++ // Perform the actual save ++ m_actionsConfigHash[i.key()]->save(); ++ } else { ++ // Erase the group ++ group.group(i.key()).deleteGroup(); ++ } ++ } ++ ++ group.sync(); ++ ++ emit changed(false); ++} ++ ++void EditPage::reloadAvailableProfiles() ++{ ++ profilesList->clear(); ++ ++ // Request profiles to the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "availableProfiles"); ++ QDBusPendingReply< StringStringMap > reply = QDBusConnection::sessionBus().asyncCall(call); ++ reply.waitForFinished(); ++ ++ if (!reply.isValid()) { ++ kDebug() << "Error contacting the daemon!"; ++ return; ++ } ++ ++ StringStringMap profiles = reply.value(); ++ ++ if (profiles.isEmpty()) { ++ kDebug() << "No available profiles!"; ++ return; ++ } ++ ++ m_profilesConfig->reparseConfiguration(); ++ ++ for (StringStringMap::const_iterator i = profiles.constBegin(); i != profiles.constEnd(); ++i) { ++ KConfigGroup group(m_profilesConfig, i.key()); ++ QListWidgetItem *itm = new QListWidgetItem(KIcon(group.readEntry("icon")), i.value()); ++ itm->setData(Qt::UserRole, i.key()); ++ profilesList->addItem(itm); ++ } ++ ++ profilesList->setCurrentRow(0); ++} ++ ++void EditPage::deleteCurrentProfile() ++{ ++ if (!profilesList->currentItem()) { ++ return; ++ } ++ ++ // We're deleting it, we don't care anymore ++ emit changed(false); ++ ++ m_profilesConfig->deleteGroup(profilesList->currentItem()->data(Qt::UserRole).toString()); ++ m_profilesConfig->sync(); ++ ++ // Notify the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reparseConfiguration"); ++ QDBusConnection::sessionBus().asyncCall(call); ++ ++ reloadAvailableProfiles(); ++} ++ ++void EditPage::createProfile(const QString &name, const QString &icon) ++{ ++ if (name.isEmpty()) { ++ return; ++ } ++ KConfigGroup group(m_profilesConfig, name); ++ group.writeEntry("icon", icon); ++ group.writeEntry("name", name); ++ ++ group.sync(); ++ ++ // Notify the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reparseConfiguration"); ++ QDBusConnection::sessionBus().asyncCall(call); ++ ++ reloadAvailableProfiles(); ++} ++ ++void EditPage::createProfile() ++{ ++ KDialog *dialog = new KDialog(this); ++ QWidget *wg = new QWidget(); ++ KLineEdit *ed = new KLineEdit(wg); ++ QLabel *lb = new QLabel(wg); ++ QFormLayout *lay = new QFormLayout(); ++ KIconButton *ibt = new KIconButton(wg); ++ ++ ibt->setIconSize(KIconLoader::SizeSmall); ++ ++ lb->setText(i18n("Please enter a name for the new profile:")); ++ ++ lb->setToolTip(i18n("The name for the new profile")); ++ lb->setWhatsThis(i18n("Enter here the name for the profile you are creating")); ++ ++ ed->setToolTip(i18n("The name for the new profile")); ++ ed->setWhatsThis(i18n("Enter here the name for the profile you are creating")); ++ ++ lay->addRow(lb); ++ lay->addRow(ibt, ed); ++ ++ wg->setLayout(lay); ++ ++ dialog->setMainWidget(wg); ++ ed->setFocus(); ++ ++ if (dialog->exec() == KDialog::Accepted) { ++ createProfile(ed->text(), ibt->icon()); ++ } ++ delete dialog; ++} ++ ++void EditPage::editProfile(const QString &id, const QString &name, const QString &icon) ++{ ++ if (id.isEmpty() || !m_profilesConfig->hasGroup(id)) { ++ return; ++ } ++ ++ KConfigGroup group(m_profilesConfig, id); ++ ++ group.writeEntry("icon", icon); ++ group.writeEntry("name", name); ++ ++ group.sync(); ++ ++ // Notify the daemon ++ notifyDaemon(id); ++ ++ reloadAvailableProfiles(); ++} ++ ++void EditPage::editProfile() ++{ ++ if (!profilesList->currentItem()) { ++ return; ++ } ++ ++ KDialog *dialog = new KDialog(this); ++ QWidget *wg = new QWidget(); ++ KLineEdit *ed = new KLineEdit(wg); ++ QLabel *lb = new QLabel(wg); ++ QFormLayout *lay = new QFormLayout(); ++ KIconButton *ibt = new KIconButton(wg); ++ ++ ibt->setIconSize(KIconLoader::SizeSmall); ++ ++ lb->setText(i18n("Please enter a name for this profile:")); ++ ++ lb->setToolTip(i18n("The name for the new profile")); ++ lb->setWhatsThis(i18n("Enter here the name for the profile you are creating")); ++ ++ ed->setToolTip(i18n("The name for the new profile")); ++ ed->setWhatsThis(i18n("Enter here the name for the profile you are creating")); ++ ++ KConfigGroup group(m_profilesConfig, profilesList->currentItem()->data(Qt::UserRole).toString()); ++ ++ ibt->setIcon(group.readEntry("icon")); ++ ed->setText(group.readEntry("name")); ++ ++ lay->addRow(lb); ++ lay->addRow(ibt, ed); ++ ++ wg->setLayout(lay); ++ ++ dialog->setMainWidget(wg); ++ ed->setFocus(); ++ ++ if (dialog->exec() == KDialog::Accepted) { ++ editProfile(profilesList->currentItem()->data(Qt::UserRole).toString(), ed->text(), ibt->icon()); ++ } ++ ++ delete dialog; ++} ++ ++void EditPage::importProfiles() ++{ ++ QString fileName = KFileDialog::getOpenFileName(KUrl(), "*.kpmsprofiles|KDE Power Management System Profiles " ++ "(*.kpmsprofiles)", this, i18n("Import Power Management Profiles")); ++ ++ if (fileName.isEmpty()) { ++ return; ++ } ++ ++ KConfig toImport(fileName, KConfig::SimpleConfig); ++ ++ foreach(const QString &ent, toImport.groupList()) { ++ KConfigGroup copyFrom(&toImport, ent); ++ KConfigGroup copyTo(m_profilesConfig, ent); ++ ++ copyFrom.copyTo(©To); ++ } ++ ++ m_profilesConfig->sync(); ++ ++ // Notify the daemon ++ QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement", ++ "org.kde.Solid.PowerManagement", "reparseConfiguration"); ++ QDBusConnection::sessionBus().asyncCall(call); ++ ++ reloadAvailableProfiles(); ++} ++ ++void EditPage::exportProfiles() ++{ ++ QString fileName = KFileDialog::getSaveFileName(KUrl(), "*.kpmsprofiles|KDE Power Management System Profiles " ++ "(*.kpmsprofiles)", this, i18n("Export Power Management Profiles")); ++ ++ if (fileName.isEmpty()) { ++ return; ++ } ++ ++ kDebug() << "Filename is" << fileName; ++ ++ KConfig *toExport = m_profilesConfig->copyTo(fileName); ++ ++ toExport->sync(); ++ ++ delete toExport; ++} ++ ++void EditPage::restoreDefaultProfiles() ++{ ++ // Confirm ++ int ret = KMessageBox::warningContinueCancel(this, i18n("The KDE Power Management System will now generate a set of default " ++ "profiles based on your computer's capabilities. This will also erase " ++ "all existing profiles. " ++ "Are you sure you want to continue?"), i18n("Restore Default Profiles")); ++ if (ret == KMessageBox::Continue) { ++ kDebug() << "Restoring defaults."; ++ PowerDevil::ProfileGenerator::generateProfiles(); ++ ++ // Notify the daemon ++ notifyDaemon(); ++ ++ reloadAvailableProfiles(); ++ } ++} ++ ++void EditPage::switchProfile(QListWidgetItem *current, QListWidgetItem *previous) ++{ ++ Q_UNUSED(current) ++ ++ if (!m_profileEdited) { ++ loadProfile(); ++ } else { ++ if (!previous) { ++ // Pass by, the profile has probably been deleted ++ loadProfile(); ++ return; ++ } else if (!m_profilesConfig.data()->groupList().contains(previous->text())) { ++ // Pass by, the profile has probably been deleted ++ loadProfile(); ++ return; ++ } ++ ++ int result = KMessageBox::warningYesNoCancel(this, i18n("The current profile has not been saved.\n" ++ "Do you want to save it?"), i18n("Save Profile")); ++ ++ if (result == KMessageBox::Yes) { ++ saveProfile(previous->data(Qt::UserRole).toString()); ++ loadProfile(); ++ } else if (result == KMessageBox::No) { ++ loadProfile(); ++ } else if (result == KMessageBox::Cancel) { ++ disconnect(profilesList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), ++ this, SLOT(switchProfile(QListWidgetItem*, QListWidgetItem*))); ++ profilesList->setCurrentItem(previous); ++ connect(profilesList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), ++ SLOT(switchProfile(QListWidgetItem*, QListWidgetItem*))); ++ } ++ } ++} ++ ++void EditPage::openUrl(const QString &url) ++{ ++ new KRun(KUrl(url), this); ++} ++ ++void EditPage::defaults() ++{ ++ restoreDefaultProfiles(); ++} ++ ++#include "EditPage.moc" +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/EditPage.h.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/EditPage.h.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/EditPage.h.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/EditPage.h.svn-base 2010-12-12 14:48:46.930000002 -0800 +@@ -0,0 +1,74 @@ ++/*************************************************************************** ++ * 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 EDITPAGE_H ++#define EDITPAGE_H ++ ++#include ++ ++#include "ui_profileEditPage.h" ++ ++namespace PowerDevil { ++class ActionConfig; ++} ++ ++class QCheckBox; ++class KToolBar; ++ ++class EditPage : public KCModule, private Ui_profileEditPage ++{ ++ Q_OBJECT ++ ++public: ++ explicit EditPage(QWidget *parent, const QVariantList &args); ++ ~EditPage(); ++ ++ void load(); ++ void save(); ++ virtual void defaults(); ++ ++private slots: ++ void onChanged(bool changed); ++ void loadProfile(); ++ void saveProfile(const QString &p = QString()); ++ void switchProfile(QListWidgetItem *current, QListWidgetItem *previous); ++ void reloadAvailableProfiles(); ++ void createProfile(const QString &name, const QString &icon); ++ void editProfile(const QString &id, const QString &name, const QString &icon); ++ void deleteCurrentProfile(); ++ void createProfile(); ++ void editProfile(); ++ ++ void importProfiles(); ++ void exportProfiles(); ++ void restoreDefaultProfiles(); ++ ++ void notifyDaemon(const QString &editedProfile = QString()); ++ ++ void openUrl(const QString &url); ++ ++private: ++ KSharedConfig::Ptr m_profilesConfig; ++ QHash< QString, QCheckBox* > m_actionsHash; ++ QHash< QString, PowerDevil::ActionConfig* > m_actionsConfigHash; ++ bool m_profileEdited; ++ KToolBar *m_toolBar; ++}; ++ ++#endif /* EDITPAGE_H */ +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/Messages.sh.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/Messages.sh.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/Messages.sh.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/Messages.sh.svn-base 2010-12-12 14:48:46.930000002 -0800 +@@ -0,0 +1,5 @@ ++#! /bin/sh ++$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11 ++$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/powerdevilprofilesconfig.pot ++rm -f rc.cpp ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/powerdevilprofilesconfig.desktop.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/powerdevilprofilesconfig.desktop.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/powerdevilprofilesconfig.desktop.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/powerdevilprofilesconfig.desktop.svn-base 2010-12-12 14:48:46.930000002 -0800 +@@ -0,0 +1,67 @@ ++[Desktop Entry] ++Exec=kcmshell4 powerdevilprofilesconfig ++Icon=document-edit ++Type=Service ++X-KDE-ServiceTypes=KCModule ++X-DocPath=kcontrol/powerdevil/index.html ++ ++X-KDE-Library=kcm_powerdevilprofilesconfig ++X-KDE-ParentApp=kcontrol ++ ++X-KDE-System-Settings-Parent-Category=power-management ++ ++Name=Power Profiles ++Name[ast]=Perfiles d'enerxía ++Name[ca]=Perfils d'energia ++Name[da]=Strømstyringsprofiler ++Name[de]=Energieprofile ++Name[en_GB]=Power Profiles ++Name[es]=Perfiles de energía ++Name[et]=Voolutarbe profiilid ++Name[hr]=Energetski profili ++Name[ia]=Profilos de energia ++Name[ja]=電源プロファイル ++Name[kk]=Қуаттандыру профильдері ++Name[km]=ទម្រង់​ថាមពល ++Name[ko]=전원 프로필 ++Name[lt]=Energijos profiliai ++Name[nb]=Strømprofiler ++Name[nds]=Stroomkuntrull-Profilen ++Name[nl]=Energieprofielen ++Name[pa]=ਪਾਵਰ ਪਰੋਫਾਇਲ ++Name[pt]=Perfis de Energia ++Name[pt_BR]=Perfis de energia ++Name[sv]=Strömprofiler ++Name[th]=โพรไฟล์พลังงาน ++Name[uk]=Профілі живлення ++Name[x-test]=xxPower Profilesxx ++Name[zh_TW]=電源設定檔 ++ ++Comment=Configure Power Management Profiles ++Comment[ast]=Configurar los perfiles de xestión d'enerxía ++Comment[ca]=Configura els perfils de gestió d'energia ++Comment[da]=Indstil strømstyringsprofiler ++Comment[de]=Energieprofile einrichten ++Comment[en_GB]=Configure Power Management Profiles ++Comment[es]=Configurar los perfiles de gestión de energía ++Comment[et]=Voolutarbe profiilide teenuste seadistamine ++Comment[hr]=Podešavanje profila za upravljanje potrošnjom energije ++Comment[ia]=Configurar profilos de gestion de Energia ++Comment[ja]=電源管理プロファイルを設定します ++Comment[kk]=Қуаттандыру профильдерін баптау ++Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ទម្រង់​គ្រប់គ្រង​ថាមពល ++Comment[ko]=전원 관리 프로필 설정 ++Comment[lt]=Konfigūruoti energijos valdymo profilius ++Comment[nb]=Tilpass strømstyringsprofiler ++Comment[nds]=Stroomkuntrullprofilen instellen ++Comment[nl]=Profielen voor energiebeheer instellen ++Comment[pa]=ਪਾਵਰ ਪਰਬੰਧ ਪਰੋਫਾਇਲ ਸੰਰਚਨਾ ++Comment[pt]=Configurar os Perfis de Gestão de Energia ++Comment[pt_BR]=Configura os perfis de gerenciamento de energia ++Comment[sv]=Anpassa strömhanteringsprofiler ++Comment[th]=ปรับแต่งโพรไฟล์การจัดการพลังงาน ++Comment[uk]=Налаштування профілів керування живленням ++Comment[x-test]=xxConfigure Power Management Profilesxx ++Comment[zh_TW]=設定電源管理 ++ ++X-KDE-Keywords=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/profileEditPage.ui.svn-base ../powerdevil/kcmodule/profiles/.svn/text-base/profileEditPage.ui.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/profiles/.svn/text-base/profileEditPage.ui.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/profiles/.svn/text-base/profileEditPage.ui.svn-base 2010-12-12 14:48:46.930000002 -0800 +@@ -0,0 +1,99 @@ ++ ++ ++ profileEditPage ++ ++ ++ ++ 0 ++ 0 ++ 683 ++ 293 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 250 ++ 16777215 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ QFrame::NoFrame ++ ++ ++ QFrame::Plain ++ ++ ++ 0 ++ ++ ++ true ++ ++ ++ ++ ++ 0 ++ 0 ++ 334 ++ 283 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ New Profile ++ ++ ++ ++ ++ Delete Profile ++ ++ ++ ++ ++ Import Profiles ++ ++ ++ ++ ++ Export Profiles ++ ++ ++ ++ ++ Restore Default Profiles ++ ++ ++ ++ ++ Edit Profile ++ ++ ++ ++ ++ ++ KListWidget ++ QListWidget ++
klistwidget.h
++
++
++ ++ ++
+diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/.svn/entries ../powerdevil/kcmodule/.svn/entries +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/.svn/entries 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/.svn/entries 2010-12-12 14:48:46.936666668 -0800 +@@ -0,0 +1,68 @@ ++10 ++ ++dir ++1205882 ++svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/workspace/powerdevil/kcmodule ++svn://anonsvn.kde.org/home/kde ++ ++ ++ ++2010-12-09T07:22:25.427202Z ++1204816 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++283d02a7-25f6-0310-bc7c-ecb5cbfe19da ++ ++global ++dir ++ ++profiles ++dir ++ ++CMakeLists.txt ++file ++ ++ ++ ++ ++2010-12-12T22:48:46.933333Z ++3d19d50d0b69c59b268845d2e61e62fd ++2010-10-21T11:22:49.772484Z ++1188090 ++dafre ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++52 ++ +diff -Naur kdebase-workspace-4.5.85/powerdevil//kcmodule/.svn/text-base/CMakeLists.txt.svn-base ../powerdevil/kcmodule/.svn/text-base/CMakeLists.txt.svn-base +--- kdebase-workspace-4.5.85/powerdevil//kcmodule/.svn/text-base/CMakeLists.txt.svn-base 1969-12-31 16:00:00.000000000 -0800 ++++ ../powerdevil/kcmodule/.svn/text-base/CMakeLists.txt.svn-base 2010-12-12 14:48:46.933333335 -0800 +@@ -0,0 +1,2 @@ ++add_subdirectory(global) ++add_subdirectory(profiles) +diff -Naur kdebase-workspace-4.5.85/powerdevil//powerdevil.notifyrc ../powerdevil/powerdevil.notifyrc +--- kdebase-workspace-4.5.85/powerdevil//powerdevil.notifyrc 2010-12-01 14:22:40.000000000 -0800 ++++ ../powerdevil/powerdevil.notifyrc 2010-12-12 14:48:46.940000001 -0800 +@@ -2,6 +2,7 @@ + Name=KDE Power Management System + Name[ca]=Sistema de gestió d'energia del KDE + Name[da]=KDE's strømstyringssystem ++Name[en_GB]=KDE Power Management System + Name[et]=KDE toitehalduse süsteem + Name[hu]=KDE energiakezelő rendszer + Name[ia]=Systema de Gestion de Energia de KDE +@@ -22,6 +23,7 @@ + Comment=Notifications for KDE Power Management system + Comment[ca]=Notificacions per al sistema de gestió d'energia del KDE + Comment[da]=Bekendtgørelser for KDE's strømstyringssystem ++Comment[en_GB]=Notifications for KDE Power Management system + Comment[et]=KDE toitehalduse süsteemi märguanded + Comment[ia]=Notificationes pro systema de gestion de Energia de KDE + Comment[kk]=KDE қуаттандыру басқару жүйесінің құлқтандырулары +@@ -128,7 +130,7 @@ + Comment[ar]=يُستخدم للتنبيهات التحذيرية + Comment[ast]=Usáu pa notificaciones d'avisu + Comment[be@latin]=Dla aścierahalnych paviedamleńniaŭ +-Comment[bg]=Предупреждения ++Comment[bg]=Използва се за предупреждения + Comment[ca]=S'usa per a les notificacions d'avís + Comment[ca@valencia]=S'usa per a les notificacions d'avís + Comment[cs]=Použito pro varování a upozornění +@@ -1686,6 +1688,7 @@ + Name=Internal KDE Power Management System Error + Name[ca]=Error intern del sistema de gestió d'energia del KDE + Name[da]=Intern fejl i KDE's strømstyringssystem ++Name[en_GB]=Internal KDE Power Management System Error + Name[et]=Sisemine KDE toitehalduse süsteemi tõrge + Name[ia]=Error Interne Systema de Gestion de Energia de KDE + Name[kk]=KDE қуаттандыру басқару жүйесінің ішкі қатесі +@@ -1704,6 +1707,7 @@ + Comment=The KDE Power Management System has triggered an internal error + Comment[ca]=El sistema de gestió d'energia del KDE ha activat un error intern + Comment[da]=KDE's strømstyringssystem har udløst en intern fejl ++Comment[en_GB]=The KDE Power Management System has triggered an internal error + Comment[et]=KDE toitehalduse süsteemi tabas sisemine tõrge + Comment[ia]=Le Systema de Gestion de Energia de KDE ha generate un error interne + Comment[kk]=KDE қуаттандыру басқару жүйесінде ішкі бір қатесі орын алды +@@ -1862,12 +1866,14 @@ + Name=Broken battery notification + Name[ca]=Notificació de bateria trencada + Name[da]=Bekendtgørelse af defekt batteri ++Name[en_GB]=Broken battery notification + Name[et]=Katkise aku märguanne + Name[ia]=Notification de Batteria rupte + Name[kk]=Батареяның істен шыққаны туралы хабарлауы + Name[km]=ការ​ជូន​ដំណឹង​ថ្ម​ខូច + Name[lt]=Pranešimas apie sugedusią bateriją + Name[nb]=Varsling om ødelagt batteri ++Name[nds]=Bescheed över Batteriefehlers + Name[nl]=Gebroken batterijmelding + Name[pa]=ਖਰਾਬ ਨੈਟਰੀ ਨੋਟੀਫਿਕੇਸ਼ਨ + Name[pt]=Notificação de baterias com problemas +@@ -1879,6 +1885,7 @@ + Comment=This notification will pop up if KDE Power Management System detects some troubles with one of your batteries + Comment[ca]=Aquesta notificació apareixerà si el sistema de gestió d'energia del KDE detecta algun problema amb alguna de les bateries + Comment[da]=Denne bekendtgørelse vil dukke op hvis KDE's strømstyringssystem finder problemer med et af dine batterier ++Comment[en_GB]=This notification will pop up if KDE Power Management System detects some troubles with one of your batteries + Comment[et]=Seda märguannet näeb, kui KDE toitehalduse süsteem tuvastab mingeid probleeme mõne su akuga + Comment[ia]=Iste notification apparera con un popup si le Systema de Gestion de Energia de KDE releva alcun problemas con un de tu batterias + Comment[kk]=Бұл KDE қуаттандыруды басқару жүйесі батареяыздың бір мәселесін байқағанда шығаратын құлақтандыру diff --git a/kdebase/PKGBUILD b/kdebase/PKGBUILD index b2e220d8e..896237e64 100644 --- a/kdebase/PKGBUILD +++ b/kdebase/PKGBUILD @@ -33,7 +33,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=("kdebase-workspace>=${_kdever}" 'pkgconfig' 'cmake' 'automoc4' 'libraw1394' 'ruby') # 'opencv' diff --git a/kdebindings/PKGBUILD b/kdebindings/PKGBUILD index 1df0d6e89..bd20e0e50 100644 --- a/kdebindings/PKGBUILD +++ b/kdebindings/PKGBUILD @@ -37,7 +37,7 @@ url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') install=${_origname}.install -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" 'pyqt>=4.8.1' 'ruby' 'mono' "kdegraphics-okular>=${_kdever}" "kdegraphics-common>=${_kdever}" "kdepim-runtime>=${_kdever}") diff --git a/kdeedu/PKGBUILD b/kdeedu/PKGBUILD index fed1de4bf..c5c96620d 100644 --- a/kdeedu/PKGBUILD +++ b/kdeedu/PKGBUILD @@ -49,7 +49,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' 'ocaml' 'facile' 'eigen' 'cfitsio' "kdelibs>=${_kdever}" "kdebase-runtime>=${_kdever}" 'openbabel' 'libqalculate' 'gsl' 'boost' 'indilib' 'r>=2.11.1' diff --git a/kdegames/PKGBUILD b/kdegames/PKGBUILD index b234b5129..600a552ff 100644 --- a/kdegames/PKGBUILD +++ b/kdegames/PKGBUILD @@ -68,7 +68,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" "kdebase-runtime>=${_kdever}" 'qca' 'ggz-client-libs' 'gnugo' 'twisted' 'openal') diff --git a/kdegraphics/PKGBUILD b/kdegraphics/PKGBUILD index 2e010fe86..c2852c8cb 100644 --- a/kdegraphics/PKGBUILD +++ b/kdegraphics/PKGBUILD @@ -36,7 +36,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" "kdebase-runtime>=${_kdever}" 'poppler-qt' 'libspectre' 'sane' 'chmlib' 'libdjvu' 'lcms' 'qca' diff --git a/kdemultimedia/PKGBUILD b/kdemultimedia/PKGBUILD index ea0ec899e..d05af5585 100644 --- a/kdemultimedia/PKGBUILD +++ b/kdemultimedia/PKGBUILD @@ -34,7 +34,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" "kdebase-runtime>=${_kdever}" 'tunepimp' 'cdparanoia' 'mplayer' 'libpulse' 'musicbrainz>=3.0.3') diff --git a/kdenetwork/PKGBUILD b/kdenetwork/PKGBUILD index 397a95d9c..7f2c64dcb 100644 --- a/kdenetwork/PKGBUILD +++ b/kdenetwork/PKGBUILD @@ -34,7 +34,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost' 'speex' 'ortp' 'libotr' 'qca-ossl' "kdebase-workspace>=${_kdever}" diff --git a/kdesdk/PKGBUILD b/kdesdk/PKGBUILD index 27ccbe3a0..db0da5aaf 100644 --- a/kdesdk/PKGBUILD +++ b/kdesdk/PKGBUILD @@ -46,7 +46,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' 'boost' "kdebase-runtime>=${_kdever}" 'antlr2' "kdepimlibs>=${_kdever}" 'subversion' "kdebindings-python>=${_kdever}" "kdepim-runtime>=${_kdever}") diff --git a/kdetoys/PKGBUILD b/kdetoys/PKGBUILD index 875425e1b..4308c6cb2 100644 --- a/kdetoys/PKGBUILD +++ b/kdetoys/PKGBUILD @@ -33,7 +33,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdebase-workspace>=${_kdever}") diff --git a/kdeutils/PKGBUILD b/kdeutils/PKGBUILD index 0c0bb8ab9..fb4ccc4ae 100644 --- a/kdeutils/PKGBUILD +++ b/kdeutils/PKGBUILD @@ -41,7 +41,7 @@ pkgdesc="split package" url="http://www.kde.org" license=('GPL' 'LGPL' 'FDL') -options=('docs' '!splithdr' 'splitdbg') +options=('docs' '!splithdr' 'splitdbg' 'log') makedepends=('pkgconfig' 'cmake' 'automoc4' "kdelibs>=${_kdever}" "kdepimlibs>=${_kdever}" "kdebase>=${_kdever}"