-rw-r--r-- | core/pim/osearch/adresssearch.cpp | 6 | ||||
-rw-r--r-- | core/pim/osearch/applnksearch.cpp | 12 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 4 | ||||
-rw-r--r-- | core/pim/osearch/doclnksearch.cpp | 4 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 42 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 3 | ||||
-rw-r--r-- | core/pim/osearch/olistview.cpp | 8 | ||||
-rw-r--r-- | core/pim/osearch/todosearch.cpp | 4 |
8 files changed, 64 insertions, 19 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp index f117fe6..7681ea2 100644 --- a/core/pim/osearch/adresssearch.cpp +++ b/core/pim/osearch/adresssearch.cpp @@ -15,26 +15,28 @@ #include <qstring.h> #include <qiconset.h> //#include <qwhatsthis.h> #include <qpe/resource.h> #include <opie/ocontactaccess.h> #include "contactitem.h" AdressSearch::AdressSearch(QListView* parent, QString name): SearchGroup(parent, name) { _contacts = 0; - QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); - setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); + QIconSet is = Resource::loadIconSet( "addressbook/AddressBookSmall" ); + setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); + + // QWhatsThis::add( this, QObject::tr("Search the addressbook") ); /* QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); QImage img = pix.convertToImage(); img.smoothScale( 14, 14 ); pix.convertFromImage( img ); setPixmap( 0, pix );*/ } AdressSearch::~AdressSearch() { delete _contacts; diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp index b15275a..e8170c5 100644 --- a/core/pim/osearch/applnksearch.cpp +++ b/core/pim/osearch/applnksearch.cpp @@ -10,56 +10,58 @@ // Copyright: See COPYING file that comes with this distribution // // #include "applnksearch.h" #include <qpe/applnk.h> #include <qpe/qpeapplication.h> #include <qiconset.h> #include <qpe/resource.h> #include "applnkitem.h" + AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name) { _apps = 0; - QIconSet is = Resource::loadIconSet( "osearch/applications" ); + QIconSet is = Resource::loadIconSet( "osearch/applicationsSmall" ); //QIconSet is = Resource::loadIconSet( "AppsIcon" ); - setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); + setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); } AppLnkSearch::~AppLnkSearch() { delete _apps; } void AppLnkSearch::load() { _apps = new AppLnkSet(QPEApplication::qpeDir()); } int AppLnkSearch::search() { QList<AppLnk> appList = _apps->children(); + for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){ if ( (_search.match( app->name() ) != -1) || (_search.match(app->comment()) != -1) - || (_search.match(app->exec()) != -1) ) { + || (_search.match(app->exec()) != -1) ) { insertItem( app ); }else if (searchFile( app )) - insertItem( app ); - qApp->processEvents( 100 ); + insertItem( app ); + qApp->processEvents( 100 ); } return _resultCount; } void AppLnkSearch::insertItem( void *rec ) { (void)new AppLnkItem( this, (AppLnk*)rec ); _resultCount++; } void AppLnkSearch::setSearch(QRegExp re) { diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index 5da7ae9..50c76e0 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp @@ -18,26 +18,26 @@ #include <qpe/config.h> #include <opie/oevent.h> #include <opie/orecur.h> #include <opie/odatebookaccess.h> #include <qiconset.h> #include <qaction.h> #include <qdatetime.h> #include <qpopupmenu.h> DatebookSearch::DatebookSearch(QListView* parent, QString name) : SearchGroup(parent, name), _dates(0), _popupMenu(0) { - QIconSet is = Resource::loadIconSet( "datebook/DateBook" ); - setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); + QIconSet is = Resource::loadIconSet( "datebook/DateBookSmall" ); + setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); Config cfg( "osearch", Config::User ); cfg.setGroup( "datebook_settings" ); actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); } DatebookSearch::~DatebookSearch() { qDebug("SAVE DATEBOOK SEARCH CONFIG"); Config cfg( "osearch", Config::User ); diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp index 26097a4..b03dbd8 100644 --- a/core/pim/osearch/doclnksearch.cpp +++ b/core/pim/osearch/doclnksearch.cpp @@ -19,26 +19,26 @@ #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <opie/owait.h> #include "doclnkitem.h" #include "doclnksearch.h" DocLnkSearch::DocLnkSearch(QListView* parent, QString name) : AppLnkSearch(parent, name), _popupMenu(0) { - QIconSet is = Resource::loadIconSet( "osearch/documents" ); - setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); + QIconSet is = Resource::loadIconSet( "osearch/documentsSmall" ); + setPixmap( 0, is.pixmap( QIconSet::Automatic, true ) ); actionSearchInFiles = new QAction( QObject::tr("search content"),QString::null, 0, 0, 0, true ); Config cfg( "osearch", Config::User ); cfg.setGroup( "doclnk_settings" ); actionSearchInFiles->setOn( cfg.readBoolEntry( "search_content", false ) ); } DocLnkSearch::~DocLnkSearch() { Config cfg( "osearch", Config::User ); cfg.setGroup( "doclnk_settings" ); diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 07403a1..55302cb 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp @@ -39,37 +39,58 @@ #include <opie/owait.h> #include "olistview.h" #include "olistviewitem.h" #include "resultitem.h" #include "adresssearch.h" #include "todosearch.h" #include "datebooksearch.h" #include "applnksearch.h" #include "doclnksearch.h" #include "mainwindow.h" +static const char* const image1_data[] = { +"14 14 3 1", +". c None", +"# c #000000", +"a c #ff0000", +"..............", +"..##.......###", +".#aa#....##aa#", +"#aaaa#.##aaaa#", +".##aaa#aaaaa##", +"...#aaaaaaa#..", +"....#aaaaa#...", +"...#aaaaa#....", +"..#aaaaaaa#...", +".#aaaaaaaaa#..", +"#aaaa###aaaa#.", +"#aaa#..##aaa#.", +"#aaa#...#aa#..", +".###.....##..."}; + + MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), _currentItem(0) { setCaption( tr("OSearch") ); setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); QFrame *mainFrame = new QFrame( this, "mainFrame" ); mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); mainLayout = new QVBoxLayout( mainFrame ); mainLayout->setSpacing( 0 ); - mainLayout->setMargin( 0 ); + mainLayout->setMargin( 3 ); resultsList = new OListView( mainFrame ); resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); mainLayout->addWidget( resultsList ); detailsFrame = new QFrame( mainFrame, "detailsFrame" ); QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); richEdit = new QTextView( detailsFrame ); QWhatsThis::add( richEdit, tr("The details of the current result") ); richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); detailsLayout->addWidget( richEdit ); @@ -145,33 +166,48 @@ void MainWindow::makeMenu() SearchAllAction->addTo( searchMenu ); searchMenu->insertItem( tr( "Options" ), searchOptions ); //SEARCH OPTIONS //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); //actionWholeWordsOnly->addTo( searchOptions ); actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); actionCaseSensitiv->addTo( searchOptions ); actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); actionWildcards->addTo( searchOptions ); //SEARCH BAR + LabelEnterText = new QLabel( searchBar, "Label" ); + LabelEnterText->setAutoMask( FALSE ); + LabelEnterText->setText( tr( "Search for: " ) ); + addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); searchEdit->setFocus(); searchBar->setHorizontalStretchable( TRUE ); searchBar->setStretchableWidget( searchEdit ); + + //Search button SearchAllAction->addTo( searchBar ); - connect( searchEdit, SIGNAL( textChanged( const QString & ) ), - this, SLOT( setSearch( const QString & ) ) ); + + //image ripped of off opie-login/loginwindow.cpp + QPixmap image1( ( const char** ) image1_data ); + + //Clear text + ClearSearchText = new QToolButton( searchBar, "ClearSearchText"); + ClearSearchText->setText( tr( "" ) ); + ClearSearchText->setPixmap( image1 ); + + connect( searchEdit, SIGNAL( textChanged( const QString & ) ),this, SLOT( setSearch( const QString & ) ) ); + connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) ); } MainWindow::~MainWindow() { Config cfg( "osearch", Config::User ); cfg.setGroup( "search_settings" ); cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); cfg.writeEntry( "wildcards", actionWildcards->isOn() ); //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); } diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index bdc6c5f..9886053 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h @@ -23,24 +23,25 @@ class QAction; class QToolBar; class QHBox; class QVBoxLayout; class QTextView; class QFrame; class OListView; class OListViewItem; class QListViewItem; class QPopupMenu; class QTimer; +class QLabel; class QSignalMapper; class QButton; class SearchGroup; class MainWindow : public QMainWindow { Q_OBJECT public: @@ -62,24 +63,26 @@ protected slots: private: QHBox *buttonBox; QMap<int, QButton*> buttonMap; QSignalMapper* signalMapper; OListView *resultsList; QTextView *richEdit; OListViewItem *_currentItem; QVBoxLayout *mainLayout; QFrame *detailsFrame; QTimer *popupTimer; QTimer *searchTimer; + QToolButton* ClearSearchText; + QLabel* LabelEnterText; QString _searchString; QList<SearchGroup> searches; QAction *SearchAllAction; QAction *actionCaseSensitiv; QAction *actionWildcards; //QAction *actionWholeWordsOnly; uint _buttonCount; void makeMenu(); }; #endif diff --git a/core/pim/osearch/olistview.cpp b/core/pim/osearch/olistview.cpp index 06392ba..e678d63 100644 --- a/core/pim/osearch/olistview.cpp +++ b/core/pim/osearch/olistview.cpp @@ -2,32 +2,34 @@ * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogtp <tille@handhelds.org> #include "olistview.h" #include "olistviewitem.h" #include <qmessagebox.h> - +#include <qpe/qpeapplication.h> OListView::OListView(QWidget *parent, const char *name ) : QListView(parent,name) { - setRootIsDecorated( true ); - addColumn(tr("Results")); + setRootIsDecorated( true ); + addColumn(tr("Results"),qApp->desktop()->width() - 9 ); + //setColumnWidthMode(0, Manual); + setSorting( -1 ); connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*))); } OListView::~OListView() { } void OListView::expand(QListViewItem *item) { ((OListViewItem*)item)->expand(); diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index 5c1d7a5..8de875e 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp @@ -17,26 +17,26 @@ #include <qpe/resource.h> #include <qpe/config.h> #include <qiconset.h> #include <qaction.h> #include <qpopupmenu.h> #include "todoitem.h" TodoSearch::TodoSearch(QListView* parent, QString name) : SearchGroup(parent, name), _todos(0), _popupMenu(0) { // AppLnkSet als(QPEApplication::qpeDir()); // setPixmap( 0, als.findExec("todolist")->pixmap() ); - QIconSet is = Resource::loadIconSet( "todo/TodoList" ); - setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); + QIconSet is = Resource::loadIconSet( "todo/TodoListSmall" ); + setPixmap( 0, is.pixmap( QIconSet::Large, true ) ); actionShowCompleted = new QAction( QObject::tr("show completed tasks"),QString::null, 0, 0, 0, true ); Config cfg( "osearch", Config::User ); cfg.setGroup( "todo_settings" ); actionShowCompleted->setOn( cfg.readBoolEntry( "show_completed_tasks", false ) ); } TodoSearch::~TodoSearch() { Config cfg( "osearch", Config::User ); cfg.setGroup( "todo_settings" ); |