author | eilers <eilers> | 2002-10-21 16:29:20 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-21 16:29:20 (UTC) |
commit | 507afe645a86191815a2f85380a452ab6797e383 (patch) (side-by-side diff) | |
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 @@ -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(); @@ -162,5 +169,5 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, connect( a, SIGNAL( activated() ), this, SLOT( slotFindClose() ) ); a->addTo( searchBar ); - + a = new QAction( tr( "Write Mail To" ), Resource::loadPixmap( "qtmail/reply" ), QString::null, 0, this, 0 ); @@ -224,5 +231,11 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); - connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); + 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; @@ -259,11 +272,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 ) { |