summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2003-03-24 21:59:51 (UTC)
committer umopapisdn <umopapisdn>2003-03-24 21:59:51 (UTC)
commitc1089dbda9c50a25e5aa6f4be410ed6a83a573c0 (patch) (unidiff)
tree61641c48bbcf51daab87e02e01020f7c478895b0
parent40ea56466fcbc32eec8e48fcf78c5cd396be4f60 (diff)
downloadopie-c1089dbda9c50a25e5aa6f4be410ed6a83a573c0.zip
opie-c1089dbda9c50a25e5aa6f4be410ed6a83a573c0.tar.gz
opie-c1089dbda9c50a25e5aa6f4be410ed6a83a573c0.tar.bz2
Change the icons for "back" & "forward" in the Weekview header in the
right files this time. :)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweeklst.cpp3
-rw-r--r--core/pim/datebook/datebookweeklstheader.ui14
2 files changed, 5 insertions, 12 deletions
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 5334a16..4ceb360 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -1,378 +1,381 @@
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#include <qpe/resource.h>
12 13
13#include <qdatetime.h> 14#include <qdatetime.h>
14#include <qheader.h> 15#include <qheader.h>
15#include <qlabel.h> 16#include <qlabel.h>
16#include <qlayout.h> 17#include <qlayout.h>
17#include <qpainter.h> 18#include <qpainter.h>
18#include <qpopupmenu.h> 19#include <qpopupmenu.h>
19#include <qtimer.h> 20#include <qtimer.h>
20#include <qstyle.h> 21#include <qstyle.h>
21#include <qtoolbutton.h> 22#include <qtoolbutton.h>
22#include <qvbox.h> 23#include <qvbox.h>
23#include <qsizepolicy.h> 24#include <qsizepolicy.h>
24#include <qabstractlayout.h> 25#include <qabstractlayout.h>
25#include <qtl.h> 26#include <qtl.h>
26 27
27bool calcWeek(const QDate &d, int &week, int &year, 28bool calcWeek(const QDate &d, int &week, int &year,
28 bool startOnMonday = false); 29 bool startOnMonday = false);
29 30
30DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, 31DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
31 const char* name, WFlags fl) 32 const char* name, WFlags fl)
32 : DateBookWeekLstHeaderBase(parent, name, fl) 33 : DateBookWeekLstHeaderBase(parent, name, fl)
33{ 34{
34 setBackgroundMode( PaletteButton ); 35 setBackgroundMode( PaletteButton );
35 labelDate->setBackgroundMode( PaletteButton ); 36 labelDate->setBackgroundMode( PaletteButton );
36 labelWeek->setBackgroundMode( PaletteButton ); 37 labelWeek->setBackgroundMode( PaletteButton );
37 forward->setBackgroundMode( PaletteButton ); 38 forward->setBackgroundMode( PaletteButton );
39 forward->setPixmap( Resource::loadPixmap("forward") );
38 back->setBackgroundMode( PaletteButton ); 40 back->setBackgroundMode( PaletteButton );
41 back->setPixmap( Resource::loadPixmap("back") );
39 DateBookWeekLstHeaderBaseLayout->setSpacing(0); 42 DateBookWeekLstHeaderBaseLayout->setSpacing(0);
40 DateBookWeekLstHeaderBaseLayout->setMargin(0); 43 DateBookWeekLstHeaderBaseLayout->setMargin(0);
41 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); 44 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
42 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 45 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
43 46
44 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); 47 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek()));
45 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); 48 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek()));
46 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); 49 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate()));
47 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); 50 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
48 onMonday=onM; 51 onMonday=onM;
49} 52}
50DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 53DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
51void DateBookWeekLstHeader::setDate(const QDate &d) { 54void DateBookWeekLstHeader::setDate(const QDate &d) {
52 date=d; 55 date=d;
53 56
54 int year,week; 57 int year,week;
55 calcWeek(d,week,year,onMonday); 58 calcWeek(d,week,year,onMonday);
56 labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) ); 59 labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) );
57 60
58 QDate start=date; 61 QDate start=date;
59 QDate stop=start.addDays(6); 62 QDate stop=start.addDays(6);
60 labelDate->setText( QString::number(start.day()) + " " + 63 labelDate->setText( QString::number(start.day()) + " " +
61 start.monthName(start.month()) + " - " + 64 start.monthName(start.month()) + " - " +
62 QString::number(stop.day()) + " " + 65 QString::number(stop.day()) + " " +
63 start.monthName(stop.month()) ); 66 start.monthName(stop.month()) );
64 emit dateChanged(year,week); 67 emit dateChanged(year,week);
65} 68}
66void DateBookWeekLstHeader::pickDate() { 69void DateBookWeekLstHeader::pickDate() {
67 static QPopupMenu *m1 = 0; 70 static QPopupMenu *m1 = 0;
68 static DateBookMonth *picker = 0; 71 static DateBookMonth *picker = 0;
69 if ( !m1 ) { 72 if ( !m1 ) {
70 m1 = new QPopupMenu( this ); 73 m1 = new QPopupMenu( this );
71 picker = new DateBookMonth( m1, 0, TRUE ); 74 picker = new DateBookMonth( m1, 0, TRUE );
72 m1->insertItem( picker ); 75 m1->insertItem( picker );
73 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 76 connect( picker, SIGNAL( dateClicked( int, int, int ) ),
74 this, SLOT( setDate( int, int, int ) ) ); 77 this, SLOT( setDate( int, int, int ) ) );
75 //connect( m1, SIGNAL( aboutToHide() ), 78 //connect( m1, SIGNAL( aboutToHide() ),
76 //this, SLOT( gotHide() ) ); 79 //this, SLOT( gotHide() ) );
77 } 80 }
78 picker->setDate( date.year(), date.month(), date.day() ); 81 picker->setDate( date.year(), date.month(), date.day() );
79 m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); 82 m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height())));
80 picker->setFocus(); 83 picker->setFocus();
81} 84}
82void DateBookWeekLstHeader::setDate(int y, int m, int d) { 85void DateBookWeekLstHeader::setDate(int y, int m, int d) {
83 QDate new_date(y,m,d); 86 QDate new_date(y,m,d);
84 setDate(new_date); 87 setDate(new_date);
85} 88}
86 89
87void DateBookWeekLstHeader::nextWeek() { 90void DateBookWeekLstHeader::nextWeek() {
88 setDate(date.addDays(7)); 91 setDate(date.addDays(7));
89} 92}
90void DateBookWeekLstHeader::prevWeek() { 93void DateBookWeekLstHeader::prevWeek() {
91 setDate(date.addDays(-7)); 94 setDate(date.addDays(-7));
92} 95}
93 96
94DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, 97DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
95 QWidget* parent, 98 QWidget* parent,
96 const char* name, 99 const char* name,
97 WFlags fl ) 100 WFlags fl )
98 : DateBookWeekLstDayHdrBase(parent, name, fl) { 101 : DateBookWeekLstDayHdrBase(parent, name, fl) {
99 102
100 date=d; 103 date=d;
101 104
102 static const char *wdays={"MTWTFSS"}; 105 static const char *wdays={"MTWTFSS"};
103 char day=wdays[d.dayOfWeek()-1]; 106 char day=wdays[d.dayOfWeek()-1];
104 107
105 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " + 108 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +
106 QString::number(d.day()) ); 109 QString::number(d.day()) );
107 add->setText("+"); 110 add->setText("+");
108 111
109 if (d == QDate::currentDate()) { 112 if (d == QDate::currentDate()) {
110 QPalette pal=label->palette(); 113 QPalette pal=label->palette();
111 pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); 114 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
112 label->setPalette(pal); 115 label->setPalette(pal);
113 116
114 /* 117 /*
115 QFont f=label->font(); 118 QFont f=label->font();
116 f.setItalic(true); 119 f.setItalic(true);
117 label->setFont(f); 120 label->setFont(f);
118 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); 121 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor()));
119 */ 122 */
120 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday 123 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday
121 QPalette pal=label->palette(); 124 QPalette pal=label->palette();
122 pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); 125 pal.setColor(QColorGroup::Foreground, QColor(255,0,0));
123 label->setPalette(pal); 126 label->setPalette(pal);
124 } 127 }
125 128
126 129
127 connect (label, SIGNAL(clicked()), this, SLOT(showDay())); 130 connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
128 connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); 131 connect (add, SIGNAL(clicked()), this, SLOT(newEvent()));
129} 132}
130 133
131void DateBookWeekLstDayHdr::showDay() { 134void DateBookWeekLstDayHdr::showDay() {
132 emit showDate(date.year(), date.month(), date.day()); 135 emit showDate(date.year(), date.month(), date.day());
133} 136}
134void DateBookWeekLstDayHdr::newEvent() { 137void DateBookWeekLstDayHdr::newEvent() {
135 QDateTime start, stop; 138 QDateTime start, stop;
136 start=stop=date; 139 start=stop=date;
137 start.setTime(QTime(10,0)); 140 start.setTime(QTime(10,0));
138 stop.setTime(QTime(12,0)); 141 stop.setTime(QTime(12,0));
139 142
140 emit addEvent(start,stop,"",0); 143 emit addEvent(start,stop,"",0);
141} 144}
142DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, 145DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
143 QWidget* parent, 146 QWidget* parent,
144 const char* name, 147 const char* name,
145 WFlags fl) : 148 WFlags fl) :
146 OClickableLabel(parent,name,fl), 149 OClickableLabel(parent,name,fl),
147 event(ev) 150 event(ev)
148{ 151{
149 char s[10]; 152 char s[10];
150 if ( ev.startDate() != ev.date() ) { // multiday event (not first day) 153 if ( ev.startDate() != ev.date() ) { // multiday event (not first day)
151 if ( ev.endDate() == ev.date() ) { // last day 154 if ( ev.endDate() == ev.date() ) { // last day
152 strcpy(s, "__|__"); 155 strcpy(s, "__|__");
153 } else { 156 } else {
154 strcpy(s, " |---"); 157 strcpy(s, " |---");
155 } 158 }
156 } else { 159 } else {
157 if(ev.event().type() == Event::Normal ) 160 if(ev.event().type() == Event::Normal )
158 sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); 161 sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
159 else 162 else
160 sprintf(s," "); 163 sprintf(s," ");
161 } 164 }
162 setText(QString(s) + " " + ev.description()); 165 setText(QString(s) + " " + ev.description());
163 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 166 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
164 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 167 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
165} 168}
166void DateBookWeekLstEvent::editMe() { 169void DateBookWeekLstEvent::editMe() {
167 emit editEvent(event.event()); 170 emit editEvent(event.event());
168} 171}
169 172
170 173
171DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 174DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
172 const QDate &d, bool onM, 175 const QDate &d, bool onM,
173 QWidget* parent, 176 QWidget* parent,
174 const char* name, WFlags fl) 177 const char* name, WFlags fl)
175 : QWidget( parent, name, fl ) 178 : QWidget( parent, name, fl )
176{ 179{
177 onMonday=onM; 180 onMonday=onM;
178 setPalette(white); 181 setPalette(white);
179 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 182 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
180 183
181 QVBoxLayout *layout = new QVBoxLayout( this ); 184 QVBoxLayout *layout = new QVBoxLayout( this );
182 185
183 qBubbleSort(ev); 186 qBubbleSort(ev);
184 QValueListIterator<EffectiveEvent> it; 187 QValueListIterator<EffectiveEvent> it;
185 it=ev.begin(); 188 it=ev.begin();
186 189
187 int dayOrder[7]; 190 int dayOrder[7];
188 if (onMonday) 191 if (onMonday)
189 for (int d=0; d<7; d++) dayOrder[d]=d+1; 192 for (int d=0; d<7; d++) dayOrder[d]=d+1;
190 else { 193 else {
191 for (int d=0; d<7; d++) dayOrder[d]=d; 194 for (int d=0; d<7; d++) dayOrder[d]=d;
192 dayOrder[0]=7; 195 dayOrder[0]=7;
193 } 196 }
194 197
195 for (int i=0; i<7; i++) { 198 for (int i=0; i<7; i++) {
196 // Header 199 // Header
197 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), 200 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i),
198 onMonday,this); 201 onMonday,this);
199 connect(hdr, SIGNAL(showDate(int,int,int)), 202 connect(hdr, SIGNAL(showDate(int,int,int)),
200 this, SIGNAL(showDate(int,int,int))); 203 this, SIGNAL(showDate(int,int,int)));
201 connect(hdr, SIGNAL(addEvent(const QDateTime &, 204 connect(hdr, SIGNAL(addEvent(const QDateTime &,
202 const QDateTime &, 205 const QDateTime &,
203 const QString &, const QString &)), 206 const QString &, const QString &)),
204 this, SIGNAL(addEvent(const QDateTime &, 207 this, SIGNAL(addEvent(const QDateTime &,
205 const QDateTime &, 208 const QDateTime &,
206 const QString &, const QString &))); 209 const QString &, const QString &)));
207 layout->addWidget(hdr); 210 layout->addWidget(hdr);
208 211
209 // Events 212 // Events
210 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 213 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
211 if(!((*it).end().hour()==(*it).start().hour() && (*it).end().minute()==(*it).start().minute())) {// Skip effective events with no duration. (i.e ending at 00:00) 214 if(!((*it).end().hour()==(*it).start().hour() && (*it).end().minute()==(*it).start().minute())) {// Skip effective events with no duration. (i.e ending at 00:00)
212 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); 215 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this);
213 layout->addWidget(l); 216 layout->addWidget(l);
214 connect (l, SIGNAL(editEvent(const Event &)), 217 connect (l, SIGNAL(editEvent(const Event &)),
215 this, SIGNAL(editEvent(const Event &))); 218 this, SIGNAL(editEvent(const Event &)));
216 } 219 }
217 it++; 220 it++;
218 } 221 }
219 222
220 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 223 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
221 } 224 }
222} 225}
223DateBookWeekLstView::~DateBookWeekLstView(){} 226DateBookWeekLstView::~DateBookWeekLstView(){}
224void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 227void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
225 228
226DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 229DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
227 QValueList<EffectiveEvent> &ev2, 230 QValueList<EffectiveEvent> &ev2,
228 QDate &d, bool onM, 231 QDate &d, bool onM,
229 QWidget* parent, 232 QWidget* parent,
230 const char* name, WFlags fl) 233 const char* name, WFlags fl)
231 : QWidget( parent, name, fl ) 234 : QWidget( parent, name, fl )
232{ 235{
233 QHBoxLayout *layout = new QHBoxLayout( this ); 236 QHBoxLayout *layout = new QHBoxLayout( this );
234 237
235 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); 238 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
236 layout->addWidget(w); 239 layout->addWidget(w);
237 connect (w, SIGNAL(editEvent(const Event &)), 240 connect (w, SIGNAL(editEvent(const Event &)),
238 this, SIGNAL(editEvent(const Event &))); 241 this, SIGNAL(editEvent(const Event &)));
239 connect (w, SIGNAL(showDate(int,int,int)), 242 connect (w, SIGNAL(showDate(int,int,int)),
240 this, SIGNAL(showDate(int,int,int))); 243 this, SIGNAL(showDate(int,int,int)));
241 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 244 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
242 const QString &,const QString &)), 245 const QString &,const QString &)),
243 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 246 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
244 const QString &, const QString &))); 247 const QString &, const QString &)));
245 248
246 249
247 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); 250 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
248 layout->addWidget(w); 251 layout->addWidget(w);
249 connect (w, SIGNAL(editEvent(const Event &)), 252 connect (w, SIGNAL(editEvent(const Event &)),
250 this, SIGNAL(editEvent(const Event &))); 253 this, SIGNAL(editEvent(const Event &)));
251 connect (w, SIGNAL(showDate(int,int,int)), 254 connect (w, SIGNAL(showDate(int,int,int)),
252 this, SIGNAL(showDate(int,int,int))); 255 this, SIGNAL(showDate(int,int,int)));
253 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 256 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
254 const QString &, const QString &)), 257 const QString &, const QString &)),
255 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 258 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
256 const QString &, const QString &))); 259 const QString &, const QString &)));
257} 260}
258 261
259DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, 262DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
260 QWidget *parent, 263 QWidget *parent,
261 const char *name ) 264 const char *name )
262 : QWidget( parent, name ), 265 : QWidget( parent, name ),
263 db( newDB ), 266 db( newDB ),
264 startTime( 0 ), 267 startTime( 0 ),
265 ampm( ap ), 268 ampm( ap ),
266 onMonday(onM) 269 onMonday(onM)
267{ 270{
268 setFocusPolicy(StrongFocus); 271 setFocusPolicy(StrongFocus);
269 layout = new QVBoxLayout( this ); 272 layout = new QVBoxLayout( this );
270 layout->setMargin(0); 273 layout->setMargin(0);
271 274
272 header=new DateBookWeekLstHeader(onM, this); 275 header=new DateBookWeekLstHeader(onM, this);
273 layout->addWidget( header ); 276 layout->addWidget( header );
274 connect(header, SIGNAL(dateChanged(int,int)), 277 connect(header, SIGNAL(dateChanged(int,int)),
275 this, SLOT(dateChanged(int,int))); 278 this, SLOT(dateChanged(int,int)));
276 connect(header, SIGNAL(setDbl(bool)), 279 connect(header, SIGNAL(setDbl(bool)),
277 this, SLOT(setDbl(bool))); 280 this, SLOT(setDbl(bool)));
278 281
279 scroll=new QScrollView(this); 282 scroll=new QScrollView(this);
280 //scroll->setVScrollBarMode(QScrollView::AlwaysOn); 283 //scroll->setVScrollBarMode(QScrollView::AlwaysOn);
281 //scroll->setHScrollBarMode(QScrollView::AlwaysOff); 284 //scroll->setHScrollBarMode(QScrollView::AlwaysOff);
282 scroll->setResizePolicy(QScrollView::AutoOneFit); 285 scroll->setResizePolicy(QScrollView::AutoOneFit);
283 layout->addWidget(scroll); 286 layout->addWidget(scroll);
284 287
285 view=NULL; 288 view=NULL;
286 Config config("DateBook"); 289 Config config("DateBook");
287 config.setGroup("Main"); 290 config.setGroup("Main");
288 dbl=config.readBoolEntry("weeklst_dbl", false); 291 dbl=config.readBoolEntry("weeklst_dbl", false);
289 header->dbl->setOn(dbl); 292 header->dbl->setOn(dbl);
290} 293}
291DateBookWeekLst::~DateBookWeekLst(){ 294DateBookWeekLst::~DateBookWeekLst(){
292 Config config("DateBook"); 295 Config config("DateBook");
293 config.setGroup("Main"); 296 config.setGroup("Main");
294 config.writeEntry("weeklst_dbl", dbl); 297 config.writeEntry("weeklst_dbl", dbl);
295} 298}
296 299
297void DateBookWeekLst::setDate(const QDate &d) { 300void DateBookWeekLst::setDate(const QDate &d) {
298 int w,y; 301 int w,y;
299 calcWeek(d,w,y,onMonday); 302 calcWeek(d,w,y,onMonday);
300 year=y; 303 year=y;
301 _week=w; 304 _week=w;
302 header->setDate(date()); 305 header->setDate(date());
303} 306}
304void DateBookWeekLst::setDbl(bool on) { 307void DateBookWeekLst::setDbl(bool on) {
305 dbl=on; 308 dbl=on;
306 redraw(); 309 redraw();
307} 310}
308void DateBookWeekLst::redraw() {getEvents();} 311void DateBookWeekLst::redraw() {getEvents();}
309 312
310QDate DateBookWeekLst::date() const { 313QDate DateBookWeekLst::date() const {
311 QDate d; 314 QDate d;
312 d.setYMD(year,1,1); 315 d.setYMD(year,1,1);
313 316
314 int dow= d.dayOfWeek(); 317 int dow= d.dayOfWeek();
315 if (!onMonday) 318 if (!onMonday)
316 if (dow==7) dow=1; 319 if (dow==7) dow=1;
317 else dow++; 320 else dow++;
318 321
319 d=d.addDays( (_week-1)*7 - dow + 1 ); 322 d=d.addDays( (_week-1)*7 - dow + 1 );
320 return d; 323 return d;
321} 324}
322 325
323void DateBookWeekLst::getEvents() { 326void DateBookWeekLst::getEvents() {
324 QDate start = date(); 327 QDate start = date();
325 QDate stop = start.addDays(6); 328 QDate stop = start.addDays(6);
326 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 329 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
327 330
328 if (view) delete view; 331 if (view) delete view;
329 if (dbl) { 332 if (dbl) {
330 QDate start2=start.addDays(7); 333 QDate start2=start.addDays(7);
331 stop=start2.addDays(6); 334 stop=start2.addDays(6);
332 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 335 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
333 336
334 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); 337 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
335 } else { 338 } else {
336 view=new DateBookWeekLstView(el,start,onMonday,scroll); 339 view=new DateBookWeekLstView(el,start,onMonday,scroll);
337 } 340 }
338 341
339 connect (view, SIGNAL(editEvent(const Event &)), 342 connect (view, SIGNAL(editEvent(const Event &)),
340 this, SIGNAL(editEvent(const Event &))); 343 this, SIGNAL(editEvent(const Event &)));
341 connect (view, SIGNAL(showDate(int,int,int)), 344 connect (view, SIGNAL(showDate(int,int,int)),
342 this, SIGNAL(showDate(int,int,int))); 345 this, SIGNAL(showDate(int,int,int)));
343 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 346 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
344 const QString &, const QString &)), 347 const QString &, const QString &)),
345 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, 348 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
346 const QString &, const QString &))); 349 const QString &, const QString &)));
347 350
348 scroll->addChild(view); 351 scroll->addChild(view);
349 view->show(); 352 view->show();
350 scroll->updateScrollBars(); 353 scroll->updateScrollBars();
351} 354}
352 355
353void DateBookWeekLst::dateChanged(int y, int w) { 356void DateBookWeekLst::dateChanged(int y, int w) {
354 year=y; 357 year=y;
355 _week=w; 358 _week=w;
356 getEvents(); 359 getEvents();
357} 360}
358 361
359void DateBookWeekLst::keyPressEvent(QKeyEvent *e) 362void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
360{ 363{
361 switch(e->key()) { 364 switch(e->key()) {
362 case Key_Up: 365 case Key_Up:
363 scroll->scrollBy(0, -20); 366 scroll->scrollBy(0, -20);
364 break; 367 break;
365 case Key_Down: 368 case Key_Down:
366 scroll->scrollBy(0, 20); 369 scroll->scrollBy(0, 20);
367 break; 370 break;
368 case Key_Left: 371 case Key_Left:
369 header->prevWeek(); 372 header->prevWeek();
370 break; 373 break;
371 case Key_Right: 374 case Key_Right:
372 header->nextWeek(); 375 header->nextWeek();
373 break; 376 break;
374 default: 377 default:
375 e->ignore(); 378 e->ignore();
376 } 379 }
377} 380}
378 381
diff --git a/core/pim/datebook/datebookweeklstheader.ui b/core/pim/datebook/datebookweeklstheader.ui
index 96cbfea..c71e046 100644
--- a/core/pim/datebook/datebookweeklstheader.ui
+++ b/core/pim/datebook/datebookweeklstheader.ui
@@ -1,315 +1,305 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>DateBookWeekLstHeaderBase</class> 2<class>DateBookWeekLstHeaderBase</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>DateBookWeekLstHeaderBase</cstring> 7 <cstring>DateBookWeekLstHeaderBase</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>183</y> 13 <y>183</y>
14 <width>447</width> 14 <width>447</width>
15 <height>45</height> 15 <height>45</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 <property> 28 <property>
29 <name>layoutSpacing</name> 29 <name>layoutSpacing</name>
30 </property> 30 </property>
31 <hbox> 31 <hbox>
32 <property stdset="1"> 32 <property stdset="1">
33 <name>margin</name> 33 <name>margin</name>
34 <number>11</number> 34 <number>11</number>
35 </property> 35 </property>
36 <property stdset="1"> 36 <property stdset="1">
37 <name>spacing</name> 37 <name>spacing</name>
38 <number>6</number> 38 <number>6</number>
39 </property> 39 </property>
40 <widget> 40 <widget>
41 <class>QToolButton</class> 41 <class>QToolButton</class>
42 <property stdset="1"> 42 <property stdset="1">
43 <name>name</name> 43 <name>name</name>
44 <cstring>back</cstring> 44 <cstring>back</cstring>
45 </property> 45 </property>
46 <property stdset="1"> 46 <property stdset="1">
47 <name>sizePolicy</name> 47 <name>sizePolicy</name>
48 <sizepolicy> 48 <sizepolicy>
49 <hsizetype>7</hsizetype> 49 <hsizetype>7</hsizetype>
50 <vsizetype>0</vsizetype> 50 <vsizetype>0</vsizetype>
51 </sizepolicy> 51 </sizepolicy>
52 </property> 52 </property>
53 <property stdset="1"> 53 <property stdset="1">
54 <name>text</name> 54 <name>text</name>
55 <string></string> 55 <string></string>
56 </property> 56 </property>
57 <property stdset="1"> 57 <property stdset="1">
58 <name>pixmap</name> 58 <name>pixmap</name>
59 <pixmap>image0</pixmap> 59 <pixmap></pixmap>
60 </property> 60 </property>
61 <property stdset="1"> 61 <property stdset="1">
62 <name>toggleButton</name> 62 <name>toggleButton</name>
63 <bool>false</bool> 63 <bool>false</bool>
64 </property> 64 </property>
65 <property stdset="1"> 65 <property stdset="1">
66 <name>autoRepeat</name> 66 <name>autoRepeat</name>
67 <bool>true</bool> 67 <bool>true</bool>
68 </property> 68 </property>
69 <property stdset="1"> 69 <property stdset="1">
70 <name>autoRaise</name> 70 <name>autoRaise</name>
71 <bool>true</bool> 71 <bool>true</bool>
72 </property> 72 </property>
73 <property stdset="1"> 73 <property stdset="1">
74 <name>toggleButton</name> 74 <name>toggleButton</name>
75 <bool>false</bool> 75 <bool>false</bool>
76 </property> 76 </property>
77 <property> 77 <property>
78 <name>toolTip</name> 78 <name>toolTip</name>
79 <string></string> 79 <string></string>
80 </property> 80 </property>
81 </widget> 81 </widget>
82 <spacer> 82 <spacer>
83 <property> 83 <property>
84 <name>name</name> 84 <name>name</name>
85 <cstring>Spacer1_3</cstring> 85 <cstring>Spacer1_3</cstring>
86 </property> 86 </property>
87 <property stdset="1"> 87 <property stdset="1">
88 <name>orientation</name> 88 <name>orientation</name>
89 <enum>Horizontal</enum> 89 <enum>Horizontal</enum>
90 </property> 90 </property>
91 <property stdset="1"> 91 <property stdset="1">
92 <name>sizeType</name> 92 <name>sizeType</name>
93 <enum>Expanding</enum> 93 <enum>Expanding</enum>
94 </property> 94 </property>
95 <property> 95 <property>
96 <name>sizeHint</name> 96 <name>sizeHint</name>
97 <size> 97 <size>
98 <width>20</width> 98 <width>20</width>
99 <height>20</height> 99 <height>20</height>
100 </size> 100 </size>
101 </property> 101 </property>
102 </spacer> 102 </spacer>
103 <widget> 103 <widget>
104 <class>QToolButton</class> 104 <class>QToolButton</class>
105 <property stdset="1"> 105 <property stdset="1">
106 <name>name</name> 106 <name>name</name>
107 <cstring>labelWeek</cstring> 107 <cstring>labelWeek</cstring>
108 </property> 108 </property>
109 <property stdset="1"> 109 <property stdset="1">
110 <name>sizePolicy</name> 110 <name>sizePolicy</name>
111 <sizepolicy> 111 <sizepolicy>
112 <hsizetype>7</hsizetype> 112 <hsizetype>7</hsizetype>
113 <vsizetype>0</vsizetype> 113 <vsizetype>0</vsizetype>
114 </sizepolicy> 114 </sizepolicy>
115 </property> 115 </property>
116 <property stdset="1"> 116 <property stdset="1">
117 <name>font</name> 117 <name>font</name>
118 <font> 118 <font>
119 <bold>1</bold> 119 <bold>1</bold>
120 </font> 120 </font>
121 </property> 121 </property>
122 <property stdset="1"> 122 <property stdset="1">
123 <name>text</name> 123 <name>text</name>
124 <string>W: 00,00</string> 124 <string>W: 00,00</string>
125 </property> 125 </property>
126 <property stdset="1"> 126 <property stdset="1">
127 <name>toggleButton</name> 127 <name>toggleButton</name>
128 <bool>false</bool> 128 <bool>false</bool>
129 </property> 129 </property>
130 <property stdset="1"> 130 <property stdset="1">
131 <name>autoRaise</name> 131 <name>autoRaise</name>
132 <bool>false</bool> 132 <bool>false</bool>
133 </property> 133 </property>
134 <property stdset="1"> 134 <property stdset="1">
135 <name>toggleButton</name> 135 <name>toggleButton</name>
136 <bool>false</bool> 136 <bool>false</bool>
137 </property> 137 </property>
138 <property> 138 <property>
139 <name>toolTip</name> 139 <name>toolTip</name>
140 <string></string> 140 <string></string>
141 </property> 141 </property>
142 </widget> 142 </widget>
143 <spacer> 143 <spacer>
144 <property> 144 <property>
145 <name>name</name> 145 <name>name</name>
146 <cstring>Spacer1</cstring> 146 <cstring>Spacer1</cstring>
147 </property> 147 </property>
148 <property stdset="1"> 148 <property stdset="1">
149 <name>orientation</name> 149 <name>orientation</name>
150 <enum>Horizontal</enum> 150 <enum>Horizontal</enum>
151 </property> 151 </property>
152 <property stdset="1"> 152 <property stdset="1">
153 <name>sizeType</name> 153 <name>sizeType</name>
154 <enum>Expanding</enum> 154 <enum>Expanding</enum>
155 </property> 155 </property>
156 <property> 156 <property>
157 <name>sizeHint</name> 157 <name>sizeHint</name>
158 <size> 158 <size>
159 <width>20</width> 159 <width>20</width>
160 <height>20</height> 160 <height>20</height>
161 </size> 161 </size>
162 </property> 162 </property>
163 </spacer> 163 </spacer>
164 <widget> 164 <widget>
165 <class>QToolButton</class> 165 <class>QToolButton</class>
166 <property stdset="1"> 166 <property stdset="1">
167 <name>name</name> 167 <name>name</name>
168 <cstring>dbl</cstring> 168 <cstring>dbl</cstring>
169 </property> 169 </property>
170 <property stdset="1"> 170 <property stdset="1">
171 <name>sizePolicy</name> 171 <name>sizePolicy</name>
172 <sizepolicy> 172 <sizepolicy>
173 <hsizetype>3</hsizetype> 173 <hsizetype>3</hsizetype>
174 <vsizetype>0</vsizetype> 174 <vsizetype>0</vsizetype>
175 </sizepolicy> 175 </sizepolicy>
176 </property> 176 </property>
177 <property stdset="1"> 177 <property stdset="1">
178 <name>font</name> 178 <name>font</name>
179 <font> 179 <font>
180 <bold>1</bold> 180 <bold>1</bold>
181 </font> 181 </font>
182 </property> 182 </property>
183 <property stdset="1"> 183 <property stdset="1">
184 <name>text</name> 184 <name>text</name>
185 <string>2</string> 185 <string>2</string>
186 </property> 186 </property>
187 <property stdset="1"> 187 <property stdset="1">
188 <name>toggleButton</name> 188 <name>toggleButton</name>
189 <bool>true</bool> 189 <bool>true</bool>
190 </property> 190 </property>
191 <property stdset="1"> 191 <property stdset="1">
192 <name>autoRaise</name> 192 <name>autoRaise</name>
193 <bool>false</bool> 193 <bool>false</bool>
194 </property> 194 </property>
195 <property stdset="1"> 195 <property stdset="1">
196 <name>toggleButton</name> 196 <name>toggleButton</name>
197 <bool>true</bool> 197 <bool>true</bool>
198 </property> 198 </property>
199 <property> 199 <property>
200 <name>toolTip</name> 200 <name>toolTip</name>
201 <string></string> 201 <string></string>
202 </property> 202 </property>
203 </widget> 203 </widget>
204 <spacer> 204 <spacer>
205 <property> 205 <property>
206 <name>name</name> 206 <name>name</name>
207 <cstring>Spacer1_3_2</cstring> 207 <cstring>Spacer1_3_2</cstring>
208 </property> 208 </property>
209 <property stdset="1"> 209 <property stdset="1">
210 <name>orientation</name> 210 <name>orientation</name>
211 <enum>Horizontal</enum> 211 <enum>Horizontal</enum>
212 </property> 212 </property>
213 <property stdset="1"> 213 <property stdset="1">
214 <name>sizeType</name> 214 <name>sizeType</name>
215 <enum>Expanding</enum> 215 <enum>Expanding</enum>
216 </property> 216 </property>
217 <property> 217 <property>
218 <name>sizeHint</name> 218 <name>sizeHint</name>
219 <size> 219 <size>
220 <width>20</width> 220 <width>20</width>
221 <height>20</height> 221 <height>20</height>
222 </size> 222 </size>
223 </property> 223 </property>
224 </spacer> 224 </spacer>
225 <widget> 225 <widget>
226 <class>QLabel</class> 226 <class>QLabel</class>
227 <property stdset="1"> 227 <property stdset="1">
228 <name>name</name> 228 <name>name</name>
229 <cstring>labelDate</cstring> 229 <cstring>labelDate</cstring>
230 </property> 230 </property>
231 <property stdset="1"> 231 <property stdset="1">
232 <name>sizePolicy</name> 232 <name>sizePolicy</name>
233 <sizepolicy> 233 <sizepolicy>
234 <hsizetype>3</hsizetype> 234 <hsizetype>3</hsizetype>
235 <vsizetype>7</vsizetype> 235 <vsizetype>7</vsizetype>
236 </sizepolicy> 236 </sizepolicy>
237 </property> 237 </property>
238 <property stdset="1"> 238 <property stdset="1">
239 <name>font</name> 239 <name>font</name>
240 <font> 240 <font>
241 <bold>1</bold> 241 <bold>1</bold>
242 </font> 242 </font>
243 </property> 243 </property>
244 <property stdset="1"> 244 <property stdset="1">
245 <name>text</name> 245 <name>text</name>
246 <string>00 Jan-00 Jan</string> 246 <string>00 Jan-00 Jan</string>
247 </property> 247 </property>
248 <property> 248 <property>
249 <name>hAlign</name> 249 <name>hAlign</name>
250 </property> 250 </property>
251 </widget> 251 </widget>
252 <spacer> 252 <spacer>
253 <property> 253 <property>
254 <name>name</name> 254 <name>name</name>
255 <cstring>Spacer1_2</cstring> 255 <cstring>Spacer1_2</cstring>
256 </property> 256 </property>
257 <property stdset="1"> 257 <property stdset="1">
258 <name>orientation</name> 258 <name>orientation</name>
259 <enum>Horizontal</enum> 259 <enum>Horizontal</enum>
260 </property> 260 </property>
261 <property stdset="1"> 261 <property stdset="1">
262 <name>sizeType</name> 262 <name>sizeType</name>
263 <enum>Expanding</enum> 263 <enum>Expanding</enum>
264 </property> 264 </property>
265 <property> 265 <property>
266 <name>sizeHint</name> 266 <name>sizeHint</name>
267 <size> 267 <size>
268 <width>20</width> 268 <width>20</width>
269 <height>20</height> 269 <height>20</height>
270 </size> 270 </size>
271 </property> 271 </property>
272 </spacer> 272 </spacer>
273 <widget> 273 <widget>
274 <class>QToolButton</class> 274 <class>QToolButton</class>
275 <property stdset="1"> 275 <property stdset="1">
276 <name>name</name> 276 <name>name</name>
277 <cstring>forward</cstring> 277 <cstring>forward</cstring>
278 </property> 278 </property>
279 <property stdset="1"> 279 <property stdset="1">
280 <name>sizePolicy</name> 280 <name>sizePolicy</name>
281 <sizepolicy> 281 <sizepolicy>
282 <hsizetype>1</hsizetype> 282 <hsizetype>1</hsizetype>
283 <vsizetype>0</vsizetype> 283 <vsizetype>0</vsizetype>
284 </sizepolicy> 284 </sizepolicy>
285 </property> 285 </property>
286 <property stdset="1"> 286 <property stdset="1">
287 <name>text</name> 287 <name>text</name>
288 <string></string> 288 <string></string>
289 </property> 289 </property>
290 <property stdset="1"> 290 <property stdset="1">
291 <name>pixmap</name> 291 <name>pixmap</name>
292 <pixmap>image1</pixmap> 292 <pixmap></pixmap>
293 </property> 293 </property>
294 <property stdset="1"> 294 <property stdset="1">
295 <name>autoRepeat</name> 295 <name>autoRepeat</name>
296 <bool>true</bool> 296 <bool>true</bool>
297 </property> 297 </property>
298 <property stdset="1"> 298 <property stdset="1">
299 <name>autoRaise</name> 299 <name>autoRaise</name>
300 <bool>true</bool> 300 <bool>true</bool>
301 </property> 301 </property>
302 </widget> 302 </widget>
303 </hbox> 303 </hbox>
304</widget> 304</widget>
305<images>
306 <image>
307 <name>image0</name>
308 <data format="XPM.GZ" length="582">789c6dcfcd4e843010c0f13b4fd1d01b31bb6cb325211b1f41e3d1c4789876a60bcbd7aeae07637c773b6d5985d870e0f7ef50605b88e7a707516cb3f72b5c5b2b6c036fa2c08f61f87c79bdffcaf2dd5ef0558b5d7e97e51b61c5e33412df4b7f2fcbb09896a94ab557817063cd744cad74a915734aac35308740d018d9332d5ab0c8ec1229f2c2448d156a661b489ee1ab4e4cf2a08a790e24020abb0dd355442eec8e914e45526215790c749e8e89891069125de466b1fe14295705ccaa5863e2d05cc01894925b2a7e8217dd8a631eb169fd509af10fd1a9ebfbdf32008d9d0c07cd274f70ee162773ba2cdfee935c977ffe6b2edf87ec07796f81cd</data>
309 </image>
310 <image>
311 <name>image1</name>
312 <data format="XPM.GZ" length="627">789c7dcfc94ec3301006e07b9ec28a6f114a13cbb1a8108f00e28884387819676993340b07847877329ea8697a60ec83bfdf232f8784bdbfbdb0e4104db39e6bcb6ca54796b8afb6fdfef87cfe89e25cb2650ac1f2f8218a5366d96bdf01aef9b2e65928a4458a0c07b25c29890352e63293e19c53a0968f52230159e8c22981744495133552097554a1f982b4ce6aeb9013d215165c81ec894e109b4070ca85378f2b35f18c04050214b20d04d010762ba457003eecd6442f88f34a45f4817ea147762b35d1acf4c47457d784737d9f18ebee1363614bf852c6f812b6c460f90abb6e93ba694ed7c49fdbaeee2f76b83da71ba772e0db5d9ccf4b07dfdd5e858edd9b2948fff9d796fc3e457f660e8d47</data>
313 </image>
314</images>
315</UI> 305</UI>