4 files changed, 104 insertions, 23 deletions
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp index f00cffe..45d9a3e 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp | |||
@@ -16,94 +16,138 @@ | |||
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 <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) | 31 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) |
32 | : TodayConfigWidget(parent, name ) { | 32 | : TodayConfigWidget(parent, name ) { |
33 | 33 | ||
34 | QVBoxLayout * layout = new QVBoxLayout( this ); | 34 | QVBoxLayout * layout = new QVBoxLayout( this ); |
35 | layout->setMargin( 20 ); | 35 | layout->setMargin( 20 ); |
36 | 36 | ||
37 | QHBox *box1 = new QHBox( this ); | 37 | QHBox *box1 = new QHBox( this ); |
38 | 38 | ||
39 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); | 39 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); |
40 | TextLabel6->setText( tr( "Max Lines " ) ); | 40 | TextLabel6->setText( tr( "Max Lines: " ) ); |
41 | 41 | ||
42 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); | 42 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); |
43 | SpinBox2->setMaxValue( 40 ); | 43 | SpinBox2->setMaxValue( 40 ); |
44 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each" ) ); | 44 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each" ) ); |
45 | 45 | ||
46 | QHBox *box2 = new QHBox( this ); | 46 | QHBox *box2 = new QHBox( this ); |
47 | 47 | ||
48 | QLabel* clipLabel = new QLabel( box2, "" ); | 48 | QLabel* clipLabel = new QLabel( box2, "" ); |
49 | clipLabel->setText( tr( "Clip line after X chars" ) ); | 49 | clipLabel->setText( tr( "Clip line after X chars: " ) ); |
50 | 50 | ||
51 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); | 51 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); |
52 | SpinBoxClip->setMaxValue( 200 ); | 52 | SpinBoxClip->setMaxValue( 200 ); |
53 | QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); | 53 | QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); |
54 | 54 | ||
55 | QHBox *box3 = new QHBox( this ); | 55 | QHBox *box3 = new QHBox( this ); |
56 | 56 | ||
57 | QLabel* daysLabel = new QLabel( box3, "" ); | 57 | QLabel* daysLabel = new QLabel( box3, "" ); |
58 | daysLabel->setText( tr( "Days look ahead" ) ); | 58 | daysLabel->setText( tr( "Days look ahead: " ) ); |
59 | |||
60 | SpinDaysClip = new QSpinBox( box3, "SpinDays" ); | 59 | SpinDaysClip = new QSpinBox( box3, "SpinDays" ); |
61 | SpinDaysClip->setMaxValue( 200 ); | 60 | SpinDaysClip->setMaxValue( 200 ); |
62 | QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); | 61 | QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); |
63 | 62 | ||
64 | QHBox *box4 = new QHBox( this ); | 63 | QHBox *box4 = new QHBox( this ); |
65 | 64 | ||
66 | QLabel* colorLabel = new QLabel( box4, "" ); | 65 | QLabel* colorLabel = new QLabel( box4, "" ); |
67 | colorLabel->setText( tr( "Set Entry Color \n(restart Today \nafter change!)" ) ); | 66 | colorLabel->setText( tr( "To activate color settings:\nRestart application !" ) ); |
67 | |||
68 | QHBox *box5 = new QHBox( this ); | ||
69 | |||
70 | QLabel* colorLabel2 = new QLabel( box5, "" ); | ||
71 | colorLabel2->setText( tr( "Set Headline Color: " ) ); | ||
72 | headlineColor = new OColorButton( box5, black , "headlineColor" ); | ||
73 | QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); | ||
74 | |||
75 | QHBox *box6 = new QHBox( this ); | ||
76 | |||
77 | QLabel* colorLabel3= new QLabel( box6, "" ); | ||
78 | colorLabel3->setText( tr( "Set Entry Color: " ) ); | ||
79 | entryColor = new OColorButton( box6, black , "entryColor" ); | ||
80 | QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); | ||
81 | |||
82 | QHBox *box7 = new QHBox( this ); | ||
83 | |||
84 | QLabel* colorLabel5 = new QLabel( box7, "" ); | ||
85 | colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); | ||
86 | SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); | ||
87 | SpinUrgentClip->setMaxValue( 200 ); | ||
88 | QLabel* colorLabel6 = new QLabel( box7, "" ); | ||
89 | colorLabel6->setText( tr( "days: " ) ); | ||
90 | urgentColor = new OColorButton( box7, red , "urgentColor" ); | ||
91 | QWhatsThis::add( urgentColor , tr( "This color will be used if we are close to the event !" ) ); | ||
92 | QWhatsThis::add( SpinUrgentClip , tr( "How many days we should search forward" ) ); | ||
68 | 93 | ||
69 | entryColor = new OColorButton( box4, red, "entryColor" ); | ||
70 | QWhatsThis::add( entryColor , tr( "What color should be used for shown birthdays/anniversaries?" ) ); | ||
71 | 94 | ||
72 | layout->addWidget( box1 ); | 95 | layout->addWidget( box1 ); |
73 | layout->addWidget( box2 ); | 96 | layout->addWidget( box2 ); |
74 | layout->addWidget( box3 ); | 97 | layout->addWidget( box3 ); |
75 | layout->addWidget( box4 ); | 98 | layout->addWidget( box4 ); |
99 | layout->addWidget( box5 ); | ||
100 | layout->addWidget( box6 ); | ||
101 | layout->addWidget( box7 ); | ||
76 | 102 | ||
77 | readConfig(); | 103 | readConfig(); |
104 | |||
78 | } | 105 | } |
79 | 106 | ||
80 | void AddressBookPluginConfig::readConfig() { | 107 | void AddressBookPluginConfig::readConfig() { |
81 | Config cfg( "todayaddressplugin" ); | 108 | Config cfg( "todayaddressplugin" ); |
82 | cfg.setGroup( "config" ); | 109 | cfg.setGroup( "config" ); |
83 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); | 110 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); |
84 | SpinBox2->setValue( m_max_lines_task ); | 111 | SpinBox2->setValue( m_max_lines_task ); |
85 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 112 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
86 | SpinBoxClip->setValue( m_maxCharClip ); | 113 | SpinBoxClip->setValue( m_maxCharClip ); |
87 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); | 114 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); |
88 | SpinDaysClip->setValue( m_daysLookAhead ); | 115 | SpinDaysClip->setValue( m_daysLookAhead ); |
89 | m_entryColor = cfg.readEntry( "entrycolor", Qt::red.name() ); | 116 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); |
117 | SpinUrgentClip->setValue( m_urgentDays ); | ||
118 | |||
119 | m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); | ||
120 | entryColor->setColor( QColor( m_entryColor ) ); | ||
121 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); | ||
122 | headlineColor->setColor( QColor( m_headlineColor ) ); | ||
123 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); | ||
124 | urgentColor->setColor( QColor( m_urgentColor ) ); | ||
90 | } | 125 | } |
91 | 126 | ||
92 | 127 | ||
93 | void AddressBookPluginConfig::writeConfig() { | 128 | void AddressBookPluginConfig::writeConfig() { |
94 | Config cfg( "todayaddressplugin" ); | 129 | Config cfg( "todayaddressplugin" ); |
95 | cfg.setGroup( "config" ); | 130 | cfg.setGroup( "config" ); |
96 | m_max_lines_task = SpinBox2->value(); | 131 | m_max_lines_task = SpinBox2->value(); |
97 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); | 132 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); |
98 | m_maxCharClip = SpinBoxClip->value(); | 133 | m_maxCharClip = SpinBoxClip->value(); |
99 | cfg.writeEntry( "maxcharclip", m_maxCharClip ); | 134 | cfg.writeEntry( "maxcharclip", m_maxCharClip ); |
100 | m_daysLookAhead = SpinDaysClip->value(); | 135 | m_daysLookAhead = SpinDaysClip->value(); |
101 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); | 136 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); |
137 | m_urgentDays = SpinUrgentClip->value(); | ||
138 | if ( m_urgentDays > m_daysLookAhead ) | ||
139 | m_urgentDays = m_daysLookAhead; | ||
140 | cfg.writeEntry( "urgentdays", m_urgentDays ); | ||
141 | |||
102 | m_entryColor = entryColor->color().name(); | 142 | m_entryColor = entryColor->color().name(); |
103 | cfg.writeEntry( "entrycolor", m_entryColor ); | 143 | cfg.writeEntry( "entrycolor", m_entryColor ); |
144 | m_headlineColor = headlineColor->color().name(); | ||
145 | cfg.writeEntry( "headlinecolor", m_headlineColor ); | ||
146 | m_urgentColor = urgentColor->color().name(); | ||
147 | cfg.writeEntry( "urgentcolor", m_urgentColor ); | ||
104 | cfg.write(); | 148 | cfg.write(); |
105 | } | 149 | } |
106 | 150 | ||
107 | 151 | ||
108 | AddressBookPluginConfig::~AddressBookPluginConfig() { | 152 | AddressBookPluginConfig::~AddressBookPluginConfig() { |
109 | } | 153 | } |
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.h b/core/pim/today/plugins/addressbook/addresspluginconfig.h index 54c8b4f..ea03368 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.h +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.h | |||
@@ -23,41 +23,50 @@ | |||
23 | #include <qspinbox.h> | 23 | #include <qspinbox.h> |
24 | 24 | ||
25 | #include <opie/todayconfigwidget.h> | 25 | #include <opie/todayconfigwidget.h> |
26 | #include <opie/ocolorbutton.h> | 26 | #include <opie/ocolorbutton.h> |
27 | 27 | ||
28 | class AddressBookPluginConfig : public TodayConfigWidget { | 28 | class AddressBookPluginConfig : public TodayConfigWidget { |
29 | 29 | ||
30 | 30 | ||
31 | public: | 31 | public: |
32 | 32 | ||
33 | AddressBookPluginConfig( QWidget *parent, const char *name ); | 33 | AddressBookPluginConfig( QWidget *parent, const char *name ); |
34 | ~AddressBookPluginConfig(); | 34 | ~AddressBookPluginConfig(); |
35 | 35 | ||
36 | private: | 36 | private: |
37 | /** | 37 | /** |
38 | * if changed then save | 38 | * if changed then save |
39 | */ | 39 | */ |
40 | bool changed(); | 40 | bool changed(); |
41 | void readConfig(); | 41 | void readConfig(); |
42 | void writeConfig(); | 42 | void writeConfig(); |
43 | 43 | ||
44 | QSpinBox* SpinBox2; | 44 | QSpinBox* SpinBox2; |
45 | QSpinBox* SpinBoxClip; | 45 | QSpinBox* SpinBoxClip; |
46 | QSpinBox* SpinDaysClip; | 46 | QSpinBox* SpinDaysClip; |
47 | QSpinBox* SpinUrgentClip; | ||
47 | OColorButton* entryColor; | 48 | OColorButton* entryColor; |
49 | OColorButton* headlineColor; | ||
50 | OColorButton* urgentColor; | ||
48 | 51 | ||
49 | // how many lines should be showed in the AddressBook section | 52 | // how many lines should be showed in the AddressBook section |
50 | int m_max_lines_task; | 53 | int m_max_lines_task; |
51 | // clip the lines after X chars | 54 | // clip the lines after X chars |
52 | int m_maxCharClip; | 55 | int m_maxCharClip; |
53 | // How many days look ahead | 56 | // How many days look ahead |
54 | int m_daysLookAhead; | 57 | int m_daysLookAhead; |
58 | // Days until urgent color is used | ||
59 | int m_urgentDays; | ||
55 | // Entry Color | 60 | // Entry Color |
56 | QString m_entryColor; | 61 | QString m_entryColor; |
62 | // Headline Color | ||
63 | QString m_headlineColor; | ||
64 | // Urgent Color | ||
65 | QString m_urgentColor; | ||
57 | }; | 66 | }; |
58 | 67 | ||
59 | 68 | ||
60 | 69 | ||
61 | 70 | ||
62 | 71 | ||
63 | #endif | 72 | #endif |
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp index c81beee..7d87fca 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp | |||
@@ -47,126 +47,151 @@ AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* | |||
47 | 47 | ||
48 | connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ), | 48 | connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ), |
49 | this, SLOT( refresh( const OContactAccess * ) ) ); | 49 | this, SLOT( refresh( const OContactAccess * ) ) ); |
50 | 50 | ||
51 | 51 | ||
52 | readConfig(); | 52 | readConfig(); |
53 | getAddress(); | 53 | getAddress(); |
54 | } | 54 | } |
55 | 55 | ||
56 | AddressBookPluginWidget::~AddressBookPluginWidget() { | 56 | AddressBookPluginWidget::~AddressBookPluginWidget() { |
57 | delete m_contactdb; | 57 | delete m_contactdb; |
58 | } | 58 | } |
59 | 59 | ||
60 | void AddressBookPluginWidget::refresh( const OContactAccess* ) | 60 | void AddressBookPluginWidget::refresh( const OContactAccess* ) |
61 | { | 61 | { |
62 | qWarning(" AddressBookPluginWidget::Database was changed externally ! "); | 62 | qWarning(" AddressBookPluginWidget::Database was changed externally ! "); |
63 | m_contactdb->reload(); | 63 | m_contactdb->reload(); |
64 | getAddress(); | 64 | getAddress(); |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | void AddressBookPluginWidget::readConfig() { | 68 | void AddressBookPluginWidget::readConfig() { |
69 | Config cfg( "todayaddressplugin" ); | 69 | Config cfg( "todayaddressplugin" ); |
70 | cfg.setGroup( "config" ); | 70 | cfg.setGroup( "config" ); |
71 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); | 71 | m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); |
72 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 72 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
73 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); | 73 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); |
74 | m_entryColor = cfg.readEntry("entrycolor", Qt::red.name() ); | 74 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); |
75 | m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); | ||
76 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); | ||
77 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); | ||
75 | } | 78 | } |
76 | 79 | ||
77 | 80 | ||
78 | /** | 81 | /** |
79 | * Get the addresss | 82 | * Get the addresss |
80 | */ | 83 | */ |
81 | void AddressBookPluginWidget::getAddress() { | 84 | void AddressBookPluginWidget::getAddress() { |
82 | 85 | ||
83 | if ( ! layoutTodo ){ | 86 | if ( ! layoutTodo ){ |
84 | layoutTodo = new QVBoxLayout( this ); | 87 | layoutTodo = new QVBoxLayout( this ); |
85 | } | 88 | } |
86 | 89 | ||
87 | if ( ! addressLabel ) { | 90 | if ( ! addressLabel ) { |
88 | addressLabel = new OClickableLabel( this ); | 91 | addressLabel = new OClickableLabel( this ); |
89 | connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); | 92 | connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); |
90 | layoutTodo->addWidget( addressLabel ); | 93 | layoutTodo->addWidget( addressLabel ); |
91 | } | 94 | } |
92 | 95 | ||
93 | QString output; | 96 | QString output; |
94 | 97 | ||
95 | // Check whether the database provide the search option.. | 98 | // Check whether the database provide the search option.. |
96 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ | 99 | if ( ! m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ |
97 | 100 | ||
98 | // Define the query for birthdays and start search.. | 101 | // Define the query for birthdays and start search.. |
99 | QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); | 102 | QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); |
100 | qWarning("Searching from now (%s) until %s ! ", QDate::currentDate().toString().latin1(), | 103 | qWarning("Searching from now (%s) until %s ! ", QDate::currentDate().toString().latin1(), |
101 | lookAheadDate.toString().latin1() ); | 104 | lookAheadDate.toString().latin1() ); |
102 | OContact querybirthdays; | 105 | OContact querybirthdays; |
103 | querybirthdays.setBirthday( lookAheadDate ); | 106 | querybirthdays.setBirthday( lookAheadDate ); |
104 | 107 | ||
105 | int ammount = 0; | 108 | int ammount = 0; |
106 | 109 | ||
107 | m_list = m_contactdb->queryByExample( querybirthdays, OContactAccess::DateDiff ); | 110 | m_list = m_contactdb->queryByExample( querybirthdays, OContactAccess::DateDiff ); |
108 | if ( m_list.count() > 0 ){ | 111 | if ( m_list.count() > 0 ){ |
109 | output = QObject::tr( "Next birthdays in <b> %1 </b> days: <br>" ).arg( m_daysLookAhead ); | 112 | output = "<font color=" + m_headlineColor + ">" |
113 | + QObject::tr( "Next birthdays in <b> %1 </b> days:" ).arg( m_daysLookAhead ) | ||
114 | + "</font> <br>"; | ||
110 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 115 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
111 | if ( ammount++ < m_maxLinesTask ){ | 116 | if ( ammount++ < m_maxLinesTask ){ |
112 | // Now we want to calculate how many days until birthday. We have to set | 117 | // Now we want to calculate how many days until birthday. We have to set |
113 | // the correct year to calculate the day diff... | 118 | // the correct year to calculate the day diff... |
114 | QDate destdate = (*m_it).birthday(); | 119 | QDate destdate = (*m_it).birthday(); |
115 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), destdate.day() ); | 120 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), destdate.day() ); |
116 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 121 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
117 | destdate.setYMD( QDate::currentDate().year()+1, destdate.month(), destdate.day() ); | 122 | destdate.setYMD( QDate::currentDate().year()+1, destdate.month(), destdate.day() ); |
118 | 123 | ||
119 | output += "<font color=" + m_entryColor + "><b>-" + (*m_it).fullName() | 124 | |
120 | + " (" | 125 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
121 | + QString::number(QDate::currentDate().daysTo(destdate)) | 126 | output += "<font color=" + m_urgentColor + "><b>-" + (*m_it).fullName() |
122 | + " Days) </b></font><br>"; | 127 | + " (" |
128 | + QString::number(QDate::currentDate().daysTo(destdate)) | ||
129 | + " Days) </b></font><br>"; | ||
130 | |||
131 | else | ||
132 | output += "<font color=" + m_entryColor + "><b>-" + (*m_it).fullName() | ||
133 | + " (" | ||
134 | + QString::number(QDate::currentDate().daysTo(destdate)) | ||
135 | + " Days) </b></font><br>"; | ||
123 | } | 136 | } |
124 | } | 137 | } |
125 | } else { | 138 | } else { |
126 | output = QObject::tr( "No birthdays in <b> %1 </b> days! <br>" ).arg( m_daysLookAhead ); | 139 | output = "<font color=" + m_headlineColor + ">" |
140 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ).arg( m_daysLookAhead ) | ||
141 | + "</font> <br>"; | ||
127 | } | 142 | } |
128 | 143 | ||
129 | // Define the query for anniversaries and start search.. | 144 | // Define the query for anniversaries and start search.. |
130 | OContact queryanniversaries; | 145 | OContact queryanniversaries; |
131 | queryanniversaries.setAnniversary( lookAheadDate ); | 146 | queryanniversaries.setAnniversary( lookAheadDate ); |
132 | 147 | ||
133 | m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff ); | 148 | m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff ); |
134 | 149 | ||
135 | ammount = 0; | 150 | ammount = 0; |
136 | if ( m_list.count() > 0 ){ | 151 | if ( m_list.count() > 0 ){ |
137 | output += QObject::tr( "Next anniversaries in <b> %1 </b> days: <br>" ).arg( m_daysLookAhead ); | 152 | output += "<font color=" + m_headlineColor + ">" |
153 | + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ).arg( m_daysLookAhead ) | ||
154 | + "</font> <br>"; | ||
138 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 155 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
139 | if ( ammount++ < m_maxLinesTask ){ | 156 | if ( ammount++ < m_maxLinesTask ){ |
140 | // Now we want to calculate how many days until anniversary. We have to set | 157 | // Now we want to calculate how many days until anniversary. We have to set |
141 | // the correct year to calculate the day diff... | 158 | // the correct year to calculate the day diff... |
142 | QDate destdate = (*m_it).anniversary(); | 159 | QDate destdate = (*m_it).anniversary(); |
143 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), destdate.day() ); | 160 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), destdate.day() ); |
144 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 161 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
145 | destdate.setYMD( QDate::currentDate().year()+1, destdate.month(), destdate.day() ); | 162 | destdate.setYMD( QDate::currentDate().year()+1, destdate.month(), destdate.day() ); |
146 | 163 | ||
147 | output += "<font color=#e00000><b>-" + (*m_it).fullName() | 164 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
148 | + " (" | 165 | output += "<font color=" + m_urgentColor + "><b>-" + (*m_it).fullName() |
149 | + QString::number(QDate::currentDate().daysTo( destdate ) ) | 166 | + " (" |
150 | + " Days) </b></font><br>"; | 167 | + QString::number(QDate::currentDate().daysTo( destdate ) ) |
168 | + " Days) </b></font><br>"; | ||
169 | else | ||
170 | output += "<font color=" + m_entryColor + "><b>-" + (*m_it).fullName() | ||
171 | + " (" | ||
172 | + QString::number(QDate::currentDate().daysTo( destdate ) ) | ||
173 | + " Days) </b></font><br>"; | ||
151 | } | 174 | } |
152 | } | 175 | } |
153 | } else { | 176 | } else { |
154 | output += QObject::tr( "No anniversaries in <b> %1 </b> days! <br>" ).arg( m_daysLookAhead ); | 177 | output += "<font color=" + m_headlineColor + ">" |
178 | + QObject::tr( "No anniversaries in <b> %1 </b> days!" ).arg( m_daysLookAhead ) | ||
179 | + "</font> <br>"; | ||
155 | } | 180 | } |
156 | 181 | ||
157 | 182 | ||
158 | }else{ | 183 | }else{ |
159 | // Libopie seems to be old.. | 184 | // Libopie seems to be old.. |
160 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); | 185 | output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); |
161 | } | 186 | } |
162 | 187 | ||
163 | addressLabel->setText( output ); | 188 | addressLabel->setText( output ); |
164 | } | 189 | } |
165 | 190 | ||
166 | /** | 191 | /** |
167 | * start the todolist | 192 | * start the todolist |
168 | */ | 193 | */ |
169 | void AddressBookPluginWidget::startAddressBook() { | 194 | void AddressBookPluginWidget::startAddressBook() { |
170 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 195 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
171 | e << QString( "addressbook" ); | 196 | e << QString( "addressbook" ); |
172 | } | 197 | } |
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.h b/core/pim/today/plugins/addressbook/addresspluginwidget.h index fa464de..89ffe7f 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.h +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.h | |||
@@ -31,28 +31,31 @@ class AddressBookPluginWidget : public QWidget { | |||
31 | 31 | ||
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | 33 | ||
34 | public: | 34 | public: |
35 | AddressBookPluginWidget( QWidget *parent, const char *name ); | 35 | AddressBookPluginWidget( QWidget *parent, const char *name ); |
36 | ~AddressBookPluginWidget(); | 36 | ~AddressBookPluginWidget(); |
37 | 37 | ||
38 | protected slots: | 38 | protected slots: |
39 | void startAddressBook(); | 39 | void startAddressBook(); |
40 | void refresh( const OContactAccess* db ); | 40 | void refresh( const OContactAccess* db ); |
41 | 41 | ||
42 | private: | 42 | private: |
43 | OClickableLabel* addressLabel; | 43 | OClickableLabel* addressLabel; |
44 | QVBoxLayout* layoutTodo; | 44 | QVBoxLayout* layoutTodo; |
45 | OContactAccess * m_contactdb; | 45 | OContactAccess * m_contactdb; |
46 | 46 | ||
47 | OContactAccess::List m_list; | 47 | OContactAccess::List m_list; |
48 | OContactAccess::List::Iterator m_it; | 48 | OContactAccess::List::Iterator m_it; |
49 | 49 | ||
50 | void readConfig(); | 50 | void readConfig(); |
51 | void getAddress(); | 51 | void getAddress(); |
52 | int m_maxLinesTask; | 52 | int m_maxLinesTask; |
53 | int m_maxCharClip; | 53 | int m_maxCharClip; |
54 | int m_daysLookAhead; | 54 | int m_daysLookAhead; |
55 | int m_urgentDays; | ||
55 | QString m_entryColor; | 56 | QString m_entryColor; |
57 | QString m_headlineColor; | ||
58 | QString m_urgentColor; | ||
56 | }; | 59 | }; |
57 | 60 | ||
58 | #endif | 61 | #endif |