summaryrefslogtreecommitdiff
authortille <tille>2003-05-13 13:46:19 (UTC)
committer tille <tille>2003-05-13 13:46:19 (UTC)
commitba4bb8e673fba43ae7a232942dea14d166991530 (patch) (unidiff)
treee775ad637d5256eb1412e576c1bd5e77ed50406d
parent1461a41433a732e3a615508e5de23f8acd91de6a (diff)
downloadopie-ba4bb8e673fba43ae7a232942dea14d166991530.zip
opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.gz
opie-ba4bb8e673fba43ae7a232942dea14d166991530.tar.bz2
icons ;)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp10
-rw-r--r--core/pim/osearch/applnkitem.cpp1
-rw-r--r--core/pim/osearch/applnksearch.cpp7
-rw-r--r--core/pim/osearch/datebooksearch.cpp5
-rw-r--r--core/pim/osearch/doclnkitem.cpp1
-rw-r--r--core/pim/osearch/doclnksearch.cpp6
-rw-r--r--core/pim/osearch/mainwindow.cpp22
-rw-r--r--core/pim/osearch/mainwindow.h10
-rw-r--r--core/pim/osearch/searchgroup.cpp31
-rw-r--r--core/pim/osearch/searchgroup.h9
-rw-r--r--core/pim/osearch/todosearch.cpp7
11 files changed, 86 insertions, 23 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index 69ad9ef..252fb40 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -13,16 +13,24 @@
13#include "adresssearch.h" 13#include "adresssearch.h"
14 14
15#include <opie/ocontactaccess.h> 15#include <opie/ocontactaccess.h>
16#include <qstring.h> 16#include <qstring.h>
17#include <qiconset.h>
18#include <qpe/resource.h>
17 19
18#include "contactitem.h" 20#include "contactitem.h"
19//#include <qdir.h>
20 21
21AdressSearch::AdressSearch(QListView* parent, QString name): 22AdressSearch::AdressSearch(QListView* parent, QString name):
22 SearchGroup(parent, name) 23 SearchGroup(parent, name)
23{ 24{
24 _contacts = 0; 25 _contacts = 0;
26 QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" );
27 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
28 /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" );
29 QImage img = pix.convertToImage();
30 img.smoothScale( 14, 14 );
31 pix.convertFromImage( img );
32 setPixmap( 0, pix );*/
25} 33}
26 34
27 35
28AdressSearch::~AdressSearch() 36AdressSearch::~AdressSearch()
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp
index 0d04be6..2c4a4cb 100644
--- a/core/pim/osearch/applnkitem.cpp
+++ b/core/pim/osearch/applnkitem.cpp
@@ -20,8 +20,9 @@ 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 setPixmap(0, _app->pixmap() );
24} 25}
25 26
26 27
27AppLnkItem::~AppLnkItem() 28AppLnkItem::~AppLnkItem()
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp
index acf650a..d5b181b 100644
--- a/core/pim/osearch/applnksearch.cpp
+++ b/core/pim/osearch/applnksearch.cpp
@@ -13,14 +13,19 @@
13#include "applnksearch.h" 13#include "applnksearch.h"
14 14
15#include <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17#include <qiconset.h>
18#include <qpe/resource.h>
17 19
18#include "applnkitem.h" 20#include "applnkitem.h"
19 21
20AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) 22AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
21{ 23{
22 _apps = 0; 24 _apps = 0;
25 QIconSet is = Resource::loadIconSet( "osearch/applications" );
26 //QIconSet is = Resource::loadIconSet( "AppsIcon" );
27 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
23} 28}
24 29
25 30
26AppLnkSearch::~AppLnkSearch() 31AppLnkSearch::~AppLnkSearch()
@@ -44,8 +49,9 @@ int AppLnkSearch::search()
44 || (_search.match(app->exec()) != -1) ) { 49 || (_search.match(app->exec()) != -1) ) {
45 count++; 50 count++;
46 insertItem( app ); 51 insertItem( app );
47 } 52 }
53 qApp->processEvents( 100 );
48 } 54 }
49 return count; 55 return count;
50} 56}
51 57
@@ -55,9 +61,8 @@ void AppLnkSearch::insertItem( void *rec )
55} 61}
56 62
57void AppLnkSearch::setSearch(QRegExp re) 63void AppLnkSearch::setSearch(QRegExp re)
58{ 64{
59 expanded = false;
60 setOpen( false ); 65 setOpen( false );
61 SearchGroup::setSearch( re ); 66 SearchGroup::setSearch( re );
62} 67}
63 68
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index 68699fa..7aabcea 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -15,13 +15,18 @@
15#include "eventitem.h" 15#include "eventitem.h"
16 16
17#include <opie/oevent.h> 17#include <opie/oevent.h>
18#include <opie/odatebookaccess.h> 18#include <opie/odatebookaccess.h>
19#include <qiconset.h>
20#include <qpe/resource.h>
19 21
20DatebookSearch::DatebookSearch(QListView* parent, QString name) 22DatebookSearch::DatebookSearch(QListView* parent, QString name)
21: SearchGroup(parent, name) 23: SearchGroup(parent, name)
22{ 24{
23 _dates = 0; 25 _dates = 0;
26 QIconSet is = Resource::loadIconSet( "datebook/DateBook" );
27 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
28
24} 29}
25 30
26 31
27DatebookSearch::~DatebookSearch() 32DatebookSearch::~DatebookSearch()
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp
index 95402b9..a1d0384 100644
--- a/core/pim/osearch/doclnkitem.cpp
+++ b/core/pim/osearch/doclnkitem.cpp
@@ -22,8 +22,9 @@ 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 setPixmap(0, _doc->pixmap() );
26} 27}
27 28
28DocLnkItem::~DocLnkItem() 29DocLnkItem::~DocLnkItem()
29{ 30{
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp
index f2a60e9..123eaa0 100644
--- a/core/pim/osearch/doclnksearch.cpp
+++ b/core/pim/osearch/doclnksearch.cpp
@@ -1,9 +1,9 @@
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//
@@ -13,14 +13,18 @@
13#include "doclnksearch.h" 13#include "doclnksearch.h"
14 14
15#include <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qpe/qpeapplication.h> 16#include <qpe/qpeapplication.h>
17#include <qiconset.h>
18#include <qpe/resource.h>
17 19
18#include "doclnkitem.h" 20#include "doclnkitem.h"
19 21
20DocLnkSearch::DocLnkSearch(QListView* parent, QString name) 22DocLnkSearch::DocLnkSearch(QListView* parent, QString name)
21: AppLnkSearch(parent, name) 23: AppLnkSearch(parent, name)
22{ 24{
25 QIconSet is = Resource::loadIconSet( "osearch/documents" );
26 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
23} 27}
24 28
25 29
26DocLnkSearch::~DocLnkSearch() 30DocLnkSearch::~DocLnkSearch()
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index e15cc7e..33a24bc 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -86,10 +86,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
86 makeMenu(); 86 makeMenu();
87 setCentralWidget( mainFrame ); 87 setCentralWidget( mainFrame );
88 88
89 popupTimer = new QTimer(); 89 popupTimer = new QTimer();
90 searchTimer = new QTimer();
90 91
91 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 92 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
93 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
92 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 94 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
93 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 95 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
94 connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); 96 connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) );
95 97
@@ -110,11 +112,12 @@ void MainWindow::makeMenu()
110// menuBar->insertItem( tr( "View" ), viewMenu ); 112// menuBar->insertItem( tr( "View" ), viewMenu );
111// menuBar->insertItem( tr( "Settings" ), cfgMenu ); 113// menuBar->insertItem( tr( "Settings" ), cfgMenu );
112 114
113 //SEARCH 115 //SEARCH
114 QAction *action = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 116 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
115 connect( action, SIGNAL(activated()), this, SLOT(searchAll()) ); 117 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
116 action->addTo( searchMenu ); 118 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
119 SearchAllAction->addTo( searchMenu );
117 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); 120 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
118 actionCaseSensitiv->addTo( searchMenu ); 121 actionCaseSensitiv->addTo( searchMenu );
119 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); 122 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
120 actionWildcards->addTo( searchMenu ); 123 actionWildcards->addTo( searchMenu );
@@ -122,8 +125,9 @@ void MainWindow::makeMenu()
122 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 125 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
123 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 126 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
124 searchBar->setHorizontalStretchable( TRUE ); 127 searchBar->setHorizontalStretchable( TRUE );
125 searchBar->setStretchableWidget( searchEdit ); 128 searchBar->setStretchableWidget( searchEdit );
129 SearchAllAction->addTo( searchBar );
126 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 130 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
127 this, SLOT( setSearch( const QString & ) ) ); 131 this, SLOT( setSearch( const QString & ) ) );
128 132
129} 133}
@@ -183,18 +187,26 @@ void MainWindow::showPopup()
183} 187}
184 188
185void MainWindow::setSearch( const QString &key ) 189void MainWindow::setSearch( const QString &key )
186{ 190{
187 QRegExp re( key, actionCaseSensitiv->isOn(), actionWildcards->isOn() ); 191 searchTimer->stop();
192 _searchString = key;
193 searchTimer->start( 300 );
194}
195
196void MainWindow::searchStringChanged()
197{
198 searchTimer->stop();
199 QRegExp re( _searchString, actionCaseSensitiv->isOn(), actionWildcards->isOn() );
188 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) 200 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
189 s->setSearch( re ); 201 s->setSearch( re );
190} 202}
191 203
192void MainWindow::searchAll() 204void MainWindow::searchAll()
193{ 205{
194 bool openState;
195 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 206 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
196 s->doSearch(); 207 s->doSearch();
208 //resultsList->repaint();
197 } 209 }
198} 210}
199 211
200void MainWindow::slotAction( int act) 212void MainWindow::slotAction( int act)
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index 2773205..939762e 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -42,27 +42,31 @@ public:
42 42
43 43
44public slots: 44public slots:
45 void setCurrent(QListViewItem*); 45 void setCurrent(QListViewItem*);
46 void showPopup();
47 void stopTimer( QListViewItem* );
48 void setSearch( const QString& ); 46 void setSearch( const QString& );
49 void searchAll(); 47 void searchAll();
50 48
51protected slots: 49protected slots:
52 void slotAction(int); 50 void slotAction(int);
53 51 void showPopup();
52 void stopTimer( QListViewItem* );
53 void searchStringChanged();
54
54private: 55private:
55 OListView *resultsList; 56 OListView *resultsList;
56 QTextView *richEdit; 57 QTextView *richEdit;
57 OListViewItem *_currentItem; 58 OListViewItem *_currentItem;
58 QVBoxLayout *mainLayout; 59 QVBoxLayout *mainLayout;
59 QHBoxLayout *buttonLayout; 60 QHBoxLayout *buttonLayout;
60 QFrame *detailsFrame; 61 QFrame *detailsFrame;
61 QTimer *popupTimer; 62 QTimer *popupTimer;
63 QTimer *searchTimer;
62 64
65 QString _searchString;
63 QList<SearchGroup> searches; 66 QList<SearchGroup> searches;
64 QHButtonGroup *buttonGroupActions; 67 QHButtonGroup *buttonGroupActions;
68 QAction *SearchAllAction;
65 QAction *actionCaseSensitiv; 69 QAction *actionCaseSensitiv;
66 QAction *actionWildcards; 70 QAction *actionWildcards;
67 uint _buttonCount; 71 uint _buttonCount;
68 void makeMenu(); 72 void makeMenu();
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
index 3159984..490deea 100644
--- a/core/pim/osearch/searchgroup.cpp
+++ b/core/pim/osearch/searchgroup.cpp
@@ -12,17 +12,18 @@
12// 12//
13#include "searchgroup.h" 13#include "searchgroup.h"
14 14
15#include <qregexp.h> 15#include <qregexp.h>
16// #include <qapplication.h>
17// #include <opie/owait.h>
16 18
17#include "olistviewitem.h" 19#include "olistviewitem.h"
18 20
19SearchGroup::SearchGroup(QListView* parent, QString name) 21SearchGroup::SearchGroup(QListView* parent, QString name)
20: OListViewItem(parent, name) 22: OListViewItem(parent, name)
21{ 23{
22 _name = name; 24 _name = name;
23 loaded = false; 25 loaded = false;
24 expanded = false;
25} 26}
26 27
27 28
28SearchGroup::~SearchGroup() 29SearchGroup::~SearchGroup()
@@ -31,44 +32,56 @@ SearchGroup::~SearchGroup()
31 32
32 33
33void SearchGroup::expand() 34void SearchGroup::expand()
34{ 35{
36 //expanded = true;
35 clearList(); 37 clearList();
36 if (_search.isEmpty()) return; 38 if (_search.isEmpty()) return;
37 OListViewItem *dummy = new OListViewItem( this, "searching..."); 39 OListViewItem *dummy = new OListViewItem( this, "searching...");
38 setOpen( expanded ); 40 setOpen( true );
39 if (!loaded) load(); 41 repaint();
40 int res_count = search(); 42 int res_count = realSearch();
41 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); 43 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
42 delete dummy; 44 delete dummy;
45 repaint();
43} 46}
44 47
45void SearchGroup::doSearch() 48void SearchGroup::doSearch()
46{ 49{
47 clearList(); 50 clearList();
48 if (_search.isEmpty()) return; 51 if (_search.isEmpty()) return;
49 if (!loaded) load(); 52 int res_count = realSearch();
50 int res_count = search();
51 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); 53 setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
54 //repaint();
52} 55}
53 56
54void SearchGroup::clearList() 57void SearchGroup::clearList()
55{ 58{
56 QListViewItem *item = firstChild(); 59 QListViewItem *item = firstChild();
57 QListViewItem *toDel; 60 QListViewItem *toDel;
58
59 while ( item != 0 ) { 61 while ( item != 0 ) {
60 toDel = item; 62 toDel = item;
61 item = item->nextSibling(); 63 item = item->nextSibling();
62 delete toDel; 64 delete toDel;
63 } 65 }
64 expanded = true;
65} 66}
66 67
67void SearchGroup::setSearch(QRegExp re) 68void SearchGroup::setSearch(QRegExp re)
68{ 69{
69 setText(0, _name+" - "+re.pattern() ); 70 setText(0, _name+" - "+re.pattern() );
70 _search = re; 71 _search = re;
71 if (expanded) expand(); 72 if (isOpen()) expand();
72 else new OListViewItem( this, "searching..."); 73 else new OListViewItem( this, "searching...");
73} 74}
74 75
76int SearchGroup::realSearch()
77{
78 //emit isSearching( tr(" Searching for %s in %s" ).arg( _search.pattern().latin1()).arg( _name ) );
79 /*OWait *wait = new OWait( qApp->mainWidget(), "test" );
80 wait->show();*/
81 if (!loaded) load();
82 int count = search();
83 /*wait->hide();
84 delete wait;*/
85 return count;
86}
87
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h
index bf5dc67..32f32e0 100644
--- a/core/pim/osearch/searchgroup.h
+++ b/core/pim/osearch/searchgroup.h
@@ -19,10 +19,11 @@ class QRegExp;
19 19
20/** 20/**
21@author Patrick S. Vogt 21@author Patrick S. Vogt
22*/ 22*/
23class SearchGroup : public OListViewItem 23class SearchGroup : public OListViewItem //, QObject
24{ 24{
25//Q_OBJECT
25public: 26public:
26 SearchGroup(QListView* parent, QString name); 27 SearchGroup(QListView* parent, QString name);
27 28
28 ~SearchGroup(); 29 ~SearchGroup();
@@ -31,16 +32,20 @@ public:
31 virtual void doSearch(); 32 virtual void doSearch();
32 virtual void setSearch(QRegExp); 33 virtual void setSearch(QRegExp);
33 virtual int rtti() { return Searchgroup;} 34 virtual int rtti() { return Searchgroup;}
34 35
36// signals:
37 // isSearching(QString);
38
35protected: 39protected:
36 QRegExp _search; 40 QRegExp _search;
37 virtual void load() = 0; 41 virtual void load() = 0;
38 virtual int search() = 0; 42 virtual int search() = 0;
39 virtual void insertItem( void* ) = 0; 43 virtual void insertItem( void* ) = 0;
40 void clearList(); 44 void clearList();
41 QString _name; 45 QString _name;
42 bool expanded;
43 bool loaded; 46 bool loaded;
47private:
48 int realSearch();
44}; 49};
45 50
46#endif 51#endif
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp
index 6a73530..c9fa61a 100644
--- a/core/pim/osearch/todosearch.cpp
+++ b/core/pim/osearch/todosearch.cpp
@@ -13,15 +13,20 @@
13#include "todosearch.h" 13#include "todosearch.h"
14 14
15#include <opie/otodoaccess.h> 15#include <opie/otodoaccess.h>
16#include <opie/otodo.h> 16#include <opie/otodo.h>
17 17#include <qiconset.h>
18#include <qpe/resource.h>
18#include "todoitem.h" 19#include "todoitem.h"
19 20
20TodoSearch::TodoSearch(QListView* parent, QString name) 21TodoSearch::TodoSearch(QListView* parent, QString name)
21: SearchGroup(parent, name) 22: SearchGroup(parent, name)
22{ 23{
23 _todos = 0; 24 _todos = 0;
25 //AppLnkSet als(QPEApplication::qpeDir());
26 //setPixmap( 0, als.findExec("todolist")->pixmap() );
27 QIconSet is = Resource::loadIconSet( "todo/TodoList" );
28 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
24} 29}
25 30
26 31
27TodoSearch::~TodoSearch() 32TodoSearch::~TodoSearch()