summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp66
1 files changed, 49 insertions, 17 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
@@ -79,5 +79,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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),
@@ -86,4 +86,11 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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
@@ -225,4 +232,10 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
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;
@@ -260,11 +273,4 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
260 abList->setCurrentCell( 0, 0 ); 273 abList->setCurrentCell( 0, 0 );
261 274
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
269 isLoading = false; 275 isLoading = false;
270} 276}
@@ -276,5 +282,5 @@ void AddressbookWindow::slotConfig()
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() ) {
@@ -282,5 +288,5 @@ void AddressbookWindow::slotConfig()
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
@@ -374,5 +380,5 @@ AddressbookWindow::~AddressbookWindow()
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
@@ -657,7 +663,5 @@ void AddressbookWindow::slotPersonalView()
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();
@@ -929,4 +933,5 @@ void AddressbookWindow::slotFindOpen()
929{ 933{
930 searchBar->show(); 934 searchBar->show();
935 abList -> inSearch();
931 searchEdit->setFocus(); 936 searchEdit->setFocus();
932} 937}
@@ -934,4 +939,5 @@ void AddressbookWindow::slotFindClose()
934{ 939{
935 searchBar->hide(); 940 searchBar->hide();
941 abList -> offSearch();
936 abList->setFocus(); 942 abList->setFocus();
937} 943}
@@ -941,10 +947,18 @@ void AddressbookWindow::slotFindNext()
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}
957void 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() )
@@ -960,4 +974,22 @@ void AddressbookWindow::slotFind()
960} 974}
961 975
976void 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}
985void 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
962void AddressbookWindow::slotSetCategory( int c ) 994void AddressbookWindow::slotSetCategory( int c )
963{ 995{