Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 29 |
1 files changed, 19 insertions, 10 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 @@ -123,17 +123,20 @@ void AbView::replaceEntry( const OContact &contact ) } 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() { @@ -145,18 +148,21 @@ bool AbView::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(); + } qWarning ("Number of contacts: %d", m_list.count()); - updateView(); + updateView( true ); } void AbView::reload() @@ -223,9 +229,9 @@ void AbView::setShowByLetter( char c ) m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards ); clearForCategory(); m_curr_Contact = 0; } - updateView(); + updateView( true ); } void AbView::setListOrder( const QValueList<int>& ordered ) { @@ -324,9 +330,9 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, // we will not have a lot of matching entries.. clearForCategory(); // Now show all found entries - updateView(); + updateView( true ); } void AbView::offSearch() { @@ -406,17 +412,18 @@ 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 ( !newdata ){ if ( m_list.count() ){ switch ( (int) m_prev_View ) { case TableView: m_curr_Contact = m_abTable -> currentEntry_UID(); @@ -426,13 +433,15 @@ void AbView::updateView() break; } }else m_curr_Contact = 0; + } // Feed all views with new lists + 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; |