From b7d34545193f39c146ab56b1127863279a3121ce Mon Sep 17 00:00:00 2001 From: tille Date: Sat, 10 May 2003 17:58:10 +0000 Subject: and doclnk search --- (limited to 'core') diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp new file mode 100644 index 0000000..fd19727 --- a/dev/null +++ b/core/pim/osearch/doclnkitem.cpp @@ -0,0 +1,54 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Patrick S. Vogt , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "doclnkitem.h" + +#include + +DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) + : ResultItem(parent) +{ + _doc = app; + setText(0, _doc->name() ); +} + + +DocLnkItem::~DocLnkItem() +{ +} + + +QString DocLnkItem::toRichText() +{ + QString text; + text += "

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


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

`"; + text += _doc->exec(); + text += "`"; + return text; +} + +void DocLnkItem::editItem() +{ + _doc->execute(); +} + +void DocLnkItem::showItem() +{ +/* QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); + e << _contact->uid();*/ + ResultItem::showItem(); +} + diff --git a/core/pim/osearch/doclnkitem.h b/core/pim/osearch/doclnkitem.h new file mode 100644 index 0000000..2718733 --- a/dev/null +++ b/core/pim/osearch/doclnkitem.h @@ -0,0 +1,37 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Patrick S. Vogt , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef DOCLNKITEM_H +#define DOCLNKITEM_H + +#include "resultitem.h" + +class DocLnk; + +/** +@author Patrick S. Vogt +*/ +class DocLnkItem : public ResultItem +{ +public: + DocLnkItem(OListViewItem* parent, DocLnk *app); + ~DocLnkItem(); + + virtual QString toRichText(); + virtual void editItem(); + virtual void showItem(); + +private: + DocLnk *_doc; +}; + +#endif diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp new file mode 100644 index 0000000..e99a385 --- a/dev/null +++ b/core/pim/osearch/doclnksearch.cpp @@ -0,0 +1,46 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Patrick S. Vogt , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include "doclnksearch.h" + +#include +#include + +#include "doclnkitem.h" + +DocLnkSearch::DocLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) +{ + _docs = 0; +} + + +DocLnkSearch::~DocLnkSearch() +{ + delete _docs; +} + + +void DocLnkSearch::expand() +{ + SearchGroup::expand(); + if (_search.isEmpty()) return; + if (!_docs) _docs = new DocLnkSet(QPEApplication::documentDir()); + QList appList = _docs->children(); + for ( DocLnk *app = appList.first(); app != 0; app = appList.next() ){ +// if (app->name().contains(_search) || app->comment().contains(_search)) + if ( (_search.match( app->name() ) != -1) + || (_search.match(app->comment()) != -1) + || (_search.match(app->exec()) != -1) ) + new DocLnkItem( this, app ); + } +} + diff --git a/core/pim/osearch/doclnksearch.h b/core/pim/osearch/doclnksearch.h new file mode 100644 index 0000000..ec740de --- a/dev/null +++ b/core/pim/osearch/doclnksearch.h @@ -0,0 +1,35 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Patrick S. Vogt , (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef DOCLNKSEARCH_H +#define DOCLNKSEARCH_H + +#include "searchgroup.h" + +class DocLnkSet; + +/** +@author Patrick S. Vogt +*/ +class DocLnkSearch : public SearchGroup +{ +public: + DocLnkSearch(QListView* parent, QString name); + + ~DocLnkSearch(); + + virtual void expand(); +private: + DocLnkSet *_docs; +}; + +#endif diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 41ce5b6..140d7bb 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp @@ -37,6 +37,7 @@ #include "todosearch.h" #include "datebooksearch.h" #include "applnksearch.h" +#include "doclnksearch.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), _currentItem(0) @@ -78,6 +79,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : todoSearch = new TodoSearch( resultsList, tr("todo") ); datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); applnkSearch = new AppLnkSearch( resultsList, tr("applications") ); + doclnkSearch = new DocLnkSearch( resultsList, tr("documents") ); makeMenu(); setCentralWidget( mainFrame ); @@ -157,6 +159,7 @@ void MainWindow::setSearch( const QString &key ) todoSearch->setSearch(key); datebookSearch->setSearch(key); applnkSearch->setSearch(key); + doclnkSearch->setSearch(key); } diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index f79504c..424b4ba 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h @@ -29,6 +29,7 @@ class AdressSearch; class TodoSearch; class DatebookSearch; class AppLnkSearch; +class DocLnkSearch; class MainWindow : public QMainWindow { @@ -63,6 +64,7 @@ private: TodoSearch *todoSearch; DatebookSearch *datebookSearch; AppLnkSearch *applnkSearch; + DocLnkSearch *doclnkSearch; void makeMenu(); }; diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro index 75e90f2..f28b01e 100644 --- a/core/pim/osearch/osearch.pro +++ b/core/pim/osearch/osearch.pro @@ -20,7 +20,9 @@ SOURCES += main.cpp \ contactitem.cpp \ eventitem.cpp \ applnksearch.cpp \ - applnkitem.cpp + applnkitem.cpp \ + doclnkitem.cpp \ + doclnksearch.cpp HEADERS += mainwindow.h \ olistview.h \ olistviewitem.h \ @@ -33,4 +35,6 @@ HEADERS += mainwindow.h \ contactitem.h \ eventitem.h \ applnksearch.h \ - applnkitem.h + applnkitem.h \ + doclnkitem.h \ + doclnksearch.h -- cgit v0.9.0.2