Review Request 128743: Addressee: Implemented a way to determine if the birthday has been set with a time
Laurent Montel
montel at kde.org
Thu Aug 25 05:52:24 BST 2016
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128743/#review98622
-----------------------------------------------------------
If you change API (new method) please increase PIM_VERSION.
- Laurent Montel
On Aug. 24, 2016, 3:51 p.m., Benni Hill wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128743/
> -----------------------------------------------------------
>
> (Updated Aug. 24, 2016, 3:51 p.m.)
>
>
> Review request for KDEPIM-Libraries and Laurent Montel.
>
>
> Repository: kcontacts
>
>
> Description
> -------
>
> - My aim was to implement a way to determine if there has been set a explicit time with the date of birth and that the time is only exported to a vcard if it has been explicitly specified. Some vcard implementations (e.g. on Android) ignore the birthday field if it comes with a time.
> The problem here is that `QDateTime` (when set with a valid date) always has a valid time (midnight by default). I therefore added the boolean `withTime` to `setBirthday()` which is stored inside `Addressee` and can be queried with `birthdayHasTime()`. I also added `setBirthday(QDate)`.
> I changed `VCardTool` to make use of this new methods when importing/exporting vcards.
> Probably `KContacts::Field` and `KContacts::LDIFConverter` also should be adjusted.
> To make use of this change in KAddressbook, (at least?) akonadi-contatcs has to be adjusted as well (in `PersonalEditorWidget::storeContact()`):
> ```
> --- a/src/editor/personaleditor/personaleditorwidget.cpp
> +++ b/src/editor/personaleditor/personaleditorwidget.cpp
> @@ -83,12 +83,7 @@ void PersonalEditorWidget::loadContact(const KContacts::Addressee &contact)
> void PersonalEditorWidget::storeContact(KContacts::Addressee &contact)
> {
> // dates group
> - QDateTime birthday = QDateTime(mBirthdateWidget->date(), QTime(), contact.birthday().timeSpec());
> - // This is needed because the constructor above sets the time component
> - // of the QDateTime to midnight. We want it to stay invalid.
> - birthday.setTime(QTime());
> -
> - contact.setBirthday(birthday);
> + contact.setBirthday(mBirthdateWidget->date());
> Akonadi::Utils::storeCustom(contact, QStringLiteral("X-Anniversary"), mAnniversaryWidget->date().toString(Qt::ISODate));
>
> // family group
> ```
>
> - Unrelated to this changes I implemented a way in VCardTool to import/export dates without a year. Dates without a year ('--MMdd') are imported as year=-1 and during export, years <= 0 are written as '--'. (This also has to be implemented in the user inteface some where to make any use.)
>
>
> Diffs
> -----
>
> autotests/birthdaytest.h 6535c42
> autotests/birthdaytest.cpp 4c5313b
> autotests/datetimetest.h 329810e
> autotests/datetimetest.cpp 8517f00
> src/addressee.h 4dc0dfd
> src/addressee.cpp 9f4dd2e
> src/vcardtool.h 48890ed
> src/vcardtool.cpp aa5654d
>
> Diff: https://git.reviewboard.kde.org/r/128743/diff/
>
>
> Testing
> -------
>
> Added autotests:
>
> - Exporting birthdays without a time.
> - Importing/Exporting dates without a year.
>
>
> Thanks,
>
> Benni Hill
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20160825/f465ec0c/attachment.html>
More information about the kde-pim
mailing list