author | eilers <eilers> | 2003-01-13 13:17:17 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-01-13 13:17:17 (UTC) |
commit | 55266a0b221b065a94dc1a83860f9603c1d3c2c5 (patch) (unidiff) | |
tree | d5f25e9c77d35dc90d4881d04854cc1a5ae4eabc | |
parent | aa4f80fdc2d78bfe1c1d4cb8ec1d852115d00fc7 (diff) | |
download | opie-55266a0b221b065a94dc1a83860f9603c1d3c2c5.zip opie-55266a0b221b065a94dc1a83860f9603c1d3c2c5.tar.gz opie-55266a0b221b065a94dc1a83860f9603c1d3c2c5.tar.bz2 |
Bugfixed and improved color settings ! Now it is possible to change
the color if the anniversary/birthday is close.. :)
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 | |||
@@ -39,3 +39,3 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
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 | ||
@@ -48,3 +48,3 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
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 | ||
@@ -57,4 +57,3 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
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" ); |
@@ -66,6 +65,30 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
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 | ||
@@ -75,4 +98,8 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* | |||
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 | } |
@@ -88,3 +115,11 @@ void AddressBookPluginConfig::readConfig() { | |||
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 | } |
@@ -101,4 +136,13 @@ void AddressBookPluginConfig::writeConfig() { | |||
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(); |
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 | |||
@@ -46,3 +46,6 @@ private: | |||
46 | QSpinBox* SpinDaysClip; | 46 | QSpinBox* SpinDaysClip; |
47 | QSpinBox* SpinUrgentClip; | ||
47 | OColorButton* entryColor; | 48 | OColorButton* entryColor; |
49 | OColorButton* headlineColor; | ||
50 | OColorButton* urgentColor; | ||
48 | 51 | ||
@@ -54,4 +57,10 @@ private: | |||
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 | }; |
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 | |||
@@ -70,6 +70,9 @@ void AddressBookPluginWidget::readConfig() { | |||
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 | } |
@@ -108,3 +111,5 @@ void AddressBookPluginWidget::getAddress() { | |||
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 ) { |
@@ -118,6 +123,14 @@ void AddressBookPluginWidget::getAddress() { | |||
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 | } |
@@ -125,3 +138,5 @@ void AddressBookPluginWidget::getAddress() { | |||
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 | } |
@@ -136,3 +151,5 @@ void AddressBookPluginWidget::getAddress() { | |||
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 ) { |
@@ -146,6 +163,12 @@ void AddressBookPluginWidget::getAddress() { | |||
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 | } |
@@ -153,3 +176,5 @@ void AddressBookPluginWidget::getAddress() { | |||
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 | } |
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 | |||
@@ -54,3 +54,6 @@ private: | |||
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 | }; |