summaryrefslogtreecommitdiff
authoreilers <eilers>2004-12-20 14:19:24 (UTC)
committer eilers <eilers>2004-12-20 14:19:24 (UTC)
commit29f05e7138a05c2c32cad8b40fd432cd383964a9 (patch) (unidiff)
tree2f80ace57f99ce24ac8c1e8a556c08e07ca18019
parent18e47153532d016d878f47e0ce11cb1a9716218e (diff)
downloadopie-29f05e7138a05c2c32cad8b40fd432cd383964a9.zip
opie-29f05e7138a05c2c32cad8b40fd432cd383964a9.tar.gz
opie-29f05e7138a05c2c32cad8b40fd432cd383964a9.tar.bz2
Fix for Bug #1269 and use of new sorted of the pim libary
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abview.cpp27
-rw-r--r--core/pim/addressbook/addressbook.cpp7
-rw-r--r--core/pim/addressbook/addressbook.h2
-rw-r--r--core/pim/addressbook/version.h2
4 files changed, 28 insertions, 10 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
@@ -144,40 +144,48 @@ Opie::OPimContact AbView::currentEntry()
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()
@@ -224,33 +232,36 @@ void AbView::setShowToView( Views view )
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 );
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp
index 835038a..0654e1a 100644
--- a/core/pim/addressbook/addressbook.cpp
+++ b/core/pim/addressbook/addressbook.cpp
@@ -339,32 +339,39 @@ void AddressbookWindow::exportvCard()
339 access->save(); 339 access->save();
340 } 340 }
341 delete access; 341 delete access;
342 }else 342 }else
343 QMessageBox::critical( 0, "Export VCard", 343 QMessageBox::critical( 0, "Export VCard",
344 QString( tr( "You have to select a contact !") ) ); 344 QString( tr( "You have to select a contact !") ) );
345 345
346 }else 346 }else
347 QMessageBox::critical( 0, "Export VCard", 347 QMessageBox::critical( 0, "Export VCard",
348 QString( tr( "You have to set a filename !") ) ); 348 QString( tr( "You have to set a filename !") ) );
349} 349}
350 350
351void AddressbookWindow::setDocument( const QString &filename ) 351void AddressbookWindow::setDocument( const QString &filename )
352{ 352{
353 odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl; 353 odebug << "void AddressbookWindow::setDocument( " << filename << " )" << oendl;
354 354
355 // Switch to default backend. This should avoid to import into
356 // the personal database accidently.
357 if ( actionPersonal->isOn() ){
358 actionPersonal->setOn( false );
359 slotPersonalView();
360 }
361
355 if ( filename.find(".vcf") != int(filename.length()) - 4 ){ 362 if ( filename.find(".vcf") != int(filename.length()) - 4 ){
356 363
357 364
358 365
359 switch( QMessageBox::information( this, tr ( "Right file type ?" ), 366 switch( QMessageBox::information( this, tr ( "Right file type ?" ),
360 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ), 367 tr( "The selected file \n does not end with \".vcf\".\n Do you really want to open it?" ),
361 tr( "&Yes" ), tr( "&No" ), QString::null, 368 tr( "&Yes" ), tr( "&No" ), QString::null,
362 0, // Enter == button 0 369 0, // Enter == button 0
363 2 ) ) { // Escape == button 2 370 2 ) ) { // Escape == button 2
364 case 0: 371 case 0:
365 odebug << "YES clicked" << oendl; 372 odebug << "YES clicked" << oendl;
366 break; 373 break;
367 case 1: 374 case 1:
368 odebug << "NO clicked" << oendl; 375 odebug << "NO clicked" << oendl;
369 return; 376 return;
370 break; 377 break;
diff --git a/core/pim/addressbook/addressbook.h b/core/pim/addressbook/addressbook.h
index 9217e95..7cc61bf 100644
--- a/core/pim/addressbook/addressbook.h
+++ b/core/pim/addressbook/addressbook.h
@@ -51,33 +51,33 @@ public:
51 static QString appName() { return QString::fromLatin1("addressbook"); } 51 static QString appName() { return QString::fromLatin1("addressbook"); }
52 AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 52 AddressbookWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
53 ~AddressbookWindow(); 53 ~AddressbookWindow();
54 54
55protected: 55protected:
56 void resizeEvent( QResizeEvent * e ); 56 void resizeEvent( QResizeEvent * e );
57 57
58 void editPersonal(); 58 void editPersonal();
59 void editEntry( EntryMode ); 59 void editEntry( EntryMode );
60 void closeEvent( QCloseEvent *e ); 60 void closeEvent( QCloseEvent *e );
61 bool save(); 61 bool save();
62 62
63public slots: 63public slots:
64 void flush(); 64 void flush();
65 void reload(); 65 void reload();
66 void appMessage(const QCString &, const QByteArray &); 66 void appMessage(const QCString &, const QByteArray &);
67 void setDocument( const QString & ); 67 void setDocument( const QString & ); // Called by obex receiver and internally!
68#ifdef __DEBUG_RELEASE 68#ifdef __DEBUG_RELEASE
69 // void slotSave(); 69 // void slotSave();
70#endif 70#endif
71 71
72private slots: 72private slots:
73 void importvCard(); 73 void importvCard();
74 void exportvCard(); 74 void exportvCard();
75 void slotListNew(); 75 void slotListNew();
76 /* void slotListView(); */ 76 /* void slotListView(); */
77 void slotListDelete(); 77 void slotListDelete();
78 void slotViewBack(); 78 void slotViewBack();
79 void slotViewEdit(); 79 void slotViewEdit();
80 void slotPersonalView(); 80 void slotPersonalView();
81 void listIsEmpty( bool ); 81 void listIsEmpty( bool );
82 /* void slotSettings(); */ 82 /* void slotSettings(); */
83 void writeMail(); 83 void writeMail();
diff --git a/core/pim/addressbook/version.h b/core/pim/addressbook/version.h
index 790aa95..7ce9752 100644
--- a/core/pim/addressbook/version.h
+++ b/core/pim/addressbook/version.h
@@ -1,10 +1,10 @@
1#ifndef _VERSION_H_ 1#ifndef _VERSION_H_
2#define _VERSION_H_ 2#define _VERSION_H_
3 3
4#define MAINVERSION "1" 4#define MAINVERSION "1"
5#define SUBVERSION "1" 5#define SUBVERSION "1"
6#define PATCHVERSION "0" 6#define PATCHVERSION "1"
7 7
8#define APPNAME "OPIE_ADDRESSBOOK" 8#define APPNAME "OPIE_ADDRESSBOOK"
9 9
10#endif 10#endif