Commit cc5abd78 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Added a helper macro for converting a QString to a Latin1 encoded char array.

parent 67899f69
......@@ -191,8 +191,7 @@ void PnViewerQt::open_change_value()
void PnViewerQtWidget::valchanged_cmd_entry()
{
if (viewer->input_open) {
QByteArray text = viewer->cmd_entry->text().toLatin1();
viewer->viewernav->set_attr_value(text.data());
viewer->viewernav->set_attr_value(qPrintableLatin1(viewer->cmd_entry->text()));
viewer->cmd_entry->setVisible(false);
viewer->set_prompt("");
viewer->input_open = 0;
......
......@@ -225,9 +225,7 @@ void XttTblQt::set_prompt(const char* prompt)
void XttTblQtWidget::valchanged_cmd_input()
{
QByteArray text = tbl->cmd_entry->text().toLatin1();
tbl->command(text.data());
tbl->command(qPrintableLatin1(tbl->cmd_entry->text()));
tbl->cmd_entry->setVisible(false);
tbl->set_prompt("");
tbl->command_open = 0;
......
......@@ -478,16 +478,14 @@ void WFoeQtWidget::valchanged_textinput()
return;
}
QByteArray value = foe->textinput->text().toLatin1();
strcpy(foe->searchstring, value.data());
strcpy(foe->searchstring, qPrintableLatin1(foe->textinput->text()));
foe->message("");
foe->textinput->setText("");
foe->textinput->setVisible(false);
/* Call the specified function */
sts = (foe->textinput_func)(foe, value.data());
sts = (foe->textinput_func)(foe, foe->searchstring);
foe->error_msg(sts);
}
......
......@@ -314,8 +314,7 @@ WUtedQt::~WUtedQt()
// Get value from textentry with specified index
void WUtedQt::get_value(int idx, char* str, int len)
{
QByteArray ba = value[idx]->text().toLatin1();
strncpy(str, ba.data(), len);
strncpy(str, qPrintableLatin1(value[idx]->text()), len);
}
// Hide all qualifiers.
......
......@@ -55,6 +55,9 @@ CoWowRecall WAttQt::value_recall;
void WAttQt::message(char severity, const char* message)
{
msg_label->setText(fl(message));
if (strcmp(message, "") != 0) {
msg_label->setVisible(true);
}
}
void WAttQt::set_prompt(const char* prompt)
......@@ -195,8 +198,7 @@ void WAttQt::change_value_close()
{
if (input_open) {
if (input_multiline) {
QByteArray ba = cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_scrolled_buffer->toPlainText());
if (text) {
// Replace ctrl characters with space
......@@ -221,8 +223,7 @@ void WAttQt::change_value_close()
message('E', "Input error, invalid character");
}
} else {
QByteArray ba = cmd_entry->text().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_entry->text());
if (text) {
wattnav->set_attr_value(input_node, input_name, text);
......@@ -251,8 +252,7 @@ void WAttQtWidget::activate_cmd_entry()
{
watt->wattnav->set_inputfocus();
QByteArray ba = watt->cmd_entry->text().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(watt->cmd_entry->text());
if (watt->input_open) {
if (text) {
......@@ -281,8 +281,7 @@ void WAttQtWidget::activate_cmd_entry()
void WAttQtWidget::activate_cmd_scrolled_ok()
{
if (watt->input_open) {
QByteArray ba = watt->cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(watt->cmd_scrolled_buffer->toPlainText());
if (text) {
// Replace ctrl characters with space
......@@ -461,6 +460,7 @@ WAttQt::WAttQt(QWidget* wa_parent_wid, void* wa_parent_ctx,
toplevel->show();
msg_label->setVisible(false);
cmd_prompt->setVisible(false);
cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false);
......
......@@ -152,8 +152,7 @@ void WAttTextQt::set_editmode(int editmode, ldh_tSesContext ldhses)
void WAttTextQt::set_attr_value()
{
if (editmode) {
QByteArray ba = textbuffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(textbuffer->toPlainText());
if (text) {
// Replace ctrl characters with space
......
......@@ -55,6 +55,9 @@ CoWowRecall WdaQt::value_recall;
void WdaQt::message(char severity, const char* message)
{
msg_label->setText(fl(message));
if (strcmp(message, "") != 0) {
msg_label->setVisible(true);
}
}
void WdaQt::set_prompt(const char* prompt)
......@@ -197,12 +200,9 @@ void WdaQtWidget::class_activate_ok()
int sts;
pwr_tClassId new_classid;
QByteArray ba = wda->wdaclass_hiervalue->text().toLatin1();
char* hiername = ba.data();
ba = wda->wdaclass_namevalue->text().toLatin1();
char* searchname = ba.data();
ba = wda->wdaclass_classvalue->text().toLatin1();
char* classname = ba.data();
char* hiername = qPrintableLatin1(wda->wdaclass_hiervalue->text());
char* searchname = qPrintableLatin1(wda->wdaclass_namevalue->text());
char* classname = qPrintableLatin1(wda->wdaclass_classvalue->text());
wda->attrobjects = wda->wdaclass_attrobjects->isChecked();
......@@ -264,8 +264,7 @@ void WdaQt::change_value_close()
{
if (input_open) {
if (input_multiline) {
QByteArray ba = cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_scrolled_buffer->toPlainText());
// Replace ctrl characters with space
for (unsigned char* s = (unsigned char*)text; *s; s++) {
......@@ -288,8 +287,7 @@ void WdaQt::change_value_close()
message('E', "Input error, invalid character");
}
} else {
QByteArray ba = cmd_entry->text().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_entry->text());
if (text) {
wdanav->set_attr_value(input_node, input_name, text);
......@@ -317,8 +315,7 @@ void WdaQtWidget::activate_cmd_entry()
wda->wdanav->set_inputfocus();
QByteArray ba = wda->cmd_entry->text().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(wda->cmd_entry->text());
if (wda->input_open) {
if (text) {
......@@ -340,8 +337,7 @@ void WdaQtWidget::activate_cmd_entry()
void WdaQtWidget::activate_cmd_scrolled_ok()
{
if (wda->input_open) {
QByteArray ba = wda->cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(wda->cmd_scrolled_buffer->toPlainText());
if (text) {
// Replace ctrl characters with space
......@@ -513,6 +509,7 @@ WdaQt::WdaQt(QWidget* wa_parent_wid, void* wa_parent_ctx,
toplevel->show();
msg_label->setVisible(false);
cmd_prompt->setVisible(false);
cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false);
......
......@@ -493,8 +493,7 @@ int WNavQt::prompt_dialog(char* title, char* text, char** value)
QString str = QInputDialog::getText(toplevel, translate_utf8(title),
translate_utf8(text), QLineEdit::Normal, "", &ok);
if (ok) {
QByteArray ba = str.toLatin1();
strcpy(*value, ba.data());
strcpy(*value, qPrintableLatin1(str));
} else {
strcpy(*value, "");
}
......
......@@ -246,13 +246,10 @@ void WRevInputDialog::closeEvent(QCloseEvent* event)
void WRevInputDialog::activate_ok()
{
QByteArray text1 = india_text1->text().toLatin1();
QByteArray text2 = india_text2->text().toLatin1();
rev->dialog_count--;
rev->india_widget = 0;
(rev->india_ok_cb)(rev, text1.data(), text2.data());
(rev->india_ok_cb)(rev, qPrintableLatin1(india_text1->text()), qPrintableLatin1(india_text2->text()));
close();
}
......
......@@ -717,6 +717,9 @@ void WttQt::set_twowindows(int two, int display_wnav, int display_wnavnode)
void WttQt::message(char severity, const char* message)
{
msg_label->setText(QString::fromLatin1(message));
if (strcmp(message, "") != 0) {
msg_label->setVisible(true);
}
}
void WttQt::set_prompt(const char* prompt)
......@@ -1362,11 +1365,8 @@ void WttQtWidget::valchanged_cmd_entry()
{
int sts;
QByteArray text = wtt->cmd_entry->text().toLatin1();
debug_print("text=%s\n", text.data());
if (!text.data()) {
wtt->wnav->wow->DisplayError("Input error", "Invalid character");
if (wtt->cmd_entry->text().isEmpty()) {
wtt->wnav->wow->DisplayError("Input error", "Input cannot be empty");
return;
}
......@@ -1375,7 +1375,7 @@ void WttQtWidget::valchanged_cmd_entry()
case wtt_eInputMode_Attribute:
wtt->input_wnav->select_object(wtt->input_node);
sts = wtt->input_wnav->set_attr_value(
wtt->input_node, wtt->input_objid, text.data());
wtt->input_node, wtt->input_objid, qPrintableLatin1(wtt->cmd_entry->text()));
if (EVEN(sts)) {
wtt->message('E', wnav_get_message(sts));
}
......@@ -1383,7 +1383,7 @@ void WttQtWidget::valchanged_cmd_entry()
case wtt_eInputMode_ObjectName:
wtt->input_wnav->select_object(wtt->input_node);
sts = wtt->input_wnav->set_object_name(
wtt->input_node, wtt->input_objid, text.data());
wtt->input_node, wtt->input_objid, qPrintableLatin1(wtt->cmd_entry->text()));
if (EVEN(sts)) {
wtt->message('E', wnav_get_message(sts));
}
......@@ -1400,7 +1400,7 @@ void WttQtWidget::valchanged_cmd_entry()
wtt->set_focus_default();
}
wtt->set_clock_cursor();
wtt->focused_wnav->command(text.data());
wtt->focused_wnav->command(qPrintableLatin1(wtt->cmd_entry->text()));
wtt->reset_cursor();
wtt->cmd_entry->setVisible(false);
wtt->set_prompt("");
......@@ -1438,10 +1438,7 @@ void WttQt::open_input_dialog(const char* text, const char* title,
QString str = QInputDialog::getText(toplevel, translate_utf8(title),
translate_utf8(text), QLineEdit::Normal, fl(init_text), &ok);
if (ok) {
QByteArray ba = str.toLatin1();
char* text = ba.data();
(ok_cb)(this, text);
(ok_cb)(this, qPrintableLatin1(str));
}
}
......@@ -2270,6 +2267,7 @@ WttQt::WttQt(void* wt_parent_ctx, QWidget* wt_parent_wid, const char* wt_name,
if (!editmode) {
palette_widget->setVisible(false);
}
msg_label->setVisible(false);
cmd_prompt->setVisible(false);
cmd_entry->setVisible(false);
set_pane_position(wnav_paned, window_width / 2);
......
......@@ -892,7 +892,6 @@ void Wtt::close(void* ctx)
void Wtt::change_value(void* ctx)
{
fprintf(stderr, "Wtt::change_value\n");
((Wtt*)ctx)->open_change_value();
}
......
......@@ -89,16 +89,16 @@ void XttQt::open_input_dialog(const char* text, const char* title,
QString str = QInputDialog::getText(toplevel, translate_utf8(title),
translate_utf8(text), QLineEdit::Normal, fl(init_text), &ok);
if (ok) {
QByteArray ba = str.toLatin1();
char* text = ba.data();
(ok_cb)(this, text);
(ok_cb)(this, qPrintableLatin1(str));
}
}
void XttQt::message(char severity, const char* msg)
{
msg_label->setText(QString::fromLatin1(msg));
if (strcmp(msg, "") != 0) {
msg_label->setVisible(true);
}
}
void XttQt::close(void* ctx, int terminate)
......@@ -517,10 +517,7 @@ void XttQtWidget::focusInEvent(QFocusEvent* event)
void XttQtWidget::valchanged_cmd_entry()
{
QByteArray ba = xtt->cmd_entry->text().toLatin1();
char* text = ba.data();
if (!text) {
if (xtt->cmd_entry->text().isEmpty()) {
xtt->cmd_entry->setVisible(false);
xtt->set_prompt("");
xtt->input_open = 0;
......@@ -530,6 +527,8 @@ void XttQtWidget::valchanged_cmd_entry()
return;
}
char* text = qPrintableLatin1(xtt->cmd_entry->text());
if (xtt->input_open) {
int sts = xtt->xnav->set_attr_value(text);
xtt->cmd_entry->setVisible(false);
......@@ -766,6 +765,7 @@ XttQt::XttQt(int argc, char* argv[], int* return_sts)
toplevel->setLayout(vbox);
toplevel->show();
msg_label->setVisible(false);
cmd_prompt->setVisible(false);
cmd_entry->setVisible(false);
......
......@@ -70,6 +70,10 @@ void dbg_print(const char* file, int line, QString str);
* Qt Helper functions
*/
QString fl(const char* text);
#ifndef qPrintableLatin1
#define qPrintableLatin1(string) (string).toLatin1().data()
#endif
QString convert_utf8(const char* str);
QString translate_utf8(const char* str);
void pop(QWidget* w);
......
......@@ -345,18 +345,8 @@ void NodelistQt::open_add_input_dialog(const char* text, const char* text2,
void NodelistInputDialogQt::activate_ok()
{
char *txt, *txt2, *txt3;
QByteArray ba = text->text().toLatin1();
txt = ba.data();
ba = text2->text().toLatin1();
txt2 = ba.data();
ba = text3->text().toLatin1();
txt3 = ba.data();
(nodelist->add_india_ok_cb)(nodelist, txt, txt2, txt3);
(nodelist->add_india_ok_cb)(nodelist, qPrintableLatin1(text->text()),
qPrintableLatin1(text2->text()), qPrintableLatin1(text3->text()));
accept();
}
......
......@@ -134,11 +134,8 @@ void CoWowQt::CreateInputDialog(void* ctx, const char* title, const char* text,
QString str = QInputDialog::getText(object->parent_wid, translate_utf8(title),
translate_utf8(text), QLineEdit::Normal, temp_txt, &ok);
if (ok) {
QByteArray ba = str.toLatin1();
char* text = ba.data();
if (inputdialogbox_ok) {
(inputdialogbox_ok)(ctx, data, text);
(inputdialogbox_ok)(ctx, data, qPrintableLatin1(str));
}
} else {
if (inputdialogbox_cancel) {
......@@ -214,10 +211,7 @@ void CoWowListWidgetQt::list_apply_cb()
selected_text = item->text(0);
}
if (action_cb) {
QByteArray ba = selected_text.toLatin1();
char* text = ba.data();
(action_cb)(parent_ctx, text, ok_pressed);
(action_cb)(parent_ctx, qPrintableLatin1(selected_text), ok_pressed);
}
}
......@@ -842,9 +836,7 @@ wow_sModalInputDialog* CoWowQt::CreateModalInputDialog(const char* title,
wow_sModalInputDialog* ret = new wow_sModalInputDialog();
ret->status = status;
QString valueutf8 = dialog_w->text();
QByteArray ba = valueutf8.toLatin1();
strncpy(ret->input_str, ba.data(), sizeof(ret->input_str));
strncpy(ret->input_str, qPrintableLatin1(dialog_w->text()), sizeof(ret->input_str));
return ret;
}
......
......@@ -50,10 +50,7 @@ void CoXHelpQt::open_input_dialog(const char* text, const char* title,
QString str = QInputDialog::getText(toplevel, fl("Input Dialog"),
fl("Graph Name"), QLineEdit::Normal, fl(init_text), &ok);
if (ok) {
QByteArray ba = str.toLatin1();
char* text = ba.data();
(ok_cb)(this, text);
(ok_cb)(this, qPrintableLatin1(str));
}
}
......
......@@ -54,6 +54,9 @@ void AttrQt::message(char severity, const char* message)
{
if (msg_label) {
msg_label->setText(fl(message));
if (strcmp(message, "") != 0) {
msg_label->setVisible(true);
}
}
}
......@@ -217,11 +220,9 @@ void AttrQtWidget::attr_activate_cmd_entry()
attr->attrnav->set_inputfocus();
QByteArray ba = attr->cmd_entry->text().toLatin1();
char* text = ba.data();
if (attr->input_open) {
attr->attrnav->set_attr_value(text, 0, 0);
attr->attrnav->set_attr_value(
qPrintableLatin1(attr->cmd_entry->text()), 0, 0);
attr->cmd_entry->setVisible(false);
attr->set_prompt("");
attr->input_open = 0;
......@@ -235,10 +236,8 @@ void AttrQtWidget::attr_activate_cmd_entry()
void AttrQtWidget::attr_activate_cmd_scrolled_ok()
{
if (attr->input_open) {
QByteArray ba = attr->cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
attr->attrnav->set_attr_value(text, 0, 0);
attr->attrnav->set_attr_value(
qPrintableLatin1(attr->cmd_scrolled_buffer->toPlainText()), 0, 0);
attr->cmd_scrolledinput->setVisible(false);
attr->set_prompt("");
attr->input_open = 0;
......@@ -407,6 +406,7 @@ AttrQt::AttrQt(QWidget* a_parent_wid, void* a_parent_ctx, attr_eType a_type,
toplevel->show();
msg_label->setVisible(false);
cmd_prompt->setVisible(false);
cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false);
......
......@@ -105,8 +105,7 @@ void GeQt::open_input_dialog(const char* text, const char* title,
QString txt = QInputDialog::getText(
toplevel, fl(title), fl(text), QLineEdit::Normal, fl(init_text), &ok);
if (ok && !txt.isEmpty()) {
QByteArray ba = txt.toLatin1();
activate_india_ok(ba.data());
activate_india_ok(qPrintableLatin1(txt));
}
}
......@@ -1141,22 +1140,20 @@ void GeQtWidget::activate_help_subgraph()
void GeQtWidget::valchanged_cmd_entry()
{
QByteArray text = ge->recall_entry->text().toLatin1();
if (ge->text_input_open) {
ge->graph->change_text(ge->current_text_object, text.data());
ge->graph->change_text(ge->current_text_object, qPrintableLatin1(ge->recall_entry->text()));
ge->text_input_open = 0;
} else if (ge->name_input_open) {
ge->graph->change_name(ge->current_text_object, text.data());
ge->graph->change_name(ge->current_text_object, qPrintableLatin1(ge->recall_entry->text()));
ge->name_input_open = 0;
} else if (ge->value_input_open) {
ge->graph->change_value(ge->current_value_object, text.data());
ge->graph->change_value(ge->current_value_object, qPrintableLatin1(ge->recall_entry->text()));
ge->value_input_open = 0;
} else if (ge->objectnav_input_open) {
ge->objectnav->set_attr_value(text.data());
ge->objectnav->set_attr_value(qPrintableLatin1(ge->recall_entry->text()));
ge->objectnav_input_open = 0;
} else if (ge->command_open) {
ge->graph->command(text.data());
ge->graph->command(qPrintableLatin1(ge->recall_entry->text()));
ge->command_open = 0;
}
......
......@@ -77,16 +77,14 @@ void XttFileviewQtWidget::list_ok_cb(const QString& file)
if (fileview->type == fileview_eType_Open) {
char selected_text[80];
QByteArray textiso = file.toLatin1();
strcpy(selected_text, textiso.data());
strcpy(selected_text, qPrintableLatin1(file));
fileview->execute(selected_text);
} else {
bool file_exist = false;
char input_text[200];
QByteArray text = file.toLatin1();
strncpy(input_text, text.data(), sizeof(input_text));
strncpy(input_text, qPrintableLatin1(file), sizeof(input_text));
/*
if (strcmp(filetype, "") != 0) {
......
......@@ -368,16 +368,10 @@ void HistQtWidget::ok_btn()
hist->eventPrio_C = hist->prioC_toggle_w->isChecked();
hist->eventPrio_D = hist->prioD_toggle_w->isChecked();
QByteArray ba = hist->start_time_entry_w->text().toLatin1();
hist->minTime_str = ba.data();
ba = hist->stop_time_entry_w->text().toLatin1();
hist->maxTime_str = ba.data();
ba = hist->event_text_entry_w->text().toLatin1();
hist->eventText_str = ba.data();
ba = hist->event_name_entry_w->text().toLatin1();
hist->eventName_str = ba.data();
hist->minTime_str = qPrintableLatin1(hist->start_time_entry_w->text());
hist->maxTime_str = qPrintableLatin1(hist->stop_time_entry_w->text());
hist->eventText_str = qPrintableLatin1(hist->event_text_entry_w->text());
hist->eventName_str = qPrintableLatin1(hist->event_name_entry_w->text());
hist->get_hist_list();
......
......@@ -59,6 +59,9 @@ CoWowRecall XAttQt::value_recall;
void XAttQt::message(char severity, const char* message)
{
msg_label->setText(fl(message));
if (strcmp(message, "") != 0) {
msg_label->setVisible(true);
}
}
void XAttQt::set_prompt(const char* prompt)
......@@ -213,8 +216,7 @@ void XAttQt::change_value_close()
{
if (input_open) {
if (input_multiline) {
QByteArray ba = cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_scrolled_buffer->toPlainText());
if (text) {
xattnav->set_attr_value(input_node, input_name, text);
......@@ -232,8 +234,7 @@ void XAttQt::change_value_close()
message('E', "Input error, invalid character");
}
} else {
QByteArray ba = cmd_entry->text().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_entry->text());
if (text) {
xattnav->set_attr_value(input_node, input_name, text);
......@@ -260,10 +261,9 @@ void XAttQtWidget::activate_cmd_entry()
xatt->xattnav->set_inputfocus();
QByteArray ba = xatt->cmd_entry->text().toLatin1();
char* text = ba.data();
if (xatt->input_open) {
char* text = qPrintableLatin1(xatt->cmd_entry->text());
if (text) {
xatt->xattnav->set_attr_value(xatt->input_node, xatt->input_name, text);
}
......@@ -282,8 +282,7 @@ void XAttQtWidget::activate_cmd_entry()
void XAttQtWidget::activate_cmd_scrolled_ok()
{
if (xatt->input_open) {
QByteArray ba = xatt->cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(xatt->cmd_scrolled_buffer->toPlainText());
if (text) {
xatt->xattnav->set_attr_value(xatt->input_node, xatt->input_name, text);
......@@ -450,6 +449,7 @@ XAttQt::XAttQt(QWidget* xa_parent_wid, void* xa_parent_ctx,
toplevel->show();
msg_label->setVisible(false);
cmd_prompt->setVisible(false);
cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false);
......
......@@ -58,6 +58,9 @@ CoWowRecall XAttOneQt::value_recall;
void XAttOneQt::message(char severity, const char* message)
{
msg_label->setText(fl(message));
if (strcmp(message, "") != 0) {
msg_label->setVisible(true);
}
}
void XAttOneQt::set_prompt(char* prompt)
......@@ -81,16 +84,14 @@ int XAttOneQt::set_value()
textutf8 = cmd_entry->text();
}
QByteArray text = textutf8.toLatin1();
if (!text.data()) {
message('E', "Input error, invalid character");
if (textutf8.isEmpty()) {
message('E', "Input cannot be empty");
return 0;
}
char buff[1024];
int sts = XNav::attr_string_to_value(
atype, text.data(), buff, sizeof(buff), asize);
atype, qPrintableLatin1(textutf8), buff, sizeof(buff), asize);
if (EVEN(sts)) {
message('E', "Input syntax error");
return sts;
......@@ -327,6 +328,7 @@ XAttOneQt::XAttOneQt(QWidget* xa_parent_wid, void* xa_parent_ctx,
access_rw = 0;
}
msg_label->setVisible(false);
if (access_rw) {
cmd_label->setVisible(false);
} else {
......
......@@ -57,6 +57,9 @@ CoWowRecall XColWindQt::value_recall;
void XColWindQt::message(char severity, const char* message)
{
msg_label->setText(fl(message));
if (strcmp(message, "") != 0) {
msg_label->setVisible(true);
}
}
void XColWindQt::set_prompt(const char* prompt)
......@@ -272,8 +275,7 @@ void XColWindQt::change_value_close()
{
if (input_open) {
if (input_multiline) {
QByteArray ba = cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_scrolled_buffer->toPlainText());
if (text) {
xattnav->set_attr_value(input_node, input_name, text);
......@@ -291,8 +293,7 @@ void XColWindQt::change_value_close()
message('E', "Input error, invalid character");
}
} else {
QByteArray ba = cmd_entry->text().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(cmd_entry->text());
if (text) {
xattnav->set_attr_value(input_node, input_name, text);
......@@ -319,10 +320,9 @@ void XColWindQtWidget::activate_cmd_entry()
colwind->xattnav->set_inputfocus();
QByteArray ba = colwind->cmd_entry->text().toLatin1();
char* text = ba.data();
if (colwind->input_open) {
char* text = qPrintableLatin1(colwind->cmd_entry->text());
if (text) {
colwind->xattnav->set_attr_value(
colwind->input_node, colwind->input_name, text);
......@@ -343,8 +343,7 @@ void XColWindQtWidget::activate_cmd_entry()
void XColWindQtWidget::activate_cmd_scrolled_ok()
{
if (colwind->input_open) {
QByteArray ba = colwind->cmd_scrolled_buffer->toPlainText().toLatin1();
char* text = ba.data();
char* text = qPrintableLatin1(colwind->cmd_scrolled_buffer->toPlainText());
if (text) {
colwind->xattnav->set_attr_value(
......@@ -577,6 +576,7 @@ XColWindQt::XColWindQt(QWidget* xa_parent_wid, void* xa_parent_ctx,
toplevel->show();
msg_label->setVisible(false);
cmd_prompt->setVisible(false);
cmd_entry->setVisible(false);
cmd_scrolledinput->setVisible(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment