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 | |||
@@ -123,17 +123,20 @@ void AbView::replaceEntry( const OContact &contact ) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | OContact AbView::currentEntry() | 125 | OContact AbView::currentEntry() |
126 | { | 126 | { |
127 | OContact currentContact; | ||
128 | |||
127 | switch ( (int) m_curr_View ) { | 129 | switch ( (int) m_curr_View ) { |
128 | case TableView: | 130 | case TableView: |
129 | return ( m_abTable -> currentEntry() ); | 131 | currentContact = m_abTable -> currentEntry(); |
130 | break; | 132 | break; |
131 | case CardView: | 133 | case CardView: |
132 | return ( m_ablabel -> currentEntry() ); | 134 | currentContact = m_ablabel -> currentEntry(); |
133 | break; | 135 | break; |
134 | } | 136 | } |
135 | return OContact(); | 137 | m_curr_Contact = currentContact.uid(); |
138 | return currentContact; | ||
136 | } | 139 | } |
137 | 140 | ||
138 | bool AbView::save() | 141 | bool AbView::save() |
139 | { | 142 | { |
@@ -144,19 +147,22 @@ bool AbView::save() | |||
144 | 147 | ||
145 | void AbView::load() | 148 | void AbView::load() |
146 | { | 149 | { |
147 | qWarning("abView:Load data"); | 150 | qWarning("abView:Load data"); |
151 | |||
152 | // Letter Search is stopped at this place | ||
153 | emit signalClearLetterPicker(); | ||
148 | 154 | ||
149 | if ( m_inPersonal ) | 155 | if ( m_inPersonal ) |
150 | m_list = m_contactdb->allRecords(); | 156 | m_list = m_contactdb->allRecords(); |
151 | else | 157 | else{ |
152 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 158 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
153 | 159 | clearForCategory(); | |
154 | clearForCategory(); | 160 | } |
155 | 161 | ||
156 | qWarning ("Number of contacts: %d", m_list.count()); | 162 | qWarning ("Number of contacts: %d", m_list.count()); |
157 | 163 | ||
158 | updateView(); | 164 | updateView( true ); |
159 | 165 | ||
160 | } | 166 | } |
161 | 167 | ||
162 | void AbView::reload() | 168 | void AbView::reload() |
@@ -223,9 +229,9 @@ void AbView::setShowByLetter( char c ) | |||
223 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards ); | 229 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards ); |
224 | clearForCategory(); | 230 | clearForCategory(); |
225 | m_curr_Contact = 0; | 231 | m_curr_Contact = 0; |
226 | } | 232 | } |
227 | updateView(); | 233 | updateView( true ); |
228 | } | 234 | } |
229 | 235 | ||
230 | void AbView::setListOrder( const QValueList<int>& ordered ) | 236 | void AbView::setListOrder( const QValueList<int>& ordered ) |
231 | { | 237 | { |
@@ -324,9 +330,9 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
324 | // we will not have a lot of matching entries.. | 330 | // we will not have a lot of matching entries.. |
325 | clearForCategory(); | 331 | clearForCategory(); |
326 | 332 | ||
327 | // Now show all found entries | 333 | // Now show all found entries |
328 | updateView(); | 334 | updateView( true ); |
329 | } | 335 | } |
330 | 336 | ||
331 | void AbView::offSearch() | 337 | void AbView::offSearch() |
332 | { | 338 | { |
@@ -406,33 +412,36 @@ void AbView::updateListinViews() | |||
406 | m_abTable -> setContacts( m_list ); | 412 | m_abTable -> setContacts( m_list ); |
407 | m_ablabel -> setContacts( m_list ); | 413 | m_ablabel -> setContacts( m_list ); |
408 | } | 414 | } |
409 | 415 | ||
410 | void AbView::updateView() | 416 | void AbView::updateView( bool newdata ) |
411 | { | 417 | { |
412 | qWarning("AbView::updateView()"); | 418 | qWarning("AbView::updateView()"); |
413 | 419 | ||
414 | if ( m_viewStack -> visibleWidget() ){ | 420 | if ( m_viewStack -> visibleWidget() ){ |
415 | m_viewStack -> visibleWidget() -> clearFocus(); | 421 | m_viewStack -> visibleWidget() -> clearFocus(); |
416 | } | 422 | } |
417 | 423 | ||
418 | // If we switching the view, we have to store some information | 424 | // If we switching the view, we have to store some information |
419 | if ( m_list.count() ){ | 425 | if ( !newdata ){ |
420 | switch ( (int) m_prev_View ) { | 426 | if ( m_list.count() ){ |
421 | case TableView: | 427 | switch ( (int) m_prev_View ) { |
422 | m_curr_Contact = m_abTable -> currentEntry_UID(); | 428 | case TableView: |
423 | break; | 429 | m_curr_Contact = m_abTable -> currentEntry_UID(); |
424 | case CardView: | 430 | break; |
425 | m_curr_Contact = m_ablabel -> currentEntry_UID(); | 431 | case CardView: |
426 | break; | 432 | m_curr_Contact = m_ablabel -> currentEntry_UID(); |
427 | } | 433 | break; |
428 | }else | 434 | } |
429 | m_curr_Contact = 0; | 435 | }else |
436 | m_curr_Contact = 0; | ||
437 | } | ||
430 | 438 | ||
431 | // Feed all views with new lists | 439 | // Feed all views with new lists |
432 | updateListinViews(); | 440 | if ( newdata ) |
441 | updateListinViews(); | ||
433 | 442 | ||
434 | // Inform the world that the view is changed | 443 | // Tell the world that the view is changed |
435 | if ( m_curr_View != m_prev_View ) | 444 | if ( m_curr_View != m_prev_View ) |
436 | emit signalViewSwitched ( (int) m_curr_View ); | 445 | emit signalViewSwitched ( (int) m_curr_View ); |
437 | 446 | ||
438 | m_prev_View = m_curr_View; | 447 | m_prev_View = m_curr_View; |