diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-04-15 17:42:29 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-04-15 17:42:29 -0500 |
commit | 3ec8230e9f10645de684b5e03471e293481183d7 (patch) | |
tree | 0a9f15fcc62fb8a0e84eb8270ff30262274f3f4c /src/kpowersave.cpp | |
parent | 82806a03ea419871940eb3c03c792f3ea15734d9 (diff) | |
download | tdepowersave-3ec8230e9f10645de684b5e03471e293481183d7.tar.gz tdepowersave-3ec8230e9f10645de684b5e03471e293481183d7.zip |
Initial migration off of HAL
Diffstat (limited to 'src/kpowersave.cpp')
-rw-r--r-- | src/kpowersave.cpp | 91 |
1 files changed, 3 insertions, 88 deletions
diff --git a/src/kpowersave.cpp b/src/kpowersave.cpp index b1c3a35..3f19e22 100644 --- a/src/kpowersave.cpp +++ b/src/kpowersave.cpp @@ -102,8 +102,6 @@ kpowersave::kpowersave( bool force_acpi_check, bool trace_func ) : KSystemTray(0 // connect to error mesages connect(autoSuspend, TQT_SIGNAL(displayErrorMsg(TQString)), this, TQT_SLOT(showErrorMessage(TQString))); - connect(hwinfo, TQT_SIGNAL(halRunning(bool)), this, TQT_SLOT(showHalErrorMsg())); - connect(hwinfo, TQT_SIGNAL(dbusRunning(int)), this, TQT_SLOT(showDBusErrorMsg(int))); // connect to events connect(hwinfo, TQT_SIGNAL(lidclosetStatus(bool)), this, TQT_SLOT(handleLidEvent(bool))); @@ -121,7 +119,6 @@ kpowersave::kpowersave( bool force_acpi_check, bool trace_func ) : KSystemTray(0 config_dialog_shown = false; suspend_dialog_shown = false; detailedIsShown = false; - hal_error_shown = false; icon_set_colored = false; icon_BG_is_colored = false; @@ -134,9 +131,6 @@ kpowersave::kpowersave( bool force_acpi_check, bool trace_func ) : KSystemTray(0 BAT_WARN_ICON_Timer = new TQTimer(this); connect(BAT_WARN_ICON_Timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(do_setIconBG())); - DISPLAY_HAL_ERROR_Timer = new TQTimer(this); - connect(DISPLAY_HAL_ERROR_Timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(showHalErrorMsg())); - AUTODIMM_Timer = new TQTimer(this); initMenu(); @@ -287,7 +281,7 @@ void kpowersave::showConfigureDialog() { i18n("Warning").ascii(), 15000); } } else { - configDlg->setWindowState(configDlg->windowState() & ~Qt::WindowMinimized | Qt::WindowActive); + configDlg->setWindowState((configDlg->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); configDlg->setActiveWindow(); } @@ -317,7 +311,7 @@ void kpowersave::loadIcon(){ BatteryCollection *primary = hwinfo->getPrimaryBatteries(); - if (hwinfo->hal_terminated || !hwinfo->isOnline() ) { + if ( !hwinfo->isOnline() ) { pixmap_name_tmp = TQString("ERROR"); } else if (hwinfo->getAcAdapter() || primary->getBatteryState() == BAT_NONE) { @@ -461,7 +455,7 @@ void kpowersave::updateTooltip(){ num3.setNum(minutes % 60); num3 = num3.rightJustify(2, '0'); - if (hwinfo->hal_terminated){ + if ( !hwinfo->isOnline() ){ tmp = i18n("No information about battery and AC status available"); } else if (hwinfo->getAcAdapter()) { @@ -1648,85 +1642,6 @@ void kpowersave::closedetaileddialog() { } /*! - * \b TQT_SLOT used to display error messages related to D-Bus in kpowersave. This function - * block all messeges which we have in kpowersave! - * TODO: do something usefull - */ -void kpowersave::showDBusErrorMsg( int type ){ - kdDebugFuncIn(trace); - - static bool displayed = false; - - TQString msg; - TQString dlg_name; - - switch (type) { - case DBUS_RUNNING: - update(); - return; - case DBUS_NOT_RUNNING: - msg = i18n("The D-Bus daemon is not running.\nStarting it will " - "provide full functionality: /etc/init.d/dbus start"); - dlg_name = "dbusNotRunning"; - break; - default: - kdDebugFuncOut(trace); - return; - } - - if (!displayed && !dlg_name.isEmpty()) { - infoDialog *dlg = new infoDialog( config, i18n("Warning"), msg, - i18n("Don't show this message again."), dlg_name); - - if (!dlg->dialogIsDisabled()) { - dlg->show(); - } - // set this always to true ... this should reduce the calls - displayed = true; - } - - kdDebugFuncOut(trace); -} - -/*! - * \b TQT_SLOT to display the HAL error message. We use this - * function to delay the message, and prevent display them is HAL or - * powersaved restarted. - */ -void kpowersave::showHalErrorMsg() { - kdDebugFuncIn(trace); - - if (hwinfo->isOnline()) { - // HAL is back! - update(); - } - if (!hwinfo->dbus_terminated) { - if(hal_error_shown && !DISPLAY_HAL_ERROR_Timer->isActive() && hwinfo->hal_terminated){ - KPassivePopup::message( i18n("ERROR"), - i18n("Could not get information from HAL. The haldaemon is " - "maybe not running."), - SmallIcon("messagebox_warning", 20), this, - i18n("Error").ascii(), 5000); - } - else if (hwinfo->hal_terminated && !hal_error_shown && !DISPLAY_HAL_ERROR_Timer->isActive()) { - hal_error_shown = true; - DISPLAY_HAL_ERROR_Timer->start(HAL_ERROR_MSG_intervall, true); - } - else if (!hwinfo->hal_terminated) { - hal_error_shown = false; - DISPLAY_HAL_ERROR_Timer->stop(); - } - } else { - // only for the case that HAL is also down with dbus and not back after restart - if (hwinfo->hal_terminated && !hal_error_shown && !DISPLAY_HAL_ERROR_Timer->isActive()) - DISPLAY_HAL_ERROR_Timer->start(HAL_ERROR_MSG_intervall, true); - } - - kdDebugFuncOut(trace); - return; -} - -/*! * \b TQT_SLOT used to display messeges in kpowersave. This function * block all messeges which we have in kpowersave! */ |