summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/doclnkitem.cpp6
-rw-r--r--core/pim/osearch/mainwindow.cpp7
2 files changed, 3 insertions, 10 deletions
diff --git a/core/pim/osearch/doclnkitem.cpp b/core/pim/osearch/doclnkitem.cpp
index a1d0384..56eb26a 100644
--- a/core/pim/osearch/doclnkitem.cpp
+++ b/core/pim/osearch/doclnkitem.cpp
@@ -1,79 +1,79 @@
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 <qpe/applnk.h> 15#include <qpe/applnk.h>
16#include <qfile.h> 16#include <qfile.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#include <qfileinfo.h> 18#include <qfileinfo.h>
19#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20 20
21DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app) 21DocLnkItem::DocLnkItem(OListViewItem* parent, DocLnk *app)
22 : ResultItem(parent) 22 : ResultItem(parent)
23{ 23{
24 _doc = app; 24 _doc = app;
25 setText(0, _doc->name() ); 25 setText(0, _doc->name() );
26 setPixmap(0, _doc->pixmap() ); 26 setPixmap(0, _doc->pixmap() );
27} 27}
28 28
29DocLnkItem::~DocLnkItem() 29DocLnkItem::~DocLnkItem()
30{ 30{
31} 31}
32 32
33QString DocLnkItem::toRichText() 33QString DocLnkItem::toRichText()
34{ 34{
35 QString text; 35 QString text;
36 text += "<b><h3>" + _doc->name() + "</b></h3><br>"; 36 text += "<b><h3>" + _doc->name() + "</b></h3><br>";
37 text += _doc->comment() + "<br>"; 37 text += _doc->comment() + "<br>";
38 text += "File: " + _doc->file() + "<br>"; 38 text += QObject::tr("File: ") + _doc->file() + "<br>";
39 text += "Link: " + _doc->linkFile() + "<br>"; 39 text += QObject::tr("Link: ") + _doc->linkFile() + "<br>";
40 text += "Mimetype: " + _doc->type() + "<br>"; 40 text += QObject::tr("Mimetype: ") + _doc->type() + "<br>";
41 if ( _doc->type().contains( "text" ) ){ 41 if ( _doc->type().contains( "text" ) ){
42 text += "<br><br><hr><br>"; 42 text += "<br><br><hr><br>";
43 QFile f(_doc->file()); 43 QFile f(_doc->file());
44 if ( f.open(IO_ReadOnly) ) { 44 if ( f.open(IO_ReadOnly) ) {
45 QTextStream t( &f ); 45 QTextStream t( &f );
46 while ( !t.eof() ) 46 while ( !t.eof() )
47 text += t.readLine() + "<br>"; 47 text += t.readLine() + "<br>";
48 } 48 }
49 f.close(); 49 f.close();
50 } 50 }
51 /* text += "<br><br>`"; 51 /* text += "<br><br>`";
52 text += _doc->exec(); 52 text += _doc->exec();
53 text += "`";*/ 53 text += "`";*/
54 QStringList list = _doc->mimeTypes(); 54 QStringList list = _doc->mimeTypes();
55 int i = 0; 55 int i = 0;
56 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 56 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
57 text += QString::number( i++) + " - " + *it ; 57 text += QString::number( i++) + " - " + *it ;
58 } 58 }
59 return text; 59 return text;
60} 60}
61 61
62void DocLnkItem::action( int act ) 62void DocLnkItem::action( int act )
63{ 63{
64 qDebug("action %i",act); 64 qDebug("action %i",act);
65 if (!_doc->isValid()) qDebug("INVALID"); 65 if (!_doc->isValid()) qDebug("INVALID");
66 if (act == 0) _doc->execute(); 66 if (act == 0) _doc->execute();
67 else if (act == 1){ 67 else if (act == 1){
68 QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)"); 68 QCopEnvelope e("QPE/Application/advancedfm", "setDocument(QString)");
69 e << _doc->file(); 69 e << _doc->file();
70 } 70 }
71} 71}
72 72
73QIntDict<QString> DocLnkItem::actions() 73QIntDict<QString> DocLnkItem::actions()
74{ 74{
75 QIntDict<QString> result; 75 QIntDict<QString> result;
76 result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) ); 76 result.insert( 0, new QString( QObject::tr("open with ") + _doc->exec() ) );
77 result.insert( 1, new QString( QObject::tr("open in filemanager") ) ); 77 result.insert( 1, new QString( QObject::tr("open in filemanager") ) );
78 return result; 78 return result;
79} 79}
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index adce926..2936b17 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,269 +1,262 @@
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
48MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 48MainWindow::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::MinimumExpanding, QSizePolicy::MinimumExpanding)); 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 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
57 57
58 mainLayout = new QVBoxLayout( mainFrame ); 58 mainLayout = new QVBoxLayout( mainFrame );
59 mainLayout->setSpacing( 0 ); 59 mainLayout->setSpacing( 0 );
60 mainLayout->setMargin( 0 ); 60 mainLayout->setMargin( 0 );
61 61
62 resultsList = new OListView( mainFrame ); 62 resultsList = new OListView( mainFrame );
63 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 63 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
64 mainLayout->addWidget( resultsList ); 64 mainLayout->addWidget( resultsList );
65 65
66 detailsFrame = new QFrame( mainFrame, "detailsFrame" ); 66 detailsFrame = new QFrame( mainFrame, "detailsFrame" );
67 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); 67 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
68 richEdit = new QTextView( detailsFrame ); 68 richEdit = new QTextView( detailsFrame );
69 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 69 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
70 detailsLayout->addWidget( richEdit ); 70 detailsLayout->addWidget( richEdit );
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 75
76 buttonLayout = new QHBoxLayout( detailsFrame ); 76 buttonLayout = new QHBoxLayout( detailsFrame );
77 detailsLayout->addLayout( buttonLayout ); 77 detailsLayout->addLayout( buttonLayout );
78 78
79 mainLayout->addWidget( detailsFrame ); 79 mainLayout->addWidget( detailsFrame );
80 detailsFrame->hide(); 80 detailsFrame->hide();
81 81
82 searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); 82 searches.append( new AppLnkSearch( resultsList, tr("applications") ) );
83 searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); 83 searches.append( new DocLnkSearch( resultsList, tr("documents") ) );
84 searches.append( new TodoSearch( resultsList, tr("todo") ) ); 84 searches.append( new TodoSearch( resultsList, tr("todo") ) );
85 searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); 85 searches.append( new DatebookSearch( resultsList, tr("datebook") ) );
86 searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); 86 searches.append( new AdressSearch( resultsList, tr("adressbook") ) );
87 87
88 setCentralWidget( mainFrame ); 88 setCentralWidget( mainFrame );
89 89
90 popupTimer = new QTimer(); 90 popupTimer = new QTimer();
91 searchTimer = new QTimer(); 91 searchTimer = new QTimer();
92 92
93 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 93 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
94 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); 94 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
95 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 95 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
96 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 96 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
97 connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); 97 connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) );
98 98
99 makeMenu(); 99 makeMenu();
100 100
101 Config cfg( "osearch", Config::User ); 101 Config cfg( "osearch", Config::User );
102 cfg.setGroup( "search_settings" ); 102 cfg.setGroup( "search_settings" );
103 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); 103 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
104 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); 104 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
105// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); 105// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
106} 106}
107 107
108void MainWindow::makeMenu() 108void MainWindow::makeMenu()
109{ 109{
110 QPEToolBar *toolBar = new QPEToolBar( this ); 110 QPEToolBar *toolBar = new QPEToolBar( this );
111 QPEToolBar *searchBar = new QPEToolBar(this); 111 QPEToolBar *searchBar = new QPEToolBar(this);
112 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 112 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
113 QPopupMenu *searchMenu = new QPopupMenu( menuBar ); 113 QPopupMenu *searchMenu = new QPopupMenu( menuBar );
114// QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 114// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
115 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 115 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
116 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); 116 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
117 117
118 setToolBarsMovable( false ); 118 setToolBarsMovable( false );
119 toolBar->setHorizontalStretchable( true ); 119 toolBar->setHorizontalStretchable( true );
120 menuBar->insertItem( tr( "Search" ), searchMenu ); 120 menuBar->insertItem( tr( "Search" ), searchMenu );
121 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 121 menuBar->insertItem( tr( "Settings" ), cfgMenu );
122 122
123 //SETTINGS MENU 123 //SETTINGS MENU
124 cfgMenu->insertItem( tr( "Search" ), searchOptions ); 124 cfgMenu->insertItem( tr( "Search" ), searchOptions );
125 QPopupMenu *pop; 125 QPopupMenu *pop;
126 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 126 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
127 pop = s->popupMenu(); 127 pop = s->popupMenu();
128 if (pop){ 128 if (pop){
129 qDebug("inserting settings menu for %s",s->text(0).latin1());
130 cfgMenu->insertItem( s->text(0), pop ); 129 cfgMenu->insertItem( s->text(0), pop );
131 //connect( pop, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) );
132 } 130 }
133 } 131 }
134 132
135 133
136 //SEARCH 134 //SEARCH
137 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 135 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
138 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 136 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
139 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 137 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
140 SearchAllAction->addTo( searchMenu ); 138 SearchAllAction->addTo( searchMenu );
141 searchMenu->insertItem( tr( "Options" ), searchOptions ); 139 searchMenu->insertItem( tr( "Options" ), searchOptions );
142 //connect( searchOptions, SIGNAL( activated(int) ), SLOT( optionChanged(int) ) );
143 140
144 //SEARCH OPTIONS 141 //SEARCH OPTIONS
145 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); 142 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
146 //actionWholeWordsOnly->addTo( searchOptions ); 143 //actionWholeWordsOnly->addTo( searchOptions );
147 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); 144 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
148 actionCaseSensitiv->addTo( searchOptions ); 145 actionCaseSensitiv->addTo( searchOptions );
149 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); 146 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
150 actionWildcards->addTo( searchOptions ); 147 actionWildcards->addTo( searchOptions );
151 148
152 //SEARCH BAR 149 //SEARCH BAR
153 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 150 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
154 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 151 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
155 searchEdit->setFocus(); 152 searchEdit->setFocus();
156 searchBar->setHorizontalStretchable( TRUE ); 153 searchBar->setHorizontalStretchable( TRUE );
157 searchBar->setStretchableWidget( searchEdit ); 154 searchBar->setStretchableWidget( searchEdit );
158 SearchAllAction->addTo( searchBar ); 155 SearchAllAction->addTo( searchBar );
159 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 156 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
160 this, SLOT( setSearch( const QString & ) ) ); 157 this, SLOT( setSearch( const QString & ) ) );
161 158
162} 159}
163 160
164MainWindow::~MainWindow() 161MainWindow::~MainWindow()
165{ 162{
166 Config cfg( "osearch", Config::User ); 163 Config cfg( "osearch", Config::User );
167 cfg.setGroup( "search_settings" ); 164 cfg.setGroup( "search_settings" );
168 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 165 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
169 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 166 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
170 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 167 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
171} 168}
172 169
173void MainWindow::setCurrent(QListViewItem *item) 170void MainWindow::setCurrent(QListViewItem *item)
174{ 171{
175 if (!item) return; 172 if (!item) return;
176 _currentItem = (OListViewItem*)item; 173 _currentItem = (OListViewItem*)item;
177 //_currentItem = dynamic_cast<OListViewItem*>(item); 174 //_currentItem = dynamic_cast<OListViewItem*>(item);
178 if (_currentItem->rtti() == OListViewItem::Result){ 175 if (_currentItem->rtti() == OListViewItem::Result){
179 ResultItem *res = (ResultItem*)item; 176 ResultItem *res = (ResultItem*)item;
180 // ResultItem *res = dynamic_cast<ResultItem*>(item); 177 // ResultItem *res = dynamic_cast<ResultItem*>(item);
181 richEdit->setText( res->toRichText() ); 178 richEdit->setText( res->toRichText() );
182 QIntDict<QString> acts = res->actions(); 179 QIntDict<QString> acts = res->actions();
183 QButton *button; 180 QButton *button;
184 for (uint i = 0; i < acts.count(); i++){ 181 for (uint i = 0; i < acts.count(); i++){
185 button = buttonGroupActions->find( i ); 182 button = buttonGroupActions->find( i );
186 qDebug("action %i >%s<",i,acts[i]->latin1());
187 if (!button) { 183 if (!button) {
188 qDebug("BUTTON");
189 button = new QPushButton( detailsFrame ); 184 button = new QPushButton( detailsFrame );
190 buttonLayout->addWidget( button, 0 ); 185 buttonLayout->addWidget( button, 0 );
191 buttonGroupActions->insert( button, i); 186 buttonGroupActions->insert( button, i);
192 } 187 }
193 button->setText( *acts[i] ); 188 button->setText( *acts[i] );
194 button->show(); 189 button->show();
195 } 190 }
196 for (uint i = acts.count(); i < _buttonCount; i++){ 191 for (uint i = acts.count(); i < _buttonCount; i++){
197 qDebug("remove button %i of %i",i, _buttonCount);
198 button = buttonGroupActions->find( i ); 192 button = buttonGroupActions->find( i );
199 if (button) button->hide(); 193 if (button) button->hide();
200 } 194 }
201 _buttonCount = acts.count(); 195 _buttonCount = acts.count();
202 detailsFrame->show(); 196 detailsFrame->show();
203 }else detailsFrame->hide(); 197 }else detailsFrame->hide();
204 popupTimer->start( 300, true ); 198 popupTimer->start( 300, true );
205} 199}
206 200
207void MainWindow::stopTimer(QListViewItem*) 201void MainWindow::stopTimer(QListViewItem*)
208{ 202{
209 popupTimer->stop(); 203 popupTimer->stop();
210} 204}
211 205
212void MainWindow::showPopup() 206void MainWindow::showPopup()
213{ 207{
214 popupTimer->stop(); 208 popupTimer->stop();
215 if (!_currentItem) return; 209 if (!_currentItem) return;
216 QPopupMenu *pop = _currentItem->popupMenu(); 210 QPopupMenu *pop = _currentItem->popupMenu();
217 if (pop) pop->popup( QCursor::pos() ); 211 if (pop) pop->popup( QCursor::pos() );
218} 212}
219 213
220void MainWindow::setSearch( const QString &key ) 214void MainWindow::setSearch( const QString &key )
221{ 215{
222 searchTimer->stop(); 216 searchTimer->stop();
223 _searchString = key; 217 _searchString = key;
224 searchTimer->start( 300 ); 218 searchTimer->start( 300 );
225} 219}
226 220
227void MainWindow::searchStringChanged() 221void MainWindow::searchStringChanged()
228{ 222{
229#ifdef NEW_OWAIT 223#ifdef NEW_OWAIT
230 OWait("setting search string"); 224 OWait("setting search string");
231#endif 225#endif
232 searchTimer->stop(); 226 searchTimer->stop();
233 QString ss = _searchString; 227 QString ss = _searchString;
234 //ss = Global::stringQuote( _searchString ); 228 //ss = Global::stringQuote( _searchString );
235 //if (actionWholeWordsOnly->isOn()) 229 //if (actionWholeWordsOnly->isOn())
236 // ss = "\\s"+_searchString+"\\s"; 230 // ss = "\\s"+_searchString+"\\s";
237 //qDebug(" set searchString >%s<",ss.latin1()); 231 //qDebug(" set searchString >%s<",ss.latin1());
238 QRegExp re( ss ); 232 QRegExp re( ss );
239 re.setCaseSensitive( actionCaseSensitiv->isOn() ); 233 re.setCaseSensitive( actionCaseSensitiv->isOn() );
240 re.setWildcard( actionWildcards->isOn() ); 234 re.setWildcard( actionWildcards->isOn() );
241 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) 235 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
242 s->setSearch( re ); 236 s->setSearch( re );
243} 237}
244 238
245void MainWindow::searchAll() 239void MainWindow::searchAll()
246{ 240{
247#ifdef NEW_OWAIT 241#ifdef NEW_OWAIT
248 OWait("searching..."); 242 OWait("searching...");
249#endif 243#endif
250 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 244 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
251 s->doSearch(); 245 s->doSearch();
252 //resultsList->repaint(); 246 //resultsList->repaint();
253 } 247 }
254} 248}
255 249
256void MainWindow::slotAction( int act ) 250void MainWindow::slotAction( int act )
257{ 251{
258 if (_currentItem->rtti() == OListViewItem::Result){ 252 if (_currentItem->rtti() == OListViewItem::Result){
259 ResultItem *res = (ResultItem*)_currentItem; 253 ResultItem *res = (ResultItem*)_currentItem;
260 // ResultItem *res = dynamic_cast<ResultItem*>(item); 254 // ResultItem *res = dynamic_cast<ResultItem*>(item);
261 res->action(act); 255 res->action(act);
262 } 256 }
263} 257}
264 258
265void MainWindow::optionChanged(int i) 259void MainWindow::optionChanged(int i)
266{ 260{
267 qDebug("optionChanged(%i)",i);
268 searchStringChanged(); 261 searchStringChanged();
269} 262}