author | eilers <eilers> | 2003-09-29 07:48:56 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-09-29 07:48:56 (UTC) |
commit | 9883c4ba419d93e101991a3337ba1ac5de3273c8 (patch) (unidiff) | |
tree | ecb5d96884914a8578f040d4b558f8697b3d60f5 | |
parent | 93b76e67cf954eab09091996a790301369d77a88 (diff) | |
download | opie-9883c4ba419d93e101991a3337ba1ac5de3273c8.zip opie-9883c4ba419d93e101991a3337ba1ac5de3273c8.tar.gz opie-9883c4ba419d93e101991a3337ba1ac5de3273c8.tar.bz2 |
ocontactfields is now moved to libopie/pim
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 4 | ||||
-rw-r--r-- | core/pim/addressbook/abview.cpp | 3 | ||||
-rw-r--r-- | core/pim/addressbook/addressbook.pro | 2 | ||||
-rw-r--r-- | core/pim/addressbook/configdlg.cpp | 2 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 1 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.h | 3 |
6 files changed, 6 insertions, 9 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 4705c78..70330c7 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -230,514 +230,514 @@ void AbTable::insertIntoTable( const OContact& cnt, int row ) | |||
230 | 230 | ||
231 | strName = findContactName( cnt ); | 231 | strName = findContactName( cnt ); |
232 | contactItem = findContactContact( cnt, row ); | 232 | contactItem = findContactContact( cnt, row ); |
233 | 233 | ||
234 | AbTableItem *ati; | 234 | AbTableItem *ati; |
235 | ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); | 235 | ati = new AbTableItem( this, QTableItem::Never, strName, contactItem.value ); |
236 | contactList.insert( ati, cnt ); | 236 | contactList.insert( ati, cnt ); |
237 | setItem( row, 0, ati ); | 237 | setItem( row, 0, ati ); |
238 | ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); | 238 | ati = new AbTableItem( this, QTableItem::Never, contactItem.value, strName); |
239 | if ( !contactItem.icon.isNull() ) | 239 | if ( !contactItem.icon.isNull() ) |
240 | ati->setPixmap( contactItem.icon ); | 240 | ati->setPixmap( contactItem.icon ); |
241 | setItem( row, 1, ati ); | 241 | setItem( row, 1, ati ); |
242 | 242 | ||
243 | //### cannot do this; table only has two columns at this point | 243 | //### cannot do this; table only has two columns at this point |
244 | // setItem( row, 2, new AbPickItem( this ) ); | 244 | // setItem( row, 2, new AbPickItem( this ) ); |
245 | 245 | ||
246 | } | 246 | } |
247 | #endif | 247 | #endif |
248 | 248 | ||
249 | 249 | ||
250 | void AbTable::columnClicked( int col ) | 250 | void AbTable::columnClicked( int col ) |
251 | { | 251 | { |
252 | if ( !sorting() ) | 252 | if ( !sorting() ) |
253 | return; | 253 | return; |
254 | 254 | ||
255 | if ( lastSortCol == -1 ) | 255 | if ( lastSortCol == -1 ) |
256 | lastSortCol = col; | 256 | lastSortCol = col; |
257 | 257 | ||
258 | if ( col == lastSortCol ) { | 258 | if ( col == lastSortCol ) { |
259 | asc = !asc; | 259 | asc = !asc; |
260 | } else { | 260 | } else { |
261 | lastSortCol = col; | 261 | lastSortCol = col; |
262 | asc = TRUE; | 262 | asc = TRUE; |
263 | } | 263 | } |
264 | //QMessageBox::information( this, "resort", "columnClicked" ); | 264 | //QMessageBox::information( this, "resort", "columnClicked" ); |
265 | resort(); | 265 | resort(); |
266 | } | 266 | } |
267 | 267 | ||
268 | void AbTable::resort() | 268 | void AbTable::resort() |
269 | { | 269 | { |
270 | qWarning( "void AbTable::resort() NOT POSSIBLE !!" ); | 270 | qWarning( "void AbTable::resort() NOT POSSIBLE !!" ); |
271 | #if 0 | 271 | #if 0 |
272 | setPaintingEnabled( FALSE ); | 272 | setPaintingEnabled( FALSE ); |
273 | if ( sorting() ) { | 273 | if ( sorting() ) { |
274 | if ( lastSortCol == -1 ) | 274 | if ( lastSortCol == -1 ) |
275 | lastSortCol = 0; | 275 | lastSortCol = 0; |
276 | sortColumn( lastSortCol, asc, TRUE ); | 276 | sortColumn( lastSortCol, asc, TRUE ); |
277 | //QMessageBox::information( this, "resort", "resort" ); | 277 | //QMessageBox::information( this, "resort", "resort" ); |
278 | updateVisible(); | 278 | updateVisible(); |
279 | } | 279 | } |
280 | setPaintingEnabled( TRUE ); | 280 | setPaintingEnabled( TRUE ); |
281 | #endif | 281 | #endif |
282 | } | 282 | } |
283 | 283 | ||
284 | OContact AbTable::currentEntry() | 284 | OContact AbTable::currentEntry() |
285 | { | 285 | { |
286 | return m_viewList[currentRow()]; | 286 | return m_viewList[currentRow()]; |
287 | } | 287 | } |
288 | 288 | ||
289 | int AbTable::currentEntry_UID() | 289 | int AbTable::currentEntry_UID() |
290 | { | 290 | { |
291 | return ( currentEntry().uid() ); | 291 | return ( currentEntry().uid() ); |
292 | } | 292 | } |
293 | 293 | ||
294 | void AbTable::clear() | 294 | void AbTable::clear() |
295 | { | 295 | { |
296 | qWarning( "void AbTable::clear()" ); | 296 | qWarning( "void AbTable::clear()" ); |
297 | // contactList.clear(); | 297 | // contactList.clear(); |
298 | 298 | ||
299 | setPaintingEnabled( FALSE ); | 299 | setPaintingEnabled( FALSE ); |
300 | for ( int r = 0; r < numRows(); ++r ) { | 300 | for ( int r = 0; r < numRows(); ++r ) { |
301 | for ( int c = 0; c < numCols(); ++c ) { | 301 | for ( int c = 0; c < numCols(); ++c ) { |
302 | if ( cellWidget( r, c ) ) | 302 | if ( cellWidget( r, c ) ) |
303 | clearCellWidget( r, c ); | 303 | clearCellWidget( r, c ); |
304 | clearCell( r, c ); | 304 | clearCell( r, c ); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | setNumRows( 0 ); | 307 | setNumRows( 0 ); |
308 | setPaintingEnabled( TRUE ); | 308 | setPaintingEnabled( TRUE ); |
309 | } | 309 | } |
310 | 310 | ||
311 | // Refresh updates column 2 if the contactsettings changed | 311 | // Refresh updates column 2 if the contactsettings changed |
312 | void AbTable::refresh() | 312 | void AbTable::refresh() |
313 | { | 313 | { |
314 | qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" ); | 314 | qWarning( "void AbTable::refresh() NOT IMPLEMENTED !!" ); |
315 | 315 | ||
316 | #if 0 | 316 | #if 0 |
317 | int rows = numRows(); | 317 | int rows = numRows(); |
318 | AbTableItem *abi; | 318 | AbTableItem *abi; |
319 | ContactItem contactItem; | 319 | ContactItem contactItem; |
320 | 320 | ||
321 | setPaintingEnabled( FALSE ); | 321 | setPaintingEnabled( FALSE ); |
322 | for ( int r = 0; r < rows; ++r ) { | 322 | for ( int r = 0; r < rows; ++r ) { |
323 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 323 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
324 | contactItem = findContactContact( contactList[abi], r ); | 324 | contactItem = findContactContact( contactList[abi], r ); |
325 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); | 325 | static_cast<AbTableItem*>( item(r, 1) )->setItem( contactItem.value, abi->text() ); |
326 | if ( !contactItem.icon.isNull() ){ | 326 | if ( !contactItem.icon.isNull() ){ |
327 | static_cast<AbTableItem*>( item(r, 1) )-> | 327 | static_cast<AbTableItem*>( item(r, 1) )-> |
328 | setPixmap( contactItem.icon ); | 328 | setPixmap( contactItem.icon ); |
329 | }else{ | 329 | }else{ |
330 | static_cast<AbTableItem*>( item(r, 1) )-> | 330 | static_cast<AbTableItem*>( item(r, 1) )-> |
331 | setPixmap( QPixmap() ); | 331 | setPixmap( QPixmap() ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | resort(); | 334 | resort(); |
335 | setPaintingEnabled( TRUE ); | 335 | setPaintingEnabled( TRUE ); |
336 | 336 | ||
337 | #endif | 337 | #endif |
338 | } | 338 | } |
339 | 339 | ||
340 | void AbTable::keyPressEvent( QKeyEvent *e ) | 340 | void AbTable::keyPressEvent( QKeyEvent *e ) |
341 | { | 341 | { |
342 | char key = toupper( e->ascii() ); | 342 | char key = toupper( e->ascii() ); |
343 | 343 | ||
344 | if ( key >= 'A' && key <= 'Z' ) | 344 | if ( key >= 'A' && key <= 'Z' ) |
345 | moveTo( key ); | 345 | moveTo( key ); |
346 | 346 | ||
347 | //qWarning("Received key .."); | 347 | //qWarning("Received key .."); |
348 | switch( e->key() ) { | 348 | switch( e->key() ) { |
349 | case Qt::Key_Space: | 349 | case Qt::Key_Space: |
350 | case Qt::Key_Return: | 350 | case Qt::Key_Return: |
351 | case Qt::Key_Enter: | 351 | case Qt::Key_Enter: |
352 | emit signalSwitch(); | 352 | emit signalSwitch(); |
353 | break; | 353 | break; |
354 | // case Qt::Key_Up: | 354 | // case Qt::Key_Up: |
355 | // qWarning("a"); | 355 | // qWarning("a"); |
356 | // emit signalKeyUp(); | 356 | // emit signalKeyUp(); |
357 | // break; | 357 | // break; |
358 | // case Qt::Key_Down: | 358 | // case Qt::Key_Down: |
359 | // qWarning("b"); | 359 | // qWarning("b"); |
360 | // emit signalKeyDown(); | 360 | // emit signalKeyDown(); |
361 | // break; | 361 | // break; |
362 | default: | 362 | default: |
363 | QTable::keyPressEvent( e ); | 363 | QTable::keyPressEvent( e ); |
364 | } | 364 | } |
365 | 365 | ||
366 | } | 366 | } |
367 | 367 | ||
368 | void AbTable::moveTo( char c ) | 368 | void AbTable::moveTo( char c ) |
369 | { | 369 | { |
370 | qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" ); | 370 | qWarning( "void AbTable::moveTo( char c ) NOT IMPLEMENTED !!" ); |
371 | 371 | ||
372 | #if 0 | 372 | #if 0 |
373 | int rows = numRows(); | 373 | int rows = numRows(); |
374 | QString value; | 374 | QString value; |
375 | AbTableItem *abi; | 375 | AbTableItem *abi; |
376 | int r; | 376 | int r; |
377 | if ( asc ) { | 377 | if ( asc ) { |
378 | r = 0; | 378 | r = 0; |
379 | while ( r < rows-1) { | 379 | while ( r < rows-1) { |
380 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 380 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
381 | QChar first = abi->key()[0]; | 381 | QChar first = abi->key()[0]; |
382 | //### is there a bug in QChar to char comparison??? | 382 | //### is there a bug in QChar to char comparison??? |
383 | if ( first.row() || first.cell() >= c ) | 383 | if ( first.row() || first.cell() >= c ) |
384 | break; | 384 | break; |
385 | r++; | 385 | r++; |
386 | } | 386 | } |
387 | } else { | 387 | } else { |
388 | //### should probably disable reverse sorting instead | 388 | //### should probably disable reverse sorting instead |
389 | r = rows - 1; | 389 | r = rows - 1; |
390 | while ( r > 0 ) { | 390 | while ( r > 0 ) { |
391 | abi = static_cast<AbTableItem*>( item(r, 0) ); | 391 | abi = static_cast<AbTableItem*>( item(r, 0) ); |
392 | QChar first = abi->key()[0]; | 392 | QChar first = abi->key()[0]; |
393 | //### is there a bug in QChar to char comparison??? | 393 | //### is there a bug in QChar to char comparison??? |
394 | if ( first.row() || first.cell() >= c ) | 394 | if ( first.row() || first.cell() >= c ) |
395 | break; | 395 | break; |
396 | r--; | 396 | r--; |
397 | } | 397 | } |
398 | } | 398 | } |
399 | setCurrentCell( r, currentColumn() ); | 399 | setCurrentCell( r, currentColumn() ); |
400 | 400 | ||
401 | #endif | 401 | #endif |
402 | } | 402 | } |
403 | 403 | ||
404 | #if 0 | 404 | #if 0 |
405 | // Useless.. Nobody uses it .. (se) | 405 | // Useless.. Nobody uses it .. (se) |
406 | QString AbTable::findContactName( const OContact &entry ) | 406 | QString AbTable::findContactName( const OContact &entry ) |
407 | { | 407 | { |
408 | // We use the fileAs, then company, defaultEmail | 408 | // We use the fileAs, then company, defaultEmail |
409 | QString str; | 409 | QString str; |
410 | str = entry.fileAs(); | 410 | str = entry.fileAs(); |
411 | if ( str.isEmpty() ) { | 411 | if ( str.isEmpty() ) { |
412 | str = entry.company(); | 412 | str = entry.company(); |
413 | if ( str.isEmpty() ) { | 413 | if ( str.isEmpty() ) { |
414 | str = entry.defaultEmail(); | 414 | str = entry.defaultEmail(); |
415 | } | 415 | } |
416 | } | 416 | } |
417 | return str; | 417 | return str; |
418 | } | 418 | } |
419 | #endif | 419 | #endif |
420 | 420 | ||
421 | 421 | ||
422 | void AbTable::resizeRows() { | 422 | void AbTable::resizeRows() { |
423 | /* | 423 | /* |
424 | if (numRows()) { | 424 | if (numRows()) { |
425 | for (int i = 0; i < numRows(); i++) { | 425 | for (int i = 0; i < numRows(); i++) { |
426 | setRowHeight( i, size ); | 426 | setRowHeight( i, size ); |
427 | } | 427 | } |
428 | } | 428 | } |
429 | updateVisible(); | 429 | updateVisible(); |
430 | */ | 430 | */ |
431 | } | 431 | } |
432 | 432 | ||
433 | 433 | ||
434 | void AbTable::realignTable() | 434 | void AbTable::realignTable() |
435 | { | 435 | { |
436 | //qWarning( "void AbTable::realignTable()" ); | 436 | //qWarning( "void AbTable::realignTable()" ); |
437 | 437 | ||
438 | setPaintingEnabled( FALSE ); | 438 | setPaintingEnabled( FALSE ); |
439 | 439 | ||
440 | resizeRows(); | 440 | resizeRows(); |
441 | fitColumns(); | 441 | fitColumns(); |
442 | 442 | ||
443 | setPaintingEnabled( TRUE ); | 443 | setPaintingEnabled( TRUE ); |
444 | 444 | ||
445 | } | 445 | } |
446 | 446 | ||
447 | 447 | ||
448 | 448 | ||
449 | 449 | ||
450 | #if QT_VERSION <= 230 | 450 | #if QT_VERSION <= 230 |
451 | #ifndef SINGLE_APP | 451 | #ifndef SINGLE_APP |
452 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) | 452 | void QTable::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) |
453 | { | 453 | { |
454 | // Region of the rect we should draw | 454 | // Region of the rect we should draw |
455 | QRegion reg( QRect( cx, cy, cw, ch ) ); | 455 | QRegion reg( QRect( cx, cy, cw, ch ) ); |
456 | // Subtract the table from it | 456 | // Subtract the table from it |
457 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); | 457 | reg = reg.subtract( QRect( QPoint( 0, 0 ), tableSize() ) ); |
458 | // And draw the rectangles (transformed as needed) | 458 | // And draw the rectangles (transformed as needed) |
459 | QArray<QRect> r = reg.rects(); | 459 | QArray<QRect> r = reg.rects(); |
460 | for (unsigned int i=0; i<r.count(); i++) | 460 | for (unsigned int i=0; i<r.count(); i++) |
461 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); | 461 | p->fillRect( r[i], colorGroup().brush( QColorGroup::Base ) ); |
462 | } | 462 | } |
463 | #endif | 463 | #endif |
464 | #endif | 464 | #endif |
465 | 465 | ||
466 | 466 | ||
467 | // int AbTable::rowHeight( int ) const | 467 | // int AbTable::rowHeight( int ) const |
468 | // { | 468 | // { |
469 | // return 18; | 469 | // return 18; |
470 | // } | 470 | // } |
471 | 471 | ||
472 | // int AbTable::rowPos( int row ) const | 472 | // int AbTable::rowPos( int row ) const |
473 | // { | 473 | // { |
474 | // return 18*row; | 474 | // return 18*row; |
475 | // } | 475 | // } |
476 | 476 | ||
477 | // int AbTable::rowAt( int pos ) const | 477 | // int AbTable::rowAt( int pos ) const |
478 | // { | 478 | // { |
479 | // return QMIN( pos/18, numRows()-1 ); | 479 | // return QMIN( pos/18, numRows()-1 ); |
480 | // } | 480 | // } |
481 | 481 | ||
482 | 482 | ||
483 | 483 | ||
484 | void AbTable::fitColumns() | 484 | void AbTable::fitColumns() |
485 | { | 485 | { |
486 | //qWarning( "void AbTable::fitColumns()" ); | 486 | qWarning( "void AbTable::fitColumns()" ); |
487 | int contentsWidth = visibleWidth() / 2; // :SX Why too low | 487 | int contentsWidth = visibleWidth() / 2; |
488 | // Fix to better value | 488 | // Fix to better value |
489 | // contentsWidth = 130; | 489 | // contentsWidth = 130; |
490 | 490 | ||
491 | setPaintingEnabled( FALSE ); | 491 | setPaintingEnabled( FALSE ); |
492 | 492 | ||
493 | if ( columnVisible == false ){ | 493 | if ( columnVisible == false ){ |
494 | showColumn(0); | 494 | showColumn(0); |
495 | columnVisible = true; | 495 | columnVisible = true; |
496 | } | 496 | } |
497 | 497 | ||
498 | //qWarning("Width: %d", contentsWidth); | 498 | //qWarning("Width: %d", contentsWidth); |
499 | 499 | ||
500 | setColumnWidth( 0, contentsWidth ); | 500 | setColumnWidth( 0, contentsWidth ); |
501 | adjustColumn(1); | 501 | adjustColumn(1); |
502 | if ( columnWidth(1) < contentsWidth ) | 502 | if ( columnWidth(1) < contentsWidth ) |
503 | setColumnWidth( 1, contentsWidth ); | 503 | setColumnWidth( 1, contentsWidth ); |
504 | 504 | ||
505 | setPaintingEnabled( TRUE ); | 505 | setPaintingEnabled( TRUE ); |
506 | } | 506 | } |
507 | 507 | ||
508 | void AbTable::show() | 508 | void AbTable::show() |
509 | { | 509 | { |
510 | //qWarning( "void AbTable::show()" ); | 510 | //qWarning( "void AbTable::show()" ); |
511 | realignTable(); | 511 | realignTable(); |
512 | QTable::show(); | 512 | QTable::show(); |
513 | } | 513 | } |
514 | 514 | ||
515 | #if 0 | 515 | #if 0 |
516 | void AbTable::setChoiceNames( const QStringList& list) | 516 | void AbTable::setChoiceNames( const QStringList& list) |
517 | { | 517 | { |
518 | choicenames = list; | 518 | choicenames = list; |
519 | if ( choicenames.isEmpty() ) { | 519 | if ( choicenames.isEmpty() ) { |
520 | // hide pick column | 520 | // hide pick column |
521 | setNumCols( 2 ); | 521 | setNumCols( 2 ); |
522 | } else { | 522 | } else { |
523 | // show pick column | 523 | // show pick column |
524 | setNumCols( 3 ); | 524 | setNumCols( 3 ); |
525 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); | 525 | setColumnWidth( 2, fontMetrics().width(tr( "Pick" ))+8 ); |
526 | horizontalHeader()->setLabel( 2, tr( "Pick" )); | 526 | horizontalHeader()->setLabel( 2, tr( "Pick" )); |
527 | } | 527 | } |
528 | fitColumns(); | 528 | fitColumns(); |
529 | } | 529 | } |
530 | #endif | 530 | #endif |
531 | 531 | ||
532 | void AbTable::itemClicked(int,int col) | 532 | void AbTable::itemClicked(int,int col) |
533 | { | 533 | { |
534 | //qWarning( "AbTable::itemClicked(int, col:%d)", col); | 534 | //qWarning( "AbTable::itemClicked(int, col:%d)", col); |
535 | if ( col == 2 ) { | 535 | if ( col == 2 ) { |
536 | return; | 536 | return; |
537 | } else { | 537 | } else { |
538 | // qWarning ("Emitting signalSwitch()"); | 538 | // qWarning ("Emitting signalSwitch()"); |
539 | emit signalSwitch(); | 539 | emit signalSwitch(); |
540 | } | 540 | } |
541 | } | 541 | } |
542 | 542 | ||
543 | #if 0 | 543 | #if 0 |
544 | QStringList AbTable::choiceNames() const | 544 | QStringList AbTable::choiceNames() const |
545 | { | 545 | { |
546 | return choicenames; | 546 | return choicenames; |
547 | } | 547 | } |
548 | 548 | ||
549 | #endif | 549 | #endif |
550 | void AbTable::setChoiceSelection( const QValueList<int>& list ) | 550 | void AbTable::setChoiceSelection( const QValueList<int>& list ) |
551 | { | 551 | { |
552 | intFields = list; | 552 | intFields = list; |
553 | } | 553 | } |
554 | 554 | ||
555 | QStringList AbTable::choiceSelection(int /*index*/) const | 555 | QStringList AbTable::choiceSelection(int /*index*/) const |
556 | { | 556 | { |
557 | QStringList r; | 557 | QStringList r; |
558 | /* ###### | 558 | /* ###### |
559 | 559 | ||
560 | QString selname = choicenames.at(index); | 560 | QString selname = choicenames.at(index); |
561 | for (each row) { | 561 | for (each row) { |
562 | OContact *c = contactForRow(row); | 562 | OContact *c = contactForRow(row); |
563 | if ( text(row,2) == selname ) { | 563 | if ( text(row,2) == selname ) { |
564 | r.append(c->email); | 564 | r.append(c->email); |
565 | } | 565 | } |
566 | } | 566 | } |
567 | 567 | ||
568 | */ | 568 | */ |
569 | return r; | 569 | return r; |
570 | } | 570 | } |
571 | 571 | ||
572 | 572 | ||
573 | void AbTable::updateVisible() | 573 | void AbTable::updateVisible() |
574 | { | 574 | { |
575 | //qWarning("void AbTable::updateVisible()"); | 575 | //qWarning("void AbTable::updateVisible()"); |
576 | 576 | ||
577 | int visible, | 577 | int visible, |
578 | totalRows, | 578 | totalRows, |
579 | row, | 579 | row, |
580 | selectedRow = 0; | 580 | selectedRow = 0; |
581 | 581 | ||
582 | visible = 0; | 582 | visible = 0; |
583 | 583 | ||
584 | setPaintingEnabled( FALSE ); | 584 | setPaintingEnabled( FALSE ); |
585 | 585 | ||
586 | realignTable(); | 586 | realignTable(); |
587 | 587 | ||
588 | totalRows = numRows(); | 588 | totalRows = numRows(); |
589 | for ( row = 0; row < totalRows; row++ ) { | 589 | for ( row = 0; row < totalRows; row++ ) { |
590 | if ( rowHeight(row) == 0 ) { | 590 | if ( rowHeight(row) == 0 ) { |
591 | showRow( row ); | 591 | showRow( row ); |
592 | adjustRow( row ); | 592 | adjustRow( row ); |
593 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) | 593 | if ( isSelected( row,0 ) || isSelected( row,1 ) ) |
594 | selectedRow = row; | 594 | selectedRow = row; |
595 | } | 595 | } |
596 | visible++; | 596 | visible++; |
597 | } | 597 | } |
598 | 598 | ||
599 | if ( selectedRow ) | 599 | if ( selectedRow ) |
600 | setCurrentCell( selectedRow, 0 ); | 600 | setCurrentCell( selectedRow, 0 ); |
601 | 601 | ||
602 | if ( !visible ) | 602 | if ( !visible ) |
603 | setCurrentCell( -1, 0 ); | 603 | setCurrentCell( -1, 0 ); |
604 | 604 | ||
605 | setPaintingEnabled( TRUE ); | 605 | setPaintingEnabled( TRUE ); |
606 | } | 606 | } |
607 | 607 | ||
608 | 608 | ||
609 | void AbTable::setPaintingEnabled( bool e ) | 609 | void AbTable::setPaintingEnabled( bool e ) |
610 | { | 610 | { |
611 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 611 | //qWarning("IN void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
612 | 612 | ||
613 | if ( e ) { | 613 | if ( e ) { |
614 | if ( countNested > 0 ) | 614 | if ( countNested > 0 ) |
615 | --countNested; | 615 | --countNested; |
616 | if ( ! countNested ){ | 616 | if ( ! countNested ){ |
617 | setUpdatesEnabled( true ); | 617 | setUpdatesEnabled( true ); |
618 | enablePainting = true; | 618 | enablePainting = true; |
619 | rowHeightChanged( 0 ); | 619 | rowHeightChanged( 0 ); |
620 | viewport()->update(); | 620 | viewport()->update(); |
621 | } | 621 | } |
622 | } else { | 622 | } else { |
623 | ++countNested; | 623 | ++countNested; |
624 | enablePainting = false; | 624 | enablePainting = false; |
625 | setUpdatesEnabled( false ); | 625 | setUpdatesEnabled( false ); |
626 | } | 626 | } |
627 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); | 627 | //qWarning("OUT void AbTable::setPaintingEnabled( %d )->Nested: %d", e, countNested ); |
628 | } | 628 | } |
629 | 629 | ||
630 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { | 630 | void AbTable::viewportPaintEvent( QPaintEvent* e ) { |
631 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); | 631 | //qWarning(" void AbTable::viewportPaintEvent( QPaintEvent* e ) -> %d", enablePainting); |
632 | if ( enablePainting ) | 632 | if ( enablePainting ) |
633 | QTable::viewportPaintEvent( e ); | 633 | QTable::viewportPaintEvent( e ); |
634 | } | 634 | } |
635 | 635 | ||
636 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { | 636 | void AbTable::paintCell(QPainter* p, int row, int col, const QRect& cr, bool ) { |
637 | const QColorGroup &cg = colorGroup(); | 637 | const QColorGroup &cg = colorGroup(); |
638 | 638 | ||
639 | p->save(); | 639 | p->save(); |
640 | 640 | ||
641 | //qWarning( "Paint row: %d", row ); | 641 | //qWarning( "Paint row: %d", row ); |
642 | 642 | ||
643 | OContact act_contact = m_viewList[row]; | 643 | OContact act_contact = m_viewList[row]; |
644 | 644 | ||
645 | // Paint alternating background bars | 645 | // Paint alternating background bars |
646 | if ( (row % 2 ) == 0 ) { | 646 | if ( (row % 2 ) == 0 ) { |
647 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 647 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
648 | p->setPen( QPen( cg.text() ) ); | 648 | p->setPen( QPen( cg.text() ) ); |
649 | } | 649 | } |
650 | else { | 650 | else { |
651 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); | 651 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Background ) ); |
652 | p->setPen( QPen( cg.buttonText() ) ); | 652 | p->setPen( QPen( cg.buttonText() ) ); |
653 | } | 653 | } |
654 | 654 | ||
655 | QFont f = p->font(); | 655 | QFont f = p->font(); |
656 | QFontMetrics fm(f); | 656 | QFontMetrics fm(f); |
657 | 657 | ||
658 | int marg = 2; | 658 | int marg = 2; |
659 | int x = 0; | 659 | int x = 0; |
660 | int y = ( cr.height() - 14 ) / 2; | 660 | int y = ( cr.height() - 14 ) / 2; |
661 | 661 | ||
662 | QString nameText = act_contact.fileAs(); | 662 | QString nameText = act_contact.fileAs(); |
663 | 663 | ||
664 | switch( col ){ | 664 | switch( col ){ |
665 | case 0: | 665 | case 0: |
666 | p->drawText( x + marg,2 + fm.ascent(), nameText ); | 666 | p->drawText( x + marg,2 + fm.ascent(), nameText ); |
667 | break; | 667 | break; |
668 | case 1:{ | 668 | case 1:{ |
669 | 669 | ||
670 | ContactItem contactItem = findContactContact( act_contact, 0 ); | 670 | ContactItem contactItem = findContactContact( act_contact, 0 ); |
671 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ | 671 | QPixmap contactPic = contactItem.icon; /* pixmap( row, col ); */ |
672 | QString contactText = contactItem.value; | 672 | QString contactText = contactItem.value; |
673 | 673 | ||
674 | if ( !contactPic.isNull() ) | 674 | if ( !contactPic.isNull() ) |
675 | { | 675 | { |
676 | p->drawPixmap( x + marg, y, contactPic ); | 676 | p->drawPixmap( x + marg, y, contactPic ); |
677 | p->drawText( x + marg + contactPic.width() | 677 | p->drawText( x + marg + contactPic.width() |
678 | + 4,2 + fm.ascent(), contactText ); | 678 | + 4,2 + fm.ascent(), contactText ); |
679 | } | 679 | } |
680 | else | 680 | else |
681 | { | 681 | { |
682 | p->drawText( x + marg,2 + fm.ascent(), contactText ); | 682 | p->drawText( x + marg,2 + fm.ascent(), contactText ); |
683 | } | 683 | } |
684 | } | 684 | } |
685 | break; | 685 | break; |
686 | 686 | ||
687 | } | 687 | } |
688 | p->restore(); | 688 | p->restore(); |
689 | } | 689 | } |
690 | 690 | ||
691 | void AbTable::rowHeightChanged( int row ) | 691 | void AbTable::rowHeightChanged( int row ) |
692 | { | 692 | { |
693 | if ( enablePainting ) | 693 | if ( enablePainting ) |
694 | QTable::rowHeightChanged( row ); | 694 | QTable::rowHeightChanged( row ); |
695 | } | 695 | } |
696 | ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) | 696 | ContactItem AbTable::findContactContact( const OContact &entry, int /* row */ ) |
697 | { | 697 | { |
698 | 698 | ||
699 | ContactItem item; | 699 | ContactItem item; |
700 | 700 | ||
701 | item.value = ""; | 701 | item.value = ""; |
702 | 702 | ||
703 | for ( QValueList<int>::ConstIterator it = intFields.begin(); | 703 | for ( QValueList<int>::ConstIterator it = intFields.begin(); |
704 | it != intFields.end(); ++it ) { | 704 | it != intFields.end(); ++it ) { |
705 | switch ( *it ) { | 705 | switch ( *it ) { |
706 | default: | 706 | default: |
707 | break; | 707 | break; |
708 | case Qtopia::Title: | 708 | case Qtopia::Title: |
709 | item.value = entry.title(); | 709 | item.value = entry.title(); |
710 | break; | 710 | break; |
711 | case Qtopia::Suffix: | 711 | case Qtopia::Suffix: |
712 | item.value = entry.suffix(); | 712 | item.value = entry.suffix(); |
713 | break; | 713 | break; |
714 | case Qtopia::FileAs: | 714 | case Qtopia::FileAs: |
715 | item.value = entry.fileAs(); | 715 | item.value = entry.fileAs(); |
716 | break; | 716 | break; |
717 | case Qtopia::DefaultEmail: | 717 | case Qtopia::DefaultEmail: |
718 | item.value = entry.defaultEmail(); | 718 | item.value = entry.defaultEmail(); |
719 | if ( !item.value.isEmpty() ) | 719 | if ( !item.value.isEmpty() ) |
720 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 720 | item.icon = Resource::loadPixmap( "addressbook/email" ); |
721 | break; | 721 | break; |
722 | case Qtopia::Emails: | 722 | case Qtopia::Emails: |
723 | item.value = entry.emails(); | 723 | item.value = entry.emails(); |
724 | if ( !item.value.isEmpty() ) | 724 | if ( !item.value.isEmpty() ) |
725 | item.icon = Resource::loadPixmap( "addressbook/email" ); | 725 | item.icon = Resource::loadPixmap( "addressbook/email" ); |
726 | break; | 726 | break; |
727 | case Qtopia::HomeStreet: | 727 | case Qtopia::HomeStreet: |
728 | item.value = entry.homeStreet(); | 728 | item.value = entry.homeStreet(); |
729 | break; | 729 | break; |
730 | case Qtopia::HomeCity: | 730 | case Qtopia::HomeCity: |
731 | item.value = entry.homeCity(); | 731 | item.value = entry.homeCity(); |
732 | break; | 732 | break; |
733 | case Qtopia::HomeState: | 733 | case Qtopia::HomeState: |
734 | item.value = entry.homeState(); | 734 | item.value = entry.homeState(); |
735 | break; | 735 | break; |
736 | case Qtopia::HomeZip: | 736 | case Qtopia::HomeZip: |
737 | item.value = entry.homeZip(); | 737 | item.value = entry.homeZip(); |
738 | break; | 738 | break; |
739 | case Qtopia::HomeCountry: | 739 | case Qtopia::HomeCountry: |
740 | item.value = entry.homeCountry(); | 740 | item.value = entry.homeCountry(); |
741 | break; | 741 | break; |
742 | case Qtopia::HomePhone: | 742 | case Qtopia::HomePhone: |
743 | item.value = entry.homePhone(); | 743 | item.value = entry.homePhone(); |
diff --git a/core/pim/addressbook/abview.cpp b/core/pim/addressbook/abview.cpp index 6cbd556..670cdb0 100644 --- a/core/pim/addressbook/abview.cpp +++ b/core/pim/addressbook/abview.cpp | |||
@@ -1,312 +1,313 @@ | |||
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 | #include <assert.h> | 25 | #include <assert.h> |
26 | 26 | ||
27 | 27 | ||
28 | // Is defined in LibQPE | 28 | // Is defined in LibQPE |
29 | extern QString categoryFileName(); | 29 | extern QString categoryFileName(); |
30 | 30 | ||
31 | QString addressbookPersonalVCardName() | 31 | QString addressbookPersonalVCardName() |
32 | { | 32 | { |
33 | QString filename = Global::applicationFileName("addressbook", | 33 | QString filename = Global::applicationFileName("addressbook", |
34 | "businesscard.vcf"); | 34 | "businesscard.vcf"); |
35 | return filename; | 35 | return filename; |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): | 39 | AbView::AbView ( QWidget* parent, const QValueList<int>& ordered ): |
40 | QWidget(parent), | 40 | QWidget(parent), |
41 | mCat(0), | 41 | mCat(0), |
42 | m_inSearch( false ), | 42 | m_inSearch( false ), |
43 | m_inPersonal( false ), | 43 | m_inPersonal( false ), |
44 | m_curr_category( -1 ), | 44 | m_curr_category( -1 ), |
45 | m_curr_View( TableView ), | 45 | m_curr_View( TableView ), |
46 | m_prev_View( TableView ), | 46 | m_prev_View( TableView ), |
47 | m_curr_Contact ( 0 ), | 47 | m_curr_Contact ( 0 ), |
48 | m_contactdb ( 0l ), | 48 | m_contactdb ( 0l ), |
49 | m_storedDB ( 0l ), | 49 | m_storedDB ( 0l ), |
50 | m_viewStack( 0l ), | 50 | m_viewStack( 0l ), |
51 | m_abTable( 0l ), | 51 | m_abTable( 0l ), |
52 | m_orderedFields( ordered ) | 52 | m_orderedFields( ordered ) |
53 | { | 53 | { |
54 | qWarning("AbView::c'tor"); | 54 | qWarning("AbView::c'tor"); |
55 | // Load default database and handle syncing myself.. ! | 55 | // Load default database and handle syncing myself.. ! |
56 | m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ), | 56 | m_contactdb = new OContactAccess ( "addressbook", 0l, 0l, false ); |
57 | m_contactdb -> setReadAhead( 16 ); // Use ReadAhead-Cache if available | ||
57 | mCat.load( categoryFileName() ); | 58 | mCat.load( categoryFileName() ); |
58 | 59 | ||
59 | // Create Layout and put WidgetStack into it. | 60 | // Create Layout and put WidgetStack into it. |
60 | QVBoxLayout *vb = new QVBoxLayout( this ); | 61 | QVBoxLayout *vb = new QVBoxLayout( this ); |
61 | m_viewStack = new QWidgetStack( this ); | 62 | m_viewStack = new QWidgetStack( this ); |
62 | vb->addWidget( m_viewStack ); | 63 | vb->addWidget( m_viewStack ); |
63 | 64 | ||
64 | // Creat TableView | 65 | // Creat TableView |
65 | QVBox* tableBox = new QVBox( m_viewStack ); | 66 | QVBox* tableBox = new QVBox( m_viewStack ); |
66 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); | 67 | m_abTable = new AbTable( m_orderedFields, tableBox, "table" ); |
67 | m_abTable->setCurrentCell( 0, 0 ); | 68 | m_abTable->setCurrentCell( 0, 0 ); |
68 | m_abTable->setFocus(); | 69 | m_abTable->setFocus(); |
69 | 70 | ||
70 | // Add TableView to WidgetStack and raise it | 71 | // Add TableView to WidgetStack and raise it |
71 | m_viewStack -> addWidget( tableBox , TableView ); | 72 | m_viewStack -> addWidget( tableBox , TableView ); |
72 | 73 | ||
73 | // Create CardView and add it to WidgetStack | 74 | // Create CardView and add it to WidgetStack |
74 | QVBox* cardBox = new QVBox( m_viewStack ); | 75 | QVBox* cardBox = new QVBox( m_viewStack ); |
75 | m_ablabel = new AbLabel( cardBox, "CardView"); | 76 | m_ablabel = new AbLabel( cardBox, "CardView"); |
76 | m_viewStack -> addWidget( cardBox , CardView ); | 77 | m_viewStack -> addWidget( cardBox , CardView ); |
77 | 78 | ||
78 | // Connect views to me | 79 | // Connect views to me |
79 | connect ( m_abTable, SIGNAL( signalSwitch( void ) ), | 80 | connect ( m_abTable, SIGNAL( signalSwitch( void ) ), |
80 | this, SLOT( slotSwitch( void ) ) ); | 81 | this, SLOT( slotSwitch( void ) ) ); |
81 | connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), | 82 | connect ( m_ablabel, SIGNAL( signalOkPressed( void ) ), |
82 | this, SLOT( slotSwitch( void ) ) ); | 83 | this, SLOT( slotSwitch( void ) ) ); |
83 | 84 | ||
84 | load(); | 85 | load(); |
85 | } | 86 | } |
86 | 87 | ||
87 | AbView::~AbView() | 88 | AbView::~AbView() |
88 | { | 89 | { |
89 | m_contactdb -> save(); | 90 | m_contactdb -> save(); |
90 | delete m_contactdb; | 91 | delete m_contactdb; |
91 | 92 | ||
92 | if ( m_storedDB ){ | 93 | if ( m_storedDB ){ |
93 | m_storedDB -> save(); | 94 | m_storedDB -> save(); |
94 | delete m_storedDB; | 95 | delete m_storedDB; |
95 | } | 96 | } |
96 | } | 97 | } |
97 | 98 | ||
98 | 99 | ||
99 | void AbView::setView( Views view ) | 100 | void AbView::setView( Views view ) |
100 | { | 101 | { |
101 | qWarning("AbView::setView( Views view )"); | 102 | qWarning("AbView::setView( Views view )"); |
102 | m_curr_View = view; | 103 | m_curr_View = view; |
103 | load(); | 104 | load(); |
104 | } | 105 | } |
105 | 106 | ||
106 | void AbView::addEntry( const OContact &newContact ) | 107 | void AbView::addEntry( const OContact &newContact ) |
107 | { | 108 | { |
108 | qWarning("abview:AddContact"); | 109 | qWarning("abview:AddContact"); |
109 | m_contactdb->add ( newContact ); | 110 | m_contactdb->add ( newContact ); |
110 | load(); | 111 | load(); |
111 | 112 | ||
112 | } | 113 | } |
113 | void AbView::removeEntry( const int UID ) | 114 | void AbView::removeEntry( const int UID ) |
114 | { | 115 | { |
115 | qWarning("abview:RemoveContact"); | 116 | qWarning("abview:RemoveContact"); |
116 | m_contactdb->remove( UID ); | 117 | m_contactdb->remove( UID ); |
117 | load(); | 118 | load(); |
118 | } | 119 | } |
119 | 120 | ||
120 | void AbView::replaceEntry( const OContact &contact ) | 121 | void AbView::replaceEntry( const OContact &contact ) |
121 | { | 122 | { |
122 | qWarning("abview:ReplaceContact"); | 123 | qWarning("abview:ReplaceContact"); |
123 | m_contactdb->replace( contact ); | 124 | m_contactdb->replace( contact ); |
124 | load(); | 125 | load(); |
125 | 126 | ||
126 | } | 127 | } |
127 | 128 | ||
128 | OContact AbView::currentEntry() | 129 | OContact AbView::currentEntry() |
129 | { | 130 | { |
130 | OContact currentContact; | 131 | OContact currentContact; |
131 | 132 | ||
132 | switch ( (int) m_curr_View ) { | 133 | switch ( (int) m_curr_View ) { |
133 | case TableView: | 134 | case TableView: |
134 | currentContact = m_abTable -> currentEntry(); | 135 | currentContact = m_abTable -> currentEntry(); |
135 | break; | 136 | break; |
136 | case CardView: | 137 | case CardView: |
137 | currentContact = m_ablabel -> currentEntry(); | 138 | currentContact = m_ablabel -> currentEntry(); |
138 | break; | 139 | break; |
139 | } | 140 | } |
140 | m_curr_Contact = currentContact.uid(); | 141 | m_curr_Contact = currentContact.uid(); |
141 | return currentContact; | 142 | return currentContact; |
142 | } | 143 | } |
143 | 144 | ||
144 | bool AbView::save() | 145 | bool AbView::save() |
145 | { | 146 | { |
146 | //qWarning("abView:Save data"); | 147 | //qWarning("abView:Save data"); |
147 | 148 | ||
148 | return m_contactdb->save(); | 149 | return m_contactdb->save(); |
149 | } | 150 | } |
150 | 151 | ||
151 | void AbView::load() | 152 | void AbView::load() |
152 | { | 153 | { |
153 | qWarning("abView:Load data"); | 154 | qWarning("abView:Load data"); |
154 | 155 | ||
155 | // Letter Search is stopped at this place | 156 | // Letter Search is stopped at this place |
156 | emit signalClearLetterPicker(); | 157 | emit signalClearLetterPicker(); |
157 | 158 | ||
158 | if ( m_inPersonal ) | 159 | if ( m_inPersonal ) |
159 | // VCard Backend does not sort.. | 160 | // VCard Backend does not sort.. |
160 | m_list = m_contactdb->allRecords(); | 161 | m_list = m_contactdb->allRecords(); |
161 | else{ | 162 | else{ |
162 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); | 163 | m_list = m_contactdb->sorted( true, 0, 0, 0 ); |
163 | if ( m_curr_category != -1 ) | 164 | if ( m_curr_category != -1 ) |
164 | clearForCategory(); | 165 | clearForCategory(); |
165 | } | 166 | } |
166 | 167 | ||
167 | qWarning ("Number of contacts: %d", m_list.count()); | 168 | qWarning ("Number of contacts: %d", m_list.count()); |
168 | 169 | ||
169 | updateView( true ); | 170 | updateView( true ); |
170 | 171 | ||
171 | } | 172 | } |
172 | 173 | ||
173 | void AbView::reload() | 174 | void AbView::reload() |
174 | { | 175 | { |
175 | qWarning( "void AbView::reload()" ); | 176 | qWarning( "void AbView::reload()" ); |
176 | 177 | ||
177 | m_contactdb->reload(); | 178 | m_contactdb->reload(); |
178 | load(); | 179 | load(); |
179 | } | 180 | } |
180 | 181 | ||
181 | void AbView::clear() | 182 | void AbView::clear() |
182 | { | 183 | { |
183 | // :SX | 184 | // :SX |
184 | } | 185 | } |
185 | 186 | ||
186 | void AbView::setShowByCategory( const QString& cat ) | 187 | void AbView::setShowByCategory( const QString& cat ) |
187 | { | 188 | { |
188 | qWarning("AbView::setShowCategory( const QString& cat )"); | 189 | qWarning("AbView::setShowCategory( const QString& cat )"); |
189 | 190 | ||
190 | int intCat = 0; | 191 | int intCat = 0; |
191 | 192 | ||
192 | // All (cat == NULL) will be stored as -1 | 193 | // All (cat == NULL) will be stored as -1 |
193 | if ( cat.isNull() ) | 194 | if ( cat.isNull() ) |
194 | intCat = -1; | 195 | intCat = -1; |
195 | else | 196 | else |
196 | intCat = mCat.id("Contacts", cat ); | 197 | intCat = mCat.id("Contacts", cat ); |
197 | 198 | ||
198 | // Just do anything if we really change the category | 199 | // Just do anything if we really change the category |
199 | if ( intCat != m_curr_category ){ | 200 | if ( intCat != m_curr_category ){ |
200 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); | 201 | // qWarning ("Categories: Selected %s.. Number: %d", cat.latin1(), m_curr_category); |
201 | 202 | ||
202 | m_curr_category = intCat; | 203 | m_curr_category = intCat; |
203 | emit signalClearLetterPicker(); | 204 | emit signalClearLetterPicker(); |
204 | 205 | ||
205 | load(); | 206 | load(); |
206 | } | 207 | } |
207 | 208 | ||
208 | } | 209 | } |
209 | 210 | ||
210 | void AbView::setShowToView( Views view ) | 211 | void AbView::setShowToView( Views view ) |
211 | { | 212 | { |
212 | qWarning("void AbView::setShowToView( View %d )", view); | 213 | qWarning("void AbView::setShowToView( View %d )", view); |
213 | 214 | ||
214 | if ( m_curr_View != view ){ | 215 | if ( m_curr_View != view ){ |
215 | qWarning ("Change the View (Category is: %d)", m_curr_category); | 216 | qWarning ("Change the View (Category is: %d)", m_curr_category); |
216 | m_prev_View = m_curr_View; | 217 | m_prev_View = m_curr_View; |
217 | m_curr_View = view; | 218 | m_curr_View = view; |
218 | 219 | ||
219 | updateView(); | 220 | updateView(); |
220 | } | 221 | } |
221 | 222 | ||
222 | } | 223 | } |
223 | 224 | ||
224 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) | 225 | void AbView::setShowByLetter( char c, AbConfig::LPSearchMode mode ) |
225 | { | 226 | { |
226 | qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); | 227 | qWarning("void AbView::setShowByLetter( %c, %d )", c, mode ); |
227 | 228 | ||
228 | assert( mode < AbConfig::LASTELEMENT ); | 229 | assert( mode < AbConfig::LASTELEMENT ); |
229 | 230 | ||
230 | OContact query; | 231 | OContact query; |
231 | if ( c == 0 ){ | 232 | if ( c == 0 ){ |
232 | load(); | 233 | load(); |
233 | return; | 234 | return; |
234 | }else{ | 235 | }else{ |
235 | // If the current Backend is unable to solve the query, we will | 236 | // If the current Backend is unable to solve the query, we will |
236 | // ignore the request .. | 237 | // ignore the request .. |
237 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ | 238 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::WildCards | OContactAccess::IgnoreCase ) ){ |
238 | return; | 239 | return; |
239 | } | 240 | } |
240 | 241 | ||
241 | switch( mode ){ | 242 | switch( mode ){ |
242 | case AbConfig::LastName: | 243 | case AbConfig::LastName: |
243 | query.setLastName( QString("%1*").arg(c) ); | 244 | query.setLastName( QString("%1*").arg(c) ); |
244 | break; | 245 | break; |
245 | case AbConfig::FileAs: | 246 | case AbConfig::FileAs: |
246 | query.setFileAs( QString("%1*").arg(c) ); | 247 | query.setFileAs( QString("%1*").arg(c) ); |
247 | break; | 248 | break; |
248 | default: | 249 | default: |
249 | qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); | 250 | qWarning( "Unknown Searchmode for AbView::setShowByLetter ! -> %d", mode ); |
250 | qWarning( "I will ignore it.." ); | 251 | qWarning( "I will ignore it.." ); |
251 | return; | 252 | return; |
252 | } | 253 | } |
253 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); | 254 | m_list = m_contactdb->queryByExample( query, OContactAccess::WildCards | OContactAccess::IgnoreCase ); |
254 | if ( m_curr_category != -1 ) | 255 | if ( m_curr_category != -1 ) |
255 | clearForCategory(); | 256 | clearForCategory(); |
256 | m_curr_Contact = 0; | 257 | m_curr_Contact = 0; |
257 | } | 258 | } |
258 | updateView( true ); | 259 | updateView( true ); |
259 | } | 260 | } |
260 | 261 | ||
261 | void AbView::setListOrder( const QValueList<int>& ordered ) | 262 | void AbView::setListOrder( const QValueList<int>& ordered ) |
262 | { | 263 | { |
263 | m_orderedFields = ordered; | 264 | m_orderedFields = ordered; |
264 | if ( m_abTable ){ | 265 | if ( m_abTable ){ |
265 | m_abTable->setOrderedList( ordered ); | 266 | m_abTable->setOrderedList( ordered ); |
266 | m_abTable->refresh(); | 267 | m_abTable->refresh(); |
267 | } | 268 | } |
268 | updateView(); | 269 | updateView(); |
269 | } | 270 | } |
270 | 271 | ||
271 | 272 | ||
272 | QString AbView::showCategory() const | 273 | QString AbView::showCategory() const |
273 | { | 274 | { |
274 | return mCat.label( "Contacts", m_curr_category ); | 275 | return mCat.label( "Contacts", m_curr_category ); |
275 | } | 276 | } |
276 | 277 | ||
277 | void AbView::showPersonal( bool personal ) | 278 | void AbView::showPersonal( bool personal ) |
278 | { | 279 | { |
279 | qWarning ("void AbView::showPersonal( %d )", personal); | 280 | qWarning ("void AbView::showPersonal( %d )", personal); |
280 | 281 | ||
281 | if ( personal ){ | 282 | if ( personal ){ |
282 | 283 | ||
283 | if ( m_inPersonal ) | 284 | if ( m_inPersonal ) |
284 | return; | 285 | return; |
285 | 286 | ||
286 | // Now switch to vCard Backend and load data. | 287 | // Now switch to vCard Backend and load data. |
287 | // The current default backend will be stored | 288 | // The current default backend will be stored |
288 | // to avoid unneeded load/stores. | 289 | // to avoid unneeded load/stores. |
289 | m_storedDB = m_contactdb; | 290 | m_storedDB = m_contactdb; |
290 | 291 | ||
291 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, | 292 | OContactAccessBackend* vcard_backend = new OContactAccessBackend_VCard( QString::null, |
292 | addressbookPersonalVCardName() ); | 293 | addressbookPersonalVCardName() ); |
293 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 294 | m_contactdb = new OContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
294 | 295 | ||
295 | m_inPersonal = true; | 296 | m_inPersonal = true; |
296 | m_curr_View = CardView; | 297 | m_curr_View = CardView; |
297 | 298 | ||
298 | }else{ | 299 | }else{ |
299 | 300 | ||
300 | if ( !m_inPersonal ) | 301 | if ( !m_inPersonal ) |
301 | return; | 302 | return; |
302 | 303 | ||
303 | // Remove vCard Backend and restore default | 304 | // Remove vCard Backend and restore default |
304 | m_contactdb->save(); | 305 | m_contactdb->save(); |
305 | delete m_contactdb; | 306 | delete m_contactdb; |
306 | 307 | ||
307 | m_contactdb = m_storedDB; | 308 | m_contactdb = m_storedDB; |
308 | m_storedDB = 0l; | 309 | m_storedDB = 0l; |
309 | 310 | ||
310 | m_curr_View = TableView; | 311 | m_curr_View = TableView; |
311 | m_inPersonal = false; | 312 | m_inPersonal = false; |
312 | 313 | ||
diff --git a/core/pim/addressbook/addressbook.pro b/core/pim/addressbook/addressbook.pro index 1637cac..c90568a 100644 --- a/core/pim/addressbook/addressbook.pro +++ b/core/pim/addressbook/addressbook.pro | |||
@@ -1,53 +1,51 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | #CONFIG = qt warn_on release | 2 | #CONFIG = qt warn_on release |
3 | CONFIG = qt warn_on debug | 3 | CONFIG = qt warn_on debug |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS= addressbook.h \ | 5 | HEADERS= addressbook.h \ |
6 | contacteditor.h \ | 6 | contacteditor.h \ |
7 | ocontactfields.h \ | ||
8 | ablabel.h \ | 7 | ablabel.h \ |
9 | abtable.h \ | 8 | abtable.h \ |
10 | picker.h \ | 9 | picker.h \ |
11 | ofloatbar.h \ | 10 | ofloatbar.h \ |
12 | configdlg.h \ | 11 | configdlg.h \ |
13 | abconfig.h \ | 12 | abconfig.h \ |
14 | abview.h | 13 | abview.h |
15 | SOURCES= main.cpp \ | 14 | SOURCES= main.cpp \ |
16 | addressbook.cpp \ | 15 | addressbook.cpp \ |
17 | contacteditor.cpp \ | 16 | contacteditor.cpp \ |
18 | ocontactfields.cpp \ | ||
19 | ablabel.cpp \ | 17 | ablabel.cpp \ |
20 | abtable.cpp \ | 18 | abtable.cpp \ |
21 | picker.cpp \ | 19 | picker.cpp \ |
22 | configdlg.cpp \ | 20 | configdlg.cpp \ |
23 | abconfig.cpp \ | 21 | abconfig.cpp \ |
24 | abview.cpp | 22 | abview.cpp |
25 | 23 | ||
26 | INTERFACES= configdlg_base.ui | 24 | INTERFACES= configdlg_base.ui |
27 | TARGET = addressbook | 25 | TARGET = addressbook |
28 | INCLUDEPATH += $(OPIEDIR)/include | 26 | INCLUDEPATH += $(OPIEDIR)/include |
29 | DEPENDPATH+= $(OPIEDIR)/include | 27 | DEPENDPATH+= $(OPIEDIR)/include |
30 | LIBS += -lqpe -lopie | 28 | LIBS += -lqpe -lopie |
31 | 29 | ||
32 | TRANSLATIONS = ../../../i18n/de/addressbook.ts \ | 30 | TRANSLATIONS = ../../../i18n/de/addressbook.ts \ |
33 | ../../../i18n/nl/addressbook.ts \ | 31 | ../../../i18n/nl/addressbook.ts \ |
34 | ../../../i18n/da/addressbook.ts \ | 32 | ../../../i18n/da/addressbook.ts \ |
35 | ../../../i18n/xx/addressbook.ts \ | 33 | ../../../i18n/xx/addressbook.ts \ |
36 | ../../../i18n/en/addressbook.ts \ | 34 | ../../../i18n/en/addressbook.ts \ |
37 | ../../../i18n/es/addressbook.ts \ | 35 | ../../../i18n/es/addressbook.ts \ |
38 | ../../../i18n/fr/addressbook.ts \ | 36 | ../../../i18n/fr/addressbook.ts \ |
39 | ../../../i18n/hu/addressbook.ts \ | 37 | ../../../i18n/hu/addressbook.ts \ |
40 | ../../../i18n/ja/addressbook.ts \ | 38 | ../../../i18n/ja/addressbook.ts \ |
41 | ../../../i18n/ko/addressbook.ts \ | 39 | ../../../i18n/ko/addressbook.ts \ |
42 | ../../../i18n/no/addressbook.ts \ | 40 | ../../../i18n/no/addressbook.ts \ |
43 | ../../../i18n/pl/addressbook.ts \ | 41 | ../../../i18n/pl/addressbook.ts \ |
44 | ../../../i18n/pt/addressbook.ts \ | 42 | ../../../i18n/pt/addressbook.ts \ |
45 | ../../../i18n/pt_BR/addressbook.ts \ | 43 | ../../../i18n/pt_BR/addressbook.ts \ |
46 | ../../../i18n/sl/addressbook.ts \ | 44 | ../../../i18n/sl/addressbook.ts \ |
47 | ../../../i18n/zh_CN/addressbook.ts \ | 45 | ../../../i18n/zh_CN/addressbook.ts \ |
48 | ../../../i18n/it/addressbook.ts \ | 46 | ../../../i18n/it/addressbook.ts \ |
49 | ../../../i18n/zh_TW/addressbook.ts | 47 | ../../../i18n/zh_TW/addressbook.ts |
50 | 48 | ||
51 | 49 | ||
52 | 50 | ||
53 | include ( $(OPIEDIR)/include.pro ) | 51 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/addressbook/configdlg.cpp b/core/pim/addressbook/configdlg.cpp index 629feef..981f5e0 100644 --- a/core/pim/addressbook/configdlg.cpp +++ b/core/pim/addressbook/configdlg.cpp | |||
@@ -1,154 +1,154 @@ | |||
1 | #include "configdlg.h" | 1 | #include "configdlg.h" |
2 | #include "ocontactfields.h" | ||
3 | 2 | ||
4 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
5 | #include <qradiobutton.h> | 4 | #include <qradiobutton.h> |
6 | #include <qlistbox.h> | 5 | #include <qlistbox.h> |
7 | #include <qpushbutton.h> | 6 | #include <qpushbutton.h> |
8 | #include <qiconset.h> | 7 | #include <qiconset.h> |
9 | 8 | ||
10 | #include <qpe/resource.h> | 9 | #include <qpe/resource.h> |
11 | 10 | ||
12 | #include <opie/ocontact.h> | 11 | #include <opie/ocontact.h> |
12 | #include "opie/ocontactfields.h" | ||
13 | 13 | ||
14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): | 14 | ConfigDlg::ConfigDlg( QWidget *parent, const char *name): |
15 | ConfigDlg_Base(parent, name, true ) | 15 | ConfigDlg_Base(parent, name, true ) |
16 | { | 16 | { |
17 | contFields = OContactFields::trfields(); | 17 | contFields = OContactFields::trfields(); |
18 | 18 | ||
19 | // We add all Fields into the Listbox | 19 | // We add all Fields into the Listbox |
20 | for (uint i=0; i < contFields.count(); i++) { | 20 | for (uint i=0; i < contFields.count(); i++) { |
21 | allFieldListBox->insertItem( contFields[i] ); | 21 | allFieldListBox->insertItem( contFields[i] ); |
22 | } | 22 | } |
23 | 23 | ||
24 | // Reset Widget Flags: This was not changeable by designer :( | 24 | // Reset Widget Flags: This was not changeable by designer :( |
25 | setWFlags ( WStyle_ContextHelp ); | 25 | setWFlags ( WStyle_ContextHelp ); |
26 | 26 | ||
27 | // Set Pics to Buttons and Tabs | 27 | // Set Pics to Buttons and Tabs |
28 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); | 28 | m_upButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/up" ) ) ); |
29 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); | 29 | m_downButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/down" ) ) ); |
30 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); | 30 | m_addButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/add" ) ) ); |
31 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); | 31 | m_removeButton->setIconSet( QIconSet( Resource::loadPixmap( "addressbook/sub" ) ) ); |
32 | 32 | ||
33 | 33 | ||
34 | // Get the translation maps between Field ID and translated strings | 34 | // Get the translation maps between Field ID and translated strings |
35 | m_mapStrToID = OContactFields::trFieldsToId(); | 35 | m_mapStrToID = OContactFields::trFieldsToId(); |
36 | m_mapIDToStr = OContactFields::idToTrFields(); | 36 | m_mapIDToStr = OContactFields::idToTrFields(); |
37 | 37 | ||
38 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); | 38 | connect ( m_addButton, SIGNAL( clicked() ), this, SLOT( slotItemAdd() ) ); |
39 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); | 39 | connect ( m_removeButton, SIGNAL( clicked() ), this, SLOT( slotItemRemove() ) ); |
40 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); | 40 | connect ( m_upButton, SIGNAL( clicked() ), this, SLOT( slotItemUp() ) ); |
41 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); | 41 | connect ( m_downButton, SIGNAL( clicked() ), this, SLOT( slotItemDown() ) ); |
42 | } | 42 | } |
43 | 43 | ||
44 | void ConfigDlg::slotItemUp() | 44 | void ConfigDlg::slotItemUp() |
45 | { | 45 | { |
46 | qWarning( "void ConfigDlg::slotItemUp()" ); | 46 | qWarning( "void ConfigDlg::slotItemUp()" ); |
47 | 47 | ||
48 | int i = fieldListBox->currentItem(); | 48 | int i = fieldListBox->currentItem(); |
49 | if ( i > 0 ) { | 49 | if ( i > 0 ) { |
50 | QString item = fieldListBox->currentText(); | 50 | QString item = fieldListBox->currentText(); |
51 | fieldListBox->removeItem( i ); | 51 | fieldListBox->removeItem( i ); |
52 | fieldListBox->insertItem( item, i-1 ); | 52 | fieldListBox->insertItem( item, i-1 ); |
53 | fieldListBox->setCurrentItem( i-1 ); | 53 | fieldListBox->setCurrentItem( i-1 ); |
54 | } | 54 | } |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | void ConfigDlg::slotItemDown() | 58 | void ConfigDlg::slotItemDown() |
59 | { | 59 | { |
60 | qWarning( "void ConfigDlg::slotItemDown()" ); | 60 | qWarning( "void ConfigDlg::slotItemDown()" ); |
61 | 61 | ||
62 | int i = fieldListBox->currentItem(); | 62 | int i = fieldListBox->currentItem(); |
63 | if ( i < (int)fieldListBox->count() - 1 ) { | 63 | if ( i < (int)fieldListBox->count() - 1 ) { |
64 | QString item = fieldListBox->currentText(); | 64 | QString item = fieldListBox->currentText(); |
65 | fieldListBox->removeItem( i ); | 65 | fieldListBox->removeItem( i ); |
66 | fieldListBox->insertItem( item, i+1 ); | 66 | fieldListBox->insertItem( item, i+1 ); |
67 | fieldListBox->setCurrentItem( i+1 ); | 67 | fieldListBox->setCurrentItem( i+1 ); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | void ConfigDlg::slotItemAdd() | 71 | void ConfigDlg::slotItemAdd() |
72 | { | 72 | { |
73 | qWarning( "void ConfigDlg::slotItemAdd()" ); | 73 | qWarning( "void ConfigDlg::slotItemAdd()" ); |
74 | 74 | ||
75 | int i = allFieldListBox->currentItem(); | 75 | int i = allFieldListBox->currentItem(); |
76 | if ( i > 0 ) { | 76 | if ( i > 0 ) { |
77 | QString item = allFieldListBox->currentText(); | 77 | QString item = allFieldListBox->currentText(); |
78 | qWarning("ADding %s", item.latin1()); | 78 | qWarning("ADding %s", item.latin1()); |
79 | fieldListBox->insertItem( item ); | 79 | fieldListBox->insertItem( item ); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void ConfigDlg::slotItemRemove() | 83 | void ConfigDlg::slotItemRemove() |
84 | { | 84 | { |
85 | qWarning( "void ConfigDlg::slotItemRemove()" ); | 85 | qWarning( "void ConfigDlg::slotItemRemove()" ); |
86 | 86 | ||
87 | int i = fieldListBox->currentItem(); | 87 | int i = fieldListBox->currentItem(); |
88 | if ( i > 0 ) { | 88 | if ( i > 0 ) { |
89 | fieldListBox->removeItem( i ); | 89 | fieldListBox->removeItem( i ); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | void ConfigDlg::setConfig( const AbConfig& cnf ) | 93 | void ConfigDlg::setConfig( const AbConfig& cnf ) |
94 | { | 94 | { |
95 | m_config = cnf; | 95 | m_config = cnf; |
96 | 96 | ||
97 | m_useRegExp->setChecked( m_config.useRegExp() ); | 97 | m_useRegExp->setChecked( m_config.useRegExp() ); |
98 | m_useWildCard->setChecked( m_config.useWildCards() ); | 98 | m_useWildCard->setChecked( m_config.useWildCards() ); |
99 | m_useQtMail->setChecked( m_config.useQtMail() ); | 99 | m_useQtMail->setChecked( m_config.useQtMail() ); |
100 | m_useOpieMail->setChecked( m_config.useOpieMail() ); | 100 | m_useOpieMail->setChecked( m_config.useOpieMail() ); |
101 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); | 101 | m_useCaseSensitive->setChecked( m_config.beCaseSensitive() ); |
102 | 102 | ||
103 | switch( m_config.fontSize() ){ | 103 | switch( m_config.fontSize() ){ |
104 | case 0: | 104 | case 0: |
105 | m_smallFont->setChecked( true ); | 105 | m_smallFont->setChecked( true ); |
106 | m_normalFont->setChecked( false ); | 106 | m_normalFont->setChecked( false ); |
107 | m_largeFont->setChecked( false ); | 107 | m_largeFont->setChecked( false ); |
108 | break; | 108 | break; |
109 | case 1: | 109 | case 1: |
110 | m_smallFont->setChecked( false ); | 110 | m_smallFont->setChecked( false ); |
111 | m_normalFont->setChecked( true ); | 111 | m_normalFont->setChecked( true ); |
112 | m_largeFont->setChecked( false ); | 112 | m_largeFont->setChecked( false ); |
113 | break; | 113 | break; |
114 | case 2: | 114 | case 2: |
115 | m_smallFont->setChecked( false ); | 115 | m_smallFont->setChecked( false ); |
116 | m_normalFont->setChecked( false ); | 116 | m_normalFont->setChecked( false ); |
117 | m_largeFont->setChecked( true ); | 117 | m_largeFont->setChecked( true ); |
118 | break; | 118 | break; |
119 | } | 119 | } |
120 | 120 | ||
121 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { | 121 | for( uint i = 0; i < m_config.orderList().count(); i++ ) { |
122 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); | 122 | fieldListBox -> insertItem ( m_mapIDToStr[ m_config.orderList()[i] ] ); |
123 | } | 123 | } |
124 | 124 | ||
125 | m_fixedBars->setChecked( m_config.fixedBars() ); | 125 | m_fixedBars->setChecked( m_config.fixedBars() ); |
126 | m_moveBars->setChecked( !m_config.fixedBars() ); | 126 | m_moveBars->setChecked( !m_config.fixedBars() ); |
127 | } | 127 | } |
128 | 128 | ||
129 | AbConfig ConfigDlg::getConfig() | 129 | AbConfig ConfigDlg::getConfig() |
130 | { | 130 | { |
131 | m_config.setUseRegExp( m_useRegExp->isOn() ); | 131 | m_config.setUseRegExp( m_useRegExp->isOn() ); |
132 | m_config.setUseWildCards( m_useWildCard->isOn() ); | 132 | m_config.setUseWildCards( m_useWildCard->isOn() ); |
133 | m_config.setUseQtMail( m_useQtMail->isOn() ); | 133 | m_config.setUseQtMail( m_useQtMail->isOn() ); |
134 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); | 134 | m_config.setUseOpieMail( m_useOpieMail->isOn() ); |
135 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); | 135 | m_config.setBeCaseSensitive( m_useCaseSensitive->isChecked() ); |
136 | 136 | ||
137 | if ( m_smallFont->isChecked() ) | 137 | if ( m_smallFont->isChecked() ) |
138 | m_config.setFontSize( 0 ); | 138 | m_config.setFontSize( 0 ); |
139 | if ( m_normalFont->isChecked() ) | 139 | if ( m_normalFont->isChecked() ) |
140 | m_config.setFontSize( 1 ); | 140 | m_config.setFontSize( 1 ); |
141 | if ( m_largeFont->isChecked() ) | 141 | if ( m_largeFont->isChecked() ) |
142 | m_config.setFontSize( 2 ); | 142 | m_config.setFontSize( 2 ); |
143 | 143 | ||
144 | QValueList<int> orderlist; | 144 | QValueList<int> orderlist; |
145 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { | 145 | for( int i = 0; i < (int)fieldListBox->count(); i++ ) { |
146 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); | 146 | orderlist.append( m_mapStrToID[ fieldListBox->text(i) ] ); |
147 | } | 147 | } |
148 | m_config.setOrderList( orderlist ); | 148 | m_config.setOrderList( orderlist ); |
149 | 149 | ||
150 | m_config.setFixedBars( m_fixedBars->isChecked() ); | 150 | m_config.setFixedBars( m_fixedBars->isChecked() ); |
151 | 151 | ||
152 | return m_config; | 152 | return m_config; |
153 | } | 153 | } |
154 | 154 | ||
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 9d1a1c7..8fbd065 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -1,280 +1,279 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | * | 4 | * |
5 | * This file is an add-on for the OPIE Palmtop Environment | 5 | * This file is an add-on for the OPIE Palmtop Environment |
6 | * | 6 | * |
7 | * This file may be distributed and/or modified under the terms of the | 7 | * This file may be distributed and/or modified under the terms of the |
8 | * GNU General Public License version 2 as published by the Free Software | 8 | * GNU General Public License version 2 as published by the Free Software |
9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging | 9 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
10 | * of this file. | 10 | * of this file. |
11 | * | 11 | * |
12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | * | 14 | * |
15 | * | 15 | * |
16 | * This is a rewrite of the abeditor.h file, modified to provide a more | 16 | * This is a rewrite of the abeditor.h file, modified to provide a more |
17 | * intuitive interface to TrollTech's original Address Book editor. This | 17 | * intuitive interface to TrollTech's original Address Book editor. This |
18 | * is made to operate exactly in interface with the exception of name. | 18 | * is made to operate exactly in interface with the exception of name. |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "contacteditor.h" | 22 | #include "contacteditor.h" |
23 | #include "addresspicker.h" | 23 | #include "addresspicker.h" |
24 | #include "ocontactfields.h" | ||
25 | 24 | ||
26 | #include <qpe/categoryselect.h> | 25 | #include <qpe/categoryselect.h> |
27 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qpedialog.h> | 27 | #include <qpe/qpedialog.h> |
29 | #include <qpe/timeconversion.h> | 28 | #include <qpe/timeconversion.h> |
30 | #include <opie/ocontact.h> | 29 | #include <opie/ocontact.h> |
31 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
32 | 31 | ||
33 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
34 | #include <qlabel.h> | 33 | #include <qlabel.h> |
35 | #include <qtabwidget.h> | 34 | #include <qtabwidget.h> |
36 | #include <qlayout.h> | 35 | #include <qlayout.h> |
37 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
38 | #include <qmultilineedit.h> | 37 | #include <qmultilineedit.h> |
39 | #include <qscrollview.h> | 38 | #include <qscrollview.h> |
40 | #include <qtoolbutton.h> | 39 | #include <qtoolbutton.h> |
41 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
42 | #include <qmainwindow.h> | 41 | #include <qmainwindow.h> |
43 | #include <qvaluelist.h> | 42 | #include <qvaluelist.h> |
44 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
45 | #include <qlistbox.h> | 44 | #include <qlistbox.h> |
46 | #include <qhbox.h> | 45 | #include <qhbox.h> |
47 | #include <qaction.h> | 46 | #include <qaction.h> |
48 | #include <qiconset.h> | 47 | #include <qiconset.h> |
49 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
50 | #include <qwhatsthis.h> | 49 | #include <qwhatsthis.h> |
51 | 50 | ||
52 | #include <assert.h> | 51 | #include <assert.h> |
53 | 52 | ||
54 | static inline bool containsAlphaNum( const QString &str ); | 53 | static inline bool containsAlphaNum( const QString &str ); |
55 | static inline bool constainsWhiteSpace( const QString &str ); | 54 | static inline bool constainsWhiteSpace( const QString &str ); |
56 | 55 | ||
57 | // helper functions, convert our comma delimited list to proper | 56 | // helper functions, convert our comma delimited list to proper |
58 | // file format... | 57 | // file format... |
59 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 58 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
60 | QString &strAll ); | 59 | QString &strAll ); |
61 | 60 | ||
62 | // helper convert from file format to comma delimited... | 61 | // helper convert from file format to comma delimited... |
63 | void parseEmailTo( const QString &strDefaultEmail, | 62 | void parseEmailTo( const QString &strDefaultEmail, |
64 | const QString &strOtherEmail, QString &strBack ); | 63 | const QString &strOtherEmail, QString &strBack ); |
65 | 64 | ||
66 | ContactEditor::ContactEditor(const OContact &entry, | 65 | ContactEditor::ContactEditor(const OContact &entry, |
67 | QWidget *parent, | 66 | QWidget *parent, |
68 | const char *name, | 67 | const char *name, |
69 | WFlags ) | 68 | WFlags ) |
70 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), | 69 | : QDialog( parent, name, TRUE, WStyle_ContextHelp ), |
71 | defaultEmailChooserPosition( -1 ), | 70 | defaultEmailChooserPosition( -1 ), |
72 | m_personalView ( false ), | 71 | m_personalView ( false ), |
73 | cmbDefaultEmail( 0 ), | 72 | cmbDefaultEmail( 0 ), |
74 | initializing ( false ) | 73 | initializing ( false ) |
75 | { | 74 | { |
76 | 75 | ||
77 | initializing = true; | 76 | initializing = true; |
78 | 77 | ||
79 | init(); | 78 | init(); |
80 | setEntry( entry ); | 79 | setEntry( entry ); |
81 | // cmbDefaultEmail = 0; | 80 | // cmbDefaultEmail = 0; |
82 | // defaultEmailChooserPosition = -1; | 81 | // defaultEmailChooserPosition = -1; |
83 | 82 | ||
84 | initializing = false; | 83 | initializing = false; |
85 | } | 84 | } |
86 | 85 | ||
87 | ContactEditor::~ContactEditor() { | 86 | ContactEditor::~ContactEditor() { |
88 | } | 87 | } |
89 | 88 | ||
90 | void ContactEditor::init() { | 89 | void ContactEditor::init() { |
91 | qWarning("init() START"); | 90 | qWarning("init() START"); |
92 | 91 | ||
93 | uint i = 0; | 92 | uint i = 0; |
94 | 93 | ||
95 | QStringList trlChooserNames; | 94 | QStringList trlChooserNames; |
96 | 95 | ||
97 | for (i = 0; i <= 6; i++) { | 96 | for (i = 0; i <= 6; i++) { |
98 | slHomeAddress.append( "" ); | 97 | slHomeAddress.append( "" ); |
99 | slBusinessAddress.append( "" ); | 98 | slBusinessAddress.append( "" ); |
100 | } | 99 | } |
101 | 100 | ||
102 | trlChooserNames = OContactFields::trphonefields( false ); | 101 | trlChooserNames = OContactFields::trphonefields( false ); |
103 | slChooserNames = OContactFields::untrphonefields( false ); | 102 | slChooserNames = OContactFields::untrphonefields( false ); |
104 | slDynamicEntries = OContactFields::untrdetailsfields( false ); | 103 | slDynamicEntries = OContactFields::untrdetailsfields( false ); |
105 | trlDynamicEntries = OContactFields::trdetailsfields( false ); | 104 | trlDynamicEntries = OContactFields::trdetailsfields( false ); |
106 | 105 | ||
107 | // Ok, we have to remove elements from the list of dynamic entries | 106 | // Ok, we have to remove elements from the list of dynamic entries |
108 | // which are now stored in special (not dynamic) widgets.. | 107 | // which are now stored in special (not dynamic) widgets.. |
109 | // Otherwise we will get problems with field assignments! (se) | 108 | // Otherwise we will get problems with field assignments! (se) |
110 | slDynamicEntries.remove("Anniversary"); | 109 | slDynamicEntries.remove("Anniversary"); |
111 | slDynamicEntries.remove("Birthday"); | 110 | slDynamicEntries.remove("Birthday"); |
112 | slDynamicEntries.remove("Gender"); | 111 | slDynamicEntries.remove("Gender"); |
113 | 112 | ||
114 | // The same with translated fields.. But I will | 113 | // The same with translated fields.. But I will |
115 | // use the translation map to avoid mismatches.. | 114 | // use the translation map to avoid mismatches.. |
116 | QMap<int, QString> translMap = OContactFields::idToTrFields(); | 115 | QMap<int, QString> translMap = OContactFields::idToTrFields(); |
117 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); | 116 | trlDynamicEntries.remove( translMap[Qtopia::Anniversary] ); |
118 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); | 117 | trlDynamicEntries.remove( translMap[Qtopia::Birthday] ); |
119 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); | 118 | trlDynamicEntries.remove( translMap[Qtopia::Gender] ); |
120 | 119 | ||
121 | // Last Check to be sure.. | 120 | // Last Check to be sure.. |
122 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); | 121 | assert( slDynamicEntries.count() == trlDynamicEntries.count() ); |
123 | assert( slChooserNames.count() == trlChooserNames.count() ); | 122 | assert( slChooserNames.count() == trlChooserNames.count() ); |
124 | 123 | ||
125 | for (i = 0; i < slChooserNames.count(); i++) | 124 | for (i = 0; i < slChooserNames.count(); i++) |
126 | slChooserValues.append(""); | 125 | slChooserValues.append(""); |
127 | 126 | ||
128 | 127 | ||
129 | QVBoxLayout *vb = new QVBoxLayout( this ); | 128 | QVBoxLayout *vb = new QVBoxLayout( this ); |
130 | 129 | ||
131 | tabMain = new QTabWidget( this ); | 130 | tabMain = new QTabWidget( this ); |
132 | vb->addWidget( tabMain ); | 131 | vb->addWidget( tabMain ); |
133 | 132 | ||
134 | QWidget *tabViewport = new QWidget ( tabMain ); | 133 | QWidget *tabViewport = new QWidget ( tabMain ); |
135 | 134 | ||
136 | vb = new QVBoxLayout( tabViewport ); | 135 | vb = new QVBoxLayout( tabViewport ); |
137 | 136 | ||
138 | svGeneral = new QScrollView( tabViewport ); | 137 | svGeneral = new QScrollView( tabViewport ); |
139 | vb->addWidget( svGeneral, 0, 0 ); | 138 | vb->addWidget( svGeneral, 0, 0 ); |
140 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 139 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
141 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); | 140 | // svGeneral->setHScrollBarMode( QScrollView::AlwaysOff ); |
142 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); | 141 | // svGeneral->setVScrollBarMode( QScrollView::AlwaysOff ); |
143 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 142 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
144 | 143 | ||
145 | QWidget *container = new QWidget( svGeneral->viewport() ); | 144 | QWidget *container = new QWidget( svGeneral->viewport() ); |
146 | svGeneral->addChild( container ); | 145 | svGeneral->addChild( container ); |
147 | 146 | ||
148 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); | 147 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 4 ); |
149 | gl->setResizeMode( QLayout::FreeResize ); | 148 | gl->setResizeMode( QLayout::FreeResize ); |
150 | 149 | ||
151 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 150 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
152 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); | 151 | QWhatsThis::add( btnFullName, tr( "Press to enter last- middle and firstname" ) ); |
153 | gl->addWidget( btnFullName, 0, 0 ); | 152 | gl->addWidget( btnFullName, 0, 0 ); |
154 | txtFullName = new QLineEdit( container ); | 153 | txtFullName = new QLineEdit( container ); |
155 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); | 154 | QWhatsThis::add( txtFullName, tr( "Enter fullname directly ! If you have a lastname with multiple words ( for instance \"de la Guerra\"), please write <lastname>,<firstnames> like this: \"de la Guerra, Carlos Pedro\"" ) ); |
156 | gl->addWidget( txtFullName, 0, 1 ); | 155 | gl->addWidget( txtFullName, 0, 1 ); |
157 | 156 | ||
158 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 157 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
159 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); | 158 | QWhatsThis::add( l, tr( "The jobtitle.." ) ); |
160 | gl->addWidget( l, 1, 0 ); | 159 | gl->addWidget( l, 1, 0 ); |
161 | txtJobTitle = new QLineEdit( container ); | 160 | txtJobTitle = new QLineEdit( container ); |
162 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); | 161 | QWhatsThis::add( txtJobTitle, tr( "The jobtitle.." ) ); |
163 | gl->addWidget( txtJobTitle, 1, 1 ); | 162 | gl->addWidget( txtJobTitle, 1, 1 ); |
164 | 163 | ||
165 | l = new QLabel( tr("Suffix"), container ); | 164 | l = new QLabel( tr("Suffix"), container ); |
166 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); | 165 | QWhatsThis::add( l, tr( "Something like \"jr.\".." ) ); |
167 | gl->addWidget( l, 2, 0 ); | 166 | gl->addWidget( l, 2, 0 ); |
168 | txtSuffix = new QLineEdit( container ); | 167 | txtSuffix = new QLineEdit( container ); |
169 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); | 168 | QWhatsThis::add( txtSuffix, tr( "Something like \"jr.\".." ) ); |
170 | gl->addWidget( txtSuffix, 2, 1 ); | 169 | gl->addWidget( txtSuffix, 2, 1 ); |
171 | 170 | ||
172 | l = new QLabel( tr( "Organization" ), container ); | 171 | l = new QLabel( tr( "Organization" ), container ); |
173 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); | 172 | QWhatsThis::add( l, tr( "The working place of the contact" ) ); |
174 | gl->addWidget( l, 3, 0 ); | 173 | gl->addWidget( l, 3, 0 ); |
175 | txtOrganization = new QLineEdit( container ); | 174 | txtOrganization = new QLineEdit( container ); |
176 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); | 175 | QWhatsThis::add( txtOrganization, tr( "The working place of the contact" ) ); |
177 | gl->addWidget( txtOrganization, 3, 1 ); | 176 | gl->addWidget( txtOrganization, 3, 1 ); |
178 | 177 | ||
179 | // Chooser 1 | 178 | // Chooser 1 |
180 | cmbChooserField1 = new QComboBox( FALSE, container ); | 179 | cmbChooserField1 = new QComboBox( FALSE, container ); |
181 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); | 180 | QWhatsThis::add( cmbChooserField1, tr( "Press to select attribute to change" ) ); |
182 | cmbChooserField1->setMaximumWidth( 90 ); | 181 | cmbChooserField1->setMaximumWidth( 90 ); |
183 | gl->addWidget( cmbChooserField1, 4, 0 ); | 182 | gl->addWidget( cmbChooserField1, 4, 0 ); |
184 | // Textfield for chooser 1. | 183 | // Textfield for chooser 1. |
185 | // Now use Widgetstack to contain the textfield and the default-email combo ! | 184 | // Now use Widgetstack to contain the textfield and the default-email combo ! |
186 | m_widgetStack1 = new QWidgetStack( container ); | 185 | m_widgetStack1 = new QWidgetStack( container ); |
187 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); | 186 | txtChooserField1 = new QLineEdit( m_widgetStack1 ); |
188 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); | 187 | m_widgetStack1 -> addWidget( txtChooserField1, TextField ); |
189 | gl->addWidget( m_widgetStack1, 4, 1 ); | 188 | gl->addWidget( m_widgetStack1, 4, 1 ); |
190 | m_widgetStack1 -> raiseWidget( TextField ); | 189 | m_widgetStack1 -> raiseWidget( TextField ); |
191 | 190 | ||
192 | // Chooser 2 | 191 | // Chooser 2 |
193 | cmbChooserField2 = new QComboBox( FALSE, container ); | 192 | cmbChooserField2 = new QComboBox( FALSE, container ); |
194 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); | 193 | QWhatsThis::add( cmbChooserField2, tr( "Press to select attribute to change" ) ); |
195 | cmbChooserField2->setMaximumWidth( 90 ); | 194 | cmbChooserField2->setMaximumWidth( 90 ); |
196 | gl->addWidget( cmbChooserField2, 5, 0 ); | 195 | gl->addWidget( cmbChooserField2, 5, 0 ); |
197 | // Textfield for chooser 2 | 196 | // Textfield for chooser 2 |
198 | // Now use WidgetStack to contain the textfield and the default-email combo! | 197 | // Now use WidgetStack to contain the textfield and the default-email combo! |
199 | m_widgetStack2 = new QWidgetStack( container ); | 198 | m_widgetStack2 = new QWidgetStack( container ); |
200 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); | 199 | txtChooserField2 = new QLineEdit( m_widgetStack2 ); |
201 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); | 200 | m_widgetStack2 -> addWidget( txtChooserField2, TextField ); |
202 | gl->addWidget( m_widgetStack2, 5, 1 ); | 201 | gl->addWidget( m_widgetStack2, 5, 1 ); |
203 | m_widgetStack2 -> raiseWidget( TextField ); | 202 | m_widgetStack2 -> raiseWidget( TextField ); |
204 | 203 | ||
205 | // Chooser 3 | 204 | // Chooser 3 |
206 | cmbChooserField3 = new QComboBox( FALSE, container ); | 205 | cmbChooserField3 = new QComboBox( FALSE, container ); |
207 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); | 206 | QWhatsThis::add( cmbChooserField3, tr( "Press to select attribute to change" ) ); |
208 | cmbChooserField3->setMaximumWidth( 90 ); | 207 | cmbChooserField3->setMaximumWidth( 90 ); |
209 | gl->addWidget( cmbChooserField3, 6, 0 ); | 208 | gl->addWidget( cmbChooserField3, 6, 0 ); |
210 | // Textfield for chooser 2 | 209 | // Textfield for chooser 2 |
211 | // Now use WidgetStack to contain the textfield and the default-email combo! | 210 | // Now use WidgetStack to contain the textfield and the default-email combo! |
212 | m_widgetStack3 = new QWidgetStack( container ); | 211 | m_widgetStack3 = new QWidgetStack( container ); |
213 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); | 212 | txtChooserField3 = new QLineEdit( m_widgetStack3 ); |
214 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); | 213 | m_widgetStack3 -> addWidget( txtChooserField3, TextField ); |
215 | gl->addWidget( m_widgetStack3, 6, 1 ); | 214 | gl->addWidget( m_widgetStack3, 6, 1 ); |
216 | m_widgetStack3 -> raiseWidget( TextField ); | 215 | m_widgetStack3 -> raiseWidget( TextField ); |
217 | 216 | ||
218 | l = new QLabel( tr( "File As" ), container ); | 217 | l = new QLabel( tr( "File As" ), container ); |
219 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); | 218 | QWhatsThis::add( l, tr( "Press to select how to store the name (and howto show it in the listview)" ) ); |
220 | gl->addWidget( l, 7, 0 ); | 219 | gl->addWidget( l, 7, 0 ); |
221 | cmbFileAs = new QComboBox( TRUE, container ); | 220 | cmbFileAs = new QComboBox( TRUE, container ); |
222 | gl->addWidget( cmbFileAs, 7, 1 ); | 221 | gl->addWidget( cmbFileAs, 7, 1 ); |
223 | 222 | ||
224 | labCat = new QLabel( tr( "Category" ), container ); | 223 | labCat = new QLabel( tr( "Category" ), container ); |
225 | gl->addWidget( labCat, 8, 0 ); | 224 | gl->addWidget( labCat, 8, 0 ); |
226 | cmbCat = new CategorySelect( container ); | 225 | cmbCat = new CategorySelect( container ); |
227 | gl->addWidget( cmbCat, 8, 1 ); | 226 | gl->addWidget( cmbCat, 8, 1 ); |
228 | labCat->show(); | 227 | labCat->show(); |
229 | cmbCat->show(); | 228 | cmbCat->show(); |
230 | 229 | ||
231 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 230 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
232 | gl->addWidget( btnNote, 9, 1 ); | 231 | gl->addWidget( btnNote, 9, 1 ); |
233 | 232 | ||
234 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 233 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
235 | 234 | ||
236 | tabViewport = new QWidget ( tabMain ); | 235 | tabViewport = new QWidget ( tabMain ); |
237 | 236 | ||
238 | vb = new QVBoxLayout( tabViewport ); | 237 | vb = new QVBoxLayout( tabViewport ); |
239 | 238 | ||
240 | svAddress = new QScrollView( tabViewport ); | 239 | svAddress = new QScrollView( tabViewport ); |
241 | vb->addWidget( svAddress, 0, 0 ); | 240 | vb->addWidget( svAddress, 0, 0 ); |
242 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 241 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
243 | svAddress->setFrameStyle( QFrame::NoFrame ); | 242 | svAddress->setFrameStyle( QFrame::NoFrame ); |
244 | 243 | ||
245 | container = new QWidget( svAddress->viewport() ); | 244 | container = new QWidget( svAddress->viewport() ); |
246 | svAddress->addChild( container ); | 245 | svAddress->addChild( container ); |
247 | 246 | ||
248 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem | 247 | gl = new QGridLayout( container, 8, 3, 2, 4 ); // row 7 QSpacerItem |
249 | 248 | ||
250 | cmbAddress = new QComboBox( FALSE, container ); | 249 | cmbAddress = new QComboBox( FALSE, container ); |
251 | cmbAddress->insertItem( tr( "Business" ) ); | 250 | cmbAddress->insertItem( tr( "Business" ) ); |
252 | cmbAddress->insertItem( tr( "Home" ) ); | 251 | cmbAddress->insertItem( tr( "Home" ) ); |
253 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 252 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
254 | 253 | ||
255 | l = new QLabel( tr( "Address" ), container ); | 254 | l = new QLabel( tr( "Address" ), container ); |
256 | gl->addWidget( l, 1, 0 ); | 255 | gl->addWidget( l, 1, 0 ); |
257 | txtAddress = new QLineEdit( container ); | 256 | txtAddress = new QLineEdit( container ); |
258 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 257 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
259 | 258 | ||
260 | l = new QLabel( tr( "City" ), container ); | 259 | l = new QLabel( tr( "City" ), container ); |
261 | gl->addWidget( l, 2, 0 ); | 260 | gl->addWidget( l, 2, 0 ); |
262 | txtCity = new QLineEdit( container ); | 261 | txtCity = new QLineEdit( container ); |
263 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 262 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
264 | 263 | ||
265 | l = new QLabel( tr( "State" ), container ); | 264 | l = new QLabel( tr( "State" ), container ); |
266 | gl->addWidget( l, 3, 0 ); | 265 | gl->addWidget( l, 3, 0 ); |
267 | txtState = new QLineEdit( container ); | 266 | txtState = new QLineEdit( container ); |
268 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 267 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
269 | 268 | ||
270 | l = new QLabel( tr( "Zip Code" ), container ); | 269 | l = new QLabel( tr( "Zip Code" ), container ); |
271 | gl->addWidget( l, 4, 0 ); | 270 | gl->addWidget( l, 4, 0 ); |
272 | txtZip = new QLineEdit( container ); | 271 | txtZip = new QLineEdit( container ); |
273 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 272 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
274 | 273 | ||
275 | l = new QLabel( tr( "Country" ), container ); | 274 | l = new QLabel( tr( "Country" ), container ); |
276 | gl->addWidget( l, 5, 0 ); | 275 | gl->addWidget( l, 5, 0 ); |
277 | cmbCountry = new QComboBox( TRUE, container ); | 276 | cmbCountry = new QComboBox( TRUE, container ); |
278 | cmbCountry->insertItem( tr( "" ) ); | 277 | cmbCountry->insertItem( tr( "" ) ); |
279 | cmbCountry->insertItem( tr ( "United States" ) ); | 278 | cmbCountry->insertItem( tr ( "United States" ) ); |
280 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); | 279 | cmbCountry->insertItem( tr ( "United Kingdom" ) ); |
diff --git a/core/pim/addressbook/contacteditor.h b/core/pim/addressbook/contacteditor.h index e7432ee..72d14a9 100644 --- a/core/pim/addressbook/contacteditor.h +++ b/core/pim/addressbook/contacteditor.h | |||
@@ -1,192 +1,191 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> | 2 | * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> |
3 | * | 3 | * |
4 | * This file is an add-on for the OPIE Palmtop Environment | 4 | * This file is an add-on for the OPIE 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 pacakaging | 8 | * Foundation and appearing in the file LICENSE.GPL included in the pacakaging |
9 | * of this file. | 9 | * 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 | * This is a rewrite of the abeditor.h file, modified to provide a more | 15 | * This is a rewrite of the abeditor.h file, modified to provide a more |
16 | * intuitive interface to TrollTech's original Address Book editor. This | 16 | * intuitive interface to TrollTech's original Address Book editor. This |
17 | * is made to operate exactly in interface with the exception of name. | 17 | * is made to operate exactly in interface with the exception of name. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef CONTACTEDITOR_H | 21 | #ifndef CONTACTEDITOR_H |
22 | #define CONTACTEDITOR_H | 22 | #define CONTACTEDITOR_H |
23 | 23 | ||
24 | #include <opie/ocontact.h> | 24 | #include <opie/ocontact.h> |
25 | #include <opie/ocontactfields.h> | ||
25 | 26 | ||
26 | #include <qpe/datebookmonth.h> | 27 | #include <qpe/datebookmonth.h> |
27 | 28 | ||
28 | #include <qdialog.h> | 29 | #include <qdialog.h> |
29 | #include <qlist.h> | 30 | #include <qlist.h> |
30 | #include <qmap.h> | 31 | #include <qmap.h> |
31 | #include <qstringlist.h> | 32 | #include <qstringlist.h> |
32 | #include <qwidgetstack.h> | 33 | #include <qwidgetstack.h> |
33 | 34 | ||
34 | #include "ocontactfields.h" | ||
35 | |||
36 | const int NAME_LF = 0; | 35 | const int NAME_LF = 0; |
37 | const int NAME_LFM = 1; | 36 | const int NAME_LFM = 1; |
38 | const int NAME_FL = 2; | 37 | const int NAME_FL = 2; |
39 | const int NAME_FML = 3; | 38 | const int NAME_FML = 3; |
40 | 39 | ||
41 | const int NAME_F = 4; | 40 | const int NAME_F = 4; |
42 | const int NAME_M = 5; | 41 | const int NAME_M = 5; |
43 | const int NAME_L = 6; | 42 | const int NAME_L = 6; |
44 | const int NAME_S = 7; | 43 | const int NAME_S = 7; |
45 | 44 | ||
46 | 45 | ||
47 | class QScrollView; | 46 | class QScrollView; |
48 | class QTabWidget; | 47 | class QTabWidget; |
49 | class QMultiLineEdit; | 48 | class QMultiLineEdit; |
50 | class QLineEdit; | 49 | class QLineEdit; |
51 | class QComboBox; | 50 | class QComboBox; |
52 | class QPushButton; | 51 | class QPushButton; |
53 | class CategorySelect; | 52 | class CategorySelect; |
54 | class QLabel; | 53 | class QLabel; |
55 | 54 | ||
56 | class ContactEditor : public QDialog { | 55 | class ContactEditor : public QDialog { |
57 | Q_OBJECT | 56 | Q_OBJECT |
58 | 57 | ||
59 | public: | 58 | public: |
60 | ContactEditor(const OContact &entry, | 59 | ContactEditor(const OContact &entry, |
61 | QWidget *parent = 0, | 60 | QWidget *parent = 0, |
62 | const char *name = 0, | 61 | const char *name = 0, |
63 | WFlags fl = 0 ); | 62 | WFlags fl = 0 ); |
64 | ~ContactEditor(); | 63 | ~ContactEditor(); |
65 | void setNameFocus(); | 64 | void setNameFocus(); |
66 | void setPersonalView( bool personal = true ); | 65 | void setPersonalView( bool personal = true ); |
67 | OContact entry() const { return ent; } | 66 | OContact entry() const { return ent; } |
68 | 67 | ||
69 | public slots: | 68 | public slots: |
70 | void slotNote(); | 69 | void slotNote(); |
71 | void slotName(); | 70 | void slotName(); |
72 | void setEntry(const OContact &entry); | 71 | void setEntry(const OContact &entry); |
73 | 72 | ||
74 | protected slots: | 73 | protected slots: |
75 | void accept(); | 74 | void accept(); |
76 | 75 | ||
77 | private: | 76 | private: |
78 | void init(); | 77 | void init(); |
79 | void saveEntry(); | 78 | void saveEntry(); |
80 | bool isEmpty(); | 79 | bool isEmpty(); |
81 | void cleanupFields(); | 80 | void cleanupFields(); |
82 | void updateDatePicker(); | 81 | void updateDatePicker(); |
83 | QString parseName( QString fullName, int type ); | 82 | QString parseName( QString fullName, int type ); |
84 | void chooserError( int index ); | 83 | void chooserError( int index ); |
85 | private slots: | 84 | private slots: |
86 | void slotChooser1Change( const QString &textChanged ); | 85 | void slotChooser1Change( const QString &textChanged ); |
87 | void slotChooser2Change( const QString &textChanged ); | 86 | void slotChooser2Change( const QString &textChanged ); |
88 | void slotChooser3Change( const QString &textChanged ); | 87 | void slotChooser3Change( const QString &textChanged ); |
89 | void slotChooser4Change( const QString &textChanged ); | 88 | void slotChooser4Change( const QString &textChanged ); |
90 | void slotCmbChooser1Change( int index ); | 89 | void slotCmbChooser1Change( int index ); |
91 | void slotCmbChooser2Change( int index ); | 90 | void slotCmbChooser2Change( int index ); |
92 | void slotCmbChooser3Change( int index ); | 91 | void slotCmbChooser3Change( int index ); |
93 | void slotCmbChooser4Change( int index ); | 92 | void slotCmbChooser4Change( int index ); |
94 | void slotAddressTypeChange( int index ); | 93 | void slotAddressTypeChange( int index ); |
95 | void slotAddressChange( const QString &textChanged ); | 94 | void slotAddressChange( const QString &textChanged ); |
96 | void slotAddress2Change( const QString &textChanged ); | 95 | void slotAddress2Change( const QString &textChanged ); |
97 | void slotPOBoxChange( const QString &textChanged ); | 96 | void slotPOBoxChange( const QString &textChanged ); |
98 | void slotCityChange( const QString &textChanged ); | 97 | void slotCityChange( const QString &textChanged ); |
99 | void slotStateChange( const QString &textChanged ); | 98 | void slotStateChange( const QString &textChanged ); |
100 | void slotZipChange( const QString &textChanged ); | 99 | void slotZipChange( const QString &textChanged ); |
101 | void slotCountryChange( const QString &textChanged ); | 100 | void slotCountryChange( const QString &textChanged ); |
102 | void slotFullNameChange( const QString &textChanged ); | 101 | void slotFullNameChange( const QString &textChanged ); |
103 | void slotSuffixChange( const QString &textChanged ); | 102 | void slotSuffixChange( const QString &textChanged ); |
104 | void slotOrganizationChange( const QString &textChanged ); | 103 | void slotOrganizationChange( const QString &textChanged ); |
105 | void slotAnniversaryDateChanged( int year, int month, int day); | 104 | void slotAnniversaryDateChanged( int year, int month, int day); |
106 | void slotBirthdayDateChanged( int year, int month, int day); | 105 | void slotBirthdayDateChanged( int year, int month, int day); |
107 | void slotRemoveBirthday(); | 106 | void slotRemoveBirthday(); |
108 | void slotRemoveAnniversary(); | 107 | void slotRemoveAnniversary(); |
109 | void defaultEmailChanged(int); | 108 | void defaultEmailChanged(int); |
110 | 109 | ||
111 | private: | 110 | private: |
112 | enum StackWidgets { TextField = 1, Combo }; | 111 | enum StackWidgets { TextField = 1, Combo }; |
113 | int defaultEmailChooserPosition; | 112 | int defaultEmailChooserPosition; |
114 | void populateDefaultEmailCmb(); | 113 | void populateDefaultEmailCmb(); |
115 | void chooserChange( const QString&, int , QLineEdit*, int ); | 114 | void chooserChange( const QString&, int , QLineEdit*, int ); |
116 | bool cmbChooserChange( int , QWidgetStack*, int ); | 115 | bool cmbChooserChange( int , QWidgetStack*, int ); |
117 | OContactFields contactfields; | 116 | OContactFields contactfields; |
118 | 117 | ||
119 | OContact ent; | 118 | OContact ent; |
120 | 119 | ||
121 | QDialog *dlgNote; | 120 | QDialog *dlgNote; |
122 | QDialog *dlgName; | 121 | QDialog *dlgName; |
123 | 122 | ||
124 | QList<QLineEdit> listValue; | 123 | QList<QLineEdit> listValue; |
125 | QList<QLabel> listName; | 124 | QList<QLabel> listName; |
126 | 125 | ||
127 | QStringList slDynamicEntries; | 126 | QStringList slDynamicEntries; |
128 | QStringList trlDynamicEntries; | 127 | QStringList trlDynamicEntries; |
129 | 128 | ||
130 | bool m_personalView; | 129 | bool m_personalView; |
131 | 130 | ||
132 | QStringList slHomeAddress; | 131 | QStringList slHomeAddress; |
133 | QStringList slBusinessAddress; | 132 | QStringList slBusinessAddress; |
134 | QStringList slChooserNames; | 133 | QStringList slChooserNames; |
135 | QStringList slChooserValues; | 134 | QStringList slChooserValues; |
136 | QStringList emails; | 135 | QStringList emails; |
137 | QString defaultEmail; | 136 | QString defaultEmail; |
138 | 137 | ||
139 | QMultiLineEdit *txtNote; | 138 | QMultiLineEdit *txtNote; |
140 | QLabel *lblNote; | 139 | QLabel *lblNote; |
141 | 140 | ||
142 | //QLineEdit *txtTitle; | 141 | //QLineEdit *txtTitle; |
143 | QLineEdit *txtFirstName; | 142 | QLineEdit *txtFirstName; |
144 | QLineEdit *txtMiddleName; | 143 | QLineEdit *txtMiddleName; |
145 | QLineEdit *txtLastName; | 144 | QLineEdit *txtLastName; |
146 | QLineEdit *txtSuffix; | 145 | QLineEdit *txtSuffix; |
147 | 146 | ||
148 | QTabWidget *tabMain; | 147 | QTabWidget *tabMain; |
149 | QScrollView *svGeneral; | 148 | QScrollView *svGeneral; |
150 | QPushButton *btnFullName; | 149 | QPushButton *btnFullName; |
151 | QPushButton *btnNote; | 150 | QPushButton *btnNote; |
152 | QLineEdit *txtFullName; | 151 | QLineEdit *txtFullName; |
153 | QLineEdit *txtJobTitle; | 152 | QLineEdit *txtJobTitle; |
154 | QLineEdit *txtOrganization; | 153 | QLineEdit *txtOrganization; |
155 | QLineEdit *txtChooserField1; | 154 | QLineEdit *txtChooserField1; |
156 | QLineEdit *txtChooserField2; | 155 | QLineEdit *txtChooserField2; |
157 | QLineEdit *txtChooserField3; | 156 | QLineEdit *txtChooserField3; |
158 | QLineEdit *txtChooserField4; | 157 | QLineEdit *txtChooserField4; |
159 | QWidgetStack* m_widgetStack1; | 158 | QWidgetStack* m_widgetStack1; |
160 | QWidgetStack* m_widgetStack2; | 159 | QWidgetStack* m_widgetStack2; |
161 | QWidgetStack* m_widgetStack3; | 160 | QWidgetStack* m_widgetStack3; |
162 | QWidgetStack* m_widgetStack4; | 161 | QWidgetStack* m_widgetStack4; |
163 | QComboBox *cmbChooserField1; | 162 | QComboBox *cmbChooserField1; |
164 | QComboBox *cmbChooserField2; | 163 | QComboBox *cmbChooserField2; |
165 | QComboBox *cmbChooserField3; | 164 | QComboBox *cmbChooserField3; |
166 | QComboBox *cmbChooserField4; | 165 | QComboBox *cmbChooserField4; |
167 | QComboBox *cmbDefaultEmail; | 166 | QComboBox *cmbDefaultEmail; |
168 | QComboBox *cmbFileAs; | 167 | QComboBox *cmbFileAs; |
169 | CategorySelect *cmbCat; | 168 | CategorySelect *cmbCat; |
170 | QLabel *labCat; | 169 | QLabel *labCat; |
171 | 170 | ||
172 | QScrollView *svAddress; | 171 | QScrollView *svAddress; |
173 | QLineEdit *txtAddress; | 172 | QLineEdit *txtAddress; |
174 | //QLineEdit *txtAddress2; | 173 | //QLineEdit *txtAddress2; |
175 | //QLineEdit *txtPOBox; | 174 | //QLineEdit *txtPOBox; |
176 | QLineEdit *txtCity; | 175 | QLineEdit *txtCity; |
177 | QLineEdit *txtState; | 176 | QLineEdit *txtState; |
178 | QLineEdit *txtZip; | 177 | QLineEdit *txtZip; |
179 | QComboBox *cmbAddress; | 178 | QComboBox *cmbAddress; |
180 | QComboBox *cmbCountry; | 179 | QComboBox *cmbCountry; |
181 | 180 | ||
182 | QScrollView *svDetails; | 181 | QScrollView *svDetails; |
183 | QComboBox *cmbGender; | 182 | QComboBox *cmbGender; |
184 | DateBookMonth* birthdayPicker; | 183 | DateBookMonth* birthdayPicker; |
185 | QToolButton* birthdayButton; | 184 | QToolButton* birthdayButton; |
186 | DateBookMonth* anniversaryPicker; | 185 | DateBookMonth* anniversaryPicker; |
187 | QToolButton* anniversaryButton; | 186 | QToolButton* anniversaryButton; |
188 | 187 | ||
189 | bool initializing; | 188 | bool initializing; |
190 | }; | 189 | }; |
191 | 190 | ||
192 | #endif | 191 | #endif |