summaryrefslogtreecommitdiff
path: root/core/pim/osearch/doclnkitem.cpp
Unidiff
Diffstat (limited to 'core/pim/osearch/doclnkitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/doclnkitem.cpp48
1 files changed, 32 insertions, 16 deletions
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 @@
2// 2//
3// C++ Implementation: $MODULE$ 3// C++ Implementation: $MODULE$
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
@@ -13,6 +13,8 @@
13#include "doclnkitem.h" 13#include "doclnkitem.h"
14 14
15#include <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qfile.h>
17#include <qtextstream.h>
16 18
17DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) 19DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app)
18 : ResultItem(parent) 20 : ResultItem(parent)
@@ -21,34 +23,48 @@ DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app)
21 setText(0, _doc->name() ); 23 setText(0, _doc->name() );
22} 24}
23 25
24
25DocLnkItem::~DocLnkItem() 26DocLnkItem::~DocLnkItem()
26{ 27{
27} 28}
28 29
29
30QString DocLnkItem::toRichText() 30QString DocLnkItem::toRichText()
31{ 31{
32 QString text; 32 QString text;
33 text += "<b><h3>"; 33 text += "<b><h3>" + _doc->name() + "</b></h3><br>";
34 text += _doc->name(); 34 text += _doc->comment() + "<br>";
35 text += "</b></h3><br>"; 35 text += "File: " + _doc->file() + "<br>";
36 text += _doc->comment(); 36 text += "Mimetype: " + _doc->type() + "<br>";
37 text += "<br><br>`"; 37 if ( _doc->type().contains( "text" ) ){
38 text += "<br><br><hr><br>";
39 QFile f(_doc->file());
40 if ( f.open(IO_ReadOnly) ) {
41 QTextStream t( &f );
42 while ( !t.eof() )
43 text += t.readLine() + "<br>";
44 }
45 f.close();
46 }
47 /* text += "<br><br>`";
38 text += _doc->exec(); 48 text += _doc->exec();
39 text += "`"; 49 text += "`";*/
50 QStringList list = _doc->mimeTypes();
51 int i = 0;
52 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
53 text += QString::number( i++) + " - " + *it ;
54 }
40 return text; 55 return text;
41} 56}
42 57
43void DocLnkItem::editItem() 58void DocLnkItem::action( int act )
44{ 59{
45 _doc->execute(); 60 qDebug("action %i",act);
61 if (!_doc->isValid()) qDebug("INVALID");
62 if (act == 0) _doc->execute();
46} 63}
47 64
48void DocLnkItem::showItem() 65QIntDict<QString> DocLnkItem::actions()
49{ 66{
50 /* QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); 67 QIntDict<QString> result;
51 e << _contact->uid();*/ 68 result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) );
52 ResultItem::showItem(); 69 return result;
53} 70}
54