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