summaryrefslogtreecommitdiff
authoreilers <eilers>2003-01-02 14:26:06 (UTC)
committer eilers <eilers>2003-01-02 14:26:06 (UTC)
commit12e9ed4ac80ac7fa042059b48d7447db0e59a86c (patch) (unidiff)
tree3165bc8422ca5560a30de2a7bf54c0a319516ce7
parent85a6acb57bb6a0b7c5340f3f3107c1b39884c023 (diff)
downloadopie-12e9ed4ac80ac7fa042059b48d7447db0e59a86c.zip
opie-12e9ed4ac80ac7fa042059b48d7447db0e59a86c.tar.gz
opie-12e9ed4ac80ac7fa042059b48d7447db0e59a86c.tar.bz2
Letterpicker now works for lowercase names..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/TODO9
-rw-r--r--core/pim/addressbook/abview.cpp9
2 files changed, 13 insertions, 5 deletions
diff --git a/core/pim/addressbook/TODO b/core/pim/addressbook/TODO
index df55b2d..1eb537f 100644
--- a/core/pim/addressbook/TODO
+++ b/core/pim/addressbook/TODO
@@ -1,109 +1,110 @@
1Stuff todo until OPIE 1.0 : 1Stuff todo until OPIE 1.0 :
2=========================== 2===========================
3 3
4Feature requests: 4Feature requests:
5----------------- 5-----------------
6- Dial by mobile phone by tapping the number.. 6- Dial by mobile phone by tapping the number..
7 (Maybe using gsmtool. And we may 7 (Maybe using gsmtool. And we may
8 add a library class for this) 8 add a library class for this)
9- dial with dtmfdial incase it's installed and there's no mobile 9- dial with dtmfdial incase it's installed and there's no mobile
10- 3rd column for 2. Contact 10- 3rd column for 2. Contact
11- Implementing additional Views (Phonebook, ...) 11- Implementing additional Views (Phonebook, ...)
12- Birthday & Anniversary Reminder 12- Birthday & Anniversary Reminder
13- Plugin for Today for Birthdays and Anniversaries 13- Plugin for Today for Birthdays and Anniversaries
14- Beaming of multiple contacts (current list/ by search or by category) 14- Beaming of multiple contacts (current list/ by search or by category)
15 15
16Known Bugs: 16Known Bugs:
17----------- 17-----------
18- Language not English (tested with german opie-translation):
19 1. Configure nicht übersetzt (alles leer).
20 2. Contacteditor nur teilweise übersetzt.
21 3. Kategorie-Picker geht nicht.
22 18
23 19
24Bugs but not in addressbook: 20Bugs but not in addressbook:
25----------------------------- 21-----------------------------
26- VCARD: If umlaut (äöüß) in address, the parser gets confused.. 22- VCARD: If umlaut (äöüß) in address, the parser gets confused..
27 23
28- Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se)) 24- Exporting and reimporting of Jobtitle was reported to fail (Could not reproduce this ! (se))
29 25
30 26
31Urgent: 27Urgent:
32-------- 28--------
33ContactEditor: 29ContactEditor:
34- Contact-Editor is temporarely reenabled. Wait for replacement. 30- Contact-Editor is temporarely reenabled. Wait for replacement.
35- Redesign of Contacteditor 31- Redesign of Contacteditor
36- Store last settings of combo-boxes 32- Store last settings of combo-boxes
37- Category is on the wrong position after changing to personal and back to normal 33- Category is on the wrong position after changing to personal and back to normal
38 ( Temporarily workaround: Category is never deactivated.. :S ) 34 ( Temporarily workaround: Category is never deactivated.. :S )
35
39- Personal and Business Web-page is not editable 36- Personal and Business Web-page is not editable
40 37
41Important: 38Important:
42---------- 39----------
43 40
44- Implement a picker/combo for the default email. 41- Implement a picker/combo for the default email.
45- After search (Started with Return): KeyFocus should be on Tabelle 42- After search (Started with Return): KeyFocus should be on Tabelle
46 43
47- "What's this" should be added (Deleyed after Feature Freeze) 44- "What's this" should be added (Deleyed after Feature Freeze)
48 45
49Less important: 46Less important:
50--------------- 47---------------
51- Reload if contacts were changed externally 48- Reload if contacts were changed externally
52- Overview window cleanup needed.. 49- Overview window cleanup needed..
53- The picker (alphabetical sort widget) should be 50- The picker (alphabetical sort widget) should be
54 placed verticaly or horizontally (configurable) 51 placed verticaly or horizontally (configurable)
55- Find a smart solution for activating/deactivating the "send email" event 52- Find a smart solution for activating/deactivating the "send email" event
56 53
57Should be Fixed (not absolute sure, need further validation): 54Should be Fixed (not absolute sure, need further validation):
58------------------------------------------------------------- 55-------------------------------------------------------------
59 56
60 57
61Fixed: 58Fixed:
62------- 59-------
63- Syncing: abtable not reloaded after sync. 60- Syncing: abtable not reloaded after sync.
64- Find widget should be replaced by something like 61- Find widget should be replaced by something like
65 qpdf has. 62 qpdf has.
66- Adding a configuration dialog 63- Adding a configuration dialog
67- Picker: Activated letter schould be more visible 64- Picker: Activated letter schould be more visible
68- Advanced handling of cursor keys (search..) 65- Advanced handling of cursor keys (search..)
69- Mail-Icon is missing 66- Mail-Icon is missing
70- Use opie-mail insted of qt-mail if possible. 67- Use opie-mail insted of qt-mail if possible.
71- Font menu is invisible using german translation 68- Font menu is invisible using german translation
72- Personal contact editor: Disable categories 69- Personal contact editor: Disable categories
73- "Nonenglish" translation bug has to be fixed. 70- "Nonenglish" translation bug has to be fixed.
74- contacteditor: Birthday, annyversary, ... : Use Dateselector 71- contacteditor: Birthday, annyversary, ... : Use Dateselector
75- The names of the countries are sorted by there english names, only.. 72- The names of the countries are sorted by there english names, only..
76 Even if they are translated.. :S 73 Even if they are translated.. :S
77- Cursor keys should work in detail-view (ablabel) 74- Cursor keys should work in detail-view (ablabel)
78 -> Ablabel should be removed and Abtable should be increased with 75 -> Ablabel should be removed and Abtable should be increased with
79 different views (as started by darwin zins).. 76 different views (as started by darwin zins)..
80- Use advanced database functions in abtable to decrease 77- Use advanced database functions in abtable to decrease
81 memory footprint and to make everything more easy ! 78 memory footprint and to make everything more easy !
82 (abtable should store Iterator for selected Category) 79 (abtable should store Iterator for selected Category)
83- Abtable: Configure Contact column (internally already available, 80- Abtable: Configure Contact column (internally already available,
84 need configuration) 81 need configuration)
85- Select of primary contact (see #274 on mantis) 82- Select of primary contact (see #274 on mantis)
86- Category-select does not work completely: "Unfiled" is always in listview .. 83- Category-select does not work completely: "Unfiled" is always in listview ..
87- Return from Contacteditor: Category resettet to all 84- Return from Contacteditor: Category resettet to all
88- Personal Details not working 85- Personal Details not working
89- If category changed, the letterpicker should be resetted 86- If category changed, the letterpicker should be resetted
90- There should be some icons for List and Cardview 87- There should be some icons for List and Cardview
91- If in Cardview and a category change removes all entries: 88- If in Cardview and a category change removes all entries:
92 There are already entries in Cardview after up/down 89 There are already entries in Cardview after up/down
93- Personal Details: Anniversary zeigt Fantasie-Werte 90- Personal Details: Anniversary zeigt Fantasie-Werte
94- Unfiled shown just in Category "All" and "Unfiled". 91- Unfiled shown just in Category "All" and "Unfiled".
95- After finising search and after Edit: Clear Picker 92- After finising search and after Edit: Clear Picker
96- After Edit: Table position back to edited entry. 93- After Edit: Table position back to edited entry.
97- Optimize Table Update... 94- Optimize Table Update...
98- Change MyDialog to Config 95- Change MyDialog to Config
99- Store position and state of toolbar 96- Store position and state of toolbar
100- Searchwidget closed: Selected user is jumping 97- Searchwidget closed: Selected user is jumping
101- Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist) 98- Wenn suchen beendet, dann dauert das Tabellenupdate (was überhaupt überflüssig ist)
102 zu lange.. 99 zu lange..
103- VCARD: Import of Anniversary does not work correctly (currently disabled) 100- VCARD: Import of Anniversary does not work correctly (currently disabled)
104- Name order selected in "contacteditor" not used in list view. 101- Name order selected in "contacteditor" not used in list view.
105- OK-Key does not switch from Detailview (ablable) to Listview 102- OK-Key does not switch from Detailview (ablable) to Listview
106- Receiving of beams should open a dialog 103- Receiving of beams should open a dialog
107- Fix start of opie-mail 104- Fix start of opie-mail
108- Implement Button Pics 105- Implement Button Pics
109- Add a dialog to accept and optionally edit received contacts by IRDA. 106- Add a dialog to accept and optionally edit received contacts by IRDA.
107- Language not English (tested with german opie-translation):
108 1. Configure nicht übersetzt (alles leer).
109 2. Contacteditor nur teilweise übersetzt.
110 3. Kategorie-Picker geht nicht.
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp
index 161b163..93e57ca 100644
--- a/core/pim/addressbook/abview.cpp
+++ b/core/pim/addressbook/abview.cpp
@@ -1,468 +1,475 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de) 2** Copyright (c) 2002 Stefan Eilers (eilers.stefan@epost.de)
3** 3**
4** This file is part of Qt Palmtop Environment. 4** This file is part of Qt Palmtop Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** 14**
15**********************************************************************/ 15**********************************************************************/
16 16
17#include "abview.h" 17#include "abview.h"
18 18
19#include <qlayout.h> 19#include <qlayout.h>
20 20
21#include <qpe/global.h> 21#include <qpe/global.h>
22 22
23#include <opie/ocontactaccessbackend_vcard.h> 23#include <opie/ocontactaccessbackend_vcard.h>
24 24
25 25
26// Is defined in LibQPE 26// Is defined in LibQPE
27extern QString categoryFileName(); 27extern QString categoryFileName();
28 28
29QString addressbookPersonalVCardName() 29QString addressbookPersonalVCardName()
30{ 30{
31 QString filename = Global::applicationFileName("addressbook", 31 QString filename = Global::applicationFileName("addressbook",
32 "businesscard.vcf"); 32 "businesscard.vcf");
33 return filename; 33 return filename;
34} 34}
35 35
36 36
37AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): 37AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ):
38 QWidget(parent), 38 QWidget(parent),
39 mCat(0), 39 mCat(0),
40 m_inSearch( false ), 40 m_inSearch( false ),
41 m_inPersonal( false ), 41 m_inPersonal( false ),
42 m_curr_category( -1 ), 42 m_curr_category( -1 ),
43 m_curr_View( TableView ), 43 m_curr_View( TableView ),
44 m_prev_View( TableView ), 44 m_prev_View( TableView ),
45 m_curr_Contact ( 0 ), 45 m_curr_Contact ( 0 ),
46 m_contactdb ( 0l ), 46 m_contactdb ( 0l ),
47 m_storedDB ( 0l ), 47 m_storedDB ( 0l ),
48 m_viewStack( 0l ), 48 m_viewStack( 0l ),
49 m_abTable( 0l ), 49 m_abTable( 0l ),
50 m_orderedFields( ordered ) 50 m_orderedFields( ordered )
51{ 51{
52 // Load default database and handle syncing myself.. ! 52 // Load default database and handle syncing myself.. !
53 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), 53 m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ),
54 mCat.load( categoryFileName() ); 54 mCat.load( categoryFileName() );
55 55
56 // Create Layout and put WidgetStack into it. 56 // Create Layout and put WidgetStack into it.
57 QVBoxLayout *vb = new QVBoxLayout( this ); 57 QVBoxLayout *vb = new QVBoxLayout( this );
58 m_viewStack = new QWidgetStack( this ); 58 m_viewStack = new QWidgetStack( this );
59 vb->addWidget( m_viewStack ); 59 vb->addWidget( m_viewStack );
60 60
61 // Creat TableView 61 // Creat TableView
62 QVBox* tableBox = new QVBox( m_viewStack ); 62 QVBox* tableBox = new QVBox( m_viewStack );
63 m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); 63 m_abTable = new AbTable( m_orderedFields, tableBox, "table" );
64 m_abTable->setCurrentCell( 0, 0 ); 64 m_abTable->setCurrentCell( 0, 0 );
65 m_abTable->setFocus(); 65 m_abTable->setFocus();
66 66
67 // Add TableView to WidgetStack and raise it 67 // Add TableView to WidgetStack and raise it
68 m_viewStack -> addWidget( tableBox , TableView ); 68 m_viewStack -> addWidget( tableBox , TableView );
69 69
70 // Create CardView and add it to WidgetStack 70 // Create CardView and add it to WidgetStack
71 QVBox* cardBox = new QVBox( m_viewStack ); 71 QVBox* cardBox = new QVBox( m_viewStack );
72 m_ablabel = new AbLabel( cardBox, "CardView"); 72 m_ablabel = new AbLabel( cardBox, "CardView");
73 m_viewStack -> addWidget( cardBox , CardView ); 73 m_viewStack -> addWidget( cardBox , CardView );
74 74
75 // Connect views to me 75 // Connect views to me
76 connect ( m_abTable, SIGNAL( signalSwitch( void ) ), 76 connect ( m_abTable, SIGNAL( signalSwitch( void ) ),
77 this, SLOT( slotSwitch( void ) ) ); 77 this, SLOT( slotSwitch( void ) ) );
78 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), 78 connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ),
79 this, SLOT( slotSwitch( void ) ) ); 79 this, SLOT( slotSwitch( void ) ) );
80 80
81 load(); 81 load();
82} 82}
83 83
84AbView::~AbView() 84AbView::~AbView()
85{ 85{
86 m_contactdb -> save(); 86 m_contactdb -> save();
87 delete m_contactdb; 87 delete m_contactdb;
88 88
89 if ( m_storedDB ){ 89 if ( m_storedDB ){
90 m_storedDB -> save(); 90 m_storedDB -> save();
91 delete m_storedDB; 91 delete m_storedDB;
92 } 92 }
93} 93}
94 94
95 95
96void AbView::setView( Views view ) 96void AbView::setView( Views view )
97{ 97{
98 qWarning("AbView::setView( Views view )"); 98 qWarning("AbView::setView( Views view )");
99 m_curr_View = view; 99 m_curr_View = view;
100 load(); 100 load();
101} 101}
102 102
103void AbView::addEntry( const OContact &newContact ) 103void AbView::addEntry( const OContact &newContact )
104{ 104{
105 qWarning("abview:AddContact"); 105 qWarning("abview:AddContact");
106 m_contactdb->add ( newContact ); 106 m_contactdb->add ( newContact );
107 load(); 107 load();
108 108
109} 109}
110void AbView::removeEntry( const int UID ) 110void AbView::removeEntry( const int UID )
111{ 111{
112 qWarning("abview:RemoveContact"); 112 qWarning("abview:RemoveContact");
113 m_contactdb->remove( UID ); 113 m_contactdb->remove( UID );
114 load(); 114 load();
115} 115}
116 116
117void AbView::replaceEntry( const OContact &contact ) 117void AbView::replaceEntry( const OContact &contact )
118{ 118{
119 qWarning("abview:ReplaceContact"); 119 qWarning("abview:ReplaceContact");
120 m_contactdb->replace( contact ); 120 m_contactdb->replace( contact );
121 load(); 121 load();
122 122
123} 123}
124 124
125OContact AbView::currentEntry() 125OContact AbView::currentEntry()
126{ 126{
127 OContact currentContact; 127 OContact currentContact;
128 128
129 switch ( (int) m_curr_View ) { 129 switch ( (int) m_curr_View ) {
130 case TableView: 130 case TableView:
131 currentContact = m_abTable -> currentEntry(); 131 currentContact = m_abTable -> currentEntry();
132 break; 132 break;
133 case CardView: 133 case CardView:
134 currentContact = m_ablabel -> currentEntry(); 134 currentContact = m_ablabel -> currentEntry();
135 break; 135 break;
136 } 136 }
137 m_curr_Contact = currentContact.uid(); 137 m_curr_Contact = currentContact.uid();
138 return currentContact; 138 return currentContact;
139} 139}
140 140
141bool AbView::save() 141bool AbView::save()
142{ 142{
143 qWarning("abView:Save data"); 143 qWarning("abView:Save data");
144 144
145 return m_contactdb->save(); 145 return m_contactdb->save();
146} 146}
147 147
148void AbView::load() 148void AbView::load()
149{ 149{
150 qWarning("abView:Load data"); 150 qWarning("abView:Load data");
151 151
152 // Letter Search is stopped at this place 152 // Letter Search is stopped at this place
153 emit signalClearLetterPicker(); 153 emit signalClearLetterPicker();
154 154
155 if ( m_inPersonal ) 155 if ( m_inPersonal )
156 // VCard Backend does not sort..
156 m_list = m_contactdb->allRecords(); 157 m_list = m_contactdb->allRecords();
157 else{ 158 else{
158 m_list = m_contactdb->sorted( true, 0, 0, 0 ); 159 m_list = m_contactdb->sorted( true, 0, 0, 0 );
159 clearForCategory(); 160 clearForCategory();
160 } 161 }
161 162
162 qWarning ("Number of contacts: %d", m_list.count()); 163 qWarning ("Number of contacts: %d", m_list.count());
163 164
164 updateView( true ); 165 updateView( true );
165 166
166} 167}
167 168
168void AbView::reload() 169void AbView::reload()
169{ 170{
170 qWarning( "void AbView::reload()" ); 171 qWarning( "void AbView::reload()" );
171 172
172 m_contactdb->reload(); 173 m_contactdb->reload();
173 load(); 174 load();
174} 175}
175 176
176void AbView::clear() 177void AbView::clear()
177{ 178{
178 // :SX 179 // :SX
179} 180}
180 181
181void AbView::setShowByCategory( const QString& cat ) 182void AbView::setShowByCategory( const QString& cat )
182{ 183{
183 qWarning("AbView::setShowCategory( const QString& cat )"); 184 qWarning("AbView::setShowCategory( const QString& cat )");
184 185
185 int intCat = 0; 186 int intCat = 0;
186 187
187 // All (cat == NULL) will be stored as -1 188 // All (cat == NULL) will be stored as -1
188 if ( cat.isNull() ) 189 if ( cat.isNull() )
189 intCat = -1; 190 intCat = -1;
190 else 191 else
191 intCat = mCat.id("Contacts", cat ); 192 intCat = mCat.id("Contacts", cat );
192 193
193 // Just do anything if we really change the category 194 // Just do anything if we really change the category
194 if ( intCat != m_curr_category ){ 195 if ( intCat != m_curr_category ){
195 qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); 196 qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category);
196 197
197 m_curr_category = intCat; 198 m_curr_category = intCat;
198 emit signalClearLetterPicker(); 199 emit signalClearLetterPicker();
199 200
200 load(); 201 load();
201 } 202 }
202 203
203} 204}
204 205
205void AbView::setShowToView( Views view ) 206void AbView::setShowToView( Views view )
206{ 207{
207 qWarning("void AbView::setShowToView( View %d )", view); 208 qWarning("void AbView::setShowToView( View %d )", view);
208 209
209 qWarning ("Change the View (Category is: %d)", m_curr_category); 210 qWarning ("Change the View (Category is: %d)", m_curr_category);
210 211
211 if ( m_curr_View != view ){ 212 if ( m_curr_View != view ){
212 m_prev_View = m_curr_View; 213 m_prev_View = m_curr_View;
213 m_curr_View = view; 214 m_curr_View = view;
214 215
215 updateView(); 216 updateView();
216 } 217 }
217 218
218} 219}
219 220
220void AbView::setShowByLetter( char c ) 221void AbView::setShowByLetter( char c )
221{ 222{
222 qWarning("void AbView::setShowByLetter( %c )", c ); 223 qWarning("void AbView::setShowByLetter( %c )", c );
223 OContact query; 224 OContact query;
224 if ( c == 0 ){ 225 if ( c == 0 ){
225 load(); 226 load();
226 return; 227 return;
227 }else{ 228 }else{
229 // If the current Backend is unable to solve the query, we will
230 // ignore the request ..
231 if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){
232 return;
233 }
234
228 query.setLastName( QString("%1*").arg(c) ); 235 query.setLastName( QString("%1*").arg(c) );
229 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards ); 236 m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase );
230 clearForCategory(); 237 clearForCategory();
231 m_curr_Contact = 0; 238 m_curr_Contact = 0;
232 } 239 }
233 updateView( true ); 240 updateView( true );
234} 241}
235 242
236void AbView::setListOrder( const QValueList<int>& ordered ) 243void AbView::setListOrder( const QValueList<int>& ordered )
237{ 244{
238 m_orderedFields = ordered; 245 m_orderedFields = ordered;
239 updateView(); 246 updateView();
240} 247}
241 248
242 249
243QString AbView::showCategory() const 250QString AbView::showCategory() const
244{ 251{
245 return mCat.label( "Contacts", m_curr_category ); 252 return mCat.label( "Contacts", m_curr_category );
246} 253}
247 254
248void AbView::showPersonal( bool personal ) 255void AbView::showPersonal( bool personal )
249{ 256{
250 qWarning ("void AbView::showPersonal( %d )", personal); 257 qWarning ("void AbView::showPersonal( %d )", personal);
251 258
252 if ( personal ){ 259 if ( personal ){
253 260
254 if ( m_inPersonal ) 261 if ( m_inPersonal )
255 return; 262 return;
256 263
257 // Now switch to vCard Backend and load data. 264 // Now switch to vCard Backend and load data.
258 // The current default backend will be stored 265 // The current default backend will be stored
259 // to avoid unneeded load/stores. 266 // to avoid unneeded load/stores.
260 m_storedDB = m_contactdb; 267 m_storedDB = m_contactdb;
261 268
262 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, 269 OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null,
263 addressbookPersonalVCardName() ); 270 addressbookPersonalVCardName() );
264 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); 271 m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true );
265 272
266 m_inPersonal = true; 273 m_inPersonal = true;
267 m_curr_View = CardView; 274 m_curr_View = CardView;
268 275
269 }else{ 276 }else{
270 277
271 if ( !m_inPersonal ) 278 if ( !m_inPersonal )
272 return; 279 return;
273 280
274 // Remove vCard Backend and restore default 281 // Remove vCard Backend and restore default
275 m_contactdb->save(); 282 m_contactdb->save();
276 delete m_contactdb; 283 delete m_contactdb;
277 284
278 m_contactdb = m_storedDB; 285 m_contactdb = m_storedDB;
279 m_storedDB = 0l; 286 m_storedDB = 0l;
280 287
281 m_curr_View = TableView; 288 m_curr_View = TableView;
282 m_inPersonal = false; 289 m_inPersonal = false;
283 290
284 } 291 }
285 load(); 292 load();
286} 293}
287 294
288QStringList AbView::categories() 295QStringList AbView::categories()
289{ 296{
290 mCat.load( categoryFileName() ); 297 mCat.load( categoryFileName() );
291 QStringList categoryList = mCat.labels( "Contacts" ); 298 QStringList categoryList = mCat.labels( "Contacts" );
292 return categoryList; 299 return categoryList;
293} 300}
294 301
295// BEGIN: Slots 302// BEGIN: Slots
296void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp, 303void AbView::slotDoFind( const QString &str, bool caseSensitive, bool useRegExp,
297 bool , QString cat ) 304 bool , QString cat )
298{ 305{
299 qWarning( "void AbView::slotDoFind" ); 306 qWarning( "void AbView::slotDoFind" );
300 307
301 // We reloading the data: Deselect Letterpicker 308 // We reloading the data: Deselect Letterpicker
302 emit signalClearLetterPicker(); 309 emit signalClearLetterPicker();
303 310
304 // Use the current Category if nothing else selected 311 // Use the current Category if nothing else selected
305 int category = 0; 312 int category = 0;
306 313
307 if ( cat.isEmpty() ) 314 if ( cat.isEmpty() )
308 category = m_curr_category; 315 category = m_curr_category;
309 else{ 316 else{
310 category = mCat.id("Contacts", cat ); 317 category = mCat.id("Contacts", cat );
311 } 318 }
312 319
313 qWarning ("Find in Category %d", category); 320 qWarning ("Find in Category %d", category);
314 321
315 QRegExp r( str ); 322 QRegExp r( str );
316 r.setCaseSensitive( caseSensitive ); 323 r.setCaseSensitive( caseSensitive );
317 r.setWildcard( !useRegExp ); 324 r.setWildcard( !useRegExp );
318 325
319 // Get all matching entries out of the database 326 // Get all matching entries out of the database
320 m_list = m_contactdb->matchRegexp( r ); 327 m_list = m_contactdb->matchRegexp( r );
321 328
322 qWarning( "found: %d", m_list.count() ); 329 qWarning( "found: %d", m_list.count() );
323 if ( m_list.count() == 0 ){ 330 if ( m_list.count() == 0 ){
324 emit signalNotFound(); 331 emit signalNotFound();
325 return; 332 return;
326 } 333 }
327 334
328 // Now remove all contacts with wrong category (if any selected) 335 // Now remove all contacts with wrong category (if any selected)
329 // This algorithm is a litte bit ineffective, but 336 // This algorithm is a litte bit ineffective, but
330 // we will not have a lot of matching entries.. 337 // we will not have a lot of matching entries..
331 clearForCategory(); 338 clearForCategory();
332 339
333 // Now show all found entries 340 // Now show all found entries
334 updateView( true ); 341 updateView( true );
335} 342}
336 343
337void AbView::offSearch() 344void AbView::offSearch()
338{ 345{
339 m_inSearch = false; 346 m_inSearch = false;
340 347
341 load(); 348 load();
342} 349}
343 350
344void AbView::slotSwitch(){ 351void AbView::slotSwitch(){
345 qWarning("AbView::slotSwitch()"); 352 qWarning("AbView::slotSwitch()");
346 353
347 m_prev_View = m_curr_View; 354 m_prev_View = m_curr_View;
348 switch ( (int) m_curr_View ){ 355 switch ( (int) m_curr_View ){
349 case TableView: 356 case TableView:
350 qWarning("Switching to CardView"); 357 qWarning("Switching to CardView");
351 m_curr_View = CardView; 358 m_curr_View = CardView;
352 break; 359 break;
353 case CardView: 360 case CardView:
354 qWarning("Switching to TableView"); 361 qWarning("Switching to TableView");
355 m_curr_View = TableView; 362 m_curr_View = TableView;
356 break; 363 break;
357 } 364 }
358 updateView(); 365 updateView();
359 366
360} 367}
361 368
362// END: Slots 369// END: Slots
363 370
364void AbView::clearForCategory() 371void AbView::clearForCategory()
365{ 372{
366 OContactAccess::List::Iterator it; 373 OContactAccess::List::Iterator it;
367 // Now remove all contacts with wrong category if any category selected 374 // Now remove all contacts with wrong category if any category selected
368 375
369 OContactAccess::List allList = m_list; 376 OContactAccess::List allList = m_list;
370 if ( m_curr_category != -1 ){ 377 if ( m_curr_category != -1 ){
371 for ( it = allList.begin(); it != allList.end(); ++it ){ 378 for ( it = allList.begin(); it != allList.end(); ++it ){
372 if ( !contactCompare( *it, m_curr_category ) ){ 379 if ( !contactCompare( *it, m_curr_category ) ){
373 qWarning("Removing %d", (*it).uid()); 380 qWarning("Removing %d", (*it).uid());
374 m_list.remove( (*it).uid() ); 381 m_list.remove( (*it).uid() );
375 } 382 }
376 } 383 }
377 } 384 }
378 385
379} 386}
380 387
381bool AbView::contactCompare( const OContact &cnt, int category ) 388bool AbView::contactCompare( const OContact &cnt, int category )
382{ 389{
383 qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category); 390 qWarning ("bool AbView::contactCompare( const OContact &cnt, %d )", category);
384 391
385 bool returnMe; 392 bool returnMe;
386 QArray<int> cats; 393 QArray<int> cats;
387 cats = cnt.categories(); 394 cats = cnt.categories();
388 395
389 qWarning ("Number of categories: %d", cats.count() ); 396 qWarning ("Number of categories: %d", cats.count() );
390 397
391 returnMe = false; 398 returnMe = false;
392 if ( cats.count() == 0 && category == 0 ) 399 if ( cats.count() == 0 && category == 0 )
393 // Contacts with no category will just shown on "All" and "Unfiled" 400 // Contacts with no category will just shown on "All" and "Unfiled"
394 returnMe = true; 401 returnMe = true;
395 else { 402 else {
396 int i; 403 int i;
397 for ( i = 0; i < int(cats.count()); i++ ) { 404 for ( i = 0; i < int(cats.count()); i++ ) {
398 qWarning("Comparing %d with %d",cats[i],category ); 405 qWarning("Comparing %d with %d",cats[i],category );
399 if ( cats[i] == category ) { 406 if ( cats[i] == category ) {
400 returnMe = true; 407 returnMe = true;
401 break; 408 break;
402 } 409 }
403 } 410 }
404 } 411 }
405 qWarning ("Return: %d", returnMe); 412 qWarning ("Return: %d", returnMe);
406 return returnMe; 413 return returnMe;
407} 414}
408 415
409// In Some rare cases we have to update all lists.. 416// In Some rare cases we have to update all lists..
410void AbView::updateListinViews() 417void AbView::updateListinViews()
411{ 418{
412 m_abTable -> setContacts( m_list ); 419 m_abTable -> setContacts( m_list );
413 m_ablabel -> setContacts( m_list ); 420 m_ablabel -> setContacts( m_list );
414} 421}
415 422
416void AbView::updateView( bool newdata ) 423void AbView::updateView( bool newdata )
417{ 424{
418 qWarning("AbView::updateView()"); 425 qWarning("AbView::updateView()");
419 426
420 if ( m_viewStack -> visibleWidget() ){ 427 if ( m_viewStack -> visibleWidget() ){
421 m_viewStack -> visibleWidget() -> clearFocus(); 428 m_viewStack -> visibleWidget() -> clearFocus();
422 } 429 }
423 430
424 // If we switching the view, we have to store some information 431 // If we switching the view, we have to store some information
425 if ( !newdata ){ 432 if ( !newdata ){
426 if ( m_list.count() ){ 433 if ( m_list.count() ){
427 switch ( (int) m_prev_View ) { 434 switch ( (int) m_prev_View ) {
428 case TableView: 435 case TableView:
429 m_curr_Contact = m_abTable -> currentEntry_UID(); 436 m_curr_Contact = m_abTable -> currentEntry_UID();
430 break; 437 break;
431 case CardView: 438 case CardView:
432 m_curr_Contact = m_ablabel -> currentEntry_UID(); 439 m_curr_Contact = m_ablabel -> currentEntry_UID();
433 break; 440 break;
434 } 441 }
435 }else 442 }else
436 m_curr_Contact = 0; 443 m_curr_Contact = 0;
437 } 444 }
438 445
439 // Feed all views with new lists 446 // Feed all views with new lists
440 if ( newdata ) 447 if ( newdata )
441 updateListinViews(); 448 updateListinViews();
442 449
443 // Tell the world that the view is changed 450 // Tell the world that the view is changed
444 if ( m_curr_View != m_prev_View ) 451 if ( m_curr_View != m_prev_View )
445 emit signalViewSwitched ( (int) m_curr_View ); 452 emit signalViewSwitched ( (int) m_curr_View );
446 453
447 m_prev_View = m_curr_View; 454 m_prev_View = m_curr_View;
448 455
449 // Switch to new View 456 // Switch to new View
450 switch ( (int) m_curr_View ) { 457 switch ( (int) m_curr_View ) {
451 case TableView: 458 case TableView:
452 m_abTable -> setChoiceSelection( m_orderedFields ); 459 m_abTable -> setChoiceSelection( m_orderedFields );
453 if ( m_curr_Contact != 0 ) 460 if ( m_curr_Contact != 0 )
454 m_abTable -> selectContact ( m_curr_Contact ); 461 m_abTable -> selectContact ( m_curr_Contact );
455 m_abTable -> setFocus(); 462 m_abTable -> setFocus();
456 break; 463 break;
457 case CardView: 464 case CardView:
458 if ( m_curr_Contact != 0 ) 465 if ( m_curr_Contact != 0 )
459 m_ablabel -> selectContact( m_curr_Contact ); 466 m_ablabel -> selectContact( m_curr_Contact );
460 m_ablabel -> setFocus(); 467 m_ablabel -> setFocus();
461 break; 468 break;
462 } 469 }
463 470
464 // Raise the current View 471 // Raise the current View
465 m_viewStack -> raiseWidget( m_curr_View ); 472 m_viewStack -> raiseWidget( m_curr_View );
466} 473}
467 474
468 475