// // // C++ Implementation: $MODULE$ // // Description: // // // Author: Patrick S. Vogt , (C) 2003 // // Copyright: See COPYING file that comes with this distribution // // #include "doclnkitem.h" #include #include #include #include #include DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) : ResultItem(parent) { _doc = app; setText(0, _doc->name() ); setPixmap(0, _doc->pixmap() ); } DocLnkItem::~DocLnkItem() { } QString DocLnkItem::toRichText() { QString text; text += "

" + _doc->name() + "


"; text += _doc->comment() + "
"; text += QObject::tr("File: ") + _doc->file() + "
"; text += QObject::tr("Link: ") + _doc->linkFile() + "
"; text += QObject::tr("Mimetype: ") + _doc->type() + "
"; if ( _doc->type().contains( "text" ) ){ text += "



"; QFile f(_doc->file()); if ( f.open(IO_ReadOnly) ) { QTextStream t( &f ); while ( !t.eof() ) text += t.readLine() + "
"; } f.close(); } /* text += "

`"; text += _doc->exec(); text += "`";*/ QStringList list = _doc->mimeTypes(); int i = 0; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { text += QString::number( i++) + " - " + *it ; } return text; } void DocLnkItem::action( int act ) { odebug << "action" << act << oendl; if (!_doc->isValid()) odebug << "INVALID" << oendl; if (act == 0) _doc->execute(); else if (act == 1){ QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); e << _doc->file(); } } QIntDict DocLnkItem::actions() { QIntDict result; result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); return result; }