Diffstat (limited to 'core/pim/today/plugins/addressbook/addresspluginwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/plugins/addressbook/addresspluginwidget.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp index b0d456d..ea387d6 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp | |||
@@ -19,9 +19,9 @@ | |||
19 | #include "addresspluginwidget.h" | 19 | #include "addresspluginwidget.h" |
20 | 20 | ||
21 | 21 | ||
22 | #include <qpe/config.h> | 22 | #include <opie2/opimcontact.h> |
23 | 23 | ||
24 | #include <opie/ocontact.h> | 24 | #include <qpe/config.h> |
25 | 25 | ||
26 | AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) | 26 | AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) |
27 | : QWidget( parent, name ) { | 27 | : QWidget( parent, name ) { |
@@ -35,10 +35,10 @@ AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* | |||
35 | delete m_contactdb; | 35 | delete m_contactdb; |
36 | } | 36 | } |
37 | 37 | ||
38 | m_contactdb = new OContactAccess("addressplugin"); | 38 | m_contactdb = new Opie::OPimContactAccess("addressplugin"); |
39 | 39 | ||
40 | connect( m_contactdb, SIGNAL( signalChanged(const OContactAccess*) ), | 40 | connect( m_contactdb, SIGNAL( signalChanged(const Opie::OPimContactAccess*) ), |
41 | this, SLOT( refresh(const OContactAccess*) ) ); | 41 | this, SLOT( refresh(const Opie::OPimContactAccess*) ) ); |
42 | 42 | ||
43 | 43 | ||
44 | readConfig(); | 44 | readConfig(); |
@@ -49,7 +49,7 @@ AddressBookPluginWidget::~AddressBookPluginWidget() { | |||
49 | delete m_contactdb; | 49 | delete m_contactdb; |
50 | } | 50 | } |
51 | 51 | ||
52 | void AddressBookPluginWidget::refresh( const OContactAccess* ) | 52 | void AddressBookPluginWidget::refresh( const Opie::OPimContactAccess* ) |
53 | { | 53 | { |
54 | qWarning(" AddressBookPluginWidget::Database was changed externally ! "); | 54 | qWarning(" AddressBookPluginWidget::Database was changed externally ! "); |
55 | m_contactdb->reload(); | 55 | m_contactdb->reload(); |
@@ -86,15 +86,15 @@ void AddressBookPluginWidget::getAddress() { | |||
86 | } | 86 | } |
87 | 87 | ||
88 | if ( ! addressLabel ) { | 88 | if ( ! addressLabel ) { |
89 | addressLabel = new OClickableLabel( this ); | 89 | addressLabel = new Opie::Ui::OClickableLabel( this ); |
90 | connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); | 90 | connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); |
91 | layoutTodo->addWidget( addressLabel ); | 91 | layoutTodo->addWidget( addressLabel ); |
92 | } | 92 | } |
93 | 93 | ||
94 | QString output; | 94 | QString output; |
95 | 95 | ||
96 | // Check whether the database provide the search option.. | 96 | // Check whether the database provide the search option.. |
97 | if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ | 97 | if ( !m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ |
98 | // Libopie seems to be old.. | 98 | // Libopie seems to be old.. |
99 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); | 99 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); |
100 | addressLabel->setText( output ); | 100 | addressLabel->setText( output ); |
@@ -110,14 +110,14 @@ void AddressBookPluginWidget::getAddress() { | |||
110 | lookAheadDate.toString().latin1() ); | 110 | lookAheadDate.toString().latin1() ); |
111 | } | 111 | } |
112 | 112 | ||
113 | if ( m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ | 113 | if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ |
114 | 114 | ||
115 | 115 | ||
116 | OContact querybirthdays; | 116 | Opie::OPimContact querybirthdays; |
117 | querybirthdays.setBirthday( lookAheadDate ); | 117 | querybirthdays.setBirthday( lookAheadDate ); |
118 | 118 | ||
119 | m_list = m_contactdb->queryByExample( querybirthdays, | 119 | m_list = m_contactdb->queryByExample( querybirthdays, |
120 | OContactAccess::DateDiff ); | 120 | Opie::OPimContactAccess::DateDiff ); |
121 | if ( m_list.count() > 0 ){ | 121 | if ( m_list.count() > 0 ){ |
122 | output = "<font color=" + m_headlineColor + ">" | 122 | output = "<font color=" + m_headlineColor + ">" |
123 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) | 123 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) |
@@ -125,31 +125,31 @@ void AddressBookPluginWidget::getAddress() { | |||
125 | + "</font> <br>"; | 125 | + "</font> <br>"; |
126 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 126 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
127 | if ( ammount++ < m_maxLinesTask ){ | 127 | if ( ammount++ < m_maxLinesTask ){ |
128 | // Now we want to calculate how many days | 128 | // Now we want to calculate how many days |
129 | //until birthday. We have to set | 129 | //until birthday. We have to set |
130 | // the correct year to calculate the day diff... | 130 | // the correct year to calculate the day diff... |
131 | QDate destdate = (*m_it).birthday(); | 131 | QDate destdate = (*m_it).birthday(); |
132 | destdate.setYMD( QDate::currentDate().year(), | 132 | destdate.setYMD( QDate::currentDate().year(), |
133 | destdate.month(), destdate.day() ); | 133 | destdate.month(), destdate.day() ); |
134 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 134 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
135 | destdate.setYMD( QDate::currentDate().year()+1, | 135 | destdate.setYMD( QDate::currentDate().year()+1, |
136 | destdate.month(), destdate.day() ); | 136 | destdate.month(), destdate.day() ); |
137 | 137 | ||
138 | 138 | ||
139 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 139 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
140 | output += "<font color=" + m_urgentColor + "><b>-" | 140 | output += "<font color=" + m_urgentColor + "><b>-" |
141 | + (*m_it).fullName() | 141 | + (*m_it).fullName() |
142 | + " (" | 142 | + " (" |
143 | + QString::number(QDate::currentDate() | 143 | + QString::number(QDate::currentDate() |
144 | .daysTo(destdate)) | 144 | .daysTo(destdate)) |
145 | + " Days) </b></font><br>"; | 145 | + " Days) </b></font><br>"; |
146 | 146 | ||
147 | else | 147 | else |
148 | output += "<font color=" + m_entryColor + "><b>-" | 148 | output += "<font color=" + m_entryColor + "><b>-" |
149 | + (*m_it).fullName() | 149 | + (*m_it).fullName() |
150 | + " (" | 150 | + " (" |
151 | + QString::number(QDate::currentDate() | 151 | + QString::number(QDate::currentDate() |
152 | .daysTo(destdate)) | 152 | .daysTo(destdate)) |
153 | + " Days) </b></font><br>"; | 153 | + " Days) </b></font><br>"; |
154 | } | 154 | } |
155 | } | 155 | } |
@@ -160,14 +160,14 @@ void AddressBookPluginWidget::getAddress() { | |||
160 | + "</font> <br>"; | 160 | + "</font> <br>"; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | if ( m_showAnniversaries ){ | 164 | if ( m_showAnniversaries ){ |
165 | // Define the query for anniversaries and start search.. | 165 | // Define the query for anniversaries and start search.. |
166 | OContact queryanniversaries; | 166 | Opie::OPimContact queryanniversaries; |
167 | queryanniversaries.setAnniversary( lookAheadDate ); | 167 | queryanniversaries.setAnniversary( lookAheadDate ); |
168 | 168 | ||
169 | m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff ); | 169 | m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff ); |
170 | 170 | ||
171 | ammount = 0; | 171 | ammount = 0; |
172 | if ( m_list.count() > 0 ){ | 172 | if ( m_list.count() > 0 ){ |
173 | output += "<font color=" + m_headlineColor + ">" | 173 | output += "<font color=" + m_headlineColor + ">" |
@@ -176,33 +176,33 @@ void AddressBookPluginWidget::getAddress() { | |||
176 | + "</font> <br>"; | 176 | + "</font> <br>"; |
177 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 177 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
178 | if ( ammount++ < m_maxLinesTask ){ | 178 | if ( ammount++ < m_maxLinesTask ){ |
179 | // Now we want to calculate how many days until anniversary. | 179 | // Now we want to calculate how many days until anniversary. |
180 | // We have to set the correct year to calculate the day diff... | 180 | // We have to set the correct year to calculate the day diff... |
181 | QDate destdate = (*m_it).anniversary(); | 181 | QDate destdate = (*m_it).anniversary(); |
182 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), | 182 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), |
183 | destdate.day() ); | 183 | destdate.day() ); |
184 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 184 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
185 | destdate.setYMD( QDate::currentDate().year()+1, | 185 | destdate.setYMD( QDate::currentDate().year()+1, |
186 | destdate.month(), destdate.day() ); | 186 | destdate.month(), destdate.day() ); |
187 | 187 | ||
188 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 188 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
189 | output += "<font color=" + m_urgentColor + "><b>-" | 189 | output += "<font color=" + m_urgentColor + "><b>-" |
190 | + (*m_it).fullName() | 190 | + (*m_it).fullName() |
191 | + " (" | 191 | + " (" |
192 | + QString::number(QDate::currentDate() | 192 | + QString::number(QDate::currentDate() |
193 | .daysTo( destdate ) ) | 193 | .daysTo( destdate ) ) |
194 | + " Days) </b></font><br>"; | 194 | + " Days) </b></font><br>"; |
195 | else | 195 | else |
196 | output += "<font color=" + m_entryColor + "><b>-" | 196 | output += "<font color=" + m_entryColor + "><b>-" |
197 | + (*m_it).fullName() | 197 | + (*m_it).fullName() |
198 | + " (" | 198 | + " (" |
199 | + QString::number(QDate::currentDate() | 199 | + QString::number(QDate::currentDate() |
200 | .daysTo( destdate ) ) | 200 | .daysTo( destdate ) ) |
201 | + " Days) </b></font><br>"; | 201 | + " Days) </b></font><br>"; |
202 | } | 202 | } |
203 | } | 203 | } |
204 | } else { | 204 | } else { |
205 | output += "<font color=" + m_headlineColor + ">" | 205 | output += "<font color=" + m_headlineColor + ">" |
206 | + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) | 206 | + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) |
207 | .arg( m_daysLookAhead ) | 207 | .arg( m_daysLookAhead ) |
208 | + "</font> <br>"; | 208 | + "</font> <br>"; |