summaryrefslogtreecommitdiff
path: root/core/pim/today
authorzecke <zecke>2005-06-27 17:50:15 (UTC)
committer zecke <zecke>2005-06-27 17:50:15 (UTC)
commit0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8 (patch) (unidiff)
treeab7169403134f8171a454e053f2e34c6fd30eede /core/pim/today
parentcc4771f193215827036689291d9d3d74d2cbef3f (diff)
downloadopie-0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8.zip
opie-0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8.tar.gz
opie-0c99f2087c4d5a1cab6c2bd1083d6db3f2a4cae8.tar.bz2
Sort by Anniversary and Birthday
Patch courtsey Marcin Juszkiewicz
Diffstat (limited to 'core/pim/today') (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
@@ -113,12 +113,17 @@ void AddressBookPluginWidget::getAddress() {
113 Opie::OPimContactAccess::DateDiff ); 113 Opie::OPimContactAccess::DateDiff );
114 if ( m_list.count() > 0 ){ 114 if ( m_list.count() > 0 ){
115 output = "<font color=" + m_headlineColor + ">" 115 output = "<font color=" + m_headlineColor + ">"
116 + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) 116 + QObject::tr( "Next birthdays in <b> %1 </b> days:" )
117 .arg( m_daysLookAhead ) 117 .arg( m_daysLookAhead )
118 + "</font> <br>"; 118 + "</font> <br>";
119
120 // Sort filtered results
121 m_list = m_contactdb->sorted( m_list, true, Opie::OPimContactAccess::SortBirthday,
122 Opie::OPimContactAccess::FilterOff, NULL );
123
119 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 124 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
120 if ( ammount++ < m_maxLinesTask ){ 125 if ( ammount++ < m_maxLinesTask ){
121 // Now we want to calculate how many days 126 // Now we want to calculate how many days
122 //until birthday. We have to set 127 //until birthday. We have to set
123 // the correct year to calculate the day diff... 128 // the correct year to calculate the day diff...
124 QDate destdate = (*m_it).birthday(); 129 QDate destdate = (*m_it).birthday();
@@ -165,12 +170,17 @@ void AddressBookPluginWidget::getAddress() {
165 ammount = 0; 170 ammount = 0;
166 if ( m_list.count() > 0 ){ 171 if ( m_list.count() > 0 ){
167 output += "<font color=" + m_headlineColor + ">" 172 output += "<font color=" + m_headlineColor + ">"
168 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) 173 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" )
169 .arg( m_daysLookAhead ) 174 .arg( m_daysLookAhead )
170 + "</font> <br>"; 175 + "</font> <br>";
176
177 // Sort filtered results
178 m_list = m_contactdb->sorted( m_list, true, Opie::OPimContactAccess::SortAnniversary,
179 Opie::OPimContactAccess::FilterOff, NULL );
180
171 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 181 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
172 if ( ammount++ < m_maxLinesTask ){ 182 if ( ammount++ < m_maxLinesTask ){
173 // Now we want to calculate how many days until anniversary. 183 // Now we want to calculate how many days until anniversary.
174 // We have to set the correct year to calculate the day diff... 184 // We have to set the correct year to calculate the day diff...
175 QDate destdate = (*m_it).anniversary(); 185 QDate destdate = (*m_it).anniversary();
176 destdate.setYMD( QDate::currentDate().year(), destdate.month(), 186 destdate.setYMD( QDate::currentDate().year(), destdate.month(),