summaryrefslogtreecommitdiff
authorzecke <zecke>2005-06-27 17:50:15 (UTC)
committer zecke <zecke>2005-06-27 17:50:15 (UTC)
commit0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8 (patch) (side-by-side diff)
treeab7169403134f8171a454e053f2e34c6fd30eede
parentcc4771f193215827036689291d9d3d74d2cbef3f (diff)
downloadopie-0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8.zip
opie-0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8.tar.gz
opie-0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8.tar.bz2
Sort by Anniversary and Birthday
Patch courtsey Marcin Juszkiewicz
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
index 5662af2..75bf474 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -111,16 +111,21 @@ void AddressBookPluginWidget::getAddress() {
m_list = m_contactdb->queryByExample( querybirthdays,
Opie::OPimContactAccess::DateDiff );
if ( m_list.count() > 0 ){
output = "<font color=" + m_headlineColor + ">"
+ QObject::tr( "Next birthdays in <b> %1 </b> days:" )
.arg( m_daysLookAhead )
+ "</font> <br>";
+
+ // Sort filtered results
+ m_list = m_contactdb->sorted( m_list, true, Opie::OPimContactAccess::SortBirthday,
+ Opie::OPimContactAccess::FilterOff, NULL );
+
for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
if ( ammount++ < m_maxLinesTask ){
// Now we want to calculate how many days
//until birthday. We have to set
// the correct year to calculate the day diff...
QDate destdate = (*m_it).birthday();
destdate.setYMD( QDate::currentDate().year(),
destdate.month(), destdate.day() );
@@ -163,16 +168,21 @@ void AddressBookPluginWidget::getAddress() {
m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff );
ammount = 0;
if ( m_list.count() > 0 ){
output += "<font color=" + m_headlineColor + ">"
+ QObject::tr( "Next anniversaries in <b> %1 </b> days:" )
.arg( m_daysLookAhead )
+ "</font> <br>";
+
+ // Sort filtered results
+ m_list = m_contactdb->sorted( m_list, true, Opie::OPimContactAccess::SortAnniversary,
+ Opie::OPimContactAccess::FilterOff, NULL );
+
for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
if ( ammount++ < m_maxLinesTask ){
// Now we want to calculate how many days until anniversary.
// We have to set the correct year to calculate the day diff...
QDate destdate = (*m_it).anniversary();
destdate.setYMD( QDate::currentDate().year(), destdate.month(),
destdate.day() );
if ( QDate::currentDate().daysTo(destdate) < 0 )