summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/applnkitem.cpp11
-rw-r--r--core/pim/osearch/doclnkitem.cpp11
2 files changed, 22 insertions, 0 deletions
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp
index 2152da4..1e7b1fb 100644
--- a/core/pim/osearch/applnkitem.cpp
+++ b/core/pim/osearch/applnkitem.cpp
@@ -1,50 +1,61 @@
1// 1//
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
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "applnkitem.h" 13#include "applnkitem.h"
14 14
15#include <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qfileinfo.h>
17#include <qpe/qcopenvelope_qws.h>
16 18
17AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) 19AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app)
18 : ResultItem(parent) 20 : ResultItem(parent)
19{ 21{
20 _app = app; 22 _app = app;
21 setText(0, _app->name() ); 23 setText(0, _app->name() );
22} 24}
23 25
24 26
25AppLnkItem::~AppLnkItem() 27AppLnkItem::~AppLnkItem()
26{ 28{
27} 29}
28 30
29 31
30QString AppLnkItem::toRichText() 32QString AppLnkItem::toRichText()
31{ 33{
32 QString text; 34 QString text;
33 text += "<b><h3>" + _app->name() + "</b></h3><br>"; 35 text += "<b><h3>" + _app->name() + "</b></h3><br>";
34 text += _app->comment() + "<br>"; 36 text += _app->comment() + "<br>";
35 text += "<br>`" + _app->exec() + "`<br>"; 37 text += "<br>`" + _app->exec() + "`<br>";
36 return text; 38 return text;
37} 39}
38 40
39void AppLnkItem::action( int act ) 41void AppLnkItem::action( int act )
40{ 42{
41 if (!_app->isValid()) qDebug("INVALID"); 43 if (!_app->isValid()) qDebug("INVALID");
42 if (act == 0) _app->execute(); 44 if (act == 0) _app->execute();
45 else if (act == 1){
46 QFileInfo file( _app->file() );
47 qDebug("opening %s in filemanager", file.dirPath().latin1());
48 QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
49 e << file.dirPath();
50 // QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
51 // e << _app->file();
52 }
43} 53}
44 54
45QIntDict<QString> AppLnkItem::actions() 55QIntDict<QString> AppLnkItem::actions()
46{ 56{
47 QIntDict<QString> result; 57 QIntDict<QString> result;
48 result.insert( 0, new QString( QObject::tr("execute") ) ); 58 result.insert( 0, new QString( QObject::tr("execute") ) );
59 result.insert( 1, new QString( QObject::tr("open in filemanager") ) );
49 return result; 60 return result;
50} 61}
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp
index 75dee58..04d08ca 100644
--- a/core/pim/osearch/doclnkitem.cpp
+++ b/core/pim/osearch/doclnkitem.cpp
@@ -1,70 +1,81 @@
1// 1//
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
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "doclnkitem.h" 13#include "doclnkitem.h"
14 14
15#include <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#include <qfileinfo.h>
19#include <qpe/qcopenvelope_qws.h>
18 20
19DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) 21DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app)
20 : ResultItem(parent) 22 : ResultItem(parent)
21{ 23{
22 _doc = app; 24 _doc = app;
23 setText(0, _doc->name() ); 25 setText(0, _doc->name() );
24} 26}
25 27
26DocLnkItem::~DocLnkItem() 28DocLnkItem::~DocLnkItem()
27{ 29{
28} 30}
29 31
30QString DocLnkItem::toRichText() 32QString DocLnkItem::toRichText()
31{ 33{
32 QString text; 34 QString text;
33 text += "<b><h3>" + _doc->name() + "</b></h3><br>"; 35 text += "<b><h3>" + _doc->name() + "</b></h3><br>";
34 text += _doc->comment() + "<br>"; 36 text += _doc->comment() + "<br>";
35 text += "File: " + _doc->file() + "<br>"; 37 text += "File: " + _doc->file() + "<br>";
36 text += "Mimetype: " + _doc->type() + "<br>"; 38 text += "Mimetype: " + _doc->type() + "<br>";
37 if ( _doc->type().contains( "text" ) ){ 39 if ( _doc->type().contains( "text" ) ){
38 text += "<br><br><hr><br>"; 40 text += "<br><br><hr><br>";
39 QFile f(_doc->file()); 41 QFile f(_doc->file());
40 if ( f.open(IO_ReadOnly) ) { 42 if ( f.open(IO_ReadOnly) ) {
41 QTextStream t( &f ); 43 QTextStream t( &f );
42 while ( !t.eof() ) 44 while ( !t.eof() )
43 text += t.readLine() + "<br>"; 45 text += t.readLine() + "<br>";
44 } 46 }
45 f.close(); 47 f.close();
46 } 48 }
47 /* text += "<br><br>`"; 49 /* text += "<br><br>`";
48 text += _doc->exec(); 50 text += _doc->exec();
49 text += "`";*/ 51 text += "`";*/
50 QStringList list = _doc->mimeTypes(); 52 QStringList list = _doc->mimeTypes();
51 int i = 0; 53 int i = 0;
52 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 54 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
53 text += QString::number( i++) + " - " + *it ; 55 text += QString::number( i++) + " - " + *it ;
54 } 56 }
55 return text; 57 return text;
56} 58}
57 59
58void DocLnkItem::action( int act ) 60void DocLnkItem::action( int act )
59{ 61{
60 qDebug("action %i",act); 62 qDebug("action %i",act);
61 if (!_doc->isValid()) qDebug("INVALID"); 63 if (!_doc->isValid()) qDebug("INVALID");
62 if (act == 0) _doc->execute(); 64 if (act == 0) _doc->execute();
65 else if (act == 1){
66 QFileInfo file( _doc->file() );
67 qDebug("opening %s in filemanager", file.dirPath().latin1());
68 QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
69 e << file.dirPath();
70 // QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
71 // e << _doc->file();
72 }
63} 73}
64 74
65QIntDict<QString> DocLnkItem::actions() 75QIntDict<QString> DocLnkItem::actions()
66{ 76{
67 QIntDict<QString> result; 77 QIntDict<QString> result;
68 result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); 78 result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) );
79 result.insert( 1, new QString( QObject::tr("open in filemanager") ) );
69 return result; 80 return result;
70} 81}