Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index aa242b7..52e5f59 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp @@ -14,12 +14,13 @@ ** **********************************************************************/ #include "abview.h" #include <opie2/ocontactaccessbackend_vcard.h> +#include <opie2/odebug.h> #include <qpe/global.h> #include <qlayout.h> #include <assert.h> @@ -48,13 +49,13 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): m_contactdb ( 0l ), m_storedDB ( 0l ), m_viewStack( 0l ), m_abTable( 0l ), m_orderedFields( ordered ) { - qWarning("AbView::c'tor"); + Opie::Core::owarn << "AbView::c'tor" << oendl; // Load default database and handle syncing myself.. ! m_contactdb = new Opie::OPimContactAccess ( "addressbook", 0l, 0l, false ); m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available mCat.load( categoryFileName() ); // Create Layout and put WidgetStack into it. @@ -96,34 +97,34 @@ AbView::~AbView() } } void AbView::setView( Views view ) { - qWarning("AbView::setView( Views view )"); + Opie::Core::owarn << "AbView::setView( Views view )" << oendl; m_curr_View = view; load(); } void AbView::addEntry( const Opie::OPimContact &newContact ) { - qWarning("abview:AddContact"); + Opie::Core::owarn << "AbView::AddContact" << oendl; m_contactdb->add ( newContact ); load(); } void AbView::removeEntry( const int UID ) { - qWarning("abview:RemoveContact"); + Opie::Core::owarn << "AbView;:RemoveContact" << oendl; m_contactdb->remove( UID ); load(); } void AbView::replaceEntry( const Opie::OPimContact &contact ) { - qWarning("abview:ReplaceContact"); + Opie::Core::owarn << "AbView::ReplaceContact" << oendl; m_contactdb->replace( contact ); load(); } Opie::OPimContact AbView::currentEntry() @@ -141,20 +142,20 @@ Opie::OPimContact AbView::currentEntry() m_curr_Contact = currentContact.uid(); return currentContact; } bool AbView::save() { - // qWarning("abView:Save data"); + // Opie::Core::owarn << "AbView::Save data" << oendl; return m_contactdb->save(); } void AbView::load() { - qWarning("abView:Load data"); + Opie::Core::owarn << "AbView::Load data" << oendl; // Letter Search is stopped at this place emit signalClearLetterPicker(); if ( m_inPersonal ) // VCard Backend does not sort.. @@ -162,72 +163,73 @@ void AbView::load() else{ m_list = m_contactdb->sorted( true, 0, 0, 0 ); if ( m_curr_category != -1 ) clearForCategory(); } - qWarning ("Number of contacts: %d", m_list.count()); + Opie::Core::owarn << "Number of contacts: " << m_list.count() << oendl; updateView( true ); } void AbView::reload() { - qWarning( "void AbView::reload()" ); + Opie::Core::owarn << "AbView::::reload()" << oendl; m_contactdb->reload(); load(); } void AbView::clear() { // :SX } void AbView::setShowByCategory( const QString& cat ) { - qWarning("AbView::setShowCategory( const QString& cat )"); + Opie::Core::owarn << "AbView::setShowCategory( const QString& cat )" << oendl; int intCat = 0; // All (cat == NULL) will be stored as -1 if ( cat.isNull() ) intCat = -1; else intCat = mCat.id("Contacts", cat ); // Just do anything if we really change the category if ( intCat != m_curr_category ){ - // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); + // Opie::Core::owarn << "Categories: Selected " << cat << ".. Number: " + // << m_curr_category << oendl; m_curr_category = intCat; emit signalClearLetterPicker(); load(); } } void AbView::setShowToView( Views view ) { - qWarning("void AbView::setShowToView( View %d )", view); + Opie::Core::owarn << "void AbView::setShowToView( View " << view << " )" << oendl; if ( m_curr_View != view ){ - qWarning ("Change the View (Category is: %d)", m_curr_category); + Opie::Core::owarn << "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 ) { - qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); + Opie::Core::owarn << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; assert( mode < AbConfig::LASTELEMENT ); Opie::OPimContact query; if ( c == 0 ){ load(); @@ -244,14 +246,14 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) query.setLastName( QString("%1*").arg(c) ); break; case AbConfig::FileAs: query.setFileAs( QString("%1*").arg(c) ); break; default: - qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); - qWarning( "I will ignore it.." ); + Opie::Core::owarn << "Unknown Searchmode for AbView::setShowByLetter ! -> " << mode << oendl + << "I will ignore it.." << oendl; return; } m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); if ( m_curr_category != -1 ) clearForCategory(); m_curr_Contact = 0; @@ -274,13 +276,13 @@ QString AbView::showCategory() const { return mCat.label( "Contacts", m_curr_category ); } void AbView::showPersonal( bool personal ) { - qWarning ("void AbView::showPersonal( %d )", personal); + Opie::Core::owarn << "void AbView::showPersonal( " << personal << " )" << oendl; if ( personal ){ if ( m_inPersonal ) return; @@ -330,13 +332,13 @@ QStringList AbView::categories() } // BEGIN: Slots void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, bool , QString cat ) { - // qWarning( "void AbView::slotDoFind" ); + // Opie::Core::owarn << "void AbView::slotDoFind" << oendl; // We reloading the data: Deselect Letterpicker emit signalClearLetterPicker(); // Use the current Category if nothing else selected int category = 0; @@ -344,22 +346,22 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, if ( cat.isEmpty() ) category = m_curr_category; else{ category = mCat.id("Contacts", cat ); } - // qWarning ("Find in Category %d", category); + // Opie::Core::owarn << "Find in Category " << category << oendl; QRegExp r( str ); r.setCaseSensitive( caseSensitive ); r.setWildcard( !useRegExp ); // Get all matching entries out of the database m_list = m_contactdb->matchRegexp( r ); - // qWarning( "found: %d", m_list.count() ); + // Opie::Core::owarn << "Found: " << m_list.count() << oendl; if ( m_list.count() == 0 ){ emit signalNotFound(); return; } // Now remove all contacts with wrong category (if any selected) @@ -377,22 +379,22 @@ void AbView::offSearch() m_inSearch = false; load(); } void AbView::slotSwitch(){ - // qWarning("AbView::slotSwitch()"); + // Opie::Core::owarn << "AbView::slotSwitch()" << oendl; m_prev_View = m_curr_View; switch ( (int) m_curr_View ){ case TableView: - qWarning("Switching to CardView"); + Opie::Core::owarn << "Switching to CardView" << oendl; m_curr_View = CardView; break; case CardView: - qWarning("Switching to TableView"); + Opie::Core::owarn << "Switching to TableView" << oendl; m_curr_View = TableView; break; } updateView(); } @@ -405,58 +407,59 @@ void AbView::clearForCategory() // Now remove all contacts with wrong category if any category selected Opie::OPimContactAccess::List allList = m_list; if ( m_curr_category != -1 ){ for ( it = allList.begin(); it != allList.end(); ++it ){ if ( !contactCompare( *it, m_curr_category ) ){ - // qWarning("Removing %d", (*it).uid()); + //Opie::Core::owarn << "Removing " << (*it).uid() << oendl; m_list.remove( (*it).uid() ); } } } } bool AbView::contactCompare( const Opie::OPimContact &cnt, int category ) { - // qWarning ("bool AbView::contactCompare( const Opie::OPimContact &cnt, %d )", category); + // Opie::Core::owarn << "bool AbView::contactCompare( const Opie::OPimContact &cnt, " + // << category << " )" << oendl; bool returnMe; QArray<int> cats; cats = cnt.categories(); - // qWarning ("Number of categories: %d", cats.count() ); + // Opie::Core::owarn << "Number of categories: " << cats.count() << oendl; returnMe = false; if ( cats.count() == 0 && category == 0 ) // Contacts with no category will just shown on "All" and "Unfiled" returnMe = true; else { int i; for ( i = 0; i < int(cats.count()); i++ ) { - // qWarning("Comparing %d with %d",cats[i],category ); + //Opie::Core::owarn << "Comparing " << cats[i] << " with " << category << oendl; if ( cats[i] == category ) { returnMe = true; break; } } } - // qWarning ("Return: %d", returnMe); + // Opie::Core::owarn << "Return: " << returnMe << oendl; 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( bool newdata ) { - // qWarning("AbView::updateView()"); + // Opie::Core::owarn << "AbView::updateView()" << oendl; if ( m_viewStack -> visibleWidget() ){ m_viewStack -> visibleWidget() -> clearFocus(); } // If we switching the view, we have to store some information |