4 files changed, 102 insertions, 47 deletions
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp index a234236..9c65e7d 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp | |||
@@ -27,2 +27,3 @@ | |||
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qvgroupbox.h> | ||
28 | 29 | ||
@@ -35,7 +36,24 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
35 | 36 | ||
36 | QHBox *box1 = new QHBox( this ); | 37 | #if 0 |
38 | // Informational stuff | ||
39 | QHBox *box4 = new QHBox( this ); | ||
40 | QLabel* colorLabel = new QLabel( box4, "" ); | ||
41 | colorLabel->setText( tr( "To activate settings: Restart application !" ) ); | ||
42 | #endif | ||
43 | |||
44 | // Buttongroup to enable/disable shown stuff | ||
45 | QVGroupBox* b_group = new QVGroupBox( this, "name" ); | ||
46 | b_group -> setTitle( tr("Enable/Disable Views") ); | ||
47 | m_showBirthdayButton = new QRadioButton( b_group ); | ||
48 | m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); | ||
49 | m_showAnniversaryButton = new QRadioButton( b_group ); | ||
50 | m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); | ||
51 | |||
52 | QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); | ||
53 | QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) ); | ||
37 | 54 | ||
55 | // Max lines settings | ||
56 | QHBox *box1 = new QHBox( this ); | ||
38 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); | 57 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); |
39 | TextLabel6->setText( tr( "Max Lines: " ) ); | 58 | TextLabel6->setText( tr( "Max Lines: " ) ); |
40 | |||
41 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); | 59 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); |
@@ -44,7 +62,7 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
44 | 62 | ||
63 | #if 0 | ||
64 | // Clip settings (currently not used) | ||
45 | QHBox *box2 = new QHBox( this ); | 65 | QHBox *box2 = new QHBox( this ); |
46 | |||
47 | QLabel* clipLabel = new QLabel( box2, "" ); | 66 | QLabel* clipLabel = new QLabel( box2, "" ); |
48 | clipLabel->setText( tr( "Clip line after X chars: " ) ); | 67 | clipLabel->setText( tr( "Clip line after X chars: " ) ); |
49 | |||
50 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); | 68 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); |
@@ -52,5 +70,6 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
52 | QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); | 70 | QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); |
71 | #endif | ||
53 | 72 | ||
73 | // Look ahead settings | ||
54 | QHBox *box3 = new QHBox( this ); | 74 | QHBox *box3 = new QHBox( this ); |
55 | |||
56 | QLabel* daysLabel = new QLabel( box3, "" ); | 75 | QLabel* daysLabel = new QLabel( box3, "" ); |
@@ -61,9 +80,4 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
61 | 80 | ||
62 | QHBox *box4 = new QHBox( this ); | 81 | // Headline color settings |
63 | |||
64 | QLabel* colorLabel = new QLabel( box4, "" ); | ||
65 | colorLabel->setText( tr( "To activate settings: Restart application !" ) ); | ||
66 | |||
67 | QHBox *box5 = new QHBox( this ); | 82 | QHBox *box5 = new QHBox( this ); |
68 | |||
69 | QLabel* colorLabel2 = new QLabel( box5, "" ); | 83 | QLabel* colorLabel2 = new QLabel( box5, "" ); |
@@ -72,5 +86,5 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
72 | QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); | 86 | QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); |
73 | |||
74 | QHBox *box6 = new QHBox( this ); | 87 | QHBox *box6 = new QHBox( this ); |
75 | 88 | ||
89 | // Entry color settings | ||
76 | QLabel* colorLabel3= new QLabel( box6, "" ); | 90 | QLabel* colorLabel3= new QLabel( box6, "" ); |
@@ -80,4 +94,4 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
80 | 94 | ||
95 | // Urgent color settings | ||
81 | QHBox *box7 = new QHBox( this ); | 96 | QHBox *box7 = new QHBox( this ); |
82 | |||
83 | QLabel* colorLabel5 = new QLabel( box7, "" ); | 97 | QLabel* colorLabel5 = new QLabel( box7, "" ); |
@@ -93,5 +107,6 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
93 | 107 | ||
94 | layout->addWidget( box4 ); | 108 | layout->addWidget( b_group ); |
109 | // layout->addWidget( box4 ); | ||
95 | layout->addWidget( box1 ); | 110 | layout->addWidget( box1 ); |
96 | layout->addWidget( box2 ); | 111 | // layout->addWidget( box2 ); |
97 | layout->addWidget( box3 ); | 112 | layout->addWidget( box3 ); |
@@ -110,4 +125,4 @@ void AddressBookPluginConfig::readConfig() { | |||
110 | SpinBox2->setValue( m_max_lines_task ); | 125 | SpinBox2->setValue( m_max_lines_task ); |
111 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 126 | // m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
112 | SpinBoxClip->setValue( m_maxCharClip ); | 127 | // SpinBoxClip->setValue( m_maxCharClip ); |
113 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); | 128 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); |
@@ -123,2 +138,6 @@ void AddressBookPluginConfig::readConfig() { | |||
123 | urgentColor->setColor( QColor( m_urgentColor ) ); | 138 | urgentColor->setColor( QColor( m_urgentColor ) ); |
139 | |||
140 | m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); | ||
141 | m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); | ||
142 | |||
124 | } | 143 | } |
@@ -131,4 +150,4 @@ void AddressBookPluginConfig::writeConfig() { | |||
131 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); | 150 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); |
132 | m_maxCharClip = SpinBoxClip->value(); | 151 | // m_maxCharClip = SpinBoxClip->value(); |
133 | cfg.writeEntry( "maxcharclip", m_maxCharClip ); | 152 | // cfg.writeEntry( "maxcharclip", m_maxCharClip ); |
134 | m_daysLookAhead = SpinDaysClip->value(); | 153 | m_daysLookAhead = SpinDaysClip->value(); |
@@ -146,2 +165,6 @@ void AddressBookPluginConfig::writeConfig() { | |||
146 | cfg.writeEntry( "urgentcolor", m_urgentColor ); | 165 | cfg.writeEntry( "urgentcolor", m_urgentColor ); |
166 | |||
167 | cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() ); | ||
168 | cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() ); | ||
169 | |||
147 | cfg.write(); | 170 | cfg.write(); |
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.h b/core/pim/today/plugins/addressbook/addresspluginconfig.h index ea03368..5e07aa3 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.h +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.h | |||
@@ -23,2 +23,3 @@ | |||
23 | #include <qspinbox.h> | 23 | #include <qspinbox.h> |
24 | #include <qradiobutton.h> | ||
24 | 25 | ||
@@ -50,2 +51,4 @@ private: | |||
50 | OColorButton* urgentColor; | 51 | OColorButton* urgentColor; |
52 | QRadioButton* m_showBirthdayButton; | ||
53 | QRadioButton* m_showAnniversaryButton; | ||
51 | 54 | ||
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp index 7d87fca..498de28 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp | |||
@@ -77,2 +77,4 @@ void AddressBookPluginWidget::readConfig() { | |||
77 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); | 77 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); |
78 | m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); | ||
79 | m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); | ||
78 | } | 80 | } |
@@ -98,3 +100,11 @@ void AddressBookPluginWidget::getAddress() { | |||
98 | // Check whether the database provide the search option.. | 100 | // Check whether the database provide the search option.. |
99 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ | 101 | // The following if-statement was replaced due to a bug in some |
102 | // implementations of libopie. The replacement should work everywhere..(eilers) | ||
103 | // if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ | ||
104 | if ( !( m_contactdb->querySettings() & OContactAccess::DateDiff ) ){ | ||
105 | // Libopie seems to be old.. | ||
106 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); | ||
107 | addressLabel->setText( output ); | ||
108 | return; | ||
109 | } | ||
100 | 110 | ||
@@ -102,3 +112,6 @@ void AddressBookPluginWidget::getAddress() { | |||
102 | QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); | 112 | QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); |
103 | qWarning("Searching from now (%s) until %s ! ", QDate::currentDate().toString().latin1(), | 113 | int ammount = 0; |
114 | if ( m_showBirthdays ){ | ||
115 | qWarning("Searching from now (%s) until %s ! ", | ||
116 | QDate::currentDate().toString().latin1(), | ||
104 | lookAheadDate.toString().latin1() ); | 117 | lookAheadDate.toString().latin1() ); |
@@ -107,8 +120,9 @@ void AddressBookPluginWidget::getAddress() { | |||
107 | 120 | ||
108 | int ammount = 0; | ||
109 | 121 | ||
110 | m_list = m_contactdb->queryByExample( querybirthdays, OContactAccess::DateDiff ); | 122 | m_list = m_contactdb->queryByExample( querybirthdays, |
123 | OContactAccess::DateDiff ); | ||
111 | if ( m_list.count() > 0 ){ | 124 | if ( m_list.count() > 0 ){ |
112 | output = "<font color=" + m_headlineColor + ">" | 125 | output = "<font color=" + m_headlineColor + ">" |
113 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ).arg( m_daysLookAhead ) | 126 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) |
127 | .arg( m_daysLookAhead ) | ||
114 | + "</font> <br>"; | 128 | + "</font> <br>"; |
@@ -116,8 +130,11 @@ void AddressBookPluginWidget::getAddress() { | |||
116 | if ( ammount++ < m_maxLinesTask ){ | 130 | if ( ammount++ < m_maxLinesTask ){ |
117 | // Now we want to calculate how many days until birthday. We have to set | 131 | // Now we want to calculate how many days |
132 | //until birthday. We have to set | ||
118 | // the correct year to calculate the day diff... | 133 | // the correct year to calculate the day diff... |
119 | QDate destdate = (*m_it).birthday(); | 134 | QDate destdate = (*m_it).birthday(); |
120 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), destdate.day() ); | 135 | destdate.setYMD( QDate::currentDate().year(), |
136 | destdate.month(), destdate.day() ); | ||
121 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 137 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
122 | destdate.setYMD( QDate::currentDate().year()+1, destdate.month(), destdate.day() ); | 138 | destdate.setYMD( QDate::currentDate().year()+1, |
139 | destdate.month(), destdate.day() ); | ||
123 | 140 | ||
@@ -125,5 +142,7 @@ void AddressBookPluginWidget::getAddress() { | |||
125 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 142 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
126 | output += "<font color=" + m_urgentColor + "><b>-" + (*m_it).fullName() | 143 | output += "<font color=" + m_urgentColor + "><b>-" |
144 | + (*m_it).fullName() | ||
127 | + " (" | 145 | + " (" |
128 | + QString::number(QDate::currentDate().daysTo(destdate)) | 146 | + QString::number(QDate::currentDate() |
147 | .daysTo(destdate)) | ||
129 | + " Days) </b></font><br>"; | 148 | + " Days) </b></font><br>"; |
@@ -131,5 +150,7 @@ void AddressBookPluginWidget::getAddress() { | |||
131 | else | 150 | else |
132 | output += "<font color=" + m_entryColor + "><b>-" + (*m_it).fullName() | 151 | output += "<font color=" + m_entryColor + "><b>-" |
152 | + (*m_it).fullName() | ||
133 | + " (" | 153 | + " (" |
134 | + QString::number(QDate::currentDate().daysTo(destdate)) | 154 | + QString::number(QDate::currentDate() |
155 | .daysTo(destdate)) | ||
135 | + " Days) </b></font><br>"; | 156 | + " Days) </b></font><br>"; |
@@ -139,6 +160,9 @@ void AddressBookPluginWidget::getAddress() { | |||
139 | output = "<font color=" + m_headlineColor + ">" | 160 | output = "<font color=" + m_headlineColor + ">" |
140 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ).arg( m_daysLookAhead ) | 161 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ) |
162 | .arg( m_daysLookAhead ) | ||
141 | + "</font> <br>"; | 163 | + "</font> <br>"; |
142 | } | 164 | } |
165 | } | ||
143 | 166 | ||
167 | if ( m_showAnniversaries ){ | ||
144 | // Define the query for anniversaries and start search.. | 168 | // Define the query for anniversaries and start search.. |
@@ -152,3 +176,4 @@ void AddressBookPluginWidget::getAddress() { | |||
152 | output += "<font color=" + m_headlineColor + ">" | 176 | output += "<font color=" + m_headlineColor + ">" |
153 | + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ).arg( m_daysLookAhead ) | 177 | + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) |
178 | .arg( m_daysLookAhead ) | ||
154 | + "</font> <br>"; | 179 | + "</font> <br>"; |
@@ -156,18 +181,24 @@ void AddressBookPluginWidget::getAddress() { | |||
156 | if ( ammount++ < m_maxLinesTask ){ | 181 | if ( ammount++ < m_maxLinesTask ){ |
157 | // Now we want to calculate how many days until anniversary. We have to set | 182 | // Now we want to calculate how many days until anniversary. |
158 | // the correct year to calculate the day diff... | 183 | // We have to set the correct year to calculate the day diff... |
159 | QDate destdate = (*m_it).anniversary(); | 184 | QDate destdate = (*m_it).anniversary(); |
160 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), destdate.day() ); | 185 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), |
186 | destdate.day() ); | ||
161 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 187 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
162 | destdate.setYMD( QDate::currentDate().year()+1, destdate.month(), destdate.day() ); | 188 | destdate.setYMD( QDate::currentDate().year()+1, |
189 | destdate.month(), destdate.day() ); | ||
163 | 190 | ||
164 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 191 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
165 | output += "<font color=" + m_urgentColor + "><b>-" + (*m_it).fullName() | 192 | output += "<font color=" + m_urgentColor + "><b>-" |
193 | + (*m_it).fullName() | ||
166 | + " (" | 194 | + " (" |
167 | + QString::number(QDate::currentDate().daysTo( destdate ) ) | 195 | + QString::number(QDate::currentDate() |
196 | .daysTo( destdate ) ) | ||
168 | + " Days) </b></font><br>"; | 197 | + " Days) </b></font><br>"; |
169 | else | 198 | else |
170 | output += "<font color=" + m_entryColor + "><b>-" + (*m_it).fullName() | 199 | output += "<font color=" + m_entryColor + "><b>-" |
200 | + (*m_it).fullName() | ||
171 | + " (" | 201 | + " (" |
172 | + QString::number(QDate::currentDate().daysTo( destdate ) ) | 202 | + QString::number(QDate::currentDate() |
203 | .daysTo( destdate ) ) | ||
173 | + " Days) </b></font><br>"; | 204 | + " Days) </b></font><br>"; |
@@ -177,10 +208,6 @@ void AddressBookPluginWidget::getAddress() { | |||
177 | output += "<font color=" + m_headlineColor + ">" | 208 | output += "<font color=" + m_headlineColor + ">" |
178 | + QObject::tr( "No anniversaries in <b> %1 </b> days!" ).arg( m_daysLookAhead ) | 209 | + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) |
210 | .arg( m_daysLookAhead ) | ||
179 | + "</font> <br>"; | 211 | + "</font> <br>"; |
180 | } | 212 | } |
181 | |||
182 | |||
183 | }else{ | ||
184 | // Libopie seems to be old.. | ||
185 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); | ||
186 | } | 213 | } |
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.h b/core/pim/today/plugins/addressbook/addresspluginwidget.h index 63f2a2b..cf2ecce 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.h +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.h | |||
@@ -60,2 +60,4 @@ private: | |||
60 | QString m_urgentColor; | 60 | QString m_urgentColor; |
61 | bool m_showBirthdays; | ||
62 | bool m_showAnniversaries; | ||
61 | }; | 63 | }; |