Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

fviewer.cpp

Go to the documentation of this file.
00001 /*
00002 Opie-sh.  convinience app to allow you to use qdialogs in scripts (mainly shell scripts)
00003 Copyright (C) 2002 Thomas Stephens
00004 
00005 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
00006 License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
00007 version.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
00010 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
00011 Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License along with this program; if not, write to the Free
00014 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00015 */
00016 #include "fviewer.h"
00017 
00018 #include <opie2/oresource.h>
00019 
00020 FViewer::FViewer(QString icon, QString filename, QString title, QWidget *parent, const char*name):QWidget(parent, name)
00021 {
00022         QVBoxLayout *layout = new QVBoxLayout(this);
00023         
00024         setIcon(Opie::Core::OResource::loadPixmap("opie-sh", Opie::Core::OResource::SmallIcon));
00025 
00026         textView = new QTextBrowser(this, "textview");
00027         layout->addWidget(textView);
00028 
00029         QString string;
00030 
00031         if(title.isNull())
00032         {
00033                 setCaption(filename);
00034         }
00035         else
00036         {
00037                 setCaption(title);
00038         }
00039         
00040         file = new QFile();
00041 
00042         if(!filename.isNull())
00043         {
00044                 file->setName(filename);
00045                 file->open(IO_ReadOnly);
00046         }
00047         else
00048         {
00049                 file->open(IO_ReadOnly, 0);
00050         }
00051         
00052         stream =  new QTextStream(file);
00053 
00054         string = stream->read();
00055         textView->mimeSourceFactory()->setFilePath(QDir::currentDirPath()+"/");
00056         textView->setText(string, QDir::currentDirPath()+"/");
00057         printf("%s\n", QDir::currentDirPath().latin1());
00058         file->close();
00059 
00060 }
00061 

Generated on Sat Nov 5 16:18:01 2005 for OPIE by  doxygen 1.4.2