Diffstat (limited to 'noncore/tools/opie-sh/inputdialog.cpp') (more/less context) (show whitespace changes)
-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 | |||
@@ -27,61 +27,65 @@ InputDialog::InputDialog(int w, int h, int newtype, QString labelString, QString | |||
27 | layout->addSpacing(5); | 27 | layout->addSpacing(5); |
28 | layout->addWidget(label); | 28 | layout->addWidget(label); |
29 | layout->addSpacing(5); | 29 | layout->addSpacing(5); |
30 | 30 | ||
31 | switch(type) | 31 | switch(type) |
32 | { | 32 | { |
33 | case 0: | 33 | case 0: |
34 | lineEdit = new QLineEdit(this, "line edit"); | 34 | lineEdit = new QLineEdit(this, "line edit"); |
35 | layout->addWidget(lineEdit); | 35 | layout->addWidget(lineEdit); |
36 | break; | 36 | break; |
37 | case 1: | 37 | case 1: |
38 | comboBox = new QComboBox(edit, this, "combo box"); | 38 | comboBox = new QComboBox(edit, this, "combo box"); |
39 | layout->addWidget(comboBox); | 39 | layout->addWidget(comboBox); |
40 | if(!filename.isNull()) | 40 | if(!filename.isNull()) |
41 | { | 41 | { |
42 | QFile file(filename); | 42 | QFile file(filename); |
43 | file.open(IO_ReadOnly); | 43 | if (file.open(IO_ReadOnly)) |
44 | { | ||
44 | QTextStream stream(&file); | 45 | QTextStream stream(&file); |
45 | QString string = stream.read(); | 46 | QString string = stream.read(); |
46 | 47 | ||
47 | comboBox->insertStringList(QStringList::split('\n', string)); | 48 | comboBox->insertStringList(QStringList::split('\n', string)); |
48 | } | 49 | } |
50 | } | ||
49 | else | 51 | else |
50 | { | 52 | { |
51 | QFile file; | 53 | QFile file; |
52 | file.open(IO_ReadOnly, 0); | 54 | file.open(IO_ReadOnly, 0); |
53 | QTextStream stream(&file); | 55 | QTextStream stream(&file); |
54 | QString string = stream.read(); | 56 | QString string = stream.read(); |
55 | 57 | ||
56 | comboBox->insertStringList(QStringList::split('\n', string)); | 58 | comboBox->insertStringList(QStringList::split('\n', string)); |
57 | } | 59 | } |
58 | break; | 60 | break; |
59 | case 2: | 61 | case 2: |
60 | listBox = new QListBox(this, "list box"); | 62 | listBox = new QListBox(this, "list box"); |
61 | listBox->setSelectionMode(QListBox::Multi); | 63 | listBox->setSelectionMode(QListBox::Multi); |
62 | layout->addWidget(listBox); | 64 | layout->addWidget(listBox); |
63 | if(!filename.isNull()) | 65 | if(!filename.isNull()) |
64 | { | 66 | { |
65 | QFile file(filename); | 67 | QFile file(filename); |
66 | file.open(IO_ReadOnly); | 68 | if (file.open(IO_ReadOnly)) |
69 | { | ||
67 | QTextStream stream(&file); | 70 | QTextStream stream(&file); |
68 | QString string = stream.read(); | 71 | QString string = stream.read(); |
69 | 72 | ||
70 | listBox->insertStringList(QStringList::split('\n', string)); | 73 | listBox->insertStringList(QStringList::split('\n', string)); |
71 | } | 74 | } |
75 | } | ||
72 | else | 76 | else |
73 | { | 77 | { |
74 | QFile file; | 78 | QFile file; |
75 | file.open(IO_ReadOnly, 0); | 79 | file.open(IO_ReadOnly, 0); |
76 | QTextStream stream(&file); | 80 | QTextStream stream(&file); |
77 | QString string = stream.read(); | 81 | QString string = stream.read(); |
78 | 82 | ||
79 | listBox->insertStringList(QStringList::split('\n', string)); | 83 | listBox->insertStringList(QStringList::split('\n', string)); |
80 | } | 84 | } |
81 | break; | 85 | break; |
82 | case 3: | 86 | case 3: |
83 | lineEdit = new QLineEdit(this, "line edit"); | 87 | lineEdit = new QLineEdit(this, "line edit"); |
84 | lineEdit->setEchoMode(QLineEdit::Password); | 88 | lineEdit->setEchoMode(QLineEdit::Password); |
85 | layout->addWidget(lineEdit); | 89 | layout->addWidget(lineEdit); |
86 | break; | 90 | break; |
87 | } | 91 | } |