summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abview.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 7abb45c..6be19f8 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -136,56 +136,64 @@ Opie::OPimContact AbView::currentEntry()
136 currentContact = m_abTable -> currentEntry(); 136 currentContact = m_abTable -> currentEntry();
137 break; 137 break;
138 case CardView: 138 case CardView:
139 currentContact = m_ablabel -> currentEntry(); 139 currentContact = m_ablabel -> currentEntry();
140 break; 140 break;
141 } 141 }
142 m_curr_Contact = currentContact.uid(); 142 m_curr_Contact = currentContact.uid();
143 return currentContact; 143 return currentContact;
144} 144}
145 145
146bool AbView::save() 146bool AbView::save()
147{ 147{
148 //odebug << "AbView::Save data" << oendl; 148 //odebug << "AbView::Save data" << oendl;
149 149
150 return m_contactdb->save(); 150 return m_contactdb->save();
151} 151}
152 152
153void AbView::load() 153void AbView::load()
154{ 154{
155 odebug << "AbView::Load data" << oendl; 155 odebug << "AbView::Load data" << oendl;
156 156
157 // Letter Search is stopped at this place 157 // Letter Search is stopped at this place
158 emit signalClearLetterPicker(); 158 emit signalClearLetterPicker();
159 159
160 if ( m_inPersonal ) 160 if ( m_curr_category == 0 ) {
161 // VCard Backend does not sort.. 161 // Show unfiled
162 m_list = m_contactdb->allRecords(); 162 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName,
163 else{ 163 Opie::OPimContactAccess::DoNotShowWithCategory, 0 );
164 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 164 } elseif ( m_curr_category != -1 ){
165 if ( m_curr_category != -1 ) 165 // Just show selected category
166 clearForCategory(); 166 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName,
167 Opie::OPimBase::FilterCategory, m_curr_category );
168 } else {
169 // Show all categories
170 m_list = m_contactdb->sorted( true, Opie::OPimContactAccess::SortFileAsName,
171 Opie::OPimBase::FilterOff, 0 );
167 } 172 }
173
174 // if ( m_curr_category != -1 )
175 // clearForCategory();
168 176
169 odebug << "Number of contacts: " << m_list.count() << oendl; 177 odebug << "Number of contacts: " << m_list.count() << oendl;
170 178
171 updateView( true ); 179 updateView( true );
172 180
173} 181}
174 182
175void AbView::reload() 183void AbView::reload()
176{ 184{
177 odebug << "AbView::::reload()" << oendl; 185 odebug << "AbView::::reload()" << oendl;
178 186
179 m_contactdb->reload(); 187 m_contactdb->reload();
180 load(); 188 load();
181} 189}
182 190
183void AbView::clear() 191void AbView::clear()
184{ 192{
185 // :SX 193 // :SX
186} 194}
187 195
188void AbView::setShowByCategory( const QString& cat ) 196void AbView::setShowByCategory( const QString& cat )
189{ 197{
190 odebug << "AbView::setShowCategory( const QString& cat )" << oendl; 198 odebug << "AbView::setShowCategory( const QString& cat )" << oendl;
191 199
@@ -216,49 +224,52 @@ void AbView::setShowToView( Views view )
216 224
217 if ( m_curr_View != view ){ 225 if ( m_curr_View != view ){
218 odebug << "Change the View (Category is: " << m_curr_category << ")" << oendl; 226 odebug << "Change the View (Category is: " << m_curr_category << ")" << oendl;
219 m_prev_View = m_curr_View; 227 m_prev_View = m_curr_View;
220 m_curr_View = view; 228 m_curr_View = view;
221 229
222 updateView(); 230 updateView();
223 } 231 }
224 232
225} 233}
226 234
227void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) 235void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode )
228{ 236{
229 odebug << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl; 237 odebug << "void AbView::setShowByLetter( " << c << ", " << mode << " )" << oendl;
230 238
231 assert( mode < AbConfig::LASTELEMENT ); 239 assert( mode < AbConfig::LASTELEMENT );
232 240
233 Opie::OPimContact query; 241 Opie::OPimContact query;
234 if ( c == 0 ){ 242 if ( c == 0 ){
235 load(); 243 load();
236 return; 244 return;
237 }else{ 245 }else{
238 // If the current Backend is unable to solve the query, we will 246 // If the current Backend is unable to solve the query, we will
239 // ignore the request .. 247 // ignore the request ..
240 if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ) ){ 248 if ( ! m_contactdb->hasQuerySettings( Opie::OPimContactAccess::WildCards |
249 Opie::OPimContactAccess::IgnoreCase ) ){
250 owarn << "Tried to access queryByExample which is not supported by the current backend!!" << oendl;
251 owarn << "I have to ignore this access!" << oendl;
241 return; 252 return;
242 } 253 }
243 254
244 switch( mode ){ 255 switch( mode ){
245 case AbConfig::LastName: 256 case AbConfig::LastName:
246 query.setLastName( QString("%1*").arg(c) ); 257 query.setLastName( QString("%1*").arg(c) );
247 break; 258 break;
248 case AbConfig::FileAs: 259 case AbConfig::FileAs:
249 query.setFileAs( QString("%1*").arg(c) ); 260 query.setFileAs( QString("%1*").arg(c) );
250 break; 261 break;
251 default: 262 default:
252 owarn << "Unknown Searchmode for AbView::setShowByLetter ! -> " << mode << oendl 263 owarn << "Unknown Searchmode for AbView::setShowByLetter ! -> " << mode << oendl
253 << "I will ignore it.." << oendl; 264 << "I will ignore it.." << oendl;
254 return; 265 return;
255 } 266 }
256 m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase ); 267 m_list = m_contactdb->queryByExample( query, Opie::OPimContactAccess::WildCards | Opie::OPimContactAccess::IgnoreCase );
257 if ( m_curr_category != -1 ) 268 if ( m_curr_category != -1 )
258 clearForCategory(); 269 clearForCategory();
259 m_curr_Contact = 0; 270 m_curr_Contact = 0;
260 } 271 }
261 updateView( true ); 272 updateView( true );
262} 273}
263 274
264void AbView::setListOrder( const QValueList<int>& ordered ) 275void AbView::setListOrder( const QValueList<int>& ordered )