summaryrefslogtreecommitdiff
authortille <tille>2003-05-16 19:36:33 (UTC)
committer tille <tille>2003-05-16 19:36:33 (UTC)
commit87051a7ba4834aed152bc09aad7f4935c9729ccb (patch) (unidiff)
tree85c2b2274efede684b1914a4e4a1b2c87bddf6b3
parent1ac65aca5d1219e537238330501bc441dd2a3324 (diff)
downloadopie-87051a7ba4834aed152bc09aad7f4935c9729ccb.zip
opie-87051a7ba4834aed152bc09aad7f4935c9729ccb.tar.gz
opie-87051a7ba4834aed152bc09aad7f4935c9729ccb.tar.bz2
and some whatsthis
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/adresssearch.cpp3
-rw-r--r--core/pim/osearch/contactitem.cpp2
-rw-r--r--core/pim/osearch/mainwindow.cpp24
3 files changed, 16 insertions, 13 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp
index 252fb40..2cd545f 100644
--- a/core/pim/osearch/adresssearch.cpp
+++ b/core/pim/osearch/adresssearch.cpp
@@ -1,58 +1,59 @@
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 "adresssearch.h" 13#include "adresssearch.h"
14 14
15#include <opie/ocontactaccess.h>
16#include <qstring.h> 15#include <qstring.h>
17#include <qiconset.h> 16#include <qiconset.h>
17#include <qwhatsthis.h>
18#include <qpe/resource.h> 18#include <qpe/resource.h>
19#include <opie/ocontactaccess.h>
19 20
20#include "contactitem.h" 21#include "contactitem.h"
21 22
22AdressSearch::AdressSearch(QListView* parent, QString name): 23AdressSearch::AdressSearch(QListView* parent, QString name):
23 SearchGroup(parent, name) 24 SearchGroup(parent, name)
24{ 25{
25 _contacts = 0; 26 _contacts = 0;
26 QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); 27 QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" );
27 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 28 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
28 /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); 29 /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" );
29 QImage img = pix.convertToImage(); 30 QImage img = pix.convertToImage();
30 img.smoothScale( 14, 14 ); 31 img.smoothScale( 14, 14 );
31 pix.convertFromImage( img ); 32 pix.convertFromImage( img );
32 setPixmap( 0, pix );*/ 33 setPixmap( 0, pix );*/
33} 34}
34 35
35 36
36AdressSearch::~AdressSearch() 37AdressSearch::~AdressSearch()
37{ 38{
38 delete _contacts; 39 delete _contacts;
39} 40}
40 41
41void AdressSearch::load() 42void AdressSearch::load()
42{ 43{
43 _contacts = new OContactAccess("osearch"); 44 _contacts = new OContactAccess("osearch");
44} 45}
45 46
46int AdressSearch::search() 47int AdressSearch::search()
47{ 48{
48 ORecordList<OContact> results = _contacts->matchRegexp(_search); 49 ORecordList<OContact> results = _contacts->matchRegexp(_search);
49 for (uint i = 0; i < results.count(); i++) { 50 for (uint i = 0; i < results.count(); i++) {
50 new ContactItem( this, new OContact( results[i] )); 51 new ContactItem( this, new OContact( results[i] ));
51 } 52 }
52 return results.count(); 53 return results.count();
53} 54}
54 55
55void AdressSearch::insertItem( void* ) 56void AdressSearch::insertItem( void* )
56{ 57{
57 58
58} 59}
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp
index 68e0cd4..c4738ae 100644
--- a/core/pim/osearch/contactitem.cpp
+++ b/core/pim/osearch/contactitem.cpp
@@ -1,143 +1,141 @@
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
20ContactItem::ContactItem(OListViewItem* parent, OContact *contact) 20ContactItem::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
28void ContactItem::setIcon() 28void 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" );
46 break;
47 case Qtopia::Emails: 45 case Qtopia::Emails:
48 icon = Resource::loadPixmap( "addressbook/email" ); 46 icon = Resource::loadPixmap( "addressbook/email" );
49 break; 47 break;
50 case Qtopia::HomePhone: 48 case Qtopia::HomePhone:
51 icon = Resource::loadPixmap( "addressbook/phonehome" ); 49 icon = Resource::loadPixmap( "addressbook/phonehome" );
52 break; 50 break;
53 case Qtopia::HomeFax: 51 case Qtopia::HomeFax:
54 icon = Resource::loadPixmap( "addressbook/faxhome" ); 52 icon = Resource::loadPixmap( "addressbook/faxhome" );
55 break; 53 break;
56 case Qtopia::HomeMobile: 54 case Qtopia::HomeMobile:
57 icon = Resource::loadPixmap( "addressbook/mobilehome" ); 55 icon = Resource::loadPixmap( "addressbook/mobilehome" );
58 break; 56 break;
59 case Qtopia::HomeWebPage: 57 case Qtopia::HomeWebPage:
60 icon = Resource::loadPixmap( "addressbook/webpagehome" ); 58 icon = Resource::loadPixmap( "addressbook/webpagehome" );
61 break; 59 break;
62 case Qtopia::BusinessWebPage: 60 case Qtopia::BusinessWebPage:
63 icon = Resource::loadPixmap( "addressbook/webpagework" ); 61 icon = Resource::loadPixmap( "addressbook/webpagework" );
64 break; 62 break;
65 case Qtopia::Title: 63 case Qtopia::Title:
66 case Qtopia::JobTitle: 64 case Qtopia::JobTitle:
67 case Qtopia::FirstName: 65 case Qtopia::FirstName:
68 case Qtopia::MiddleName: 66 case Qtopia::MiddleName:
69 case Qtopia::LastName: 67 case Qtopia::LastName:
70 case Qtopia::Suffix: 68 case Qtopia::Suffix:
71 case Qtopia::Nickname: 69 case Qtopia::Nickname:
72 case Qtopia::FileAs: 70 case Qtopia::FileAs:
73 icon = Resource::loadPixmap( "addressbook/identity" ); 71 icon = Resource::loadPixmap( "addressbook/identity" );
74 break; 72 break;
75 case Qtopia::HomeStreet: 73 case Qtopia::HomeStreet:
76 case Qtopia::HomeCity: 74 case Qtopia::HomeCity:
77 case Qtopia::HomeState: 75 case Qtopia::HomeState:
78 case Qtopia::HomeZip: 76 case Qtopia::HomeZip:
79 case Qtopia::HomeCountry: 77 case Qtopia::HomeCountry:
80 icon = Resource::loadPixmap( "osearch/addresshome" ); 78 icon = Resource::loadPixmap( "osearch/addresshome" );
81 break; 79 break;
82 case Qtopia::Company: 80 case Qtopia::Company:
83 case Qtopia::BusinessCity: 81 case Qtopia::BusinessCity:
84 case Qtopia::BusinessStreet: 82 case Qtopia::BusinessStreet:
85 case Qtopia::BusinessZip: 83 case Qtopia::BusinessZip:
86 case Qtopia::BusinessCountry: 84 case Qtopia::BusinessCountry:
87 case Qtopia::Department: 85 case Qtopia::Department:
88 case Qtopia::Office: 86 case Qtopia::Office:
89 case Qtopia::Manager: 87 case Qtopia::Manager:
90 case Qtopia::BusinessPager: 88 case Qtopia::BusinessPager:
91 case Qtopia::Profession: 89 case Qtopia::Profession:
92 icon = Resource::loadPixmap( "osearch/addresshome" ); 90 icon = Resource::loadPixmap( "osearch/addresshome" );
93 break; 91 break;
94 case Qtopia::Assistant: 92 case Qtopia::Assistant:
95 case Qtopia::Spouse: 93 case Qtopia::Spouse:
96 case Qtopia::Children: 94 case Qtopia::Children:
97 icon = Resource::loadPixmap( "osearch/personal" ); 95 icon = Resource::loadPixmap( "osearch/personal" );
98 break; 96 break;
99 case Qtopia::Birthday: 97 case Qtopia::Birthday:
100 case Qtopia::Anniversary: 98 case Qtopia::Anniversary:
101 icon = Resource::loadPixmap( "osearch/clock" ); 99 icon = Resource::loadPixmap( "osearch/clock" );
102 break; 100 break;
103 case Qtopia::Notes: 101 case Qtopia::Notes:
104 icon = Resource::loadPixmap( "txt" ); 102 icon = Resource::loadPixmap( "txt" );
105 break; 103 break;
106 default: 104 default:
107 icon = Resource::loadPixmap( "DocsIcon" ); 105 icon = Resource::loadPixmap( "DocsIcon" );
108 break; 106 break;
109 } 107 }
110 setPixmap( 0, icon ); 108 setPixmap( 0, icon );
111} 109}
112 110
113ContactItem::~ContactItem() 111ContactItem::~ContactItem()
114{ 112{
115 delete _contact; 113 delete _contact;
116} 114}
117 115
118 116
119QString ContactItem::toRichText() 117QString ContactItem::toRichText()
120{ 118{
121 return _contact->toRichText(); 119 return _contact->toRichText();
122} 120}
123 121
124void ContactItem::action( int act ) 122void ContactItem::action( int act )
125{ 123{
126if (act == 0){ 124if (act == 0){
127 QCopEnvelope e("QPE/Application/addressbook", "show(int)"); 125 QCopEnvelope e("QPE/Application/addressbook", "show(int)");
128 e << _contact->uid(); 126 e << _contact->uid();
129}else if(act == 1){ 127}else if(act == 1){
130 QCopEnvelope e("QPE/Application/addressbook", "edit(int)"); 128 QCopEnvelope e("QPE/Application/addressbook", "edit(int)");
131 e << _contact->uid(); 129 e << _contact->uid();
132} 130}
133 131
134} 132}
135 133
136QIntDict<QString> ContactItem::actions() 134QIntDict<QString> ContactItem::actions()
137{ 135{
138 QIntDict<QString> result; 136 QIntDict<QString> result;
139 result.insert( 0, new QString( QObject::tr("show") ) ); 137 result.insert( 0, new QString( QObject::tr("show") ) );
140 result.insert( 1, new QString( QObject::tr("edit") ) ); 138 result.insert( 1, new QString( QObject::tr("edit") ) );
141 return result; 139 return result;
142 140
143} 141}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 2936b17..c6934db 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,262 +1,266 @@
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"
14 13
15#include <qpe/qpemenubar.h>
16#include <qpe/qpemessagebox.h>
17#include <qpe/resource.h>
18#include <qpe/config.h>
19#include <qpe/qpetoolbar.h>
20#include <qpe/qpeapplication.h>
21#include <qpe/config.h>
22#include <qpe/global.h>
23#include <opie/owait.h>
24#include <qaction.h> 14#include <qaction.h>
25#include <qmessagebox.h> 15#include <qmessagebox.h>
26#include <qpopupmenu.h> 16#include <qpopupmenu.h>
27#include <qtoolbutton.h> 17#include <qtoolbutton.h>
28#include <qstring.h> 18#include <qstring.h>
29#include <qlabel.h> 19#include <qlabel.h>
30#include <qfile.h> 20#include <qfile.h>
31#include <qhbuttongroup.h> 21#include <qhbuttongroup.h>
32#include <qpushbutton.h> 22#include <qpushbutton.h>
33#include <qintdict.h> 23#include <qintdict.h>
34#include <qlayout.h> 24#include <qlayout.h>
35#include <qlineedit.h> 25#include <qlineedit.h>
36#include <qtextbrowser.h> 26#include <qtextbrowser.h>
37#include <qregexp.h> 27#include <qregexp.h>
28#include <qwhatsthis.h>
29#include <qpe/qpemenubar.h>
30#include <qpe/qpemessagebox.h>
31#include <qpe/resource.h>
32#include <qpe/config.h>
33#include <qpe/qpetoolbar.h>
34#include <qpe/qpeapplication.h>
35#include <qpe/config.h>
36#include <qpe/global.h>
37#include <opie/owait.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#include "mainwindow.h"
47 48
48MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 49MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
49 QMainWindow( parent, name, f ), _currentItem(0) 50 QMainWindow( parent, name, f ), _currentItem(0)
50{ 51{
51 setCaption( tr("OSearch") ); 52 setCaption( tr("OSearch") );
52 53
53 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 54 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
54 55
55 QFrame *mainFrame = new QFrame( this, "mainFrame" ); 56 QFrame *mainFrame = new QFrame( this, "mainFrame" );
56 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 57 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
57 58
58 mainLayout = new QVBoxLayout( mainFrame ); 59 mainLayout = new QVBoxLayout( mainFrame );
59 mainLayout->setSpacing( 0 ); 60 mainLayout->setSpacing( 0 );
60 mainLayout->setMargin( 0 ); 61 mainLayout->setMargin( 0 );
61 62
62 resultsList = new OListView( mainFrame ); 63 resultsList = new OListView( mainFrame );
63 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 64 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
64 mainLayout->addWidget( resultsList ); 65 mainLayout->addWidget( resultsList );
65 66
66 detailsFrame = new QFrame( mainFrame, "detailsFrame" ); 67 detailsFrame = new QFrame( mainFrame, "detailsFrame" );
67 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); 68 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
68 richEdit = new QTextView( detailsFrame ); 69 richEdit = new QTextView( detailsFrame );
70 QWhatsThis::add( richEdit, tr("The details of the current result") );
69 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 71 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
70 detailsLayout->addWidget( richEdit ); 72 detailsLayout->addWidget( richEdit );
71 73
72 buttonGroupActions = new QHButtonGroup( this ); 74 buttonGroupActions = new QHButtonGroup( this );
73 buttonGroupActions->hide(); 75 buttonGroupActions->hide();
74 _buttonCount = 0; 76 _buttonCount = 0;
75 77
76 buttonLayout = new QHBoxLayout( detailsFrame ); 78 buttonLayout = new QHBoxLayout( detailsFrame );
77 detailsLayout->addLayout( buttonLayout ); 79 detailsLayout->addLayout( buttonLayout );
78 80
79 mainLayout->addWidget( detailsFrame ); 81 mainLayout->addWidget( detailsFrame );
80 detailsFrame->hide(); 82 detailsFrame->hide();
81 83
82 searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); 84 searches.append( new AppLnkSearch( resultsList, tr("applications") ) );
83 searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); 85 searches.append( new DocLnkSearch( resultsList, tr("documents") ) );
84 searches.append( new TodoSearch( resultsList, tr("todo") ) ); 86 searches.append( new TodoSearch( resultsList, tr("todo") ) );
85 searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); 87 searches.append( new DatebookSearch( resultsList, tr("datebook") ) );
86 searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); 88 searches.append( new AdressSearch( resultsList, tr("adressbook") ) );
87 89
88 setCentralWidget( mainFrame ); 90 setCentralWidget( mainFrame );
89 91
90 popupTimer = new QTimer(); 92 popupTimer = new QTimer();
91 searchTimer = new QTimer(); 93 searchTimer = new QTimer();
92 94
93 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 95 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
94 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); 96 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
95 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 97 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
96 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 98 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
97 connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); 99 connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) );
98 100
99 makeMenu(); 101 makeMenu();
100 102
101 Config cfg( "osearch", Config::User ); 103 Config cfg( "osearch", Config::User );
102 cfg.setGroup( "search_settings" ); 104 cfg.setGroup( "search_settings" );
103 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); 105 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
104 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); 106 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
105// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); 107// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
106} 108}
107 109
108void MainWindow::makeMenu() 110void MainWindow::makeMenu()
109{ 111{
110 QPEToolBar *toolBar = new QPEToolBar( this ); 112 QPEToolBar *toolBar = new QPEToolBar( this );
111 QPEToolBar *searchBar = new QPEToolBar(this); 113 QPEToolBar *searchBar = new QPEToolBar(this);
112 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 114 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
113 QPopupMenu *searchMenu = new QPopupMenu( menuBar ); 115 QPopupMenu *searchMenu = new QPopupMenu( menuBar );
114// QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 116// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
115 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 117 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
116 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); 118 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
117 119
118 setToolBarsMovable( false ); 120 setToolBarsMovable( false );
119 toolBar->setHorizontalStretchable( true ); 121 toolBar->setHorizontalStretchable( true );
120 menuBar->insertItem( tr( "Search" ), searchMenu ); 122 menuBar->insertItem( tr( "Search" ), searchMenu );
121 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 123 menuBar->insertItem( tr( "Settings" ), cfgMenu );
122 124
123 //SETTINGS MENU 125 //SETTINGS MENU
124 cfgMenu->insertItem( tr( "Search" ), searchOptions ); 126 cfgMenu->insertItem( tr( "Search" ), searchOptions );
125 QPopupMenu *pop; 127 QPopupMenu *pop;
126 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 128 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
127 pop = s->popupMenu(); 129 pop = s->popupMenu();
128 if (pop){ 130 if (pop){
129 cfgMenu->insertItem( s->text(0), pop ); 131 cfgMenu->insertItem( s->text(0), pop );
130 } 132 }
131 } 133 }
132 134
133 135
134 //SEARCH 136 //SEARCH
135 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 137 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
136 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 138 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
139 // QWhatsThis::add( SearchAllAction, tr("Search everything...") );
137 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 140 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
138 SearchAllAction->addTo( searchMenu ); 141 SearchAllAction->addTo( searchMenu );
139 searchMenu->insertItem( tr( "Options" ), searchOptions ); 142 searchMenu->insertItem( tr( "Options" ), searchOptions );
140 143
141 //SEARCH OPTIONS 144 //SEARCH OPTIONS
142 //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 );
143 //actionWholeWordsOnly->addTo( searchOptions ); 146 //actionWholeWordsOnly->addTo( searchOptions );
144 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 );
145 actionCaseSensitiv->addTo( searchOptions ); 148 actionCaseSensitiv->addTo( searchOptions );
146 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 );
147 actionWildcards->addTo( searchOptions ); 150 actionWildcards->addTo( searchOptions );
148 151
149 //SEARCH BAR 152 //SEARCH BAR
150 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 153 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
151 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 154 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
155 QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
152 searchEdit->setFocus(); 156 searchEdit->setFocus();
153 searchBar->setHorizontalStretchable( TRUE ); 157 searchBar->setHorizontalStretchable( TRUE );
154 searchBar->setStretchableWidget( searchEdit ); 158 searchBar->setStretchableWidget( searchEdit );
155 SearchAllAction->addTo( searchBar ); 159 SearchAllAction->addTo( searchBar );
156 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 160 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
157 this, SLOT( setSearch( const QString & ) ) ); 161 this, SLOT( setSearch( const QString & ) ) );
158 162
159} 163}
160 164
161MainWindow::~MainWindow() 165MainWindow::~MainWindow()
162{ 166{
163 Config cfg( "osearch", Config::User ); 167 Config cfg( "osearch", Config::User );
164 cfg.setGroup( "search_settings" ); 168 cfg.setGroup( "search_settings" );
165 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 169 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
166 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 170 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
167 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 171 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
168} 172}
169 173
170void MainWindow::setCurrent(QListViewItem *item) 174void MainWindow::setCurrent(QListViewItem *item)
171{ 175{
172 if (!item) return; 176 if (!item) return;
173 _currentItem = (OListViewItem*)item; 177 _currentItem = (OListViewItem*)item;
174 //_currentItem = dynamic_cast<OListViewItem*>(item); 178 //_currentItem = dynamic_cast<OListViewItem*>(item);
175 if (_currentItem->rtti() == OListViewItem::Result){ 179 if (_currentItem->rtti() == OListViewItem::Result){
176 ResultItem *res = (ResultItem*)item; 180 ResultItem *res = (ResultItem*)item;
177 // ResultItem *res = dynamic_cast<ResultItem*>(item); 181 // ResultItem *res = dynamic_cast<ResultItem*>(item);
178 richEdit->setText( res->toRichText() ); 182 richEdit->setText( res->toRichText() );
179 QIntDict<QString> acts = res->actions(); 183 QIntDict<QString> acts = res->actions();
180 QButton *button; 184 QButton *button;
181 for (uint i = 0; i < acts.count(); i++){ 185 for (uint i = 0; i < acts.count(); i++){
182 button = buttonGroupActions->find( i ); 186 button = buttonGroupActions->find( i );
183 if (!button) { 187 if (!button) {
184 button = new QPushButton( detailsFrame ); 188 button = new QPushButton( detailsFrame );
185 buttonLayout->addWidget( button, 0 ); 189 buttonLayout->addWidget( button, 0 );
186 buttonGroupActions->insert( button, i); 190 buttonGroupActions->insert( button, i);
187 } 191 }
188 button->setText( *acts[i] ); 192 button->setText( *acts[i] );
189 button->show(); 193 button->show();
190 } 194 }
191 for (uint i = acts.count(); i < _buttonCount; i++){ 195 for (uint i = acts.count(); i < _buttonCount; i++){
192 button = buttonGroupActions->find( i ); 196 button = buttonGroupActions->find( i );
193 if (button) button->hide(); 197 if (button) button->hide();
194 } 198 }
195 _buttonCount = acts.count(); 199 _buttonCount = acts.count();
196 detailsFrame->show(); 200 detailsFrame->show();
197 }else detailsFrame->hide(); 201 }else detailsFrame->hide();
198 popupTimer->start( 300, true ); 202 popupTimer->start( 300, true );
199} 203}
200 204
201void MainWindow::stopTimer(QListViewItem*) 205void MainWindow::stopTimer(QListViewItem*)
202{ 206{
203 popupTimer->stop(); 207 popupTimer->stop();
204} 208}
205 209
206void MainWindow::showPopup() 210void MainWindow::showPopup()
207{ 211{
208 popupTimer->stop(); 212 popupTimer->stop();
209 if (!_currentItem) return; 213 if (!_currentItem) return;
210 QPopupMenu *pop = _currentItem->popupMenu(); 214 QPopupMenu *pop = _currentItem->popupMenu();
211 if (pop) pop->popup( QCursor::pos() ); 215 if (pop) pop->popup( QCursor::pos() );
212} 216}
213 217
214void MainWindow::setSearch( const QString &key ) 218void MainWindow::setSearch( const QString &key )
215{ 219{
216 searchTimer->stop(); 220 searchTimer->stop();
217 _searchString = key; 221 _searchString = key;
218 searchTimer->start( 300 ); 222 searchTimer->start( 300 );
219} 223}
220 224
221void MainWindow::searchStringChanged() 225void MainWindow::searchStringChanged()
222{ 226{
223#ifdef NEW_OWAIT 227#ifdef NEW_OWAIT
224 OWait("setting search string"); 228 OWait("setting search string");
225#endif 229#endif
226 searchTimer->stop(); 230 searchTimer->stop();
227 QString ss = _searchString; 231 QString ss = _searchString;
228 //ss = Global::stringQuote( _searchString ); 232 //ss = Global::stringQuote( _searchString );
229 //if (actionWholeWordsOnly->isOn()) 233 //if (actionWholeWordsOnly->isOn())
230 // ss = "\\s"+_searchString+"\\s"; 234 // ss = "\\s"+_searchString+"\\s";
231 //qDebug(" set searchString >%s<",ss.latin1()); 235 //qDebug(" set searchString >%s<",ss.latin1());
232 QRegExp re( ss ); 236 QRegExp re( ss );
233 re.setCaseSensitive( actionCaseSensitiv->isOn() ); 237 re.setCaseSensitive( actionCaseSensitiv->isOn() );
234 re.setWildcard( actionWildcards->isOn() ); 238 re.setWildcard( actionWildcards->isOn() );
235 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) 239 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
236 s->setSearch( re ); 240 s->setSearch( re );
237} 241}
238 242
239void MainWindow::searchAll() 243void MainWindow::searchAll()
240{ 244{
241#ifdef NEW_OWAIT 245#ifdef NEW_OWAIT
242 OWait("searching..."); 246 OWait("searching...");
243#endif 247#endif
244 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 248 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
245 s->doSearch(); 249 s->doSearch();
246 //resultsList->repaint(); 250 //resultsList->repaint();
247 } 251 }
248} 252}
249 253
250void MainWindow::slotAction( int act ) 254void MainWindow::slotAction( int act )
251{ 255{
252 if (_currentItem->rtti() == OListViewItem::Result){ 256 if (_currentItem->rtti() == OListViewItem::Result){
253 ResultItem *res = (ResultItem*)_currentItem; 257 ResultItem *res = (ResultItem*)_currentItem;
254 // ResultItem *res = dynamic_cast<ResultItem*>(item); 258 // ResultItem *res = dynamic_cast<ResultItem*>(item);
255 res->action(act); 259 res->action(act);
256 } 260 }
257} 261}
258 262
259void MainWindow::optionChanged(int i) 263void MainWindow::optionChanged(int i)
260{ 264{
261 searchStringChanged(); 265 searchStringChanged();
262} 266}