author | tille <tille> | 2003-05-12 11:26:06 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-12 11:26:06 (UTC) |
commit | 47a67025a4d34635877ece741def266e28e46db8 (patch) (unidiff) | |
tree | 4f7e3e9bf4bfe82a217958959d4ab89eb1ae79bd | |
parent | bc87629a1a871888e010f885ee40b2c3d6283ab4 (diff) | |
download | opie-47a67025a4d34635877ece741def266e28e46db8.zip opie-47a67025a4d34635877ece741def266e28e46db8.tar.gz opie-47a67025a4d34635877ece741def266e28e46db8.tar.bz2 |
added menus
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 54 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 4 | ||||
-rw-r--r-- | core/pim/osearch/osearch.pro | 1 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.cpp | 15 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.h | 4 |
5 files changed, 42 insertions, 36 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 @@ | |||
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qtextbrowser.h> | 33 | #include <qtextbrowser.h> |
34 | #include <qregexp.h> | ||
34 | 35 | ||
35 | #include "olistview.h" | 36 | #include "olistview.h" |
@@ -67,20 +68,11 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
67 | 68 | ||
68 | buttonGroupActions = new QHButtonGroup( this ); | 69 | buttonGroupActions = new QHButtonGroup( this ); |
70 | buttonGroupActions->hide(); | ||
69 | _buttonCount = 0; | 71 | _buttonCount = 0; |
70 | // buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 72 | // buttonGroupActions->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
71 | 73 | ||
72 | buttonLayout = new QHBoxLayout( detailsFrame ); | 74 | buttonLayout = new QHBoxLayout( detailsFrame ); |
73 | buttonGroupActions->hide(); | 75 | detailsLayout->addLayout( buttonLayout ); |
74 | //buttonLayout->addWidget( buttonGroupActions, 0 ); | 76 | |
75 | |||
76 | detailsLayout->addLayout( buttonLayout ); | ||
77 | /* | ||
78 | QPushButton *buttonShow = new QPushButton( detailsFrame, "Show" ); | ||
79 | buttonShow->setText( tr("show") ); | ||
80 | QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" ); | ||
81 | buttonEdit->setText( tr("edit") ); | ||
82 | buttonLayout->addWidget( buttonShow, 0 ); | ||
83 | buttonLayout->addWidget( buttonEdit, 0 ); | ||
84 | */ | ||
85 | mainLayout->addWidget( detailsFrame ); | 77 | mainLayout->addWidget( detailsFrame ); |
86 | detailsFrame->hide(); | 78 | detailsFrame->hide(); |
@@ -101,5 +93,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
101 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 93 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
102 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); | 94 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); |
103 | // connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) ); | ||
104 | 95 | ||
105 | } | 96 | } |
@@ -107,28 +98,33 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
107 | void MainWindow::makeMenu() | 98 | void MainWindow::makeMenu() |
108 | { | 99 | { |
109 | // QPEToolBar *toolBar = new QPEToolBar( this ); | 100 | QPEToolBar *toolBar = new QPEToolBar( this ); |
110 | // QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 101 | QPEToolBar *searchBar = new QPEToolBar(this); |
111 | // QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 102 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
103 | QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | ||
112 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 104 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
113 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 105 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
114 | // | 106 | // |
115 | setToolBarsMovable( false ); | 107 | setToolBarsMovable( false ); |
116 | // toolBar->setHorizontalStretchable( true ); | 108 | toolBar->setHorizontalStretchable( true ); |
117 | // menuBar->insertItem( tr( "Search" ), searchMenu ); | 109 | menuBar->insertItem( tr( "Search" ), searchMenu ); |
118 | // menuBar->insertItem( tr( "View" ), viewMenu ); | 110 | // menuBar->insertItem( tr( "View" ), viewMenu ); |
119 | // menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 111 | // menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
120 | 112 | ||
121 | //SEARCH | 113 | //SEARCH |
122 | QPEToolBar *searchBar = new QPEToolBar(this); | 114 | QAction *action = new QAction( tr("Search all"),QString::null, 0, this, 0 ); |
123 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 115 | connect( action, SIGNAL(activated()), this, SLOT(searchAll()) ); |
124 | QLabel *label = new QLabel( tr("Search: "), searchBar ); | 116 | action->addTo( searchMenu ); |
125 | // label->setBackgroundMode( PaletteForeground ); | 117 | actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); |
126 | searchBar->setHorizontalStretchable( TRUE ); | 118 | actionCaseSensitiv->addTo( searchMenu ); |
119 | actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); | ||
120 | actionWildcards->addTo( searchMenu ); | ||
121 | |||
122 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | ||
127 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 123 | QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
124 | searchBar->setHorizontalStretchable( TRUE ); | ||
128 | searchBar->setStretchableWidget( searchEdit ); | 125 | searchBar->setStretchableWidget( searchEdit ); |
129 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 126 | connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
130 | this, SLOT( setSearch( const QString & ) ) ); | 127 | this, SLOT( setSearch( const QString & ) ) ); |
131 | 128 | ||
132 | |||
133 | } | 129 | } |
134 | 130 | ||
@@ -189,8 +185,16 @@ void MainWindow::showPopup() | |||
189 | void MainWindow::setSearch( const QString &key ) | 185 | void MainWindow::setSearch( const QString &key ) |
190 | { | 186 | { |
187 | QRegExp re( key, actionCaseSensitiv->isOn(), actionWildcards->isOn() ); | ||
191 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) | 188 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ) |
192 | s->setSearch( key ); | 189 | s->setSearch( re ); |
193 | } | 190 | } |
194 | 191 | ||
192 | void MainWindow::searchAll() | ||
193 | { | ||
194 | bool openState; | ||
195 | for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ | ||
196 | s->doSearch(); | ||
197 | } | ||
198 | } | ||
195 | 199 | ||
196 | void MainWindow::slotAction( int act) | 200 | 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: | |||
47 | void stopTimer( QListViewItem* ); | 47 | void stopTimer( QListViewItem* ); |
48 | void setSearch( const QString& ); | 48 | void setSearch( const QString& ); |
49 | void searchAll(); | ||
49 | 50 | ||
50 | protected slots: | 51 | protected slots: |
@@ -58,9 +59,10 @@ private: | |||
58 | QHBoxLayout *buttonLayout; | 59 | QHBoxLayout *buttonLayout; |
59 | QFrame *detailsFrame; | 60 | QFrame *detailsFrame; |
60 | // OListViewItem *_item; | ||
61 | QTimer *popupTimer; | 61 | QTimer *popupTimer; |
62 | 62 | ||
63 | QList<SearchGroup> searches; | 63 | QList<SearchGroup> searches; |
64 | QHButtonGroup *buttonGroupActions; | 64 | QHButtonGroup *buttonGroupActions; |
65 | QAction *actionCaseSensitiv; | ||
66 | QAction *actionWildcards; | ||
65 | uint _buttonCount; | 67 | uint _buttonCount; |
66 | void makeMenu(); | 68 | 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 | |||
2 | LIBS += -lqpe -lopie | 2 | LIBS += -lqpe -lopie |
3 | INTERFACES = | 3 | INTERFACES = |
4 | include ( $(OPIEDIR)/include.pro ) | ||
4 | TEMPLATE = app | 5 | TEMPLATE = app |
5 | CONFIG += debug warn_on qt | 6 | 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() | |||
43 | } | 43 | } |
44 | 44 | ||
45 | void SearchGroup::doSearch() | ||
46 | { | ||
47 | clearList(); | ||
48 | if (_search.isEmpty()) return; | ||
49 | if (!loaded) load(); | ||
50 | int res_count = search(); | ||
51 | setText(0, _name + " - " + _search.pattern() + " (" + QString::number( res_count ) + ")"); | ||
52 | } | ||
45 | 53 | ||
46 | void SearchGroup::clearList() | 54 | void SearchGroup::clearList() |
@@ -57,11 +65,4 @@ void SearchGroup::clearList() | |||
57 | } | 65 | } |
58 | 66 | ||
59 | void SearchGroup::setSearch(QString s) | ||
60 | { | ||
61 | setSearch( QRegExp( s ) ); | ||
62 | _search.setCaseSensitive(false); | ||
63 | } | ||
64 | |||
65 | |||
66 | void SearchGroup::setSearch(QRegExp re) | 67 | void SearchGroup::setSearch(QRegExp re) |
67 | { | 68 | { |
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: | |||
29 | 29 | ||
30 | virtual void expand(); | 30 | virtual void expand(); |
31 | virtual void setSearch(QString); | 31 | virtual void doSearch(); |
32 | virtual void setSearch(QRegExp); | 32 | virtual void setSearch(QRegExp); |
33 | virtual int rtti() { return Searchgroup;} | 33 | virtual int rtti() { return Searchgroup;} |
34 | 34 | ||
35 | |||
36 | |||
37 | protected: | 35 | protected: |
38 | QRegExp _search; | 36 | QRegExp _search; |