-rw-r--r-- | kabc/field.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kabc/field.cpp b/kabc/field.cpp index 7c6d7a9..203f696 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp | |||
@@ -28,16 +28,18 @@ $Id$ | |||
28 | 28 | ||
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | #include <kconfigbase.h> | 31 | #include <kconfigbase.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | 33 | ||
34 | #include "field.h" | 34 | #include "field.h" |
35 | #include "resource.h" | 35 | #include "resource.h" |
36 | //Added by qt3to4: | ||
37 | #include <Q3ValueList> | ||
36 | 38 | ||
37 | using namespace KABC; | 39 | using namespace KABC; |
38 | 40 | ||
39 | class Field::FieldImpl | 41 | class Field::FieldImpl |
40 | { | 42 | { |
41 | public: | 43 | public: |
42 | FieldImpl( int fieldId, int category = 0, | 44 | FieldImpl( int fieldId, int category = 0, |
43 | const QString &label = QString::null, | 45 | const QString &label = QString::null, |
@@ -372,17 +374,17 @@ bool Field::setValue( KABC::Addressee &a, const QString &value ) | |||
372 | a.setNote( value ); | 374 | a.setNote( value ); |
373 | return true; | 375 | return true; |
374 | case FieldImpl::Birthday: | 376 | case FieldImpl::Birthday: |
375 | //US | 377 | //US |
376 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); | 378 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); |
377 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? | 379 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? |
378 | { | 380 | { |
379 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate | 381 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate |
380 | a.setBirthday(dt); | 382 | a.setBirthday((QDateTime)dt); |
381 | } | 383 | } |
382 | return true; | 384 | return true; |
383 | case FieldImpl::CustomField: | 385 | case FieldImpl::CustomField: |
384 | a.insertCustom( mImpl->app(), mImpl->key(), value ); | 386 | a.insertCustom( mImpl->app(), mImpl->key(), value ); |
385 | //US never copy the resourcename back to the adressee. | 387 | //US never copy the resourcename back to the adressee. |
386 | case FieldImpl::Resource: | 388 | case FieldImpl::Resource: |
387 | default: | 389 | default: |
388 | return false; | 390 | return false; |
@@ -488,17 +490,17 @@ void Field::saveFields( const QString &identifier, | |||
488 | KConfig *cfg = KGlobal::config(); | 490 | KConfig *cfg = KGlobal::config(); |
489 | KConfigGroupSaver( cfg, "KABCFields" ); | 491 | KConfigGroupSaver( cfg, "KABCFields" ); |
490 | saveFields( cfg, identifier, fields ); | 492 | saveFields( cfg, identifier, fields ); |
491 | } | 493 | } |
492 | 494 | ||
493 | void Field::saveFields( KConfig *cfg, const QString &identifier, | 495 | void Field::saveFields( KConfig *cfg, const QString &identifier, |
494 | const Field::List &fields ) | 496 | const Field::List &fields ) |
495 | { | 497 | { |
496 | QValueList<int> fieldIds; | 498 | Q3ValueList<int> fieldIds; |
497 | 499 | ||
498 | //US | 500 | //US |
499 | // qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); | 501 | // qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); |
500 | 502 | ||
501 | int custom = 0; | 503 | int custom = 0; |
502 | Field::List::ConstIterator it; | 504 | Field::List::ConstIterator it; |
503 | for( it = fields.begin(); it != fields.end(); ++it ) { | 505 | for( it = fields.begin(); it != fields.end(); ++it ) { |
504 | //US | 506 | //US |
@@ -528,24 +530,24 @@ Field::List Field::restoreFields( const QString &identifier ) | |||
528 | 530 | ||
529 | Field::List l = restoreFields( cfg, identifier ); | 531 | Field::List l = restoreFields( cfg, identifier ); |
530 | 532 | ||
531 | return l; | 533 | return l; |
532 | } | 534 | } |
533 | 535 | ||
534 | Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) | 536 | Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) |
535 | { | 537 | { |
536 | QValueList<int> fieldIds = cfg->readIntListEntry( identifier); | 538 | Q3ValueList<int> fieldIds = cfg->readIntListEntry( identifier); |
537 | //US | 539 | //US |
538 | // qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); | 540 | // qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); |
539 | 541 | ||
540 | Field::List fields; | 542 | Field::List fields; |
541 | 543 | ||
542 | int custom = 0; | 544 | int custom = 0; |
543 | QValueList<int>::ConstIterator it; | 545 | Q3ValueList<int>::ConstIterator it; |
544 | for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { | 546 | for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { |
545 | FieldImpl *f = 0; | 547 | FieldImpl *f = 0; |
546 | if ( (*it) == FieldImpl::CustomField ) { | 548 | if ( (*it) == FieldImpl::CustomField ) { |
547 | QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + | 549 | QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + |
548 | identifier + "_" + | 550 | identifier + "_" + |
549 | QString::number( custom++ ) ); | 551 | QString::number( custom++ ) ); |
550 | f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], | 552 | f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], |
551 | customEntry[ 1 ], customEntry[ 2 ] ); | 553 | customEntry[ 1 ], customEntry[ 2 ] ); |