author | groucho <groucho> | 2003-01-27 08:49:52 (UTC) |
---|---|---|
committer | groucho <groucho> | 2003-01-27 08:49:52 (UTC) |
commit | dd9560a3f08593d99036adfad6636f4aaa52a01b (patch) (unidiff) | |
tree | 09ea262ef72f0f45051184531f94fafcd7b33d30 | |
parent | 85edd77c0da9c2aec1b57238d010e84db1607363 (diff) | |
download | opie-dd9560a3f08593d99036adfad6636f4aaa52a01b.zip opie-dd9560a3f08593d99036adfad6636f4aaa52a01b.tar.gz opie-dd9560a3f08593d99036adfad6636f4aaa52a01b.tar.bz2 |
Changes to make the weeklstview show translated day headers
Addressbookplugin was not translated, however this beast still does not show the translated strings
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/plugins/addressbook/addressbook.pro | 19 | ||||
-rw-r--r-- | core/pim/today/plugins/addressbook/addresspluginconfig.cpp | 1 |
3 files changed, 21 insertions, 3 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 7451abc..9089fe9 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -1,233 +1,233 @@ | |||
1 | #include "datebookweeklst.h" | 1 | #include "datebookweeklst.h" |
2 | 2 | ||
3 | #include "datebookweekheaderimpl.h" | 3 | #include "datebookweekheaderimpl.h" |
4 | 4 | ||
5 | #include <qpe/calendar.h> | 5 | #include <qpe/calendar.h> |
6 | #include <qpe/datebookdb.h> | 6 | #include <qpe/datebookdb.h> |
7 | #include <qpe/event.h> | 7 | #include <qpe/event.h> |
8 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/timestring.h> | 9 | #include <qpe/timestring.h> |
10 | #include <qpe/datebookmonth.h> | 10 | #include <qpe/datebookmonth.h> |
11 | #include <qpe/config.h> | 11 | #include <qpe/config.h> |
12 | 12 | ||
13 | #include <qdatetime.h> | 13 | #include <qdatetime.h> |
14 | #include <qheader.h> | 14 | #include <qheader.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qlayout.h> | 16 | #include <qlayout.h> |
17 | #include <qpainter.h> | 17 | #include <qpainter.h> |
18 | #include <qpopupmenu.h> | 18 | #include <qpopupmenu.h> |
19 | #include <qtimer.h> | 19 | #include <qtimer.h> |
20 | #include <qstyle.h> | 20 | #include <qstyle.h> |
21 | #include <qtoolbutton.h> | 21 | #include <qtoolbutton.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qsizepolicy.h> | 23 | #include <qsizepolicy.h> |
24 | #include <qabstractlayout.h> | 24 | #include <qabstractlayout.h> |
25 | #include <qtl.h> | 25 | #include <qtl.h> |
26 | 26 | ||
27 | bool calcWeek(const QDate &d, int &week, int &year, | 27 | bool calcWeek(const QDate &d, int &week, int &year, |
28 | bool startOnMonday = false); | 28 | bool startOnMonday = false); |
29 | 29 | ||
30 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, | 30 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, |
31 | const char* name, WFlags fl) | 31 | const char* name, WFlags fl) |
32 | : DateBookWeekLstHeaderBase(parent, name, fl) | 32 | : DateBookWeekLstHeaderBase(parent, name, fl) |
33 | { | 33 | { |
34 | setBackgroundMode( PaletteButton ); | 34 | setBackgroundMode( PaletteButton ); |
35 | labelDate->setBackgroundMode( PaletteButton ); | 35 | labelDate->setBackgroundMode( PaletteButton ); |
36 | labelWeek->setBackgroundMode( PaletteButton ); | 36 | labelWeek->setBackgroundMode( PaletteButton ); |
37 | forward->setBackgroundMode( PaletteButton ); | 37 | forward->setBackgroundMode( PaletteButton ); |
38 | back->setBackgroundMode( PaletteButton ); | 38 | back->setBackgroundMode( PaletteButton ); |
39 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | 39 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); |
40 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | 40 | DateBookWeekLstHeaderBaseLayout->setMargin(0); |
41 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | 41 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); |
42 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | 42 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); |
43 | 43 | ||
44 | connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); | 44 | connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); |
45 | connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); | 45 | connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); |
46 | connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); | 46 | connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); |
47 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | 47 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); |
48 | onMonday=onM; | 48 | onMonday=onM; |
49 | } | 49 | } |
50 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | 50 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} |
51 | void DateBookWeekLstHeader::setDate(const QDate &d) { | 51 | void DateBookWeekLstHeader::setDate(const QDate &d) { |
52 | date=d; | 52 | date=d; |
53 | 53 | ||
54 | int year,week; | 54 | int year,week; |
55 | calcWeek(d,week,year,onMonday); | 55 | calcWeek(d,week,year,onMonday); |
56 | labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) ); | 56 | labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) ); |
57 | 57 | ||
58 | QDate start=date; | 58 | QDate start=date; |
59 | QDate stop=start.addDays(6); | 59 | QDate stop=start.addDays(6); |
60 | labelDate->setText( QString::number(start.day()) + " " + | 60 | labelDate->setText( QString::number(start.day()) + " " + |
61 | start.monthName(start.month()) + " - " + | 61 | start.monthName(start.month()) + " - " + |
62 | QString::number(stop.day()) + " " + | 62 | QString::number(stop.day()) + " " + |
63 | start.monthName(stop.month()) ); | 63 | start.monthName(stop.month()) ); |
64 | emit dateChanged(year,week); | 64 | emit dateChanged(year,week); |
65 | } | 65 | } |
66 | void DateBookWeekLstHeader::pickDate() { | 66 | void DateBookWeekLstHeader::pickDate() { |
67 | static QPopupMenu *m1 = 0; | 67 | static QPopupMenu *m1 = 0; |
68 | static DateBookMonth *picker = 0; | 68 | static DateBookMonth *picker = 0; |
69 | if ( !m1 ) { | 69 | if ( !m1 ) { |
70 | m1 = new QPopupMenu( this ); | 70 | m1 = new QPopupMenu( this ); |
71 | picker = new DateBookMonth( m1, 0, TRUE ); | 71 | picker = new DateBookMonth( m1, 0, TRUE ); |
72 | m1->insertItem( picker ); | 72 | m1->insertItem( picker ); |
73 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | 73 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), |
74 | this, SLOT( setDate( int, int, int ) ) ); | 74 | this, SLOT( setDate( int, int, int ) ) ); |
75 | //connect( m1, SIGNAL( aboutToHide() ), | 75 | //connect( m1, SIGNAL( aboutToHide() ), |
76 | //this, SLOT( gotHide() ) ); | 76 | //this, SLOT( gotHide() ) ); |
77 | } | 77 | } |
78 | picker->setDate( date.year(), date.month(), date.day() ); | 78 | picker->setDate( date.year(), date.month(), date.day() ); |
79 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); | 79 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); |
80 | picker->setFocus(); | 80 | picker->setFocus(); |
81 | } | 81 | } |
82 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | 82 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { |
83 | QDate new_date(y,m,d); | 83 | QDate new_date(y,m,d); |
84 | setDate(new_date); | 84 | setDate(new_date); |
85 | } | 85 | } |
86 | 86 | ||
87 | void DateBookWeekLstHeader::nextWeek() { | 87 | void DateBookWeekLstHeader::nextWeek() { |
88 | setDate(date.addDays(7)); | 88 | setDate(date.addDays(7)); |
89 | } | 89 | } |
90 | void DateBookWeekLstHeader::prevWeek() { | 90 | void DateBookWeekLstHeader::prevWeek() { |
91 | setDate(date.addDays(-7)); | 91 | setDate(date.addDays(-7)); |
92 | } | 92 | } |
93 | 93 | ||
94 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, | 94 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, |
95 | QWidget* parent, | 95 | QWidget* parent, |
96 | const char* name, | 96 | const char* name, |
97 | WFlags fl ) | 97 | WFlags fl ) |
98 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | 98 | : DateBookWeekLstDayHdrBase(parent, name, fl) { |
99 | 99 | ||
100 | date=d; | 100 | date=d; |
101 | 101 | ||
102 | static const char *wdays="MTWTFSS"; | 102 | static const char *wdays={"MTWTFSS"}; |
103 | char day=wdays[d.dayOfWeek()-1]; | 103 | char day=wdays[d.dayOfWeek()-1]; |
104 | 104 | ||
105 | label->setText( QString(QChar(day)) + " " + | 105 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " + |
106 | QString::number(d.day()) ); | 106 | QString::number(d.day()) ); |
107 | add->setText("+"); | 107 | add->setText("+"); |
108 | 108 | ||
109 | if (d == QDate::currentDate()) { | 109 | if (d == QDate::currentDate()) { |
110 | QPalette pal=label->palette(); | 110 | QPalette pal=label->palette(); |
111 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | 111 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); |
112 | label->setPalette(pal); | 112 | label->setPalette(pal); |
113 | 113 | ||
114 | /* | 114 | /* |
115 | QFont f=label->font(); | 115 | QFont f=label->font(); |
116 | f.setItalic(true); | 116 | f.setItalic(true); |
117 | label->setFont(f); | 117 | label->setFont(f); |
118 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | 118 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); |
119 | */ | 119 | */ |
120 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | 120 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday |
121 | QPalette pal=label->palette(); | 121 | QPalette pal=label->palette(); |
122 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | 122 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); |
123 | label->setPalette(pal); | 123 | label->setPalette(pal); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | 127 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); |
128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | 128 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); |
129 | } | 129 | } |
130 | 130 | ||
131 | void DateBookWeekLstDayHdr::showDay() { | 131 | void DateBookWeekLstDayHdr::showDay() { |
132 | emit showDate(date.year(), date.month(), date.day()); | 132 | emit showDate(date.year(), date.month(), date.day()); |
133 | } | 133 | } |
134 | void DateBookWeekLstDayHdr::newEvent() { | 134 | void DateBookWeekLstDayHdr::newEvent() { |
135 | QDateTime start, stop; | 135 | QDateTime start, stop; |
136 | start=stop=date; | 136 | start=stop=date; |
137 | start.setTime(QTime(10,0)); | 137 | start.setTime(QTime(10,0)); |
138 | stop.setTime(QTime(12,0)); | 138 | stop.setTime(QTime(12,0)); |
139 | 139 | ||
140 | emit addEvent(start,stop,""); | 140 | emit addEvent(start,stop,""); |
141 | } | 141 | } |
142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | 142 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, |
143 | QWidget* parent, | 143 | QWidget* parent, |
144 | const char* name, | 144 | const char* name, |
145 | WFlags fl) : | 145 | WFlags fl) : |
146 | OClickableLabel(parent,name,fl), | 146 | OClickableLabel(parent,name,fl), |
147 | event(ev) | 147 | event(ev) |
148 | { | 148 | { |
149 | char s[10]; | 149 | char s[10]; |
150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) | 150 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) |
151 | if ( ev.endDate() == ev.date() ) { // last day | 151 | if ( ev.endDate() == ev.date() ) { // last day |
152 | strcpy(s, "__|__"); | 152 | strcpy(s, "__|__"); |
153 | } else { | 153 | } else { |
154 | strcpy(s, " |---"); | 154 | strcpy(s, " |---"); |
155 | } | 155 | } |
156 | } else { | 156 | } else { |
157 | if(ev.event().type() == Event::Normal ) | 157 | if(ev.event().type() == Event::Normal ) |
158 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); | 158 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); |
159 | else | 159 | else |
160 | sprintf(s," "); | 160 | sprintf(s," "); |
161 | } | 161 | } |
162 | setText(QString(s) + " " + ev.description()); | 162 | setText(QString(s) + " " + ev.description()); |
163 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 163 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
164 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 164 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
165 | } | 165 | } |
166 | void DateBookWeekLstEvent::editMe() { | 166 | void DateBookWeekLstEvent::editMe() { |
167 | emit editEvent(event.event()); | 167 | emit editEvent(event.event()); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 171 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
172 | const QDate &d, bool onM, | 172 | const QDate &d, bool onM, |
173 | QWidget* parent, | 173 | QWidget* parent, |
174 | const char* name, WFlags fl) | 174 | const char* name, WFlags fl) |
175 | : QWidget( parent, name, fl ) | 175 | : QWidget( parent, name, fl ) |
176 | { | 176 | { |
177 | onMonday=onM; | 177 | onMonday=onM; |
178 | setPalette(white); | 178 | setPalette(white); |
179 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | 179 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); |
180 | 180 | ||
181 | QVBoxLayout *layout = new QVBoxLayout( this ); | 181 | QVBoxLayout *layout = new QVBoxLayout( this ); |
182 | 182 | ||
183 | qBubbleSort(ev); | 183 | qBubbleSort(ev); |
184 | QValueListIterator<EffectiveEvent> it; | 184 | QValueListIterator<EffectiveEvent> it; |
185 | it=ev.begin(); | 185 | it=ev.begin(); |
186 | 186 | ||
187 | int dayOrder[7]; | 187 | int dayOrder[7]; |
188 | if (onMonday) | 188 | if (onMonday) |
189 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | 189 | for (int d=0; d<7; d++) dayOrder[d]=d+1; |
190 | else { | 190 | else { |
191 | for (int d=0; d<7; d++) dayOrder[d]=d; | 191 | for (int d=0; d<7; d++) dayOrder[d]=d; |
192 | dayOrder[0]=7; | 192 | dayOrder[0]=7; |
193 | } | 193 | } |
194 | 194 | ||
195 | for (int i=0; i<7; i++) { | 195 | for (int i=0; i<7; i++) { |
196 | // Header | 196 | // Header |
197 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), | 197 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), |
198 | onMonday,this); | 198 | onMonday,this); |
199 | connect(hdr, SIGNAL(showDate(int,int,int)), | 199 | connect(hdr, SIGNAL(showDate(int,int,int)), |
200 | this, SIGNAL(showDate(int,int,int))); | 200 | this, SIGNAL(showDate(int,int,int))); |
201 | connect(hdr, SIGNAL(addEvent(const QDateTime &, | 201 | connect(hdr, SIGNAL(addEvent(const QDateTime &, |
202 | const QDateTime &, | 202 | const QDateTime &, |
203 | const QString &)), | 203 | const QString &)), |
204 | this, SIGNAL(addEvent(const QDateTime &, | 204 | this, SIGNAL(addEvent(const QDateTime &, |
205 | const QDateTime &, | 205 | const QDateTime &, |
206 | const QString &))); | 206 | const QString &))); |
207 | layout->addWidget(hdr); | 207 | layout->addWidget(hdr); |
208 | 208 | ||
209 | // Events | 209 | // Events |
210 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | 210 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { |
211 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); | 211 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); |
212 | layout->addWidget(l); | 212 | layout->addWidget(l); |
213 | connect (l, SIGNAL(editEvent(const Event &)), | 213 | connect (l, SIGNAL(editEvent(const Event &)), |
214 | this, SIGNAL(editEvent(const Event &))); | 214 | this, SIGNAL(editEvent(const Event &))); |
215 | it++; | 215 | it++; |
216 | } | 216 | } |
217 | 217 | ||
218 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 218 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | DateBookWeekLstView::~DateBookWeekLstView(){} | 221 | DateBookWeekLstView::~DateBookWeekLstView(){} |
222 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | 222 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} |
223 | 223 | ||
224 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | 224 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
225 | QValueList<EffectiveEvent> &ev2, | 225 | QValueList<EffectiveEvent> &ev2, |
226 | QDate &d, bool onM, | 226 | QDate &d, bool onM, |
227 | QWidget* parent, | 227 | QWidget* parent, |
228 | const char* name, WFlags fl) | 228 | const char* name, WFlags fl) |
229 | : QWidget( parent, name, fl ) | 229 | : QWidget( parent, name, fl ) |
230 | { | 230 | { |
231 | QHBoxLayout *layout = new QHBoxLayout( this ); | 231 | QHBoxLayout *layout = new QHBoxLayout( this ); |
232 | 232 | ||
233 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); | 233 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); |
diff --git a/core/pim/today/plugins/addressbook/addressbook.pro b/core/pim/today/plugins/addressbook/addressbook.pro index fd7d786..3ee5bce 100644 --- a/core/pim/today/plugins/addressbook/addressbook.pro +++ b/core/pim/today/plugins/addressbook/addressbook.pro | |||
@@ -1,23 +1,42 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt release | 3 | CONFIG += qt release |
4 | 4 | ||
5 | # Input | 5 | # Input |
6 | HEADERS = addressplugin.h addresspluginimpl.h addresspluginconfig.h \ | 6 | HEADERS = addressplugin.h addresspluginimpl.h addresspluginconfig.h \ |
7 | addresspluginwidget.h | 7 | addresspluginwidget.h |
8 | SOURCES = addressplugin.cpp addresspluginimpl.cpp addresspluginconfig.cpp \ | 8 | SOURCES = addressplugin.cpp addresspluginimpl.cpp addresspluginconfig.cpp \ |
9 | addresspluginwidget.cpp | 9 | addresspluginwidget.cpp |
10 | 10 | ||
11 | INCLUDEPATH += $(OPIEDIR)/include \ | 11 | INCLUDEPATH += $(OPIEDIR)/include \ |
12 | ../ ../library | 12 | ../ ../library |
13 | DEPENDPATH += $(OPIEDIR)/include \ | 13 | DEPENDPATH += $(OPIEDIR)/include \ |
14 | ../ ../library | 14 | ../ ../library |
15 | 15 | ||
16 | LIBS+= -lqpe -lopie | 16 | LIBS+= -lqpe -lopie |
17 | 17 | ||
18 | DESTDIR = $(OPIEDIR)/plugins/today | 18 | DESTDIR = $(OPIEDIR)/plugins/today |
19 | TARGET = todayaddressbookplugin | 19 | TARGET = todayaddressbookplugin |
20 | 20 | ||
21 | TRANSLATIONS = ../../../../../i18n/de/libtodayaddressbookplugin.ts \ | ||
22 | ../../../../../i18n/xx/libtodayaddressbookplugin.ts \ | ||
23 | ../../../../../i18n/en/libtodayaddressbookplugin.ts \ | ||
24 | ../../../../../i18n/es/libtodayaddressbookplugin.ts \ | ||
25 | ../../../../../i18n/fr/libtodayaddressbookplugin.ts \ | ||
26 | ../../../../../i18n/hu/libtodayaddressbookplugin.ts \ | ||
27 | ../../../../../i18n/ja/libtodayaddressbookplugin.ts \ | ||
28 | ../../../../../i18n/ko/libtodayaddressbookplugin.ts \ | ||
29 | ../../../../../i18n/no/libtodayaddressbookplugin.ts \ | ||
30 | ../../../../../i18n/pl/libtodayaddressbookplugin.ts \ | ||
31 | ../../../../../i18n/pt/libtodayaddressbookplugin.ts \ | ||
32 | ../../../../../i18n/pt_BR/libtodayaddressbookplugin.ts \ | ||
33 | ../../../../../i18n/sl/libtodayaddressbookplugin.ts \ | ||
34 | ../../../../../i18n/zh_CN/libtodayaddressbookplugin.ts \ | ||
35 | ../../../../../i18n/zh_TW/libtodayaddressbookplugin.ts \ | ||
36 | ../../../../../i18n/it/libtodayaddressbookplugin.ts \ | ||
37 | ../../../../../i18n/da/libtodayaddressbookplugin.ts | ||
38 | |||
39 | |||
21 | 40 | ||
22 | 41 | ||
23 | include ( $(OPIEDIR)/include.pro ) | 42 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp index 8d7bec6..a234236 100644 --- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp | |||
@@ -1,153 +1,152 @@ | |||
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 <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 | |||
31 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) | 30 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) |
32 | : TodayConfigWidget(parent, name ) { | 31 | : TodayConfigWidget(parent, name ) { |
33 | 32 | ||
34 | QVBoxLayout * layout = new QVBoxLayout( this ); | 33 | QVBoxLayout * layout = new QVBoxLayout( this ); |
35 | layout->setMargin( 20 ); | 34 | layout->setMargin( 20 ); |
36 | 35 | ||
37 | QHBox *box1 = new QHBox( this ); | 36 | QHBox *box1 = new QHBox( this ); |
38 | 37 | ||
39 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); | 38 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); |
40 | TextLabel6->setText( tr( "Max Lines: " ) ); | 39 | TextLabel6->setText( tr( "Max Lines: " ) ); |
41 | 40 | ||
42 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); | 41 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); |
43 | SpinBox2->setMaxValue( 40 ); | 42 | SpinBox2->setMaxValue( 40 ); |
44 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); | 43 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); |
45 | 44 | ||
46 | QHBox *box2 = new QHBox( this ); | 45 | QHBox *box2 = new QHBox( this ); |
47 | 46 | ||
48 | QLabel* clipLabel = new QLabel( box2, "" ); | 47 | QLabel* clipLabel = new QLabel( box2, "" ); |
49 | clipLabel->setText( tr( "Clip line after X chars: " ) ); | 48 | clipLabel->setText( tr( "Clip line after X chars: " ) ); |
50 | 49 | ||
51 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); | 50 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); |
52 | SpinBoxClip->setMaxValue( 200 ); | 51 | SpinBoxClip->setMaxValue( 200 ); |
53 | QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); | 52 | QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); |
54 | 53 | ||
55 | QHBox *box3 = new QHBox( this ); | 54 | QHBox *box3 = new QHBox( this ); |
56 | 55 | ||
57 | QLabel* daysLabel = new QLabel( box3, "" ); | 56 | QLabel* daysLabel = new QLabel( box3, "" ); |
58 | daysLabel->setText( tr( "Days look ahead: " ) ); | 57 | daysLabel->setText( tr( "Days look ahead: " ) ); |
59 | SpinDaysClip = new QSpinBox( box3, "SpinDays" ); | 58 | SpinDaysClip = new QSpinBox( box3, "SpinDays" ); |
60 | SpinDaysClip->setMaxValue( 200 ); | 59 | SpinDaysClip->setMaxValue( 200 ); |
61 | QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); | 60 | QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); |
62 | 61 | ||
63 | QHBox *box4 = new QHBox( this ); | 62 | QHBox *box4 = new QHBox( this ); |
64 | 63 | ||
65 | QLabel* colorLabel = new QLabel( box4, "" ); | 64 | QLabel* colorLabel = new QLabel( box4, "" ); |
66 | colorLabel->setText( tr( "To activate settings: Restart application !" ) ); | 65 | colorLabel->setText( tr( "To activate settings: Restart application !" ) ); |
67 | 66 | ||
68 | QHBox *box5 = new QHBox( this ); | 67 | QHBox *box5 = new QHBox( this ); |
69 | 68 | ||
70 | QLabel* colorLabel2 = new QLabel( box5, "" ); | 69 | QLabel* colorLabel2 = new QLabel( box5, "" ); |
71 | colorLabel2->setText( tr( "Set Headline Color: " ) ); | 70 | colorLabel2->setText( tr( "Set Headline Color: " ) ); |
72 | headlineColor = new OColorButton( box5, black , "headlineColor" ); | 71 | headlineColor = new OColorButton( box5, black , "headlineColor" ); |
73 | QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); | 72 | QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); |
74 | 73 | ||
75 | QHBox *box6 = new QHBox( this ); | 74 | QHBox *box6 = new QHBox( this ); |
76 | 75 | ||
77 | QLabel* colorLabel3= new QLabel( box6, "" ); | 76 | QLabel* colorLabel3= new QLabel( box6, "" ); |
78 | colorLabel3->setText( tr( "Set Entry Color: " ) ); | 77 | colorLabel3->setText( tr( "Set Entry Color: " ) ); |
79 | entryColor = new OColorButton( box6, black , "entryColor" ); | 78 | entryColor = new OColorButton( box6, black , "entryColor" ); |
80 | QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); | 79 | QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); |
81 | 80 | ||
82 | QHBox *box7 = new QHBox( this ); | 81 | QHBox *box7 = new QHBox( this ); |
83 | 82 | ||
84 | QLabel* colorLabel5 = new QLabel( box7, "" ); | 83 | QLabel* colorLabel5 = new QLabel( box7, "" ); |
85 | colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); | 84 | colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); |
86 | SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); | 85 | SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); |
87 | SpinUrgentClip->setMaxValue( 200 ); | 86 | SpinUrgentClip->setMaxValue( 200 ); |
88 | QLabel* colorLabel6 = new QLabel( box7, "" ); | 87 | QLabel* colorLabel6 = new QLabel( box7, "" ); |
89 | colorLabel6->setText( tr( " days: " ) ); | 88 | colorLabel6->setText( tr( " days: " ) ); |
90 | urgentColor = new OColorButton( box7, red , "urgentColor" ); | 89 | urgentColor = new OColorButton( box7, red , "urgentColor" ); |
91 | QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); | 90 | QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); |
92 | QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); | 91 | QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); |
93 | 92 | ||
94 | 93 | ||
95 | layout->addWidget( box4 ); | 94 | layout->addWidget( box4 ); |
96 | layout->addWidget( box1 ); | 95 | layout->addWidget( box1 ); |
97 | layout->addWidget( box2 ); | 96 | layout->addWidget( box2 ); |
98 | layout->addWidget( box3 ); | 97 | layout->addWidget( box3 ); |
99 | layout->addWidget( box5 ); | 98 | layout->addWidget( box5 ); |
100 | layout->addWidget( box6 ); | 99 | layout->addWidget( box6 ); |
101 | layout->addWidget( box7 ); | 100 | layout->addWidget( box7 ); |
102 | 101 | ||
103 | readConfig(); | 102 | readConfig(); |
104 | 103 | ||
105 | } | 104 | } |
106 | 105 | ||
107 | void AddressBookPluginConfig::readConfig() { | 106 | void AddressBookPluginConfig::readConfig() { |
108 | Config cfg( "todayaddressplugin" ); | 107 | Config cfg( "todayaddressplugin" ); |
109 | cfg.setGroup( "config" ); | 108 | cfg.setGroup( "config" ); |
110 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); | 109 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); |
111 | SpinBox2->setValue( m_max_lines_task ); | 110 | SpinBox2->setValue( m_max_lines_task ); |
112 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 111 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
113 | SpinBoxClip->setValue( m_maxCharClip ); | 112 | SpinBoxClip->setValue( m_maxCharClip ); |
114 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); | 113 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); |
115 | SpinDaysClip->setValue( m_daysLookAhead ); | 114 | SpinDaysClip->setValue( m_daysLookAhead ); |
116 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); | 115 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); |
117 | SpinUrgentClip->setValue( m_urgentDays ); | 116 | SpinUrgentClip->setValue( m_urgentDays ); |
118 | 117 | ||
119 | m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); | 118 | m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); |
120 | entryColor->setColor( QColor( m_entryColor ) ); | 119 | entryColor->setColor( QColor( m_entryColor ) ); |
121 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); | 120 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); |
122 | headlineColor->setColor( QColor( m_headlineColor ) ); | 121 | headlineColor->setColor( QColor( m_headlineColor ) ); |
123 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); | 122 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); |
124 | urgentColor->setColor( QColor( m_urgentColor ) ); | 123 | urgentColor->setColor( QColor( m_urgentColor ) ); |
125 | } | 124 | } |
126 | 125 | ||
127 | 126 | ||
128 | void AddressBookPluginConfig::writeConfig() { | 127 | void AddressBookPluginConfig::writeConfig() { |
129 | Config cfg( "todayaddressplugin" ); | 128 | Config cfg( "todayaddressplugin" ); |
130 | cfg.setGroup( "config" ); | 129 | cfg.setGroup( "config" ); |
131 | m_max_lines_task = SpinBox2->value(); | 130 | m_max_lines_task = SpinBox2->value(); |
132 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); | 131 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); |
133 | m_maxCharClip = SpinBoxClip->value(); | 132 | m_maxCharClip = SpinBoxClip->value(); |
134 | cfg.writeEntry( "maxcharclip", m_maxCharClip ); | 133 | cfg.writeEntry( "maxcharclip", m_maxCharClip ); |
135 | m_daysLookAhead = SpinDaysClip->value(); | 134 | m_daysLookAhead = SpinDaysClip->value(); |
136 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); | 135 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); |
137 | m_urgentDays = SpinUrgentClip->value(); | 136 | m_urgentDays = SpinUrgentClip->value(); |
138 | if ( m_urgentDays > m_daysLookAhead ) | 137 | if ( m_urgentDays > m_daysLookAhead ) |
139 | m_urgentDays = m_daysLookAhead; | 138 | m_urgentDays = m_daysLookAhead; |
140 | cfg.writeEntry( "urgentdays", m_urgentDays ); | 139 | cfg.writeEntry( "urgentdays", m_urgentDays ); |
141 | 140 | ||
142 | m_entryColor = entryColor->color().name(); | 141 | m_entryColor = entryColor->color().name(); |
143 | cfg.writeEntry( "entrycolor", m_entryColor ); | 142 | cfg.writeEntry( "entrycolor", m_entryColor ); |
144 | m_headlineColor = headlineColor->color().name(); | 143 | m_headlineColor = headlineColor->color().name(); |
145 | cfg.writeEntry( "headlinecolor", m_headlineColor ); | 144 | cfg.writeEntry( "headlinecolor", m_headlineColor ); |
146 | m_urgentColor = urgentColor->color().name(); | 145 | m_urgentColor = urgentColor->color().name(); |
147 | cfg.writeEntry( "urgentcolor", m_urgentColor ); | 146 | cfg.writeEntry( "urgentcolor", m_urgentColor ); |
148 | cfg.write(); | 147 | cfg.write(); |
149 | } | 148 | } |
150 | 149 | ||
151 | 150 | ||
152 | AddressBookPluginConfig::~AddressBookPluginConfig() { | 151 | AddressBookPluginConfig::~AddressBookPluginConfig() { |
153 | } | 152 | } |