summaryrefslogtreecommitdiff
authortille <tille>2003-05-14 16:54:01 (UTC)
committer tille <tille>2003-05-14 16:54:01 (UTC)
commitdabb32d52954874ffd8c79de3a82923dde5b27af (patch) (side-by-side diff)
treee116b2e1b15c84a25a39fc2b9f2bad498570e9f7
parent6bc6d8eb1051335e99416f5a8311788b40c7476a (diff)
downloadopie-dabb32d52954874ffd8c79de3a82923dde5b27af.zip
opie-dabb32d52954874ffd8c79de3a82923dde5b27af.tar.gz
opie-dabb32d52954874ffd8c79de3a82923dde5b27af.tar.bz2
added settings
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/osearch/mainwindow.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index 093ca54..b80c637 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -9,24 +9,25 @@
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "mainwindow.h"
#include <qpe/qpemenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qhbuttongroup.h>
#include <qpushbutton.h>
#include <qintdict.h>
#include <qlayout.h>
#include <qlineedit.h>
@@ -86,64 +87,79 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
makeMenu();
setCentralWidget( mainFrame );
popupTimer = new QTimer();
searchTimer = new QTimer();
connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) );
+
+ Config cfg( "osearch", Config::User );
+ cfg.setGroup( "search_settings" );
+ actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
+ actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
}
void MainWindow::makeMenu()
{
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 );
-//
+ QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
+ QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
+
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Search" ), searchMenu );
-// menuBar->insertItem( tr( "View" ), viewMenu );
-// menuBar->insertItem( tr( "Settings" ), cfgMenu );
+ menuBar->insertItem( tr( "Settings" ), cfgMenu );
+ cfgMenu->insertItem( tr( "Search" ), searchOptions );
+
//SEARCH
SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
SearchAllAction->addTo( searchMenu );
+ searchMenu->insertItem( tr( "Options" ), searchOptions );
+
+ //SEARCH OPTIONS
actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
- actionCaseSensitiv->addTo( searchMenu );
+ actionCaseSensitiv->addTo( searchOptions );
actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
- actionWildcards->addTo( searchMenu );
+ actionWildcards->addTo( searchOptions );
+ //SEARCH BAR
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
searchEdit->setFocus();
searchBar->setHorizontalStretchable( TRUE );
searchBar->setStretchableWidget( searchEdit );
SearchAllAction->addTo( searchBar );
connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( setSearch( const QString & ) ) );
}
MainWindow::~MainWindow()
{
+ Config cfg( "osearch", Config::User );
+ cfg.setGroup( "search_settings" );
+ cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
+ cfg.writeEntry( "wildcards", actionWildcards->isOn() );
}
void MainWindow::setCurrent(QListViewItem *item)
{
if (!item) return;
_currentItem = (OListViewItem*)item;
// _currentItem = dynamic_cast<OListViewItem*>(item);
if (_currentItem->rtti() == OListViewItem::Result){
ResultItem *res = (ResultItem*)item;
// ResultItem *res = dynamic_cast<ResultItem*>(item);
richEdit->setText( res->toRichText() );
QIntDict<QString> acts = res->actions();