author | drw <drw> | 2004-04-02 21:24:41 (UTC) |
---|---|---|
committer | drw <drw> | 2004-04-02 21:24:41 (UTC) |
commit | ebe03c3cd5d2bc1e1ae94f123da7ab27b2188f6a (patch) (unidiff) | |
tree | 2b642af98abf3825cca6aef0f2adfb0934634e76 | |
parent | 8b67cce78d89fdbb5c2a70f257aaef0e8162d767 (diff) | |
download | opie-ebe03c3cd5d2bc1e1ae94f123da7ab27b2188f6a.zip opie-ebe03c3cd5d2bc1e1ae94f123da7ab27b2188f6a.tar.gz opie-ebe03c3cd5d2bc1e1ae94f123da7ab27b2188f6a.tar.bz2 |
Use ODebug (another 7 down...)
-rw-r--r-- | core/pim/osearch/applnkitem.cpp | 5 | ||||
-rw-r--r-- | core/pim/osearch/config.in | 2 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 4 | ||||
-rw-r--r-- | core/pim/osearch/doclnkitem.cpp | 6 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 5 | ||||
-rw-r--r-- | core/pim/osearch/opie-osearch.control | 2 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.cpp | 3 |
7 files changed, 16 insertions, 11 deletions
diff --git a/core/pim/osearch/applnkitem.cpp b/core/pim/osearch/applnkitem.cpp index 19e765e..ca54eef 100644 --- a/core/pim/osearch/applnkitem.cpp +++ b/core/pim/osearch/applnkitem.cpp | |||
@@ -1,60 +1,61 @@ | |||
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 <opie2/odebug.h> | ||
16 | |||
15 | #include <qpe/applnk.h> | 17 | #include <qpe/applnk.h> |
16 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
17 | 19 | ||
18 | |||
19 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) | 20 | AppLnkItem::AppLnkItem(OListViewItem* parent, AppLnk *app) |
20 | : ResultItem(parent) | 21 | : ResultItem(parent) |
21 | { | 22 | { |
22 | _app = app; | 23 | _app = app; |
23 | setText(0, _app->name() ); | 24 | setText(0, _app->name() ); |
24 | setPixmap(0, _app->pixmap() ); | 25 | setPixmap(0, _app->pixmap() ); |
25 | } | 26 | } |
26 | 27 | ||
27 | 28 | ||
28 | AppLnkItem::~AppLnkItem() | 29 | AppLnkItem::~AppLnkItem() |
29 | { | 30 | { |
30 | } | 31 | } |
31 | 32 | ||
32 | 33 | ||
33 | QString AppLnkItem::toRichText() | 34 | QString AppLnkItem::toRichText() |
34 | { | 35 | { |
35 | QString text; | 36 | QString text; |
36 | text += "<b><h3>" + _app->name() + "</b></h3><br>"; | 37 | text += "<b><h3>" + _app->name() + "</b></h3><br>"; |
37 | text += _app->comment() + "<br>"; | 38 | text += _app->comment() + "<br>"; |
38 | text += "<br>`" + _app->exec() + "`<br>"; | 39 | text += "<br>`" + _app->exec() + "`<br>"; |
39 | text += "<br>`" + _app->file() + "`<br>"; | 40 | text += "<br>`" + _app->file() + "`<br>"; |
40 | text += "<br>`" + _app->linkFile() + "`<br>"; | 41 | text += "<br>`" + _app->linkFile() + "`<br>"; |
41 | return text; | 42 | return text; |
42 | } | 43 | } |
43 | 44 | ||
44 | void AppLnkItem::action( int act ) | 45 | void AppLnkItem::action( int act ) |
45 | { | 46 | { |
46 | if (!_app->isValid()) qDebug("INVALID"); | 47 | if (!_app->isValid()) Opie::Core::odebug << "INVALID" << oendl; |
47 | if (act == 0) _app->execute(); | 48 | if (act == 0) _app->execute(); |
48 | else if (act == 1){ | 49 | else if (act == 1){ |
49 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); | 50 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); |
50 | e << _app->linkFile(); | 51 | e << _app->linkFile(); |
51 | } | 52 | } |
52 | } | 53 | } |
53 | 54 | ||
54 | QIntDict<QString> AppLnkItem::actions() | 55 | QIntDict<QString> AppLnkItem::actions() |
55 | { | 56 | { |
56 | QIntDict<QString> result; | 57 | QIntDict<QString> result; |
57 | result.insert( 0, new QString( QObject::tr("execute") ) ); | 58 | result.insert( 0, new QString( QObject::tr("execute") ) ); |
58 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); | 59 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); |
59 | return result; | 60 | return result; |
60 | } | 61 | } |
diff --git a/core/pim/osearch/config.in b/core/pim/osearch/config.in index ec0da27..71191ce 100644 --- a/core/pim/osearch/config.in +++ b/core/pim/osearch/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config OSEARCH | 1 | config OSEARCH |
2 | boolean "opie-osearch (searches throught your PDA)" | 2 | boolean "opie-osearch (searches throught your PDA)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && LIBOPIE2PIM | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM |
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index eeea54b..af6b194 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp | |||
@@ -1,93 +1,93 @@ | |||
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 "datebooksearch.h" | 13 | #include "datebooksearch.h" |
14 | #include "eventitem.h" | 14 | #include "eventitem.h" |
15 | 15 | ||
16 | #include <opie2/odebug.h> | ||
16 | #include <opie2/opimevent.h> | 17 | #include <opie2/opimevent.h> |
17 | #include <opie2/opimrecurrence.h> | 18 | #include <opie2/opimrecurrence.h> |
18 | 19 | ||
19 | |||
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | 22 | ||
23 | #include <qaction.h> | 23 | #include <qaction.h> |
24 | #include <qpopupmenu.h> | 24 | #include <qpopupmenu.h> |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | DatebookSearch::DatebookSearch(QListView* parent, QString name) | 28 | DatebookSearch::DatebookSearch(QListView* parent, QString name) |
29 | : SearchGroup(parent, name), _dates(0), _popupMenu(0) | 29 | : SearchGroup(parent, name), _dates(0), _popupMenu(0) |
30 | { | 30 | { |
31 | QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" ); | 31 | QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" ); |
32 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); | 32 | setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); |
33 | actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); | 33 | actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); |
34 | actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); | 34 | actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); |
35 | Config cfg( "osearch", Config::User ); | 35 | Config cfg( "osearch", Config::User ); |
36 | cfg.setGroup( "datebook_settings" ); | 36 | cfg.setGroup( "datebook_settings" ); |
37 | actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); | 37 | actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); |
38 | actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); | 38 | actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); |
39 | } | 39 | } |
40 | 40 | ||
41 | DatebookSearch::~DatebookSearch() | 41 | DatebookSearch::~DatebookSearch() |
42 | { | 42 | { |
43 | qDebug("SAVE DATEBOOK SEARCH CONFIG"); | 43 | Opie::Core::odebug << "SAVE DATEBOOK SEARCH CONFIG" << oendl; |
44 | Config cfg( "osearch", Config::User ); | 44 | Config cfg( "osearch", Config::User ); |
45 | cfg.setGroup( "datebook_settings" ); | 45 | cfg.setGroup( "datebook_settings" ); |
46 | cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); | 46 | cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); |
47 | cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); | 47 | cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); |
48 | delete _dates; | 48 | delete _dates; |
49 | delete _popupMenu; | 49 | delete _popupMenu; |
50 | delete actionShowPastEvents; | 50 | delete actionShowPastEvents; |
51 | delete actionSearchInDates; | 51 | delete actionSearchInDates; |
52 | } | 52 | } |
53 | 53 | ||
54 | 54 | ||
55 | void DatebookSearch::load() | 55 | void DatebookSearch::load() |
56 | { | 56 | { |
57 | _dates = new ODateBookAccess(); | 57 | _dates = new ODateBookAccess(); |
58 | _dates->load(); | 58 | _dates->load(); |
59 | } | 59 | } |
60 | 60 | ||
61 | int DatebookSearch::search() | 61 | int DatebookSearch::search() |
62 | { | 62 | { |
63 | OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search); | 63 | OPimRecordList<OPimEvent> results = _dates->matchRegexp(_search); |
64 | for (uint i = 0; i < results.count(); i++) | 64 | for (uint i = 0; i < results.count(); i++) |
65 | insertItem( new OPimEvent( results[i] ) ); | 65 | insertItem( new OPimEvent( results[i] ) ); |
66 | return _resultCount; | 66 | return _resultCount; |
67 | } | 67 | } |
68 | 68 | ||
69 | void DatebookSearch::insertItem( void *rec ) | 69 | void DatebookSearch::insertItem( void *rec ) |
70 | { | 70 | { |
71 | OPimEvent *ev = (OPimEvent*)rec; | 71 | OPimEvent *ev = (OPimEvent*)rec; |
72 | if ( !actionShowPastEvents->isOn() && | 72 | if ( !actionShowPastEvents->isOn() && |
73 | ev->endDateTime() < QDateTime::currentDateTime() && | 73 | ev->endDateTime() < QDateTime::currentDateTime() && |
74 | !ev->recurrence().doesRecur() | 74 | !ev->recurrence().doesRecur() |
75 | ) return; | 75 | ) return; |
76 | if ( !actionSearchInDates->isOn() && ( | 76 | if ( !actionSearchInDates->isOn() && ( |
77 | ev->lastHitField() == Qtopia::StartDateTime || | 77 | ev->lastHitField() == Qtopia::StartDateTime || |
78 | ev->lastHitField() == Qtopia::EndDateTime ) | 78 | ev->lastHitField() == Qtopia::EndDateTime ) |
79 | ) return; | 79 | ) return; |
80 | new EventItem( this, ev ); | 80 | new EventItem( this, ev ); |
81 | _resultCount++; | 81 | _resultCount++; |
82 | } | 82 | } |
83 | 83 | ||
84 | QPopupMenu* DatebookSearch::popupMenu() | 84 | QPopupMenu* DatebookSearch::popupMenu() |
85 | { | 85 | { |
86 | if (!_popupMenu){ | 86 | if (!_popupMenu){ |
87 | _popupMenu = new QPopupMenu( 0 ); | 87 | _popupMenu = new QPopupMenu( 0 ); |
88 | actionShowPastEvents->addTo( _popupMenu ); | 88 | actionShowPastEvents->addTo( _popupMenu ); |
89 | actionSearchInDates->addTo( _popupMenu ); | 89 | actionSearchInDates->addTo( _popupMenu ); |
90 | } | 90 | } |
91 | return _popupMenu; | 91 | return _popupMenu; |
92 | } | 92 | } |
93 | 93 | ||
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp index df8e856..d908f7c 100644 --- a/core/pim/osearch/doclnkitem.cpp +++ b/core/pim/osearch/doclnkitem.cpp | |||
@@ -1,79 +1,81 @@ | |||
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 <opie2/odebug.h> | ||
16 | |||
15 | #include <qpe/applnk.h> | 17 | #include <qpe/applnk.h> |
16 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
17 | 19 | ||
18 | #include <qtextstream.h> | 20 | #include <qtextstream.h> |
19 | #include <qfileinfo.h> | 21 | #include <qfileinfo.h> |
20 | 22 | ||
21 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) | 23 | DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) |
22 | : ResultItem(parent) | 24 | : ResultItem(parent) |
23 | { | 25 | { |
24 | _doc = app; | 26 | _doc = app; |
25 | setText(0, _doc->name() ); | 27 | setText(0, _doc->name() ); |
26 | setPixmap(0, _doc->pixmap() ); | 28 | setPixmap(0, _doc->pixmap() ); |
27 | } | 29 | } |
28 | 30 | ||
29 | DocLnkItem::~DocLnkItem() | 31 | DocLnkItem::~DocLnkItem() |
30 | { | 32 | { |
31 | } | 33 | } |
32 | 34 | ||
33 | QString DocLnkItem::toRichText() | 35 | QString DocLnkItem::toRichText() |
34 | { | 36 | { |
35 | QString text; | 37 | QString text; |
36 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; | 38 | text += "<b><h3>" + _doc->name() + "</b></h3><br>"; |
37 | text += _doc->comment() + "<br>"; | 39 | text += _doc->comment() + "<br>"; |
38 | text += QObject::tr("File: ") + _doc->file() + "<br>"; | 40 | text += QObject::tr("File: ") + _doc->file() + "<br>"; |
39 | text += QObject::tr("Link: ") + _doc->linkFile() + "<br>"; | 41 | text += QObject::tr("Link: ") + _doc->linkFile() + "<br>"; |
40 | text += QObject::tr("Mimetype: ") + _doc->type() + "<br>"; | 42 | text += QObject::tr("Mimetype: ") + _doc->type() + "<br>"; |
41 | if ( _doc->type().contains( "text" ) ){ | 43 | if ( _doc->type().contains( "text" ) ){ |
42 | text += "<br><br><hr><br>"; | 44 | text += "<br><br><hr><br>"; |
43 | QFile f(_doc->file()); | 45 | QFile f(_doc->file()); |
44 | if ( f.open(IO_ReadOnly) ) { | 46 | if ( f.open(IO_ReadOnly) ) { |
45 | QTextStream t( &f ); | 47 | QTextStream t( &f ); |
46 | while ( !t.eof() ) | 48 | while ( !t.eof() ) |
47 | text += t.readLine() + "<br>"; | 49 | text += t.readLine() + "<br>"; |
48 | } | 50 | } |
49 | f.close(); | 51 | f.close(); |
50 | } | 52 | } |
51 | /* text += "<br><br>`"; | 53 | /* text += "<br><br>`"; |
52 | text += _doc->exec(); | 54 | text += _doc->exec(); |
53 | text += "`";*/ | 55 | text += "`";*/ |
54 | QStringList list = _doc->mimeTypes(); | 56 | QStringList list = _doc->mimeTypes(); |
55 | int i = 0; | 57 | int i = 0; |
56 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 58 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
57 | text += QString::number( i++) + " - " + *it ; | 59 | text += QString::number( i++) + " - " + *it ; |
58 | } | 60 | } |
59 | return text; | 61 | return text; |
60 | } | 62 | } |
61 | 63 | ||
62 | void DocLnkItem::action( int act ) | 64 | void DocLnkItem::action( int act ) |
63 | { | 65 | { |
64 | qDebug("action %i",act); | 66 | Opie::Core::odebug << "action" << act << oendl; |
65 | if (!_doc->isValid()) qDebug("INVALID"); | 67 | if (!_doc->isValid()) Opie::Core::odebug << "INVALID" << oendl; |
66 | if (act == 0) _doc->execute(); | 68 | if (act == 0) _doc->execute(); |
67 | else if (act == 1){ | 69 | else if (act == 1){ |
68 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); | 70 | QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); |
69 | e << _doc->file(); | 71 | e << _doc->file(); |
70 | } | 72 | } |
71 | } | 73 | } |
72 | 74 | ||
73 | QIntDict<QString> DocLnkItem::actions() | 75 | QIntDict<QString> DocLnkItem::actions() |
74 | { | 76 | { |
75 | QIntDict<QString> result; | 77 | QIntDict<QString> result; |
76 | result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); | 78 | result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); |
77 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); | 79 | result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); |
78 | return result; | 80 | return result; |
79 | } | 81 | } |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 8b6a5df..f329e83 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -1,317 +1,318 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 10 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
11 | 11 | ||
12 | 12 | ||
13 | #include "olistview.h" | 13 | #include "olistview.h" |
14 | #include "olistviewitem.h" | 14 | #include "olistviewitem.h" |
15 | #include "resultitem.h" | 15 | #include "resultitem.h" |
16 | #include "adresssearch.h" | 16 | #include "adresssearch.h" |
17 | #include "todosearch.h" | 17 | #include "todosearch.h" |
18 | #include "datebooksearch.h" | 18 | #include "datebooksearch.h" |
19 | #include "applnksearch.h" | 19 | #include "applnksearch.h" |
20 | #include "doclnksearch.h" | 20 | #include "doclnksearch.h" |
21 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
22 | 22 | ||
23 | #include <opie2/odebug.h> | ||
23 | #include <opie2/owait.h> | 24 | #include <opie2/owait.h> |
24 | 25 | ||
25 | #include <qpe/qpemessagebox.h> | 26 | #include <qpe/qpemessagebox.h> |
26 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
27 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
28 | 29 | ||
29 | 30 | ||
30 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/global.h> | 32 | #include <qpe/global.h> |
32 | 33 | ||
33 | #include <qtoolbar.h> | 34 | #include <qtoolbar.h> |
34 | #include <qaction.h> | 35 | #include <qaction.h> |
35 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
36 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
37 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
38 | #include <qstring.h> | 39 | #include <qstring.h> |
39 | #include <qlabel.h> | 40 | #include <qlabel.h> |
40 | #include <qfile.h> | 41 | #include <qfile.h> |
41 | #include <qhbuttongroup.h> | 42 | #include <qhbuttongroup.h> |
42 | #include <qhbox.h> | 43 | #include <qhbox.h> |
43 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
44 | #include <qintdict.h> | 45 | #include <qintdict.h> |
45 | #include <qlayout.h> | 46 | #include <qlayout.h> |
46 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
47 | #include <qsignalmapper.h> | 48 | #include <qsignalmapper.h> |
48 | #include <qtextbrowser.h> | 49 | #include <qtextbrowser.h> |
49 | #include <qregexp.h> | 50 | #include <qregexp.h> |
50 | #include <qwhatsthis.h> | 51 | #include <qwhatsthis.h> |
51 | #include <qmenubar.h> | 52 | #include <qmenubar.h> |
52 | 53 | ||
53 | 54 | ||
54 | 55 | ||
55 | static const char* const image1_data[] = { | 56 | static const char* const image1_data[] = { |
56 | "14 14 3 1", | 57 | "14 14 3 1", |
57 | ". c None", | 58 | ". c None", |
58 | "# c #000000", | 59 | "# c #000000", |
59 | "a c #ff0000", | 60 | "a c #ff0000", |
60 | "..............", | 61 | "..............", |
61 | "..##.......###", | 62 | "..##.......###", |
62 | ".#aa#....##aa#", | 63 | ".#aa#....##aa#", |
63 | "#aaaa#.##aaaa#", | 64 | "#aaaa#.##aaaa#", |
64 | ".##aaa#aaaaa##", | 65 | ".##aaa#aaaaa##", |
65 | "...#aaaaaaa#..", | 66 | "...#aaaaaaa#..", |
66 | "....#aaaaa#...", | 67 | "....#aaaaa#...", |
67 | "...#aaaaa#....", | 68 | "...#aaaaa#....", |
68 | "..#aaaaaaa#...", | 69 | "..#aaaaaaa#...", |
69 | ".#aaaaaaaaa#..", | 70 | ".#aaaaaaaaa#..", |
70 | "#aaaa###aaaa#.", | 71 | "#aaaa###aaaa#.", |
71 | "#aaa#..##aaa#.", | 72 | "#aaa#..##aaa#.", |
72 | "#aaa#...#aa#..", | 73 | "#aaa#...#aa#..", |
73 | ".###.....##..."}; | 74 | ".###.....##..."}; |
74 | 75 | ||
75 | 76 | ||
76 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 77 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
77 | QMainWindow( parent, name, f ), _currentItem(0) | 78 | QMainWindow( parent, name, f ), _currentItem(0) |
78 | { | 79 | { |
79 | setCaption( tr("OSearch") ); | 80 | setCaption( tr("OSearch") ); |
80 | 81 | ||
81 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 82 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
82 | 83 | ||
83 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 84 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
84 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 85 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
85 | 86 | ||
86 | mainLayout = new QVBoxLayout( mainFrame ); | 87 | mainLayout = new QVBoxLayout( mainFrame ); |
87 | mainLayout->setSpacing( 0 ); | 88 | mainLayout->setSpacing( 0 ); |
88 | mainLayout->setMargin( 3 ); | 89 | mainLayout->setMargin( 3 ); |
89 | 90 | ||
90 | resultsList = new OListView( mainFrame ); | 91 | resultsList = new OListView( mainFrame ); |
91 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 92 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
92 | mainLayout->addWidget( resultsList ); | 93 | mainLayout->addWidget( resultsList ); |
93 | 94 | ||
94 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 95 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
95 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 96 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
96 | richEdit = new QTextView( detailsFrame ); | 97 | richEdit = new QTextView( detailsFrame ); |
97 | QWhatsThis::add( richEdit, tr("The details of the current result") ); | 98 | QWhatsThis::add( richEdit, tr("The details of the current result") ); |
98 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 99 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
99 | detailsLayout->addWidget( richEdit ); | 100 | detailsLayout->addWidget( richEdit ); |
100 | 101 | ||
101 | buttonBox = new QHBox( mainFrame, "Button Box" ); | 102 | buttonBox = new QHBox( mainFrame, "Button Box" ); |
102 | 103 | ||
103 | _buttonCount = 0; | 104 | _buttonCount = 0; |
104 | 105 | ||
105 | mainLayout->addWidget( detailsFrame ); | 106 | mainLayout->addWidget( detailsFrame ); |
106 | mainLayout->addWidget( buttonBox ); | 107 | mainLayout->addWidget( buttonBox ); |
107 | detailsFrame->hide(); | 108 | detailsFrame->hide(); |
108 | buttonBox->hide(); | 109 | buttonBox->hide(); |
109 | 110 | ||
110 | searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); | 111 | searches.append( new AppLnkSearch( resultsList, tr("Applications") ) ); |
111 | searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); | 112 | searches.append( new DocLnkSearch( resultsList, tr("Documents") ) ); |
112 | searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); | 113 | searches.append( new TodoSearch( resultsList, tr("Todo List") ) ); |
113 | searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); | 114 | searches.append( new DatebookSearch( resultsList, tr("Calendar") ) ); |
114 | searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); | 115 | searches.append( new AdressSearch( resultsList, tr("Contacts") ) ); |
115 | 116 | ||
116 | setCentralWidget( mainFrame ); | 117 | setCentralWidget( mainFrame ); |
117 | 118 | ||
118 | popupTimer = new QTimer(); | 119 | popupTimer = new QTimer(); |
119 | searchTimer = new QTimer(); | 120 | searchTimer = new QTimer(); |
120 | 121 | ||
121 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 122 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
122 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); | 123 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); |
123 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 124 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
124 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 125 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
125 | 126 | ||
126 | signalMapper = new QSignalMapper( this ); | 127 | signalMapper = new QSignalMapper( this ); |
127 | 128 | ||
128 | connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); | 129 | connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); |
129 | 130 | ||
130 | makeMenu(); | 131 | makeMenu(); |
131 | 132 | ||
132 | Config cfg( "osearch", Config::User ); | 133 | Config cfg( "osearch", Config::User ); |
133 | cfg.setGroup( "search_settings" ); | 134 | cfg.setGroup( "search_settings" ); |
134 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); | 135 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); |
135 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); | 136 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); |
136 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); | 137 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); |
137 | } | 138 | } |
138 | 139 | ||
139 | void MainWindow::makeMenu() | 140 | void MainWindow::makeMenu() |
140 | { | 141 | { |
141 | QToolBar *toolBar = new QToolBar( this ); | 142 | QToolBar *toolBar = new QToolBar( this ); |
142 | QToolBar *searchBar = new QToolBar(this); | 143 | QToolBar *searchBar = new QToolBar(this); |
143 | QMenuBar *menuBar = new QMenuBar( toolBar ); | 144 | QMenuBar *menuBar = new QMenuBar( toolBar ); |
144 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 145 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
145 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 146 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
146 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 147 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
147 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); | 148 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); |
148 | 149 | ||
149 | setToolBarsMovable( false ); | 150 | setToolBarsMovable( false ); |
150 | toolBar->setHorizontalStretchable( true ); | 151 | toolBar->setHorizontalStretchable( true ); |
151 | menuBar->insertItem( tr( "Search" ), searchMenu ); | 152 | menuBar->insertItem( tr( "Search" ), searchMenu ); |
152 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 153 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
153 | 154 | ||
154 | //SETTINGS MENU | 155 | //SETTINGS MENU |
155 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); | 156 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); |
156 | QPopupMenu *pop; | 157 | QPopupMenu *pop; |
157 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 158 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
158 | pop = s->popupMenu(); | 159 | pop = s->popupMenu(); |
159 | if (pop){ | 160 | if (pop){ |
160 | cfgMenu->insertItem( s->text(0), pop ); | 161 | cfgMenu->insertItem( s->text(0), pop ); |
161 | } | 162 | } |
162 | } | 163 | } |
163 | 164 | ||
164 | 165 | ||
165 | //SEARCH | 166 | //SEARCH |
166 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); | 167 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); |
167 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); | 168 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); |
168 | // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); | 169 | // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); |
169 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); | 170 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); |
170 | SearchAllAction->addTo( searchMenu ); | 171 | SearchAllAction->addTo( searchMenu ); |
171 | searchMenu->insertItem( tr( "Options" ), searchOptions ); | 172 | searchMenu->insertItem( tr( "Options" ), searchOptions ); |
172 | 173 | ||
173 | //SEARCH OPTIONS | 174 | //SEARCH OPTIONS |
174 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); | 175 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); |
175 | //actionWholeWordsOnly->addTo( searchOptions ); | 176 | //actionWholeWordsOnly->addTo( searchOptions ); |
176 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); | 177 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); |
177 | actionCaseSensitiv->addTo( searchOptions ); | 178 | actionCaseSensitiv->addTo( searchOptions ); |
178 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); | 179 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); |
179 | actionWildcards->addTo( searchOptions ); | 180 | actionWildcards->addTo( searchOptions ); |
180 | 181 | ||
181 | //SEARCH BAR | 182 | //SEARCH BAR |
182 | LabelEnterText = new QLabel( searchBar, "Label" ); | 183 | LabelEnterText = new QLabel( searchBar, "Label" ); |
183 | LabelEnterText->setAutoMask( FALSE ); | 184 | LabelEnterText->setAutoMask( FALSE ); |
184 | LabelEnterText->setText( tr( "Search for: " ) ); | 185 | LabelEnterText->setText( tr( "Search for: " ) ); |
185 | 186 | ||
186 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 187 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
187 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 188 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
188 | QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); | 189 | QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); |
189 | searchEdit->setFocus(); | 190 | searchEdit->setFocus(); |
190 | searchBar->setHorizontalStretchable( TRUE ); | 191 | searchBar->setHorizontalStretchable( TRUE ); |
191 | searchBar->setStretchableWidget( searchEdit ); | 192 | searchBar->setStretchableWidget( searchEdit ); |
192 | 193 | ||
193 | //Search button | 194 | //Search button |
194 | SearchAllAction->addTo( searchBar ); | 195 | SearchAllAction->addTo( searchBar ); |
195 | 196 | ||
196 | //image ripped of off opie-login/loginwindow.cpp | 197 | //image ripped of off opie-login/loginwindow.cpp |
197 | QPixmap image1( ( const char** ) image1_data ); | 198 | QPixmap image1( ( const char** ) image1_data ); |
198 | 199 | ||
199 | //Clear text | 200 | //Clear text |
200 | ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); | 201 | ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); |
201 | ClearSearchText->setText( tr( "" ) ); | 202 | ClearSearchText->setText( tr( "" ) ); |
202 | ClearSearchText->setPixmap( image1 ); | 203 | ClearSearchText->setPixmap( image1 ); |
203 | 204 | ||
204 | connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) ); | 205 | connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) ); |
205 | connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); | 206 | connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); |
206 | 207 | ||
207 | } | 208 | } |
208 | 209 | ||
209 | MainWindow::~MainWindow() | 210 | MainWindow::~MainWindow() |
210 | { | 211 | { |
211 | Config cfg( "osearch", Config::User ); | 212 | Config cfg( "osearch", Config::User ); |
212 | cfg.setGroup( "search_settings" ); | 213 | cfg.setGroup( "search_settings" ); |
213 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); | 214 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); |
214 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); | 215 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); |
215 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); | 216 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); |
216 | } | 217 | } |
217 | 218 | ||
218 | void MainWindow::setCurrent(QListViewItem *item) | 219 | void MainWindow::setCurrent(QListViewItem *item) |
219 | { | 220 | { |
220 | if (!item) return; | 221 | if (!item) return; |
221 | _currentItem = (OListViewItem*)item; | 222 | _currentItem = (OListViewItem*)item; |
222 | //_currentItem = dynamic_cast<OListViewItem*>(item); | 223 | //_currentItem = dynamic_cast<OListViewItem*>(item); |
223 | if (_currentItem->rtti() == OListViewItem::Result){ | 224 | if (_currentItem->rtti() == OListViewItem::Result){ |
224 | ResultItem *res = (ResultItem*)item; | 225 | ResultItem *res = (ResultItem*)item; |
225 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 226 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
226 | richEdit->setText( res->toRichText() ); | 227 | richEdit->setText( res->toRichText() ); |
227 | QIntDict<QString> acts = res->actions(); | 228 | QIntDict<QString> acts = res->actions(); |
228 | QButton *button; | 229 | QButton *button; |
229 | for (uint i = 0; i < acts.count(); i++){ | 230 | for (uint i = 0; i < acts.count(); i++){ |
230 | button = buttonMap[i]; | 231 | button = buttonMap[i]; |
231 | if (!button) { | 232 | if (!button) { |
232 | qWarning(" no button for %s", (*acts[i]).latin1() ); | 233 | Opie::Core::owarn << " no button for " << *acts[i] << oendl; |
233 | button = new QPushButton( buttonBox ); | 234 | button = new QPushButton( buttonBox ); |
234 | buttonMap.insert( i, button ); | 235 | buttonMap.insert( i, button ); |
235 | signalMapper->setMapping(button, i ); | 236 | signalMapper->setMapping(button, i ); |
236 | connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); | 237 | connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); |
237 | } | 238 | } |
238 | button->setText( *acts[i] ); | 239 | button->setText( *acts[i] ); |
239 | button->show(); | 240 | button->show(); |
240 | } | 241 | } |
241 | for (uint i = acts.count(); i < _buttonCount; i++){ | 242 | for (uint i = acts.count(); i < _buttonCount; i++){ |
242 | button = buttonMap[i]; | 243 | button = buttonMap[i]; |
243 | if (button) button->hide(); | 244 | if (button) button->hide(); |
244 | } | 245 | } |
245 | _buttonCount = acts.count(); | 246 | _buttonCount = acts.count(); |
246 | detailsFrame->show(); | 247 | detailsFrame->show(); |
247 | buttonBox->show(); | 248 | buttonBox->show(); |
248 | 249 | ||
249 | }else { | 250 | }else { |
250 | detailsFrame->hide(); | 251 | detailsFrame->hide(); |
251 | buttonBox->hide(); | 252 | buttonBox->hide(); |
252 | } | 253 | } |
253 | popupTimer->start( 300, true ); | 254 | popupTimer->start( 300, true ); |
254 | } | 255 | } |
255 | 256 | ||
256 | void MainWindow::stopTimer(QListViewItem*) | 257 | void MainWindow::stopTimer(QListViewItem*) |
257 | { | 258 | { |
258 | popupTimer->stop(); | 259 | popupTimer->stop(); |
259 | } | 260 | } |
260 | 261 | ||
261 | void MainWindow::showPopup() | 262 | void MainWindow::showPopup() |
262 | { | 263 | { |
263 | popupTimer->stop(); | 264 | popupTimer->stop(); |
264 | if (!_currentItem) return; | 265 | if (!_currentItem) return; |
265 | QPopupMenu *pop = _currentItem->popupMenu(); | 266 | QPopupMenu *pop = _currentItem->popupMenu(); |
266 | if (pop) pop->popup( QCursor::pos() ); | 267 | if (pop) pop->popup( QCursor::pos() ); |
267 | } | 268 | } |
268 | 269 | ||
269 | void MainWindow::setSearch( const QString &key ) | 270 | void MainWindow::setSearch( const QString &key ) |
270 | { | 271 | { |
271 | searchTimer->stop(); | 272 | searchTimer->stop(); |
272 | _searchString = key; | 273 | _searchString = key; |
273 | searchTimer->start( 300 ); | 274 | searchTimer->start( 300 ); |
274 | } | 275 | } |
275 | 276 | ||
276 | void MainWindow::searchStringChanged() | 277 | void MainWindow::searchStringChanged() |
277 | { | 278 | { |
278 | #ifdef NEW_OWAIT | 279 | #ifdef NEW_OWAIT |
279 | OWait("setting search string"); | 280 | OWait("setting search string"); |
280 | #endif | 281 | #endif |
281 | searchTimer->stop(); | 282 | searchTimer->stop(); |
282 | QString ss = _searchString; | 283 | QString ss = _searchString; |
283 | //ss = Global::stringQuote( _searchString ); | 284 | //ss = Global::stringQuote( _searchString ); |
284 | //if (actionWholeWordsOnly->isOn()) | 285 | //if (actionWholeWordsOnly->isOn()) |
285 | // ss = "\\s"+_searchString+"\\s"; | 286 | // ss = "\\s"+_searchString+"\\s"; |
286 | //qDebug(" set searchString >%s<",ss.latin1()); | 287 | //Opie:Core::odebug << " set searchString >" << ss << "<" << oendl; |
287 | QRegExp re( ss ); | 288 | QRegExp re( ss ); |
288 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); | 289 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); |
289 | re.setWildcard( actionWildcards->isOn() ); | 290 | re.setWildcard( actionWildcards->isOn() ); |
290 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) | 291 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) |
291 | s->setSearch( re ); | 292 | s->setSearch( re ); |
292 | } | 293 | } |
293 | 294 | ||
294 | void MainWindow::searchAll() | 295 | void MainWindow::searchAll() |
295 | { | 296 | { |
296 | #ifdef NEW_OWAIT | 297 | #ifdef NEW_OWAIT |
297 | OWait("searching..."); | 298 | OWait("searching..."); |
298 | #endif | 299 | #endif |
299 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 300 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
300 | s->doSearch(); | 301 | s->doSearch(); |
301 | //resultsList->repaint(); | 302 | //resultsList->repaint(); |
302 | } | 303 | } |
303 | } | 304 | } |
304 | 305 | ||
305 | void MainWindow::slotAction( int act ) | 306 | void MainWindow::slotAction( int act ) |
306 | { | 307 | { |
307 | if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ | 308 | if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ |
308 | ResultItem *res = (ResultItem*)_currentItem; | 309 | ResultItem *res = (ResultItem*)_currentItem; |
309 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 310 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
310 | res->action(act); | 311 | res->action(act); |
311 | } | 312 | } |
312 | } | 313 | } |
313 | 314 | ||
314 | void MainWindow::optionChanged(int ) | 315 | void MainWindow::optionChanged(int ) |
315 | { | 316 | { |
316 | searchStringChanged(); | 317 | searchStringChanged(); |
317 | } | 318 | } |
diff --git a/core/pim/osearch/opie-osearch.control b/core/pim/osearch/opie-osearch.control index 9bf0607..73838b9 100644 --- a/core/pim/osearch/opie-osearch.control +++ b/core/pim/osearch/opie-osearch.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-osearch | 1 | Package: opie-osearch |
2 | Files: plugins/application/libosearch.so* bin/osearch apps/1Pim/osearch.desktop pics/osearch/*.png | 2 | Files: plugins/application/libosearch.so* bin/osearch apps/1Pim/osearch.desktop pics/osearch/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Maintainer: Patrick S. Vogt <tille@handhelds.org> | 5 | Maintainer: Patrick S. Vogt <tille@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiepim2 |
8 | Description: Search through all PIM data | 8 | Description: Search through all PIM data |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp index 9166f72..2ca37cf 100644 --- a/core/pim/osearch/searchgroup.cpp +++ b/core/pim/osearch/searchgroup.cpp | |||
@@ -1,89 +1,90 @@ | |||
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 "searchgroup.h" | 13 | #include "searchgroup.h" |
14 | 14 | ||
15 | #include <opie2/odebug.h> | ||
15 | #include <opie2/owait.h> | 16 | #include <opie2/owait.h> |
16 | 17 | ||
17 | #include <qapplication.h> | 18 | #include <qapplication.h> |
18 | 19 | ||
19 | #ifndef NEW_OWAIT | 20 | #ifndef NEW_OWAIT |
20 | static Opie::Ui::OWait *wait = 0; | 21 | static Opie::Ui::OWait *wait = 0; |
21 | #endif | 22 | #endif |
22 | 23 | ||
23 | SearchGroup::SearchGroup(QListView* parent, QString name) | 24 | SearchGroup::SearchGroup(QListView* parent, QString name) |
24 | : OListViewItem(parent, name) | 25 | : OListViewItem(parent, name) |
25 | { | 26 | { |
26 | _name = name; | 27 | _name = name; |
27 | loaded = false; | 28 | loaded = false; |
28 | } | 29 | } |
29 | 30 | ||
30 | 31 | ||
31 | SearchGroup::~SearchGroup() | 32 | SearchGroup::~SearchGroup() |
32 | { | 33 | { |
33 | } | 34 | } |
34 | 35 | ||
35 | 36 | ||
36 | void SearchGroup::expand() | 37 | void SearchGroup::expand() |
37 | { | 38 | { |
38 | //expanded = true; | 39 | //expanded = true; |
39 | if (_lastSearch != _search) clearList(); | 40 | if (_lastSearch != _search) clearList(); |
40 | if (_search.isEmpty()) return; | 41 | if (_search.isEmpty()) return; |
41 | OListViewItem *dummy = new OListViewItem( this, "searching..."); | 42 | OListViewItem *dummy = new OListViewItem( this, "searching..."); |
42 | setOpen( true ); | 43 | setOpen( true ); |
43 | repaint(); | 44 | repaint(); |
44 | int res_count = realSearch(); | 45 | int res_count = realSearch(); |
45 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); | 46 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); |
46 | delete dummy; | 47 | delete dummy; |
47 | repaint(); | 48 | repaint(); |
48 | } | 49 | } |
49 | 50 | ||
50 | void SearchGroup::doSearch() | 51 | void SearchGroup::doSearch() |
51 | { | 52 | { |
52 | clearList(); | 53 | clearList(); |
53 | if (_search.isEmpty()) return; | 54 | if (_search.isEmpty()) return; |
54 | _resultCount = realSearch(); | 55 | _resultCount = realSearch(); |
55 | //repaint(); | 56 | //repaint(); |
56 | } | 57 | } |
57 | 58 | ||
58 | void SearchGroup::setSearch(QRegExp re) | 59 | void SearchGroup::setSearch(QRegExp re) |
59 | { | 60 | { |
60 | if (re == _search) return; | 61 | if (re == _search) return; |
61 | setText(0, _name+" - "+re.pattern() ); | 62 | setText(0, _name+" - "+re.pattern() ); |
62 | _search = re; | 63 | _search = re; |
63 | if (isOpen()) expand(); | 64 | if (isOpen()) expand(); |
64 | else new OListViewItem( this, "searching..."); | 65 | else new OListViewItem( this, "searching..."); |
65 | } | 66 | } |
66 | 67 | ||
67 | int SearchGroup::realSearch() | 68 | int SearchGroup::realSearch() |
68 | { | 69 | { |
69 | if (_lastSearch == _search) return _resultCount; | 70 | if (_lastSearch == _search) return _resultCount; |
70 | #ifndef NEW_OWAIT | 71 | #ifndef NEW_OWAIT |
71 | if (!wait) wait = new Opie::Ui::OWait( qApp->mainWidget(), "osearch" ); | 72 | if (!wait) wait = new Opie::Ui::OWait( qApp->mainWidget(), "osearch" ); |
72 | wait->show(); | 73 | wait->show(); |
73 | qApp->processEvents(); | 74 | qApp->processEvents(); |
74 | #else | 75 | #else |
75 | qDebug("********** NEW_OWAIT *************"); | 76 | Opie:Core::odebug << "********** NEW_OWAIT *************" << oendl; |
76 | OWait( "searching" ); | 77 | OWait( "searching" ); |
77 | #endif | 78 | #endif |
78 | if (!loaded) load(); | 79 | if (!loaded) load(); |
79 | _resultCount = 0; | 80 | _resultCount = 0; |
80 | _resultCount = search(); | 81 | _resultCount = search(); |
81 | _lastSearch = _search; | 82 | _lastSearch = _search; |
82 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")"); | 83 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( _resultCount ) + ")"); |
83 | 84 | ||
84 | #ifndef NEW_OWAIT | 85 | #ifndef NEW_OWAIT |
85 | wait->hide(); | 86 | wait->hide(); |
86 | #endif | 87 | #endif |
87 | return _resultCount; | 88 | return _resultCount; |
88 | } | 89 | } |
89 | 90 | ||