summaryrefslogtreecommitdiff
authortille <tille>2003-05-12 11:26:06 (UTC)
committer tille <tille>2003-05-12 11:26:06 (UTC)
commit47a67025a4d34635877ece741def266e28e46db8 (patch) (side-by-side diff)
tree4f7e3e9bf4bfe82a217958959d4ab89eb1ae79bd
parentbc87629a1a871888e010f885ee40b2c3d6283ab4 (diff)
downloadopie-47a67025a4d34635877ece741def266e28e46db8.zip
opie-47a67025a4d34635877ece741def266e28e46db8.tar.gz
opie-47a67025a4d34635877ece741def266e28e46db8.tar.bz2
added menus
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/osearch/mainwindow.cpp50
-rw-r--r--core/pim/osearch/mainwindow.h4
-rw-r--r--core/pim/osearch/osearch.pro1
-rw-r--r--core/pim/osearch/searchgroup.cpp15
-rw-r--r--core/pim/osearch/searchgroup.h4
5 files changed, 40 insertions, 34 deletions
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index a0b7b23..e15cc7e 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -32,4 +32,5 @@
#include <qlineedit.h>
#include <qtextbrowser.h>
+#include <qregexp.h>
#include "olistview.h"
@@ -67,20 +68,11 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
buttonGroupActions = new QHButtonGroup( this );
+ buttonGroupActions->hide();
_buttonCount = 0;
// buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
buttonLayout = new QHBoxLayout( detailsFrame );
- buttonGroupActions->hide();
- //buttonLayout->addWidget( buttonGroupActions, 0 );
-
detailsLayout->addLayout( buttonLayout );
- /*
- QPushButton *buttonShow = new QPushButton( detailsFrame, "Show" );
- buttonShow->setText( tr("show") );
- QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" );
- buttonEdit->setText( tr("edit") );
- buttonLayout->addWidget( buttonShow, 0 );
- buttonLayout->addWidget( buttonEdit, 0 );
-*/
+
mainLayout->addWidget( detailsFrame );
detailsFrame->hide();
@@ -101,5 +93,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) );
-// connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) );
}
@@ -107,28 +98,33 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
void MainWindow::makeMenu()
{
-// QPEToolBar *toolBar = new QPEToolBar( this );
-// QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
-// QPopupMenu *searchMenu = new QPopupMenu( menuBar );
+ QPEToolBar *toolBar = new QPEToolBar( this );
+ QPEToolBar *searchBar = new QPEToolBar(this);
+ QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
+ QPopupMenu *searchMenu = new QPopupMenu( menuBar );
// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
// QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
//
setToolBarsMovable( false );
-// toolBar->setHorizontalStretchable( true );
-// menuBar->insertItem( tr( "Search" ), searchMenu );
+ toolBar->setHorizontalStretchable( true );
+ menuBar->insertItem( tr( "Search" ), searchMenu );
// menuBar->insertItem( tr( "View" ), viewMenu );
// menuBar->insertItem( tr( "Settings" ), cfgMenu );
//SEARCH
- QPEToolBar *searchBar = new QPEToolBar(this);
+ QAction *action = new QAction( tr("Search all"),QString::null, 0, this, 0 );
+ connect( action, SIGNAL(activated()), this, SLOT(searchAll()) );
+ action->addTo( searchMenu );
+ actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
+ actionCaseSensitiv->addTo( searchMenu );
+ actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
+ actionWildcards->addTo( searchMenu );
+
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
- QLabel *label = new QLabel( tr("Search: "), searchBar );
-// label->setBackgroundMode( PaletteForeground );
- searchBar->setHorizontalStretchable( TRUE );
QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
+ searchBar->setHorizontalStretchable( TRUE );
searchBar->setStretchableWidget( searchEdit );
connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( setSearch( const QString & ) ) );
-
}
@@ -189,8 +185,16 @@ void MainWindow::showPopup()
void MainWindow::setSearch( const QString &key )
{
+ QRegExp re( key, actionCaseSensitiv->isOn(), actionWildcards->isOn() );
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() )
- s->setSearch( key );
+ s->setSearch( re );
}
+void MainWindow::searchAll()
+{
+ bool openState;
+ for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
+ s->doSearch();
+ }
+}
void MainWindow::slotAction( int act)
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index f6ae0a4..2773205 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -47,4 +47,5 @@ public slots:
void stopTimer( QListViewItem* );
void setSearch( const QString& );
+ void searchAll();
protected slots:
@@ -58,9 +59,10 @@ private:
QHBoxLayout *buttonLayout;
QFrame *detailsFrame;
-// OListViewItem *_item;
QTimer *popupTimer;
QList<SearchGroup> searches;
QHButtonGroup *buttonGroupActions;
+ QAction *actionCaseSensitiv;
+ QAction *actionWildcards;
uint _buttonCount;
void makeMenu();
diff --git a/core/pim/osearch/osearch.pro b/core/pim/osearch/osearch.pro
index d5dcda2..2e571e3 100644
--- a/core/pim/osearch/osearch.pro
+++ b/core/pim/osearch/osearch.pro
@@ -2,4 +2,5 @@ DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
INTERFACES =
+include ( $(OPIEDIR)/include.pro )
TEMPLATE = app
CONFIG += debug warn_on qt
diff --git a/core/pim/osearch/searchgroup.cpp b/core/pim/osearch/searchgroup.cpp
index d062207..3159984 100644
--- a/core/pim/osearch/searchgroup.cpp
+++ b/core/pim/osearch/searchgroup.cpp
@@ -43,4 +43,12 @@ void SearchGroup::expand()
}
+void SearchGroup::doSearch()
+{
+ clearList();
+ if (_search.isEmpty()) return;
+ if (!loaded) load();
+ int res_count = search();
+ setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")");
+}
void SearchGroup::clearList()
@@ -57,11 +65,4 @@ void SearchGroup::clearList()
}
-void SearchGroup::setSearch(QString s)
-{
- setSearch( QRegExp( s ) );
- _search.setCaseSensitive(false);
-}
-
-
void SearchGroup::setSearch(QRegExp re)
{
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h
index 35949f0..bf5dc67 100644
--- a/core/pim/osearch/searchgroup.h
+++ b/core/pim/osearch/searchgroup.h
@@ -29,10 +29,8 @@ public:
virtual void expand();
- virtual void setSearch(QString);
+ virtual void doSearch();
virtual void setSearch(QRegExp);
virtual int rtti() { return Searchgroup;}
-
-
protected:
QRegExp _search;