-rw-r--r-- | noncore/tools/opie-sh/inputdialog.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/tools/opie-sh/inputdialog.cpp b/noncore/tools/opie-sh/inputdialog.cpp index 8046795..1dd8bf7 100644 --- a/noncore/tools/opie-sh/inputdialog.cpp +++ b/noncore/tools/opie-sh/inputdialog.cpp @@ -37,18 +37,20 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString case 1: comboBox = new QComboBox(edit, this, "combo box"); layout->addWidget(comboBox); if(!filename.isNull()) { QFile file(filename); - file.open(IO_ReadOnly); + if (file.open(IO_ReadOnly)) + { QTextStream stream(&file); QString string = stream.read(); comboBox->insertStringList(QStringList::split('\n', string)); } + } else { QFile file; file.open(IO_ReadOnly, 0); QTextStream stream(&file); QString string = stream.read(); @@ -60,18 +62,20 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString listBox = new QListBox(this, "list box"); listBox->setSelectionMode(QListBox::Multi); layout->addWidget(listBox); if(!filename.isNull()) { QFile file(filename); - file.open(IO_ReadOnly); + if (file.open(IO_ReadOnly)) + { QTextStream stream(&file); QString string = stream.read(); listBox->insertStringList(QStringList::split('\n', string)); } + } else { QFile file; file.open(IO_ReadOnly, 0); QTextStream stream(&file); QString string = stream.read(); |