diff options
Diffstat (limited to 'src/kpowersave.cpp')
-rw-r--r-- | src/kpowersave.cpp | 84 |
1 files changed, 26 insertions, 58 deletions
diff --git a/src/kpowersave.cpp b/src/kpowersave.cpp index fba5562..ad4e942 100644 --- a/src/kpowersave.cpp +++ b/src/kpowersave.cpp @@ -30,6 +30,7 @@ #include <knotifydialog.h> #include <kpassivepopup.h> #include <tdepopupmenu.h> +#include <khelpmenu.h> // other TQt headers: #include <tqcursor.h> @@ -191,7 +192,7 @@ void kpowersave::initMenu() { STANDBY_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("stand_by", TQIconSet::Automatic), i18n("Standby"), this, TQT_SLOT(do_standby())); - speed_menu = new TQPopupMenu(this, i18n("Set CPU Frequency Policy").ascii()); + speed_menu = new TQPopupMenu(this, i18n("Set CPU Frequency Policy").utf8()); speed_menu->insertItem(i18n("Performance"), PERFORMANCE); speed_menu->insertItem(i18n("Dynamic"), DYNAMIC); speed_menu->insertItem(i18n("Powersave"), POWERSAVE); @@ -205,7 +206,7 @@ void kpowersave::initMenu() { SCHEME_SEPARATOR_MENU_ID = contextMenu()->insertSeparator(); - scheme_menu = new TQPopupMenu(this, i18n("Set Active Scheme").ascii()); + scheme_menu = new TQPopupMenu(this, i18n("Set Active Scheme").utf8()); SCHEME_MENU_ID = contextMenu()->insertItem(i18n("Set Active Scheme"), scheme_menu); connect(scheme_menu, TQT_SIGNAL(activated(int)), this, TQT_SLOT(do_setActiveScheme(int))); @@ -219,17 +220,11 @@ void kpowersave::initMenu() { HELP_SEPARATOR_MENU_ID = contextMenu()->insertSeparator(); - help_menu = new TQPopupMenu(this, i18n("&Help").ascii()); - - help_menu->insertItem( SmallIcon("help", TQIconSet::Automatic), i18n("&KPowersave Handbook"), - this, TQT_SLOT(slotHelp())); - help_menu->insertSeparator(); - help_menu->insertItem( i18n("&Report a bug ..."), this, TQT_SLOT(slotReportBug())); - help_menu->insertItem( SmallIcon("kpowersave", TQIconSet::Automatic), - i18n("&About KPowersave"), this, TQT_SLOT(slotAbout())); - - HELP_MENU = contextMenu()->insertItem(SmallIcon("help", TQIconSet::Automatic), - i18n("&Help"), help_menu); + // Create help submenu + KHelpMenu *m_help = new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false, actionCollection()); + TDEPopupMenu *help = m_help->menu(); + help->connectItem(KHelpMenu::menuHelpContents, this, TQT_SLOT(slotHelpContents())); + this->contextMenu()->insertItem(SmallIcon("help"), KStdGuiItem::help().text(), help); connect(this, TQT_SIGNAL(quitSelected()), this, TQT_SLOT(_quit())); @@ -284,7 +279,7 @@ void kpowersave::showConfigureDialog() { else { KPassivePopup::message(i18n("WARNING"), i18n("Cannot find any schemes."), SmallIcon("messagebox_warning", 20), this, - i18n("Warning").ascii(), 15000); + i18n("Warning").utf8(), 15000); } } else { configDlg->setWindowState(configDlg->windowState() & ~Qt::WindowMinimized | Qt::WindowActive); @@ -557,34 +552,6 @@ void kpowersave::slotAbout() } /*! - * \b TQT_SLOT to open the website to report bugs - */ -void kpowersave::slotReportBug() -{ -#ifdef DISTRO_IS_SUSE - #ifdef DISTRO_IS_SLES_SLED - kapp->invokeBrowser("https://bugzilla.novell.com/"); - #else - kapp->invokeBrowser("http://en.opensuse.org/Submitting_Bug_Reports"); - #endif -#else - #ifdef DISTRO_IS_ALTLINUX - kapp->invokeBrowser("http://bugzilla.altlinux.org/"); - #else - #ifdef DISTRO_IS_UBUNTU - kapp->invokeBrowser("https://launchpad.net/distros/ubuntu/+bugs"); - #else - #ifdef DISTRO_IS_PARDUS - kapp->invokeBrowser("http://bugs.pardus.org.tr/"); - #else - kapp->invokeBrowser("http://sourceforge.net/tracker/?group_id=124576&atid=700009"); - #endif - #endif - #endif -#endif -} - -/*! * \b TQT_SLOT to set the icon background on/off if battery is in critical, low or warning-state. Within * this function we set \ref icon_state_changed to true and call \ref redrawPixmap() to redraw the * kickerapplet icon and create a icon with blinking background. \n \n @@ -599,6 +566,7 @@ void kpowersave::do_setIconBG(){ kdDebugFuncOut(trace); } + /*! * \b TQT_SLOT to enable/disable the autosuspend. */ @@ -717,7 +685,7 @@ bool kpowersave::do_suspend2disk(){ } else { KPassivePopup::message( i18n("WARNING"),i18n("Hibernation failed"), SmallIcon("messagebox_warning", 20), this, - i18n("Warning").ascii(), 15000); + i18n("Warning").utf8(), 15000); kdDebugFuncOut(trace); return false; } @@ -725,7 +693,7 @@ bool kpowersave::do_suspend2disk(){ KPassivePopup::message( i18n("WARNING"), i18n("Hibernation disabled by administrator."), SmallIcon("messagebox_warning", 20), - this, i18n("Warning").ascii(), 15000); + this, i18n("Warning").utf8(), 15000); this->contextMenu()->setItemEnabled(SUSPEND2DISK_MENU_ID, false); kdDebugFuncOut(trace); return false; @@ -773,7 +741,7 @@ bool kpowersave::do_suspend2ram(){ } else { KPassivePopup::message( i18n("WARNING"),i18n("Suspend mode failed"), SmallIcon("messagebox_warning", 20), this, - i18n("Warning").ascii(), 15000); + i18n("Warning").utf8(), 15000); kdDebugFuncOut(trace); return false; } @@ -781,7 +749,7 @@ bool kpowersave::do_suspend2ram(){ KPassivePopup::message( i18n("WARNING"), i18n("Suspend mode disabled by administrator."), SmallIcon("messagebox_warning", 20), this, - i18n("Warning").ascii(), 15000); + i18n("Warning").utf8(), 15000); this->contextMenu()->setItemEnabled(SUSPEND2RAM_MENU_ID, false); kdDebugFuncOut(trace); return false; @@ -829,14 +797,14 @@ bool kpowersave::do_standby(){ } else { KPassivePopup::message( i18n("WARNING"),i18n("Standby failed"), SmallIcon("messagebox_warning", 20), this, - i18n("Warning").ascii(), 15000); + i18n("Warning").utf8(), 15000); kdDebugFuncOut(trace); return false; } } else { KPassivePopup::message( i18n("WARNING"),i18n("Standby disabled by administrator."), SmallIcon("messagebox_warning", 20), this, - i18n("Warning").ascii(), 15000); + i18n("Warning").utf8(), 15000); this->contextMenu()->setItemEnabled(STANDBY_MENU_ID, false); kdDebugFuncOut(trace); return false; @@ -1192,7 +1160,7 @@ void kpowersave::handleLidEvent( bool closed ){ "be a problem with the selected \nlock " "method or something else."), SmallIcon("messagebox_warning", 20), this, - i18n("Warning").ascii(), 10000); + i18n("Warning").utf8(), 10000); } } @@ -1310,7 +1278,7 @@ void kpowersave::do_setSpeedPolicy(int menu_id){ if(!hwinfo->setCPUFreq((cpufreq_type)menu_id, settings->cpuFreqDynamicPerformance)) { KPassivePopup::message(i18n("WARNING"), i18n("CPU Freq Policy %1 could not be set.").arg(speed_menu->text(menu_id)), - SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 10000); + SmallIcon("messagebox_warning", 20), this, i18n("Warning").utf8(), 10000); } else { hwinfo->checkCurrentCPUFreqPolicy(); update(); @@ -1339,7 +1307,7 @@ void kpowersave::do_setActiveScheme( int i ){ } else if (!settings->schemes[i]){ KPassivePopup::message( i18n("WARNING"), i18n("Scheme %1 could not be activated.").arg(scheme_menu->text(i)), - SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 5000); + SmallIcon("messagebox_warning", 20), this, i18n("Warning").utf8(), 5000); } kdDebugFuncOut(trace); @@ -1533,12 +1501,12 @@ void kpowersave::updateSchemeMenu(){ if ( *it == settings->ac_scheme ){ scheme_menu->insertItem( SmallIcon("scheme_power", TQIconSet::Automatic), - i18n( ((TQString)*it).ascii() ), x, x); + i18n( ((TQString)*it).utf8() ), x, x); } else{ if ( *it == settings->battery_scheme ){ scheme_menu->insertItem(SmallIcon("scheme_powersave", TQIconSet::Automatic), - i18n( (*it).ascii() ), x, x); + i18n( (*it).utf8() ), x, x); } else{ if ((TQString)*it == "Acoustic"){ @@ -1558,7 +1526,7 @@ void kpowersave::updateSchemeMenu(){ i18n( "Advanced Powersave" ), x, x); } else { - scheme_menu->insertItem(i18n( (*it).ascii() ), x, x); + scheme_menu->insertItem(i18n( (*it).utf8() ), x, x); } } } @@ -1709,7 +1677,7 @@ void kpowersave::showHalErrorMsg() { i18n("Could not get information from HAL. The haldaemon is " "maybe not running."), SmallIcon("messagebox_warning", 20), this, - i18n("Error").ascii(), 5000); + i18n("Error").utf8(), 5000); } else if (hwinfo->hal_terminated && !hal_error_shown && !DISPLAY_HAL_ERROR_Timer->isActive()) { hal_error_shown = true; @@ -1738,7 +1706,7 @@ void kpowersave::showErrorMessage( TQString msg ){ if(settings->psMsgAsPassivePopup) { KPassivePopup::message("KPowersave", msg, SmallIcon("messagebox_warning", 20), - this, i18n("Warning").ascii(), 10000); + this, i18n("Warning").utf8(), 10000); } else { kapp->updateUserTimestamp(); // KMessageBox::error( 0, msg); @@ -2184,7 +2152,7 @@ void kpowersave::notifySchemeSwitch() { eventType = "scheme_" + _scheme; KNotifyClient::event( this->winId(), eventType, - i18n("Switched to scheme: %1").arg(i18n(_scheme.ascii())).ascii()); + i18n("Switched to scheme: %1").arg(i18n(_scheme.utf8()))); } kdDebugFuncOut(trace); @@ -2293,7 +2261,7 @@ void kpowersave::handleResumeSignal() { KPassivePopup::message( i18n("WARNING"), i18n("Could not remount (all) external storage" " media."), SmallIcon("messagebox_warning", 20), - this, i18n("Warning").ascii(), 15000); + this, i18n("Warning").utf8(), 15000); } } else { kdError() << "Unknown error while suspend. Errorcode: " << resume_result << endl; |