summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/addressbook.cpp
Side-by-side diff
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,
abEditor(0),
useRegExp(false),
- DoSignalWrapAround(false),
+ doNotifyWrapAround(true),
caseSensitive(false),
bAbEditFirstTime(TRUE),
@@ -86,4 +86,11 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
isLoading = true;
+ // Read Config settings
+ Config cfg("AddressBook");
+ cfg.setGroup("Search");
+ useRegExp = cfg.readBoolEntry( "useRegExp" );
+ caseSensitive = cfg.readBoolEntry( "caseSensitive" );
+ doNotifyWrapAround = cfg.readBoolEntry( "doNotifyWrapAround" );
+
initFields();
@@ -225,4 +232,10 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) );
connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) );
+ connect( abList, SIGNAL( signalSearchNext() ), this, SLOT( slotFindNext() ) );
+ connect( abList, SIGNAL( signalSearchBackward() ), this, SLOT( slotFindPrevious() ) );
+
+ // Maybe we should react on Wraparound and notfound ?
+ QObject::connect( abList, SIGNAL(signalNotFound()), this, SLOT(slotNotFound()) );
+ QObject::connect( abList, SIGNAL(signalWrapAround()), this, SLOT(slotWrapAround()) );
mView = 0;
@@ -260,11 +273,4 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name,
abList->setCurrentCell( 0, 0 );
- // Read Config settings
- Config cfg("AddressBook");
- cfg.setGroup("Search");
- useRegExp = cfg.readBoolEntry( "useRegExp" );
- caseSensitive = cfg.readBoolEntry( "caseSensitive" );
- DoSignalWrapAround = cfg.readBoolEntry( "signalWrapAround" );
-
isLoading = false;
}
@@ -276,5 +282,5 @@ void AddressbookWindow::slotConfig()
dlg -> setUseRegExp ( useRegExp );
dlg -> setBeCaseSensitive( caseSensitive );
- dlg -> setSignalWrapAround( DoSignalWrapAround );
+ dlg -> setSignalWrapAround( doNotifyWrapAround );
dlg -> showMaximized();
if ( dlg -> exec() ) {
@@ -282,5 +288,5 @@ void AddressbookWindow::slotConfig()
useRegExp = dlg -> useRegExp();
caseSensitive = dlg -> beCaseSensitive();
- DoSignalWrapAround = dlg -> signalWrapAround();
+ doNotifyWrapAround = dlg -> signalWrapAround();
}
@@ -374,5 +380,5 @@ AddressbookWindow::~AddressbookWindow()
cfg.writeEntry("useRegExp", useRegExp);
cfg.writeEntry("caseSensitive", caseSensitive);
- cfg.writeEntry("signalWrapAround", DoSignalWrapAround);
+ cfg.writeEntry("doNotifyWrapAround", doNotifyWrapAround);
}
@@ -657,7 +663,5 @@ void AddressbookWindow::slotPersonalView()
actionNew->setEnabled(TRUE);
actionTrash->setEnabled(TRUE);
-#ifndef MAKE_FOR_SHARP_ROM
actionFind->setEnabled(TRUE);
-#endif
slotUpdateToolbar(); // maybe some of the above could be moved there
showList();
@@ -929,4 +933,5 @@ void AddressbookWindow::slotFindOpen()
{
searchBar->show();
+ abList -> inSearch();
searchEdit->setFocus();
}
@@ -934,4 +939,5 @@ void AddressbookWindow::slotFindClose()
{
searchBar->hide();
+ abList -> offSearch();
abList->setFocus();
}
@@ -941,10 +947,18 @@ void AddressbookWindow::slotFindNext()
showList();
- // Maybe we should react on Wraparound and notfound ?
-// QObject::connect( abList, SIGNAL(signalNotFound()), &frmFind, SLOT(slotNotFound()) );
-// QObject::connect( abList, SIGNAL(signalWrapAround()), &frmFind, SLOT(slotWrapAround()) );
-
abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, false);
+ searchEdit->clearFocus();
+ abList->setFocus();
+ if ( abList->numSelections() )
+ abList->clearSelection();
+
+}
+void AddressbookWindow::slotFindPrevious()
+{
+ if ( centralWidget() == abView() )
+ showList();
+
+ abList->slotDoFind( searchEdit->text(), caseSensitive, useRegExp, true);
if ( abList->numSelections() )
@@ -960,4 +974,22 @@ void AddressbookWindow::slotFind()
}
+void AddressbookWindow::slotNotFound()
+{
+ qWarning("Got notfound signal !");
+ QMessageBox::information( this, tr( "Not Found" ),
+ tr( "Unable to find a contact for this" ) + "\n"
+ + tr( "search pattern !" ) );
+
+
+}
+void AddressbookWindow::slotWrapAround()
+{
+ qWarning("Got wrap signal !");
+ if ( doNotifyWrapAround )
+ QMessageBox::information( this, tr( "End of list" ),
+ tr( "End of list. Wrap around now.. !" ) + "\n" );
+
+}
+
void AddressbookWindow::slotSetCategory( int c )
{