aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/qconf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/qconf.cc')
-rw-r--r--scripts/kconfig/qconf.cc59
1 files changed, 39 insertions, 20 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 0cdbf9dbbd51..4590cd31623f 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -26,8 +26,23 @@
26#include "qconf.moc" 26#include "qconf.moc"
27#include "images.c" 27#include "images.c"
28 28
29#ifdef _
30# undef _
31# define _ qgettext
32#endif
33
29static QApplication *configApp; 34static QApplication *configApp;
30 35
36static inline QString qgettext(const char* str)
37{
38 return QString::fromLocal8Bit(gettext(str));
39}
40
41static inline QString qgettext(const QString& str)
42{
43 return QString::fromLocal8Bit(gettext(str.latin1()));
44}
45
31ConfigSettings::ConfigSettings() 46ConfigSettings::ConfigSettings()
32 : showAll(false), showName(false), showRange(false), showData(false) 47 : showAll(false), showName(false), showRange(false), showData(false)
33{ 48{
@@ -177,7 +192,7 @@ void ConfigItem::updateMenu(void)
177 192
178 sym = menu->sym; 193 sym = menu->sym;
179 prop = menu->prompt; 194 prop = menu->prompt;
180 prompt = menu_get_prompt(menu); 195 prompt = QString::fromLocal8Bit(menu_get_prompt(menu));
181 196
182 if (prop) switch (prop->type) { 197 if (prop) switch (prop->type) {
183 case P_MENU: 198 case P_MENU:
@@ -203,7 +218,7 @@ void ConfigItem::updateMenu(void)
203 if (!sym) 218 if (!sym)
204 goto set_prompt; 219 goto set_prompt;
205 220
206 setText(nameColIdx, sym->name); 221 setText(nameColIdx, QString::fromLocal8Bit(sym->name));
207 222
208 type = sym_get_type(sym); 223 type = sym_get_type(sym);
209 switch (type) { 224 switch (type) {
@@ -213,9 +228,9 @@ void ConfigItem::updateMenu(void)
213 228
214 if (!sym_is_changable(sym) && !list->showAll) { 229 if (!sym_is_changable(sym) && !list->showAll) {
215 setPixmap(promptColIdx, 0); 230 setPixmap(promptColIdx, 0);
216 setText(noColIdx, 0); 231 setText(noColIdx, QString::null);
217 setText(modColIdx, 0); 232 setText(modColIdx, QString::null);
218 setText(yesColIdx, 0); 233 setText(yesColIdx, QString::null);
219 break; 234 break;
220 } 235 }
221 expr = sym_get_tristate_value(sym); 236 expr = sym_get_tristate_value(sym);
@@ -257,6 +272,7 @@ void ConfigItem::updateMenu(void)
257 const char* data; 272 const char* data;
258 273
259 data = sym_get_string_value(sym); 274 data = sym_get_string_value(sym);
275
260#if QT_VERSION >= 300 276#if QT_VERSION >= 300
261 int i = list->mapIdx(dataColIdx); 277 int i = list->mapIdx(dataColIdx);
262 if (i >= 0) 278 if (i >= 0)
@@ -264,9 +280,9 @@ void ConfigItem::updateMenu(void)
264#endif 280#endif
265 setText(dataColIdx, data); 281 setText(dataColIdx, data);
266 if (type == S_STRING) 282 if (type == S_STRING)
267 prompt.sprintf("%s: %s", prompt.latin1(), data); 283 prompt = QString("%1: %2").arg(prompt).arg(data);
268 else 284 else
269 prompt.sprintf("(%s) %s", data, prompt.latin1()); 285 prompt = QString("(%2) %1").arg(prompt).arg(data);
270 break; 286 break;
271 } 287 }
272 if (!sym_has_value(sym) && visible) 288 if (!sym_has_value(sym) && visible)
@@ -343,9 +359,9 @@ void ConfigLineEdit::show(ConfigItem* i)
343{ 359{
344 item = i; 360 item = i;
345 if (sym_get_string_value(item->menu->sym)) 361 if (sym_get_string_value(item->menu->sym))
346 setText(sym_get_string_value(item->menu->sym)); 362 setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym)));
347 else 363 else
348 setText(0); 364 setText(QString::null);
349 Parent::show(); 365 Parent::show();
350 setFocus(); 366 setFocus();
351} 367}
@@ -961,7 +977,7 @@ ConfigMainWindow::ConfigMainWindow(void)
961 delete configSettings; 977 delete configSettings;
962} 978}
963 979
964static QString print_filter(const char *str) 980static QString print_filter(const QString &str)
965{ 981{
966 QRegExp re("[<>&\"\\n]"); 982 QRegExp re("[<>&\"\\n]");
967 QString res = str; 983 QString res = str;
@@ -994,7 +1010,7 @@ static QString print_filter(const char *str)
994 1010
995static void expr_print_help(void *data, const char *str) 1011static void expr_print_help(void *data, const char *str)
996{ 1012{
997 ((QString*)data)->append(print_filter(str)); 1013 reinterpret_cast<QString*>(data)->append(print_filter(str));
998} 1014}
999 1015
1000/* 1016/*
@@ -1009,7 +1025,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1009 if (item) 1025 if (item)
1010 menu = ((ConfigItem*)item)->menu; 1026 menu = ((ConfigItem*)item)->menu;
1011 if (!menu) { 1027 if (!menu) {
1012 helpText->setText(NULL); 1028 helpText->setText(QString::null);
1013 return; 1029 return;
1014 } 1030 }
1015 1031
@@ -1019,16 +1035,16 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1019 if (sym) { 1035 if (sym) {
1020 if (menu->prompt) { 1036 if (menu->prompt) {
1021 head += "<big><b>"; 1037 head += "<big><b>";
1022 head += print_filter(menu->prompt->text); 1038 head += print_filter(_(menu->prompt->text));
1023 head += "</b></big>"; 1039 head += "</b></big>";
1024 if (sym->name) { 1040 if (sym->name) {
1025 head += " ("; 1041 head += " (";
1026 head += print_filter(sym->name); 1042 head += print_filter(_(sym->name));
1027 head += ")"; 1043 head += ")";
1028 } 1044 }
1029 } else if (sym->name) { 1045 } else if (sym->name) {
1030 head += "<big><b>"; 1046 head += "<big><b>";
1031 head += print_filter(sym->name); 1047 head += print_filter(_(sym->name));
1032 head += "</b></big>"; 1048 head += "</b></big>";
1033 } 1049 }
1034 head += "<br><br>"; 1050 head += "<br><br>";
@@ -1049,7 +1065,7 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1049 case P_PROMPT: 1065 case P_PROMPT:
1050 case P_MENU: 1066 case P_MENU:
1051 debug += "prompt: "; 1067 debug += "prompt: ";
1052 debug += print_filter(prop->text); 1068 debug += print_filter(_(prop->text));
1053 debug += "<br>"; 1069 debug += "<br>";
1054 break; 1070 break;
1055 case P_DEFAULT: 1071 case P_DEFAULT:
@@ -1088,10 +1104,10 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1088 debug += "<br>"; 1104 debug += "<br>";
1089 } 1105 }
1090 1106
1091 help = print_filter(sym->help); 1107 help = print_filter(_(sym->help));
1092 } else if (menu->prompt) { 1108 } else if (menu->prompt) {
1093 head += "<big><b>"; 1109 head += "<big><b>";
1094 head += print_filter(menu->prompt->text); 1110 head += print_filter(_(menu->prompt->text));
1095 head += "</b></big><br><br>"; 1111 head += "</b></big><br><br>";
1096 if (showDebug) { 1112 if (showDebug) {
1097 if (menu->prompt->visible.expr) { 1113 if (menu->prompt->visible.expr) {
@@ -1111,7 +1127,7 @@ void ConfigMainWindow::loadConfig(void)
1111 QString s = QFileDialog::getOpenFileName(".config", NULL, this); 1127 QString s = QFileDialog::getOpenFileName(".config", NULL, this);
1112 if (s.isNull()) 1128 if (s.isNull())
1113 return; 1129 return;
1114 if (conf_read(s.latin1())) 1130 if (conf_read(QFile::encodeName(s)))
1115 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 1131 QMessageBox::information(this, "qconf", "Unable to load configuration!");
1116 ConfigView::updateListAll(); 1132 ConfigView::updateListAll();
1117} 1133}
@@ -1127,7 +1143,7 @@ void ConfigMainWindow::saveConfigAs(void)
1127 QString s = QFileDialog::getSaveFileName(".config", NULL, this); 1143 QString s = QFileDialog::getSaveFileName(".config", NULL, this);
1128 if (s.isNull()) 1144 if (s.isNull())
1129 return; 1145 return;
1130 if (conf_write(s.latin1())) 1146 if (conf_write(QFile::encodeName(s)))
1131 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1147 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1132} 1148}
1133 1149
@@ -1372,6 +1388,9 @@ int main(int ac, char** av)
1372 ConfigMainWindow* v; 1388 ConfigMainWindow* v;
1373 const char *name; 1389 const char *name;
1374 1390
1391 bindtextdomain(PACKAGE, LOCALEDIR);
1392 textdomain(PACKAGE);
1393
1375#ifndef LKC_DIRECT_LINK 1394#ifndef LKC_DIRECT_LINK
1376 kconfig_load(); 1395 kconfig_load();
1377#endif 1396#endif