author | eilers <eilers> | 2002-10-21 16:29:20 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-21 16:29:20 (UTC) |
commit | 507afe645a86191815a2f85380a452ab6797e383 (patch) (unidiff) | |
tree | e69293f25af3d6d8e2125b0f92a097615ddb0a38 /core/pim/addressbook/addressbook.cpp | |
parent | 71c7800e8ae5dc2d701242828ceb8c11bcd96fbe (diff) | |
download | opie-507afe645a86191815a2f85380a452ab6797e383.zip opie-507afe645a86191815a2f85380a452ab6797e383.tar.gz opie-507afe645a86191815a2f85380a452ab6797e383.tar.bz2 |
Some usability updates in picker and find..
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 70 |
1 files changed, 51 insertions, 19 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index f7e4c95..3466801 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -78,13 +78,20 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
78 | : QMainWindow( parent, name, f ), | 78 | : QMainWindow( parent, name, f ), |
79 | abEditor(0), | 79 | abEditor(0), |
80 | useRegExp(false), | 80 | useRegExp(false), |
81 | DoSignalWrapAround(false), | 81 | doNotifyWrapAround(true), |
82 | caseSensitive(false), | 82 | caseSensitive(false), |
83 | bAbEditFirstTime(TRUE), | 83 | bAbEditFirstTime(TRUE), |
84 | syncing(FALSE) | 84 | syncing(FALSE) |
85 | { | 85 | { |
86 | isLoading = true; | 86 | isLoading = true; |
87 | 87 | ||
88 | // Read Config settings | ||
89 | Config cfg("AddressBook"); | ||
90 | cfg.setGroup("Search"); | ||
91 | useRegExp = cfg.readBoolEntry( "useRegExp" ); | ||
92 | caseSensitive = cfg.readBoolEntry( "caseSensitive" ); | ||
93 | doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" ); | ||
94 | |||
88 | initFields(); | 95 | initFields(); |
89 | 96 | ||
90 | setCaption( tr("Contacts") ); | 97 | setCaption( tr("Contacts") ); |
@@ -161,7 +168,7 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
161 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 168 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
162 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); | 169 | connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); |
163 | a->addTo( searchBar ); | 170 | a->addTo( searchBar ); |
164 | 171 | ||
165 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), | 172 | a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), |
166 | QString::null, 0, this, 0 ); | 173 | QString::null, 0, this, 0 ); |
167 | //a->setEnabled( FALSE ); we got support for it now :) zecke | 174 | //a->setEnabled( FALSE ); we got support for it now :) zecke |
@@ -223,7 +230,13 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
223 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 230 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
224 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); | 231 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); |
225 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); | 232 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); |
226 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); | 233 | connect( abList, SIGNAL( currentChanged(int,int) ), this, SLOT( slotUpdateToolbar() ) ); |
234 | connect( abList, SIGNAL( signalSearchNext() ), this, SLOT( slotFindNext() ) ); | ||
235 | connect( abList, SIGNAL( signalSearchBackward() ), this, SLOT( slotFindPrevious() ) ); | ||
236 | |||
237 | // Maybe we should react on Wraparound and notfound ? | ||
238 | QObject::connect( abList, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) ); | ||
239 | QObject::connect( abList, SIGNAL(signalWrapAround()), this, SLOT(slotWrapAround()) ); | ||
227 | 240 | ||
228 | mView = 0; | 241 | mView = 0; |
229 | 242 | ||
@@ -258,13 +271,6 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
258 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 271 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
259 | 272 | ||
260 | abList->setCurrentCell( 0, 0 ); | 273 | abList->setCurrentCell( 0, 0 ); |
261 | |||
262 | // Read Config settings | ||
263 | Config cfg("AddressBook"); | ||
264 | cfg.setGroup("Search"); | ||
265 | useRegExp = cfg.readBoolEntry( "useRegExp" ); | ||
266 | caseSensitive = cfg.readBoolEntry( "caseSensitive" ); | ||
267 | DoSignalWrapAround = cfg.readBoolEntry( "signalWrapAround" ); | ||
268 | 274 | ||
269 | isLoading = false; | 275 | isLoading = false; |
270 | } | 276 | } |
@@ -275,13 +281,13 @@ void AddressbookWindow::slotConfig() | |||
275 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); | 281 | ConfigDlg* dlg = new ConfigDlg( this, "Config" ); |
276 | dlg -> setUseRegExp ( useRegExp ); | 282 | dlg -> setUseRegExp ( useRegExp ); |
277 | dlg -> setBeCaseSensitive( caseSensitive ); | 283 | dlg -> setBeCaseSensitive( caseSensitive ); |
278 | dlg -> setSignalWrapAround( DoSignalWrapAround ); | 284 | dlg -> setSignalWrapAround( doNotifyWrapAround ); |
279 | dlg -> showMaximized(); | 285 | dlg -> showMaximized(); |
280 | if ( dlg -> exec() ) { | 286 | if ( dlg -> exec() ) { |
281 | qWarning ("Config Dialog accepted !"); | 287 | qWarning ("Config Dialog accepted !"); |
282 | useRegExp = dlg -> useRegExp(); | 288 | useRegExp = dlg -> useRegExp(); |
283 | caseSensitive = dlg -> beCaseSensitive(); | 289 | caseSensitive = dlg -> beCaseSensitive(); |
284 | DoSignalWrapAround = dlg -> signalWrapAround(); | 290 | doNotifyWrapAround = dlg -> signalWrapAround(); |
285 | } | 291 | } |
286 | 292 | ||
287 | delete dlg; | 293 | delete dlg; |
@@ -373,7 +379,7 @@ AddressbookWindow::~AddressbookWindow() | |||
373 | cfg.setGroup("Search"); | 379 | cfg.setGroup("Search"); |
374 | cfg.writeEntry("useRegExp", useRegExp); | 380 | cfg.writeEntry("useRegExp", useRegExp); |
375 | cfg.writeEntry("caseSensitive", caseSensitive); | 381 | cfg.writeEntry("caseSensitive", caseSensitive); |
376 | cfg.writeEntry("signalWrapAround", DoSignalWrapAround); | 382 | cfg.writeEntry("doNotifyWrapAround", doNotifyWrapAround); |
377 | } | 383 | } |
378 | 384 | ||
379 | void AddressbookWindow::slotUpdateToolbar() | 385 | void AddressbookWindow::slotUpdateToolbar() |
@@ -656,9 +662,7 @@ void AddressbookWindow::slotPersonalView() | |||
656 | setCaption( tr("Contacts") ); | 662 | setCaption( tr("Contacts") ); |
657 | actionNew->setEnabled(TRUE); | 663 | actionNew->setEnabled(TRUE); |
658 | actionTrash->setEnabled(TRUE); | 664 | actionTrash->setEnabled(TRUE); |
659 | #ifndef MAKE_FOR_SHARP_ROM | ||
660 | actionFind->setEnabled(TRUE); | 665 | actionFind->setEnabled(TRUE); |
661 | #endif | ||
662 | slotUpdateToolbar(); // maybe some of the above could be moved there | 666 | slotUpdateToolbar(); // maybe some of the above could be moved there |
663 | showList(); | 667 | showList(); |
664 | return; | 668 | return; |
@@ -928,11 +932,13 @@ AbLabel *AddressbookWindow::abView() | |||
928 | void AddressbookWindow::slotFindOpen() | 932 | void AddressbookWindow::slotFindOpen() |
929 | { | 933 | { |
930 | searchBar->show(); | 934 | searchBar->show(); |
935 | abList -> inSearch(); | ||
931 | searchEdit->setFocus(); | 936 | searchEdit->setFocus(); |
932 | } | 937 | } |
933 | void AddressbookWindow::slotFindClose() | 938 | void AddressbookWindow::slotFindClose() |
934 | { | 939 | { |
935 | searchBar->hide(); | 940 | searchBar->hide(); |
941 | abList -> offSearch(); | ||
936 | abList->setFocus(); | 942 | abList->setFocus(); |
937 | } | 943 | } |
938 | void AddressbookWindow::slotFindNext() | 944 | void AddressbookWindow::slotFindNext() |
@@ -940,12 +946,20 @@ void AddressbookWindow::slotFindNext() | |||
940 | if ( centralWidget() == abView() ) | 946 | if ( centralWidget() == abView() ) |
941 | showList(); | 947 | showList(); |
942 | 948 | ||
943 | // Maybe we should react on Wraparound and notfound ? | ||
944 | // QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) ); | ||
945 | // QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) ); | ||
946 | |||
947 | abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, false); | 949 | abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, false); |
948 | 950 | ||
951 | searchEdit->clearFocus(); | ||
952 | abList->setFocus(); | ||
953 | if ( abList->numSelections() ) | ||
954 | abList->clearSelection(); | ||
955 | |||
956 | } | ||
957 | void AddressbookWindow::slotFindPrevious() | ||
958 | { | ||
959 | if ( centralWidget() == abView() ) | ||
960 | showList(); | ||
961 | |||
962 | abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, true); | ||
949 | 963 | ||
950 | if ( abList->numSelections() ) | 964 | if ( abList->numSelections() ) |
951 | abList->clearSelection(); | 965 | abList->clearSelection(); |
@@ -959,6 +973,24 @@ void AddressbookWindow::slotFind() | |||
959 | slotFindNext(); | 973 | slotFindNext(); |
960 | } | 974 | } |
961 | 975 | ||
976 | void AddressbookWindow::slotNotFound() | ||
977 | { | ||
978 | qWarning("Got notfound signal !"); | ||
979 | QMessageBox::information( this, tr( "Not Found" ), | ||
980 | tr( "Unable to find a contact for this" ) + "\n" | ||
981 | + tr( "search pattern !" ) ); | ||
982 | |||
983 | |||
984 | } | ||
985 | void AddressbookWindow::slotWrapAround() | ||
986 | { | ||
987 | qWarning("Got wrap signal !"); | ||
988 | if ( doNotifyWrapAround ) | ||
989 | QMessageBox::information( this, tr( "End of list" ), | ||
990 | tr( "End of list. Wrap around now.. !" ) + "\n" ); | ||
991 | |||
992 | } | ||
993 | |||
962 | void AddressbookWindow::slotSetCategory( int c ) | 994 | void AddressbookWindow::slotSetCategory( int c ) |
963 | { | 995 | { |
964 | 996 | ||