00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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