-rw-r--r-- | noncore/tools/opie-sh/fviewer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/tools/opie-sh/fviewer.cpp b/noncore/tools/opie-sh/fviewer.cpp index 1a0acc6..5dc09ff 100644 --- a/noncore/tools/opie-sh/fviewer.cpp +++ b/noncore/tools/opie-sh/fviewer.cpp | |||
@@ -1,56 +1,57 @@ | |||
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 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 | 21 | ||
22 | textView = new QTextBrowser(this, "textview"); | 22 | textView = new QTextBrowser(this, "textview"); |
23 | layout->addWidget(textView); | 23 | layout->addWidget(textView); |
24 | 24 | ||
25 | QString string; | 25 | QString string; |
26 | 26 | ||
27 | if(title.isNull()) | 27 | if(title.isNull()) |
28 | { | 28 | { |
29 | setCaption(filename); | 29 | setCaption(filename); |
30 | } | 30 | } |
31 | else | 31 | else |
32 | { | 32 | { |
33 | setCaption(title); | 33 | setCaption(title); |
34 | } | 34 | } |
35 | 35 | ||
36 | file = new QFile(); | 36 | file = new QFile(); |
37 | 37 | ||
38 | if(!filename.isNull()) | 38 | if(!filename.isNull()) |
39 | { | 39 | { |
40 | file->setName(filename); | 40 | file->setName(filename); |
41 | file->open(IO_ReadOnly); | 41 | file->open(IO_ReadOnly); |
42 | } | 42 | } |
43 | else | 43 | else |
44 | { | 44 | { |
45 | file->open(IO_ReadOnly, 0); | 45 | file->open(IO_ReadOnly, 0); |
46 | } | 46 | } |
47 | 47 | ||
48 | stream = new QTextStream(file); | 48 | stream = new QTextStream(file); |
49 | 49 | ||
50 | string = stream->read(); | 50 | string = stream->read(); |
51 | textView->setText(string); | 51 | textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()+"/"); |
52 | textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()); | 52 | textView->setText(string, QDir::currentDirPath()+"/"); |
53 | printf("%s\n", QDir::currentDirPath().latin1()); | ||
53 | file->close(); | 54 | file->close(); |
54 | 55 | ||
55 | } | 56 | } |
56 | 57 | ||