author | eilers <eilers> | 2003-08-30 15:32:34 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-30 15:32:34 (UTC) |
commit | cfb97af8f45087e58d4b82689df22191bd657c34 (patch) (unidiff) | |
tree | 9e01e85787092abb0d8c6733bbe3091eaf6a892a /core/pim/addressbook/abview.cpp | |
parent | 9f07321949f8baf1a64db0e4caec58041d3f775f (diff) | |
download | opie-cfb97af8f45087e58d4b82689df22191bd657c34.zip opie-cfb97af8f45087e58d4b82689df22191bd657c34.tar.gz opie-cfb97af8f45087e58d4b82689df22191bd657c34.tar.bz2 |
Speed optimization fix:
Startup and usability improved if a lot of contacts are stored. Left speed bootleneck is the xml
file..
Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abview.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 477f85b..6cbd556 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -51,6 +51,7 @@ AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | |||
51 | m_abTable( 0l ), | 51 | m_abTable( 0l ), |
52 | m_orderedFields( ordered ) | 52 | m_orderedFields( ordered ) |
53 | { | 53 | { |
54 | qWarning("AbView::c'tor"); | ||
54 | // Load default database and handle syncing myself.. ! | 55 | // Load default database and handle syncing myself.. ! |
55 | m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), | 56 | m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), |
56 | mCat.load( categoryFileName() ); | 57 | mCat.load( categoryFileName() ); |
@@ -97,28 +98,28 @@ AbView::~AbView() | |||
97 | 98 | ||
98 | void AbView::setView( Views view ) | 99 | void AbView::setView( Views view ) |
99 | { | 100 | { |
100 | //qWarning("AbView::setView( Views view )"); | 101 | qWarning("AbView::setView( Views view )"); |
101 | m_curr_View = view; | 102 | m_curr_View = view; |
102 | load(); | 103 | load(); |
103 | } | 104 | } |
104 | 105 | ||
105 | void AbView::addEntry( const OContact &newContact ) | 106 | void AbView::addEntry( const OContact &newContact ) |
106 | { | 107 | { |
107 | //qWarning("abview:AddContact"); | 108 | qWarning("abview:AddContact"); |
108 | m_contactdb->add ( newContact ); | 109 | m_contactdb->add ( newContact ); |
109 | load(); | 110 | load(); |
110 | 111 | ||
111 | } | 112 | } |
112 | void AbView::removeEntry( const int UID ) | 113 | void AbView::removeEntry( const int UID ) |
113 | { | 114 | { |
114 | //qWarning("abview:RemoveContact"); | 115 | qWarning("abview:RemoveContact"); |
115 | m_contactdb->remove( UID ); | 116 | m_contactdb->remove( UID ); |
116 | load(); | 117 | load(); |
117 | } | 118 | } |
118 | 119 | ||
119 | void AbView::replaceEntry( const OContact &contact ) | 120 | void AbView::replaceEntry( const OContact &contact ) |
120 | { | 121 | { |
121 | //qWarning("abview:ReplaceContact"); | 122 | qWarning("abview:ReplaceContact"); |
122 | m_contactdb->replace( contact ); | 123 | m_contactdb->replace( contact ); |
123 | load(); | 124 | load(); |
124 | 125 | ||
@@ -149,7 +150,7 @@ bool AbView::save() | |||
149 | 150 | ||
150 | void AbView::load() | 151 | void AbView::load() |
151 | { | 152 | { |
152 | //qWarning("abView:Load data"); | 153 | qWarning("abView:Load data"); |
153 | 154 | ||
154 | // Letter Search is stopped at this place | 155 | // Letter Search is stopped at this place |
155 | emit signalClearLetterPicker(); | 156 | emit signalClearLetterPicker(); |
@@ -159,7 +160,8 @@ void AbView::load() | |||
159 | m_list = m_contactdb->allRecords(); | 160 | m_list = m_contactdb->allRecords(); |
160 | else{ | 161 | else{ |
161 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 162 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
162 | clearForCategory(); | 163 | if ( m_curr_category != -1 ) |
164 | clearForCategory(); | ||
163 | } | 165 | } |
164 | 166 | ||
165 | qWarning ("Number of contacts: %d", m_list.count()); | 167 | qWarning ("Number of contacts: %d", m_list.count()); |
@@ -170,7 +172,7 @@ void AbView::load() | |||
170 | 172 | ||
171 | void AbView::reload() | 173 | void AbView::reload() |
172 | { | 174 | { |
173 | //qWarning( "void AbView::reload()" ); | 175 | qWarning( "void AbView::reload()" ); |
174 | 176 | ||
175 | m_contactdb->reload(); | 177 | m_contactdb->reload(); |
176 | load(); | 178 | load(); |
@@ -183,7 +185,7 @@ void AbView::clear() | |||
183 | 185 | ||
184 | void AbView::setShowByCategory( const QString& cat ) | 186 | void AbView::setShowByCategory( const QString& cat ) |
185 | { | 187 | { |
186 | //qWarning("AbView::setShowCategory( const QString& cat )"); | 188 | qWarning("AbView::setShowCategory( const QString& cat )"); |
187 | 189 | ||
188 | int intCat = 0; | 190 | int intCat = 0; |
189 | 191 | ||
@@ -207,11 +209,10 @@ void AbView::setShowByCategory( const QString& cat ) | |||
207 | 209 | ||
208 | void AbView::setShowToView( Views view ) | 210 | void AbView::setShowToView( Views view ) |
209 | { | 211 | { |
210 | //qWarning("void AbView::setShowToView( View %d )", view); | 212 | qWarning("void AbView::setShowToView( View %d )", view); |
211 | |||
212 | //qWarning ("Change the View (Category is: %d)", m_curr_category); | ||
213 | 213 | ||
214 | if ( m_curr_View != view ){ | 214 | if ( m_curr_View != view ){ |
215 | qWarning ("Change the View (Category is: %d)", m_curr_category); | ||
215 | m_prev_View = m_curr_View; | 216 | m_prev_View = m_curr_View; |
216 | m_curr_View = view; | 217 | m_curr_View = view; |
217 | 218 | ||
@@ -250,7 +251,8 @@ void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | |||
250 | return; | 251 | return; |
251 | } | 252 | } |
252 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); | 253 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); |
253 | clearForCategory(); | 254 | if ( m_curr_category != -1 ) |
255 | clearForCategory(); | ||
254 | m_curr_Contact = 0; | 256 | m_curr_Contact = 0; |
255 | } | 257 | } |
256 | updateView( true ); | 258 | updateView( true ); |
@@ -274,7 +276,7 @@ QString AbView::showCategory() const | |||
274 | 276 | ||
275 | void AbView::showPersonal( bool personal ) | 277 | void AbView::showPersonal( bool personal ) |
276 | { | 278 | { |
277 | //qWarning ("void AbView::showPersonal( %d )", personal); | 279 | qWarning ("void AbView::showPersonal( %d )", personal); |
278 | 280 | ||
279 | if ( personal ){ | 281 | if ( personal ){ |
280 | 282 | ||
@@ -362,7 +364,8 @@ void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, | |||
362 | // Now remove all contacts with wrong category (if any selected) | 364 | // Now remove all contacts with wrong category (if any selected) |
363 | // This algorithm is a litte bit ineffective, but | 365 | // This algorithm is a litte bit ineffective, but |
364 | // we will not have a lot of matching entries.. | 366 | // we will not have a lot of matching entries.. |
365 | clearForCategory(); | 367 | if ( m_curr_category != -1 ) |
368 | clearForCategory(); | ||
366 | 369 | ||
367 | // Now show all found entries | 370 | // Now show all found entries |
368 | updateView( true ); | 371 | updateView( true ); |