summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/addressbook.cpp2
-rw-r--r--core/pim/addressbook/contacteditor.cpp12
-rw-r--r--core/pim/todo/todotable.h11
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
@@ -508,49 +508,49 @@ static void parseName( const QString& name, QString *first, QString *middle,
508 } 508 }
509 509
510} 510}
511 511
512 512
513void AddressbookWindow::appMessage(const QCString &msg, const QByteArray &data) 513void 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();
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
@@ -90,49 +90,49 @@ void ContactEditor::init() {
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" ) ) {
@@ -170,49 +170,49 @@ void ContactEditor::init() {
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" ) ) {
@@ -249,49 +249,49 @@ void ContactEditor::init() {
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 }
@@ -1013,49 +1013,49 @@ void ContactEditor::accept() {
1013 QDialog::accept(); 1013 QDialog::accept();
1014 } 1014 }
1015 1015
1016} 1016}
1017 1017
1018void ContactEditor::slotNote() { 1018void 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
1026void ContactEditor::slotName() { 1026void 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
1046void ContactEditor::setNameFocus() { 1046void ContactEditor::setNameFocus() {
1047 1047
1048 txtFullName->setFocus(); 1048 txtFullName->setFocus();
1049 1049
1050} 1050}
1051 1051
1052bool ContactEditor::isEmpty() { 1052bool 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 ) )
@@ -1396,49 +1396,49 @@ void ContactEditor::setEntry( const Contact &entry ) {
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();
@@ -1597,49 +1597,49 @@ void ContactEditor::saveEntry() {
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") )
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
@@ -50,49 +50,49 @@ public:
50private: 50private:
51 bool checked; 51 bool checked;
52 QString sortKey; 52 QString sortKey;
53}; 53};
54 54
55class ComboItem : public QTableItem 55class ComboItem : public QTableItem
56{ 56{
57public: 57public:
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
66private: 66private:
67 QGuardedPtr<QComboBox> cb; 67 QGuardedPtr<QComboBox> cb;
68 68
69}; 69};
70 70
71class TodoTextItem : public QTableItem 71class TodoTextItem : public QTableItem
72{ 72{
73public: 73public:
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
80class DueTextItem : public QTableItem 80class 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
95enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE }; 95enum journal_action { ACTION_ADD=0, ACTION_REMOVE, ACTION_REPLACE };
96 96
97namespace Opie 97namespace Opie
98{ 98{
@@ -171,62 +171,65 @@ private slots:
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
176private: 176private:
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
193inline void TodoTable::insertIntoTable( ToDoEvent *todo, int row ) 193inline 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
217inline void TodoTable::realignTable( int row ) 220inline 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 );