summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/applnkitem.cpp54
-rw-r--r--core/pim/osearch/applnkitem.h37
-rw-r--r--core/pim/osearch/applnksearch.cpp46
-rw-r--r--core/pim/osearch/applnksearch.h35
-rw-r--r--core/pim/osearch/mainwindow.cpp4
-rw-r--r--core/pim/osearch/mainwindow.h2
-rw-r--r--core/pim/osearch/osearch.pro8
7 files changed, 183 insertions, 3 deletions
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp
new file mode 100644
index 0000000..f45ed68
--- a/dev/null
+++ b/core/pim/osearch/applnkitem.cpp
@@ -0,0 +1,54 @@
1//
2//
3// C++ Implementation: $MODULE$
4//
5// Description:
6//
7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9//
10// Copyright: See COPYING file that comes with this distribution
11//
12//
13#include "applnkitem.h"
14
15#include <qpe/applnk.h>
16
17AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app)
18 : ResultItem(parent)
19{
20 _app = app;
21 setText(0, _app->name() );
22}
23
24
25AppLnkItem::~AppLnkItem()
26{
27}
28
29
30QString AppLnkItem::toRichText()
31{
32 QString text;
33 text += "<b><h3>";
34 text += _app->name();
35 text += "</b></h3><br>";
36 text += _app->comment();
37 text += "<br><br>`";
38 text += _app->exec();
39 text += "`";
40 return text;
41}
42
43void AppLnkItem::editItem()
44{
45 _app->execute();
46}
47
48void AppLnkItem::showItem()
49{
50 /* QCopEnvelope e("QPE/Application/addressbook", "edit(int)");
51 e << _contact->uid();*/
52 ResultItem::showItem();
53}
54
diff --git a/core/pim/osearch/applnkitem.h b/core/pim/osearch/applnkitem.h
new file mode 100644
index 0000000..b28631a
--- a/dev/null
+++ b/core/pim/osearch/applnkitem.h
@@ -0,0 +1,37 @@
1//
2//
3// C++ Interface: $MODULE$
4//
5// Description:
6//
7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9//
10// Copyright: See COPYING file that comes with this distribution
11//
12//
13#ifndef APPLNKITEM_H
14#define APPLNKITEM_H
15
16#include "resultitem.h"
17
18class AppLnk;
19
20/**
21@author Patrick S. Vogt
22*/
23class AppLnkItem : public ResultItem
24{
25public:
26 AppLnkItem(OListViewItem* parent, AppLnk *app);
27 ~AppLnkItem();
28
29 virtual QString toRichText();
30 virtual void editItem();
31 virtual void showItem();
32
33private:
34 AppLnk *_app;
35};
36
37#endif
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
new file mode 100644
index 0000000..7872ae3
--- a/dev/null
+++ b/core/pim/osearch/applnksearch.cpp
@@ -0,0 +1,46 @@
1//
2//
3// C++ Implementation: $MODULE$
4//
5// Description:
6//
7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9//
10// Copyright: See COPYING file that comes with this distribution
11//
12//
13#include "applnksearch.h"
14
15#include <qpe/applnk.h>
16#include <qpe/qpeapplication.h>
17
18#include "applnkitem.h"
19
20AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
21{
22 _apps = 0;
23}
24
25
26AppLnkSearch::~AppLnkSearch()
27{
28 delete _apps;
29}
30
31
32void AppLnkSearch::expand()
33{
34 SearchGroup::expand();
35 if (_search.isEmpty()) return;
36 if (!_apps) _apps = new AppLnkSet(QPEApplication::qpeDir());
37 QList<AppLnk> appList = _apps->children();
38 for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
39 // if (app->name().contains(_search) || app->comment().contains(_search))
40 if ( (_search.match( app->name() ) != -1)
41 || (_search.match(app->comment()) != -1)
42 || (_search.match(app->exec()) != -1) )
43 new AppLnkItem( this, app );
44 }
45}
46
diff --git a/core/pim/osearch/applnksearch.h b/core/pim/osearch/applnksearch.h
new file mode 100644
index 0000000..e283cd3
--- a/dev/null
+++ b/core/pim/osearch/applnksearch.h
@@ -0,0 +1,35 @@
1//
2//
3// C++ Interface: $MODULE$
4//
5// Description:
6//
7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9//
10// Copyright: See COPYING file that comes with this distribution
11//
12//
13#ifndef APPLNKSEARCH_H
14#define APPLNKSEARCH_H
15
16#include "searchgroup.h"
17
18class AppLnkSet;
19
20/**
21@author Patrick S. Vogt
22*/
23class AppLnkSearch : public SearchGroup
24{
25public:
26 AppLnkSearch(QListView* parent, QString name);
27
28 ~AppLnkSearch();
29
30 virtual void expand();
31private:
32 AppLnkSet *_apps;
33};
34
35#endif
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 3dba3a9..41ce5b6 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -27,25 +27,25 @@
27#include <qfile.h> 27#include <qfile.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qtextbrowser.h> 31#include <qtextbrowser.h>
32 32
33#include "olistview.h" 33#include "olistview.h"
34#include "olistviewitem.h" 34#include "olistviewitem.h"
35#include "resultitem.h" 35#include "resultitem.h"
36#include "adresssearch.h" 36#include "adresssearch.h"
37#include "todosearch.h" 37#include "todosearch.h"
38#include "datebooksearch.h" 38#include "datebooksearch.h"
39 39#include "applnksearch.h"
40 40
41MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 41MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
42 QMainWindow( parent, name, f ), _currentItem(0) 42 QMainWindow( parent, name, f ), _currentItem(0)
43{ 43{
44 setCaption( tr("OSearch") ); 44 setCaption( tr("OSearch") );
45 45
46 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 46 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
47 47
48 QFrame *mainFrame = new QFrame( this, "mainFrame" ); 48 QFrame *mainFrame = new QFrame( this, "mainFrame" );
49 49
50 mainLayout = new QVBoxLayout( mainFrame ); 50 mainLayout = new QVBoxLayout( mainFrame );
51 mainLayout->setSpacing( 0 ); 51 mainLayout->setSpacing( 0 );
@@ -68,24 +68,25 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
68 QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" ); 68 QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" );
69 buttonEdit->setText( tr("edit") ); 69 buttonEdit->setText( tr("edit") );
70 // buttonEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 70 // buttonEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
71 buttonLayout->addWidget( buttonShow, 0 ); 71 buttonLayout->addWidget( buttonShow, 0 );
72 buttonLayout->addWidget( buttonEdit, 0 ); 72 buttonLayout->addWidget( buttonEdit, 0 );
73 73
74 mainLayout->addWidget( detailsFrame, 0 ); 74 mainLayout->addWidget( detailsFrame, 0 );
75 detailsFrame->hide(); 75 detailsFrame->hide();
76 76
77 adrSearch = new AdressSearch( resultsList, tr("adressbook") ); 77 adrSearch = new AdressSearch( resultsList, tr("adressbook") );
78 todoSearch = new TodoSearch( resultsList, tr("todo") ); 78 todoSearch = new TodoSearch( resultsList, tr("todo") );
79 datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); 79 datebookSearch = new DatebookSearch( resultsList, tr("datebook") );
80 applnkSearch = new AppLnkSearch( resultsList, tr("applications") );
80 81
81 makeMenu(); 82 makeMenu();
82 setCentralWidget( mainFrame ); 83 setCentralWidget( mainFrame );
83 84
84 popupTimer = new QTimer(); 85 popupTimer = new QTimer();
85 86
86 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 87 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
87 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 88 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
88 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 89 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
89 connect(buttonShow, SIGNAL(clicked()), SLOT( showItem() ) ); 90 connect(buttonShow, SIGNAL(clicked()), SLOT( showItem() ) );
90 connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) ); 91 connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) );
91 92
@@ -146,24 +147,25 @@ void MainWindow::stopTimer(QListViewItem*)
146 147
147void MainWindow::showPopup() 148void MainWindow::showPopup()
148{ 149{
149 qDebug("showPopup"); 150 qDebug("showPopup");
150 if (!_item) return; 151 if (!_item) return;
151} 152}
152 153
153void MainWindow::setSearch( const QString &key ) 154void MainWindow::setSearch( const QString &key )
154{ 155{
155 adrSearch->setSearch(key); 156 adrSearch->setSearch(key);
156 todoSearch->setSearch(key); 157 todoSearch->setSearch(key);
157 datebookSearch->setSearch(key); 158 datebookSearch->setSearch(key);
159 applnkSearch->setSearch(key);
158} 160}
159 161
160 162
161void MainWindow::showItem() 163void MainWindow::showItem()
162{ 164{
163 if (_currentItem->rtti() == OListViewItem::Result){ 165 if (_currentItem->rtti() == OListViewItem::Result){
164 ResultItem *res = (ResultItem*)_currentItem; 166 ResultItem *res = (ResultItem*)_currentItem;
165 // ResultItem *res = dynamic_cast<ResultItem*>(item); 167 // ResultItem *res = dynamic_cast<ResultItem*>(item);
166 res->showItem(); 168 res->showItem();
167 } 169 }
168} 170}
169 171
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index f7e8f8e..f79504c 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -19,24 +19,25 @@
19#include <qpopupmenu.h> 19#include <qpopupmenu.h>
20 20
21class QPEToolBar; 21class QPEToolBar;
22class QVBoxLayout; 22class QVBoxLayout;
23class QTextView; 23class QTextView;
24class QFrame; 24class QFrame;
25class QListViewItem; 25class QListViewItem;
26class OListView; 26class OListView;
27class OListViewItem; 27class OListViewItem;
28class AdressSearch; 28class AdressSearch;
29class TodoSearch; 29class TodoSearch;
30class DatebookSearch; 30class DatebookSearch;
31class AppLnkSearch;
31 32
32class MainWindow : public QMainWindow 33class MainWindow : public QMainWindow
33{ 34{
34 Q_OBJECT 35 Q_OBJECT
35 36
36 37
37public: 38public:
38 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 39 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
39 ~MainWindow(); 40 ~MainWindow();
40 41
41 42
42public slots: 43public slots:
@@ -52,18 +53,19 @@ protected slots:
52private: 53private:
53 OListView *resultsList; 54 OListView *resultsList;
54 QTextView *richEdit; 55 QTextView *richEdit;
55 OListViewItem *_currentItem; 56 OListViewItem *_currentItem;
56 QVBoxLayout *mainLayout; 57 QVBoxLayout *mainLayout;
57 QFrame *detailsFrame; 58 QFrame *detailsFrame;
58 OListViewItem *_item; 59 OListViewItem *_item;
59 QTimer *popupTimer; 60 QTimer *popupTimer;
60 61
61 AdressSearch *adrSearch; 62 AdressSearch *adrSearch;
62 TodoSearch *todoSearch; 63 TodoSearch *todoSearch;
63 DatebookSearch *datebookSearch; 64 DatebookSearch *datebookSearch;
65 AppLnkSearch *applnkSearch;
64 66
65 void makeMenu(); 67 void makeMenu();
66}; 68};
67 69
68#endif 70#endif
69 71
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro
index 397bc83..75e90f2 100644
--- a/core/pim/osearch/osearch.pro
+++ b/core/pim/osearch/osearch.pro
@@ -9,24 +9,28 @@ TARGET = osearch
9INCLUDEPATH = $(OPIEDIR)/include 9INCLUDEPATH = $(OPIEDIR)/include
10SOURCES += main.cpp \ 10SOURCES += main.cpp \
11 mainwindow.cpp \ 11 mainwindow.cpp \
12 olistview.cpp \ 12 olistview.cpp \
13 olistviewitem.cpp \ 13 olistviewitem.cpp \
14 adresssearch.cpp \ 14 adresssearch.cpp \
15 todosearch.cpp \ 15 todosearch.cpp \
16 datebooksearch.cpp \ 16 datebooksearch.cpp \
17 searchgroup.cpp \ 17 searchgroup.cpp \
18 resultitem.cpp \ 18 resultitem.cpp \
19 todoitem.cpp \ 19 todoitem.cpp \
20 contactitem.cpp \ 20 contactitem.cpp \
21 eventitem.cpp 21 eventitem.cpp \
22 applnksearch.cpp \
23 applnkitem.cpp
22HEADERS += mainwindow.h \ 24HEADERS += mainwindow.h \
23 olistview.h \ 25 olistview.h \
24 olistviewitem.h \ 26 olistviewitem.h \
25 adresssearch.h \ 27 adresssearch.h \
26 todosearch.h \ 28 todosearch.h \
27 datebooksearch.h \ 29 datebooksearch.h \
28 searchgroup.h \ 30 searchgroup.h \
29 resultitem.h \ 31 resultitem.h \
30 todoitem.h \ 32 todoitem.h \
31 contactitem.h \ 33 contactitem.h \
32 eventitem.h 34 eventitem.h \
35 applnksearch.h \
36 applnkitem.h