author | drw <drw> | 2005-06-06 19:09:03 (UTC) |
---|---|---|
committer | drw <drw> | 2005-06-06 19:09:03 (UTC) |
commit | 9ccde964284da2c2dcc42da5e04f818e45baa148 (patch) (unidiff) | |
tree | aafeed7ef6bcceaf1271a7f3b748b3fd9634c0f6 | |
parent | 85a043b065f0b43470bc15dc6594eb520f379505 (diff) | |
download | opie-9ccde964284da2c2dcc42da5e04f818e45baa148.zip opie-9ccde964284da2c2dcc42da5e04f818e45baa148.tar.gz opie-9ccde964284da2c2dcc42da5e04f818e45baa148.tar.bz2 |
Fix to show/not show birthdays and use checkboxes for selection in plugin config dialog (courtesy of hrw)
3 files changed, 52 insertions, 52 deletions
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp index 7b6117e..4f1630d 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp | |||
@@ -27,27 +27,27 @@ | |||
27 | #include <qvgroupbox.h> | 27 | #include <qvgroupbox.h> |
28 | 28 | ||
29 | 29 | ||
30 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) | 30 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) |
31 | : TodayConfigWidget(parent, name ) { | 31 | : TodayConfigWidget(parent, name ) { |
32 | 32 | ||
33 | QVBoxLayout * layout = new QVBoxLayout( this ); | 33 | QVBoxLayout * layout = new QVBoxLayout( this ); |
34 | layout->setMargin( 5 ); | 34 | layout->setMargin( 5 ); |
35 | 35 | ||
36 | // Buttongroup to enable/disable shown stuff | 36 | // Buttongroup to enable/disable shown stuff |
37 | QVGroupBox* b_group = new QVGroupBox( this, "name" ); | 37 | QVGroupBox* b_group = new QVGroupBox( this, "name" ); |
38 | b_group -> setTitle( tr("Enable/Disable Views") ); | 38 | b_group -> setTitle( tr("Enable/Disable Views") ); |
39 | m_showBirthdayButton = new QRadioButton( b_group ); | 39 | m_showBirthdayButton = new QCheckBox( b_group ); |
40 | m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); | 40 | m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); |
41 | m_showAnniversaryButton = new QRadioButton( b_group ); | 41 | m_showAnniversaryButton = new QCheckBox( b_group ); |
42 | m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); | 42 | m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); |
43 | 43 | ||
44 | QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); | 44 | QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); |
45 | QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) ); | 45 | QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) ); |
46 | 46 | ||
47 | // Max lines settings | 47 | // Max lines settings |
48 | QHBox *box1 = new QHBox( this ); | 48 | QHBox *box1 = new QHBox( this ); |
49 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); | 49 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); |
50 | TextLabel6->setText( tr( "Max Lines: " ) ); | 50 | TextLabel6->setText( tr( "Max Lines: " ) ); |
51 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); | 51 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); |
52 | SpinBox2->setMaxValue( 40 ); | 52 | SpinBox2->setMaxValue( 40 ); |
53 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); | 53 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); |
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.h b/core/pim/today/plugins/addressbook/addresspluginconfig.h index e065ca2..1284fdc 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.h +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.h | |||
@@ -15,51 +15,51 @@ | |||
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #ifndef ADDRESSBOOK_PLUGIN_CONFIG_H | 19 | #ifndef ADDRESSBOOK_PLUGIN_CONFIG_H |
20 | #define ADDRESSBOOK_PLUGIN_CONFIG_H | 20 | #define ADDRESSBOOK_PLUGIN_CONFIG_H |
21 | 21 | ||
22 | #include <opie2/todayconfigwidget.h> | 22 | #include <opie2/todayconfigwidget.h> |
23 | #include <opie2/ocolorbutton.h> | 23 | #include <opie2/ocolorbutton.h> |
24 | 24 | ||
25 | #include <qwidget.h> | 25 | #include <qwidget.h> |
26 | #include <qspinbox.h> | 26 | #include <qspinbox.h> |
27 | #include <qradiobutton.h> | 27 | #include <qcheckbox.h> |
28 | 28 | ||
29 | class AddressBookPluginConfig : public TodayConfigWidget { | 29 | class AddressBookPluginConfig : public TodayConfigWidget { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | 31 | ||
32 | public: | 32 | public: |
33 | 33 | ||
34 | AddressBookPluginConfig( QWidget *parent, const char *name ); | 34 | AddressBookPluginConfig( QWidget *parent, const char *name ); |
35 | ~AddressBookPluginConfig(); | 35 | ~AddressBookPluginConfig(); |
36 | 36 | ||
37 | private: | 37 | private: |
38 | /** | 38 | /** |
39 | * if changed then save | 39 | * if changed then save |
40 | */ | 40 | */ |
41 | bool changed(); | 41 | bool changed(); |
42 | void readConfig(); | 42 | void readConfig(); |
43 | void writeConfig(); | 43 | void writeConfig(); |
44 | 44 | ||
45 | QSpinBox* SpinBox2; | 45 | QSpinBox* SpinBox2; |
46 | QSpinBox* SpinBoxClip; | 46 | QSpinBox* SpinBoxClip; |
47 | QSpinBox* SpinDaysClip; | 47 | QSpinBox* SpinDaysClip; |
48 | QSpinBox* SpinUrgentClip; | 48 | QSpinBox* SpinUrgentClip; |
49 | Opie::OColorButton* entryColor; | 49 | Opie::OColorButton* entryColor; |
50 | Opie::OColorButton* headlineColor; | 50 | Opie::OColorButton* headlineColor; |
51 | Opie::OColorButton* urgentColor; | 51 | Opie::OColorButton* urgentColor; |
52 | QRadioButton* m_showBirthdayButton; | 52 | QCheckBox* m_showBirthdayButton; |
53 | QRadioButton* m_showAnniversaryButton; | 53 | QCheckBox* m_showAnniversaryButton; |
54 | 54 | ||
55 | // how many lines should be showed in the AddressBook section | 55 | // how many lines should be showed in the AddressBook section |
56 | int m_max_lines_task; | 56 | int m_max_lines_task; |
57 | // clip the lines after X chars | 57 | // clip the lines after X chars |
58 | int m_maxCharClip; | 58 | int m_maxCharClip; |
59 | // How many days look ahead | 59 | // How many days look ahead |
60 | int m_daysLookAhead; | 60 | int m_daysLookAhead; |
61 | // Days until urgent color is used | 61 | // Days until urgent color is used |
62 | int m_urgentDays; | 62 | int m_urgentDays; |
63 | // Entry Color | 63 | // Entry Color |
64 | QString m_entryColor; | 64 | QString m_entryColor; |
65 | // Headline Color | 65 | // Headline Color |
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp index df7c5e1..5662af2 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp | |||
@@ -93,76 +93,76 @@ void AddressBookPluginWidget::getAddress() { | |||
93 | // Libopie seems to be old.. | 93 | // Libopie seems to be old.. |
94 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); | 94 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); |
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 | } | ||
106 | |||
107 | if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ | ||
108 | |||
109 | |||
110 | Opie::OPimContact querybirthdays; | ||
111 | querybirthdays.setBirthday( lookAheadDate ); | ||
112 | 105 | ||
113 | m_list = m_contactdb->queryByExample( querybirthdays, | 106 | if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ |
114 | Opie::OPimContactAccess::DateDiff ); | 107 | |
115 | if ( m_list.count() > 0 ){ | 108 | |
116 | output = "<font color=" + m_headlineColor + ">" | 109 | Opie::OPimContact querybirthdays; |
117 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) | 110 | querybirthdays.setBirthday( lookAheadDate ); |
118 | .arg( m_daysLookAhead ) | 111 | |
119 | + "</font> <br>"; | 112 | m_list = m_contactdb->queryByExample( querybirthdays, |
120 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 113 | Opie::OPimContactAccess::DateDiff ); |
121 | if ( ammount++ < m_maxLinesTask ){ | 114 | if ( m_list.count() > 0 ){ |
122 | // Now we want to calculate how many days | 115 | output = "<font color=" + m_headlineColor + ">" |
123 | //until birthday. We have to set | 116 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) |
124 | // the correct year to calculate the day diff... | 117 | .arg( m_daysLookAhead ) |
125 | QDate destdate = (*m_it).birthday(); | 118 | + "</font> <br>"; |
126 | destdate.setYMD( QDate::currentDate().year(), | 119 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
127 | destdate.month(), destdate.day() ); | 120 | if ( ammount++ < m_maxLinesTask ){ |
128 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 121 | // Now we want to calculate how many days |
129 | destdate.setYMD( QDate::currentDate().year()+1, | 122 | //until birthday. We have to set |
123 | // the correct year to calculate the day diff... | ||
124 | QDate destdate = (*m_it).birthday(); | ||
125 | destdate.setYMD( QDate::currentDate().year(), | ||
130 | destdate.month(), destdate.day() ); | 126 | destdate.month(), destdate.day() ); |
131 | 127 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | |
132 | 128 | destdate.setYMD( QDate::currentDate().year()+1, | |
133 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 129 | destdate.month(), destdate.day() ); |
134 | output += "<font color=" + m_urgentColor + "><b>-" | 130 | |
135 | + (*m_it).fullName() | 131 | |
136 | + " (" | 132 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
137 | + QString::number(QDate::currentDate() | 133 | output += "<font color=" + m_urgentColor + "><b>-" |
138 | .daysTo(destdate)) | 134 | + (*m_it).fullName() |
139 | + " Days) </b></font><br>"; | 135 | + " (" |
140 | 136 | + QString::number(QDate::currentDate() | |
141 | else | 137 | .daysTo(destdate)) |
142 | output += "<font color=" + m_entryColor + "><b>-" | 138 | + " Days) </b></font><br>"; |
143 | + (*m_it).fullName() | 139 | |
144 | + " (" | 140 | else |
145 | + QString::number(QDate::currentDate() | 141 | output += "<font color=" + m_entryColor + "><b>-" |
146 | .daysTo(destdate)) | 142 | + (*m_it).fullName() |
147 | + " Days) </b></font><br>"; | 143 | + " (" |
144 | + QString::number(QDate::currentDate() | ||
145 | .daysTo(destdate)) | ||
146 | + " Days) </b></font><br>"; | ||
147 | } | ||
148 | } | 148 | } |
149 | } else { | ||
150 | output = "<font color=" + m_headlineColor + ">" | ||
151 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ) | ||
152 | .arg( m_daysLookAhead ) | ||
153 | + "</font> <br>"; | ||
149 | } | 154 | } |
150 | } else { | ||
151 | output = "<font color=" + m_headlineColor + ">" | ||
152 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ) | ||
153 | .arg( m_daysLookAhead ) | ||
154 | + "</font> <br>"; | ||
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | if ( m_showAnniversaries ){ | 158 | if ( m_showAnniversaries ){ |
159 | // Define the query for anniversaries and start search.. | 159 | // Define the query for anniversaries and start search.. |
160 | Opie::OPimContact queryanniversaries; | 160 | Opie::OPimContact queryanniversaries; |
161 | queryanniversaries.setAnniversary( lookAheadDate ); | 161 | queryanniversaries.setAnniversary( lookAheadDate ); |
162 | 162 | ||
163 | m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff ); | 163 | m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff ); |
164 | 164 | ||
165 | ammount = 0; | 165 | ammount = 0; |
166 | if ( m_list.count() > 0 ){ | 166 | if ( m_list.count() > 0 ){ |
167 | output += "<font color=" + m_headlineColor + ">" | 167 | output += "<font color=" + m_headlineColor + ">" |
168 | + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) | 168 | + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) |