-rw-r--r-- | core/pim/osearch/applnkitem.cpp | 11 | ||||
-rw-r--r-- | core/pim/osearch/doclnkitem.cpp | 11 |
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 @@ // // // C++ Implementation: $MODULE$ // // Description: // // // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 // // Copyright: See COPYING file that comes with this distribution // // #include "applnkitem.h" #include <qpe/applnk.h> +#include <qfileinfo.h> +#include <qpe/qcopenvelope_qws.h> AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) : ResultItem(parent) { _app = app; setText(0, _app->name() ); } AppLnkItem::~AppLnkItem() { } QString AppLnkItem::toRichText() { QString text; text += "<b><h3>" + _app->name() + "</b></h3><br>"; text += _app->comment() + "<br>"; text += "<br>`" + _app->exec() + "`<br>"; return text; } void AppLnkItem::action( int act ) { if (!_app->isValid()) qDebug("INVALID"); if (act == 0) _app->execute(); + else if (act == 1){ + QFileInfo file( _app->file() ); + qDebug("opening %s in filemanager", file.dirPath().latin1()); + QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); + e << file.dirPath(); +// QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); + // e << _app->file(); + } } QIntDict<QString> AppLnkItem::actions() { QIntDict<QString> result; result.insert( 0, new QString( QObject::tr("execute") ) ); + result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); return result; } 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 @@ // // // C++ Implementation: $MODULE$ // // Description: // // // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 // // Copyright: See COPYING file that comes with this distribution // // #include "doclnkitem.h" #include <qpe/applnk.h> #include <qfile.h> #include <qtextstream.h> +#include <qfileinfo.h> +#include <qpe/qcopenvelope_qws.h> DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) : ResultItem(parent) { _doc = app; setText(0, _doc->name() ); } DocLnkItem::~DocLnkItem() { } QString DocLnkItem::toRichText() { QString text; text += "<b><h3>" + _doc->name() + "</b></h3><br>"; text += _doc->comment() + "<br>"; text += "File: " + _doc->file() + "<br>"; text += "Mimetype: " + _doc->type() + "<br>"; if ( _doc->type().contains( "text" ) ){ text += "<br><br><hr><br>"; QFile f(_doc->file()); if ( f.open(IO_ReadOnly) ) { QTextStream t( &f ); while ( !t.eof() ) text += t.readLine() + "<br>"; } f.close(); } /* text += "<br><br>`"; 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 ) { qDebug("action %i",act); if (!_doc->isValid()) qDebug("INVALID"); if (act == 0) _doc->execute(); + else if (act == 1){ + QFileInfo file( _doc->file() ); + qDebug("opening %s in filemanager", file.dirPath().latin1()); + QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); + e << file.dirPath(); +// QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); + // e << _doc->file(); + } } QIntDict<QString> DocLnkItem::actions() { QIntDict<QString> result; result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); + result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); return result; } |