From 43c18630840a98aed8deb96b454957c40f0a4344 Mon Sep 17 00:00:00 2001 From: tille Date: Sun, 11 May 2003 19:19:30 +0000 Subject: improved applnk and doclnk searching clean up: - mainwindow: handling of searchgroups - searchgroups: introduced load, search and insertItem functions - flexible actions handling - doclnksearch inherits applnksearch --- (limited to 'core/pim/osearch/doclnkitem.cpp') diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp index fd19727..75dee58 100644 --- a/core/pim/osearch/doclnkitem.cpp +++ b/core/pim/osearch/doclnkitem.cpp @@ -2,7 +2,7 @@ // // C++ Implementation: $MODULE$ // -// Description: +// Description: // // // Author: Patrick S. Vogt , (C) 2003 @@ -13,6 +13,8 @@ #include "doclnkitem.h" #include +#include +#include DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) : ResultItem(parent) @@ -21,34 +23,48 @@ DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) setText(0, _doc->name() ); } - DocLnkItem::~DocLnkItem() { } - QString DocLnkItem::toRichText() { QString text; - text += "

"; - text += _doc->name(); - text += "


"; - text += _doc->comment(); - text += "

`"; + text += "

" + _doc->name() + "


"; + text += _doc->comment() + "
"; + text += "File: " + _doc->file() + "
"; + text += "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 += "`"; + 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::editItem() +void DocLnkItem::action( int act ) { - _doc->execute(); + qDebug("action %i",act); + if (!_doc->isValid()) qDebug("INVALID"); + if (act == 0) _doc->execute(); } -void DocLnkItem::showItem() +QIntDict DocLnkItem::actions() { -/* QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); - e << _contact->uid();*/ - ResultItem::showItem(); + QIntDict result; + result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); + return result; } - -- cgit v0.9.0.2