-rw-r--r-- | noncore/tools/opie-sh/fviewer.cpp | 4 | ||||
-rw-r--r-- | noncore/tools/opie-sh/fviewer.h | 3 | ||||
-rw-r--r-- | noncore/tools/opie-sh/opie-sh.control | 5 | ||||
-rw-r--r-- | noncore/tools/opie-sh/opie-sh.cpp | 16 |
4 files changed, 20 insertions, 8 deletions
diff --git a/noncore/tools/opie-sh/fviewer.cpp b/noncore/tools/opie-sh/fviewer.cpp index 5dc09ff..882c72c 100644 --- a/noncore/tools/opie-sh/fviewer.cpp +++ b/noncore/tools/opie-sh/fviewer.cpp | |||
@@ -1,57 +1,59 @@ | |||
1 | /* | 1 | /* |
2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) | 2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | #include "fviewer.h" | 16 | #include "fviewer.h" |
17 | 17 | ||
18 | FViewer::FViewer(QString filename, QString title, QWidget *parent=0, const char*name=0):QWidget(parent, name) | 18 | FViewer::FViewer(QString icon, QString filename, QString title, QWidget *parent=0, const char*name=0):QWidget(parent, name) |
19 | { | 19 | { |
20 | QVBoxLayout *layout = new QVBoxLayout(this); | 20 | QVBoxLayout *layout = new QVBoxLayout(this); |
21 | |||
22 | setIcon(Resource::loadPixmap("opie-sh")); | ||
21 | 23 | ||
22 | textView = new QTextBrowser(this, "textview"); | 24 | textView = new QTextBrowser(this, "textview"); |
23 | layout->addWidget(textView); | 25 | layout->addWidget(textView); |
24 | 26 | ||
25 | QString string; | 27 | QString string; |
26 | 28 | ||
27 | if(title.isNull()) | 29 | if(title.isNull()) |
28 | { | 30 | { |
29 | setCaption(filename); | 31 | setCaption(filename); |
30 | } | 32 | } |
31 | else | 33 | else |
32 | { | 34 | { |
33 | setCaption(title); | 35 | setCaption(title); |
34 | } | 36 | } |
35 | 37 | ||
36 | file = new QFile(); | 38 | file = new QFile(); |
37 | 39 | ||
38 | if(!filename.isNull()) | 40 | if(!filename.isNull()) |
39 | { | 41 | { |
40 | file->setName(filename); | 42 | file->setName(filename); |
41 | file->open(IO_ReadOnly); | 43 | file->open(IO_ReadOnly); |
42 | } | 44 | } |
43 | else | 45 | else |
44 | { | 46 | { |
45 | file->open(IO_ReadOnly, 0); | 47 | file->open(IO_ReadOnly, 0); |
46 | } | 48 | } |
47 | 49 | ||
48 | stream = new QTextStream(file); | 50 | stream = new QTextStream(file); |
49 | 51 | ||
50 | string = stream->read(); | 52 | string = stream->read(); |
51 | textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()+"/"); | 53 | textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()+"/"); |
52 | textView->setText(string, QDir::currentDirPath()+"/"); | 54 | textView->setText(string, QDir::currentDirPath()+"/"); |
53 | printf("%s\n", QDir::currentDirPath().latin1()); | 55 | printf("%s\n", QDir::currentDirPath().latin1()); |
54 | file->close(); | 56 | file->close(); |
55 | 57 | ||
56 | } | 58 | } |
57 | 59 | ||
diff --git a/noncore/tools/opie-sh/fviewer.h b/noncore/tools/opie-sh/fviewer.h index 488b6ed..cd5206c 100644 --- a/noncore/tools/opie-sh/fviewer.h +++ b/noncore/tools/opie-sh/fviewer.h | |||
@@ -1,35 +1,36 @@ | |||
1 | /* | 1 | /* |
2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) | 2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <qwidget.h> | 17 | #include <qwidget.h> |
18 | #include <qfile.h> | 18 | #include <qfile.h> |
19 | #include <qtextstream.h> | 19 | #include <qtextstream.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qdir.h> | 23 | #include <qdir.h> |
24 | #include <qpe/resource.h> | ||
24 | 25 | ||
25 | class FViewer :public QWidget | 26 | class FViewer :public QWidget |
26 | { | 27 | { |
27 | Q_OBJECT | 28 | Q_OBJECT |
28 | public: | 29 | public: |
29 | FViewer(QString filename, QString title, QWidget *parent=0, const char*name=0); | 30 | FViewer(QString icon, QString filename, QString title, QWidget *parent=0, const char*name=0); |
30 | private: | 31 | private: |
31 | QFile *file; | 32 | QFile *file; |
32 | QTextBrowser *textView; | 33 | QTextBrowser *textView; |
33 | QTextStream *stream; | 34 | QTextStream *stream; |
34 | QTimer *timer; | 35 | QTimer *timer; |
35 | }; | 36 | }; |
diff --git a/noncore/tools/opie-sh/opie-sh.control b/noncore/tools/opie-sh/opie-sh.control index e9b13a5..8f586fe 100644 --- a/noncore/tools/opie-sh/opie-sh.control +++ b/noncore/tools/opie-sh/opie-sh.control | |||
@@ -1,10 +1,11 @@ | |||
1 | Files: bin/opie-sh pics/opie-sh/*.png | 1 | Files: bin/opie-sh* apps/Applications/opie-sh.desktop pics/opie-sh/*.png help/opie-sh/*.html |
2 | Priority: optional | 2 | Priority: optional |
3 | Package: opie-sh | ||
3 | Section: opie/applications | 4 | Section: opie/applications |
4 | Maintainer: Thomas Stephens <spiralman@softhome.net> | 5 | Maintainer: Thomas Stephens <spiralman@softhome.net> |
5 | Architecture: arm | 6 | Architecture: arm |
6 | Version: 0.4-$SUB_VERSION | 7 | Version: 0.5-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 8 | Depends: opie-base ($QPE_VERSION) |
8 | License: GPL | 9 | License: GPL |
9 | Description: a QDialog shell frontend | 10 | Description: a QDialog shell frontend |
10 | A program to let you use various dialogs from the console (or a shell script) | 11 | A program to let you use various dialogs from the console (or a shell script) |
diff --git a/noncore/tools/opie-sh/opie-sh.cpp b/noncore/tools/opie-sh/opie-sh.cpp index a1b8035..e898cb1 100644 --- a/noncore/tools/opie-sh/opie-sh.cpp +++ b/noncore/tools/opie-sh/opie-sh.cpp | |||
@@ -1,269 +1,277 @@ | |||
1 | /* | 1 | /* |
2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) | 2 | Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) |
3 | Copyright (C) 2002 Thomas Stephens | 3 | Copyright (C) 2002 Thomas Stephens |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public | 5 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public |
6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later | 6 | License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later |
7 | version. | 7 | version. |
8 | 8 | ||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <qstring.h> | 17 | #include <qstring.h> |
18 | #include <qstringlist.h> | 18 | #include <qstringlist.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | 22 | ||
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | 24 | ||
25 | #include "mbox.h" | 25 | #include "mbox.h" |
26 | #include "fviewer.h" | 26 | #include "fviewer.h" |
27 | #include "inputdialog.h" | 27 | #include "inputdialog.h" |
28 | 28 | ||
29 | int myMessageBox(int wi, int h, QWidget *w, int argc, QStringList args) | 29 | int myMessageBox(int wi, int h, QWidget *w, int argc, QStringList args) |
30 | { | 30 | { |
31 | int i, type=0; | 31 | int i, type=0; |
32 | QString button0Text, button1Text, button2Text, string, title; | 32 | QString button0Text, button1Text, button2Text, string, title; |
33 | bool full=true; | 33 | bool full=true; |
34 | 34 | ||
35 | for(i=0; i<argc; i++) | 35 | for(i=0; i<argc; i++) |
36 | { | 36 | { |
37 | if(args[i] == "-t") | 37 | if(args[i] == "-t") |
38 | { | 38 | { |
39 | title = args[i+1]; | 39 | title = args[i+1]; |
40 | } | 40 | } |
41 | 41 | ||
42 | if(args[i] == "-M") | 42 | if(args[i] == "-M") |
43 | { | 43 | { |
44 | string = args[i+1]; | 44 | string = args[i+1]; |
45 | } | 45 | } |
46 | 46 | ||
47 | if(args[i] == "-0") | 47 | if(args[i] == "-0") |
48 | { | 48 | { |
49 | button0Text = args[i+1]; | 49 | button0Text = args[i+1]; |
50 | } | 50 | } |
51 | 51 | ||
52 | if(args[i] == "-1") | 52 | if(args[i] == "-1") |
53 | { | 53 | { |
54 | button1Text = args[i+1]; | 54 | button1Text = args[i+1]; |
55 | } | 55 | } |
56 | 56 | ||
57 | if(args[i] == "-2") | 57 | if(args[i] == "-2") |
58 | { | 58 | { |
59 | button2Text = args[i+1]; | 59 | button2Text = args[i+1]; |
60 | } | 60 | } |
61 | 61 | ||
62 | if(args[i] == "-I") | 62 | if(args[i] == "-I") |
63 | { | 63 | { |
64 | type=0; | 64 | type=0; |
65 | } | 65 | } |
66 | 66 | ||
67 | if(args[i] == "-w") | 67 | if(args[i] == "-w") |
68 | { | 68 | { |
69 | type = 1; | 69 | type = 1; |
70 | } | 70 | } |
71 | 71 | ||
72 | if(args[i] == "-e") | 72 | if(args[i] == "-e") |
73 | { | 73 | { |
74 | type = 2; | 74 | type = 2; |
75 | } | 75 | } |
76 | 76 | ||
77 | if(args[i] == "-g") | 77 | if(args[i] == "-g") |
78 | { | 78 | { |
79 | full = false; | 79 | full = false; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | MBox *mbox = new MBox(wi, h, (int)type, title, string, &button0Text, &button1Text, &button2Text, w, (QString)"messagebox"); | 83 | MBox *mbox = new MBox(wi, h, (int)type, title, string, &button0Text, &button1Text, &button2Text, w, (QString)"messagebox"); |
84 | if(full) | 84 | if(full) |
85 | { | 85 | { |
86 | w->setCaption(title); | 86 | w->setCaption(title); |
87 | w->showMaximized(); | 87 | w->showMaximized(); |
88 | } | 88 | } |
89 | //mbox->show(); | 89 | //mbox->show(); |
90 | switch(mbox->exec() ) | 90 | switch(mbox->exec() ) |
91 | { | 91 | { |
92 | case 0: | 92 | case 0: |
93 | return -1; | 93 | return -1; |
94 | case 1: | 94 | case 1: |
95 | return -1; | 95 | return -1; |
96 | case 2: | 96 | case 2: |
97 | return 0; | 97 | return 0; |
98 | case 3: | 98 | case 3: |
99 | return 1; | 99 | return 1; |
100 | case 4: | 100 | case 4: |
101 | return 2; | 101 | return 2; |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | void printusage() | 105 | void printusage() |
106 | { | 106 | { |
107 | printf("Usage instructions for Opie-sh\n"); | 107 | printf("Usage instructions for Opie-sh\n"); |
108 | printf("Usage: opie-sh [dialog type] [type specific options]\n"); | 108 | printf("Usage: opie-sh [dialog type] [type specific options]\n"); |
109 | printf("Types:\n"); | 109 | printf("Types:\n"); |
110 | printf(" -m Message Box\n"); | 110 | printf(" -m Message Box\n"); |
111 | printf(" -f [filename] View file [Default = stdin]\n"); | 111 | printf(" -f [filename] View file [Default = stdin]\n"); |
112 | printf(" -i Input dialog\n"); | 112 | printf(" -i Input dialog\n"); |
113 | printf(" -h --help These instructions\n"); | 113 | printf(" -h --help These instructions\n"); |
114 | printf(" -t [title] The window/dialog title\n"); | 114 | printf(" -t [title] The window/dialog title\n"); |
115 | printf("Message box options:\n"); | 115 | printf("Message box options:\n"); |
116 | printf(" -M [message] The message to display\n"); | 116 | printf(" -M [message] The message to display\n"); |
117 | printf(" -I Use information icon\n"); | 117 | printf(" -I Use information icon\n"); |
118 | printf(" -w Use the warning icon\n"); | 118 | printf(" -w Use the warning icon\n"); |
119 | printf(" -e Use the error icon\n"); | 119 | printf(" -e Use the error icon\n"); |
120 | printf(" -0 [text] First button text [Default = OK]\n"); | 120 | printf(" -0 [text] First button text [Default = OK]\n"); |
121 | printf(" -1 [text] Second button text\n"); | 121 | printf(" -1 [text] Second button text\n"); |
122 | printf(" -2 [text] Third button text\n"); | 122 | printf(" -2 [text] Third button text\n"); |
123 | printf(" -g Disable fullscreen\n"); | 123 | printf(" -g Disable fullscreen\n"); |
124 | printf("Input Dialog options:\n"); | 124 | printf("Input Dialog options:\n"); |
125 | printf(" -s A single line of input (output to console)\n"); | 125 | printf(" -s A single line of input (output to console)\n"); |
126 | printf(" -l List input (newline separated list read in from file)\n"); | 126 | printf(" -l List input (newline separated list read in from file)\n"); |
127 | printf(" -b A list box, enabling multiple selections (input same as -l)\n"); | 127 | printf(" -b A list box, enabling multiple selections (input same as -l)\n"); |
128 | printf(" -L [label] The label for the input field\n"); | 128 | printf(" -L [label] The label for the input field\n"); |
129 | printf(" -F [filename] An input file (for when it makes sense) [Default = stdin]\n"); | 129 | printf(" -F [filename] An input file (for when it makes sense) [Default = stdin]\n"); |
130 | printf(" -E Makes list input editable\n"); | 130 | printf(" -E Makes list input editable\n"); |
131 | printf(" -g Disable fullscreen\n"); | 131 | printf(" -g Disable fullscreen\n\0"); |
132 | } | 132 | } |
133 | 133 | ||
134 | int fileviewer(QPEApplication *a, int argc, QStringList args) | 134 | int fileviewer(QPEApplication *a, int argc, QStringList args) |
135 | { | 135 | { |
136 | int i; | 136 | int i; |
137 | QString filename, title; | 137 | QString filename, title, icon; |
138 | bool update=false; | 138 | bool update=false; |
139 | 139 | ||
140 | for(i=0; i < argc; i++) | 140 | for(i=0; i < argc; i++) |
141 | { | 141 | { |
142 | if(args[i] == "-f") | 142 | if(args[i] == "-f") |
143 | { | 143 | { |
144 | if(args[i+1][0] != '-') | 144 | if(args[i+1][0] != '-') |
145 | { | 145 | { |
146 | filename = args[i+1]; | 146 | filename = args[i+1]; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | if(args[i] == "-I") | ||
151 | { | ||
152 | icon=args[i+1]; | ||
153 | } | ||
154 | |||
150 | if(args[i] == "-t") | 155 | if(args[i] == "-t") |
151 | { | 156 | { |
152 | title = args[i+1]; | 157 | title = args[i+1]; |
153 | } | 158 | } |
154 | } | 159 | } |
155 | FViewer *fview = new FViewer(filename, title, 0, (QString) "fileviewer"); | 160 | FViewer *fview = new FViewer(icon, filename, title, 0, (QString) "fileviewer"); |
156 | a->setMainWidget(fview); | 161 | a->setMainWidget(fview); |
157 | fview->showMaximized(); | 162 | fview->showMaximized(); |
158 | return a->exec(); | 163 | return a->exec(); |
159 | } | 164 | } |
160 | 165 | ||
161 | int input(int wi, int h, QWidget *w, int argc, QStringList args) | 166 | int input(int wi, int h, QWidget *w, int argc, QStringList args) |
162 | { | 167 | { |
163 | int i, type = 0; | 168 | int i, type = 0; |
164 | QString title, label, filename; | 169 | QString title, label, filename; |
165 | bool edit=false, full=true; | 170 | bool edit=false, full=true; |
166 | 171 | ||
167 | for(i=0; i < argc; i++) | 172 | for(i=0; i < argc; i++) |
168 | { | 173 | { |
169 | if(args[i] == "-s") | 174 | if(args[i] == "-s") |
170 | { | 175 | { |
171 | type = 0; | 176 | type = 0; |
172 | } | 177 | } |
173 | 178 | ||
174 | if(args[i] == "-l") | 179 | if(args[i] == "-l") |
175 | { | 180 | { |
176 | type = 1; | 181 | type = 1; |
177 | } | 182 | } |
178 | 183 | ||
179 | if(args[i] == "-b") | 184 | if(args[i] == "-b") |
180 | { | 185 | { |
181 | type = 2; | 186 | type = 2; |
182 | } | 187 | } |
183 | 188 | ||
184 | if(args[i] == "-t") | 189 | if(args[i] == "-t") |
185 | { | 190 | { |
186 | title = args[i+1]; | 191 | title = args[i+1]; |
187 | } | 192 | } |
188 | 193 | ||
189 | if(args[i] == "-L") | 194 | if(args[i] == "-L") |
190 | { | 195 | { |
191 | label = args[i+1]; | 196 | label = args[i+1]; |
192 | } | 197 | } |
193 | 198 | ||
194 | if(args[i] == "-F") | 199 | if(args[i] == "-F") |
195 | { | 200 | { |
196 | filename = args[i+1]; | 201 | if(args[i+1][0] != '-') |
202 | { | ||
203 | filename = args[i+1]; | ||
204 | } | ||
197 | } | 205 | } |
198 | 206 | ||
199 | if(args[i] =="-E") | 207 | if(args[i] =="-E") |
200 | { | 208 | { |
201 | edit = true; | 209 | edit = true; |
202 | } | 210 | } |
203 | 211 | ||
204 | if(args[i] == "-g") | 212 | if(args[i] == "-g") |
205 | { | 213 | { |
206 | full = false; | 214 | full = false; |
207 | } | 215 | } |
208 | } | 216 | } |
209 | InputDialog *id = new InputDialog(wi, h, type, label, title, filename, edit, w); | 217 | InputDialog *id = new InputDialog(wi, h, type, label, title, filename, edit, w); |
210 | if(full) | 218 | if(full) |
211 | { | 219 | { |
212 | w->setCaption(title); | 220 | w->setCaption(title); |
213 | w->showMaximized(); | 221 | w->showMaximized(); |
214 | } | 222 | } |
215 | if( id->exec() == 1) | 223 | if( id->exec() == 1) |
216 | { | 224 | { |
217 | printf("%s\n", id->getString().latin1()); | 225 | printf("%s\n", id->getString().latin1()); |
218 | return 0; | 226 | return 0; |
219 | } | 227 | } |
220 | else | 228 | else |
221 | { | 229 | { |
222 | return -1; | 230 | return -1; |
223 | } | 231 | } |
224 | } | 232 | } |
225 | 233 | ||
226 | int main(int argc, char **argv) | 234 | int main(int argc, char **argv) |
227 | { | 235 | { |
228 | int i; | 236 | int i; |
229 | QStringList args; | 237 | QStringList args; |
230 | QPEApplication a(argc, argv); | 238 | QPEApplication a(argc, argv); |
231 | QWidget w; | 239 | QWidget w; |
232 | a.setMainWidget(&w); | 240 | a.setMainWidget(&w); |
233 | QWidget *d = a.desktop(); | 241 | QWidget *d = a.desktop(); |
234 | int width=d->width(); | 242 | int width=d->width(); |
235 | int height=d->height(); | 243 | int height=d->height(); |
236 | 244 | ||
237 | for(i=0; i < argc; i++) | 245 | for(i=0; i < argc; i++) |
238 | { | 246 | { |
239 | args += argv[i]; | 247 | args += argv[i]; |
240 | } | 248 | } |
241 | 249 | ||
242 | for(i=0; i < argc; i++) | 250 | for(i=0; i < argc; i++) |
243 | { | 251 | { |
244 | if(args[i] == "-m") | 252 | if(args[i] == "-m") |
245 | { | 253 | { |
246 | return myMessageBox(width, height, &w, argc, args); | 254 | return myMessageBox(width, height, &w, argc, args); |
247 | } | 255 | } |
248 | 256 | ||
249 | if(args[i] == "-f") | 257 | if(args[i] == "-f") |
250 | { | 258 | { |
251 | return fileviewer(&a, argc, args); | 259 | return fileviewer(&a, argc, args); |
252 | } | 260 | } |
253 | 261 | ||
254 | if(args[i] == "-i") | 262 | if(args[i] == "-i") |
255 | { | 263 | { |
256 | return input(width, height, &w, argc, args); | 264 | return input(width, height, &w, argc, args); |
257 | } | 265 | } |
258 | 266 | ||
259 | if(args[i] == "-h" || args[i] =="--help") | 267 | if(args[i] == "-h" || args[i] =="--help") |
260 | { | 268 | { |
261 | printusage(); | 269 | printusage(); |
262 | return -1; | 270 | return -1; |
263 | } | 271 | } |
264 | } | 272 | } |
265 | 273 | ||
266 | printusage(); | 274 | printusage(); |
267 | return -1; | 275 | return -1; |
268 | } | 276 | } |
269 | 277 | ||