-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 | 14 |
4 files changed, 19 insertions, 7 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,45 +1,47 @@ /* Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "fviewer.h" -FViewer::FViewer(QString filename, QString title, QWidget *parent=0, const char*name=0):QWidget(parent, name) +FViewer::FViewer(QString icon, QString filename, QString title, QWidget *parent=0, const char*name=0):QWidget(parent, name) { QVBoxLayout *layout = new QVBoxLayout(this); + setIcon(Resource::loadPixmap("opie-sh")); + textView = new QTextBrowser(this, "textview"); layout->addWidget(textView); QString string; if(title.isNull()) { setCaption(filename); } else { setCaption(title); } file = new QFile(); if(!filename.isNull()) { file->setName(filename); file->open(IO_ReadOnly); } else { file->open(IO_ReadOnly, 0); 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 @@ /* Opie-sh. convinience app to allow you to use qdialogs in scripts (mainly shell scripts) Copyright (C) 2002 Thomas Stephens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <qwidget.h> #include <qfile.h> #include <qtextstream.h> #include <qtextbrowser.h> #include <qlayout.h> #include <qtimer.h> #include <qdir.h> +#include <qpe/resource.h> class FViewer :public QWidget { Q_OBJECT public: - FViewer(QString filename, QString title, QWidget *parent=0, const char*name=0); + FViewer(QString icon, QString filename, QString title, QWidget *parent=0, const char*name=0); private: QFile *file; QTextBrowser *textView; QTextStream *stream; QTimer *timer; }; 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 @@ -Files: bin/opie-sh pics/opie-sh/*.png +Files: bin/opie-sh* apps/Applications/opie-sh.desktop pics/opie-sh/*.png help/opie-sh/*.html Priority: optional +Package: opie-sh Section: opie/applications Maintainer: Thomas Stephens <spiralman@softhome.net> Architecture: arm -Version: 0.4-$SUB_VERSION +Version: 0.5-$SUB_VERSION Depends: opie-base ($QPE_VERSION) License: GPL Description: a QDialog shell frontend 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 @@ -107,115 +107,123 @@ void printusage() printf("Usage instructions for Opie-sh\n"); printf("Usage: opie-sh [dialog type] [type specific options]\n"); printf("Types:\n"); printf(" -m Message Box\n"); printf(" -f [filename] View file [Default = stdin]\n"); printf(" -i Input dialog\n"); printf(" -h --help These instructions\n"); printf(" -t [title] The window/dialog title\n"); printf("Message box options:\n"); printf(" -M [message] The message to display\n"); printf(" -I Use information icon\n"); printf(" -w Use the warning icon\n"); printf(" -e Use the error icon\n"); printf(" -0 [text] First button text [Default = OK]\n"); printf(" -1 [text] Second button text\n"); printf(" -2 [text] Third button text\n"); printf(" -g Disable fullscreen\n"); printf("Input Dialog options:\n"); printf(" -s A single line of input (output to console)\n"); printf(" -l List input (newline separated list read in from file)\n"); printf(" -b A list box, enabling multiple selections (input same as -l)\n"); printf(" -L [label] The label for the input field\n"); printf(" -F [filename] An input file (for when it makes sense) [Default = stdin]\n"); printf(" -E Makes list input editable\n"); - printf(" -g Disable fullscreen\n"); + printf(" -g Disable fullscreen\n\0"); } int fileviewer(QPEApplication *a, int argc, QStringList args) { int i; - QString filename, title; + QString filename, title, icon; bool update=false; for(i=0; i < argc; i++) { if(args[i] == "-f") { if(args[i+1][0] != '-') { filename = args[i+1]; } } + if(args[i] == "-I") + { + icon=args[i+1]; + } + if(args[i] == "-t") { title = args[i+1]; } } - FViewer *fview = new FViewer(filename, title, 0, (QString) "fileviewer"); + FViewer *fview = new FViewer(icon, filename, title, 0, (QString) "fileviewer"); a->setMainWidget(fview); fview->showMaximized(); return a->exec(); } int input(int wi, int h, QWidget *w, int argc, QStringList args) { int i, type = 0; QString title, label, filename; bool edit=false, full=true; for(i=0; i < argc; i++) { if(args[i] == "-s") { type = 0; } if(args[i] == "-l") { type = 1; } if(args[i] == "-b") { type = 2; } if(args[i] == "-t") { title = args[i+1]; } if(args[i] == "-L") { label = args[i+1]; } if(args[i] == "-F") { + if(args[i+1][0] != '-') + { filename = args[i+1]; } + } if(args[i] =="-E") { edit = true; } if(args[i] == "-g") { full = false; } } InputDialog *id = new InputDialog(wi, h, type, label, title, filename, edit, w); if(full) { w->setCaption(title); w->showMaximized(); } if( id->exec() == 1) { printf("%s\n", id->getString().latin1()); return 0; } else { |