author | eilers <eilers> | 2002-10-27 16:18:51 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-27 16:18:51 (UTC) |
commit | cc01384d8c2b421d5f455f32631d8c2ec4b7e844 (patch) (side-by-side diff) | |
tree | 0917ecf78c54b17620a583e584198881db24fee2 | |
parent | 5f09fc992af19fc208315217eb46635a762f1e55 (diff) | |
download | opie-cc01384d8c2b421d5f455f32631d8c2ec4b7e844.zip opie-cc01384d8c2b421d5f455f32631d8c2ec4b7e844.tar.gz opie-cc01384d8c2b421d5f455f32631d8c2ec4b7e844.tar.bz2 |
OContact now uses QDate to avoid wrong interpreted strings
A lot of inline functions moved into the library..
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 5 | ||||
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 34 |
2 files changed, 20 insertions, 19 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index 4feadeb..5222f16 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp @@ -21,12 +21,13 @@ #define QTOPIA_INTERNAL_CONTACT_MRE #include <qpe/categoryselect.h> #include <qpe/config.h> #include <qpe/stringutil.h> #include <qpe/qcopenvelope_qws.h> +#include <qpe/timestring.h> #include <opie/orecordlist.h> #include <qasciidict.h> #include <qdatetime.h> #include <qfile.h> @@ -447,16 +448,16 @@ QString AbTable::findContactContact( const OContact &entry, int /* row */ ) value = entry.spouse(); break; case Qtopia::Gender: value = entry.gender(); break; case Qtopia::Birthday: - value = entry.birthday(); + value = TimeString::numberDateString( entry.birthday() ); break; case Qtopia::Anniversary: - value = entry.anniversary(); + value = TimeString::numberDateString( entry.anniversary() ); break; case Qtopia::Nickname: value = entry.nickname(); break; case Qtopia::Children: value = entry.children(); diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 52ab0f2..e034b35 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -1,8 +1,9 @@ /* * Copyright (c) 2002 Michael R. Crawford <mike@tuxnami.org> + * Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) * * This file is an add-on for the OPIE Palmtop Environment * * This file may be distributed and/or modified under the terms of the * GNU General Public License version 2 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included in the pacakaging @@ -1105,26 +1106,12 @@ void ContactEditor::loadFields() { if ( *it == "Nickname" ) (*lit)->setText( tr( "Nickname" ) ); if ( *it == "Children" ) (*lit)->setText( tr( "Children" ) ); } - // Set DatePicker - qWarning ("**Info: %s", ent.birthday().latin1() ); - if ( !ent.birthday().isEmpty() ){ - birthdayButton->setText( ent.birthday() ); - birthdayPicker->setDate( TimeConversion::fromString ( ent.birthday() ) ); - } else - birthdayButton->setText( tr ("Unknown") ); - - qWarning ("**Info: %s", ent.anniversary().latin1() ); - if ( !ent.anniversary().isEmpty() ){ - anniversaryButton->setText( ent.anniversary() ); - anniversaryPicker->setDate( TimeConversion::fromString ( ent.birthday() ) ); - } else - anniversaryButton->setText( tr ("Unknown") ); } void ContactEditor::accept() { if ( isEmpty() ) { @@ -1598,13 +1585,26 @@ void ContactEditor::setEntry( const OContact &entry ) { slotCmbChooser1Change( cmbChooserField1->currentItem() ); slotCmbChooser2Change( cmbChooserField2->currentItem() ); slotCmbChooser3Change( cmbChooserField3->currentItem() ); slotAddressTypeChange( cmbAddress->currentItem() ); - loadFields(); + // loadFields(); :SX + + // Set DatePicker + if ( !ent.birthday().isNull() ){ + birthdayButton->setText( TimeString::numberDateString( ent.birthday() ) ); + birthdayPicker->setDate( ent.birthday() ); + } else + birthdayButton->setText( tr ("Unknown") ); + + if ( !ent.anniversary().isNull() ){ + anniversaryButton->setText( TimeString::numberDateString( ent.anniversary() ) ); + anniversaryPicker->setDate( ent.anniversary() ); + } else + anniversaryButton->setText( tr ("Unknown") ); } void ContactEditor::saveEntry() { if ( useFullName == TRUE ) { @@ -1888,17 +1888,17 @@ void ContactEditor::setPersonalView( bool personal ) void ContactEditor::slotAnniversaryDateChanged( int year, int month, int day) { QDate date; date.setYMD( year, month, day ); QString dateString = TimeString::numberDateString( date ); anniversaryButton->setText( dateString ); - ent.setAnniversary ( dateString ); + ent.setAnniversary ( date ); } void ContactEditor::slotBirthdayDateChanged( int year, int month, int day) { QDate date; date.setYMD( year, month, day ); QString dateString = TimeString::numberDateString( date ); birthdayButton->setText( dateString ); - ent.setBirthday ( dateString ); + ent.setBirthday ( date ); } |