author | eilers <eilers> | 2005-03-18 16:06:14 (UTC) |
---|---|---|
committer | eilers <eilers> | 2005-03-18 16:06:14 (UTC) |
commit | e8df4b3938c8f97aa958708a56794797f16b24c7 (patch) (side-by-side diff) | |
tree | 1e70153934960abc8e493a4da506021cf535e2d0 | |
parent | b37f4395889351829e295d6fd1b4535ad3a67728 (diff) | |
download | opie-e8df4b3938c8f97aa958708a56794797f16b24c7.zip opie-e8df4b3938c8f97aa958708a56794797f16b24c7.tar.gz opie-e8df4b3938c8f97aa958708a56794797f16b24c7.tar.bz2 |
Fixing problem with categories: "unfiled" and "all" show the same list.
Previous patch removed correct use of the pim backend. Therefore I had reimplemented it.
-rw-r--r-- | core/pim/addressbook/abview.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 34035fd..8a2db96 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp @@ -96,133 +96,143 @@ AbView::~AbView() delete m_storedDB; } } void AbView::setView( Views view ) { odebug << "AbView::setView( Views view )" << oendl; m_curr_View = view; load(); } void AbView::addEntry( const Opie::OPimContact &newContact ) { odebug << "AbView::AddContact" << oendl; m_contactdb->add ( newContact ); load(); } void AbView::removeEntry( const int UID ) { odebug << "AbView;:RemoveContact" << oendl; m_contactdb->remove( UID ); load(); } void AbView::replaceEntry( const Opie::OPimContact &contact ) { odebug << "AbView::ReplaceContact" << oendl; m_contactdb->replace( contact ); load(); } Opie::OPimContact AbView::currentEntry() { Opie::OPimContact currentContact; switch ( (int) m_curr_View ) { case TableView: currentContact = m_abTable -> currentEntry(); break; case CardView: currentContact = m_ablabel -> currentEntry(); break; } m_curr_Contact = currentContact.uid(); return currentContact; } bool AbView::save() { // odebug << "AbView::Save data" << oendl; return m_contactdb->save(); } void AbView::load() { odebug << "AbView::Load data" << oendl; // Letter Search is stopped at this place emit signalClearLetterPicker(); - m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, - Opie::OPimContactAccess::FilterCategory, m_curr_category ); - -// if ( m_curr_category != -1 ) -// clearForCategory(); + odebug << "selected Category: " << m_curr_category << oendl; + + if ( m_curr_category == -1 ) { + // Show just unfiled contacts + m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, + Opie::OPimContactAccess::DoNotShowWithCategory, 0 ); + } else if ( m_curr_category == 0 ){ + // Just show all contacts + m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, + Opie::OPimBase::FilterOff, 0 ); + } else { + // Show contacts with given categories + m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName, + Opie::OPimBase::FilterCategory, m_curr_category ); + } odebug << "Number of contacts: " << m_list.count() << oendl; updateView( true ); } void AbView::reload() { odebug << "AbView::::reload()" << oendl; m_contactdb->reload(); load(); } void AbView::clear() { // :SX } void AbView::setShowByCategory( const QString& cat ) { odebug << "AbView::setShowCategory( const QString& cat )" << oendl; int intCat = 0; // Unfiled will be stored as -1 if ( cat == tr( "Unfiled" ) ) intCat = -1; else if ( cat.isNull() ) intCat = 0; else intCat = mCat.id("Contacts", cat ); // Just do anything if we really change the category if ( intCat != m_curr_category ){ // odebug << "Categories: Selected " << cat << ".. Number: " // << m_curr_category << oendl; m_curr_category = intCat; emit signalClearLetterPicker(); load(); } m_curr_category = intCat; } void AbView::setShowToView( Views view ) { odebug << "void AbView::setShowToView( View " << view << " )" << oendl; if ( m_curr_View != view ){ odebug << "Change the View (Category is: " << m_curr_category << ")" << oendl; m_prev_View = m_curr_View; m_curr_View = view; updateView(); } } void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) { odebug << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; |