-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 | |||
@@ -390,194 +390,194 @@ void AbTable::moveTo( char c ) | |||
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 | ||
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,152 +1,153 @@ | |||
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 | { |
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,108 +1,108 @@ | |||
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; |
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,120 +1,119 @@ | |||
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 | ||
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,131 +1,130 @@ | |||
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 | ||