summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-18 12:32:26 +0000
committersamelian <samelian@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-01-18 12:32:26 +0000
commita50cc3d292ae7d0867ac69515ffc6a158ef7883b (patch)
tree2aa9527bb566c744ca734d0a52e228329c8abb41
parentce95d7052be28df7af07a659e8751b6e961f31ce (diff)
downloadtdepowersave-a50cc3d2.tar.gz
tdepowersave-a50cc3d2.zip
[applications/kpowersave] make compatible with QT_NO_ASCII_CAST flag
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpowersave@1215362 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--src/configuredialog.cpp4
-rw-r--r--src/dbusHAL.cpp26
-rw-r--r--src/detaileddialog.cpp4
-rw-r--r--src/hardware_cpu.cpp5
-rw-r--r--src/kpowersave.cpp42
5 files changed, 41 insertions, 40 deletions
diff --git a/src/configuredialog.cpp b/src/configuredialog.cpp
index 196b26b..a0e45ae 100644
--- a/src/configuredialog.cpp
+++ b/src/configuredialog.cpp
@@ -146,7 +146,7 @@ void ConfigureDialog::setSchemeList(){
cB_batteryScheme->clear();
for ( QStringList::Iterator it = schemes.begin(); it != schemes.end(); ++it ) {
- QString _tmp = *it;
+ const char *_tmp = (*it).ascii();
if(_tmp == "Performance" || _tmp == i18n("Performance")) {
listBox_schemes->insertItem(SmallIcon("scheme_power", QIconSet::Automatic), i18n(_tmp));
cB_acScheme->insertItem(i18n(_tmp));
@@ -1271,7 +1271,7 @@ void ConfigureDialog::setInactivityBox(){
// actions.append("Turn Off Computer");
for ( QStringList::Iterator it = actions.begin(); it != actions.end(); ++it ) {
- cB_autoInactivity->insertItem( i18n( *it ) );
+ cB_autoInactivity->insertItem( i18n( (*it).ascii() ) );
}
kdDebugFuncOut(trace);
diff --git a/src/dbusHAL.cpp b/src/dbusHAL.cpp
index 3c9a293..926d189 100644
--- a/src/dbusHAL.cpp
+++ b/src/dbusHAL.cpp
@@ -431,12 +431,12 @@ bool dbusHAL::halGetPropertyInt(QString udi, QString property, int *returnval){
DBusError error;
dbus_error_init(&error);
- if (!libhal_device_property_exists(hal_ctx, udi, property, &error)) {
+ if (!libhal_device_property_exists(hal_ctx, udi.ascii(), property.ascii(), &error)) {
kdWarning() << "Property: " << property << " for: " << udi << " doesn't exist." << endl;
goto out;
}
- *returnval = libhal_device_get_property_int(hal_ctx, udi, property, &error);
+ *returnval = libhal_device_get_property_int(hal_ctx, udi.ascii(), property.ascii(), &error);
if (dbus_error_is_set(&error)) {
kdError() << "Fetching property: " << property << " for: " << udi
@@ -470,12 +470,12 @@ bool dbusHAL::halGetPropertyBool(QString udi, QString property, bool *returnval)
DBusError error;
dbus_error_init(&error);
- if (!libhal_device_property_exists(hal_ctx, udi, property, &error)) {
+ if (!libhal_device_property_exists(hal_ctx, udi.ascii(), property.ascii(), &error)) {
kdWarning() << "Property: " << property << " for: " << udi << " doesn't exist." << endl;
goto out;
}
- *returnval = libhal_device_get_property_bool(hal_ctx, udi, property, &error);
+ *returnval = libhal_device_get_property_bool(hal_ctx, udi.ascii(), property.ascii(), &error);
if (dbus_error_is_set(&error)) {
kdError() << "Fetching property: " << property << " for: " << udi
@@ -510,12 +510,12 @@ bool dbusHAL::halGetPropertyString(QString udi, QString property, QString *retur
DBusError error;
dbus_error_init(&error);
- if (!libhal_device_property_exists(hal_ctx, udi, property, &error)) {
+ if (!libhal_device_property_exists(hal_ctx, udi.ascii(), property.ascii(), &error)) {
kdWarning() << "Property: " << property << " for: " << udi << " doesn't exist." << endl;
goto out;
}
- *returnval = libhal_device_get_property_string(hal_ctx, udi, property, &error);
+ *returnval = libhal_device_get_property_string(hal_ctx, udi.ascii(), property.ascii(), &error);
if (dbus_error_is_set(&error)) {
kdError() << "Fetching property: " << property << " for: " << udi
@@ -551,12 +551,12 @@ bool dbusHAL::halGetPropertyStringList (QString udi, QString property, QStringLi
dbus_error_init(&error);
- if (!libhal_device_property_exists(hal_ctx, udi, property, &error)) {
+ if (!libhal_device_property_exists(hal_ctx, udi.ascii(), property.ascii(), &error)) {
kdWarning() << "Property: " << property << " for: " << udi << " doesn't exist." << endl;
goto out;
}
- found = libhal_device_get_property_strlist (hal_ctx, udi, property, &error);
+ found = libhal_device_get_property_strlist (hal_ctx, udi.ascii(), property.ascii(), &error);
if (dbus_error_is_set(&error)) {
kdWarning() << "Error while query existing strlist Property: " << property
@@ -597,7 +597,7 @@ bool dbusHAL::halQueryCapability(QString udi, QString capability, bool *returnva
DBusError error;
dbus_error_init(&error);
- *returnval = libhal_device_query_capability(hal_ctx, udi, capability, &error);
+ *returnval = libhal_device_query_capability(hal_ctx, udi.ascii(), capability.ascii(), &error);
if (dbus_error_is_set(&error)) {
kdError() << "Fetching capability: " << capability << " for: " << udi
@@ -630,7 +630,7 @@ bool dbusHAL::halDevicePropertyExist(QString udi, QString property ) {
DBusError error;
dbus_error_init(&error);
- if (! libhal_device_property_exists (hal_ctx, udi, property, &error)) {
+ if (! libhal_device_property_exists (hal_ctx, udi.ascii(), property.ascii(), &error)) {
if (dbus_error_is_set(&error)) {
kdError() << "Fetching existing property: " << property << " for: " << udi
<< " failed with: " << error.message << endl;
@@ -665,7 +665,7 @@ bool dbusHAL::halFindDeviceByCapability (QString capability, QStringList *device
dbus_error_init(&error);
- found = libhal_find_device_by_capability (hal_ctx, capability, &num, &error);
+ found = libhal_find_device_by_capability (hal_ctx, capability.ascii(), &num, &error);
if (dbus_error_is_set(&error)) {
kdError() << "Could not get list of devices with capability: " << capability
@@ -707,7 +707,7 @@ bool dbusHAL::halFindDeviceByString (QString property, QString keyval, QStringLi
dbus_error_init(&error);
- found = libhal_manager_find_device_string_match (hal_ctx, property, keyval, &num, &error);
+ found = libhal_manager_find_device_string_match (hal_ctx, property.ascii(), keyval.ascii(), &num, &error);
if (dbus_error_is_set(&error)) {
kdError() << "Could not get list of devices with key: " << property
@@ -819,7 +819,7 @@ bool dbusHAL::dbusMethodCall( QString interface, QString path, QString object, Q
goto out;
}
- message = dbus_message_new_method_call( interface, path, object, method );
+ message = dbus_message_new_method_call( interface.ascii(), path.ascii(), object.ascii(), method.ascii() );
dbus_message_append_args_valist(message, first_arg_type, var_args);
if (retvalue == NULL) {
diff --git a/src/detaileddialog.cpp b/src/detaileddialog.cpp
index c48df79..b75fcc9 100644
--- a/src/detaileddialog.cpp
+++ b/src/detaileddialog.cpp
@@ -356,7 +356,7 @@ void detaileddialog::setProcessorThrottling() {
// get max cpu freq and set it to the max of the progressbar
ProcessorPBar[i]->setTotalSteps(100);
QString ProgressString = QString("%1% (%2 MHz)").arg(100 - cpuInfo->cpu_throttling[i]).arg(cpuInfo->cpufreq_speed[i]);
- ProcessorPBar[i]->setFormat(i18n(ProgressString));
+ ProcessorPBar[i]->setFormat(i18n(ProgressString.ascii()));
ProcessorPBar[i]->setProgress(100 - cpuInfo->cpu_throttling[i]);
ProcessorPBar[i]->setEnabled(true);
} else if (cpuInfo->cpufreq_speed[i] < 0) {
@@ -411,7 +411,7 @@ void detaileddialog::setInfos() {
if(!config->currentScheme.isEmpty())
display += i18n("Current Scheme: ") + "\n";
- displayValue += i18n(config->currentScheme) + "\n";
+ displayValue += i18n(config->currentScheme.ascii()) + "\n";
if(config->currentScheme == config->ac_scheme)
InfoPictogram->setPixmap(SmallIcon("scheme_power", 22));
else if(config->currentScheme == config->battery_scheme)
diff --git a/src/hardware_cpu.cpp b/src/hardware_cpu.cpp
index c05e3ec..f0d939c 100644
--- a/src/hardware_cpu.cpp
+++ b/src/hardware_cpu.cpp
@@ -38,6 +38,7 @@
// system header
#include <fcntl.h>
+#include <unistd.h>
/*! The default constructor of the class CPUInfo */
CPUInfo::CPUInfo() {
@@ -123,7 +124,7 @@ int CPUInfo::checkCPUSpeed(){
new_value = -1;
- fd = open(cpu_device, O_RDONLY);
+ fd = open(cpu_device.ascii(), O_RDONLY);
if (read(fd, buf, 14) > 0){
new_value = strtol(buf, NULL, 10)/1000;
close(fd);
@@ -295,7 +296,7 @@ void CPUInfo::getCPUMaxSpeed() {
// while (!access(cpu_device_max, R_OK)) {
for (int cpu_id=0; cpu_id < numOfCPUs; cpu_id++) {
- fd = open(cpu_device_max, O_RDONLY);
+ fd = open(cpu_device_max.ascii(), O_RDONLY);
if (read(fd, buf, 14) > 0){
maxfreq = strtol(buf, NULL, 10)/1000;
cpufreq_max_speed.append(maxfreq);
diff --git a/src/kpowersave.cpp b/src/kpowersave.cpp
index 09d1573..085753e 100644
--- a/src/kpowersave.cpp
+++ b/src/kpowersave.cpp
@@ -191,7 +191,7 @@ void kpowersave::initMenu() {
STANDBY_MENU_ID = this->contextMenu()->insertItem( SmallIconSet("stand_by", QIconSet::Automatic),
i18n("Standby"), this, SLOT(do_standby()));
- speed_menu = new QPopupMenu(this, i18n("Set CPU Frequency Policy"));
+ speed_menu = new QPopupMenu(this, i18n("Set CPU Frequency Policy").ascii());
speed_menu->insertItem(i18n("Performance"), PERFORMANCE);
speed_menu->insertItem(i18n("Dynamic"), DYNAMIC);
speed_menu->insertItem(i18n("Powersave"), POWERSAVE);
@@ -205,7 +205,7 @@ void kpowersave::initMenu() {
SCHEME_SEPARATOR_MENU_ID = contextMenu()->insertSeparator();
- scheme_menu = new QPopupMenu(this, i18n("Set Active Scheme"));
+ scheme_menu = new QPopupMenu(this, i18n("Set Active Scheme").ascii());
SCHEME_MENU_ID = contextMenu()->insertItem(i18n("Set Active Scheme"), scheme_menu);
connect(scheme_menu, SIGNAL(activated(int)), this, SLOT(do_setActiveScheme(int)));
@@ -219,7 +219,7 @@ void kpowersave::initMenu() {
HELP_SEPARATOR_MENU_ID = contextMenu()->insertSeparator();
- help_menu = new QPopupMenu(this, i18n("&Help"));
+ help_menu = new QPopupMenu(this, i18n("&Help").ascii());
help_menu->insertItem( SmallIcon("help", QIconSet::Automatic), i18n("&KPowersave Handbook"),
this, SLOT(slotHelp()));
@@ -284,7 +284,7 @@ void kpowersave::showConfigureDialog() {
else {
KPassivePopup::message(i18n("WARNING"), i18n("Cannot find any schemes."),
SmallIcon("messagebox_warning", 20), this,
- i18n("Warning"), 15000);
+ i18n("Warning").ascii(), 15000);
}
} else {
configDlg->setWindowState(configDlg->windowState() & ~WindowMinimized | WindowActive);
@@ -714,7 +714,7 @@ bool kpowersave::do_suspend2disk(){
} else {
KPassivePopup::message( i18n("WARNING"),i18n("Suspend to disk failed"),
SmallIcon("messagebox_warning", 20), this,
- i18n("Warning"), 15000);
+ i18n("Warning").ascii(), 15000);
kdDebugFuncOut(trace);
return false;
}
@@ -722,7 +722,7 @@ bool kpowersave::do_suspend2disk(){
KPassivePopup::message( i18n("WARNING"),
i18n("Suspend to disk disabled by administrator."),
SmallIcon("messagebox_warning", 20),
- this, i18n("Warning"), 15000);
+ this, i18n("Warning").ascii(), 15000);
this->contextMenu()->setItemEnabled(SUSPEND2DISK_MENU_ID, false);
kdDebugFuncOut(trace);
return false;
@@ -770,7 +770,7 @@ bool kpowersave::do_suspend2ram(){
} else {
KPassivePopup::message( i18n("WARNING"),i18n("Suspend to RAM failed"),
SmallIcon("messagebox_warning", 20), this,
- i18n("Warning"), 15000);
+ i18n("Warning").ascii(), 15000);
kdDebugFuncOut(trace);
return false;
}
@@ -778,7 +778,7 @@ bool kpowersave::do_suspend2ram(){
KPassivePopup::message( i18n("WARNING"),
i18n("Suspend to RAM disabled by administrator."),
SmallIcon("messagebox_warning", 20), this,
- i18n("Warning"), 15000);
+ i18n("Warning").ascii(), 15000);
this->contextMenu()->setItemEnabled(SUSPEND2RAM_MENU_ID, false);
kdDebugFuncOut(trace);
return false;
@@ -826,14 +826,14 @@ bool kpowersave::do_standby(){
} else {
KPassivePopup::message( i18n("WARNING"),i18n("Standby failed"),
SmallIcon("messagebox_warning", 20), this,
- i18n("Warning"), 15000);
+ i18n("Warning").ascii(), 15000);
kdDebugFuncOut(trace);
return false;
}
} else {
KPassivePopup::message( i18n("WARNING"),i18n("Standby disabled by administrator."),
SmallIcon("messagebox_warning", 20), this,
- i18n("Warning"), 15000);
+ i18n("Warning").ascii(), 15000);
this->contextMenu()->setItemEnabled(STANDBY_MENU_ID, false);
kdDebugFuncOut(trace);
return false;
@@ -1189,7 +1189,7 @@ void kpowersave::handleLidEvent( bool closed ){
"be a problem with the selected \nlock "
"method or something else."),
SmallIcon("messagebox_warning", 20), this,
- i18n("Warning"), 10000);
+ i18n("Warning").ascii(), 10000);
}
}
@@ -1307,7 +1307,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"), 10000);
+ SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 10000);
} else {
hwinfo->checkCurrentCPUFreqPolicy();
update();
@@ -1323,7 +1323,7 @@ void kpowersave::do_setSpeedPolicy(int menu_id){
void kpowersave::do_setActiveScheme( int i ){
if (trace) kdDebug() << funcinfo << "IN: " << "set scheme to: " << i << endl;
- if(settings->schemes[i] && (settings->schemes[i] != settings->currentScheme)) {
+ if(!settings->schemes[i].isEmpty() && (settings->schemes[i] != settings->currentScheme)) {
for (int x = 0; x < (int) scheme_menu->count(); x++){
if (x == i)
scheme_menu->setItemChecked(x, true);
@@ -1336,7 +1336,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"), 5000);
+ SmallIcon("messagebox_warning", 20), this, i18n("Warning").ascii(), 5000);
}
kdDebugFuncOut(trace);
@@ -1530,12 +1530,12 @@ void kpowersave::updateSchemeMenu(){
if ( *it == settings->ac_scheme ){
scheme_menu->insertItem( SmallIcon("scheme_power", QIconSet::Automatic),
- i18n( (QString)*it ), x, x);
+ i18n( ((QString)*it).ascii() ), x, x);
}
else{
if ( *it == settings->battery_scheme ){
scheme_menu->insertItem(SmallIcon("scheme_powersave", QIconSet::Automatic),
- i18n( *it ), x, x);
+ i18n( (*it).ascii() ), x, x);
}
else{
if ((QString)*it == "Acoustic"){
@@ -1555,7 +1555,7 @@ void kpowersave::updateSchemeMenu(){
i18n( "Advanced Powersave" ), x, x);
}
else {
- scheme_menu->insertItem(i18n( *it ), x, x);
+ scheme_menu->insertItem(i18n( (*it).ascii() ), x, x);
}
}
}
@@ -1706,7 +1706,7 @@ void kpowersave::showHalErrorMsg() {
i18n("Could not get information from HAL. The haldaemon is "
"maybe not running."),
SmallIcon("messagebox_warning", 20), this,
- i18n("Error"), 5000);
+ i18n("Error").ascii(), 5000);
}
else if (hwinfo->hal_terminated && !hal_error_shown && !DISPLAY_HAL_ERROR_Timer->isActive()) {
hal_error_shown = true;
@@ -1735,7 +1735,7 @@ void kpowersave::showErrorMessage( QString msg ){
if(settings->psMsgAsPassivePopup) {
KPassivePopup::message("KPowersave", msg, SmallIcon("messagebox_warning", 20),
- this, i18n("Warning"), 10000);
+ this, i18n("Warning").ascii(), 10000);
} else {
kapp->updateUserTimestamp();
// KMessageBox::error( 0, msg);
@@ -2181,7 +2181,7 @@ void kpowersave::notifySchemeSwitch() {
eventType = "scheme_" + _scheme;
KNotifyClient::event( this->winId(), eventType,
- i18n("Switched to scheme: %1").arg(i18n(_scheme)));
+ i18n("Switched to scheme: %1").arg(i18n(_scheme.ascii())).ascii());
}
kdDebugFuncOut(trace);
@@ -2290,7 +2290,7 @@ void kpowersave::handleResumeSignal() {
KPassivePopup::message( i18n("WARNING"),
i18n("Could not remount (all) external storage"
" media."), SmallIcon("messagebox_warning", 20),
- this, i18n("Warning"), 15000);
+ this, i18n("Warning").ascii(), 15000);
}
} else {
kdError() << "Unknown error while suspend. Errorcode: " << resume_result << endl;