summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (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
@@ -95,48 +95,53 @@ void AddressBookPluginWidget::getAddress() {
95 addressLabel->setText( output ); 95 addressLabel->setText( output );
96 return; 96 return;
97 } 97 }
98 98
99 // Define the query for birthdays and start search.. 99 // Define the query for birthdays and start search..
100 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); 100 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead );
101 int ammount = 0; 101 int ammount = 0;
102 if ( m_showBirthdays ){ 102 if ( m_showBirthdays ){
103 owarn << "Searching from now (" << QDate::currentDate().toString() << ") until " 103 owarn << "Searching from now (" << QDate::currentDate().toString() << ") until "
104 << lookAheadDate.toString() << " ! " << oendl; 104 << lookAheadDate.toString() << " ! " << oendl;
105 105
106 if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ 106 if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){
107 107
108 108
109 Opie::OPimContact querybirthdays; 109 Opie::OPimContact querybirthdays;
110 querybirthdays.setBirthday( lookAheadDate ); 110 querybirthdays.setBirthday( lookAheadDate );
111 111
112 m_list = m_contactdb->queryByExample( querybirthdays, 112 m_list = m_contactdb->queryByExample( querybirthdays,
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();
125 destdate.setYMD( QDate::currentDate().year(), 130 destdate.setYMD( QDate::currentDate().year(),
126 destdate.month(), destdate.day() ); 131 destdate.month(), destdate.day() );
127 if ( QDate::currentDate().daysTo(destdate) < 0 ) 132 if ( QDate::currentDate().daysTo(destdate) < 0 )
128 destdate.setYMD( QDate::currentDate().year()+1, 133 destdate.setYMD( QDate::currentDate().year()+1,
129 destdate.month(), destdate.day() ); 134 destdate.month(), destdate.day() );
130 135
131 136
132 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 137 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
133 output += "<font color=" + m_urgentColor + "><b>-" 138 output += "<font color=" + m_urgentColor + "><b>-"
134 + (*m_it).fullName() 139 + (*m_it).fullName()
135 + " (" 140 + " ("
136 + QString::number(QDate::currentDate() 141 + QString::number(QDate::currentDate()
137 .daysTo(destdate)) 142 .daysTo(destdate))
138 + " Days) </b></font><br>"; 143 + " Days) </b></font><br>";
139 144
140 else 145 else
141 output += "<font color=" + m_entryColor + "><b>-" 146 output += "<font color=" + m_entryColor + "><b>-"
142 + (*m_it).fullName() 147 + (*m_it).fullName()
@@ -147,48 +152,53 @@ void AddressBookPluginWidget::getAddress() {
147 } 152 }
148 } 153 }
149 } else { 154 } else {
150 output = "<font color=" + m_headlineColor + ">" 155 output = "<font color=" + m_headlineColor + ">"
151 + QObject::tr( "No birthdays in <b> %1 </b> days!" ) 156 + QObject::tr( "No birthdays in <b> %1 </b> days!" )
152 .arg( m_daysLookAhead ) 157 .arg( m_daysLookAhead )
153 + "</font> <br>"; 158 + "</font> <br>";
154 } 159 }
155 } 160 }
156 } 161 }
157 162
158 if ( m_showAnniversaries ){ 163 if ( m_showAnniversaries ){
159 // Define the query for anniversaries and start search.. 164 // Define the query for anniversaries and start search..
160 Opie::OPimContact queryanniversaries; 165 Opie::OPimContact queryanniversaries;
161 queryanniversaries.setAnniversary( lookAheadDate ); 166 queryanniversaries.setAnniversary( lookAheadDate );
162 167
163 m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff ); 168 m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff );
164 169
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(),
177 destdate.day() ); 187 destdate.day() );
178 if ( QDate::currentDate().daysTo(destdate) < 0 ) 188 if ( QDate::currentDate().daysTo(destdate) < 0 )
179 destdate.setYMD( QDate::currentDate().year()+1, 189 destdate.setYMD( QDate::currentDate().year()+1,
180 destdate.month(), destdate.day() ); 190 destdate.month(), destdate.day() );
181 191
182 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 192 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
183 output += "<font color=" + m_urgentColor + "><b>-" 193 output += "<font color=" + m_urgentColor + "><b>-"
184 + (*m_it).fullName() 194 + (*m_it).fullName()
185 + " (" 195 + " ("
186 + QString::number(QDate::currentDate() 196 + QString::number(QDate::currentDate()
187 .daysTo( destdate ) ) 197 .daysTo( destdate ) )
188 + " Days) </b></font><br>"; 198 + " Days) </b></font><br>";
189 else 199 else
190 output += "<font color=" + m_entryColor + "><b>-" 200 output += "<font color=" + m_entryColor + "><b>-"
191 + (*m_it).fullName() 201 + (*m_it).fullName()
192 + " (" 202 + " ("
193 + QString::number(QDate::currentDate() 203 + QString::number(QDate::currentDate()
194 .daysTo( destdate ) ) 204 .daysTo( destdate ) )