3 files changed, 9 insertions, 31 deletions
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp index 81bb8fd..7b6117e 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp | |||
@@ -1,178 +1,162 @@ | |||
1 | /* | 1 | /* |
2 | * addresspluginconfig.cpp | 2 | * addresspluginconfig.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2003 by Stefan Eilers | 4 | * copyright : (c) 2003 by Stefan Eilers |
5 | * email : eilers.stefan@epost.de | 5 | * email : eilers.stefan@epost.de |
6 | * | 6 | * |
7 | * This implementation was derived from the todolist plugin implementation | 7 | * This implementation was derived from the todolist plugin implementation |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "addresspluginconfig.h" | 19 | #include "addresspluginconfig.h" |
20 | 20 | ||
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | 22 | ||
23 | #include <qlayout.h> | 23 | #include <qlayout.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qwhatsthis.h> | 26 | #include <qwhatsthis.h> |
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( 20 ); | 34 | layout->setMargin( 5 ); |
35 | |||
36 | #if 0 | ||
37 | // Informational stuff | ||
38 | QHBox *box4 = new QHBox( this ); | ||
39 | QLabel* colorLabel = new QLabel( box4, "" ); | ||
40 | colorLabel->setText( tr( "To activate settings: Restart application !" ) ); | ||
41 | #endif | ||
42 | 35 | ||
43 | // Buttongroup to enable/disable shown stuff | 36 | // Buttongroup to enable/disable shown stuff |
44 | QVGroupBox* b_group = new QVGroupBox( this, "name" ); | 37 | QVGroupBox* b_group = new QVGroupBox( this, "name" ); |
45 | b_group -> setTitle( tr("Enable/Disable Views") ); | 38 | b_group -> setTitle( tr("Enable/Disable Views") ); |
46 | m_showBirthdayButton = new QRadioButton( b_group ); | 39 | m_showBirthdayButton = new QRadioButton( b_group ); |
47 | m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); | 40 | m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); |
48 | m_showAnniversaryButton = new QRadioButton( b_group ); | 41 | m_showAnniversaryButton = new QRadioButton( b_group ); |
49 | m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); | 42 | m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); |
50 | 43 | ||
51 | 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!" ) ); |
52 | 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 !" ) ); |
53 | 46 | ||
54 | // Max lines settings | 47 | // Max lines settings |
55 | QHBox *box1 = new QHBox( this ); | 48 | QHBox *box1 = new QHBox( this ); |
56 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); | 49 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); |
57 | TextLabel6->setText( tr( "Max Lines: " ) ); | 50 | TextLabel6->setText( tr( "Max Lines: " ) ); |
58 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); | 51 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); |
59 | SpinBox2->setMaxValue( 40 ); | 52 | SpinBox2->setMaxValue( 40 ); |
60 | 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" ) ); |
61 | 54 | ||
62 | #if 0 | ||
63 | // Clip settings (currently not used) | ||
64 | QHBox *box2 = new QHBox( this ); | ||
65 | QLabel* clipLabel = new QLabel( box2, "" ); | ||
66 | clipLabel->setText( tr( "Clip line after X chars: " ) ); | ||
67 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); | ||
68 | SpinBoxClip->setMaxValue( 200 ); | ||
69 | QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); | ||
70 | #endif | ||
71 | |||
72 | // Look ahead settings | 55 | // Look ahead settings |
73 | QHBox *box3 = new QHBox( this ); | 56 | QHBox *box3 = new QHBox( this ); |
74 | QLabel* daysLabel = new QLabel( box3, "" ); | 57 | QLabel* daysLabel = new QLabel( box3, "" ); |
75 | daysLabel->setText( tr( "Days look ahead: " ) ); | 58 | daysLabel->setText( tr( "Days look ahead: " ) ); |
76 | SpinDaysClip = new QSpinBox( box3, "SpinDays" ); | 59 | SpinDaysClip = new QSpinBox( box3, "SpinDays" ); |
77 | SpinDaysClip->setMaxValue( 200 ); | 60 | SpinDaysClip->setMaxValue( 200 ); |
78 | QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); | 61 | QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); |
79 | 62 | ||
80 | // QHBox *box4 = new QHBox( this ); | ||
81 | |||
82 | // QLabel* colorLabel = new QLabel( box4, "" ); | ||
83 | // colorLabel->setText( tr( "To activate settings: Restart application !" ) ); | ||
84 | |||
85 | 63 | ||
86 | QHBox *box5 = new QHBox( this ); | 64 | QHBox *box5 = new QHBox( this ); |
87 | QLabel* colorLabel2 = new QLabel( box5, "" ); | 65 | QLabel* colorLabel2 = new QLabel( box5, "" ); |
88 | colorLabel2->setText( tr( "Set Headline Color: " ) ); | 66 | colorLabel2->setText( tr( "Set Headline Color: " ) ); |
89 | headlineColor = new Opie::OColorButton( box5, black , "headlineColor" ); | 67 | headlineColor = new Opie::OColorButton( box5, black , "headlineColor" ); |
90 | QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); | 68 | QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); |
91 | QHBox *box6 = new QHBox( this ); | 69 | QHBox *box6 = new QHBox( this ); |
92 | 70 | ||
93 | // Entry color settings | 71 | // Entry color settings |
94 | QLabel* colorLabel3= new QLabel( box6, "" ); | 72 | QLabel* colorLabel3= new QLabel( box6, "" ); |
95 | colorLabel3->setText( tr( "Set Entry Color: " ) ); | 73 | colorLabel3->setText( tr( "Set Entry Color: " ) ); |
96 | entryColor = new Opie::OColorButton( box6, black , "entryColor" ); | 74 | entryColor = new Opie::OColorButton( box6, black , "entryColor" ); |
97 | QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); | 75 | QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); |
98 | 76 | ||
99 | // Urgent color settings | 77 | // Urgent color settings |
100 | QHBox *box7 = new QHBox( this ); | 78 | QHBox *box7 = new QHBox( this ); |
101 | QLabel* colorLabel5 = new QLabel( box7, "" ); | 79 | QLabel* colorLabel5 = new QLabel( box7, "" ); |
102 | colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); | 80 | colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); |
103 | SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); | 81 | SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); |
104 | SpinUrgentClip->setMaxValue( 200 ); | 82 | SpinUrgentClip->setMaxValue( 200 ); |
105 | QLabel* colorLabel6 = new QLabel( box7, "" ); | 83 | QLabel* colorLabel6 = new QLabel( box7, "" ); |
106 | colorLabel6->setText( tr( " days: " ) ); | 84 | colorLabel6->setText( tr( " days: " ) ); |
107 | urgentColor = new Opie::OColorButton( box7, red , "urgentColor" ); | 85 | urgentColor = new Opie::OColorButton( box7, red , "urgentColor" ); |
108 | QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); | 86 | QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); |
109 | QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); | 87 | QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); |
110 | 88 | ||
111 | 89 | ||
112 | //layout->addWidget( box4 ); | 90 | layout->addWidget( b_group ); |
113 | layout->addWidget( box1 ); | 91 | layout->addWidget( box1 ); |
114 | //layout->addWidget( box2 ); | ||
115 | layout->addWidget( box3 ); | 92 | layout->addWidget( box3 ); |
116 | layout->addWidget( box5 ); | 93 | layout->addWidget( box5 ); |
117 | layout->addWidget( box6 ); | 94 | layout->addWidget( box6 ); |
118 | layout->addWidget( box7 ); | 95 | layout->addWidget( box7 ); |
96 | |||
97 | /* | ||
98 | * pack the widgets together | ||
99 | */ | ||
100 | QSpacerItem *item = new QSpacerItem( 1, 2, QSizePolicy::Minimum, | ||
101 | QSizePolicy::MinimumExpanding ); | ||
102 | layout->addItem( item ); | ||
119 | 103 | ||
120 | readConfig(); | 104 | readConfig(); |
121 | 105 | ||
122 | } | 106 | } |
123 | 107 | ||
124 | void AddressBookPluginConfig::readConfig() { | 108 | void AddressBookPluginConfig::readConfig() { |
125 | Config cfg( "todayaddressplugin" ); | 109 | Config cfg( "todayaddressplugin" ); |
126 | cfg.setGroup( "config" ); | 110 | cfg.setGroup( "config" ); |
127 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); | 111 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); |
128 | SpinBox2->setValue( m_max_lines_task ); | 112 | SpinBox2->setValue( m_max_lines_task ); |
129 | // m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 113 | // m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
130 | // SpinBoxClip->setValue( m_maxCharClip ); | 114 | // SpinBoxClip->setValue( m_maxCharClip ); |
131 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); | 115 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); |
132 | SpinDaysClip->setValue( m_daysLookAhead ); | 116 | SpinDaysClip->setValue( m_daysLookAhead ); |
133 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); | 117 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); |
134 | SpinUrgentClip->setValue( m_urgentDays ); | 118 | SpinUrgentClip->setValue( m_urgentDays ); |
135 | 119 | ||
136 | m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); | 120 | m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); |
137 | entryColor->setColor( QColor( m_entryColor ) ); | 121 | entryColor->setColor( QColor( m_entryColor ) ); |
138 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); | 122 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); |
139 | headlineColor->setColor( QColor( m_headlineColor ) ); | 123 | headlineColor->setColor( QColor( m_headlineColor ) ); |
140 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); | 124 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); |
141 | urgentColor->setColor( QColor( m_urgentColor ) ); | 125 | urgentColor->setColor( QColor( m_urgentColor ) ); |
142 | 126 | ||
143 | m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); | 127 | m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); |
144 | m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); | 128 | m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); |
145 | 129 | ||
146 | } | 130 | } |
147 | 131 | ||
148 | 132 | ||
149 | void AddressBookPluginConfig::writeConfig() { | 133 | void AddressBookPluginConfig::writeConfig() { |
150 | Config cfg( "todayaddressplugin" ); | 134 | Config cfg( "todayaddressplugin" ); |
151 | cfg.setGroup( "config" ); | 135 | cfg.setGroup( "config" ); |
152 | m_max_lines_task = SpinBox2->value(); | 136 | m_max_lines_task = SpinBox2->value(); |
153 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); | 137 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); |
154 | // m_maxCharClip = SpinBoxClip->value(); | 138 | // m_maxCharClip = SpinBoxClip->value(); |
155 | // cfg.writeEntry( "maxcharclip", m_maxCharClip ); | 139 | // cfg.writeEntry( "maxcharclip", m_maxCharClip ); |
156 | m_daysLookAhead = SpinDaysClip->value(); | 140 | m_daysLookAhead = SpinDaysClip->value(); |
157 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); | 141 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); |
158 | m_urgentDays = SpinUrgentClip->value(); | 142 | m_urgentDays = SpinUrgentClip->value(); |
159 | if ( m_urgentDays > m_daysLookAhead ) | 143 | if ( m_urgentDays > m_daysLookAhead ) |
160 | m_urgentDays = m_daysLookAhead; | 144 | m_urgentDays = m_daysLookAhead; |
161 | cfg.writeEntry( "urgentdays", m_urgentDays ); | 145 | cfg.writeEntry( "urgentdays", m_urgentDays ); |
162 | 146 | ||
163 | m_entryColor = entryColor->color().name(); | 147 | m_entryColor = entryColor->color().name(); |
164 | cfg.writeEntry( "entrycolor", m_entryColor ); | 148 | cfg.writeEntry( "entrycolor", m_entryColor ); |
165 | m_headlineColor = headlineColor->color().name(); | 149 | m_headlineColor = headlineColor->color().name(); |
166 | cfg.writeEntry( "headlinecolor", m_headlineColor ); | 150 | cfg.writeEntry( "headlinecolor", m_headlineColor ); |
167 | m_urgentColor = urgentColor->color().name(); | 151 | m_urgentColor = urgentColor->color().name(); |
168 | cfg.writeEntry( "urgentcolor", m_urgentColor ); | 152 | cfg.writeEntry( "urgentcolor", m_urgentColor ); |
169 | 153 | ||
170 | cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() ); | 154 | cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() ); |
171 | cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() ); | 155 | cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() ); |
172 | 156 | ||
173 | cfg.write(); | 157 | cfg.write(); |
174 | } | 158 | } |
175 | 159 | ||
176 | 160 | ||
177 | AddressBookPluginConfig::~AddressBookPluginConfig() { | 161 | AddressBookPluginConfig::~AddressBookPluginConfig() { |
178 | } | 162 | } |
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp index d76a29a..df7c5e1 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp | |||
@@ -1,165 +1,160 @@ | |||
1 | /* | 1 | /* |
2 | * addresspluginwidget.cpp | 2 | * addresspluginwidget.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2003 by Stefan Eilers | 4 | * copyright : (c) 2003 by Stefan Eilers |
5 | * email : eilers.stefan@epost.de | 5 | * email : eilers.stefan@epost.de |
6 | * | 6 | * |
7 | * This implementation was derived from the todolist plugin implementation | 7 | * This implementation was derived from the todolist plugin implementation |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "addresspluginwidget.h" | 19 | #include "addresspluginwidget.h" |
20 | 20 | ||
21 | #include <opie2/odebug.h> | 21 | #include <opie2/odebug.h> |
22 | #include <opie2/opimcontact.h> | 22 | #include <opie2/opimcontact.h> |
23 | 23 | ||
24 | #include <qpe/config.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 ) { |
28 | 28 | ||
29 | addressLabel = 0l; | 29 | addressLabel = 0l; |
30 | m_contactdb = 0l; | 30 | m_contactdb = 0l; |
31 | layoutTodo = 0l; | 31 | layoutTodo = 0l; |
32 | 32 | ||
33 | // Hä ? Nonsense ! (se) | ||
34 | if ( m_contactdb ) { | ||
35 | delete m_contactdb; | ||
36 | } | ||
37 | |||
38 | m_contactdb = new Opie::OPimContactAccess("addressplugin"); | 33 | m_contactdb = new Opie::OPimContactAccess("addressplugin"); |
39 | 34 | ||
40 | connect( m_contactdb, SIGNAL( signalChanged(const Opie::OPimContactAccess*) ), | 35 | connect( m_contactdb, SIGNAL( signalChanged(const Opie::OPimContactAccess*) ), |
41 | this, SLOT( refresh(const Opie::OPimContactAccess*) ) ); | 36 | this, SLOT( refresh(const Opie::OPimContactAccess*) ) ); |
42 | 37 | ||
43 | 38 | ||
44 | readConfig(); | 39 | readConfig(); |
45 | getAddress(); | 40 | getAddress(); |
46 | } | 41 | } |
47 | 42 | ||
48 | AddressBookPluginWidget::~AddressBookPluginWidget() { | 43 | AddressBookPluginWidget::~AddressBookPluginWidget() { |
49 | delete m_contactdb; | 44 | delete m_contactdb; |
50 | } | 45 | } |
51 | 46 | ||
52 | void AddressBookPluginWidget::refresh( const Opie::OPimContactAccess* ) | 47 | void AddressBookPluginWidget::refresh( const Opie::OPimContactAccess* ) |
53 | { | 48 | { |
54 | owarn << " AddressBookPluginWidget::Database was changed externally ! " << oendl; | 49 | owarn << " AddressBookPluginWidget::Database was changed externally ! " << oendl; |
55 | m_contactdb->reload(); | 50 | m_contactdb->reload(); |
56 | getAddress(); | 51 | getAddress(); |
57 | } | 52 | } |
58 | 53 | ||
59 | void AddressBookPluginWidget::reinitialize() { | 54 | void AddressBookPluginWidget::reinitialize() { |
60 | readConfig(); | 55 | readConfig(); |
61 | getAddress(); | 56 | getAddress(); |
62 | } | 57 | } |
63 | 58 | ||
64 | void AddressBookPluginWidget::readConfig() { | 59 | void AddressBookPluginWidget::readConfig() { |
65 | Config cfg( "todayaddressplugin" ); | 60 | Config cfg( "todayaddressplugin" ); |
66 | cfg.setGroup( "config" ); | 61 | cfg.setGroup( "config" ); |
67 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); | 62 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); |
68 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 63 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
69 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); | 64 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); |
70 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); | 65 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); |
71 | m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); | 66 | m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); |
72 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); | 67 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); |
73 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); | 68 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); |
74 | m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); | 69 | m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); |
75 | m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); | 70 | m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); |
76 | } | 71 | } |
77 | 72 | ||
78 | 73 | ||
79 | /** | 74 | /** |
80 | * Get the addresss | 75 | * Get the addresss |
81 | */ | 76 | */ |
82 | void AddressBookPluginWidget::getAddress() { | 77 | void AddressBookPluginWidget::getAddress() { |
83 | 78 | ||
84 | if ( ! layoutTodo ){ | 79 | if ( ! layoutTodo ){ |
85 | layoutTodo = new QVBoxLayout( this ); | 80 | layoutTodo = new QVBoxLayout( this ); |
86 | } | 81 | } |
87 | 82 | ||
88 | if ( ! addressLabel ) { | 83 | if ( ! addressLabel ) { |
89 | addressLabel = new Opie::Ui::OClickableLabel( this ); | 84 | addressLabel = new Opie::Ui::OClickableLabel( this ); |
90 | connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); | 85 | connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); |
91 | layoutTodo->addWidget( addressLabel ); | 86 | layoutTodo->addWidget( addressLabel ); |
92 | } | 87 | } |
93 | 88 | ||
94 | QString output; | 89 | QString output; |
95 | 90 | ||
96 | // Check whether the database provide the search option.. | 91 | // Check whether the database provide the search option.. |
97 | if ( !m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ | 92 | if ( !m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ |
98 | // Libopie seems to be old.. | 93 | // Libopie seems to be old.. |
99 | 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>" ); |
100 | addressLabel->setText( output ); | 95 | addressLabel->setText( output ); |
101 | return; | 96 | return; |
102 | } | 97 | } |
103 | 98 | ||
104 | // Define the query for birthdays and start search.. | 99 | // Define the query for birthdays and start search.. |
105 | QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); | 100 | QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); |
106 | int ammount = 0; | 101 | int ammount = 0; |
107 | if ( m_showBirthdays ){ | 102 | if ( m_showBirthdays ){ |
108 | owarn << "Searching from now (" << QDate::currentDate().toString() << ") until " | 103 | owarn << "Searching from now (" << QDate::currentDate().toString() << ") until " |
109 | << lookAheadDate.toString() << " ! " << oendl; | 104 | << lookAheadDate.toString() << " ! " << oendl; |
110 | } | 105 | } |
111 | 106 | ||
112 | if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ | 107 | if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ |
113 | 108 | ||
114 | 109 | ||
115 | Opie::OPimContact querybirthdays; | 110 | Opie::OPimContact querybirthdays; |
116 | querybirthdays.setBirthday( lookAheadDate ); | 111 | querybirthdays.setBirthday( lookAheadDate ); |
117 | 112 | ||
118 | m_list = m_contactdb->queryByExample( querybirthdays, | 113 | m_list = m_contactdb->queryByExample( querybirthdays, |
119 | Opie::OPimContactAccess::DateDiff ); | 114 | Opie::OPimContactAccess::DateDiff ); |
120 | if ( m_list.count() > 0 ){ | 115 | if ( m_list.count() > 0 ){ |
121 | output = "<font color=" + m_headlineColor + ">" | 116 | output = "<font color=" + m_headlineColor + ">" |
122 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) | 117 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) |
123 | .arg( m_daysLookAhead ) | 118 | .arg( m_daysLookAhead ) |
124 | + "</font> <br>"; | 119 | + "</font> <br>"; |
125 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 120 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
126 | if ( ammount++ < m_maxLinesTask ){ | 121 | if ( ammount++ < m_maxLinesTask ){ |
127 | // Now we want to calculate how many days | 122 | // Now we want to calculate how many days |
128 | //until birthday. We have to set | 123 | //until birthday. We have to set |
129 | // the correct year to calculate the day diff... | 124 | // the correct year to calculate the day diff... |
130 | QDate destdate = (*m_it).birthday(); | 125 | QDate destdate = (*m_it).birthday(); |
131 | destdate.setYMD( QDate::currentDate().year(), | 126 | destdate.setYMD( QDate::currentDate().year(), |
132 | destdate.month(), destdate.day() ); | 127 | destdate.month(), destdate.day() ); |
133 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 128 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
134 | destdate.setYMD( QDate::currentDate().year()+1, | 129 | destdate.setYMD( QDate::currentDate().year()+1, |
135 | destdate.month(), destdate.day() ); | 130 | destdate.month(), destdate.day() ); |
136 | 131 | ||
137 | 132 | ||
138 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 133 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
139 | output += "<font color=" + m_urgentColor + "><b>-" | 134 | output += "<font color=" + m_urgentColor + "><b>-" |
140 | + (*m_it).fullName() | 135 | + (*m_it).fullName() |
141 | + " (" | 136 | + " (" |
142 | + QString::number(QDate::currentDate() | 137 | + QString::number(QDate::currentDate() |
143 | .daysTo(destdate)) | 138 | .daysTo(destdate)) |
144 | + " Days) </b></font><br>"; | 139 | + " Days) </b></font><br>"; |
145 | 140 | ||
146 | else | 141 | else |
147 | output += "<font color=" + m_entryColor + "><b>-" | 142 | output += "<font color=" + m_entryColor + "><b>-" |
148 | + (*m_it).fullName() | 143 | + (*m_it).fullName() |
149 | + " (" | 144 | + " (" |
150 | + QString::number(QDate::currentDate() | 145 | + QString::number(QDate::currentDate() |
151 | .daysTo(destdate)) | 146 | .daysTo(destdate)) |
152 | + " Days) </b></font><br>"; | 147 | + " Days) </b></font><br>"; |
153 | } | 148 | } |
154 | } | 149 | } |
155 | } else { | 150 | } else { |
156 | output = "<font color=" + m_headlineColor + ">" | 151 | output = "<font color=" + m_headlineColor + ">" |
157 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ) | 152 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ) |
158 | .arg( m_daysLookAhead ) | 153 | .arg( m_daysLookAhead ) |
159 | + "</font> <br>"; | 154 | + "</font> <br>"; |
160 | } | 155 | } |
161 | } | 156 | } |
162 | 157 | ||
163 | if ( m_showAnniversaries ){ | 158 | if ( m_showAnniversaries ){ |
164 | // Define the query for anniversaries and start search.. | 159 | // Define the query for anniversaries and start search.. |
165 | Opie::OPimContact queryanniversaries; | 160 | Opie::OPimContact queryanniversaries; |
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.h b/core/pim/today/plugins/addressbook/addresspluginwidget.h index b1c690d..25b3098 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.h +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.h | |||
@@ -1,66 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | * addresspluginwidget.h | 2 | * addresspluginwidget.h |
3 | * | 3 | * |
4 | * copyright : (c) 2003 by Stefan Eilers | 4 | * copyright : (c) 2003 by Stefan Eilers |
5 | * email : eilers.stefan@epost.de | 5 | * email : eilers.stefan@epost.de |
6 | * | 6 | * |
7 | * This implementation was derived from the todolist plugin implementation | 7 | * This implementation was derived from the todolist plugin implementation |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #ifndef ADDRESSBOOK_PLUGIN_WIDGET_H | 19 | #ifndef ADDRESSBOOK_PLUGIN_WIDGET_H |
20 | #define ADDRESSBOOK_PLUGIN_WIDGET_H | 20 | #define ADDRESSBOOK_PLUGIN_WIDGET_H |
21 | 21 | ||
22 | #include <opie2/ocontactaccess.h> | 22 | #include <opie2/ocontactaccess.h> |
23 | #include <opie2/oclickablelabel.h> | 23 | #include <opie2/oclickablelabel.h> |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | 29 | ||
30 | class AddressBookPluginWidget : public QWidget { | 30 | class AddressBookPluginWidget : public QWidget { |
31 | |||
32 | Q_OBJECT | 31 | Q_OBJECT |
33 | 32 | ||
34 | public: | 33 | public: |
35 | AddressBookPluginWidget( QWidget *parent, const char *name ); | 34 | AddressBookPluginWidget( QWidget *parent, const char *name ); |
36 | ~AddressBookPluginWidget(); | 35 | ~AddressBookPluginWidget(); |
37 | 36 | ||
38 | void reinitialize(); | 37 | void reinitialize(); |
39 | public slots: | 38 | public slots: |
40 | void refresh( const Opie::OPimContactAccess* db ); | 39 | void refresh( const Opie::OPimContactAccess* db ); |
41 | 40 | ||
42 | protected slots: | 41 | protected slots: |
43 | void startAddressBook(); | 42 | void startAddressBook(); |
44 | 43 | ||
45 | private: | 44 | private: |
46 | Opie::Ui::OClickableLabel* addressLabel; | 45 | Opie::Ui::OClickableLabel* addressLabel; |
47 | QVBoxLayout* layoutTodo; | 46 | QVBoxLayout* layoutTodo; |
48 | Opie::OPimContactAccess * m_contactdb; | 47 | Opie::OPimContactAccess * m_contactdb; |
49 | 48 | ||
50 | Opie::OPimContactAccess::List m_list; | 49 | Opie::OPimContactAccess::List m_list; |
51 | Opie::OPimContactAccess::List::Iterator m_it; | 50 | Opie::OPimContactAccess::List::Iterator m_it; |
52 | 51 | ||
53 | void readConfig(); | 52 | void readConfig(); |
54 | void getAddress(); | 53 | void getAddress(); |
55 | int m_maxLinesTask; | 54 | int m_maxLinesTask; |
56 | int m_maxCharClip; | 55 | int m_maxCharClip; |
57 | int m_daysLookAhead; | 56 | int m_daysLookAhead; |
58 | int m_urgentDays; | 57 | int m_urgentDays; |
59 | QString m_entryColor; | 58 | QString m_entryColor; |
60 | QString m_headlineColor; | 59 | QString m_headlineColor; |
61 | QString m_urgentColor; | 60 | QString m_urgentColor; |
62 | bool m_showBirthdays; | 61 | bool m_showBirthdays; |
63 | bool m_showAnniversaries; | 62 | bool m_showAnniversaries; |
64 | }; | 63 | }; |
65 | 64 | ||
66 | #endif | 65 | #endif |