author | zecke <zecke> | 2002-09-10 13:15:52 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 13:15:52 (UTC) |
commit | 4fe9ebf0faabcfdcdc0104309da59de043d9785a (patch) (unidiff) | |
tree | 0cdf6b1f45df2e014c1cceb4f943779861cc2767 | |
parent | 8db6dc7be6e274fe1ce762b15801052bce7bcf26 (diff) | |
download | opie-4fe9ebf0faabcfdcdc0104309da59de043d9785a.zip opie-4fe9ebf0faabcfdcdc0104309da59de043d9785a.tar.gz opie-4fe9ebf0faabcfdcdc0104309da59de043d9785a.tar.bz2 |
COmpile fixes
-rw-r--r-- | core/pim/addressbook/addressbook.cpp | 2 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 12 | ||||
-rw-r--r-- | core/pim/todo/todotable.h | 11 |
3 files changed, 14 insertions, 11 deletions
diff --git a/core/pim/addressbook/addressbook.cpp b/core/pim/addressbook/addressbook.cpp index e11cf4c..3255269 100644 --- a/core/pim/addressbook/addressbook.cpp +++ b/core/pim/addressbook/addressbook.cpp | |||
@@ -468,129 +468,129 @@ void AddressbookWindow::slotBeam() | |||
468 | mkdir("/tmp/obex/", 0755); | 468 | mkdir("/tmp/obex/", 0755); |
469 | Contact::writeVCard( beamfile, c ); | 469 | Contact::writeVCard( beamfile, c ); |
470 | filename = beamfile; | 470 | filename = beamfile; |
471 | } | 471 | } |
472 | Ir *ir = new Ir( this ); | 472 | Ir *ir = new Ir( this ); |
473 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 473 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
474 | QString description = c.fullName(); | 474 | QString description = c.fullName(); |
475 | ir->send( filename, description, "text/x-vCard" ); | 475 | ir->send( filename, description, "text/x-vCard" ); |
476 | } | 476 | } |
477 | 477 | ||
478 | void AddressbookWindow::beamDone( Ir *ir ) | 478 | void AddressbookWindow::beamDone( Ir *ir ) |
479 | { | 479 | { |
480 | delete ir; | 480 | delete ir; |
481 | unlink( beamfile ); | 481 | unlink( beamfile ); |
482 | } | 482 | } |
483 | 483 | ||
484 | 484 | ||
485 | static void parseName( const QString& name, QString *first, QString *middle, | 485 | static void parseName( const QString& name, QString *first, QString *middle, |
486 | QString * last ) | 486 | QString * last ) |
487 | { | 487 | { |
488 | 488 | ||
489 | int comma = name.find ( "," ); | 489 | int comma = name.find ( "," ); |
490 | QString rest; | 490 | QString rest; |
491 | if ( comma > 0 ) { | 491 | if ( comma > 0 ) { |
492 | *last = name.left( comma ); | 492 | *last = name.left( comma ); |
493 | comma++; | 493 | comma++; |
494 | while ( comma < int(name.length()) && name[comma] == ' ' ) | 494 | while ( comma < int(name.length()) && name[comma] == ' ' ) |
495 | comma++; | 495 | comma++; |
496 | rest = name.mid( comma ); | 496 | rest = name.mid( comma ); |
497 | } else { | 497 | } else { |
498 | int space = name.findRev( ' ' ); | 498 | int space = name.findRev( ' ' ); |
499 | *last = name.mid( space+1 ); | 499 | *last = name.mid( space+1 ); |
500 | rest = name.left( space ); | 500 | rest = name.left( space ); |
501 | } | 501 | } |
502 | int space = rest.find( ' ' ); | 502 | int space = rest.find( ' ' ); |
503 | if ( space <= 0 ) { | 503 | if ( space <= 0 ) { |
504 | *first = rest; | 504 | *first = rest; |
505 | } else { | 505 | } else { |
506 | *first = rest.left( space ); | 506 | *first = rest.left( space ); |
507 | *middle = rest.mid( space+1 ); | 507 | *middle = rest.mid( space+1 ); |
508 | } | 508 | } |
509 | 509 | ||
510 | } | 510 | } |
511 | 511 | ||
512 | 512 | ||
513 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) | 513 | void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) |
514 | { | 514 | { |
515 | if (msg == "editPersonal()") { | 515 | if (msg == "editPersonal()") { |
516 | editPersonal(); | 516 | editPersonal(); |
517 | } else if (msg == "editPersonalAndClose()") { | 517 | } else if (msg == "editPersonalAndClose()") { |
518 | editPersonal(); | 518 | editPersonal(); |
519 | close(); | 519 | close(); |
520 | } else if ( msg == "addContact(QString,QString)" ) { | 520 | } else if ( msg == "addContact(QString,QString)" ) { |
521 | QDataStream stream(data,IO_ReadOnly); | 521 | QDataStream stream(data,IO_ReadOnly); |
522 | QString name, email; | 522 | QString name, email; |
523 | stream >> name >> email; | 523 | stream >> name >> email; |
524 | 524 | ||
525 | Contact cnt; | 525 | Contact cnt; |
526 | QString fn, mn, ln; | 526 | QString fn, mn, ln; |
527 | parseName( name, &fn, &mn, &ln ); | 527 | parseName( name, &fn, &mn, &ln ); |
528 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); | 528 | // qDebug( " %s - %s - %s", fn.latin1(), mn.latin1(), ln.latin1() ); |
529 | cnt.setFirstName( fn ); | 529 | cnt.setFirstName( fn ); |
530 | cnt.setMiddleName( mn ); | 530 | cnt.setMiddleName( mn ); |
531 | cnt.setLastName( ln ); | 531 | cnt.setLastName( ln ); |
532 | cnt.setEmails( email ); | 532 | cnt.insertEmails( email ); |
533 | cnt.setDefaultEmail( email ); | 533 | cnt.setDefaultEmail( email ); |
534 | cnt.setFileAs(); | 534 | cnt.setFileAs(); |
535 | 535 | ||
536 | if ( bAbEditFirstTime ) { | 536 | if ( bAbEditFirstTime ) { |
537 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, | 537 | abEditor = new ContactEditor( cnt, &orderedFields, &slOrderedFields, |
538 | this, "editor" ); | 538 | this, "editor" ); |
539 | bAbEditFirstTime = FALSE; | 539 | bAbEditFirstTime = FALSE; |
540 | } else { | 540 | } else { |
541 | abEditor->setEntry( cnt ); | 541 | abEditor->setEntry( cnt ); |
542 | } | 542 | } |
543 | abView()->init( cnt ); | 543 | abView()->init( cnt ); |
544 | editEntry( NewEntry ); | 544 | editEntry( NewEntry ); |
545 | 545 | ||
546 | 546 | ||
547 | 547 | ||
548 | } | 548 | } |
549 | #if 0 | 549 | #if 0 |
550 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { | 550 | else if (msg == "pickAddresses(QCString,QCString,QStringList,...)" ) { |
551 | QDataStream stream(data,IO_ReadOnly); | 551 | QDataStream stream(data,IO_ReadOnly); |
552 | QCString ch,m; | 552 | QCString ch,m; |
553 | QStringList types; | 553 | QStringList types; |
554 | stream >> ch >> m >> types; | 554 | stream >> ch >> m >> types; |
555 | AddressPicker picker(abList,this,0,TRUE); | 555 | AddressPicker picker(abList,this,0,TRUE); |
556 | picker.showMaximized(); | 556 | picker.showMaximized(); |
557 | picker.setChoiceNames(types); | 557 | picker.setChoiceNames(types); |
558 | int i=0; | 558 | int i=0; |
559 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 559 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
560 | QStringList sel; | 560 | QStringList sel; |
561 | stream >> sel; | 561 | stream >> sel; |
562 | picker.setSelection(i++,sel); | 562 | picker.setSelection(i++,sel); |
563 | } | 563 | } |
564 | picker.showMaximized(); | 564 | picker.showMaximized(); |
565 | picker.exec(); | 565 | picker.exec(); |
566 | 566 | ||
567 | // ###### note: contacts may have been added - save here! | 567 | // ###### note: contacts may have been added - save here! |
568 | 568 | ||
569 | setCentralWidget(abList); | 569 | setCentralWidget(abList); |
570 | QCopEnvelope e(ch,m); | 570 | QCopEnvelope e(ch,m); |
571 | i=0; | 571 | i=0; |
572 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { | 572 | for (QStringList::ConstIterator it = types.begin(); it!=types.end(); ++it) { |
573 | QStringList sel = picker.selection(i++); | 573 | QStringList sel = picker.selection(i++); |
574 | e << sel; | 574 | e << sel; |
575 | } | 575 | } |
576 | } | 576 | } |
577 | #endif | 577 | #endif |
578 | 578 | ||
579 | } | 579 | } |
580 | 580 | ||
581 | void AddressbookWindow::editPersonal() | 581 | void AddressbookWindow::editPersonal() |
582 | { | 582 | { |
583 | QString filename = addressbookPersonalVCardName(); | 583 | QString filename = addressbookPersonalVCardName(); |
584 | Contact me; | 584 | Contact me; |
585 | if (QFile::exists(filename)) | 585 | if (QFile::exists(filename)) |
586 | me = Contact::readVCard( filename )[0]; | 586 | me = Contact::readVCard( filename )[0]; |
587 | if (bAbEditFirstTime) { | 587 | if (bAbEditFirstTime) { |
588 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, | 588 | abEditor = new ContactEditor( me, &orderedFields, &slOrderedFields, |
589 | this, "editor" ); | 589 | this, "editor" ); |
590 | // don't create a new editor every time | 590 | // don't create a new editor every time |
591 | bAbEditFirstTime = FALSE; | 591 | bAbEditFirstTime = FALSE; |
592 | } else | 592 | } else |
593 | abEditor->setEntry( me ); | 593 | abEditor->setEntry( me ); |
594 | 594 | ||
595 | abEditor->setCaption(tr("Edit My Personal Details")); | 595 | abEditor->setCaption(tr("Edit My Personal Details")); |
596 | abEditor->showMaximized(); | 596 | abEditor->showMaximized(); |
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 39bd63c..ae86ed0 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -50,288 +50,288 @@ void parseEmailTo( const QString &strDefaultEmail, | |||
50 | const QString &strOtherEmail, QString &strBack ); | 50 | const QString &strOtherEmail, QString &strBack ); |
51 | 51 | ||
52 | ContactEditor::ContactEditor(const Contact &entry, | 52 | ContactEditor::ContactEditor(const Contact &entry, |
53 | const QValueList<int> *newOrderedValues, | 53 | const QValueList<int> *newOrderedValues, |
54 | QStringList *slNewOrdered, | 54 | QStringList *slNewOrdered, |
55 | QWidget *parent, | 55 | QWidget *parent, |
56 | const char *name, | 56 | const char *name, |
57 | WFlags fl ) | 57 | WFlags fl ) |
58 | : QDialog( parent, name, TRUE, fl ), | 58 | : QDialog( parent, name, TRUE, fl ), |
59 | orderedValues( newOrderedValues ), | 59 | orderedValues( newOrderedValues ), |
60 | slOrdered( *slNewOrdered ) | 60 | slOrdered( *slNewOrdered ) |
61 | { | 61 | { |
62 | 62 | ||
63 | init(); | 63 | init(); |
64 | initMap(); | 64 | initMap(); |
65 | setEntry( entry ); | 65 | setEntry( entry ); |
66 | qDebug("finish"); | 66 | qDebug("finish"); |
67 | } | 67 | } |
68 | 68 | ||
69 | ContactEditor::~ContactEditor() { | 69 | ContactEditor::~ContactEditor() { |
70 | } | 70 | } |
71 | 71 | ||
72 | void ContactEditor::init() { | 72 | void ContactEditor::init() { |
73 | 73 | ||
74 | useFullName = TRUE; | 74 | useFullName = TRUE; |
75 | 75 | ||
76 | int i = 0; | 76 | int i = 0; |
77 | /** SHut up and stop leaking | 77 | /** SHut up and stop leaking |
78 | slHomeAddress = new QStringList; | 78 | slHomeAddress = new QStringList; |
79 | slBusinessAddress = new QStringList; | 79 | slBusinessAddress = new QStringList; |
80 | slChooserNames = new QStringList; | 80 | slChooserNames = new QStringList; |
81 | slChooserValues = new QStringList; | 81 | slChooserValues = new QStringList; |
82 | 82 | ||
83 | slDynamicEntries = new QStringList; | 83 | slDynamicEntries = new QStringList; |
84 | */ | 84 | */ |
85 | //*slDynamicEntries = *slOrdered; | 85 | //*slDynamicEntries = *slOrdered; |
86 | 86 | ||
87 | for (i = 0; i <= 6; i++) { | 87 | for (i = 0; i <= 6; i++) { |
88 | slHomeAddress.append( "" ); | 88 | slHomeAddress.append( "" ); |
89 | slBusinessAddress.append( "" ); | 89 | slBusinessAddress.append( "" ); |
90 | } | 90 | } |
91 | 91 | ||
92 | { | 92 | { |
93 | hasGender = FALSE; | 93 | hasGender = FALSE; |
94 | hasTitle = FALSE; | 94 | hasTitle = FALSE; |
95 | hasCompany = FALSE; | 95 | hasCompany = FALSE; |
96 | hasNotes = FALSE; | 96 | hasNotes = FALSE; |
97 | hasStreet = FALSE; | 97 | hasStreet = FALSE; |
98 | hasStreet2 = FALSE; | 98 | hasStreet2 = FALSE; |
99 | hasPOBox = FALSE; | 99 | hasPOBox = FALSE; |
100 | hasCity = FALSE; | 100 | hasCity = FALSE; |
101 | hasState = FALSE; | 101 | hasState = FALSE; |
102 | hasZip = FALSE; | 102 | hasZip = FALSE; |
103 | hasCountry = FALSE; | 103 | hasCountry = FALSE; |
104 | 104 | ||
105 | QStringList::ConstIterator it = slOrdered.begin(); | 105 | QStringList::ConstIterator it = slOrdered.begin(); |
106 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { | 106 | for ( i = 0; it != slOrdered.end(); i++, ++it ) { |
107 | 107 | ||
108 | if ( (*it) == tr( "Business Fax" ) ) { | 108 | if ( (*it) == tr( "Business Fax" ) ) { |
109 | slChooserNames.append( *it ); | 109 | slChooserNames.append( *it ); |
110 | slChooserValues.append("" ); | 110 | slChooserValues.append("" ); |
111 | //slDynamicEntries->remove( it ); | 111 | //slDynamicEntries->remove( it ); |
112 | continue; | 112 | continue; |
113 | } | 113 | } |
114 | 114 | ||
115 | if ( (*it) == tr( "Home Fax" ) ) { | 115 | if ( (*it) == tr( "Home Fax" ) ) { |
116 | slChooserNames.append( *it ); | 116 | slChooserNames.append( *it ); |
117 | slChooserValues.append("" ); | 117 | slChooserValues.append("" ); |
118 | //slDynamicEntries->remove( it ); | 118 | //slDynamicEntries->remove( it ); |
119 | continue; | 119 | continue; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | if ( (*it) == tr( "Business Phone" ) ) { | 123 | if ( (*it) == tr( "Business Phone" ) ) { |
124 | slChooserNames.append( *it ); | 124 | slChooserNames.append( *it ); |
125 | slChooserValues.append( "" ); | 125 | slChooserValues.append( "" ); |
126 | //slDynamicEntries->remove( it ); | 126 | //slDynamicEntries->remove( it ); |
127 | continue; | 127 | continue; |
128 | } | 128 | } |
129 | 129 | ||
130 | if ( (*it) == tr( "Home Phone" ) ) { | 130 | if ( (*it) == tr( "Home Phone" ) ) { |
131 | slChooserNames.append( *it ); | 131 | slChooserNames.append( *it ); |
132 | slChooserValues.append( "" ); | 132 | slChooserValues.append( "" ); |
133 | //slDynamicEntries->remove( it ); | 133 | //slDynamicEntries->remove( it ); |
134 | continue; | 134 | continue; |
135 | } | 135 | } |
136 | 136 | ||
137 | /* | 137 | /* |
138 | if ( (*it).right( 2 ) == tr( "IM" ) ) { | 138 | if ( (*it).right( 2 ) == tr( "IM" ) ) { |
139 | slChooserNames.append( *it ); | 139 | slChooserNames.append( *it ); |
140 | slChooserValues.append( "" ); | 140 | slChooserValues.append( "" ); |
141 | //slDynamicEntries->remove( it ); | 141 | //slDynamicEntries->remove( it ); |
142 | continue; | 142 | continue; |
143 | } */ | 143 | } */ |
144 | 144 | ||
145 | if ( (*it) == tr( "Business Mobile" ) ) { | 145 | if ( (*it) == tr( "Business Mobile" ) ) { |
146 | slChooserNames.append( *it ); | 146 | slChooserNames.append( *it ); |
147 | slChooserValues.append( "" ); | 147 | slChooserValues.append( "" ); |
148 | //slDynamicEntries->remove( it ); | 148 | //slDynamicEntries->remove( it ); |
149 | continue; | 149 | continue; |
150 | } | 150 | } |
151 | 151 | ||
152 | if ( (*it) == tr( "Home Mobile" ) ) { | 152 | if ( (*it) == tr( "Home Mobile" ) ) { |
153 | slChooserNames.append( *it ); | 153 | slChooserNames.append( *it ); |
154 | slChooserValues.append( "" ); | 154 | slChooserValues.append( "" ); |
155 | //slDynamicEntries->remove( it ); | 155 | //slDynamicEntries->remove( it ); |
156 | continue; | 156 | continue; |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | if ( (*it) == tr( "Business WebPage" ) ) { | 160 | if ( (*it) == tr( "Business WebPage" ) ) { |
161 | slChooserNames.append( *it ); | 161 | slChooserNames.append( *it ); |
162 | slChooserValues.append( "" ); | 162 | slChooserValues.append( "" ); |
163 | //slDynamicEntries->remove( it ); | 163 | //slDynamicEntries->remove( it ); |
164 | continue; | 164 | continue; |
165 | } | 165 | } |
166 | 166 | ||
167 | if ( (*it) == tr( "Home Web Page" ) ) { | 167 | if ( (*it) == tr( "Home Web Page" ) ) { |
168 | slChooserNames.append( *it ); | 168 | slChooserNames.append( *it ); |
169 | slChooserValues.append( "" ); | 169 | slChooserValues.append( "" ); |
170 | //slDynamicEntries->remove( it ); | 170 | //slDynamicEntries->remove( it ); |
171 | continue; | 171 | continue; |
172 | } | 172 | } |
173 | 173 | ||
174 | if ( (*it) == tr( "Business Pager" ) ) { | 174 | if ( (*it) == tr( "Business Pager" ) ) { |
175 | slChooserNames.append( *it ); | 175 | slChooserNames.append( *it ); |
176 | slChooserValues.append( "" ); | 176 | slChooserValues.append( "" ); |
177 | //slDynamicEntries->remove( it ); | 177 | //slDynamicEntries->remove( it ); |
178 | continue; | 178 | continue; |
179 | } | 179 | } |
180 | 180 | ||
181 | if ( *it == tr( "Default Email" ) ) { | 181 | if ( *it == tr( "Default Email" ) ) { |
182 | slChooserNames.append( *it ); | 182 | slChooserNames.append( *it ); |
183 | slChooserValues.append( "" ); | 183 | slChooserValues.append( "" ); |
184 | //slDynamicEntries->remove( it ); | 184 | //slDynamicEntries->remove( it ); |
185 | continue; | 185 | continue; |
186 | } | 186 | } |
187 | 187 | ||
188 | if ( *it == tr( "Emails" ) ) { | 188 | if ( *it == tr( "Emails" ) ) { |
189 | slChooserNames.append( *it ); | 189 | slChooserNames.append( *it ); |
190 | slChooserValues.append( "" ); | 190 | slChooserValues.append( "" ); |
191 | //slDynamicEntries->remove( it ); | 191 | //slDynamicEntries->remove( it ); |
192 | continue; | 192 | continue; |
193 | } | 193 | } |
194 | 194 | ||
195 | if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) | 195 | if ( *it == "Name Title" || *it == "First Name" || *it == "Middle Name" || *it == "Last Name" || *it == "File As" || *it == "Default Email" || *it == "Emails" || *it == "Groups" ) |
196 | continue; | 196 | continue; |
197 | 197 | ||
198 | if ( *it == tr( "Name Title" ) ) { | 198 | if ( *it == tr( "Name Title" ) ) { |
199 | //slDynamicEntries->remove( it ); | 199 | //slDynamicEntries->remove( it ); |
200 | continue; | 200 | continue; |
201 | } | 201 | } |
202 | 202 | ||
203 | if ( *it == tr( "First Name" ) ) { | 203 | if ( *it == tr( "First Name" ) ) { |
204 | //slDynamicEntries->remove( it ); | 204 | //slDynamicEntries->remove( it ); |
205 | continue; | 205 | continue; |
206 | } | 206 | } |
207 | 207 | ||
208 | if ( *it == tr( "Middle Name" ) ) { | 208 | if ( *it == tr( "Middle Name" ) ) { |
209 | //slDynamicEntries->remove( it ); | 209 | //slDynamicEntries->remove( it ); |
210 | continue; | 210 | continue; |
211 | } | 211 | } |
212 | 212 | ||
213 | if ( *it == tr( "Last Name" ) ) { | 213 | if ( *it == tr( "Last Name" ) ) { |
214 | //slDynamicEntries->remove( it ); | 214 | //slDynamicEntries->remove( it ); |
215 | continue; | 215 | continue; |
216 | } | 216 | } |
217 | 217 | ||
218 | if ( *it == tr( "Suffix" ) ) { | 218 | if ( *it == tr( "Suffix" ) ) { |
219 | //slDynamicEntries->remove( it ); | 219 | //slDynamicEntries->remove( it ); |
220 | continue; | 220 | continue; |
221 | } | 221 | } |
222 | 222 | ||
223 | if ( *it == tr( "File As" ) ) { | 223 | if ( *it == tr( "File As" ) ) { |
224 | //slDynamicEntries->remove( it ); | 224 | //slDynamicEntries->remove( it ); |
225 | continue; | 225 | continue; |
226 | } | 226 | } |
227 | 227 | ||
228 | if ( *it == tr( "Gender" ) ) { | 228 | if ( *it == tr( "Gender" ) ) { |
229 | hasGender = TRUE; | 229 | hasGender = TRUE; |
230 | //slDynamicEntries->remove( it ); | 230 | //slDynamicEntries->remove( it ); |
231 | continue; | 231 | continue; |
232 | } | 232 | } |
233 | 233 | ||
234 | if ( *it == tr( "Job Title" ) ) { | 234 | if ( *it == tr( "Job Title" ) ) { |
235 | hasTitle = TRUE; | 235 | hasTitle = TRUE; |
236 | //slDynamicEntries->remove( it ); | 236 | //slDynamicEntries->remove( it ); |
237 | continue; | 237 | continue; |
238 | } | 238 | } |
239 | 239 | ||
240 | if ( *it == tr( "Company") || *it == tr( "Organization" ) ) { | 240 | if ( *it == tr( "Company") || *it == tr( "Organization" ) ) { |
241 | hasCompany = TRUE; | 241 | hasCompany = TRUE; |
242 | //slDynamicEntries->remove( it ); | 242 | //slDynamicEntries->remove( it ); |
243 | continue; | 243 | continue; |
244 | } | 244 | } |
245 | 245 | ||
246 | if ( *it == tr( "Notes" ) ) { | 246 | if ( *it == tr( "Notes" ) ) { |
247 | hasNotes = TRUE; | 247 | hasNotes = TRUE; |
248 | //slDynamicEntries->remove( it ); | 248 | //slDynamicEntries->remove( it ); |
249 | continue; | 249 | continue; |
250 | } | 250 | } |
251 | 251 | ||
252 | if ( *it == tr( "Groups" ) ) { | 252 | if ( *it == tr( "Groups" ) ) { |
253 | //slDynamicEntries->remove( it ); | 253 | //slDynamicEntries->remove( it ); |
254 | continue; | 254 | continue; |
255 | } | 255 | } |
256 | 256 | ||
257 | if ( (*it) == tr( "Business Street" ) ) { | 257 | if ( (*it) == tr( "Business Street" ) ) { |
258 | hasStreet = TRUE; | 258 | hasStreet = TRUE; |
259 | //slDynamicEntries->remove( it ); | 259 | //slDynamicEntries->remove( it ); |
260 | continue; | 260 | continue; |
261 | } | 261 | } |
262 | 262 | ||
263 | if ( (*it) == tr( "Home Street" ) ) { | 263 | if ( (*it) == tr( "Home Street" ) ) { |
264 | hasStreet = TRUE; | 264 | hasStreet = TRUE; |
265 | //slDynamicEntries->remove( it ); | 265 | //slDynamicEntries->remove( it ); |
266 | continue; | 266 | continue; |
267 | } | 267 | } |
268 | /* | 268 | /* |
269 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { | 269 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { |
270 | hasStreet2 = TRUE; | 270 | hasStreet2 = TRUE; |
271 | //slDynamicEntries->remove( it ); | 271 | //slDynamicEntries->remove( it ); |
272 | continue; | 272 | continue; |
273 | } | 273 | } |
274 | 274 | ||
275 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { | 275 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { |
276 | hasPOBox = TRUE; | 276 | hasPOBox = TRUE; |
277 | //slDynamicEntries->remove( it ); | 277 | //slDynamicEntries->remove( it ); |
278 | continue; | 278 | continue; |
279 | } */ | 279 | } */ |
280 | 280 | ||
281 | if ( (*it) == tr( "Business City" ) ) { | 281 | if ( (*it) == tr( "Business City" ) ) { |
282 | hasCity = TRUE; | 282 | hasCity = TRUE; |
283 | //slDynamicEntries->remove( it ); | 283 | //slDynamicEntries->remove( it ); |
284 | continue; | 284 | continue; |
285 | } | 285 | } |
286 | 286 | ||
287 | if ( (*it) == tr( "Business State" ) ) { | 287 | if ( (*it) == tr( "Business State" ) ) { |
288 | hasState = TRUE; | 288 | hasState = TRUE; |
289 | //slDynamicEntries->remove( it ); | 289 | //slDynamicEntries->remove( it ); |
290 | continue; | 290 | continue; |
291 | } | 291 | } |
292 | 292 | ||
293 | if ( (*it) == tr( "Business Zip" ) ) { | 293 | if ( (*it) == tr( "Business Zip" ) ) { |
294 | hasZip = TRUE; | 294 | hasZip = TRUE; |
295 | //slDynamicEntries->remove( it ); | 295 | //slDynamicEntries->remove( it ); |
296 | continue; | 296 | continue; |
297 | } | 297 | } |
298 | 298 | ||
299 | if ( (*it) == tr( "Business Country" ) ) { | 299 | if ( (*it) == tr( "Business Country" ) ) { |
300 | hasCountry = TRUE; | 300 | hasCountry = TRUE; |
301 | //slDynamicEntries->remove( it ); | 301 | //slDynamicEntries->remove( it ); |
302 | continue; | 302 | continue; |
303 | } | 303 | } |
304 | 304 | ||
305 | if ( (*it) == tr( "Home City" ) ) { | 305 | if ( (*it) == tr( "Home City" ) ) { |
306 | hasCity = TRUE; | 306 | hasCity = TRUE; |
307 | //slDynamicEntries->remove( it ); | 307 | //slDynamicEntries->remove( it ); |
308 | continue; | 308 | continue; |
309 | } | 309 | } |
310 | 310 | ||
311 | if ( (*it) == tr( "Home State" ) ) { | 311 | if ( (*it) == tr( "Home State" ) ) { |
312 | hasState = TRUE; | 312 | hasState = TRUE; |
313 | //slDynamicEntries->remove( it ); | 313 | //slDynamicEntries->remove( it ); |
314 | continue; | 314 | continue; |
315 | } | 315 | } |
316 | 316 | ||
317 | if ( (*it) == tr( "Home Zip" ) ) { | 317 | if ( (*it) == tr( "Home Zip" ) ) { |
318 | hasZip = TRUE; | 318 | hasZip = TRUE; |
319 | //slDynamicEntries->remove( it ); | 319 | //slDynamicEntries->remove( it ); |
320 | continue; | 320 | continue; |
321 | } | 321 | } |
322 | 322 | ||
323 | if ( (*it) == tr( "Home Country" ) ) { | 323 | if ( (*it) == tr( "Home Country" ) ) { |
324 | hasCountry = TRUE; | 324 | hasCountry = TRUE; |
325 | //slDynamicEntries->remove( it ); | 325 | //slDynamicEntries->remove( it ); |
326 | continue; | 326 | continue; |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | slDynamicEntries.append( *it ); | 330 | slDynamicEntries.append( *it ); |
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | QVBoxLayout *vb = new QVBoxLayout( this ); | 334 | QVBoxLayout *vb = new QVBoxLayout( this ); |
335 | 335 | ||
336 | tabMain = new QTabWidget( this ); | 336 | tabMain = new QTabWidget( this ); |
337 | vb->addWidget( tabMain ); | 337 | vb->addWidget( tabMain ); |
@@ -973,129 +973,129 @@ void ContactEditor::slotAddressTypeChange( int index ) { | |||
973 | txtTmp->setText( slHomeAddress[6] ); | 973 | txtTmp->setText( slHomeAddress[6] ); |
974 | 974 | ||
975 | } | 975 | } |
976 | 976 | ||
977 | } | 977 | } |
978 | 978 | ||
979 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 979 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
980 | 980 | ||
981 | int index = cmbFileAs->currentItem(); | 981 | int index = cmbFileAs->currentItem(); |
982 | 982 | ||
983 | cmbFileAs->clear(); | 983 | cmbFileAs->clear(); |
984 | 984 | ||
985 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 985 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
986 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 986 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
987 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 987 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
988 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 988 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
989 | 989 | ||
990 | cmbFileAs->setCurrentItem( index ); | 990 | cmbFileAs->setCurrentItem( index ); |
991 | 991 | ||
992 | useFullName = TRUE; | 992 | useFullName = TRUE; |
993 | 993 | ||
994 | } | 994 | } |
995 | 995 | ||
996 | void ContactEditor::loadFields() { | 996 | void ContactEditor::loadFields() { |
997 | 997 | ||
998 | QStringList::ConstIterator it; | 998 | QStringList::ConstIterator it; |
999 | QListIterator<QLabel> lit( listName ); | 999 | QListIterator<QLabel> lit( listName ); |
1000 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { | 1000 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { |
1001 | (*lit)->setText( *it ); | 1001 | (*lit)->setText( *it ); |
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | void ContactEditor::accept() { | 1005 | void ContactEditor::accept() { |
1006 | 1006 | ||
1007 | if ( isEmpty() ) { | 1007 | if ( isEmpty() ) { |
1008 | cleanupFields(); | 1008 | cleanupFields(); |
1009 | reject(); | 1009 | reject(); |
1010 | } else { | 1010 | } else { |
1011 | saveEntry(); | 1011 | saveEntry(); |
1012 | cleanupFields(); | 1012 | cleanupFields(); |
1013 | QDialog::accept(); | 1013 | QDialog::accept(); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void ContactEditor::slotNote() { | 1018 | void ContactEditor::slotNote() { |
1019 | 1019 | ||
1020 | dlgNote->showMaximized(); | 1020 | dlgNote->showMaximized(); |
1021 | if ( !dlgNote->exec() ) { | 1021 | if ( !dlgNote->exec() ) { |
1022 | txtNote->setText( ent.notes() ); | 1022 | txtNote->setText( ent.notes() ); |
1023 | } | 1023 | } |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | void ContactEditor::slotName() { | 1026 | void ContactEditor::slotName() { |
1027 | 1027 | ||
1028 | QString tmpName; | 1028 | QString tmpName; |
1029 | if (useFullName == TRUE) { | 1029 | if (useFullName == TRUE) { |
1030 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 1030 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
1031 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 1031 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
1032 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 1032 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
1033 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 1033 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
1034 | } | 1034 | } |
1035 | dlgName->showMaximized(); | 1035 | dlgName->showMaximized(); |
1036 | if ( dlgName->exec() ) { | 1036 | if ( dlgName->exec() ) { |
1037 | 1037 | ||
1038 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); | 1038 | tmpName = txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text(); |
1039 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); | 1039 | txtFullName->setText( tmpName.simplifyWhiteSpace() ); |
1040 | slotFullNameChange( txtFullName->text() ); | 1040 | slotFullNameChange( txtFullName->text() ); |
1041 | useFullName = FALSE; | 1041 | useFullName = FALSE; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | void ContactEditor::setNameFocus() { | 1046 | void ContactEditor::setNameFocus() { |
1047 | 1047 | ||
1048 | txtFullName->setFocus(); | 1048 | txtFullName->setFocus(); |
1049 | 1049 | ||
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | bool ContactEditor::isEmpty() { | 1052 | bool ContactEditor::isEmpty() { |
1053 | // Test and see if the record should be saved. | 1053 | // Test and see if the record should be saved. |
1054 | // More strict than the original qtopia, needs name or fileas to save | 1054 | // More strict than the original qtopia, needs name or fileas to save |
1055 | 1055 | ||
1056 | QString t = txtFullName->text(); | 1056 | QString t = txtFullName->text(); |
1057 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1057 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1058 | return false; | 1058 | return false; |
1059 | 1059 | ||
1060 | t = cmbFileAs->currentText(); | 1060 | t = cmbFileAs->currentText(); |
1061 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 1061 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
1062 | return false; | 1062 | return false; |
1063 | 1063 | ||
1064 | return true; | 1064 | return true; |
1065 | 1065 | ||
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | QString ContactEditor::parseName( const QString fullName, int type ) { | 1068 | QString ContactEditor::parseName( const QString fullName, int type ) { |
1069 | 1069 | ||
1070 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 1070 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
1071 | QString strFirstName; | 1071 | QString strFirstName; |
1072 | QString strMiddleName; | 1072 | QString strMiddleName; |
1073 | QString strLastName; | 1073 | QString strLastName; |
1074 | QString strSuffix; | 1074 | QString strSuffix; |
1075 | QString strTitle; | 1075 | QString strTitle; |
1076 | int commapos; | 1076 | int commapos; |
1077 | int spCount; | 1077 | int spCount; |
1078 | int spPos; | 1078 | int spPos; |
1079 | int spPos2; | 1079 | int spPos2; |
1080 | 1080 | ||
1081 | 1081 | ||
1082 | commapos = simplifiedName.find( ',', 0, TRUE); | 1082 | commapos = simplifiedName.find( ',', 0, TRUE); |
1083 | spCount = simplifiedName.contains( ' ', TRUE ); | 1083 | spCount = simplifiedName.contains( ' ', TRUE ); |
1084 | 1084 | ||
1085 | if ( commapos == -1 ) { | 1085 | if ( commapos == -1 ) { |
1086 | 1086 | ||
1087 | switch (spCount) { | 1087 | switch (spCount) { |
1088 | case 0: | 1088 | case 0: |
1089 | //return simplifiedName; | 1089 | //return simplifiedName; |
1090 | if (txtLastName->text() != "") { | 1090 | if (txtLastName->text() != "") { |
1091 | strLastName = simplifiedName; | 1091 | strLastName = simplifiedName; |
1092 | break; | 1092 | break; |
1093 | } | 1093 | } |
1094 | if (txtMiddleName->text() != "") { | 1094 | if (txtMiddleName->text() != "") { |
1095 | strMiddleName = simplifiedName; | 1095 | strMiddleName = simplifiedName; |
1096 | break; | 1096 | break; |
1097 | } | 1097 | } |
1098 | if (txtSuffix->text() != "") { | 1098 | if (txtSuffix->text() != "") { |
1099 | strSuffix = simplifiedName; | 1099 | strSuffix = simplifiedName; |
1100 | break; | 1100 | break; |
1101 | } | 1101 | } |
@@ -1356,129 +1356,129 @@ void ContactEditor::setEntry( const Contact &entry ) { | |||
1356 | slHomeAddress[6] = ent.homeCountry(); | 1356 | slHomeAddress[6] = ent.homeCountry(); |
1357 | slBusinessAddress[6] = ent.businessCountry(); | 1357 | slBusinessAddress[6] = ent.businessCountry(); |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | QStringList::ConstIterator it; | 1360 | QStringList::ConstIterator it; |
1361 | QListIterator<QLineEdit> itLE( listValue ); | 1361 | QListIterator<QLineEdit> itLE( listValue ); |
1362 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1362 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1363 | if ( *it == tr("Department") ) | 1363 | if ( *it == tr("Department") ) |
1364 | (*itLE)->setText( ent.department() ); | 1364 | (*itLE)->setText( ent.department() ); |
1365 | 1365 | ||
1366 | if ( *it == tr("Company" )) | 1366 | if ( *it == tr("Company" )) |
1367 | (*itLE)->setText( ent.company() ); | 1367 | (*itLE)->setText( ent.company() ); |
1368 | 1368 | ||
1369 | if ( *it == tr("Office" )) | 1369 | if ( *it == tr("Office" )) |
1370 | (*itLE)->setText( ent.office() ); | 1370 | (*itLE)->setText( ent.office() ); |
1371 | 1371 | ||
1372 | if ( *it == tr("Profession" )) | 1372 | if ( *it == tr("Profession" )) |
1373 | (*itLE)->setText( ent.profession() ); | 1373 | (*itLE)->setText( ent.profession() ); |
1374 | 1374 | ||
1375 | if ( *it == tr("Assistant" )) | 1375 | if ( *it == tr("Assistant" )) |
1376 | (*itLE)->setText( ent.assistant() ); | 1376 | (*itLE)->setText( ent.assistant() ); |
1377 | 1377 | ||
1378 | if ( *it == tr("Manager" )) | 1378 | if ( *it == tr("Manager" )) |
1379 | (*itLE)->setText( ent.manager() ); | 1379 | (*itLE)->setText( ent.manager() ); |
1380 | 1380 | ||
1381 | if ( *it == tr("Spouse" )) | 1381 | if ( *it == tr("Spouse" )) |
1382 | (*itLE)->setText( ent.spouse() ); | 1382 | (*itLE)->setText( ent.spouse() ); |
1383 | 1383 | ||
1384 | if ( *it == tr("Birthday" )) | 1384 | if ( *it == tr("Birthday" )) |
1385 | (*itLE)->setText( ent.birthday() ); | 1385 | (*itLE)->setText( ent.birthday() ); |
1386 | 1386 | ||
1387 | if ( *it == tr("Anniversary" )) | 1387 | if ( *it == tr("Anniversary" )) |
1388 | (*itLE)->setText( ent.anniversary() ); | 1388 | (*itLE)->setText( ent.anniversary() ); |
1389 | 1389 | ||
1390 | if ( *it == tr("Nickname" )) | 1390 | if ( *it == tr("Nickname" )) |
1391 | (*itLE)->setText( ent.nickname() ); | 1391 | (*itLE)->setText( ent.nickname() ); |
1392 | 1392 | ||
1393 | if ( *it == tr("Children" )) | 1393 | if ( *it == tr("Children" )) |
1394 | (*itLE)->setText( ent.children() ); | 1394 | (*itLE)->setText( ent.children() ); |
1395 | 1395 | ||
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | QStringList::Iterator itV; | 1398 | QStringList::Iterator itV; |
1399 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1399 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1400 | 1400 | ||
1401 | if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) | 1401 | if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) |
1402 | *itV = ent.businessPhone(); | 1402 | *itV = ent.businessPhone(); |
1403 | /* | 1403 | /* |
1404 | if ( *it == "Business 2 Phone" ) | 1404 | if ( *it == "Business 2 Phone" ) |
1405 | *itV = ent.business2Phone(); | 1405 | *itV = ent.business2Phone(); |
1406 | */ | 1406 | */ |
1407 | if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) | 1407 | if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) |
1408 | *itV = ent.businessFax(); | 1408 | *itV = ent.businessFax(); |
1409 | 1409 | ||
1410 | if ( *it == tr("Business Mobile") || *it == tr("work Mobile" )) | 1410 | if ( *it == tr("Business Mobile") || *it == tr("work Mobile" )) |
1411 | *itV = ent.businessMobile(); | 1411 | *itV = ent.businessMobile(); |
1412 | /* | 1412 | /* |
1413 | if ( *it == "Company Phone" ) | 1413 | if ( *it == "Company Phone" ) |
1414 | *itV = ent.companyPhone(); | 1414 | *itV = ent.companyPhone(); |
1415 | */ | 1415 | */ |
1416 | if ( *it == tr("Default Email" )) | 1416 | if ( *it == tr("Default Email" )) |
1417 | *itV = ent.defaultEmail(); | 1417 | *itV = ent.defaultEmail(); |
1418 | 1418 | ||
1419 | if ( *it == tr("Emails" )) | 1419 | if ( *it == tr("Emails" )) |
1420 | *itV = ent.emails(); | 1420 | *itV = ent.emailList().join(";"); |
1421 | 1421 | ||
1422 | if ( *it == tr("Home Phone" )) | 1422 | if ( *it == tr("Home Phone" )) |
1423 | *itV = ent.homePhone(); | 1423 | *itV = ent.homePhone(); |
1424 | /* | 1424 | /* |
1425 | if ( *it == "Home 2 Phone" ) | 1425 | if ( *it == "Home 2 Phone" ) |
1426 | *itV = ent.home2Phone(); | 1426 | *itV = ent.home2Phone(); |
1427 | */ | 1427 | */ |
1428 | if ( *it == tr("Home Fax" )) | 1428 | if ( *it == tr("Home Fax" )) |
1429 | *itV = ent.homeFax(); | 1429 | *itV = ent.homeFax(); |
1430 | 1430 | ||
1431 | if ( *it == tr("Home Mobile" )) | 1431 | if ( *it == tr("Home Mobile" )) |
1432 | *itV = ent.homeMobile(); | 1432 | *itV = ent.homeMobile(); |
1433 | /* | 1433 | /* |
1434 | if ( *it == "Car Phone" ) | 1434 | if ( *it == "Car Phone" ) |
1435 | *itV = ent.carPhone(); | 1435 | *itV = ent.carPhone(); |
1436 | 1436 | ||
1437 | if ( *it == "ISDN Phone" ) | 1437 | if ( *it == "ISDN Phone" ) |
1438 | *itV = ent.ISDNPhone(); | 1438 | *itV = ent.ISDNPhone(); |
1439 | 1439 | ||
1440 | if ( *it == "Other Phone" ) | 1440 | if ( *it == "Other Phone" ) |
1441 | *itV = ent.otherPhone(); | 1441 | *itV = ent.otherPhone(); |
1442 | */ | 1442 | */ |
1443 | if ( *it == tr("Business Pager") || *it == tr("Work Pager" )) | 1443 | if ( *it == tr("Business Pager") || *it == tr("Work Pager" )) |
1444 | *itV = ent.businessPager(); | 1444 | *itV = ent.businessPager(); |
1445 | /* | 1445 | /* |
1446 | if ( *it == "Home Pager") | 1446 | if ( *it == "Home Pager") |
1447 | *itV = ent.homePager(); | 1447 | *itV = ent.homePager(); |
1448 | 1448 | ||
1449 | if ( *it == "AIM IM" ) | 1449 | if ( *it == "AIM IM" ) |
1450 | *itV = ent.AIMIM(); | 1450 | *itV = ent.AIMIM(); |
1451 | 1451 | ||
1452 | if ( *it == "ICQ IM" ) | 1452 | if ( *it == "ICQ IM" ) |
1453 | *itV = ent.ICQIM(); | 1453 | *itV = ent.ICQIM(); |
1454 | 1454 | ||
1455 | if ( *it == "Jabber IM" ) | 1455 | if ( *it == "Jabber IM" ) |
1456 | *itV = ent.jabberIM(); | 1456 | *itV = ent.jabberIM(); |
1457 | 1457 | ||
1458 | if ( *it == "MSN IM" ) | 1458 | if ( *it == "MSN IM" ) |
1459 | *itV = ent.MSNIM(); | 1459 | *itV = ent.MSNIM(); |
1460 | 1460 | ||
1461 | if ( *it == "Yahoo IM" ) | 1461 | if ( *it == "Yahoo IM" ) |
1462 | *itV = ent.yahooIM(); | 1462 | *itV = ent.yahooIM(); |
1463 | */ | 1463 | */ |
1464 | if ( *it == tr("Home Web Page") ) | 1464 | if ( *it == tr("Home Web Page") ) |
1465 | *itV = ent.homeWebpage(); | 1465 | *itV = ent.homeWebpage(); |
1466 | if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") ) | 1466 | if ( *it == tr("Business WebPage") || *it == tr("Work Web Page") ) |
1467 | *itV = ent.businessWebpage(); | 1467 | *itV = ent.businessWebpage(); |
1468 | 1468 | ||
1469 | 1469 | ||
1470 | } | 1470 | } |
1471 | 1471 | ||
1472 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1472 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1473 | 1473 | ||
1474 | QString gender = ent.gender(); | 1474 | QString gender = ent.gender(); |
1475 | cmbGender->setCurrentItem( gender.toInt() ); | 1475 | cmbGender->setCurrentItem( gender.toInt() ); |
1476 | 1476 | ||
1477 | txtNote->setText( ent.notes() ); | 1477 | txtNote->setText( ent.notes() ); |
1478 | 1478 | ||
1479 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1479 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1480 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1480 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1481 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1481 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1482 | 1482 | ||
1483 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1483 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1484 | 1484 | ||
@@ -1557,129 +1557,129 @@ void ContactEditor::saveEntry() { | |||
1557 | QStringList::ConstIterator it; | 1557 | QStringList::ConstIterator it; |
1558 | QListIterator<QLineEdit> itLE( listValue ); | 1558 | QListIterator<QLineEdit> itLE( listValue ); |
1559 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1559 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1560 | if ( *it == tr("Department" )) | 1560 | if ( *it == tr("Department" )) |
1561 | ent.setDepartment( (*itLE)->text() ); | 1561 | ent.setDepartment( (*itLE)->text() ); |
1562 | 1562 | ||
1563 | if ( *it == tr("Company" )) | 1563 | if ( *it == tr("Company" )) |
1564 | ent.setCompany( (*itLE)->text() ); | 1564 | ent.setCompany( (*itLE)->text() ); |
1565 | 1565 | ||
1566 | if ( *it == tr("Office" )) | 1566 | if ( *it == tr("Office" )) |
1567 | ent.setOffice( (*itLE)->text() ); | 1567 | ent.setOffice( (*itLE)->text() ); |
1568 | 1568 | ||
1569 | if ( *it == tr("Profession" )) | 1569 | if ( *it == tr("Profession" )) |
1570 | ent.setProfession( (*itLE)->text() ); | 1570 | ent.setProfession( (*itLE)->text() ); |
1571 | 1571 | ||
1572 | if ( *it == tr("Assistant" )) | 1572 | if ( *it == tr("Assistant" )) |
1573 | ent.setAssistant( (*itLE)->text() ); | 1573 | ent.setAssistant( (*itLE)->text() ); |
1574 | 1574 | ||
1575 | if ( *it == tr("Manager" )) | 1575 | if ( *it == tr("Manager" )) |
1576 | ent.setManager( (*itLE)->text() ); | 1576 | ent.setManager( (*itLE)->text() ); |
1577 | 1577 | ||
1578 | if ( *it == tr("Spouse" )) | 1578 | if ( *it == tr("Spouse" )) |
1579 | ent.setSpouse( (*itLE)->text() ); | 1579 | ent.setSpouse( (*itLE)->text() ); |
1580 | 1580 | ||
1581 | if ( *it == tr("Birthday" )) | 1581 | if ( *it == tr("Birthday" )) |
1582 | ent.setBirthday( (*itLE)->text() ); | 1582 | ent.setBirthday( (*itLE)->text() ); |
1583 | 1583 | ||
1584 | if ( *it == tr("Anniversary" )) | 1584 | if ( *it == tr("Anniversary" )) |
1585 | ent.setAnniversary( (*itLE)->text() ); | 1585 | ent.setAnniversary( (*itLE)->text() ); |
1586 | 1586 | ||
1587 | if ( *it == tr("Nickname" )) | 1587 | if ( *it == tr("Nickname" )) |
1588 | ent.setNickname( (*itLE)->text() ); | 1588 | ent.setNickname( (*itLE)->text() ); |
1589 | 1589 | ||
1590 | if ( *it == tr("Children" )) | 1590 | if ( *it == tr("Children" )) |
1591 | ent.setChildren( (*itLE)->text() ); | 1591 | ent.setChildren( (*itLE)->text() ); |
1592 | 1592 | ||
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | QStringList::ConstIterator itV; | 1595 | QStringList::ConstIterator itV; |
1596 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1596 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
1597 | 1597 | ||
1598 | if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) | 1598 | if ( *it == tr("Business Phone") || *it == tr("Work Phone" )) |
1599 | ent.setBusinessPhone( *itV ); | 1599 | ent.setBusinessPhone( *itV ); |
1600 | /* | 1600 | /* |
1601 | if ( *it == tr("Business 2 Phone" ) | 1601 | if ( *it == tr("Business 2 Phone" ) |
1602 | ent.setBusiness2Phone( *itV ); | 1602 | ent.setBusiness2Phone( *itV ); |
1603 | */ | 1603 | */ |
1604 | if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) | 1604 | if ( *it == tr("Business Fax") || *it == tr("Work Fax" )) |
1605 | ent.setBusinessFax( *itV ); | 1605 | ent.setBusinessFax( *itV ); |
1606 | 1606 | ||
1607 | if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" )) | 1607 | if ( *it == tr("Business Mobile") || *it == tr("Work Mobile" )) |
1608 | ent.setBusinessMobile( *itV ); | 1608 | ent.setBusinessMobile( *itV ); |
1609 | /* | 1609 | /* |
1610 | if ( *it == "Company Phone" ) | 1610 | if ( *it == "Company Phone" ) |
1611 | ent.setCompanyPhone( *itV ); | 1611 | ent.setCompanyPhone( *itV ); |
1612 | */ | 1612 | */ |
1613 | //if ( *it == "Default Email" ) | 1613 | //if ( *it == "Default Email" ) |
1614 | //ent.setDefaultEmail( *itV ); | 1614 | //ent.setDefaultEmail( *itV ); |
1615 | 1615 | ||
1616 | if ( *it == tr("Emails" )) { | 1616 | if ( *it == tr("Emails" )) { |
1617 | QString allemail; | 1617 | QString allemail; |
1618 | QString defaultmail; | 1618 | QString defaultmail; |
1619 | parseEmailFrom( *itV, defaultmail, allemail ); | 1619 | parseEmailFrom( *itV, defaultmail, allemail ); |
1620 | ent.setDefaultEmail( defaultmail ); | 1620 | ent.setDefaultEmail( defaultmail ); |
1621 | ent.setEmails( *itV ); | 1621 | ent.insertEmails( *itV ); |
1622 | } | 1622 | } |
1623 | 1623 | ||
1624 | if ( *it == tr("Home Phone" )) | 1624 | if ( *it == tr("Home Phone" )) |
1625 | ent.setHomePhone( *itV ); | 1625 | ent.setHomePhone( *itV ); |
1626 | /* | 1626 | /* |
1627 | if ( *it == "Home 2 Phone" ) | 1627 | if ( *it == "Home 2 Phone" ) |
1628 | ent.setHome2Phone( *itV ); | 1628 | ent.setHome2Phone( *itV ); |
1629 | */ | 1629 | */ |
1630 | if ( *it == tr("Home Fax" )) | 1630 | if ( *it == tr("Home Fax" )) |
1631 | ent.setHomeFax( *itV ); | 1631 | ent.setHomeFax( *itV ); |
1632 | 1632 | ||
1633 | if ( *it == tr("Home Mobile" )) | 1633 | if ( *it == tr("Home Mobile" )) |
1634 | ent.setHomeMobile( *itV ); | 1634 | ent.setHomeMobile( *itV ); |
1635 | /* | 1635 | /* |
1636 | if ( *it == "Car Phone" ) | 1636 | if ( *it == "Car Phone" ) |
1637 | ent.setCarPhone( *itV ); | 1637 | ent.setCarPhone( *itV ); |
1638 | 1638 | ||
1639 | if ( *it == "ISDN Phone" ) | 1639 | if ( *it == "ISDN Phone" ) |
1640 | ent.setISDNPhone( *itV ); | 1640 | ent.setISDNPhone( *itV ); |
1641 | 1641 | ||
1642 | if ( *it == "Other Phone" ) | 1642 | if ( *it == "Other Phone" ) |
1643 | ent.setOtherPhone( *itV ); | 1643 | ent.setOtherPhone( *itV ); |
1644 | */ | 1644 | */ |
1645 | if ( *it == tr("Business Pager") || *it == tr("Work Pager") ) | 1645 | if ( *it == tr("Business Pager") || *it == tr("Work Pager") ) |
1646 | ent.setBusinessPager( *itV ); | 1646 | ent.setBusinessPager( *itV ); |
1647 | /* | 1647 | /* |
1648 | if ( *it == "Home Pager" ) | 1648 | if ( *it == "Home Pager" ) |
1649 | ent.setHomePager( *itV ); | 1649 | ent.setHomePager( *itV ); |
1650 | 1650 | ||
1651 | if ( *it == "AIM IM" ) | 1651 | if ( *it == "AIM IM" ) |
1652 | ent.setAIMIM( *itV ); | 1652 | ent.setAIMIM( *itV ); |
1653 | 1653 | ||
1654 | if ( *it == "ICQ IM" ) | 1654 | if ( *it == "ICQ IM" ) |
1655 | ent.setICQIM( *itV ); | 1655 | ent.setICQIM( *itV ); |
1656 | 1656 | ||
1657 | if ( *it == "Jabber IM" ) | 1657 | if ( *it == "Jabber IM" ) |
1658 | ent.setJabberIM( *itV ); | 1658 | ent.setJabberIM( *itV ); |
1659 | 1659 | ||
1660 | if ( *it == "MSN IM" ) | 1660 | if ( *it == "MSN IM" ) |
1661 | ent.setMSNIM( *itV ); | 1661 | ent.setMSNIM( *itV ); |
1662 | 1662 | ||
1663 | if ( *it == "Yahoo IM" ) | 1663 | if ( *it == "Yahoo IM" ) |
1664 | ent.setYahooIM( *itV ); | 1664 | ent.setYahooIM( *itV ); |
1665 | */ | 1665 | */ |
1666 | if ( *it == tr("Home Web Page") ) | 1666 | if ( *it == tr("Home Web Page") ) |
1667 | ent.setHomeWebpage( *itV ); | 1667 | ent.setHomeWebpage( *itV ); |
1668 | if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" )) | 1668 | if ( *it == tr("Business WebPage") || *it == tr("Work Web Page" )) |
1669 | ent.setBusinessWebpage( *itV ); | 1669 | ent.setBusinessWebpage( *itV ); |
1670 | 1670 | ||
1671 | 1671 | ||
1672 | } | 1672 | } |
1673 | 1673 | ||
1674 | int gender = cmbGender->currentItem(); | 1674 | int gender = cmbGender->currentItem(); |
1675 | ent.setGender( QString::number( gender ) ); | 1675 | ent.setGender( QString::number( gender ) ); |
1676 | 1676 | ||
1677 | QString str = txtNote->text(); | 1677 | QString str = txtNote->text(); |
1678 | if ( !str.isNull() ) | 1678 | if ( !str.isNull() ) |
1679 | ent.setNotes( str ); | 1679 | ent.setNotes( str ); |
1680 | 1680 | ||
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1683 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1684 | QString &strAll ) | 1684 | QString &strAll ) |
1685 | { | 1685 | { |
diff --git a/core/pim/todo/todotable.h b/core/pim/todo/todotable.h index 39e00d1..7539df1 100644 --- a/core/pim/todo/todotable.h +++ b/core/pim/todo/todotable.h | |||
@@ -10,236 +10,239 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef TODOTABLE_H | 21 | #ifndef TODOTABLE_H |
22 | #define TODOTABLE_H | 22 | #define TODOTABLE_H |
23 | 23 | ||
24 | #include <qpe/categories.h> | 24 | #include <qpe/categories.h> |
25 | #include <qpe/stringutil.h> | 25 | #include <qpe/stringutil.h> |
26 | //#include <qpe/task.h> | 26 | //#include <qpe/task.h> |
27 | #include <opie/todoevent.h> | 27 | #include <opie/todoevent.h> |
28 | 28 | ||
29 | #include <qtable.h> | 29 | #include <qtable.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | #include <qguardedptr.h> | 31 | #include <qguardedptr.h> |
32 | 32 | ||
33 | class Node; | 33 | class Node; |
34 | class QComboBox; | 34 | class QComboBox; |
35 | class QTimer; | 35 | class QTimer; |
36 | 36 | ||
37 | class CheckItem : public QTableItem | 37 | class CheckItem : public QTableItem |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | CheckItem( QTable *t, const QString &sortkey ); | 40 | CheckItem( QTable *t, const QString &sortkey ); |
41 | 41 | ||
42 | void setChecked( bool b ); | 42 | void setChecked( bool b ); |
43 | void toggle(); | 43 | void toggle(); |
44 | bool isChecked() const; | 44 | bool isChecked() const; |
45 | void setKey( const QString &key ) { sortKey = key; } | 45 | void setKey( const QString &key ) { sortKey = key; } |
46 | QString key() const; | 46 | QString key() const; |
47 | 47 | ||
48 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); | 48 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | bool checked; | 51 | bool checked; |
52 | QString sortKey; | 52 | QString sortKey; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | class ComboItem : public QTableItem | 55 | class ComboItem : public QTableItem |
56 | { | 56 | { |
57 | public: | 57 | public: |
58 | ComboItem( QTable *t, EditType et ); | 58 | ComboItem( QTable *t, EditType et ); |
59 | QWidget *createEditor() const; | 59 | QWidget *createEditor() const; |
60 | void setContentFromEditor( QWidget *w ); | 60 | void setContentFromEditor( QWidget *w ); |
61 | void setText( const QString &s ); | 61 | void setText( const QString &s ); |
62 | int alignment() const { return Qt::AlignCenter; } | 62 | int alignment() const { return Qt::AlignCenter; } |
63 | 63 | ||
64 | QString text() const; | 64 | QString text() const; |
65 | 65 | ||
66 | private: | 66 | private: |
67 | QGuardedPtr<QComboBox> cb; | 67 | QGuardedPtr<QComboBox> cb; |
68 | 68 | ||
69 | }; | 69 | }; |
70 | 70 | ||
71 | class TodoTextItem : public QTableItem | 71 | class TodoTextItem : public QTableItem |
72 | { | 72 | { |
73 | public: | 73 | public: |
74 | TodoTextItem( QTable *t, const QString & str ) | 74 | TodoTextItem( QTable *t, const QString & str ) |
75 | :QTableItem( t, QTableItem::Never, str ) {} | 75 | :QTableItem( t, QTableItem::Never, str ) {} |
76 | 76 | ||
77 | QString key () const { return Qtopia::buildSortKey( text() ); } | 77 | QString key () const { return Qtopia::buildSortKey( text() ); } |
78 | }; | 78 | }; |
79 | 79 | ||
80 | class DueTextItem : public QTableItem | 80 | class DueTextItem : public QTableItem |
81 | { | 81 | { |
82 | public: | 82 | public: |
83 | DueTextItem( QTable *t, ToDoEvent *ev ); | 83 | DueTextItem( QTable *t, ToDoEvent *ev ); |
84 | QString key() const; | 84 | QString key() const; |
85 | void setToDoEvent( const ToDoEvent *ev ); | 85 | void setToDoEvent( const ToDoEvent *ev ); |
86 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); | 86 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); |
87 | private: | 87 | private: |
88 | int m_off; | 88 | int m_off; |
89 | bool m_hasDate:1; | 89 | bool m_hasDate:1; |
90 | bool m_completed:1; | 90 | bool m_completed:1; |
91 | 91 | ||
92 | }; | 92 | }; |
93 | 93 | ||
94 | 94 | ||
95 | enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE }; | 95 | enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE }; |
96 | 96 | ||
97 | namespace Opie | 97 | namespace Opie |
98 | { | 98 | { |
99 | class XMLElement; | 99 | class XMLElement; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | class TodoTable : public QTable | 102 | class TodoTable : public QTable |
103 | { | 103 | { |
104 | Q_OBJECT | 104 | Q_OBJECT |
105 | 105 | ||
106 | public: | 106 | public: |
107 | TodoTable( QWidget *parent = 0, const char * name = 0 ); | 107 | TodoTable( QWidget *parent = 0, const char * name = 0 ); |
108 | void addEntry( const ToDoEvent &todo ); | 108 | void addEntry( const ToDoEvent &todo ); |
109 | void clearFindRow() { currFindRow = -2; } | 109 | void clearFindRow() { currFindRow = -2; } |
110 | 110 | ||
111 | ToDoEvent currentEntry() const; | 111 | ToDoEvent currentEntry() const; |
112 | void replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem = false ); | 112 | void replaceCurrentEntry( const ToDoEvent &todo, bool fromTableItem = false ); |
113 | 113 | ||
114 | QStringList categories(); | 114 | QStringList categories(); |
115 | 115 | ||
116 | void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); } | 116 | void setShowCompleted( bool sc ) { showComp = sc; updateVisible(); } |
117 | bool showCompleted() const { return showComp; } | 117 | bool showCompleted() const { return showComp; } |
118 | 118 | ||
119 | void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();} | 119 | void setShowDeadline (bool sd) {showDeadl = sd; updateVisible();} |
120 | bool showDeadline() const { return showDeadl;} | 120 | bool showDeadline() const { return showDeadl;} |
121 | 121 | ||
122 | void setShowCategory( const QString &c ) { showCat = c; updateVisible(); } | 122 | void setShowCategory( const QString &c ) { showCat = c; updateVisible(); } |
123 | const QString &showCategory() const { return showCat; } | 123 | const QString &showCategory() const { return showCat; } |
124 | int showCategoryId() const; | 124 | int showCategoryId() const; |
125 | 125 | ||
126 | bool save( const QString &fn ); | 126 | bool save( const QString &fn ); |
127 | void load( const QString &fn ); | 127 | void load( const QString &fn ); |
128 | void applyJournal( ); | 128 | void applyJournal( ); |
129 | void clear(); | 129 | void clear(); |
130 | void removeCurrentEntry(); | 130 | void removeCurrentEntry(); |
131 | void removeAllEntries() { clear(); }; | 131 | void removeAllEntries() { clear(); }; |
132 | //void removeAllEntriesInCategory(const QString &category ); | 132 | //void removeAllEntriesInCategory(const QString &category ); |
133 | 133 | ||
134 | void setPaintingEnabled( bool e ); | 134 | void setPaintingEnabled( bool e ); |
135 | 135 | ||
136 | virtual void sortColumn( int col, bool ascending, bool /*wholeRows*/ ); | 136 | virtual void sortColumn( int col, bool ascending, bool /*wholeRows*/ ); |
137 | 137 | ||
138 | // int rowHeight( int ) const; | 138 | // int rowHeight( int ) const; |
139 | // int rowPos( int row ) const; | 139 | // int rowPos( int row ) const; |
140 | // virtual int rowAt( int pos ) const; | 140 | // virtual int rowAt( int pos ) const; |
141 | 141 | ||
142 | signals: | 142 | signals: |
143 | void signalEdit(); | 143 | void signalEdit(); |
144 | void signalDoneChanged( bool b ); | 144 | void signalDoneChanged( bool b ); |
145 | void signalPriorityChanged( int i ); | 145 | void signalPriorityChanged( int i ); |
146 | void signalShowMenu( const QPoint & ); | 146 | void signalShowMenu( const QPoint & ); |
147 | void signalNotFound(); | 147 | void signalNotFound(); |
148 | void signalWrapAround(); | 148 | void signalWrapAround(); |
149 | void showDetails( const ToDoEvent & ); | 149 | void showDetails( const ToDoEvent & ); |
150 | protected: | 150 | protected: |
151 | void keyPressEvent( QKeyEvent *e ); | 151 | void keyPressEvent( QKeyEvent *e ); |
152 | 152 | ||
153 | private: | 153 | private: |
154 | void updateVisible(); | 154 | void updateVisible(); |
155 | void viewportPaintEvent( QPaintEvent * ); | 155 | void viewportPaintEvent( QPaintEvent * ); |
156 | void internalAddEntries( QList<ToDoEvent> &list); | 156 | void internalAddEntries( QList<ToDoEvent> &list); |
157 | inline void insertIntoTable( ToDoEvent *todo, int row ); | 157 | inline void insertIntoTable( ToDoEvent *todo, int row ); |
158 | void updateJournal( const ToDoEvent &todo, journal_action action); | 158 | void updateJournal( const ToDoEvent &todo, journal_action action); |
159 | void mergeJournal(); | 159 | void mergeJournal(); |
160 | void journalFreeReplaceEntry( const ToDoEvent &todo, int row ); | 160 | void journalFreeReplaceEntry( const ToDoEvent &todo, int row ); |
161 | void journalFreeRemoveEntry( int row ); | 161 | void journalFreeRemoveEntry( int row ); |
162 | inline void realignTable( int row ); | 162 | inline void realignTable( int row ); |
163 | void loadFile( const QString &strFile); | 163 | void loadFile( const QString &strFile); |
164 | 164 | ||
165 | private slots: | 165 | private slots: |
166 | void slotClicked( int row, int col, int button, const QPoint &pos ); | 166 | void slotClicked( int row, int col, int button, const QPoint &pos ); |
167 | void slotPressed( int row, int col, int button, const QPoint &pos ); | 167 | void slotPressed( int row, int col, int button, const QPoint &pos ); |
168 | void slotCheckPriority(int row, int col ); | 168 | void slotCheckPriority(int row, int col ); |
169 | void slotCurrentChanged(int row, int col ); | 169 | void slotCurrentChanged(int row, int col ); |
170 | void slotDoFind( const QString &findString, bool caseSensetive, | 170 | void slotDoFind( const QString &findString, bool caseSensetive, |
171 | bool backwards, int category ); | 171 | bool backwards, int category ); |
172 | void slotShowMenu(); | 172 | void slotShowMenu(); |
173 | void rowHeightChanged( int row ); | 173 | void rowHeightChanged( int row ); |
174 | void slotCheckDay(); // check the day | 174 | void slotCheckDay(); // check the day |
175 | 175 | ||
176 | private: | 176 | private: |
177 | friend class TodoWindow; | 177 | friend class TodoWindow; |
178 | 178 | ||
179 | QMap<CheckItem*, ToDoEvent *> todoList; | 179 | QMap<CheckItem*, ToDoEvent *> todoList; |
180 | QStringList categoryList; | 180 | QStringList categoryList; |
181 | bool showComp; | 181 | bool showComp; |
182 | QString showCat; | 182 | QString showCat; |
183 | QTimer *menuTimer; | 183 | QTimer *menuTimer; |
184 | QDate mDay; | 184 | QDate mDay; |
185 | QTimer *mDayTimer; // see if the day changed | 185 | QTimer *mDayTimer; // see if the day changed |
186 | bool enablePainting; | 186 | bool enablePainting; |
187 | Categories mCat; | 187 | Categories mCat; |
188 | int currFindRow; | 188 | int currFindRow; |
189 | bool showDeadl:1; | 189 | bool showDeadl:1; |
190 | }; | 190 | }; |
191 | 191 | ||
192 | 192 | ||
193 | inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) | 193 | inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) |
194 | { | 194 | { |
195 | QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A') | 195 | int rows = numRows(); |
196 | + todo->priority() ) | 196 | ++rows; |
197 | setNumRows( rows ); | ||
198 | QString sortKey = (char) ((todo->isCompleted() ? 'a' : 'A') | ||
199 | + todo->priority() ) | ||
197 | + Qtopia::buildSortKey( todo->description() ); | 200 | + Qtopia::buildSortKey( todo->description() ); |
198 | CheckItem *chk = new CheckItem( this, sortKey ); | 201 | CheckItem *chk = new CheckItem( this, sortKey ); |
199 | chk->setChecked( todo->isCompleted() ); | 202 | chk->setChecked( todo->isCompleted() ); |
200 | ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent ); | 203 | ComboItem *cmb = new ComboItem( this, QTableItem::WhenCurrent ); |
201 | cmb->setText( QString::number( todo->priority() ) ); | 204 | cmb->setText( QString::number( todo->priority() ) ); |
202 | QString sum = todo->summary(); | 205 | QString sum = todo->summary(); |
203 | QTableItem *ti = new TodoTextItem( this, sum.isEmpty() ? todo->description().left(40).simplifyWhiteSpace() : sum ); | 206 | QTableItem *ti = new TodoTextItem( this, sum.isEmpty() ? todo->description().left(40).simplifyWhiteSpace() : sum ); |
204 | ti->setReplaceable( false ); | 207 | ti->setReplaceable( false ); |
205 | 208 | ||
206 | DueTextItem *due = new DueTextItem(this, todo ); | 209 | DueTextItem *due = new DueTextItem(this, todo ); |
207 | setItem( row, 3, due); | 210 | setItem( row, 3, due); |
208 | 211 | ||
209 | setItem( row, 0, chk ); | 212 | setItem( row, 0, chk ); |
210 | setItem( row, 1, cmb ); | 213 | setItem( row, 1, cmb ); |
211 | setItem( row, 2, ti ); | 214 | setItem( row, 2, ti ); |
212 | 215 | ||
213 | 216 | ||
214 | todoList.insert( chk, todo ); | 217 | todoList.insert( chk, todo ); |
215 | } | 218 | } |
216 | 219 | ||
217 | inline void TodoTable::realignTable( int row ) | 220 | inline void TodoTable::realignTable( int row ) |
218 | { | 221 | { |
219 | QTableItem *ti1, | 222 | QTableItem *ti1, |
220 | *ti2, | 223 | *ti2, |
221 | *ti3, | 224 | *ti3, |
222 | *ti4; | 225 | *ti4; |
223 | int totalRows = numRows(); | 226 | int totalRows = numRows(); |
224 | for ( int curr = row; curr < totalRows - 1; curr++ ) { | 227 | for ( int curr = row; curr < totalRows - 1; curr++ ) { |
225 | // this is bad, we must take the item out and then | 228 | // this is bad, we must take the item out and then |
226 | // set it. In the end, it behaves no worse (time wise) | 229 | // set it. In the end, it behaves no worse (time wise) |
227 | // then the old way of saving the entries to file, clearing | 230 | // then the old way of saving the entries to file, clearing |
228 | // the table re-reading in the file and resetting the table | 231 | // the table re-reading in the file and resetting the table |
229 | ti1 = item( curr + 1, 0 ); | 232 | ti1 = item( curr + 1, 0 ); |
230 | ti2 = item( curr + 1, 1 ); | 233 | ti2 = item( curr + 1, 1 ); |
231 | ti3 = item( curr + 1, 2 ); | 234 | ti3 = item( curr + 1, 2 ); |
232 | ti4 = item( curr + 1, 3 ); | 235 | ti4 = item( curr + 1, 3 ); |
233 | takeItem( ti1 ); | 236 | takeItem( ti1 ); |
234 | takeItem( ti2 ); | 237 | takeItem( ti2 ); |
235 | takeItem( ti3 ); | 238 | takeItem( ti3 ); |
236 | takeItem( ti4 ); | 239 | takeItem( ti4 ); |
237 | setItem( curr, 0, ti1 ); | 240 | setItem( curr, 0, ti1 ); |
238 | setItem( curr, 1, ti2 ); | 241 | setItem( curr, 1, ti2 ); |
239 | setItem( curr, 2, ti3 ); | 242 | setItem( curr, 2, ti3 ); |
240 | setItem( curr, 3, ti4 ); | 243 | setItem( curr, 3, ti4 ); |
241 | } | 244 | } |
242 | setNumRows( totalRows - 1 ); | 245 | setNumRows( totalRows - 1 ); |
243 | } | 246 | } |
244 | 247 | ||
245 | #endif | 248 | #endif |