Diffstat (limited to 'core/pim/addressbook/addressbook.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 191 |
1 files changed, 131 insertions, 60 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index 3255269..cf2eddf 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -4,25 +4,25 @@ | |||
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 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** OContact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define QTOPIA_INTERNAL_FD | 21 | #define QTOPIA_INTERNAL_FD |
22 | 22 | ||
23 | #include "contacteditor.h" | 23 | #include "contacteditor.h" |
24 | #include "ablabel.h" | 24 | #include "ablabel.h" |
25 | #include "abtable.h" | 25 | #include "abtable.h" |
26 | #include "addresssettings.h" | 26 | #include "addresssettings.h" |
27 | #include "addressbook.h" | 27 | #include "addressbook.h" |
28 | 28 | ||
@@ -86,24 +86,26 @@ static QString addressbookPersonalVCardName() | |||
86 | "businesscard.vcf"); | 86 | "businesscard.vcf"); |
87 | return filename; | 87 | return filename; |
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | 91 | AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, |
92 | WFlags f ) | 92 | WFlags f ) |
93 | : QMainWindow( parent, name, f ), | 93 | : QMainWindow( parent, name, f ), |
94 | abEditor(0), | 94 | abEditor(0), |
95 | bAbEditFirstTime(TRUE), | 95 | bAbEditFirstTime(TRUE), |
96 | syncing(FALSE) | 96 | syncing(FALSE) |
97 | { | 97 | { |
98 | isLoading = true; | ||
99 | |||
98 | initFields(); | 100 | initFields(); |
99 | 101 | ||
100 | setCaption( tr("Contacts") ); | 102 | setCaption( tr("Contacts") ); |
101 | setIcon( Resource::loadPixmap( "AddressBook" ) ); | 103 | setIcon( Resource::loadPixmap( "AddressBook" ) ); |
102 | 104 | ||
103 | setToolBarsMovable( FALSE ); | 105 | setToolBarsMovable( FALSE ); |
104 | 106 | ||
105 | // Create Toolbars | 107 | // Create Toolbars |
106 | 108 | ||
107 | QPEToolBar *bar = new QPEToolBar( this ); | 109 | QPEToolBar *bar = new QPEToolBar( this ); |
108 | bar->setHorizontalStretchable( TRUE ); | 110 | bar->setHorizontalStretchable( TRUE ); |
109 | 111 | ||
@@ -178,155 +180,161 @@ AddressbookWindow::AddressbookWindow( QWidget *parent, const char *name, | |||
178 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); | 180 | connect( a, SIGNAL( activated() ), this, SLOT( slotBeam() ) ); |
179 | a->addTo( edit ); | 181 | a->addTo( edit ); |
180 | a->addTo( listTools ); | 182 | a->addTo( listTools ); |
181 | } | 183 | } |
182 | 184 | ||
183 | edit->insertSeparator(); | 185 | edit->insertSeparator(); |
184 | 186 | ||
185 | a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); | 187 | a = new QAction( tr("Import vCard"), QString::null, 0, 0, 0, TRUE ); |
186 | actionPersonal = a; | 188 | actionPersonal = a; |
187 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); | 189 | connect( a, SIGNAL( activated() ), this, SLOT( importvCard() ) ); |
188 | a->addTo( edit ); | 190 | a->addTo( edit ); |
189 | 191 | ||
190 | |||
191 | edit->insertSeparator(); | 192 | edit->insertSeparator(); |
192 | 193 | ||
193 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); | 194 | a = new QAction( tr("My Personal Details"), QString::null, 0, 0, 0, TRUE ); |
194 | actionPersonal = a; | 195 | actionPersonal = a; |
195 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); | 196 | connect( a, SIGNAL( activated() ), this, SLOT( slotPersonalView() ) ); |
196 | a->addTo( edit ); | 197 | a->addTo( edit ); |
197 | 198 | ||
198 | 199 | ||
199 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); | 200 | a = new QAction( tr( "Arrange Edit Fields"), QString::null, 0, 0 ); |
200 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 201 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
201 | a->addTo( edit ); | 202 | a->addTo( edit ); |
202 | 203 | ||
203 | // Create Views | 204 | // Create Views |
204 | 205 | ||
205 | // This is safe to call without checking to see if it exists... | 206 | // This is safe to call without checking to see if it exists... |
206 | // not to mention it also does the necessary stuff for the | 207 | // not to mention it also does the necessary stuff for the |
207 | // journaling... | 208 | // journaling... |
208 | QString str = addressbookXMLFilename(); | 209 | QString str = addressbookXMLFilename(); |
209 | if ( str.isNull() ) { | 210 | if ( str.isNull() ) { |
210 | QMessageBox::warning( this, tr("Out of Space"), | 211 | QMessageBox::warning( |
212 | this, | ||
213 | tr("Out of Space"), | ||
211 | tr("There is not enough space to create\n" | 214 | tr("There is not enough space to create\n" |
212 | "neccessary startup files.\n" | 215 | "neccessary startup files.\n" |
213 | "\nFree up some space before\nentering data!") | 216 | "\nFree up some space before\nentering data!") |
214 | ); | 217 | ); |
215 | } | 218 | } |
216 | 219 | ||
217 | listContainer = new QWidget( this ); | 220 | listContainer = new QWidget( this ); |
218 | 221 | ||
219 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); | 222 | QVBoxLayout *vb = new QVBoxLayout( listContainer ); |
220 | 223 | ||
221 | abList = new AbTable( &orderedFields, listContainer, "table" ); | 224 | abList = new AbTable( &orderedFields, listContainer, "table" ); |
222 | vb->addWidget(abList); | 225 | vb->addWidget(abList); |
223 | abList->setHScrollBarMode( QScrollView::AlwaysOff ); | 226 | // abList->setHScrollBarMode( QScrollView::AlwaysOff ); |
224 | connect( abList, SIGNAL( empty( bool ) ), | 227 | connect( abList, SIGNAL( empty( bool ) ), this, SLOT( listIsEmpty( bool ) ) ); |
225 | this, SLOT( listIsEmpty( bool ) ) ); | 228 | connect( abList, SIGNAL( details() ), this, SLOT( slotListView() ) ); |
226 | connect( abList, SIGNAL( details() ), | 229 | connect( abList, SIGNAL(currentChanged(int,int)), this, SLOT(slotUpdateToolbar()) ); |
227 | this, SLOT( slotListView() ) ); | ||
228 | connect( abList, SIGNAL(currentChanged(int,int)), | ||
229 | this, SLOT(slotUpdateToolbar()) ); | ||
230 | 230 | ||
231 | mView = 0; | 231 | mView = 0; |
232 | 232 | ||
233 | abList->load( addressbookXMLFilename() ); | 233 | abList->load( addressbookXMLFilename() ); |
234 | if ( QFile::exists(addressbookOldXMLFilename()) ) { | 234 | if ( QFile::exists(addressbookOldXMLFilename()) ) { |
235 | abList->load( addressbookOldXMLFilename() ); | 235 | abList->load( addressbookOldXMLFilename() ); |
236 | QFile::remove(addressbookOldXMLFilename()); | 236 | QFile::remove(addressbookOldXMLFilename()); |
237 | } | 237 | } |
238 | 238 | ||
239 | pLabel = new LetterPicker( listContainer ); | 239 | pLabel = new LetterPicker( listContainer ); |
240 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); | 240 | connect(pLabel, SIGNAL(letterClicked(char)), this, SLOT(slotSetLetter(char))); |
241 | vb->addWidget(pLabel); | 241 | vb->addWidget(pLabel); |
242 | catMenu = new QPopupMenu( this ); | 242 | catMenu = new QPopupMenu( this ); |
243 | catMenu->setCheckable( TRUE ); | 243 | catMenu->setCheckable( TRUE ); |
244 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); | 244 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(slotSetCategory(int)) ); |
245 | populateCategories(); | 245 | populateCategories(); |
246 | 246 | ||
247 | mbList->insertItem( tr("View"), catMenu ); | 247 | mbList->insertItem( tr("View"), catMenu ); |
248 | setCentralWidget( listContainer ); | 248 | // setCentralWidget( listContainer ); |
249 | 249 | ||
250 | fontMenu = new QPopupMenu(this); | 250 | fontMenu = new QPopupMenu(this); |
251 | fontMenu->setCheckable( true ); | 251 | fontMenu->setCheckable( true ); |
252 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); | 252 | connect( fontMenu, SIGNAL(activated(int)), this, SLOT(slotSetFont(int))); |
253 | 253 | ||
254 | fontMenu->insertItem(tr( "Small" ), 0); | 254 | fontMenu->insertItem(tr( "Small" ), 0); |
255 | fontMenu->insertItem(tr( "Normal" ), 1); | 255 | fontMenu->insertItem(tr( "Normal" ), 1); |
256 | fontMenu->insertItem(tr( "Large" ), 2); | 256 | fontMenu->insertItem(tr( "Large" ), 2); |
257 | 257 | ||
258 | defaultFont = new QFont( abList->font() ); | 258 | defaultFont = new QFont( abList->font() ); |
259 | 259 | ||
260 | slotSetFont(startFontSize); | 260 | slotSetFont(startFontSize); |
261 | 261 | ||
262 | mbList->insertItem( tr("Font"), fontMenu); | 262 | mbList->insertItem( tr("Font"), fontMenu); |
263 | setCentralWidget(listContainer); | 263 | setCentralWidget(listContainer); |
264 | 264 | ||
265 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); | 265 | // qDebug("adressbook contrsuction: t=%d", t.elapsed() ); |
266 | |||
267 | abList->setCurrentCell( 0, 0 ); | ||
268 | |||
269 | isLoading = false; | ||
266 | } | 270 | } |
267 | 271 | ||
268 | 272 | ||
269 | void AddressbookWindow::slotSetFont( int size ) { | 273 | void AddressbookWindow::slotSetFont( int size ) { |
270 | 274 | ||
271 | if (size > 2 || size < 0) | 275 | if (size > 2 || size < 0) |
272 | size = 1; | 276 | size = 1; |
273 | 277 | ||
274 | startFontSize = size; | 278 | startFontSize = size; |
275 | 279 | ||
276 | QFont *currentFont; | 280 | QFont *currentFont; |
277 | 281 | ||
278 | switch (size) { | 282 | switch (size) { |
279 | case 0: | 283 | case 0: |
280 | fontMenu->setItemChecked(0, true); | 284 | fontMenu->setItemChecked(0, true); |
281 | fontMenu->setItemChecked(1, false); | 285 | fontMenu->setItemChecked(1, false); |
282 | fontMenu->setItemChecked(2, false); | 286 | fontMenu->setItemChecked(2, false); |
283 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); | 287 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() - 2 ) ); |
284 | currentFont = new QFont (abList->font()); | 288 | currentFont = new QFont (abList->font()); |
285 | abList->resizeRows(currentFont->pixelSize() + 7); | 289 | // abList->resizeRows(currentFont->pixelSize() + 7); |
290 | abList->resizeRows(); | ||
286 | break; | 291 | break; |
287 | case 1: | 292 | case 1: |
288 | fontMenu->setItemChecked(0, false); | 293 | fontMenu->setItemChecked(0, false); |
289 | fontMenu->setItemChecked(1, true); | 294 | fontMenu->setItemChecked(1, true); |
290 | fontMenu->setItemChecked(2, false); | 295 | fontMenu->setItemChecked(2, false); |
291 | abList->setFont( *defaultFont ); | 296 | abList->setFont( *defaultFont ); |
292 | currentFont = new QFont (abList->font()); | 297 | currentFont = new QFont (abList->font()); |
293 | abList->resizeRows(currentFont->pixelSize() + 7); | 298 | // abList->resizeRows(currentFont->pixelSize() + 7); |
299 | abList->resizeRows(); | ||
294 | break; | 300 | break; |
295 | case 2: | 301 | case 2: |
296 | fontMenu->setItemChecked(0, false); | 302 | fontMenu->setItemChecked(0, false); |
297 | fontMenu->setItemChecked(1, false); | 303 | fontMenu->setItemChecked(1, false); |
298 | fontMenu->setItemChecked(2, true); | 304 | fontMenu->setItemChecked(2, true); |
299 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); | 305 | abList->setFont( QFont( defaultFont->family(), defaultFont->pointSize() + 2 ) ); |
300 | currentFont = new QFont (abList->font()); | 306 | currentFont = new QFont (abList->font()); |
301 | abList->resizeRows(currentFont->pixelSize() + 7); | 307 | //abList->resizeRows(currentFont->pixelSize() + 7); |
308 | abList->resizeRows(); | ||
302 | break; | 309 | break; |
303 | } | 310 | } |
304 | } | 311 | } |
305 | 312 | ||
306 | 313 | ||
307 | 314 | ||
308 | void AddressbookWindow::importvCard() { | 315 | void AddressbookWindow::importvCard() { |
309 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); | 316 | QString str = OFileDialog::getOpenFileName( 1,"/");//,"", "*", this ); |
310 | if(!str.isEmpty() ) | 317 | if(!str.isEmpty() ) |
311 | setDocument((const QString&) str ); | 318 | setDocument((const QString&) str ); |
312 | 319 | ||
313 | } | 320 | } |
314 | 321 | ||
315 | void AddressbookWindow::setDocument( const QString &filename ) | 322 | void AddressbookWindow::setDocument( const QString &filename ) |
316 | { | 323 | { |
317 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) return; | 324 | if ( filename.find(".vcf") != int(filename.length()) - 4 ) |
325 | return; | ||
318 | 326 | ||
319 | QValueList<Contact> cl = Contact::readVCard( filename ); | 327 | QValueList<OContact> cl = OContact::readVCard( filename ); |
320 | for( QValueList<Contact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { | 328 | for( QValueList<OContact>::Iterator it = cl.begin(); it != cl.end(); ++it ) { |
321 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") | 329 | // QString msg = tr("You received a vCard for\n%1.\nDo You want to add it to your\naddressbook?") |
322 | // .arg( (*it).fullName() ); | 330 | // .arg( (*it).fullName() ); |
323 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == | 331 | // if ( QMessageBox::information( this, tr("received contact"), msg, QMessageBox::Ok, QMessageBox::Cancel ) == |
324 | // QMessageBox::Ok ) { | 332 | // QMessageBox::Ok ) { |
325 | abList->addEntry( *it ); | 333 | abList->addEntry( *it ); |
326 | // } | 334 | // } |
327 | } | 335 | } |
328 | 336 | ||
329 | } | 337 | } |
330 | 338 | ||
331 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) | 339 | void AddressbookWindow::resizeEvent( QResizeEvent *e ) |
332 | { | 340 | { |
@@ -338,72 +346,85 @@ void AddressbookWindow::resizeEvent( QResizeEvent *e ) | |||
338 | showView(); | 346 | showView(); |
339 | } | 347 | } |
340 | 348 | ||
341 | AddressbookWindow::~AddressbookWindow() | 349 | AddressbookWindow::~AddressbookWindow() |
342 | { | 350 | { |
343 | Config cfg("AddressBook"); | 351 | Config cfg("AddressBook"); |
344 | cfg.setGroup("Font"); | 352 | cfg.setGroup("Font"); |
345 | cfg.writeEntry("fontSize", startFontSize); | 353 | cfg.writeEntry("fontSize", startFontSize); |
346 | } | 354 | } |
347 | 355 | ||
348 | void AddressbookWindow::slotUpdateToolbar() | 356 | void AddressbookWindow::slotUpdateToolbar() |
349 | { | 357 | { |
350 | Contact ce = abList->currentEntry(); | 358 | OContact ce = abList->currentEntry(); |
351 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); | 359 | actionMail->setEnabled( !ce.defaultEmail().isEmpty() ); |
352 | } | 360 | } |
353 | 361 | ||
354 | void AddressbookWindow::showList() | 362 | void AddressbookWindow::showList() |
355 | { | 363 | { |
356 | if ( mView ) mView->hide(); | 364 | bool visiblemView; |
365 | |||
366 | visiblemView = false; | ||
367 | if ( mView ) { | ||
368 | mView->hide(); | ||
369 | visiblemView = true; | ||
370 | } | ||
357 | setCentralWidget( listContainer ); | 371 | setCentralWidget( listContainer ); |
358 | listContainer->show(); | 372 | listContainer->show(); |
359 | // update our focues... (or use a stack widget!); | 373 | // update our focues... (or use a stack widget!); |
360 | abList->setFocus(); | 374 | abList->setFocus(); |
375 | |||
376 | // This makes sure we are scrolled all the way to the left | ||
377 | abList->setContentsPos( 0, abList->contentsY() ); | ||
378 | |||
379 | //if ( visiblemView && abList->showBook() == "Cards" ) | ||
380 | //abList->setShowCategory( abList->showBook(), abList->showCategory() ); | ||
381 | |||
361 | } | 382 | } |
362 | 383 | ||
363 | void AddressbookWindow::showView() | 384 | void AddressbookWindow::showView() |
364 | { | 385 | { |
365 | if ( abList->numRows() > 0 ) { | 386 | if ( abList->numRows() > 0 ) { |
366 | listContainer->hide(); | 387 | listContainer->hide(); |
367 | setCentralWidget( abView() ); | 388 | setCentralWidget( abView() ); |
368 | mView->show(); | 389 | mView->show(); |
369 | mView->setFocus(); | 390 | mView->setFocus(); |
370 | } | 391 | } |
371 | } | 392 | } |
372 | 393 | ||
373 | void AddressbookWindow::slotListNew() | 394 | void AddressbookWindow::slotListNew() |
374 | { | 395 | { |
375 | Contact cnt; | 396 | OContact cnt; |
376 | if( !syncing ) { | 397 | if( !syncing ) { |
377 | if ( abEditor ) | 398 | if ( abEditor ) |
378 | abEditor->setEntry( cnt ); | 399 | abEditor->setEntry( cnt ); |
379 | abView()->init( cnt ); | 400 | abView()->init( cnt ); |
380 | editEntry( NewEntry ); | 401 | editEntry( NewEntry ); |
381 | } else { | 402 | } else { |
382 | QMessageBox::warning(this, tr("Contacts"), | 403 | QMessageBox::warning(this, tr("OContacts"), |
383 | tr("Can not edit data, currently syncing")); | 404 | tr("Can not edit data, currently syncing")); |
384 | } | 405 | } |
385 | } | 406 | } |
386 | 407 | ||
387 | void AddressbookWindow::slotListView() | 408 | void AddressbookWindow::slotListView() |
388 | { | 409 | { |
389 | abView()->init( abList->currentEntry() ); | 410 | abView()->init( abList->currentEntry() ); |
390 | mView->sync(); | 411 | mView->sync(); |
391 | showView(); | 412 | showView(); |
392 | } | 413 | } |
393 | 414 | ||
394 | void AddressbookWindow::slotListDelete() | 415 | void AddressbookWindow::slotListDelete() |
395 | { | 416 | { |
396 | if(!syncing) { | 417 | if(!syncing) { |
397 | Contact tmpEntry = abList->currentEntry(); | 418 | OContact tmpEntry = abList->currentEntry(); |
398 | 419 | ||
399 | // get a name, do the best we can... | 420 | // get a name, do the best we can... |
400 | QString strName = tmpEntry.fullName(); | 421 | QString strName = tmpEntry.fullName(); |
401 | if ( strName.isEmpty() ) { | 422 | if ( strName.isEmpty() ) { |
402 | strName = tmpEntry.company(); | 423 | strName = tmpEntry.company(); |
403 | if ( strName.isEmpty() ) | 424 | if ( strName.isEmpty() ) |
404 | strName = "No Name"; | 425 | strName = "No Name"; |
405 | } | 426 | } |
406 | 427 | ||
407 | 428 | ||
408 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), | 429 | if ( QPEMessageBox::confirmDelete( this, tr( "Contacts" ), |
409 | strName ) ) { | 430 | strName ) ) { |
@@ -432,50 +453,47 @@ void AddressbookWindow::slotViewEdit() | |||
432 | editEntry( EditEntry ); | 453 | editEntry( EditEntry ); |
433 | } | 454 | } |
434 | } else { | 455 | } else { |
435 | QMessageBox::warning( this, tr("Contacts"), | 456 | QMessageBox::warning( this, tr("Contacts"), |
436 | tr("Can not edit data, currently syncing") ); | 457 | tr("Can not edit data, currently syncing") ); |
437 | } | 458 | } |
438 | } | 459 | } |
439 | 460 | ||
440 | 461 | ||
441 | 462 | ||
442 | void AddressbookWindow::writeMail() | 463 | void AddressbookWindow::writeMail() |
443 | { | 464 | { |
444 | Contact c = abList->currentEntry(); | 465 | OContact c = abList->currentEntry(); |
445 | QString name = c.fileAs(); | 466 | QString name = c.fileAs(); |
446 | QString email = c.defaultEmail(); | 467 | QString email = c.defaultEmail(); |
447 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); | 468 | QCopEnvelope e("QPE/Application/qtmail", "writeMail(QString,QString)"); |
448 | e << name << email; | 469 | e << name << email; |
449 | } | 470 | } |
450 | 471 | ||
451 | |||
452 | |||
453 | |||
454 | static const char * beamfile = "/tmp/obex/contact.vcf"; | 472 | static const char * beamfile = "/tmp/obex/contact.vcf"; |
455 | 473 | ||
456 | void AddressbookWindow::slotBeam() | 474 | void AddressbookWindow::slotBeam() |
457 | { | 475 | { |
458 | QString filename; | 476 | QString filename; |
459 | Contact c; | 477 | OContact c; |
460 | if ( actionPersonal->isOn() ) { | 478 | if ( actionPersonal->isOn() ) { |
461 | filename = addressbookPersonalVCardName(); | 479 | filename = addressbookPersonalVCardName(); |
462 | if (!QFile::exists(filename)) | 480 | if (!QFile::exists(filename)) |
463 | return; // can't beam a non-existent file | 481 | return; // can't beam a non-existent file |
464 | c = Contact::readVCard( filename )[0]; | 482 | c = OContact::readVCard( filename )[0]; |
465 | } else { | 483 | } else { |
466 | unlink( beamfile ); // delete if exists | 484 | unlink( beamfile ); // delete if exists |
467 | c = abList->currentEntry(); | 485 | c = abList->currentEntry(); |
468 | mkdir("/tmp/obex/", 0755); | 486 | mkdir("/tmp/obex/", 0755); |
469 | Contact::writeVCard( beamfile, c ); | 487 | OContact::writeVCard( beamfile, c ); |
470 | filename = beamfile; | 488 | filename = beamfile; |
471 | } | 489 | } |
472 | Ir *ir = new Ir( this ); | 490 | Ir *ir = new Ir( this ); |
473 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 491 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
474 | QString description = c.fullName(); | 492 | QString description = c.fullName(); |
475 | ir->send( filename, description, "text/x-vCard" ); | 493 | ir->send( filename, description, "text/x-vCard" ); |
476 | } | 494 | } |
477 | 495 | ||
478 | void AddressbookWindow::beamDone( Ir *ir ) | 496 | void AddressbookWindow::beamDone( Ir *ir ) |
479 | { | 497 | { |
480 | delete ir; | 498 | delete ir; |
481 | unlink( beamfile ); | 499 | unlink( beamfile ); |
@@ -513,25 +531,25 @@ static void parseName( const QString& name, QString *first, QString *middle, | |||
513 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 531 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
514 | { | 532 | { |
515 | if (msg == "editPersonal()") { | 533 | if (msg == "editPersonal()") { |
516 | editPersonal(); | 534 | editPersonal(); |
517 | } else if (msg == "editPersonalAndClose()") { | 535 | } else if (msg == "editPersonalAndClose()") { |
518 | editPersonal(); | 536 | editPersonal(); |
519 | close(); | 537 | close(); |
520 | } else if ( msg == "addContact(QString,QString)" ) { | 538 | } else if ( msg == "addContact(QString,QString)" ) { |
521 | QDataStream stream(data,IO_ReadOnly); | 539 | QDataStream stream(data,IO_ReadOnly); |
522 | QString name, email; | 540 | QString name, email; |
523 | stream >> name >> email; | 541 | stream >> name >> email; |
524 | 542 | ||
525 | Contact cnt; | 543 | OContact cnt; |
526 | QString fn, mn, ln; | 544 | QString fn, mn, ln; |
527 | parseName( name, &fn, &mn, &ln ); | 545 | parseName( name, &fn, &mn, &ln ); |
528 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 546 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
529 | cnt.setFirstName( fn ); | 547 | cnt.setFirstName( fn ); |
530 | cnt.setMiddleName( mn ); | 548 | cnt.setMiddleName( mn ); |
531 | cnt.setLastName( ln ); | 549 | cnt.setLastName( ln ); |
532 | cnt.insertEmails( email ); | 550 | cnt.insertEmails( email ); |
533 | cnt.setDefaultEmail( email ); | 551 | cnt.setDefaultEmail( email ); |
534 | cnt.setFileAs(); | 552 | cnt.setFileAs(); |
535 | 553 | ||
536 | if ( bAbEditFirstTime ) { | 554 | if ( bAbEditFirstTime ) { |
537 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, | 555 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, |
@@ -572,45 +590,45 @@ void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | |||
572 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 590 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
573 | QStringList sel = picker.selection(i++); | 591 | QStringList sel = picker.selection(i++); |
574 | e << sel; | 592 | e << sel; |
575 | } | 593 | } |
576 | } | 594 | } |
577 | #endif | 595 | #endif |
578 | 596 | ||
579 | } | 597 | } |
580 | 598 | ||
581 | void AddressbookWindow::editPersonal() | 599 | void AddressbookWindow::editPersonal() |
582 | { | 600 | { |
583 | QString filename = addressbookPersonalVCardName(); | 601 | QString filename = addressbookPersonalVCardName(); |
584 | Contact me; | 602 | OContact me; |
585 | if (QFile::exists(filename)) | 603 | if (QFile::exists(filename)) |
586 | me = Contact::readVCard( filename )[0]; | 604 | me = OContact::readVCard( filename )[0]; |
587 | if (bAbEditFirstTime) { | 605 | if (bAbEditFirstTime) { |
588 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, | 606 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, |
589 | this, "editor" ); | 607 | this, "editor" ); |
590 | // don't create a new editor every time | 608 | // don't create a new editor every time |
591 | bAbEditFirstTime = FALSE; | 609 | bAbEditFirstTime = FALSE; |
592 | } else | 610 | } else |
593 | abEditor->setEntry( me ); | 611 | abEditor->setEntry( me ); |
594 | 612 | ||
595 | abEditor->setCaption(tr("Edit My Personal Details")); | 613 | abEditor->setCaption(tr("Edit My Personal Details")); |
596 | abEditor->showMaximized(); | 614 | abEditor->showMaximized(); |
597 | 615 | ||
598 | // fix the foxus... | 616 | // fix the foxus... |
599 | abEditor->setNameFocus(); | 617 | abEditor->setNameFocus(); |
600 | if ( abEditor->exec() ) { | 618 | if ( abEditor->exec() ) { |
601 | setFocus(); | 619 | setFocus(); |
602 | Contact new_personal = abEditor->entry(); | 620 | OContact new_personal = abEditor->entry(); |
603 | QString fname = addressbookPersonalVCardName(); | 621 | QString fname = addressbookPersonalVCardName(); |
604 | Contact::writeVCard( fname, new_personal ); | 622 | OContact::writeVCard( fname, new_personal ); |
605 | abView()->init(new_personal); | 623 | abView()->init(new_personal); |
606 | abView()->sync(); | 624 | abView()->sync(); |
607 | } | 625 | } |
608 | abEditor->setCaption( tr("Edit Address") ); | 626 | abEditor->setCaption( tr("Edit Address") ); |
609 | } | 627 | } |
610 | 628 | ||
611 | void AddressbookWindow::slotPersonalView() | 629 | void AddressbookWindow::slotPersonalView() |
612 | { | 630 | { |
613 | if (!actionPersonal->isOn()) { | 631 | if (!actionPersonal->isOn()) { |
614 | // we just turned it off | 632 | // we just turned it off |
615 | setCaption( tr("Contacts") ); | 633 | setCaption( tr("Contacts") ); |
616 | actionNew->setEnabled(TRUE); | 634 | actionNew->setEnabled(TRUE); |
@@ -624,62 +642,62 @@ void AddressbookWindow::slotPersonalView() | |||
624 | } | 642 | } |
625 | 643 | ||
626 | // XXX need to disable some QActions. | 644 | // XXX need to disable some QActions. |
627 | actionNew->setEnabled(FALSE); | 645 | actionNew->setEnabled(FALSE); |
628 | actionTrash->setEnabled(FALSE); | 646 | actionTrash->setEnabled(FALSE); |
629 | #ifndef MAKE_FOR_SHARP_ROM | 647 | #ifndef MAKE_FOR_SHARP_ROM |
630 | actionFind->setEnabled(FALSE); | 648 | actionFind->setEnabled(FALSE); |
631 | #endif | 649 | #endif |
632 | actionMail->setEnabled(FALSE); | 650 | actionMail->setEnabled(FALSE); |
633 | 651 | ||
634 | setCaption( tr("Contacts - My Personal Details") ); | 652 | setCaption( tr("Contacts - My Personal Details") ); |
635 | QString filename = addressbookPersonalVCardName(); | 653 | QString filename = addressbookPersonalVCardName(); |
636 | Contact me; | 654 | OContact me; |
637 | if (QFile::exists(filename)) | 655 | if (QFile::exists(filename)) |
638 | me = Contact::readVCard( filename )[0]; | 656 | me = OContact::readVCard( filename )[0]; |
639 | 657 | ||
640 | abView()->init( me ); | 658 | abView()->init( me ); |
641 | abView()->sync(); | 659 | abView()->sync(); |
642 | listContainer->hide(); | 660 | listContainer->hide(); |
643 | setCentralWidget( abView() ); | 661 | setCentralWidget( abView() ); |
644 | mView->show(); | 662 | mView->show(); |
645 | mView->setFocus(); | 663 | mView->setFocus(); |
646 | } | 664 | } |
647 | 665 | ||
648 | void AddressbookWindow::editEntry( EntryMode entryMode ) | 666 | void AddressbookWindow::editEntry( EntryMode entryMode ) |
649 | { | 667 | { |
650 | Contact entry; | 668 | OContact entry; |
651 | if ( bAbEditFirstTime ) { | 669 | if ( bAbEditFirstTime ) { |
652 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, | 670 | abEditor = new ContactEditor( entry, &orderedFields, &slOrderedFields, |
653 | this, "editor" ); | 671 | this, "editor" ); |
654 | bAbEditFirstTime = FALSE; | 672 | bAbEditFirstTime = FALSE; |
655 | if ( entryMode == EditEntry ) | 673 | if ( entryMode == EditEntry ) |
656 | abEditor->setEntry( abList->currentEntry() ); | 674 | abEditor->setEntry( abList->currentEntry() ); |
657 | } | 675 | } |
658 | // other things may chane the caption. | 676 | // other things may chane the caption. |
659 | abEditor->setCaption( tr("Edit Address") ); | 677 | abEditor->setCaption( tr("Edit Address") ); |
660 | 678 | ||
661 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 679 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
662 | abEditor->showMaximized(); | 680 | abEditor->showMaximized(); |
663 | #endif | 681 | #endif |
664 | // fix the foxus... | 682 | // fix the foxus... |
665 | abEditor->setNameFocus(); | 683 | abEditor->setNameFocus(); |
666 | if ( abEditor->exec() ) { | 684 | if ( abEditor->exec() ) { |
667 | setFocus(); | 685 | setFocus(); |
668 | if ( entryMode == NewEntry ) { | 686 | if ( entryMode == NewEntry ) { |
669 | Contact insertEntry = abEditor->entry(); | 687 | OContact insertEntry = abEditor->entry(); |
670 | insertEntry.assignUid(); | 688 | insertEntry.assignUid(); |
671 | abList->addEntry( insertEntry ); | 689 | abList->addEntry( insertEntry ); |
672 | } else { | 690 | } else { |
673 | Contact replaceEntry = abEditor->entry(); | 691 | OContact replaceEntry = abEditor->entry(); |
674 | if ( !replaceEntry.isValidUid() ) | 692 | if ( !replaceEntry.isValidUid() ) |
675 | replaceEntry.assignUid(); | 693 | replaceEntry.assignUid(); |
676 | abList->replaceCurrentEntry( replaceEntry ); | 694 | abList->replaceCurrentEntry( replaceEntry ); |
677 | } | 695 | } |
678 | } | 696 | } |
679 | populateCategories(); | 697 | populateCategories(); |
680 | showList(); | 698 | showList(); |
681 | } | 699 | } |
682 | 700 | ||
683 | void AddressbookWindow::listIsEmpty( bool empty ) | 701 | void AddressbookWindow::listIsEmpty( bool empty ) |
684 | { | 702 | { |
685 | if ( !empty ) { | 703 | if ( !empty ) { |
@@ -715,24 +733,25 @@ void AddressbookWindow::closeEvent( QCloseEvent *e ) | |||
715 | return; | 733 | return; |
716 | } | 734 | } |
717 | 735 | ||
718 | if(syncing) { | 736 | if(syncing) { |
719 | /* shouldn't we save, I hear you say? well its already been set | 737 | /* shouldn't we save, I hear you say? well its already been set |
720 | so that an edit can not occur during a sync, and we flushed | 738 | so that an edit can not occur during a sync, and we flushed |
721 | at the start of the sync, so there is no need to save | 739 | at the start of the sync, so there is no need to save |
722 | Saving however itself would cause problems. */ | 740 | Saving however itself would cause problems. */ |
723 | e->accept(); | 741 | e->accept(); |
724 | return; | 742 | return; |
725 | } | 743 | } |
726 | //################## shouldn't always save | 744 | //################## shouldn't always save |
745 | // True, but the database handles this automatically ! (se) | ||
727 | if ( save() ) | 746 | if ( save() ) |
728 | e->accept(); | 747 | e->accept(); |
729 | else | 748 | else |
730 | e->ignore(); | 749 | e->ignore(); |
731 | } | 750 | } |
732 | 751 | ||
733 | /* | 752 | /* |
734 | Returns TRUE if it is OK to exit | 753 | Returns TRUE if it is OK to exit |
735 | */ | 754 | */ |
736 | 755 | ||
737 | bool AddressbookWindow::save() | 756 | bool AddressbookWindow::save() |
738 | { | 757 | { |
@@ -783,32 +802,31 @@ void AddressbookWindow::slotSettings() | |||
783 | abEditor->loadFields(); | 802 | abEditor->loadFields(); |
784 | abList->refresh(); | 803 | abList->refresh(); |
785 | } | 804 | } |
786 | } | 805 | } |
787 | 806 | ||
788 | 807 | ||
789 | void AddressbookWindow::initFields() | 808 | void AddressbookWindow::initFields() |
790 | { | 809 | { |
791 | // we really don't need the things from the configuration, anymore | 810 | // we really don't need the things from the configuration, anymore |
792 | // only thing that is important are the important categories. So, | 811 | // only thing that is important are the important categories. So, |
793 | // Call the contact functions that correspond to these old functions... | 812 | // Call the contact functions that correspond to these old functions... |
794 | 813 | ||
795 | QStringList xmlFields = Contact::fields(); | 814 | QStringList xmlFields = OContact::fields(); |
796 | QStringList visibleFields = Contact::trfields(); | 815 | QStringList visibleFields = OContact::trfields(); |
797 | xmlFields.remove( "Title" ); | 816 | xmlFields.remove( "Title" ); |
798 | visibleFields.remove( tr("Name Title") ); | 817 | visibleFields.remove( tr("Name Title") ); |
799 | visibleFields.remove( tr("Notes") ); | 818 | visibleFields.remove( tr("Notes") ); |
800 | 819 | ||
801 | int i, | 820 | int i, version; |
802 | version; | ||
803 | Config cfg( "AddressBook" ); | 821 | Config cfg( "AddressBook" ); |
804 | QString zn; | 822 | QString zn; |
805 | 823 | ||
806 | // ### Write a function to keep this from happening again... | 824 | // ### Write a function to keep this from happening again... |
807 | QStringList::ConstIterator it; | 825 | QStringList::ConstIterator it; |
808 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { | 826 | for ( i = 0, it = xmlFields.begin(); it != xmlFields.end(); ++it, i++ ) { |
809 | allFields.append( i + 3 ); | 827 | allFields.append( i + 3 ); |
810 | } | 828 | } |
811 | 829 | ||
812 | cfg.setGroup( "Version" ); | 830 | cfg.setGroup( "Version" ); |
813 | version = cfg.readNumEntry( "version" ); | 831 | version = cfg.readNumEntry( "version" ); |
814 | i = 0; | 832 | i = 0; |
@@ -874,25 +892,25 @@ void AddressbookWindow::initFields() | |||
874 | slOrderedFields.remove( tr("Default Email") ); | 892 | slOrderedFields.remove( tr("Default Email") ); |
875 | slOrderedFields.remove( tr("Notes") ); | 893 | slOrderedFields.remove( tr("Notes") ); |
876 | slOrderedFields.remove( tr("Gender") ); | 894 | slOrderedFields.remove( tr("Gender") ); |
877 | 895 | ||
878 | } | 896 | } |
879 | } | 897 | } |
880 | 898 | ||
881 | 899 | ||
882 | AbLabel *AddressbookWindow::abView() | 900 | AbLabel *AddressbookWindow::abView() |
883 | { | 901 | { |
884 | if ( !mView ) { | 902 | if ( !mView ) { |
885 | mView = new AbLabel( this, "viewer" ); | 903 | mView = new AbLabel( this, "viewer" ); |
886 | mView->init( Contact() ); | 904 | mView->init( OContact() ); |
887 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); | 905 | connect( mView, SIGNAL( okPressed() ), this, SLOT( slotListView() ) ); |
888 | } | 906 | } |
889 | return mView; | 907 | return mView; |
890 | } | 908 | } |
891 | 909 | ||
892 | void AddressbookWindow::slotFind() | 910 | void AddressbookWindow::slotFind() |
893 | { | 911 | { |
894 | #ifndef MAKE_FOR_SHARP_ROM | 912 | #ifndef MAKE_FOR_SHARP_ROM |
895 | if ( centralWidget() == abView() ) | 913 | if ( centralWidget() == abView() ) |
896 | showList(); | 914 | showList(); |
897 | 915 | ||
898 | FindDialog frmFind( "Contacts", this ); | 916 | FindDialog frmFind( "Contacts", this ); |
@@ -902,58 +920,111 @@ void AddressbookWindow::slotFind() | |||
902 | 920 | ||
903 | frmFind.exec(); | 921 | frmFind.exec(); |
904 | 922 | ||
905 | if ( abList->numSelections() ) | 923 | if ( abList->numSelections() ) |
906 | abList->clearSelection(); | 924 | abList->clearSelection(); |
907 | 925 | ||
908 | abList->clearFindRow(); | 926 | abList->clearFindRow(); |
909 | #endif | 927 | #endif |
910 | } | 928 | } |
911 | 929 | ||
912 | void AddressbookWindow::slotSetCategory( int c ) | 930 | void AddressbookWindow::slotSetCategory( int c ) |
913 | { | 931 | { |
932 | |||
933 | QString cat, book; | ||
934 | |||
914 | if ( c <= 0 ) | 935 | if ( c <= 0 ) |
915 | return; | 936 | return; |
916 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) | 937 | |
938 | // Checkmark Book Menu Item Selected | ||
939 | if ( c < 6 ) | ||
940 | for ( unsigned int i = 1; i < 6; i++ ) | ||
917 | catMenu->setItemChecked( i, c == (int)i ); | 941 | catMenu->setItemChecked( i, c == (int)i ); |
918 | if ( c == 1 ) { | 942 | |
919 | abList->setShowCategory( QString::null ); | 943 | // Checkmark Category Menu Item Selected |
920 | setCaption( tr("Contacts") + " - " + tr ( "All" ) ); | 944 | else |
921 | } else if ( c == (int)catMenu->count() ) { | 945 | for ( unsigned int i = 6; i < catMenu->count(); i++ ) |
922 | abList->setShowCategory( tr( "Unfiled" ) ); | 946 | catMenu->setItemChecked( i, c == (int)i ); |
923 | setCaption( tr("Contacts") + " - " + tr( "Unfiled" ) ); | 947 | |
924 | } else { | 948 | for ( unsigned int i = 1; i < catMenu->count(); i++ ) { |
925 | QString cat = abList->categories()[c - 2]; | 949 | if (catMenu->isItemChecked( i )) { |
926 | abList->setShowCategory( cat ); | 950 | if ( i == 1 ) // default List view |
927 | setCaption( tr("Contacts") + " - " + cat ); | 951 | book = QString::null; |
952 | else if ( i == 2 ) | ||
953 | book = "Phone"; | ||
954 | else if ( i == 3 ) | ||
955 | book = "Company"; | ||
956 | else if ( i == 4 ) | ||
957 | book = "Email"; | ||
958 | else if ( i == 5 ) | ||
959 | book = "Cards"; | ||
960 | else if ( i == 6 ) // default All Categories | ||
961 | cat = QString::null; | ||
962 | else if ( i == (unsigned int)catMenu->count() ) // last menu option will be Unfiled | ||
963 | cat = "Unfiled"; | ||
964 | else | ||
965 | cat = abList->categories()[i - 7]; | ||
928 | } | 966 | } |
929 | } | 967 | } |
930 | 968 | ||
969 | abList->setShowCategory( book, cat ); | ||
970 | |||
971 | if ( book.isEmpty() ) | ||
972 | book = "List"; | ||
973 | if ( cat.isEmpty() ) | ||
974 | cat = "All"; | ||
975 | |||
976 | setCaption( tr( "Contacts" ) + " - " + tr( book ) + " - " + tr( cat ) ); | ||
977 | } | ||
978 | |||
931 | void AddressbookWindow::slotSetLetter( char c ) { | 979 | void AddressbookWindow::slotSetLetter( char c ) { |
932 | 980 | ||
933 | abList->setShowByLetter( c ); | 981 | abList->setShowByLetter( c ); |
934 | 982 | ||
935 | } | 983 | } |
936 | 984 | ||
937 | void AddressbookWindow::populateCategories() | 985 | void AddressbookWindow::populateCategories() |
938 | { | 986 | { |
939 | catMenu->clear(); | 987 | catMenu->clear(); |
940 | 988 | ||
941 | int id, | 989 | int id, rememberId; |
942 | rememberId; | ||
943 | id = 1; | 990 | id = 1; |
944 | rememberId = 0; | 991 | rememberId = 0; |
992 | |||
993 | catMenu->insertItem( tr( "List" ), id++ ); | ||
994 | catMenu->insertItem( tr( "Phone Book" ), id++ ); | ||
995 | catMenu->insertItem( tr( "Company Book" ), id++ ); | ||
996 | catMenu->insertItem( tr( "Email Book" ), id++ ); | ||
997 | catMenu->insertItem( tr( "Cards" ), id++ ); | ||
998 | catMenu->insertSeparator(); | ||
999 | |||
945 | catMenu->insertItem( tr( "All" ), id++ ); | 1000 | catMenu->insertItem( tr( "All" ), id++ ); |
946 | QStringList categories = abList->categories(); | 1001 | QStringList categories = abList->categories(); |
947 | categories.append( tr( "Unfiled" ) ); | 1002 | categories.append( tr( "Unfiled" ) ); |
948 | for ( QStringList::Iterator it = categories.begin(); | 1003 | for ( QStringList::Iterator it = categories.begin(); |
949 | it != categories.end(); ++it ) { | 1004 | it != categories.end(); ++it ) { |
950 | catMenu->insertItem( *it, id ); | 1005 | catMenu->insertItem( *it, id ); |
951 | if ( *it == abList->showCategory() ) | 1006 | if ( *it == abList->showCategory() ) |
952 | rememberId = id; | 1007 | rememberId = id; |
953 | ++id; | 1008 | ++id; |
954 | } | 1009 | } |
955 | if ( abList->showCategory().isEmpty() ) | 1010 | |
956 | slotSetCategory( 1 ); | 1011 | if ( abList->showBook().isEmpty() ) { |
957 | else | 1012 | catMenu->setItemChecked( 1, true ); |
1013 | } else if ( abList->showBook() == "Phone" ) { | ||
1014 | catMenu->setItemChecked( 2, true ); | ||
1015 | } else if ( abList->showBook() == "Company" ) { | ||
1016 | catMenu->setItemChecked( 3, true ); | ||
1017 | } else if ( abList->showBook() == "Email" ) { | ||
1018 | catMenu->setItemChecked( 4, true ); | ||
1019 | } else if ( abList->showBook() == "Cards" ) { | ||
1020 | catMenu->setItemChecked( 5, true ); | ||
1021 | } | ||
1022 | |||
1023 | if ( abList->showCategory().isEmpty() ) { | ||
1024 | slotSetCategory( 6 ); | ||
1025 | } | ||
1026 | else { | ||
958 | slotSetCategory( rememberId ); | 1027 | slotSetCategory( rememberId ); |
959 | } | 1028 | } |
1029 | } | ||
1030 | |||