summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.pro4
-rw-r--r--core/pim/datebook/datebookweeklst.cpp2
-rw-r--r--core/pim/datebook/datebookweeklst.h4
-rw-r--r--core/pim/datebook/datebookweeklstdayhdr.ui8
-rw-r--r--core/pim/datebook/dateentryimpl.cpp8
-rw-r--r--core/pim/datebook/opie-datebook.control2
-rw-r--r--core/pim/datebook/timepicker.cpp19
-rw-r--r--core/pim/datebook/timepicker.h6
-rw-r--r--libopie/libopie.pro4
-rw-r--r--libopie/oclickablelabel.cpp (renamed from core/pim/datebook/clickablelabel.cpp)18
-rw-r--r--libopie/oclickablelabel.h (renamed from core/pim/datebook/clickablelabel.h)4
11 files changed, 40 insertions, 39 deletions
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index a8a9285..9383053 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -1,55 +1,53 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 4
5 HEADERS= datebookday.h \ 5 HEADERS= datebookday.h \
6 datebook.h \ 6 datebook.h \
7 dateentryimpl.h \ 7 dateentryimpl.h \
8 datebookdayheaderimpl.h \ 8 datebookdayheaderimpl.h \
9 datebooksettings.h \ 9 datebooksettings.h \
10 datebookweek.h \ 10 datebookweek.h \
11 datebookweeklst.h \ 11 datebookweeklst.h \
12 datebookweekheaderimpl.h \ 12 datebookweekheaderimpl.h \
13 repeatentry.h \ 13 repeatentry.h \
14 clickablelabel.h \
15 timepicker.h 14 timepicker.h
16 15
17 SOURCES= main.cpp \ 16 SOURCES= main.cpp \
18 datebookday.cpp \ 17 datebookday.cpp \
19 datebook.cpp \ 18 datebook.cpp \
20 dateentryimpl.cpp \ 19 dateentryimpl.cpp \
21 datebookdayheaderimpl.cpp \ 20 datebookdayheaderimpl.cpp \
22 datebooksettings.cpp \ 21 datebooksettings.cpp \
23 datebookweek.cpp \ 22 datebookweek.cpp \
24 datebookweeklst.cpp \ 23 datebookweeklst.cpp \
25 datebookweekheaderimpl.cpp \ 24 datebookweekheaderimpl.cpp \
26 repeatentry.cpp \ 25 repeatentry.cpp \
27 clickablelabel.cpp \
28 timepicker.cpp 26 timepicker.cpp
29 27
30 INTERFACES= dateentry.ui \ 28 INTERFACES= dateentry.ui \
31 datebookdayheader.ui \ 29 datebookdayheader.ui \
32 datebooksettingsbase.ui \ 30 datebooksettingsbase.ui \
33 datebookweekheader.ui \ 31 datebookweekheader.ui \
34 datebookweeklstheader.ui \ 32 datebookweeklstheader.ui \
35 datebookweeklstdayhdr.ui \ 33 datebookweeklstdayhdr.ui \
36 repeatentrybase.ui 34 repeatentrybase.ui
37 35
38INCLUDEPATH += $(OPIEDIR)/include 36INCLUDEPATH += $(OPIEDIR)/include
39 DEPENDPATH+= $(OPIEDIR)/include 37 DEPENDPATH+= $(OPIEDIR)/include
40LIBS += -lqpe 38LIBS += -lqpe -lopie
41 39
42 TARGET = datebook 40 TARGET = datebook
43 41
44TRANSLATIONS = ../i18n/pt_BR/datebook.ts 42TRANSLATIONS = ../i18n/pt_BR/datebook.ts
45TRANSLATIONS += ../i18n/de/datebook.ts 43TRANSLATIONS += ../i18n/de/datebook.ts
46TRANSLATIONS += ../i18n/en/datebook.ts 44TRANSLATIONS += ../i18n/en/datebook.ts
47TRANSLATIONS += ../i18n/hu/datebook.ts 45TRANSLATIONS += ../i18n/hu/datebook.ts
48TRANSLATIONS += ../i18n/pl/datebook.ts 46TRANSLATIONS += ../i18n/pl/datebook.ts
49TRANSLATIONS += ../i18n/sl/datebook.ts 47TRANSLATIONS += ../i18n/sl/datebook.ts
50TRANSLATIONS += ../i18n/ja/datebook.ts 48TRANSLATIONS += ../i18n/ja/datebook.ts
51TRANSLATIONS += ../i18n/ko/datebook.ts 49TRANSLATIONS += ../i18n/ko/datebook.ts
52TRANSLATIONS += ../i18n/no/datebook.ts 50TRANSLATIONS += ../i18n/no/datebook.ts
53TRANSLATIONS += ../i18n/zh_CN/datebook.ts 51TRANSLATIONS += ../i18n/zh_CN/datebook.ts
54TRANSLATIONS += ../i18n/zh_TW/datebook.ts 52TRANSLATIONS += ../i18n/zh_TW/datebook.ts
55TRANSLATIONS += ../i18n/fr/datebook.ts 53TRANSLATIONS += ../i18n/fr/datebook.ts
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 85c745a..8e88377 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -1,338 +1,338 @@
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
27bool calcWeek(const QDate &d, int &week, int &year, 27bool calcWeek(const QDate &d, int &week, int &year,
28 bool startOnMonday = false); 28 bool startOnMonday = false);
29 29
30DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, 30DateBookWeekLstHeader::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}
50DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 50DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
51void DateBookWeekLstHeader::setDate(const QDate &d) { 51void 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("W: " + QString::number(week)); 56 labelWeek->setText("W: " + 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}
66void DateBookWeekLstHeader::pickDate() { 66void 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}
82void DateBookWeekLstHeader::setDate(int y, int m, int d) { 82void 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
87void DateBookWeekLstHeader::nextWeek() { 87void DateBookWeekLstHeader::nextWeek() {
88 setDate(date.addDays(7)); 88 setDate(date.addDays(7));
89} 89}
90void DateBookWeekLstHeader::prevWeek() { 90void DateBookWeekLstHeader::prevWeek() {
91 setDate(date.addDays(-7)); 91 setDate(date.addDays(-7));
92} 92}
93 93
94DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, 94DateBookWeekLstDayHdr::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(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
131void DateBookWeekLstDayHdr::showDay() { 131void DateBookWeekLstDayHdr::showDay() {
132 emit showDate(date.year(), date.month(), date.day()); 132 emit showDate(date.year(), date.month(), date.day());
133} 133}
134void DateBookWeekLstDayHdr::newEvent() { 134void 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}
142DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, 142DateBookWeekLstEvent::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 ClickableLabel(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 sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); 157 sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
158 } 158 }
159 setText(QString(s) + " " + ev.description()); 159 setText(QString(s) + " " + ev.description());
160 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 160 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
161 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 161 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
162} 162}
163void DateBookWeekLstEvent::editMe() { 163void DateBookWeekLstEvent::editMe() {
164 emit editEvent(event.event()); 164 emit editEvent(event.event());
165} 165}
166 166
167 167
168DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 168DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
169 const QDate &d, bool onM, 169 const QDate &d, bool onM,
170 QWidget* parent, 170 QWidget* parent,
171 const char* name, WFlags fl) 171 const char* name, WFlags fl)
172 : QWidget( parent, name, fl ) 172 : QWidget( parent, name, fl )
173{ 173{
174 onMonday=onM; 174 onMonday=onM;
175 setPalette(white); 175 setPalette(white);
176 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 176 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
177 177
178 QVBoxLayout *layout = new QVBoxLayout( this ); 178 QVBoxLayout *layout = new QVBoxLayout( this );
179 179
180 qBubbleSort(ev); 180 qBubbleSort(ev);
181 QValueListIterator<EffectiveEvent> it; 181 QValueListIterator<EffectiveEvent> it;
182 it=ev.begin(); 182 it=ev.begin();
183 183
184 int dayOrder[7]; 184 int dayOrder[7];
185 if (onMonday) 185 if (onMonday)
186 for (int d=0; d<7; d++) dayOrder[d]=d+1; 186 for (int d=0; d<7; d++) dayOrder[d]=d+1;
187 else { 187 else {
188 for (int d=0; d<7; d++) dayOrder[d]=d; 188 for (int d=0; d<7; d++) dayOrder[d]=d;
189 dayOrder[0]=7; 189 dayOrder[0]=7;
190 } 190 }
191 191
192 for (int i=0; i<7; i++) { 192 for (int i=0; i<7; i++) {
193 // Header 193 // Header
194 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), 194 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i),
195 onMonday,this); 195 onMonday,this);
196 connect(hdr, SIGNAL(showDate(int,int,int)), 196 connect(hdr, SIGNAL(showDate(int,int,int)),
197 this, SIGNAL(showDate(int,int,int))); 197 this, SIGNAL(showDate(int,int,int)));
198 connect(hdr, SIGNAL(addEvent(const QDateTime &, 198 connect(hdr, SIGNAL(addEvent(const QDateTime &,
199 const QDateTime &, 199 const QDateTime &,
200 const QString &)), 200 const QString &)),
201 this, SIGNAL(addEvent(const QDateTime &, 201 this, SIGNAL(addEvent(const QDateTime &,
202 const QDateTime &, 202 const QDateTime &,
203 const QString &))); 203 const QString &)));
204 layout->addWidget(hdr); 204 layout->addWidget(hdr);
205 205
206 // Events 206 // Events
207 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 207 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
208 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); 208 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this);
209 layout->addWidget(l); 209 layout->addWidget(l);
210 connect (l, SIGNAL(editEvent(const Event &)), 210 connect (l, SIGNAL(editEvent(const Event &)),
211 this, SIGNAL(editEvent(const Event &))); 211 this, SIGNAL(editEvent(const Event &)));
212 it++; 212 it++;
213 } 213 }
214 214
215 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 215 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
216 } 216 }
217} 217}
218DateBookWeekLstView::~DateBookWeekLstView(){} 218DateBookWeekLstView::~DateBookWeekLstView(){}
219void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 219void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
220 220
221DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 221DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
222 QValueList<EffectiveEvent> &ev2, 222 QValueList<EffectiveEvent> &ev2,
223 QDate &d, bool onM, 223 QDate &d, bool onM,
224 QWidget* parent, 224 QWidget* parent,
225 const char* name, WFlags fl) 225 const char* name, WFlags fl)
226 : QWidget( parent, name, fl ) 226 : QWidget( parent, name, fl )
227{ 227{
228 QHBoxLayout *layout = new QHBoxLayout( this ); 228 QHBoxLayout *layout = new QHBoxLayout( this );
229 229
230 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); 230 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
231 layout->addWidget(w); 231 layout->addWidget(w);
232 connect (w, SIGNAL(editEvent(const Event &)), 232 connect (w, SIGNAL(editEvent(const Event &)),
233 this, SIGNAL(editEvent(const Event &))); 233 this, SIGNAL(editEvent(const Event &)));
234 connect (w, SIGNAL(showDate(int,int,int)), 234 connect (w, SIGNAL(showDate(int,int,int)),
235 this, SIGNAL(showDate(int,int,int))); 235 this, SIGNAL(showDate(int,int,int)));
236 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 236 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
237 const QString &)), 237 const QString &)),
238 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 238 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
239 const QString &))); 239 const QString &)));
240 240
241 241
242 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); 242 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
243 layout->addWidget(w); 243 layout->addWidget(w);
244 connect (w, SIGNAL(editEvent(const Event &)), 244 connect (w, SIGNAL(editEvent(const Event &)),
245 this, SIGNAL(editEvent(const Event &))); 245 this, SIGNAL(editEvent(const Event &)));
246 connect (w, SIGNAL(showDate(int,int,int)), 246 connect (w, SIGNAL(showDate(int,int,int)),
247 this, SIGNAL(showDate(int,int,int))); 247 this, SIGNAL(showDate(int,int,int)));
248 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 248 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
249 const QString &)), 249 const QString &)),
250 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 250 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
251 const QString &))); 251 const QString &)));
252} 252}
253 253
254DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, 254DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
255 QWidget *parent, 255 QWidget *parent,
256 const char *name ) 256 const char *name )
257 : QWidget( parent, name ), 257 : QWidget( parent, name ),
258 db( newDB ), 258 db( newDB ),
259 startTime( 0 ), 259 startTime( 0 ),
260 ampm( ap ), 260 ampm( ap ),
261 onMonday(onM) 261 onMonday(onM)
262{ 262{
263 setFocusPolicy(StrongFocus); 263 setFocusPolicy(StrongFocus);
264 layout = new QVBoxLayout( this ); 264 layout = new QVBoxLayout( this );
265 layout->setMargin(0); 265 layout->setMargin(0);
266 266
267 header=new DateBookWeekLstHeader(onM, this); 267 header=new DateBookWeekLstHeader(onM, this);
268 layout->addWidget( header ); 268 layout->addWidget( header );
269 connect(header, SIGNAL(dateChanged(int,int)), 269 connect(header, SIGNAL(dateChanged(int,int)),
270 this, SLOT(dateChanged(int,int))); 270 this, SLOT(dateChanged(int,int)));
271 connect(header, SIGNAL(setDbl(bool)), 271 connect(header, SIGNAL(setDbl(bool)),
272 this, SLOT(setDbl(bool))); 272 this, SLOT(setDbl(bool)));
273 273
274 scroll=new QScrollView(this); 274 scroll=new QScrollView(this);
275 //scroll->setVScrollBarMode(QScrollView::AlwaysOn); 275 //scroll->setVScrollBarMode(QScrollView::AlwaysOn);
276 //scroll->setHScrollBarMode(QScrollView::AlwaysOff); 276 //scroll->setHScrollBarMode(QScrollView::AlwaysOff);
277 scroll->setResizePolicy(QScrollView::AutoOneFit); 277 scroll->setResizePolicy(QScrollView::AutoOneFit);
278 layout->addWidget(scroll); 278 layout->addWidget(scroll);
279 279
280 view=NULL; 280 view=NULL;
281 Config config("DateBook"); 281 Config config("DateBook");
282 config.setGroup("Main"); 282 config.setGroup("Main");
283 dbl=config.readBoolEntry("weeklst_dbl", false); 283 dbl=config.readBoolEntry("weeklst_dbl", false);
284 header->dbl->setOn(dbl); 284 header->dbl->setOn(dbl);
285} 285}
286DateBookWeekLst::~DateBookWeekLst(){ 286DateBookWeekLst::~DateBookWeekLst(){
287 Config config("DateBook"); 287 Config config("DateBook");
288 config.setGroup("Main"); 288 config.setGroup("Main");
289 config.writeEntry("weeklst_dbl", dbl); 289 config.writeEntry("weeklst_dbl", dbl);
290} 290}
291 291
292void DateBookWeekLst::setDate(const QDate &d) { 292void DateBookWeekLst::setDate(const QDate &d) {
293 int w,y; 293 int w,y;
294 calcWeek(d,w,y,onMonday); 294 calcWeek(d,w,y,onMonday);
295 year=y; 295 year=y;
296 _week=w; 296 _week=w;
297 header->setDate(date()); 297 header->setDate(date());
298} 298}
299void DateBookWeekLst::setDbl(bool on) { 299void DateBookWeekLst::setDbl(bool on) {
300 dbl=on; 300 dbl=on;
301 redraw(); 301 redraw();
302} 302}
303void DateBookWeekLst::redraw() {getEvents();} 303void DateBookWeekLst::redraw() {getEvents();}
304 304
305QDate DateBookWeekLst::date() const { 305QDate DateBookWeekLst::date() const {
306 QDate d; 306 QDate d;
307 d.setYMD(year,1,1); 307 d.setYMD(year,1,1);
308 308
309 int dow= d.dayOfWeek(); 309 int dow= d.dayOfWeek();
310 if (!onMonday) 310 if (!onMonday)
311 if (dow==7) dow=1; 311 if (dow==7) dow=1;
312 else dow++; 312 else dow++;
313 313
314 d=d.addDays( (_week-1)*7 - dow + 1 ); 314 d=d.addDays( (_week-1)*7 - dow + 1 );
315 return d; 315 return d;
316} 316}
317 317
318void DateBookWeekLst::getEvents() { 318void DateBookWeekLst::getEvents() {
319 QDate start = date(); 319 QDate start = date();
320 QDate stop = start.addDays(6); 320 QDate stop = start.addDays(6);
321 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 321 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
322 322
323 if (view) delete view; 323 if (view) delete view;
324 if (dbl) { 324 if (dbl) {
325 QDate start2=start.addDays(7); 325 QDate start2=start.addDays(7);
326 stop=start2.addDays(6); 326 stop=start2.addDays(6);
327 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 327 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
328 328
329 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); 329 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
330 } else { 330 } else {
331 view=new DateBookWeekLstView(el,start,onMonday,scroll); 331 view=new DateBookWeekLstView(el,start,onMonday,scroll);
332 } 332 }
333 333
334 connect (view, SIGNAL(editEvent(const Event &)), 334 connect (view, SIGNAL(editEvent(const Event &)),
335 this, SIGNAL(editEvent(const Event &))); 335 this, SIGNAL(editEvent(const Event &)));
336 connect (view, SIGNAL(showDate(int,int,int)), 336 connect (view, SIGNAL(showDate(int,int,int)),
337 this, SIGNAL(showDate(int,int,int))); 337 this, SIGNAL(showDate(int,int,int)));
338 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 338 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index b0b0417..24f6c83 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -1,151 +1,151 @@
1#ifndef DATEBOOKWEEKLST 1#ifndef DATEBOOKWEEKLST
2#define DATEBOOKWEEKLST 2#define DATEBOOKWEEKLST
3 3
4#include <qwidget.h> 4#include <qwidget.h>
5#include <qdatetime.h> 5#include <qdatetime.h>
6#include <qpe/event.h> 6#include <qpe/event.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qscrollview.h> 8#include <qscrollview.h>
9 9
10#include "datebookweeklstheader.h" 10#include "datebookweeklstheader.h"
11#include "datebookweeklstdayhdr.h" 11#include "datebookweeklstdayhdr.h"
12 12
13#include "clickablelabel.h" 13#include <opie/oclickablelabel.h>
14 14
15class QDateTime; 15class QDateTime;
16class DateBookDB; 16class DateBookDB;
17 17
18class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase 18class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase
19{ 19{
20 Q_OBJECT 20 Q_OBJECT
21public: 21public:
22 DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, 22 DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0,
23 WFlags fl = 0 ); 23 WFlags fl = 0 );
24 ~DateBookWeekLstHeader(); 24 ~DateBookWeekLstHeader();
25 void setDate(const QDate &d); 25 void setDate(const QDate &d);
26 26
27public slots: 27public slots:
28 void nextWeek(); 28 void nextWeek();
29 void prevWeek(); 29 void prevWeek();
30 void pickDate(); 30 void pickDate();
31 void setDate(int y, int m, int d); 31 void setDate(int y, int m, int d);
32signals: 32signals:
33 void dateChanged(int y, int w); 33 void dateChanged(int y, int w);
34 void setDbl(bool on); 34 void setDbl(bool on);
35private: 35private:
36 QDate date; 36 QDate date;
37 bool onMonday; 37 bool onMonday;
38}; 38};
39 39
40class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase 40class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase
41{ 41{
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 DateBookWeekLstDayHdr(const QDate &d, bool onM, 44 DateBookWeekLstDayHdr(const QDate &d, bool onM,
45 QWidget* parent = 0, const char* name = 0, 45 QWidget* parent = 0, const char* name = 0,
46 WFlags fl = 0 ); 46 WFlags fl = 0 );
47public slots: 47public slots:
48 void showDay(); 48 void showDay();
49 void newEvent(); 49 void newEvent();
50signals: 50signals:
51 void showDate(int y, int m, int d); 51 void showDate(int y, int m, int d);
52 void addEvent(const QDateTime &start, const QDateTime &stop, 52 void addEvent(const QDateTime &start, const QDateTime &stop,
53 const QString &str); 53 const QString &str);
54private: 54private:
55 QDate date; 55 QDate date;
56}; 56};
57 57
58class DateBookWeekLstEvent: public ClickableLabel 58class DateBookWeekLstEvent: public OClickableLabel
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61public: 61public:
62 DateBookWeekLstEvent(const EffectiveEvent &ev, 62 DateBookWeekLstEvent(const EffectiveEvent &ev,
63 QWidget* parent = 0, const char* name = 0, 63 QWidget* parent = 0, const char* name = 0,
64 WFlags fl = 0); 64 WFlags fl = 0);
65signals: 65signals:
66 void editEvent(const Event &e); 66 void editEvent(const Event &e);
67private slots: 67private slots:
68 void editMe(); 68 void editMe();
69private: 69private:
70 const EffectiveEvent event; 70 const EffectiveEvent event;
71}; 71};
72 72
73class DateBookWeekLstView: public QWidget 73class DateBookWeekLstView: public QWidget
74{ 74{
75 Q_OBJECT 75 Q_OBJECT
76public: 76public:
77 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, 77 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM,
78 QWidget* parent = 0, const char* name = 0, 78 QWidget* parent = 0, const char* name = 0,
79 WFlags fl = 0 ); 79 WFlags fl = 0 );
80 ~DateBookWeekLstView(); 80 ~DateBookWeekLstView();
81signals: 81signals:
82 void editEvent(const Event &e); 82 void editEvent(const Event &e);
83 void showDate(int y, int m, int d); 83 void showDate(int y, int m, int d);
84 void addEvent(const QDateTime &start, const QDateTime &stop, 84 void addEvent(const QDateTime &start, const QDateTime &stop,
85 const QString &str); 85 const QString &str);
86private: 86private:
87 bool onMonday; 87 bool onMonday;
88protected slots: 88protected slots:
89 void keyPressEvent(QKeyEvent *); 89 void keyPressEvent(QKeyEvent *);
90}; 90};
91 91
92class DateBookWeekLstDblView: public QWidget { 92class DateBookWeekLstDblView: public QWidget {
93 Q_OBJECT 93 Q_OBJECT
94public: 94public:
95 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 95 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
96 QValueList<EffectiveEvent> &ev2, 96 QValueList<EffectiveEvent> &ev2,
97 QDate &d, bool onM, 97 QDate &d, bool onM,
98 QWidget* parent = 0, const char* name = 0, 98 QWidget* parent = 0, const char* name = 0,
99 WFlags fl = 0 ); 99 WFlags fl = 0 );
100signals: 100signals:
101 void editEvent(const Event &e); 101 void editEvent(const Event &e);
102 void showDate(int y, int m, int d); 102 void showDate(int y, int m, int d);
103 void addEvent(const QDateTime &start, const QDateTime &stop, 103 void addEvent(const QDateTime &start, const QDateTime &stop,
104 const QString &str); 104 const QString &str);
105}; 105};
106 106
107class DateBookWeekLst : public QWidget 107class DateBookWeekLst : public QWidget
108{ 108{
109 Q_OBJECT 109 Q_OBJECT
110 110
111public: 111public:
112 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, 112 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB,
113 QWidget *parent = 0, 113 QWidget *parent = 0,
114 const char *name = 0 ); 114 const char *name = 0 );
115 ~DateBookWeekLst(); 115 ~DateBookWeekLst();
116 void setDate( int y, int w ); 116 void setDate( int y, int w );
117 void setDate(const QDate &d ); 117 void setDate(const QDate &d );
118 int week() const { return _week; }; 118 int week() const { return _week; };
119 QDate date() const; 119 QDate date() const;
120 120
121public slots: 121public slots:
122 void redraw(); 122 void redraw();
123 void dateChanged(int y, int w); 123 void dateChanged(int y, int w);
124 124
125protected slots: 125protected slots:
126 void keyPressEvent(QKeyEvent *); 126 void keyPressEvent(QKeyEvent *);
127 void setDbl(bool on); 127 void setDbl(bool on);
128 128
129signals: 129signals:
130 void showDate(int y, int m, int d); 130 void showDate(int y, int m, int d);
131 void addEvent(const QDateTime &start, const QDateTime &stop, 131 void addEvent(const QDateTime &start, const QDateTime &stop,
132 const QString &str); 132 const QString &str);
133 void editEvent(const Event &e); 133 void editEvent(const Event &e);
134 134
135private: 135private:
136 DateBookDB *db; 136 DateBookDB *db;
137 int startTime; 137 int startTime;
138 bool ampm; 138 bool ampm;
139 bool onMonday; 139 bool onMonday;
140 bool dbl; 140 bool dbl;
141 int year, _week; 141 int year, _week;
142 DateBookWeekLstHeader *header; 142 DateBookWeekLstHeader *header;
143 QWidget *view; 143 QWidget *view;
144 QVBoxLayout *layout; 144 QVBoxLayout *layout;
145 QScrollView *scroll; 145 QScrollView *scroll;
146 146
147 void getEvents(); 147 void getEvents();
148}; 148};
149 149
150#endif 150#endif
151 151
diff --git a/core/pim/datebook/datebookweeklstdayhdr.ui b/core/pim/datebook/datebookweeklstdayhdr.ui
index 2b68754..9499726 100644
--- a/core/pim/datebook/datebookweeklstdayhdr.ui
+++ b/core/pim/datebook/datebookweeklstdayhdr.ui
@@ -1,145 +1,145 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>DateBookWeekLstDayHdrBase</class> 2<class>DateBookWeekLstDayHdrBase</class>
3<widget> 3<widget>
4 <class>QWidget</class> 4 <class>QWidget</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>DateBookWeekLstDayHdrBase</cstring> 7 <cstring>DateBookWeekLstDayHdrBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>106</y> 13 <y>106</y>
14 <width>621</width> 14 <width>621</width>
15 <height>5</height> 15 <height>5</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>sizePolicy</name> 19 <name>sizePolicy</name>
20 <sizepolicy> 20 <sizepolicy>
21 <hsizetype>7</hsizetype> 21 <hsizetype>7</hsizetype>
22 <vsizetype>0</vsizetype> 22 <vsizetype>0</vsizetype>
23 </sizepolicy> 23 </sizepolicy>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutMargin</name> 26 <name>layoutMargin</name>
27 </property> 27 </property>
28 <hbox> 28 <hbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>0</number> 31 <number>0</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>6</number> 35 <number>6</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>Line</class> 38 <class>Line</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>Line1</cstring> 41 <cstring>Line1</cstring>
42 </property> 42 </property>
43 <property stdset="1"> 43 <property stdset="1">
44 <name>minimumSize</name> 44 <name>minimumSize</name>
45 <size> 45 <size>
46 <width>0</width> 46 <width>0</width>
47 <height>0</height> 47 <height>0</height>
48 </size> 48 </size>
49 </property> 49 </property>
50 <property stdset="1"> 50 <property stdset="1">
51 <name>maximumSize</name> 51 <name>maximumSize</name>
52 <size> 52 <size>
53 <width>32767</width> 53 <width>32767</width>
54 <height>32767</height> 54 <height>32767</height>
55 </size> 55 </size>
56 </property> 56 </property>
57 <property stdset="1"> 57 <property stdset="1">
58 <name>orientation</name> 58 <name>orientation</name>
59 <enum>Horizontal</enum> 59 <enum>Horizontal</enum>
60 </property> 60 </property>
61 </widget> 61 </widget>
62 <widget> 62 <widget>
63 <class>ClickableLabel</class> 63 <class>OClickableLabel</class>
64 <property stdset="1"> 64 <property stdset="1">
65 <name>name</name> 65 <name>name</name>
66 <cstring>label</cstring> 66 <cstring>label</cstring>
67 </property> 67 </property>
68 <property stdset="1"> 68 <property stdset="1">
69 <name>sizePolicy</name> 69 <name>sizePolicy</name>
70 <sizepolicy> 70 <sizepolicy>
71 <hsizetype>0</hsizetype> 71 <hsizetype>0</hsizetype>
72 <vsizetype>0</vsizetype> 72 <vsizetype>0</vsizetype>
73 </sizepolicy> 73 </sizepolicy>
74 </property> 74 </property>
75 <property stdset="1"> 75 <property stdset="1">
76 <name>font</name> 76 <name>font</name>
77 <font> 77 <font>
78 <bold>1</bold> 78 <bold>1</bold>
79 </font> 79 </font>
80 </property> 80 </property>
81 </widget> 81 </widget>
82 <widget> 82 <widget>
83 <class>Line</class> 83 <class>Line</class>
84 <property stdset="1"> 84 <property stdset="1">
85 <name>name</name> 85 <name>name</name>
86 <cstring>Line1_2</cstring> 86 <cstring>Line1_2</cstring>
87 </property> 87 </property>
88 <property stdset="1"> 88 <property stdset="1">
89 <name>minimumSize</name> 89 <name>minimumSize</name>
90 <size> 90 <size>
91 <width>0</width> 91 <width>0</width>
92 <height>0</height> 92 <height>0</height>
93 </size> 93 </size>
94 </property> 94 </property>
95 <property stdset="1"> 95 <property stdset="1">
96 <name>maximumSize</name> 96 <name>maximumSize</name>
97 <size> 97 <size>
98 <width>32767</width> 98 <width>32767</width>
99 <height>32767</height> 99 <height>32767</height>
100 </size> 100 </size>
101 </property> 101 </property>
102 <property stdset="1"> 102 <property stdset="1">
103 <name>orientation</name> 103 <name>orientation</name>
104 <enum>Horizontal</enum> 104 <enum>Horizontal</enum>
105 </property> 105 </property>
106 </widget> 106 </widget>
107 <widget> 107 <widget>
108 <class>ClickableLabel</class> 108 <class>OClickableLabel</class>
109 <property stdset="1"> 109 <property stdset="1">
110 <name>name</name> 110 <name>name</name>
111 <cstring>add</cstring> 111 <cstring>add</cstring>
112 </property> 112 </property>
113 <property stdset="1"> 113 <property stdset="1">
114 <name>sizePolicy</name> 114 <name>sizePolicy</name>
115 <sizepolicy> 115 <sizepolicy>
116 <hsizetype>0</hsizetype> 116 <hsizetype>0</hsizetype>
117 <vsizetype>0</vsizetype> 117 <vsizetype>0</vsizetype>
118 </sizepolicy> 118 </sizepolicy>
119 </property> 119 </property>
120 </widget> 120 </widget>
121 </hbox> 121 </hbox>
122</widget> 122</widget>
123<customwidgets> 123<customwidgets>
124 <customwidget> 124 <customwidget>
125 <class>ClickableLabel</class> 125 <class>OClickableLabel</class>
126 <header location="local">clickablelabel.h</header> 126 <header location="global">opie/oclickablelabel.h</header>
127 <sizehint> 127 <sizehint>
128 <width>-1</width> 128 <width>-1</width>
129 <height>-1</height> 129 <height>-1</height>
130 </sizehint> 130 </sizehint>
131 <container>0</container> 131 <container>0</container>
132 <sizepolicy> 132 <sizepolicy>
133 <hordata>5</hordata> 133 <hordata>5</hordata>
134 <verdata>5</verdata> 134 <verdata>5</verdata>
135 </sizepolicy> 135 </sizepolicy>
136 <pixmap>image0</pixmap> 136 <pixmap>image0</pixmap>
137 </customwidget> 137 </customwidget>
138</customwidgets> 138</customwidgets>
139<images> 139<images>
140 <image> 140 <image>
141 <name>image0</name> 141 <name>image0</name>
142 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> 142 <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data>
143 </image> 143 </image>
144</images> 144</images>
145</UI> 145</UI>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index e14e2f5..c4f6c68 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -1,308 +1,312 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "dateentryimpl.h" 21#include "dateentryimpl.h"
22#include "repeatentry.h" 22#include "repeatentry.h"
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/categoryselect.h> 25#include <qpe/categoryselect.h>
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30#include <qpe/tzselect.h> 30#include <qpe/tzselect.h>
31 31
32#include <qevent.h> 32#include <qevent.h>
33#include <qcheckbox.h> 33#include <qcheckbox.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qlineedit.h> 36#include <qlineedit.h>
37#include <qmultilineedit.h> 37#include <qmultilineedit.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39#include <qscrollview.h> 39#include <qscrollview.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qtoolbutton.h> 41#include <qtoolbutton.h>
42 42
43#include "timepicker.h" 43#include "timepicker.h"
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46#include <stdio.h>
46 47
47/* 48/*
48 * Constructs a DateEntry which is a child of 'parent', with the 49 * Constructs a DateEntry which is a child of 'parent', with the
49 * name 'name' and widget flags set to 'f' 50 * name 'name' and widget flags set to 'f'
50 * 51 *
51 * The dialog will by default be modeless, unless you set 'modal' to 52 * The dialog will by default be modeless, unless you set 'modal' to
52 * TRUE to construct a modal dialog. 53 * TRUE to construct a modal dialog.
53 */ 54 */
54 55
55DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, 56DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
56 const QDateTime &end, bool whichClock, QWidget* parent, 57 const QDateTime &end, bool whichClock, QWidget* parent,
57 const char* name ) 58 const char* name )
58 : DateEntryBase( parent, name ), 59 : DateEntryBase( parent, name ),
59 ampm( whichClock ), 60 ampm( whichClock ),
60 startWeekOnMonday( startOnMonday ) 61 startWeekOnMonday( startOnMonday ),
62 m_showStart(true)
61{ 63{
62 init(); 64 init();
63 setDates(start,end); 65 setDates(start,end);
64 setFocusProxy(comboDescription); 66 setFocusProxy(comboDescription);
65} 67}
66 68
67bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) 69bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
68{ 70{
69 if( ev->type() == QEvent::FocusIn ){ 71 if( ev->type() == QEvent::FocusIn ){
70 if( obj == comboStart ){ 72 if( obj == comboStart ){
71 timePickerStart->setHour(startTime.hour()); 73 timePickerStart->setHour(startTime.hour());
72 timePickerStart->setMinute(startTime.minute()); 74 timePickerStart->setMinute(startTime.minute());
73 TimePickerLabel->setText( tr("Start Time" ) ); 75 TimePickerLabel->setText( tr("Start Time" ) );
74 m_showStart= true; 76 m_showStart= true;
75 }else if( obj == comboEnd ){ 77 }else if( obj == comboEnd ){
76 timePickerStart->setHour(endTime.hour()); 78 timePickerStart->setHour(endTime.hour());
77 timePickerStart->setMinute(endTime.minute()); 79 timePickerStart->setMinute(endTime.minute());
78 TimePickerLabel->setText( tr("End Time") ); 80 TimePickerLabel->setText( tr("End Time") );
79 m_showStart = false; 81 m_showStart = false;
80 } 82 }
81 } else if( ev->type() == QEvent::FocusOut ){ 83 } else if( ev->type() == QEvent::FocusOut ){
82 if( obj == comboEnd ){ 84 if( obj == comboEnd ){
83 QString s; 85 QString s;
84 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); 86 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute());
85 comboEnd->setText(s); 87 comboEnd->setText(s);
86 } 88 }
87 else if( obj == comboStart ){ 89 else if( obj == comboStart ){
88 QString s; 90 QString s;
89 s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); 91 s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute());
90 comboStart->setText(s); 92 comboStart->setText(s);
91 } 93 }
92 } 94 }
93 95
94 return false; 96 return false;
95} 97}
96 98
97static void addOrPick( QComboBox* combo, const QString& t ) 99static void addOrPick( QComboBox* combo, const QString& t )
98{ 100{
99 // Pick an item if one excists 101 // Pick an item if one excists
100 for (int i=0; i<combo->count(); i++) { 102 for (int i=0; i<combo->count(); i++) {
101 if ( combo->text(i) == t ) { 103 if ( combo->text(i) == t ) {
102 combo->setCurrentItem(i); 104 combo->setCurrentItem(i);
103 return; 105 return;
104 } 106 }
105 } 107 }
106 108
107 // Else add one 109 // Else add one
108 combo->insertItem(t); 110 combo->insertItem(t);
109 combo->setCurrentItem(combo->count()-1); 111 combo->setCurrentItem(combo->count()-1);
110} 112}
111 113
112DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, 114DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock,
113 QWidget* parent, const char* name ) 115 QWidget* parent, const char* name )
114 : DateEntryBase( parent, name ), 116 : DateEntryBase( parent, name ),
115 ampm( whichClock ), 117 ampm( whichClock ),
116 startWeekOnMonday( startOnMonday ) 118 startWeekOnMonday( startOnMonday ),
119 m_showStart(true)
120
117{ 121{
118 init(); 122 init();
119 setDates(event.start(),event.end()); 123 setDates(event.start(),event.end());
120 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); 124 comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") );
121 if(!event.description().isEmpty()) 125 if(!event.description().isEmpty())
122 addOrPick( comboDescription, event.description() ); 126 addOrPick( comboDescription, event.description() );
123 if(!event.location().isEmpty()) 127 if(!event.location().isEmpty())
124 addOrPick( comboLocation, event.location() ); 128 addOrPick( comboLocation, event.location() );
125 checkAlarm->setChecked( event.hasAlarm() ); 129 checkAlarm->setChecked( event.hasAlarm() );
126 checkAllDay->setChecked( event.type() == Event::AllDay ); 130 checkAllDay->setChecked( event.type() == Event::AllDay );
127 if(!event.notes().isEmpty()) 131 if(!event.notes().isEmpty())
128 editNote->setText(event.notes()); 132 editNote->setText(event.notes());
129 spinAlarm->setValue(event.alarmTime()); 133 spinAlarm->setValue(event.alarmTime());
130 if ( event.alarmSound() != Event::Silent ) 134 if ( event.alarmSound() != Event::Silent )
131 comboSound->setCurrentItem( 1 ); 135 comboSound->setCurrentItem( 1 );
132 if ( event.hasRepeat() ) { 136 if ( event.hasRepeat() ) {
133 rp = event.repeatPattern(); 137 rp = event.repeatPattern();
134 cmdRepeat->setText( tr("Repeat...") ); 138 cmdRepeat->setText( tr("Repeat...") );
135 } 139 }
136 setRepeatLabel(); 140 setRepeatLabel();
137} 141}
138 142
139void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) 143void DateEntry::setDates( const QDateTime& s, const QDateTime& e )
140{ 144{
141 startDate = s.date(); 145 startDate = s.date();
142 endDate = e.date(); 146 endDate = e.date();
143 startTime = s.time(); 147 startTime = s.time();
144 endTime = e.time(); 148 endTime = e.time();
145 149
146 startDateChanged( s.date().year(), s.date().month(), s.date().day() ); 150 startDateChanged( s.date().year(), s.date().month(), s.date().day() );
147 endDateChanged( e.date().year(), e.date().month(), e.date().day() ); 151 endDateChanged( e.date().year(), e.date().month(), e.date().day() );
148 152
149 updateTimeEdit(true,true); 153 updateTimeEdit(true,true);
150} 154}
151 155
152void DateEntry::updateTimeEdit(bool s, bool e) { 156void DateEntry::updateTimeEdit(bool s, bool e) {
153 157
154 // Comboboxes 158 // Comboboxes
155 QString strStart, strEnd; 159 QString strStart, strEnd;
156 int shour, ehour; 160 int shour, ehour;
157 if ( ampm ) { 161 if ( ampm ) {
158 shour = startTime.hour(); 162 shour = startTime.hour();
159 ehour = endTime.hour(); 163 ehour = endTime.hour();
160 if ( shour >= 12 ) { 164 if ( shour >= 12 ) {
161 if ( shour > 12 ) 165 if ( shour > 12 )
162 shour -= 12; 166 shour -= 12;
163 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); 167 strStart.sprintf( "%d:%02d PM", shour, startTime.minute() );
164 } else { 168 } else {
165 if ( shour == 0 ) 169 if ( shour == 0 )
166 shour = 12; 170 shour = 12;
167 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); 171 strStart.sprintf( "%d:%02d AM", shour, startTime.minute() );
168 } 172 }
169 if ( ehour == 24 && endTime.minute() == 0 ) { 173 if ( ehour == 24 && endTime.minute() == 0 ) {
170 strEnd = "11:59 PM"; // or "midnight" 174 strEnd = "11:59 PM"; // or "midnight"
171 } else if ( ehour >= 12 ) { 175 } else if ( ehour >= 12 ) {
172 if ( ehour > 12 ) 176 if ( ehour > 12 )
173 ehour -= 12; 177 ehour -= 12;
174 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); 178 strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() );
175 } else { 179 } else {
176 if ( ehour == 0 ) 180 if ( ehour == 0 )
177 ehour = 12; 181 ehour = 12;
178 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); 182 strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() );
179 } 183 }
180 } else { 184 } else {
181 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); 185 strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() );
182 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); 186 strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() );
183 } 187 }
184 188
185 if (s) comboStart->setText(strStart); 189 if (s) comboStart->setText(strStart);
186 if (e) comboEnd->setText(strEnd); 190 if (e) comboEnd->setText(strEnd);
187} 191}
188 192
189void DateEntry::init() 193void DateEntry::init()
190{ 194{
191 comboDescription->setInsertionPolicy(QComboBox::AtCurrent); 195 comboDescription->setInsertionPolicy(QComboBox::AtCurrent);
192 comboLocation->setInsertionPolicy(QComboBox::AtCurrent); 196 comboLocation->setInsertionPolicy(QComboBox::AtCurrent);
193 197
194 initCombos(); 198 initCombos();
195 QPopupMenu *m1 = new QPopupMenu( this ); 199 QPopupMenu *m1 = new QPopupMenu( this );
196 startPicker = new DateBookMonth( m1, 0, TRUE ); 200 startPicker = new DateBookMonth( m1, 0, TRUE );
197 m1->insertItem( startPicker ); 201 m1->insertItem( startPicker );
198 buttonStart->setPopup( m1 ); 202 buttonStart->setPopup( m1 );
199 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 203 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
200 this, SLOT( startDateChanged( int, int, int ) ) ); 204 this, SLOT( startDateChanged( int, int, int ) ) );
201 205
202 //Let start button change both start and end dates 206 //Let start button change both start and end dates
203 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ), 207 connect( startPicker, SIGNAL( dateClicked( int, int, int ) ),
204 this, SLOT( endDateChanged( int, int, int ) ) ); 208 this, SLOT( endDateChanged( int, int, int ) ) );
205 connect( qApp, SIGNAL( clockChanged( bool ) ), 209 connect( qApp, SIGNAL( clockChanged( bool ) ),
206 this, SLOT( slotChangeClock( bool ) ) ); 210 this, SLOT( slotChangeClock( bool ) ) );
207 connect( qApp, SIGNAL(weekChanged(bool)), 211 connect( qApp, SIGNAL(weekChanged(bool)),
208 this, SLOT(slotChangeStartOfWeek(bool)) ); 212 this, SLOT(slotChangeStartOfWeek(bool)) );
209 213
210 QPopupMenu *m2 = new QPopupMenu( this ); 214 QPopupMenu *m2 = new QPopupMenu( this );
211 endPicker = new DateBookMonth( m2, 0, TRUE ); 215 endPicker = new DateBookMonth( m2, 0, TRUE );
212 m2->insertItem( endPicker ); 216 m2->insertItem( endPicker );
213 buttonEnd->setPopup( m2 ); 217 buttonEnd->setPopup( m2 );
214 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), 218 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
215 this, SLOT( endDateChanged( int, int, int ) ) ); 219 this, SLOT( endDateChanged( int, int, int ) ) );
216 220
217 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), 221 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ),
218 this, SLOT( startTimePicked(const QTime &) )); 222 this, SLOT( startTimePicked(const QTime &) ));
219 editNote->setFixedVisibleLines(3); 223 editNote->setFixedVisibleLines(3);
220 // install eventFilters 224 // install eventFilters
221 comboEnd->installEventFilter( this ); 225 comboEnd->installEventFilter( this );
222 comboStart->installEventFilter( this ); 226 comboStart->installEventFilter( this );
223} 227}
224 228
225/* 229/*
226 * Destroys the object and frees any allocated resources 230 * Destroys the object and frees any allocated resources
227 */ 231 */
228DateEntry::~DateEntry() 232DateEntry::~DateEntry()
229{ 233{
230 // no need to delete child widgets, Qt does it all for us 234 // no need to delete child widgets, Qt does it all for us
231 //cout << "Del: " << comboStart->currentText() << endl; 235 //cout << "Del: " << comboStart->currentText() << endl;
232} 236}
233 237
234/* 238/*
235 * public slot 239 * public slot
236 */ 240 */
237void DateEntry::endDateChanged( int y, int m, int d ) 241void DateEntry::endDateChanged( int y, int m, int d )
238{ 242{
239 endDate.setYMD( y, m, d ); 243 endDate.setYMD( y, m, d );
240 if ( endDate < startDate ) { 244 if ( endDate < startDate ) {
241 endDate = startDate; 245 endDate = startDate;
242 } 246 }
243 247
244 buttonEnd->setText( TimeString::shortDate( endDate ) ); 248 buttonEnd->setText( TimeString::shortDate( endDate ) );
245 249
246 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() ); 250 endPicker->setDate( endDate.year(), endDate.month(), endDate.day() );
247} 251}
248 252
249static QTime parseTime( const QString& s, bool ampm ) 253static QTime parseTime( const QString& s, bool ampm )
250{ 254{
251 QTime tmpTime; 255 QTime tmpTime;
252 QStringList l = QStringList::split( ':', s ); 256 QStringList l = QStringList::split( ':', s );
253 int hour = l[0].toInt(); 257 int hour = l[0].toInt();
254 if ( ampm ) { 258 if ( ampm ) {
255 int i=0; 259 int i=0;
256 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9') 260 while (i<int(l[1].length()) && l[1][i]>='0' && l[1][i]<='9')
257 i++; 261 i++;
258 QString digits = l[1].left(i); 262 QString digits = l[1].left(i);
259 if ( l[1].contains( "PM", FALSE ) ) { 263 if ( l[1].contains( "PM", FALSE ) ) {
260 if ( hour != 12 ) 264 if ( hour != 12 )
261 hour += 12; 265 hour += 12;
262 } else { 266 } else {
263 if ( hour == 12 ) 267 if ( hour == 12 )
264 hour = 0; 268 hour = 0;
265 } 269 }
266 l[1] = digits; 270 l[1] = digits;
267 } 271 }
268 int minute = l[1].toInt(); 272 int minute = l[1].toInt();
269 if ( minute > 59 ) 273 if ( minute > 59 )
270 minute = 59; 274 minute = 59;
271 else if ( minute < 0 ) 275 else if ( minute < 0 )
272 minute = 0; 276 minute = 0;
273 if ( hour > 23 ) { 277 if ( hour > 23 ) {
274 hour = 23; 278 hour = 23;
275 minute = 59; 279 minute = 59;
276 } else if ( hour < 0 ) 280 } else if ( hour < 0 )
277 hour = 0; 281 hour = 0;
278 tmpTime.setHMS( hour, minute, 0 ); 282 tmpTime.setHMS( hour, minute, 0 );
279 return tmpTime; 283 return tmpTime;
280} 284}
281 285
282/* 286/*
283 * public slot 287 * public slot
284 */ 288 */
285void DateEntry::endTimeChanged( const QString &s ) 289void DateEntry::endTimeChanged( const QString &s )
286{ 290{
287 endTimeChanged( parseTime(s,ampm) ); 291 endTimeChanged( parseTime(s,ampm) );
288} 292}
289 293
290void DateEntry::endTimeChanged( const QTime &t ) { 294void DateEntry::endTimeChanged( const QTime &t ) {
291 if ( endDate > startDate || t >= startTime ) { 295 if ( endDate > startDate || t >= startTime ) {
292 endTime = t; 296 endTime = t;
293 } else { 297 } else {
294 endTime = startTime; 298 endTime = startTime;
295 //comboEnd->setCurrentItem( comboStart->currentItem() ); 299 //comboEnd->setCurrentItem( comboStart->currentItem() );
296 } 300 }
297 timePickerStart->setHour(endTime.hour()); 301 timePickerStart->setHour(endTime.hour());
298 timePickerStart->setMinute(endTime.minute()); 302 timePickerStart->setMinute(endTime.minute());
299} 303}
300 304
301/* 305/*
302 * public slot 306 * public slot
303 */ 307 */
304void DateEntry::startDateChanged( int y, int m, int d ) 308void DateEntry::startDateChanged( int y, int m, int d )
305{ 309{
306 QDate prev = startDate; 310 QDate prev = startDate;
307 startDate.setYMD( y, m, d ); 311 startDate.setYMD( y, m, d );
308 if ( rp.type == Event::Weekly && 312 if ( rp.type == Event::Weekly &&
diff --git a/core/pim/datebook/opie-datebook.control b/core/pim/datebook/opie-datebook.control
index 6566d50..9bef119 100644
--- a/core/pim/datebook/opie-datebook.control
+++ b/core/pim/datebook/opie-datebook.control
@@ -1,9 +1,9 @@
1Files: bin/datebook apps/Applications/datebook.desktop 1Files: bin/datebook apps/Applications/datebook.desktop
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Warwick Allison <warwick@trolltech.com> 4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm 5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION 6Version: $QPE_VERSION-$SUB_VERSION
7Depends: opie-base ($QPE_VERSION) 7Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION)
8Description: A datebook/appointment manager 8Description: A datebook/appointment manager
9 A datebook/appointment manager for the Opie environment. 9 A datebook/appointment manager for the Opie environment.
diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp
index 43e05ad..f2cb71d 100644
--- a/core/pim/datebook/timepicker.cpp
+++ b/core/pim/datebook/timepicker.cpp
@@ -1,120 +1,119 @@
1#include "timepicker.h" 1#include "timepicker.h"
2 2
3#include <qbuttongroup.h> 3#include <qbuttongroup.h>
4#include <qtoolbutton.h> 4#include <qtoolbutton.h>
5#include <qlayout.h> 5#include <qlayout.h>
6#include "clickablelabel.h"
7#include <qstring.h> 6#include <qstring.h>
8#include <stdio.h> 7#include <stdio.h>
9 8
10TimePicker::TimePicker(QWidget* parent, const char* name, 9TimePicker::TimePicker(QWidget* parent, const char* name,
11 WFlags fl) : 10 WFlags fl) :
12 QWidget(parent,name,fl) 11 QWidget(parent,name,fl)
13{ 12{
14 QVBoxLayout *vbox=new QVBoxLayout(this); 13 QVBoxLayout *vbox=new QVBoxLayout(this);
15 14
16 ClickableLabel *r; 15 OClickableLabel *r;
17 QString s; 16 QString s;
18 17
19 // Hour Row 18 // Hour Row
20 QWidget *row=new QWidget(this); 19 QWidget *row=new QWidget(this);
21 QHBoxLayout *l=new QHBoxLayout(row); 20 QHBoxLayout *l=new QHBoxLayout(row);
22 vbox->addWidget(row); 21 vbox->addWidget(row);
23 22
24 23
25 for (int i=0; i<24; i++) { 24 for (int i=0; i<24; i++) {
26 r=new ClickableLabel(row); 25 r=new OClickableLabel(row);
27 hourLst.append(r); 26 hourLst.append(r);
28 s.sprintf("%.2d",i); 27 s.sprintf("%.2d",i);
29 r->setText(s); 28 r->setText(s);
30 r->setToggleButton(true); 29 r->setToggleButton(true);
31 r->setAlignment(AlignHCenter | AlignVCenter); 30 r->setAlignment(AlignHCenter | AlignVCenter);
32 l->addWidget(r); 31 l->addWidget(r);
33 connect(r, SIGNAL(toggled(bool)), 32 connect(r, SIGNAL(toggled(bool)),
34 this, SLOT(slotHour(bool))); 33 this, SLOT(slotHour(bool)));
35 34
36 if (i==11) { // Second row 35 if (i==11) { // Second row
37 row=new QWidget(this); 36 row=new QWidget(this);
38 l=new QHBoxLayout(row); 37 l=new QHBoxLayout(row);
39 vbox->addWidget(row); 38 vbox->addWidget(row);
40 } 39 }
41 } 40 }
42 41
43 // Minute Row 42 // Minute Row
44 row=new QWidget(this); 43 row=new QWidget(this);
45 l=new QHBoxLayout(row); 44 l=new QHBoxLayout(row);
46 vbox->addWidget(row); 45 vbox->addWidget(row);
47 46
48 for (int i=0; i<60; i+=5) { 47 for (int i=0; i<60; i+=5) {
49 r=new ClickableLabel(row); 48 r=new OClickableLabel(row);
50 minuteLst.append(r); 49 minuteLst.append(r);
51 s.sprintf("%.2d",i); 50 s.sprintf("%.2d",i);
52 r->setText(s); 51 r->setText(s);
53 r->setToggleButton(true); 52 r->setToggleButton(true);
54 r->setAlignment(AlignHCenter | AlignVCenter); 53 r->setAlignment(AlignHCenter | AlignVCenter);
55 l->addWidget(r); 54 l->addWidget(r);
56 connect(r, SIGNAL(toggled(bool)), 55 connect(r, SIGNAL(toggled(bool)),
57 this, SLOT(slotMinute(bool))); 56 this, SLOT(slotMinute(bool)));
58 } 57 }
59} 58}
60 59
61void TimePicker::slotHour(bool b) { 60void TimePicker::slotHour(bool b) {
62 61
63 ClickableLabel *r = (ClickableLabel *) sender(); 62 OClickableLabel *r = (OClickableLabel *) sender();
64 63
65 if (b) { 64 if (b) {
66 QValueListIterator<ClickableLabel *> it; 65 QValueListIterator<OClickableLabel *> it;
67 for (it=hourLst.begin(); it!=hourLst.end(); it++) { 66 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
68 if (*it != r) (*it)->setOn(false); 67 if (*it != r) (*it)->setOn(false);
69 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0); 68 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0);
70 } 69 }
71 emit timeChanged(tm); 70 emit timeChanged(tm);
72 } else { 71 } else {
73 r->setOn(true); 72 r->setOn(true);
74 } 73 }
75 74
76} 75}
77 76
78void TimePicker::slotMinute(bool b) { 77void TimePicker::slotMinute(bool b) {
79 78
80 ClickableLabel *r = (ClickableLabel *) sender(); 79 OClickableLabel *r = (OClickableLabel *) sender();
81 80
82 if (b) { 81 if (b) {
83 QValueListIterator<ClickableLabel *> it; 82 QValueListIterator<OClickableLabel *> it;
84 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { 83 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
85 if (*it != r) (*it)->setOn(false); 84 if (*it != r) (*it)->setOn(false);
86 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); 85 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0);
87 } 86 }
88 emit timeChanged(tm); 87 emit timeChanged(tm);
89 } else { 88 } else {
90 r->setOn(true); 89 r->setOn(true);
91 } 90 }
92 91
93} 92}
94 93
95void TimePicker::setMinute(int m) { 94void TimePicker::setMinute(int m) {
96 95
97 QString minute; 96 QString minute;
98 minute.sprintf("%.2d",m); 97 minute.sprintf("%.2d",m);
99 98
100 QValueListIterator<ClickableLabel *> it; 99 QValueListIterator<OClickableLabel *> it;
101 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { 100 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
102 if ((*it)->text() == minute) (*it)->setOn(true); 101 if ((*it)->text() == minute) (*it)->setOn(true);
103 else (*it)->setOn(false); 102 else (*it)->setOn(false);
104 } 103 }
105 104
106 tm.setHMS(tm.hour(),m,0); 105 tm.setHMS(tm.hour(),m,0);
107} 106}
108 107
109void TimePicker::setHour(int h) { 108void TimePicker::setHour(int h) {
110 109
111 QString hour; 110 QString hour;
112 hour.sprintf("%.2d",h); 111 hour.sprintf("%.2d",h);
113 112
114 QValueListIterator<ClickableLabel *> it; 113 QValueListIterator<OClickableLabel *> it;
115 for (it=hourLst.begin(); it!=hourLst.end(); it++) { 114 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
116 if ((*it)->text() == hour) (*it)->setOn(true); 115 if ((*it)->text() == hour) (*it)->setOn(true);
117 else (*it)->setOn(false); 116 else (*it)->setOn(false);
118 } 117 }
119 tm.setHMS(h,tm.minute(),0); 118 tm.setHMS(h,tm.minute(),0);
120} 119}
diff --git a/core/pim/datebook/timepicker.h b/core/pim/datebook/timepicker.h
index 0acadcb..1c35600 100644
--- a/core/pim/datebook/timepicker.h
+++ b/core/pim/datebook/timepicker.h
@@ -1,32 +1,32 @@
1#ifndef TIMEPICKER_H 1#ifndef TIMEPICKER_H
2#define TIMEPICKER_H 2#define TIMEPICKER_H
3 3
4#include <qwidget.h> 4#include <qwidget.h>
5#include <qvaluelist.h> 5#include <qvaluelist.h>
6#include "clickablelabel.h" 6#include <opie/oclickablelabel.h>
7#include <qdatetime.h> 7#include <qdatetime.h>
8 8
9class TimePicker: public QWidget { 9class TimePicker: public QWidget {
10 Q_OBJECT 10 Q_OBJECT
11 11
12 public: 12 public:
13 TimePicker(QWidget* parent = 0, const char* name = 0, 13 TimePicker(QWidget* parent = 0, const char* name = 0,
14 WFlags fl = 0); 14 WFlags fl = 0);
15 void setHour(int h); 15 void setHour(int h);
16 void setMinute(int m); 16 void setMinute(int m);
17 17
18 private: 18 private:
19 QValueList<ClickableLabel *> hourLst; 19 QValueList<OClickableLabel *> hourLst;
20 QValueList<ClickableLabel *> minuteLst; 20 QValueList<OClickableLabel *> minuteLst;
21 QTime tm; 21 QTime tm;
22 22
23 private slots: 23 private slots:
24 void slotHour(bool b); 24 void slotHour(bool b);
25 void slotMinute(bool b); 25 void slotMinute(bool b);
26 26
27 signals: 27 signals:
28 void timeChanged(const QTime &); 28 void timeChanged(const QTime &);
29}; 29};
30 30
31 31
32#endif 32#endif
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index ba64bda..337206a 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -1,8 +1,8 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3 HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h 3 HEADERS = ofontmenu.h ofileselector.h ofiledialog.h ofileview.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h colordialog.h colorpopupmenu.h oclickablelabel.h
4 SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp 4 SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp colordialog.cpp colorpopupmenu.cpp oclickablelabel.cpp
5 TARGET = opie 5 TARGET = opie
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7DESTDIR = $(QTDIR)/lib$(PROJMAK) 7DESTDIR = $(QTDIR)/lib$(PROJMAK)
8#VERSION = 1.0.0 8#VERSION = 1.0.0
diff --git a/core/pim/datebook/clickablelabel.cpp b/libopie/oclickablelabel.cpp
index 128bebb..43a0524 100644
--- a/core/pim/datebook/clickablelabel.cpp
+++ b/libopie/oclickablelabel.cpp
@@ -1,88 +1,88 @@
1#include "clickablelabel.h" 1#include "oclickablelabel.h"
2#include <stdio.h> 2#include <stdio.h>
3 3
4ClickableLabel::ClickableLabel(QWidget* parent, 4OClickableLabel::OClickableLabel(QWidget* parent,
5 const char* name, 5 const char* name,
6 WFlags fl) : 6 WFlags fl) :
7 QLabel(parent,name,fl) 7 QLabel(parent,name,fl)
8{ 8{
9 textInverted=false; 9 textInverted=false;
10 isToggle=false; 10 isToggle=false;
11 isDown=false; 11 isDown=false;
12 showState(false); 12 showState(false);
13 setFrameShadow(Sunken); 13 setFrameShadow(Sunken);
14} 14}
15 15
16void ClickableLabel::setToggleButton(bool t) { 16void OClickableLabel::setToggleButton(bool t) {
17 isToggle=t; 17 isToggle=t;
18} 18}
19 19
20void ClickableLabel::mousePressEvent( QMouseEvent *e ) { 20void OClickableLabel::mousePressEvent( QMouseEvent *e ) {
21 if (isToggle && isDown) { 21 if (isToggle && isDown) {
22 showState(false); 22 showState(false);
23 } else { 23 } else {
24 showState(true); 24 showState(true);
25 } 25 }
26} 26}
27 27
28void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { 28void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) {
29 if (rect().contains(e->pos()) && isToggle) isDown=!isDown; 29 if (rect().contains(e->pos()) && isToggle) isDown=!isDown;
30 30
31 if (isToggle && isDown) { 31 if (isToggle && isDown) {
32 showState(true); 32 showState(true);
33 } else { 33 } else {
34 showState(false); 34 showState(false);
35 } 35 }
36 36
37 if (rect().contains(e->pos())) { 37 if (rect().contains(e->pos())) {
38 if (isToggle) { 38 if (isToggle) {
39 emit toggled(isDown); 39 emit toggled(isDown);
40 } 40 }
41 emit clicked(); 41 emit clicked();
42 } 42 }
43} 43}
44 44
45void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { 45void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) {
46 if (rect().contains(e->pos())) { 46 if (rect().contains(e->pos())) {
47 if (isToggle && isDown) { 47 if (isToggle && isDown) {
48 showState(false); 48 showState(false);
49 } else { 49 } else {
50 showState(true); 50 showState(true);
51 } 51 }
52 } else { 52 } else {
53 if (isToggle && isDown) { 53 if (isToggle && isDown) {
54 showState(true); 54 showState(true);
55 } else { 55 } else {
56 showState(false); 56 showState(false);
57 } 57 }
58 } 58 }
59} 59}
60 60
61void ClickableLabel::showState(bool on) { 61void OClickableLabel::showState(bool on) {
62 if (on) { 62 if (on) {
63 //setFrameShape(Panel); 63 //setFrameShape(Panel);
64 setInverted(true); 64 setInverted(true);
65 setBackgroundMode(PaletteHighlight); 65 setBackgroundMode(PaletteHighlight);
66 } else { 66 } else {
67 //setFrameShape(NoFrame); 67 //setFrameShape(NoFrame);
68 setInverted(false); 68 setInverted(false);
69 setBackgroundMode(PaletteBackground); 69 setBackgroundMode(PaletteBackground);
70 } 70 }
71 repaint(); 71 repaint();
72} 72}
73 73
74void ClickableLabel::setInverted(bool on) { 74void OClickableLabel::setInverted(bool on) {
75 if ( (!textInverted && on) || (textInverted && !on) ) { 75 if ( (!textInverted && on) || (textInverted && !on) ) {
76 QPalette pal=palette(); 76 QPalette pal=palette();
77 QColor col=pal.color(QPalette::Normal, QColorGroup::Foreground); 77 QColor col=pal.color(QPalette::Normal, QColorGroup::Foreground);
78 col.setRgb(255-col.red(),255-col.green(),255-col.blue()); 78 col.setRgb(255-col.red(),255-col.green(),255-col.blue());
79 pal.setColor(QPalette::Normal, QColorGroup::Foreground, col); 79 pal.setColor(QPalette::Normal, QColorGroup::Foreground, col);
80 setPalette(pal); 80 setPalette(pal);
81 textInverted=!textInverted; 81 textInverted=!textInverted;
82 } 82 }
83} 83}
84 84
85void ClickableLabel::setOn(bool on) { 85void OClickableLabel::setOn(bool on) {
86 isDown=on; 86 isDown=on;
87 showState(isDown); 87 showState(isDown);
88} 88}
diff --git a/core/pim/datebook/clickablelabel.h b/libopie/oclickablelabel.h
index d00fee6..f65c440 100644
--- a/core/pim/datebook/clickablelabel.h
+++ b/libopie/oclickablelabel.h
@@ -1,30 +1,30 @@
1#ifndef CLICKABLELABEL 1#ifndef CLICKABLELABEL
2#define CLICKABLELABEL 2#define CLICKABLELABEL
3 3
4#include <qlabel.h> 4#include <qlabel.h>
5 5
6class ClickableLabel: public QLabel 6class OClickableLabel: public QLabel
7{ 7{
8 Q_OBJECT 8 Q_OBJECT
9public: 9public:
10 ClickableLabel(QWidget* parent = 0, const char* name = 0, 10 OClickableLabel(QWidget* parent = 0, const char* name = 0,
11 WFlags fl = 0); 11 WFlags fl = 0);
12 void setToggleButton(bool t); 12 void setToggleButton(bool t);
13 protected: 13 protected:
14 void mousePressEvent( QMouseEvent *e ); 14 void mousePressEvent( QMouseEvent *e );
15 void mouseReleaseEvent( QMouseEvent *e ); 15 void mouseReleaseEvent( QMouseEvent *e );
16 void mouseMoveEvent( QMouseEvent *e ); 16 void mouseMoveEvent( QMouseEvent *e );
17 public slots: 17 public slots:
18 void setOn(bool on); 18 void setOn(bool on);
19 signals: 19 signals:
20 void clicked(); 20 void clicked();
21 void toggled(bool on); 21 void toggled(bool on);
22 private: 22 private:
23 bool isToggle; 23 bool isToggle;
24 bool isDown; 24 bool isDown;
25 void showState(bool on); 25 void showState(bool on);
26 bool textInverted; 26 bool textInverted;
27 void setInverted(bool on); 27 void setInverted(bool on);
28}; 28};
29 29
30#endif 30#endif