-rw-r--r-- | core/pim/osearch/contactitem.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 13 | ||||
-rw-r--r-- | core/pim/osearch/opie-osearch.control | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp index ad43ba2..554ab13 100644 --- a/core/pim/osearch/contactitem.cpp +++ b/core/pim/osearch/contactitem.cpp | |||
@@ -1,143 +1,143 @@ | |||
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 "contactitem.h" | 13 | #include "contactitem.h" |
14 | 14 | ||
15 | #include <qpixmap.h> | 15 | #include <qpixmap.h> |
16 | #include <opie/ocontact.h> | 16 | #include <opie/ocontact.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
19 | 19 | ||
20 | ContactItem::ContactItem(OListViewItem* parent, OContact *contact) | 20 | ContactItem::ContactItem(OListViewItem* parent, OContact *contact) |
21 | : ResultItem(parent) | 21 | : ResultItem(parent) |
22 | { | 22 | { |
23 | _contact = contact; | 23 | _contact = contact; |
24 | setText(0, _contact->toShortText()); | 24 | setText(0, _contact->toShortText()); |
25 | setIcon(); | 25 | setIcon(); |
26 | } | 26 | } |
27 | 27 | ||
28 | void ContactItem::setIcon() | 28 | void ContactItem::setIcon() |
29 | { | 29 | { |
30 | QPixmap icon; | 30 | QPixmap icon; |
31 | switch ( _contact->lastHitField() ) { | 31 | switch ( _contact->lastHitField() ) { |
32 | case -1: | 32 | case -1: |
33 | icon = Resource::loadPixmap( "reset" ); | 33 | icon = Resource::loadPixmap( "reset" ); |
34 | break; | 34 | break; |
35 | case Qtopia::BusinessPhone: | 35 | case Qtopia::BusinessPhone: |
36 | icon = Resource::loadPixmap( "addressbook/phonework" ); | 36 | icon = Resource::loadPixmap( "addressbook/phonework" ); |
37 | break; | 37 | break; |
38 | case Qtopia::BusinessFax: | 38 | case Qtopia::BusinessFax: |
39 | icon = Resource::loadPixmap( "addressbook/faxwork" ); | 39 | icon = Resource::loadPixmap( "addressbook/faxwork" ); |
40 | break; | 40 | break; |
41 | case Qtopia::BusinessMobile: | 41 | case Qtopia::BusinessMobile: |
42 | icon = Resource::loadPixmap( "addressbook/mobilework" ); | 42 | icon = Resource::loadPixmap( "addressbook/mobilework" ); |
43 | break; | 43 | break; |
44 | case Qtopia::DefaultEmail: | 44 | case Qtopia::DefaultEmail: |
45 | icon = Resource::loadPixmap( "addressbook/email" ); | 45 | icon = Resource::loadPixmap( "addressbook/email" ); |
46 | break; | 46 | break; |
47 | case Qtopia::Emails: | 47 | case Qtopia::Emails: |
48 | icon = Resource::loadPixmap( "addressbook/email" ); | 48 | icon = Resource::loadPixmap( "addressbook/email" ); |
49 | break; | 49 | break; |
50 | case Qtopia::HomePhone: | 50 | case Qtopia::HomePhone: |
51 | icon = Resource::loadPixmap( "addressbook/phonehome" ); | 51 | icon = Resource::loadPixmap( "addressbook/phonehome" ); |
52 | break; | 52 | break; |
53 | case Qtopia::HomeFax: | 53 | case Qtopia::HomeFax: |
54 | icon = Resource::loadPixmap( "addressbook/faxhome" ); | 54 | icon = Resource::loadPixmap( "addressbook/faxhome" ); |
55 | break; | 55 | break; |
56 | case Qtopia::HomeMobile: | 56 | case Qtopia::HomeMobile: |
57 | icon = Resource::loadPixmap( "addressbook/mobilehome" ); | 57 | icon = Resource::loadPixmap( "addressbook/mobilehome" ); |
58 | break; | 58 | break; |
59 | case Qtopia::HomeWebPage: | 59 | case Qtopia::HomeWebPage: |
60 | icon = Resource::loadPixmap( "addressbook/webpagehome" ); | 60 | icon = Resource::loadPixmap( "addressbook/webpagehome" ); |
61 | break; | 61 | break; |
62 | case Qtopia::BusinessWebPage: | 62 | case Qtopia::BusinessWebPage: |
63 | icon = Resource::loadPixmap( "addressbook/webpagework" ); | 63 | icon = Resource::loadPixmap( "addressbook/webpagework" ); |
64 | break; | 64 | break; |
65 | case Qtopia::Title: | 65 | case Qtopia::Title: |
66 | case Qtopia::JobTitle: | 66 | case Qtopia::JobTitle: |
67 | case Qtopia::FirstName: | 67 | case Qtopia::FirstName: |
68 | case Qtopia::MiddleName: | 68 | case Qtopia::MiddleName: |
69 | case Qtopia::LastName: | 69 | case Qtopia::LastName: |
70 | case Qtopia::Suffix: | 70 | case Qtopia::Suffix: |
71 | case Qtopia::Nickname: | 71 | case Qtopia::Nickname: |
72 | case Qtopia::FileAs: | 72 | case Qtopia::FileAs: |
73 | icon = Resource::loadPixmap( "osearch/identity" ); | 73 | icon = Resource::loadPixmap( "osearch/identity" ); |
74 | break; | 74 | break; |
75 | case Qtopia::HomeStreet: | 75 | case Qtopia::HomeStreet: |
76 | case Qtopia::HomeCity: | 76 | case Qtopia::HomeCity: |
77 | case Qtopia::HomeState: | 77 | case Qtopia::HomeState: |
78 | case Qtopia::HomeZip: | 78 | case Qtopia::HomeZip: |
79 | case Qtopia::HomeCountry: | 79 | case Qtopia::HomeCountry: |
80 | icon = Resource::loadPixmap( "osearch/addresshome" ); | 80 | icon = Resource::loadPixmap( "osearch/addresshome" ); |
81 | break; | 81 | break; |
82 | case Qtopia::Company: | 82 | case Qtopia::Company: |
83 | case Qtopia::BusinessCity: | 83 | case Qtopia::BusinessCity: |
84 | case Qtopia::BusinessStreet: | 84 | case Qtopia::BusinessStreet: |
85 | case Qtopia::BusinessZip: | 85 | case Qtopia::BusinessZip: |
86 | case Qtopia::BusinessCountry: | 86 | case Qtopia::BusinessCountry: |
87 | case Qtopia::Department: | 87 | case Qtopia::Department: |
88 | case Qtopia::Office: | 88 | case Qtopia::Office: |
89 | case Qtopia::Manager: | 89 | case Qtopia::Manager: |
90 | case Qtopia::BusinessPager: | 90 | case Qtopia::BusinessPager: |
91 | case Qtopia::Profession: | 91 | case Qtopia::Profession: |
92 | icon = Resource::loadPixmap( "addressbook/addresshome" ); | 92 | icon = Resource::loadPixmap( "osearch/addresshome" ); |
93 | break; | 93 | break; |
94 | case Qtopia::Assistant: | 94 | case Qtopia::Assistant: |
95 | case Qtopia::Spouse: | 95 | case Qtopia::Spouse: |
96 | case Qtopia::Children: | 96 | case Qtopia::Children: |
97 | icon = Resource::loadPixmap( "osearch/personal" ); | 97 | icon = Resource::loadPixmap( "osearch/personal" ); |
98 | break; | 98 | break; |
99 | case Qtopia::Birthday: | 99 | case Qtopia::Birthday: |
100 | case Qtopia::Anniversary: | 100 | case Qtopia::Anniversary: |
101 | icon = Resource::loadPixmap( "osearch/clock" ); | 101 | icon = Resource::loadPixmap( "osearch/clock" ); |
102 | break; | 102 | break; |
103 | case Qtopia::Notes: | 103 | case Qtopia::Notes: |
104 | icon = Resource::loadPixmap( "txt" ); | 104 | icon = Resource::loadPixmap( "txt" ); |
105 | break; | 105 | break; |
106 | default: | 106 | default: |
107 | icon = Resource::loadPixmap( "DocsIcon" ); | 107 | icon = Resource::loadPixmap( "DocsIcon" ); |
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | setPixmap( 0, icon ); | 110 | setPixmap( 0, icon ); |
111 | } | 111 | } |
112 | 112 | ||
113 | ContactItem::~ContactItem() | 113 | ContactItem::~ContactItem() |
114 | { | 114 | { |
115 | delete _contact; | 115 | delete _contact; |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | QString ContactItem::toRichText() | 119 | QString ContactItem::toRichText() |
120 | { | 120 | { |
121 | return _contact->toRichText(); | 121 | return _contact->toRichText(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void ContactItem::action( int act ) | 124 | void ContactItem::action( int act ) |
125 | { | 125 | { |
126 | if (act == 0){ | 126 | if (act == 0){ |
127 | QCopEnvelope e("QPE/Application/addressbook", "show(int)"); | 127 | QCopEnvelope e("QPE/Application/addressbook", "show(int)"); |
128 | e << _contact->uid(); | 128 | e << _contact->uid(); |
129 | }else if(act == 1){ | 129 | }else if(act == 1){ |
130 | QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); | 130 | QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); |
131 | e << _contact->uid(); | 131 | e << _contact->uid(); |
132 | } | 132 | } |
133 | 133 | ||
134 | } | 134 | } |
135 | 135 | ||
136 | QIntDict<QString> ContactItem::actions() | 136 | QIntDict<QString> ContactItem::actions() |
137 | { | 137 | { |
138 | QIntDict<QString> result; | 138 | QIntDict<QString> result; |
139 | result.insert( 0, new QString( QObject::tr("show") ) ); | 139 | result.insert( 0, new QString( QObject::tr("show") ) ); |
140 | result.insert( 1, new QString( QObject::tr("edit") ) ); | 140 | result.insert( 1, new QString( QObject::tr("edit") ) ); |
141 | return result; | 141 | return result; |
142 | 142 | ||
143 | } | 143 | } |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 6070fdf..adce926 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -1,270 +1,269 @@ | |||
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 "mainwindow.h" | 13 | #include "mainwindow.h" |
14 | 14 | ||
15 | #include <qpe/qpemenubar.h> | 15 | #include <qpe/qpemenubar.h> |
16 | #include <qpe/qpemessagebox.h> | 16 | #include <qpe/qpemessagebox.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qpe/global.h> | 22 | #include <qpe/global.h> |
23 | #include <opie/owait.h> | 23 | #include <opie/owait.h> |
24 | #include <qaction.h> | 24 | #include <qaction.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qpopupmenu.h> | 26 | #include <qpopupmenu.h> |
27 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qhbuttongroup.h> | 31 | #include <qhbuttongroup.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qintdict.h> | 33 | #include <qintdict.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qtextbrowser.h> | 36 | #include <qtextbrowser.h> |
37 | #include <qregexp.h> | 37 | #include <qregexp.h> |
38 | 38 | ||
39 | #include "olistview.h" | 39 | #include "olistview.h" |
40 | #include "olistviewitem.h" | 40 | #include "olistviewitem.h" |
41 | #include "resultitem.h" | 41 | #include "resultitem.h" |
42 | #include "adresssearch.h" | 42 | #include "adresssearch.h" |
43 | #include "todosearch.h" | 43 | #include "todosearch.h" |
44 | #include "datebooksearch.h" | 44 | #include "datebooksearch.h" |
45 | #include "applnksearch.h" | 45 | #include "applnksearch.h" |
46 | #include "doclnksearch.h" | 46 | #include "doclnksearch.h" |
47 | 47 | ||
48 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 48 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
49 | QMainWindow( parent, name, f ), _currentItem(0) | 49 | QMainWindow( parent, name, f ), _currentItem(0) |
50 | { | 50 | { |
51 | setCaption( tr("OSearch") ); | 51 | setCaption( tr("OSearch") ); |
52 | 52 | ||
53 | setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); | 53 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
54 | 54 | ||
55 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 55 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
56 | mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | ||
56 | 57 | ||
57 | mainLayout = new QVBoxLayout( mainFrame ); | 58 | mainLayout = new QVBoxLayout( mainFrame ); |
58 | mainLayout->setSpacing( 0 ); | 59 | mainLayout->setSpacing( 0 ); |
59 | mainLayout->setMargin( 0 ); | 60 | mainLayout->setMargin( 0 ); |
60 | 61 | ||
61 | resultsList = new OListView( mainFrame ); | 62 | resultsList = new OListView( mainFrame ); |
62 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); | 63 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
63 | mainLayout->addWidget( resultsList, 1 ); | 64 | mainLayout->addWidget( resultsList ); |
64 | 65 | ||
65 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 66 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
66 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 67 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
67 | richEdit = new QTextView( detailsFrame ); | 68 | richEdit = new QTextView( detailsFrame ); |
68 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding)); | 69 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
69 | //richEdit->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum )); | 70 | detailsLayout->addWidget( richEdit ); |
70 | detailsLayout->addWidget( richEdit, 1 ); | ||
71 | 71 | ||
72 | buttonGroupActions = new QHButtonGroup( this ); | 72 | buttonGroupActions = new QHButtonGroup( this ); |
73 | buttonGroupActions->hide(); | 73 | buttonGroupActions->hide(); |
74 | _buttonCount = 0; | 74 | _buttonCount = 0; |
75 | // buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | ||
76 | 75 | ||
77 | buttonLayout = new QHBoxLayout( detailsFrame ); | 76 | buttonLayout = new QHBoxLayout( detailsFrame ); |
78 | detailsLayout->addLayout( buttonLayout ); | 77 | detailsLayout->addLayout( buttonLayout ); |
79 | 78 | ||
80 | mainLayout->addWidget( detailsFrame ); | 79 | mainLayout->addWidget( detailsFrame ); |
81 | detailsFrame->hide(); | 80 | detailsFrame->hide(); |
82 | 81 | ||
83 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); | 82 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); |
84 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); | 83 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); |
85 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); | 84 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); |
86 | searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); | 85 | searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); |
87 | searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); | 86 | searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); |
88 | 87 | ||
89 | setCentralWidget( mainFrame ); | 88 | setCentralWidget( mainFrame ); |
90 | 89 | ||
91 | popupTimer = new QTimer(); | 90 | popupTimer = new QTimer(); |
92 | searchTimer = new QTimer(); | 91 | searchTimer = new QTimer(); |
93 | 92 | ||
94 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 93 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
95 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); | 94 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); |
96 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 95 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
97 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 96 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
98 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); | 97 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); |
99 | 98 | ||
100 | makeMenu(); | 99 | makeMenu(); |
101 | 100 | ||
102 | Config cfg( "osearch", Config::User ); | 101 | Config cfg( "osearch", Config::User ); |
103 | cfg.setGroup( "search_settings" ); | 102 | cfg.setGroup( "search_settings" ); |
104 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); | 103 | actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); |
105 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); | 104 | actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); |
106 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); | 105 | // actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); |
107 | } | 106 | } |
108 | 107 | ||
109 | void MainWindow::makeMenu() | 108 | void MainWindow::makeMenu() |
110 | { | 109 | { |
111 | QPEToolBar *toolBar = new QPEToolBar( this ); | 110 | QPEToolBar *toolBar = new QPEToolBar( this ); |
112 | QPEToolBar *searchBar = new QPEToolBar(this); | 111 | QPEToolBar *searchBar = new QPEToolBar(this); |
113 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 112 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
114 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 113 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
115 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 114 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
116 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 115 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
117 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); | 116 | QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); |
118 | 117 | ||
119 | setToolBarsMovable( false ); | 118 | setToolBarsMovable( false ); |
120 | toolBar->setHorizontalStretchable( true ); | 119 | toolBar->setHorizontalStretchable( true ); |
121 | menuBar->insertItem( tr( "Search" ), searchMenu ); | 120 | menuBar->insertItem( tr( "Search" ), searchMenu ); |
122 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 121 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
123 | 122 | ||
124 | //SETTINGS MENU | 123 | //SETTINGS MENU |
125 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); | 124 | cfgMenu->insertItem( tr( "Search" ), searchOptions ); |
126 | QPopupMenu *pop; | 125 | QPopupMenu *pop; |
127 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 126 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
128 | pop = s->popupMenu(); | 127 | pop = s->popupMenu(); |
129 | if (pop){ | 128 | if (pop){ |
130 | qDebug("inserting settings menu for %s",s->text(0).latin1()); | 129 | qDebug("inserting settings menu for %s",s->text(0).latin1()); |
131 | cfgMenu->insertItem( s->text(0), pop ); | 130 | cfgMenu->insertItem( s->text(0), pop ); |
132 | //connect( pop, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) ); | 131 | //connect( pop, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) ); |
133 | } | 132 | } |
134 | } | 133 | } |
135 | 134 | ||
136 | 135 | ||
137 | //SEARCH | 136 | //SEARCH |
138 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); | 137 | SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); |
139 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); | 138 | SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); |
140 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); | 139 | connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); |
141 | SearchAllAction->addTo( searchMenu ); | 140 | SearchAllAction->addTo( searchMenu ); |
142 | searchMenu->insertItem( tr( "Options" ), searchOptions ); | 141 | searchMenu->insertItem( tr( "Options" ), searchOptions ); |
143 | //connect( searchOptions, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) ); | 142 | //connect( searchOptions, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) ); |
144 | 143 | ||
145 | //SEARCH OPTIONS | 144 | //SEARCH OPTIONS |
146 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); | 145 | //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); |
147 | //actionWholeWordsOnly->addTo( searchOptions ); | 146 | //actionWholeWordsOnly->addTo( searchOptions ); |
148 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); | 147 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); |
149 | actionCaseSensitiv->addTo( searchOptions ); | 148 | actionCaseSensitiv->addTo( searchOptions ); |
150 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); | 149 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); |
151 | actionWildcards->addTo( searchOptions ); | 150 | actionWildcards->addTo( searchOptions ); |
152 | 151 | ||
153 | //SEARCH BAR | 152 | //SEARCH BAR |
154 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 153 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
155 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 154 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
156 | searchEdit->setFocus(); | 155 | searchEdit->setFocus(); |
157 | searchBar->setHorizontalStretchable( TRUE ); | 156 | searchBar->setHorizontalStretchable( TRUE ); |
158 | searchBar->setStretchableWidget( searchEdit ); | 157 | searchBar->setStretchableWidget( searchEdit ); |
159 | SearchAllAction->addTo( searchBar ); | 158 | SearchAllAction->addTo( searchBar ); |
160 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 159 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
161 | this, SLOT( setSearch( const QString & ) ) ); | 160 | this, SLOT( setSearch( const QString & ) ) ); |
162 | 161 | ||
163 | } | 162 | } |
164 | 163 | ||
165 | MainWindow::~MainWindow() | 164 | MainWindow::~MainWindow() |
166 | { | 165 | { |
167 | Config cfg( "osearch", Config::User ); | 166 | Config cfg( "osearch", Config::User ); |
168 | cfg.setGroup( "search_settings" ); | 167 | cfg.setGroup( "search_settings" ); |
169 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); | 168 | cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); |
170 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); | 169 | cfg.writeEntry( "wildcards", actionWildcards->isOn() ); |
171 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); | 170 | //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); |
172 | } | 171 | } |
173 | 172 | ||
174 | void MainWindow::setCurrent(QListViewItem *item) | 173 | void MainWindow::setCurrent(QListViewItem *item) |
175 | { | 174 | { |
176 | if (!item) return; | 175 | if (!item) return; |
177 | _currentItem = (OListViewItem*)item; | 176 | _currentItem = (OListViewItem*)item; |
178 | //_currentItem = dynamic_cast<OListViewItem*>(item); | 177 | //_currentItem = dynamic_cast<OListViewItem*>(item); |
179 | if (_currentItem->rtti() == OListViewItem::Result){ | 178 | if (_currentItem->rtti() == OListViewItem::Result){ |
180 | ResultItem *res = (ResultItem*)item; | 179 | ResultItem *res = (ResultItem*)item; |
181 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 180 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
182 | richEdit->setText( res->toRichText() ); | 181 | richEdit->setText( res->toRichText() ); |
183 | QIntDict<QString> acts = res->actions(); | 182 | QIntDict<QString> acts = res->actions(); |
184 | QButton *button; | 183 | QButton *button; |
185 | for (uint i = 0; i < acts.count(); i++){ | 184 | for (uint i = 0; i < acts.count(); i++){ |
186 | button = buttonGroupActions->find( i ); | 185 | button = buttonGroupActions->find( i ); |
187 | qDebug("action %i >%s<",i,acts[i]->latin1()); | 186 | qDebug("action %i >%s<",i,acts[i]->latin1()); |
188 | if (!button) { | 187 | if (!button) { |
189 | qDebug("BUTTON"); | 188 | qDebug("BUTTON"); |
190 | button = new QPushButton( detailsFrame ); | 189 | button = new QPushButton( detailsFrame ); |
191 | buttonLayout->addWidget( button, 0 ); | 190 | buttonLayout->addWidget( button, 0 ); |
192 | buttonGroupActions->insert( button, i); | 191 | buttonGroupActions->insert( button, i); |
193 | } | 192 | } |
194 | button->setText( *acts[i] ); | 193 | button->setText( *acts[i] ); |
195 | button->show(); | 194 | button->show(); |
196 | } | 195 | } |
197 | for (uint i = acts.count(); i < _buttonCount; i++){ | 196 | for (uint i = acts.count(); i < _buttonCount; i++){ |
198 | qDebug("remove button %i of %i",i, _buttonCount); | 197 | qDebug("remove button %i of %i",i, _buttonCount); |
199 | button = buttonGroupActions->find( i ); | 198 | button = buttonGroupActions->find( i ); |
200 | if (button) button->hide(); | 199 | if (button) button->hide(); |
201 | } | 200 | } |
202 | _buttonCount = acts.count(); | 201 | _buttonCount = acts.count(); |
203 | detailsFrame->show(); | 202 | detailsFrame->show(); |
204 | }else detailsFrame->hide(); | 203 | }else detailsFrame->hide(); |
205 | popupTimer->start( 300, true ); | 204 | popupTimer->start( 300, true ); |
206 | } | 205 | } |
207 | 206 | ||
208 | void MainWindow::stopTimer(QListViewItem*) | 207 | void MainWindow::stopTimer(QListViewItem*) |
209 | { | 208 | { |
210 | popupTimer->stop(); | 209 | popupTimer->stop(); |
211 | } | 210 | } |
212 | 211 | ||
213 | void MainWindow::showPopup() | 212 | void MainWindow::showPopup() |
214 | { | 213 | { |
215 | popupTimer->stop(); | 214 | popupTimer->stop(); |
216 | if (!_currentItem) return; | 215 | if (!_currentItem) return; |
217 | QPopupMenu *pop = _currentItem->popupMenu(); | 216 | QPopupMenu *pop = _currentItem->popupMenu(); |
218 | if (pop) pop->popup( QCursor::pos() ); | 217 | if (pop) pop->popup( QCursor::pos() ); |
219 | } | 218 | } |
220 | 219 | ||
221 | void MainWindow::setSearch( const QString &key ) | 220 | void MainWindow::setSearch( const QString &key ) |
222 | { | 221 | { |
223 | searchTimer->stop(); | 222 | searchTimer->stop(); |
224 | _searchString = key; | 223 | _searchString = key; |
225 | searchTimer->start( 300 ); | 224 | searchTimer->start( 300 ); |
226 | } | 225 | } |
227 | 226 | ||
228 | void MainWindow::searchStringChanged() | 227 | void MainWindow::searchStringChanged() |
229 | { | 228 | { |
230 | #ifdef NEW_OWAIT | 229 | #ifdef NEW_OWAIT |
231 | OWait("setting search string"); | 230 | OWait("setting search string"); |
232 | #endif | 231 | #endif |
233 | searchTimer->stop(); | 232 | searchTimer->stop(); |
234 | QString ss = _searchString; | 233 | QString ss = _searchString; |
235 | //ss = Global::stringQuote( _searchString ); | 234 | //ss = Global::stringQuote( _searchString ); |
236 | //if (actionWholeWordsOnly->isOn()) | 235 | //if (actionWholeWordsOnly->isOn()) |
237 | // ss = "\\s"+_searchString+"\\s"; | 236 | // ss = "\\s"+_searchString+"\\s"; |
238 | //qDebug(" set searchString >%s<",ss.latin1()); | 237 | //qDebug(" set searchString >%s<",ss.latin1()); |
239 | QRegExp re( ss ); | 238 | QRegExp re( ss ); |
240 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); | 239 | re.setCaseSensitive( actionCaseSensitiv->isOn() ); |
241 | re.setWildcard( actionWildcards->isOn() ); | 240 | re.setWildcard( actionWildcards->isOn() ); |
242 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) | 241 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) |
243 | s->setSearch( re ); | 242 | s->setSearch( re ); |
244 | } | 243 | } |
245 | 244 | ||
246 | void MainWindow::searchAll() | 245 | void MainWindow::searchAll() |
247 | { | 246 | { |
248 | #ifdef NEW_OWAIT | 247 | #ifdef NEW_OWAIT |
249 | OWait("searching..."); | 248 | OWait("searching..."); |
250 | #endif | 249 | #endif |
251 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | 250 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ |
252 | s->doSearch(); | 251 | s->doSearch(); |
253 | //resultsList->repaint(); | 252 | //resultsList->repaint(); |
254 | } | 253 | } |
255 | } | 254 | } |
256 | 255 | ||
257 | void MainWindow::slotAction( int act ) | 256 | void MainWindow::slotAction( int act ) |
258 | { | 257 | { |
259 | if (_currentItem->rtti() == OListViewItem::Result){ | 258 | if (_currentItem->rtti() == OListViewItem::Result){ |
260 | ResultItem *res = (ResultItem*)_currentItem; | 259 | ResultItem *res = (ResultItem*)_currentItem; |
261 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 260 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
262 | res->action(act); | 261 | res->action(act); |
263 | } | 262 | } |
264 | } | 263 | } |
265 | 264 | ||
266 | void MainWindow::optionChanged(int i) | 265 | void MainWindow::optionChanged(int i) |
267 | { | 266 | { |
268 | qDebug("optionChanged(%i)",i); | 267 | qDebug("optionChanged(%i)",i); |
269 | searchStringChanged(); | 268 | searchStringChanged(); |
270 | } | 269 | } |
diff --git a/core/pim/osearch/opie-osearch.control b/core/pim/osearch/opie-osearch.control index d7e3310..9f1bf5f 100644 --- a/core/pim/osearch/opie-osearch.control +++ b/core/pim/osearch/opie-osearch.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Packagename: opie-osearch | 1 | Packagename: opie-osearch |
2 | Files: bin/osearch apps/1Pim/osearch.desktop pics/osearch/OSearch.png | 2 | Files: bin/osearch apps/1Pim/osearch.desktop pics/osearch/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/ | 4 | Section: opie/ |
5 | Maintainer: Patrick S. Vogt <tille@handhelds.org> | 5 | Maintainer: Patrick S. Vogt <tille@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | 7 | Version: $QPE_VERSION-$SUB_VERSION |
8 | Depends: task-opie-minimal | 8 | Depends: task-opie-minimal |
9 | Description: search... | 9 | Description: search... |
10 | 10 | ||