author | eilers <eilers> | 2002-11-30 18:13:34 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-30 18:13:34 (UTC) |
commit | 6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a (patch) (side-by-side diff) | |
tree | a873946a9b52edaab8f374918c7e0b468c2353b3 /core/pim/addressbook/abview.cpp | |
parent | fe672fd88ead7a987d66f03439eb860e67aeaca6 (diff) | |
download | opie-6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a.zip opie-6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a.tar.gz opie-6afb59b5950c8fdd24dc93ac4ee370a3c8437f9a.tar.bz2 |
Fixed a lot of usability stuff .. Some minor bugs were fixed, too ..
Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 0f4bd5f..7226e82 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp @@ -115,56 +115,62 @@ void AbView::removeEntry( const int UID ) } void AbView::replaceEntry( const OContact &contact ) { qWarning("abview:ReplaceContact"); m_contactdb->replace( contact ); load(); } OContact AbView::currentEntry() { + OContact currentContact; + switch ( (int) m_curr_View ) { case TableView: - return ( m_abTable -> currentEntry() ); + currentContact = m_abTable -> currentEntry(); break; case CardView: - return ( m_ablabel -> currentEntry() ); + currentContact = m_ablabel -> currentEntry(); break; } - return OContact(); + m_curr_Contact = currentContact.uid(); + return currentContact; } bool AbView::save() { qWarning("abView:Save data"); return m_contactdb->save(); } void AbView::load() { qWarning("abView:Load data"); + + // Letter Search is stopped at this place + emit signalClearLetterPicker(); if ( m_inPersonal ) m_list = m_contactdb->allRecords(); - else + else{ m_list = m_contactdb->sorted( true, 0, 0, 0 ); - - clearForCategory(); + clearForCategory(); + } qWarning ("Number of contacts: %d", m_list.count()); - updateView(); + updateView( true ); } void AbView::reload() { qWarning( "void AbView::reload()" ); m_contactdb->reload(); load(); } void AbView::clear() @@ -215,25 +221,25 @@ void AbView::setShowByLetter( char c ) { qWarning("void AbView::setShowByLetter( %c )", c ); OContact query; if ( c == 0 ){ load(); return; }else{ query.setLastName( QString("%1*").arg(c) ); m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards ); clearForCategory(); m_curr_Contact = 0; } - updateView(); + updateView( true ); } void AbView::setListOrder( const QValueList<int>& ordered ) { m_orderedFields = ordered; updateView(); } QString AbView::showCategory() const { return mCat.label( "Contacts", m_curr_category ); @@ -316,25 +322,25 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, qWarning( "found: %d", m_list.count() ); if ( m_list.count() == 0 ){ emit signalNotFound(); return; } // Now remove all contacts with wrong category (if any selected) // This algorithm is a litte bit ineffective, but // we will not have a lot of matching entries.. clearForCategory(); // Now show all found entries - updateView(); + updateView( true ); } void AbView::offSearch() { m_inSearch = false; load(); } void AbView::slotSwitch(){ qWarning("AbView::slotSwitch()"); @@ -398,49 +404,52 @@ bool AbView::contactCompare( const OContact &cnt, int category ) } qWarning ("Return: %d", returnMe); return returnMe; } // In Some rare cases we have to update all lists.. void AbView::updateListinViews() { m_abTable -> setContacts( m_list ); m_ablabel -> setContacts( m_list ); } -void AbView::updateView() +void AbView::updateView( bool newdata ) { qWarning("AbView::updateView()"); if ( m_viewStack -> visibleWidget() ){ m_viewStack -> visibleWidget() -> clearFocus(); } // If we switching the view, we have to store some information - if ( m_list.count() ){ - switch ( (int) m_prev_View ) { - case TableView: - m_curr_Contact = m_abTable -> currentEntry_UID(); - break; - case CardView: - m_curr_Contact = m_ablabel -> currentEntry_UID(); - break; - } - }else - m_curr_Contact = 0; + if ( !newdata ){ + if ( m_list.count() ){ + switch ( (int) m_prev_View ) { + case TableView: + m_curr_Contact = m_abTable -> currentEntry_UID(); + break; + case CardView: + m_curr_Contact = m_ablabel -> currentEntry_UID(); + break; + } + }else + m_curr_Contact = 0; + } // Feed all views with new lists - updateListinViews(); + if ( newdata ) + updateListinViews(); - // Inform the world that the view is changed + // Tell the world that the view is changed if ( m_curr_View != m_prev_View ) emit signalViewSwitched ( (int) m_curr_View ); m_prev_View = m_curr_View; // Switch to new View switch ( (int) m_curr_View ) { case TableView: m_abTable -> setChoiceSelection( m_orderedFields ); if ( m_curr_Contact != 0 ) m_abTable -> selectContact ( m_curr_Contact ); m_abTable -> setFocus(); |