author | tille <tille> | 2003-05-17 10:38:52 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-17 10:38:52 (UTC) |
commit | cdf3ec6993eebb80c96258c1bb217594ea442544 (patch) (unidiff) | |
tree | e0323d8011928c11aecc747535fcf8ae521d70c3 /core | |
parent | f6c30fa4d0e97b0256a7b40554f70b5c08895d80 (diff) | |
download | opie-cdf3ec6993eebb80c96258c1bb217594ea442544.zip opie-cdf3ec6993eebb80c96258c1bb217594ea442544.tar.gz opie-cdf3ec6993eebb80c96258c1bb217594ea442544.tar.bz2 |
(layout) fixes from zecke (for 0.99)
and some minor things...
-rw-r--r-- | core/pim/osearch/adresssearch.cpp | 5 | ||||
-rw-r--r-- | core/pim/osearch/applnksearch.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/datebooksearch.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/doclnksearch.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/eventitem.cpp | 2 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 39 | ||||
-rw-r--r-- | core/pim/osearch/mainwindow.h | 22 | ||||
-rw-r--r-- | core/pim/osearch/searchgroup.h | 2 | ||||
-rw-r--r-- | core/pim/osearch/todosearch.cpp | 2 |
9 files changed, 46 insertions, 32 deletions
diff --git a/core/pim/osearch/adresssearch.cpp b/core/pim/osearch/adresssearch.cpp index 2cd545f..f117fe6 100644 --- a/core/pim/osearch/adresssearch.cpp +++ b/core/pim/osearch/adresssearch.cpp | |||
@@ -13,9 +13,9 @@ | |||
13 | #include "adresssearch.h" | 13 | #include "adresssearch.h" |
14 | 14 | ||
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qiconset.h> | 16 | #include <qiconset.h> |
17 | #include <qwhatsthis.h> | 17 | //#include <qwhatsthis.h> |
18 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | #include <opie/ocontactaccess.h> | 19 | #include <opie/ocontactaccess.h> |
20 | 20 | ||
21 | #include "contactitem.h" | 21 | #include "contactitem.h" |
@@ -25,8 +25,9 @@ AdressSearch::AdressSearch(QListView* parent, QString name): | |||
25 | { | 25 | { |
26 | _contacts = 0; | 26 | _contacts = 0; |
27 | QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); | 27 | QIconSet is = Resource::loadIconSet( "addressbook/AddressBook" ); |
28 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); | 28 | setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); |
29 | //QWhatsThis::add( this, QObject::tr("Search the addressbook") ); | ||
29 | /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); | 30 | /*QPixmap pix = Resource::loadPixmap( "addressbook/AddressBook" ); |
30 | QImage img = pix.convertToImage(); | 31 | QImage img = pix.convertToImage(); |
31 | img.smoothScale( 14, 14 ); | 32 | img.smoothScale( 14, 14 ); |
32 | pix.convertFromImage( img ); | 33 | pix.convertFromImage( img ); |
@@ -47,9 +48,9 @@ void AdressSearch::load() | |||
47 | int AdressSearch::search() | 48 | int AdressSearch::search() |
48 | { | 49 | { |
49 | ORecordList<OContact> results = _contacts->matchRegexp(_search); | 50 | ORecordList<OContact> results = _contacts->matchRegexp(_search); |
50 | for (uint i = 0; i < results.count(); i++) { | 51 | for (uint i = 0; i < results.count(); i++) { |
51 | new ContactItem( this, new OContact( results[i] )); | 52 | (void)new ContactItem( this, new OContact( results[i] )); |
52 | } | 53 | } |
53 | return results.count(); | 54 | return results.count(); |
54 | } | 55 | } |
55 | 56 | ||
diff --git a/core/pim/osearch/applnksearch.cpp b/core/pim/osearch/applnksearch.cpp index 403c719..b15275a 100644 --- a/core/pim/osearch/applnksearch.cpp +++ b/core/pim/osearch/applnksearch.cpp | |||
@@ -56,9 +56,9 @@ int AppLnkSearch::search() | |||
56 | } | 56 | } |
57 | 57 | ||
58 | void AppLnkSearch::insertItem( void *rec ) | 58 | void AppLnkSearch::insertItem( void *rec ) |
59 | { | 59 | { |
60 | new AppLnkItem( this, (AppLnk*)rec ); | 60 | (void)new AppLnkItem( this, (AppLnk*)rec ); |
61 | _resultCount++; | 61 | _resultCount++; |
62 | } | 62 | } |
63 | 63 | ||
64 | void AppLnkSearch::setSearch(QRegExp re) | 64 | void AppLnkSearch::setSearch(QRegExp re) |
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp index 5da7ae9..be2bf25 100644 --- a/core/pim/osearch/datebooksearch.cpp +++ b/core/pim/osearch/datebooksearch.cpp | |||
@@ -75,9 +75,9 @@ void DatebookSearch::insertItem( void *rec ) | |||
75 | if ( !actionSearchInDates->isOn() && ( | 75 | if ( !actionSearchInDates->isOn() && ( |
76 | ev->lastHitField() == Qtopia::StartDateTime || | 76 | ev->lastHitField() == Qtopia::StartDateTime || |
77 | ev->lastHitField() == Qtopia::EndDateTime ) | 77 | ev->lastHitField() == Qtopia::EndDateTime ) |
78 | ) return; | 78 | ) return; |
79 | new EventItem( this, ev ); | 79 | (void)new EventItem( this, ev ); |
80 | _resultCount++; | 80 | _resultCount++; |
81 | } | 81 | } |
82 | 82 | ||
83 | QPopupMenu* DatebookSearch::popupMenu() | 83 | QPopupMenu* DatebookSearch::popupMenu() |
diff --git a/core/pim/osearch/doclnksearch.cpp b/core/pim/osearch/doclnksearch.cpp index 321d011..3428798 100644 --- a/core/pim/osearch/doclnksearch.cpp +++ b/core/pim/osearch/doclnksearch.cpp | |||
@@ -75,9 +75,9 @@ bool DocLnkSearch::searchFile( AppLnk *app ) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | void DocLnkSearch::insertItem( void *rec ) | 77 | void DocLnkSearch::insertItem( void *rec ) |
78 | { | 78 | { |
79 | new DocLnkItem( this, (DocLnk*)rec ); | 79 | (void)new DocLnkItem( this, (DocLnk*)rec ); |
80 | _resultCount++; | 80 | _resultCount++; |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp index 24ce8e8..3228093 100644 --- a/core/pim/osearch/eventitem.cpp +++ b/core/pim/osearch/eventitem.cpp | |||
@@ -15,8 +15,9 @@ | |||
15 | #include <qdatetime.h> | 15 | #include <qdatetime.h> |
16 | #include <qpixmap.h> | 16 | #include <qpixmap.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/qcopenvelope_qws.h> | 18 | #include <qpe/qcopenvelope_qws.h> |
19 | //#include <qwhatsthis.h> | ||
19 | #include <opie/oevent.h> | 20 | #include <opie/oevent.h> |
20 | 21 | ||
21 | EventItem::EventItem(OListViewItem* parent, OEvent *event) | 22 | EventItem::EventItem(OListViewItem* parent, OEvent *event) |
22 | : ResultItem(parent) | 23 | : ResultItem(parent) |
@@ -61,8 +62,9 @@ void EventItem::setIcon() | |||
61 | QPixmap icon; | 62 | QPixmap icon; |
62 | switch ( _event->lastHitField() ) { | 63 | switch ( _event->lastHitField() ) { |
63 | case -1: | 64 | case -1: |
64 | icon = Resource::loadPixmap( "reset" ); | 65 | icon = Resource::loadPixmap( "reset" ); |
66 | // QWhatsThis::add( icon, QObject::tr("Enter your search terms here") ); | ||
65 | break; | 67 | break; |
66 | case Qtopia::DatebookDescription: | 68 | case Qtopia::DatebookDescription: |
67 | icon = Resource::loadPixmap( "osearch/summary" ); | 69 | icon = Resource::loadPixmap( "osearch/summary" ); |
68 | break; | 70 | break; |
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index c6934db..aa52061 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -18,12 +18,14 @@ | |||
18 | #include <qstring.h> | 18 | #include <qstring.h> |
19 | #include <qlabel.h> | 19 | #include <qlabel.h> |
20 | #include <qfile.h> | 20 | #include <qfile.h> |
21 | #include <qhbuttongroup.h> | 21 | #include <qhbuttongroup.h> |
22 | #include <qhbox.h> | ||
22 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
23 | #include <qintdict.h> | 24 | #include <qintdict.h> |
24 | #include <qlayout.h> | 25 | #include <qlayout.h> |
25 | #include <qlineedit.h> | 26 | #include <qlineedit.h> |
27 | #include <qsignalmapper.h> | ||
26 | #include <qtextbrowser.h> | 28 | #include <qtextbrowser.h> |
27 | #include <qregexp.h> | 29 | #include <qregexp.h> |
28 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
29 | #include <qpe/qpemenubar.h> | 31 | #include <qpe/qpemenubar.h> |
@@ -70,17 +72,16 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
70 | QWhatsThis::add( richEdit, tr("The details of the current result") ); | 72 | QWhatsThis::add( richEdit, tr("The details of the current result") ); |
71 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 73 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
72 | detailsLayout->addWidget( richEdit ); | 74 | detailsLayout->addWidget( richEdit ); |
73 | 75 | ||
74 | buttonGroupActions = new QHButtonGroup( this ); | 76 | buttonBox = new QHBox( mainFrame, "Button Box" ); |
75 | buttonGroupActions->hide(); | ||
76 | _buttonCount = 0; | ||
77 | 77 | ||
78 | buttonLayout = new QHBoxLayout( detailsFrame ); | 78 | _buttonCount = 0; |
79 | detailsLayout->addLayout( buttonLayout ); | ||
80 | 79 | ||
81 | mainLayout->addWidget( detailsFrame ); | 80 | mainLayout->addWidget( detailsFrame ); |
81 | mainLayout->addWidget( buttonBox ); | ||
82 | detailsFrame->hide(); | 82 | detailsFrame->hide(); |
83 | buttonBox->hide(); | ||
83 | 84 | ||
84 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); | 85 | searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); |
85 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); | 86 | searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); |
86 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); | 87 | searches.append( new TodoSearch( resultsList, tr("todo") ) ); |
@@ -95,9 +96,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | |||
95 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 96 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
96 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); | 97 | connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); |
97 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 98 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
98 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 99 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
99 | connect(buttonGroupActions, SIGNAL(clicked(int)), SLOT( slotAction(int) ) ); | 100 | |
101 | signalMapper = new QSignalMapper( this ); | ||
102 | |||
103 | connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); | ||
100 | 104 | ||
101 | makeMenu(); | 105 | makeMenu(); |
102 | 106 | ||
103 | Config cfg( "osearch", Config::User ); | 107 | Config cfg( "osearch", Config::User ); |
@@ -182,24 +186,31 @@ void MainWindow::setCurrent(QListViewItem *item) | |||
182 | richEdit->setText( res->toRichText() ); | 186 | richEdit->setText( res->toRichText() ); |
183 | QIntDict<QString> acts = res->actions(); | 187 | QIntDict<QString> acts = res->actions(); |
184 | QButton *button; | 188 | QButton *button; |
185 | for (uint i = 0; i < acts.count(); i++){ | 189 | for (uint i = 0; i < acts.count(); i++){ |
186 | button = buttonGroupActions->find( i ); | 190 | button = buttonMap[i]; |
187 | if (!button) { | 191 | if (!button) { |
188 | button = new QPushButton( detailsFrame ); | 192 | qWarning(" no button for %s", (*acts[i]).latin1() ); |
189 | buttonLayout->addWidget( button, 0 ); | 193 | button = new QPushButton( buttonBox ); |
190 | buttonGroupActions->insert( button, i); | 194 | buttonMap.insert( i, button ); |
195 | signalMapper->setMapping(button, i ); | ||
196 | connect(button, SIGNAL(clicked() ), signalMapper, SLOT(map() ) ); | ||
191 | } | 197 | } |
192 | button->setText( *acts[i] ); | 198 | button->setText( *acts[i] ); |
193 | button->show(); | 199 | button->show(); |
194 | } | 200 | } |
195 | for (uint i = acts.count(); i < _buttonCount; i++){ | 201 | for (uint i = acts.count(); i < _buttonCount; i++){ |
196 | button = buttonGroupActions->find( i ); | 202 | button = buttonMap[i]; |
197 | if (button) button->hide(); | 203 | if (button) button->hide(); |
198 | } | 204 | } |
199 | _buttonCount = acts.count(); | 205 | _buttonCount = acts.count(); |
200 | detailsFrame->show(); | 206 | detailsFrame->show(); |
201 | }else detailsFrame->hide(); | 207 | buttonBox->show(); |
208 | |||
209 | }else { | ||
210 | detailsFrame->hide(); | ||
211 | buttonBox->hide(); | ||
212 | } | ||
202 | popupTimer->start( 300, true ); | 213 | popupTimer->start( 300, true ); |
203 | } | 214 | } |
204 | 215 | ||
205 | void MainWindow::stopTimer(QListViewItem*) | 216 | void MainWindow::stopTimer(QListViewItem*) |
@@ -252,15 +263,15 @@ void MainWindow::searchAll() | |||
252 | } | 263 | } |
253 | 264 | ||
254 | void MainWindow::slotAction( int act ) | 265 | void MainWindow::slotAction( int act ) |
255 | { | 266 | { |
256 | if (_currentItem->rtti() == OListViewItem::Result){ | 267 | if ( _currentItem && _currentItem->rtti() == OListViewItem::Result){ |
257 | ResultItem *res = (ResultItem*)_currentItem; | 268 | ResultItem *res = (ResultItem*)_currentItem; |
258 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 269 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
259 | res->action(act); | 270 | res->action(act); |
260 | } | 271 | } |
261 | } | 272 | } |
262 | 273 | ||
263 | void MainWindow::optionChanged(int i) | 274 | void MainWindow::optionChanged(int ) |
264 | { | 275 | { |
265 | searchStringChanged(); | 276 | searchStringChanged(); |
266 | } | 277 | } |
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h index cba11c5..1f5c4bb 100644 --- a/core/pim/osearch/mainwindow.h +++ b/core/pim/osearch/mainwindow.h | |||
@@ -12,24 +12,23 @@ | |||
12 | #ifndef MAINWINDOW_H | 12 | #ifndef MAINWINDOW_H |
13 | #define MAINWINDOW_H | 13 | #define MAINWINDOW_H |
14 | 14 | ||
15 | #include <qmainwindow.h> | 15 | #include <qmainwindow.h> |
16 | #include <qdialog.h> | ||
17 | #include <qaction.h> | ||
18 | #include <qlist.h> | 16 | #include <qlist.h> |
19 | #include <qtimer.h> | 17 | #include <qmap.h> |
20 | #include <qpopupmenu.h> | ||
21 | 18 | ||
19 | class QAction; | ||
22 | class QPEToolBar; | 20 | class QPEToolBar; |
21 | class QHBox; | ||
23 | class QVBoxLayout; | 22 | class QVBoxLayout; |
24 | class QHBoxLayout; | ||
25 | class QTextView; | 23 | class QTextView; |
26 | class QFrame; | 24 | class QFrame; |
27 | class QListViewItem; | ||
28 | class OListView; | 25 | class OListView; |
29 | class OListViewItem; | 26 | class OListViewItem; |
30 | class QHButtonGroup; | 27 | class QListViewItem; |
31 | 28 | class QPopupMenu; | |
29 | class QSignalMapper; | ||
30 | class QTimer; | ||
32 | class SearchGroup; | 31 | class SearchGroup; |
33 | 32 | ||
34 | class MainWindow : public QMainWindow | 33 | class MainWindow : public QMainWindow |
35 | { | 34 | { |
@@ -51,22 +50,23 @@ protected slots: | |||
51 | void showPopup(); | 50 | void showPopup(); |
52 | void stopTimer( QListViewItem* ); | 51 | void stopTimer( QListViewItem* ); |
53 | void searchStringChanged(); | 52 | void searchStringChanged(); |
54 | void optionChanged(int); | 53 | void optionChanged(int); |
55 | 54 | ||
56 | private: | 55 | private: |
56 | QHBox *buttonBox; | ||
57 | QMap<int, QButton*> buttonMap; | ||
58 | QSignalMapper* signalMapper; | ||
57 | OListView *resultsList; | 59 | OListView *resultsList; |
58 | QTextView *richEdit; | 60 | QTextView *richEdit; |
59 | OListViewItem *_currentItem; | 61 | OListViewItem *_currentItem; |
60 | QVBoxLayout *mainLayout; | 62 | QVBoxLayout *mainLayout; |
61 | QHBoxLayout *buttonLayout; | ||
62 | QFrame *detailsFrame; | 63 | QFrame *detailsFrame; |
63 | QTimer *popupTimer; | 64 | QTimer *popupTimer; |
64 | QTimer *searchTimer; | 65 | QTimer *searchTimer; |
65 | 66 | ||
66 | QString _searchString; | 67 | QString _searchString; |
67 | QList<SearchGroup> searches; | 68 | QList<SearchGroup> searches; |
68 | QHButtonGroup *buttonGroupActions; | ||
69 | QAction *SearchAllAction; | 69 | QAction *SearchAllAction; |
70 | QAction *actionCaseSensitiv; | 70 | QAction *actionCaseSensitiv; |
71 | QAction *actionWildcards; | 71 | QAction *actionWildcards; |
72 | //QAction *actionWholeWordsOnly; | 72 | //QAction *actionWholeWordsOnly; |
diff --git a/core/pim/osearch/searchgroup.h b/core/pim/osearch/searchgroup.h index ad37d4e..de74efb 100644 --- a/core/pim/osearch/searchgroup.h +++ b/core/pim/osearch/searchgroup.h | |||
@@ -39,9 +39,9 @@ protected: | |||
39 | virtual void insertItem( void* ) = 0; | 39 | virtual void insertItem( void* ) = 0; |
40 | QRegExp _search; | 40 | QRegExp _search; |
41 | QRegExp _lastSearch; | 41 | QRegExp _lastSearch; |
42 | QString _name; | 42 | QString _name; |
43 | bool loaded; | 43 | bool loaded : 1; |
44 | int _resultCount; | 44 | int _resultCount; |
45 | private: | 45 | private: |
46 | int realSearch(); | 46 | int realSearch(); |
47 | }; | 47 | }; |
diff --git a/core/pim/osearch/todosearch.cpp b/core/pim/osearch/todosearch.cpp index 08bbe93..5c1d7a5 100644 --- a/core/pim/osearch/todosearch.cpp +++ b/core/pim/osearch/todosearch.cpp | |||
@@ -65,9 +65,9 @@ void TodoSearch::insertItem( void *rec ) | |||
65 | { | 65 | { |
66 | OTodo *todo = (OTodo*)rec; | 66 | OTodo *todo = (OTodo*)rec; |
67 | if (!actionShowCompleted->isOn() && | 67 | if (!actionShowCompleted->isOn() && |
68 | todo->isCompleted() ) return; | 68 | todo->isCompleted() ) return; |
69 | new TodoItem( this, todo ); | 69 | (void)new TodoItem( this, todo ); |
70 | _resultCount++; | 70 | _resultCount++; |
71 | } | 71 | } |
72 | 72 | ||
73 | QPopupMenu* TodoSearch::popupMenu() | 73 | QPopupMenu* TodoSearch::popupMenu() |