summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp276
-rw-r--r--core/pim/datebook/datebookweek.cpp179
-rw-r--r--core/pim/datebook/datebookweek.h2
-rw-r--r--core/pim/datebook/datebookweekheader.ui62
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp137
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.h19
-rw-r--r--core/pim/datebook/datebookweeklst.cpp212
-rw-r--r--core/pim/datebook/datebookweeklst.h41
-rw-r--r--core/pim/datebook/datebookweeklstheader.ui127
9 files changed, 453 insertions, 602 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index cf1eeca..b7e89b0 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -78,119 +78,122 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
78 rowStyle( 0 ), 78 rowStyle( 0 ),
79 bJumpToCurTime(FALSE), 79 bJumpToCurTime(FALSE),
80 syncing(FALSE), 80 syncing(FALSE),
81 inSearch(FALSE), 81 inSearch(FALSE),
82 alarmCounter(0) 82 alarmCounter(0)
83{ 83{
84 bool needEvilHack= false; // if we need an Evil Hack 84 bool needEvilHack= false; // if we need an Evil Hack
85 QTime t; 85 QTime t;
86 t.start(); 86 t.start();
87 db = new DateBookDBHack; 87 db = new DateBookDBHack;
88 qDebug("loading db t=%d", t.elapsed() ); 88 qDebug("loading db t=%d", t.elapsed() );
89 loadSettings(); 89 loadSettings();
90 setCaption( tr("Calendar") ); 90 setCaption( tr("Calendar") );
91 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 91 setIcon( Resource::loadPixmap( "datebook_icon" ) );
92 92
93 setToolBarsMovable( FALSE ); 93 setToolBarsMovable( FALSE );
94 94
95 views = new QWidgetStack( this ); 95 views = new QWidgetStack( this );
96 setCentralWidget( views ); 96 setCentralWidget( views );
97 97
98 dayView = 0; 98 dayView = 0;
99 weekView = 0; 99 weekView = 0;
100 weekLstView = 0; 100 weekLstView = 0;
101 monthView = 0; 101 monthView = 0;
102 102
103 QPEToolBar *bar = new QPEToolBar( this ); 103// QPEToolBar *bar = new QPEToolBar( this );
104 bar->setHorizontalStretchable( TRUE ); 104// bar->setHorizontalStretchable( TRUE );
105 105
106 QPEMenuBar *mb = new QPEMenuBar( bar ); 106// QPEMenuBar *mb = new QPEMenuBar( bar );
107 mb->setMargin( 0 ); 107// mb->setMargin( 0 );
108 108
109 QPEToolBar *sub_bar = new QPEToolBar(this); 109// QPopupMenu *view = new QPopupMenu( this );
110 110// mb->insertItem( tr( "View" ), view );
111 QPopupMenu *view = new QPopupMenu( this ); 111
112 QPopupMenu *settings = new QPopupMenu( this ); 112 QPEToolBar *sub_bar = new QPEToolBar(this);
113 113 sub_bar->setHorizontalStretchable(TRUE);
114 mb->insertItem( tr( "View" ), view ); 114
115 mb->insertItem( tr( "Settings" ), settings ); 115 QActionGroup *g = new QActionGroup( this );
116 116 g->setExclusive( TRUE );
117 QActionGroup *g = new QActionGroup( this ); 117
118 g->setExclusive( TRUE ); 118 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
119 119 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 120 a->addTo( sub_bar );
121 QString::null, 0, this, 0 ); 121
122 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 122 sub_bar->addSeparator();
123 a->addTo( sub_bar ); 123
124 124 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 );
125 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); 125 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
126 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 126 a->addTo( sub_bar );
127 a->addTo( sub_bar ); 127 //a->addTo( view );
128 a->addTo( view ); 128
129 129 sub_bar->addSeparator();
130 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 130
131 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 131 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
132 a->addTo( sub_bar ); 132 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
133 a->addTo( view ); 133 a->addTo( sub_bar );
134 a->setToggleAction( TRUE ); 134// a->addTo( view );
135 a->setOn( TRUE ); 135 a->setToggleAction( TRUE );
136 dayAction = a; 136 a->setOn( TRUE );
137 137 dayAction = a;
138 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); 138
139 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); 139 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 );
140 a->addTo( sub_bar ); 140 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
141 a->addTo( view ); 141 a->addTo( sub_bar );
142 a->setToggleAction( TRUE ); 142// a->addTo( view );
143 weekAction = a; 143 a->setToggleAction( TRUE );
144 144 weekAction = a;
145 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); 145
146 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); 146 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 );
147 a->addTo( sub_bar ); 147 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
148 a->addTo( view ); 148 a->addTo( sub_bar );
149 a->setToggleAction( TRUE ); 149// a->addTo( view );
150 weekLstAction = a; 150 a->setToggleAction( TRUE );
151 151 weekLstAction = a;
152 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); 152
153 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); 153 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
154 a->addTo( sub_bar ); 154 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
155 a->addTo( view ); 155 a->addTo( sub_bar );
156 a->setToggleAction( TRUE ); 156// a->addTo( view );
157 monthAction = a; 157 a->setToggleAction( TRUE );
158 158 monthAction = a;
159 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); 159
160 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 160 sub_bar->addSeparator();
161 a->addTo( sub_bar ); 161
162 162 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 );
163 a = new QAction( tr( "Edit..." ), QString::null, 0, 0 ); 163 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
164 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 164 a->addTo( sub_bar );
165 a->addTo( settings ); 165
166 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 );
167 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
168 a->addTo( sub_bar );
166 169
167 if(defaultView==DAY) viewDay(); 170 if(defaultView==DAY) viewDay();
168 if(defaultView==WEEK) needEvilHack=true;// viewWeek(); 171 if(defaultView==WEEK) needEvilHack=true;// viewWeek();
169 if(defaultView==WEEKLST) viewWeekLst(); 172 if(defaultView==WEEKLST) viewWeekLst();
170 if(defaultView==MONTH) viewMonth(); 173 if(defaultView==MONTH) viewMonth();
171 174
172 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); 175 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
173 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); 176 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) );
174 177
175#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 178#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
176 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 179 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) );
177#endif 180#endif
178 181
179 // listen on QPE/System 182 // listen on QPE/System
180#if defined(Q_WS_QWS) 183#if defined(Q_WS_QWS)
181#if !defined(QT_NO_COP) 184#if !defined(QT_NO_COP)
182 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 185 QCopChannel *channel = new QCopChannel( "QPE/System", this );
183 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 186 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) );
184 channel = new QCopChannel( "QPE/Datebook", this ); 187 channel = new QCopChannel( "QPE/Datebook", this );
185 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 188 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) );
186 qDebug("olle\n"); 189 qDebug("olle\n");
187#endif 190#endif
188#endif 191#endif
189 192
190 qDebug("done t=%d", t.elapsed() ); 193 qDebug("done t=%d", t.elapsed() );
191 194
192 /* 195 /*
193 * Here is a problem description: 196 * Here is a problem description:
194 * When Weekview is the default view 197 * When Weekview is the default view
195 * a DateBookWeekView get's created 198 * a DateBookWeekView get's created
196 * redraw() get's called. So what? 199 * redraw() get's called. So what?
@@ -370,36 +373,29 @@ void DateBook::view(int v, const QDate &d) {
370 views->raiseWidget( monthView ); 373 views->raiseWidget( monthView );
371 monthView->redraw(); 374 monthView->redraw();
372 } 375 }
373} 376}
374 377
375void DateBook::viewDefault(const QDate &d) { 378void DateBook::viewDefault(const QDate &d) {
376/*
377 Config config("DateBook");
378 config.setGroup("Main");
379 int current=config.readNumEntry("defaultview", DAY);
380
381 view(current,d);
382*/
383 view(defaultView,d); 379 view(defaultView,d);
384} 380}
385 381
386void DateBook::viewDay() { 382void DateBook::viewDay() {
387 view(DAY,currentDate()); 383 view(DAY,currentDate());
388} 384}
389 385
390void DateBook::viewWeek() { 386void DateBook::viewWeek() {
391 view(WEEK,currentDate()); 387 view(WEEK,currentDate());
392} 388}
393 389
394void DateBook::viewWeekLst() { 390void DateBook::viewWeekLst() {
395 view(WEEKLST,currentDate()); 391 view(WEEKLST,currentDate());
396} 392}
397 393
398void DateBook::viewMonth() { 394void DateBook::viewMonth() {
399 view(MONTH,currentDate()); 395 view(MONTH,currentDate());
400} 396}
401 397
402void DateBook::insertEvent( const Event &e ) 398void DateBook::insertEvent( const Event &e )
403{ 399{
404 Event dupEvent=e; 400 Event dupEvent=e;
405 dupEvent.setLocation(defaultLocation); 401 dupEvent.setLocation(defaultLocation);
@@ -523,39 +519,30 @@ void DateBook::initDay()
523 if ( !dayView ) { 519 if ( !dayView ) {
524 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); 520 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
525 views->addWidget( dayView, DAY ); 521 views->addWidget( dayView, DAY );
526 dayView->setStartViewTime( startTime ); 522 dayView->setStartViewTime( startTime );
527 dayView->setJumpToCurTime( bJumpToCurTime ); 523 dayView->setJumpToCurTime( bJumpToCurTime );
528 dayView->setRowStyle( rowStyle ); 524 dayView->setRowStyle( rowStyle );
529 connect( this, SIGNAL( newEvent() ), 525 connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) );
530 dayView, SLOT( redraw() ) ); 526 connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) );
531 connect( dayView, SIGNAL( newEvent() ), 527 connect( dayView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) );
532 this, SLOT( fileNew() ) ); 528 connect( dayView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) );
533 connect( dayView, SIGNAL( removeEvent( const Event & ) ), 529 connect( dayView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) );
534 this, SLOT( removeEvent( const Event & ) ) ); 530 connect( dayView, SIGNAL( beamEvent( const Event & ) ), this, SLOT( beamEvent( const Event & ) ) );
535 connect( dayView, SIGNAL( editEvent( const Event & ) ), 531 connect( dayView, SIGNAL(sigNewEvent(const QString &)), this, SLOT(slotNewEventFromKey(const QString &)) );
536 this, SLOT( editEvent( const Event & ) ) ); 532 }
537 connect( dayView, SIGNAL( duplicateEvent( const Event & ) ),
538 this, SLOT( duplicateEvent( const Event & ) ) );
539 connect( dayView, SIGNAL( beamEvent( const Event & ) ),
540 this, SLOT( beamEvent( const Event & ) ) );
541 connect( dayView, SIGNAL(sigNewEvent(const QString &)),
542 this, SLOT(slotNewEventFromKey(const QString &)) );
543 }
544} 533}
545 534
546void DateBook::initWeek() 535void DateBook::initWeek()
547{ 536{
548 if ( !weekView ) { 537 if ( !weekView ) {
549 weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" ); 538 weekView = new DateBookWeek( ampm, onMonday, db, views, "week view" );
550 weekView->setStartViewTime( startTime ); 539 weekView->setStartViewTime( startTime );
551 views->addWidget( weekView, WEEK ); 540 views->addWidget( weekView, WEEK );
552 connect( weekView, SIGNAL( showDate( int, int, int ) ), 541 connect( weekView, SIGNAL( showDate( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) );
553 this, SLOT( showDay( int, int, int ) ) ); 542 connect( this, SIGNAL( newEvent() ), weekView, SLOT( redraw() ) );
554 connect( this, SIGNAL( newEvent() ),
555 weekView, SLOT( redraw() ) );
556 } 543 }
557 544
558 //But also get it right: the year that we display can be different 545 //But also get it right: the year that we display can be different
559 //from the year of the current date. So, first find the year 546 //from the year of the current date. So, first find the year
560 //number of the current week. 547 //number of the current week.
561 int yearNumber, totWeeks; 548 int yearNumber, totWeeks;
@@ -565,50 +552,38 @@ void DateBook::initWeek()
565 calcWeek( d, totWeeks, yearNumber, onMonday ); 552 calcWeek( d, totWeeks, yearNumber, onMonday );
566 553
567 while ( totWeeks == 1 ) { 554 while ( totWeeks == 1 ) {
568 d = d.addDays( -1 ); 555 d = d.addDays( -1 );
569 calcWeek( d, totWeeks, yearNumber, onMonday ); 556 calcWeek( d, totWeeks, yearNumber, onMonday );
570 } 557 }
571 if ( totWeeks != weekView->totalWeeks() )
572 weekView->setTotalWeeks( totWeeks );
573} 558}
574 559
575void DateBook::initWeekLst() { 560void DateBook::initWeekLst() {
576 if ( !weekLstView ) { 561 if ( !weekLstView ) {
577 weekLstView = new DateBookWeekLst( ampm, onMonday, db, 562 weekLstView = new DateBookWeekLst( ampm, onMonday, db, views, "weeklst view" );
578 views, "weeklst view" ); 563 views->addWidget( weekLstView, WEEKLST );
579 views->addWidget( weekLstView, WEEKLST ); 564
580 565 //weekLstView->setStartViewTime( startTime );
581 //weekLstView->setStartViewTime( startTime ); 566 connect( weekLstView, SIGNAL( showDate( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) );
582 connect( weekLstView, SIGNAL( showDate( int, int, int ) ), 567 connect( weekLstView, SIGNAL( addEvent( const QDateTime &, const QDateTime &, const QString & , const QString &) ),
583 this, SLOT( showDay( int, int, int ) ) ); 568 this, SLOT( slotNewEntry( const QDateTime &, const QDateTime &, const QString & , const QString &) ) );
584 connect( weekLstView, SIGNAL( addEvent( const QDateTime &, 569 connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) );
585 const QDateTime &, 570 connect( weekLstView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) );
586 const QString & , const QString &) ), 571 }
587 this, SLOT( slotNewEntry( const QDateTime &,
588 const QDateTime &,
589 const QString & , const QString &) ) );
590 connect( this, SIGNAL( newEvent() ),
591 weekLstView, SLOT( redraw() ) );
592 connect( weekLstView, SIGNAL( editEvent( const Event & ) ),
593 this, SLOT( editEvent( const Event & ) ) );
594 }
595} 572}
596 573
597 574
598void DateBook::initMonth() 575void DateBook::initMonth()
599{ 576{
600 if ( !monthView ) { 577 if ( !monthView ) {
601 monthView = new DateBookMonth( views, "month view", FALSE, db ); 578 monthView = new DateBookMonth( views, "month view", FALSE, db );
602 views->addWidget( monthView, MONTH ); 579 views->addWidget( monthView, MONTH );
603 connect( monthView, SIGNAL( dateClicked( int, int, int ) ), 580 connect( monthView, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) );
604 this, SLOT( showDay( int, int, int ) ) ); 581 connect( this, SIGNAL( newEvent() ), monthView, SLOT( redraw() ) );
605 connect( this, SIGNAL( newEvent() ), 582 qApp->processEvents();
606 monthView, SLOT( redraw() ) ); 583 }
607 qApp->processEvents();
608 }
609} 584}
610 585
611void DateBook::loadSettings() 586void DateBook::loadSettings()
612{ 587{
613 Config qpeconfig( "qpe" ); 588 Config qpeconfig( "qpe" );
614 qpeconfig.setGroup("Time"); 589 qpeconfig.setGroup("Time");
@@ -626,12 +601,13 @@ void DateBook::loadSettings()
626 weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); 601 weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL);
627 602
628 defaultLocation=config.readEntry("defaultLocation"); 603 defaultLocation=config.readEntry("defaultLocation");
629 QString tmpString=config.readEntry("defaultCategories"); 604 QString tmpString=config.readEntry("defaultCategories");
630 QStringList tmpStringList=QStringList::split(",",tmpString); 605 QStringList tmpStringList=QStringList::split(",",tmpString);
631 defaultCategories.truncate(0); 606 defaultCategories.truncate(0);
607
632 for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) { 608 for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) {
633 defaultCategories.resize(defaultCategories.count()+1); 609 defaultCategories.resize(defaultCategories.count()+1);
634 defaultCategories[defaultCategories.count()-1]=(*i).toInt(); 610 defaultCategories[defaultCategories.count()-1]=(*i).toInt();
635 } 611 }
636} 612}
637 613
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 8241655..3ae4610 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -350,44 +350,34 @@ DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
350 : QWidget( parent, name ), 350 : QWidget( parent, name ),
351 db( newDB ), 351 db( newDB ),
352 startTime( 0 ), 352 startTime( 0 ),
353 ampm( ap ), 353 ampm( ap ),
354 bStartOnMonday( startOnMonday ) 354 bStartOnMonday( startOnMonday )
355{ 355{
356 setFocusPolicy(StrongFocus); 356 setFocusPolicy(StrongFocus);
357 QVBoxLayout *vb = new QVBoxLayout( this ); 357 QVBoxLayout *vb = new QVBoxLayout( this );
358 header = new DateBookWeekHeader( bStartOnMonday, this ); 358 header = new DateBookWeekHeader( bStartOnMonday, this );
359 view = new DateBookWeekView( ampm, startOnMonday, this ); 359 view = new DateBookWeekView( ampm, startOnMonday, this );
360 vb->addWidget( header ); 360 vb->addWidget( header );
361 vb->addWidget( view ); 361 vb->addWidget( view );
362 362
363 lblDesc = new QLabel( this, "event label" ); 363 lblDesc = new QLabel( this, "event label" );
364 lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); 364 lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box );
365 lblDesc->setBackgroundColor( yellow ); 365 lblDesc->setBackgroundColor( yellow );
366 lblDesc->hide(); 366 lblDesc->hide();
367 367
368 tHide = new QTimer( this ); 368 tHide = new QTimer( this );
369 369
370 connect( view, SIGNAL( showDay( int ) ), 370 connect( view, SIGNAL( showDay( int ) ), this, SLOT( showDay( int ) ) );
371 this, SLOT( showDay( int ) ) ); 371 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), this, SLOT(slotShowEvent(const EffectiveEvent&)) );
372 connect( view, SIGNAL(signalShowEvent(const EffectiveEvent&)), 372 connect( view, SIGNAL(signalHideEvent()), this, SLOT(slotHideEvent()) );
373 this, SLOT(slotShowEvent(const EffectiveEvent&)) ); 373 connect( header, SIGNAL( dateChanged( int, int ) ), this, SLOT( dateChanged( int, int ) ) );
374 connect( view, SIGNAL(signalHideEvent()), 374 connect( tHide, SIGNAL( timeout() ), lblDesc, SLOT( hide() ) );
375 this, SLOT(slotHideEvent()) ); 375 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) );
376 connect( header, SIGNAL( dateChanged( int, int ) ), 376 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(slotClockChanged(bool)));
377 this, SLOT( dateChanged( int, int ) ) ); 377 setDate(QDate::currentDate());
378 connect( tHide, SIGNAL( timeout() ),
379 lblDesc, SLOT( hide() ) );
380 connect( header->spinYear, SIGNAL(valueChanged(int)),
381 this, SLOT(slotYearChanged(int)) );
382 connect( qApp, SIGNAL(weekChanged(bool)),
383 this, SLOT(slotWeekChanged(bool)) );
384 connect( qApp, SIGNAL(clockChanged(bool)),
385 this, SLOT(slotClockChanged(bool)));
386 setDate(QDate::currentDate());
387
388} 378}
389 379
390void DateBookWeek::keyPressEvent(QKeyEvent *e) 380void DateBookWeek::keyPressEvent(QKeyEvent *e)
391{ 381{
392 switch(e->key()) { 382 switch(e->key()) {
393 case Key_Up: 383 case Key_Up:
@@ -406,84 +396,80 @@ void DateBookWeek::keyPressEvent(QKeyEvent *e)
406 e->ignore(); 396 e->ignore();
407 } 397 }
408} 398}
409 399
410void DateBookWeek::showDay( int day ) 400void DateBookWeek::showDay( int day )
411{ 401{
412 QDate d; 402 QDate d;
413 d = dateFromWeek( _week, year, bStartOnMonday ); 403 d = dateFromWeek( _week, year, bStartOnMonday );
414 day--; 404 day--;
415 d = d.addDays( day ); 405 d = d.addDays( day );
416 emit showDate( d.year(), d.month(), d.day() ); 406 emit showDate( d.year(), d.month(), d.day() );
417} 407}
418 408
419void DateBookWeek::setDate( int y, int m, int d ) 409void DateBookWeek::setDate( int y, int m, int d )
420{ 410{
421 QDate date; 411 setDate(QDate(y, m, d));
422 date.setYMD( y, m, d );
423 setDate(QDate(y, m, d));
424} 412}
425 413
426void DateBookWeek::setDate(QDate date) 414void DateBookWeek::setDate(QDate date)
427{ 415{
428 dow = date.dayOfWeek(); 416 dow = date.dayOfWeek();
429 int w, y; 417 int w, y;
430 calcWeek( date, w, y, bStartOnMonday ); 418 calcWeek( date, w, y, bStartOnMonday );
431 header->setDate( y, w ); 419 header->setDate( date );
432} 420}
433 421
434void DateBookWeek::dateChanged( int y, int w ) 422void DateBookWeek::dateChanged( int y, int w )
435{ 423{
436 year = y; 424 year = y;
437 _week = w; 425 _week = w;
438 getEvents(); 426 getEvents();
439} 427}
440 428
441QDate DateBookWeek::date() const 429QDate DateBookWeek::date() const
442{ 430{
443 QDate d; 431 QDate d;
444 d = dateFromWeek( _week - 1, year, bStartOnMonday ); 432 d = dateFromWeek( _week - 1, year, bStartOnMonday );
445 if ( bStartOnMonday ) 433 if ( bStartOnMonday )
446 d = d.addDays( 7 + dow - 1 ); 434 d = d.addDays( 7 + dow - 1 );
447 else { 435 else {
448 if ( dow == 7 ) 436 if ( dow == 7 )
449 d = d.addDays( dow ); 437 d = d.addDays( dow );
450 else 438 else
451 d = d.addDays( 7 + dow ); 439 d = d.addDays( 7 + dow );
452 } 440 }
453 return d; 441 return d;
454} 442}
455 443
456void DateBookWeek::getEvents() 444void DateBookWeek::getEvents()
457{ 445{
458 QDate startWeek = weekDate(); 446 QDate startWeek = weekDate();
459 447
460 QDate endWeek = startWeek.addDays( 6 ); 448 QDate endWeek = startWeek.addDays( 6 );
461 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, 449 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents(startWeek, endWeek);
462 endWeek); 450 view->showEvents( eventList );
463 view->showEvents( eventList ); 451 view->moveToHour( startTime );
464 view->moveToHour( startTime );
465} 452}
466 453
467void DateBookWeek::generateAllDayTooltext( QString& text ) { 454void DateBookWeek::generateAllDayTooltext( QString& text ) {
468 text += "<b>" + tr("This is an all day event.") + "</b><br>"; 455 text += "<b>" + tr("This is an all day event.") + "</b><br>";
469} 456}
470 457
471void DateBookWeek::generateNormalTooltext( QString& str, 458void DateBookWeek::generateNormalTooltext( QString& str, const EffectiveEvent &ev ) {
472 const EffectiveEvent &ev ) { 459 str += "<b>" + QObject::tr("Start") + "</b>: ";
473 str += "<b>" + QObject::tr("Start") + "</b>: "; 460 str += TimeString::timeString( ev.event().start().time(), ampm, FALSE );
474 str += TimeString::timeString( ev.event().start().time(), ampm, FALSE ); 461 if( ev.startDate()!=ev.endDate() ) {
475 if( ev.startDate()!=ev.endDate() ) { 462 str += " <i>" + TimeString::longDateString( ev.startDate() )+"</i>";
476 str += " <i>" + TimeString::longDateString( ev.startDate() )+"</i>"; 463 }
477 } 464 str += "<br>";
478 str += "<br>"; 465 str += "<b>" + QObject::tr("End") + "</b>: ";
479 str += "<b>" + QObject::tr("End") + "</b>: "; 466 str += TimeString::timeString( ev.event().end().time(), ampm, FALSE );
480 str += TimeString::timeString( ev.event().end().time(), ampm, FALSE ); 467 if( ev.startDate()!=ev.endDate() ) {
481 if( ev.startDate()!=ev.endDate() ) { 468 str += " <i>" + TimeString::longDateString( ev.endDate() ) + "</i>";
482 str += " <i>" + TimeString::longDateString( ev.endDate() ) + "</i>"; 469 }
483 }
484} 470}
485 471
486void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) 472void DateBookWeek::slotShowEvent( const EffectiveEvent &ev )
487{ 473{
488 if ( tHide->isActive() ) 474 if ( tHide->isActive() )
489 tHide->stop(); 475 tHide->stop();
@@ -563,46 +549,33 @@ void DateBookWeek::redraw()
563{ 549{
564 getEvents(); 550 getEvents();
565} 551}
566 552
567void DateBookWeek::slotYearChanged( int y ) 553void DateBookWeek::slotYearChanged( int y )
568{ 554{
569 int totWeek; 555 int totWeek;
570 QDate d( y, 12, 31 ); 556 QDate d( y, 12, 31 );
571 int throwAway; 557 int throwAway;
572 calcWeek( d, totWeek, throwAway, bStartOnMonday );
573 while ( totWeek == 1 ) {
574 d = d.addDays( -1 );
575 calcWeek( d, totWeek, throwAway, bStartOnMonday ); 558 calcWeek( d, totWeek, throwAway, bStartOnMonday );
576 } 559 while ( totWeek == 1 ) {
577 if ( totWeek != totalWeeks() ) 560 d = d.addDays( -1 );
578 setTotalWeeks( totWeek ); 561 calcWeek( d, totWeek, throwAway, bStartOnMonday );
579} 562 }
580
581
582void DateBookWeek::setTotalWeeks( int numWeeks )
583{
584 header->spinWeek->setMaxValue( numWeeks );
585}
586
587int DateBookWeek::totalWeeks() const
588{
589 return header->spinWeek->maxValue();
590} 563}
591 564
592void DateBookWeek::slotWeekChanged( bool onMonday ) 565void DateBookWeek::slotWeekChanged( bool onMonday )
593{ 566{
594 bStartOnMonday = onMonday; 567 bStartOnMonday = onMonday;
595 view->setStartOfWeek( bStartOnMonday ); 568 view->setStartOfWeek( bStartOnMonday );
596 header->setStartOfWeek( bStartOnMonday ); 569 header->setStartOfWeek( bStartOnMonday );
597 redraw(); 570 redraw();
598} 571}
599 572
600void DateBookWeek::slotClockChanged( bool ap ) 573void DateBookWeek::slotClockChanged( bool ap )
601{ 574{
602 ampm = ap; 575 ampm = ap;
603} 576}
604 577
605// return the date at the beginning of the week... 578// return the date at the beginning of the week...
606QDate DateBookWeek::weekDate() const 579QDate DateBookWeek::weekDate() const
607{ 580{
608 return dateFromWeek( _week, year, bStartOnMonday ); 581 return dateFromWeek( _week, year, bStartOnMonday );
diff --git a/core/pim/datebook/datebookweek.h b/core/pim/datebook/datebookweek.h
index acbc2c7..8c5e06d 100644
--- a/core/pim/datebook/datebookweek.h
+++ b/core/pim/datebook/datebookweek.h
@@ -106,14 +106,12 @@ public:
106 void setDate( QDate d ); 106 void setDate( QDate d );
107 QDate date() const; 107 QDate date() const;
108 DateBookWeekView *weekView() const { return view; } 108 DateBookWeekView *weekView() const { return view; }
109 void setStartViewTime( int startHere ); 109 void setStartViewTime( int startHere );
110 int startViewTime() const; 110 int startViewTime() const;
111 int week() const { return _week; }; 111 int week() const { return _week; };
112 void setTotalWeeks( int totalWeeks );
113 int totalWeeks() const;
114 QDate weekDate() const; 112 QDate weekDate() const;
115 113
116public slots: 114public slots:
117 void redraw(); 115 void redraw();
118 void slotWeekChanged( bool bStartOnMonday ); 116 void slotWeekChanged( bool bStartOnMonday );
119 void slotClockChanged( bool a ); 117 void slotClockChanged( bool a );
diff --git a/core/pim/datebook/datebookweekheader.ui b/core/pim/datebook/datebookweekheader.ui
index 591b625..b2e0e36 100644
--- a/core/pim/datebook/datebookweekheader.ui
+++ b/core/pim/datebook/datebookweekheader.ui
@@ -116,72 +116,12 @@
116 </property> 116 </property>
117 <property> 117 <property>
118 <name>toolTip</name> 118 <name>toolTip</name>
119 <string></string> 119 <string></string>
120 </property> 120 </property>
121 </widget> 121 </widget>
122 <widget>
123 <class>QSpinBox</class>
124 <property stdset="1">
125 <name>name</name>
126 <cstring>spinYear</cstring>
127 </property>
128 <property stdset="1">
129 <name>sizePolicy</name>
130 <sizepolicy>
131 <hsizetype>0</hsizetype>
132 <vsizetype>0</vsizetype>
133 </sizepolicy>
134 </property>
135 <property stdset="1">
136 <name>prefix</name>
137 <string>Y: </string>
138 </property>
139 <property stdset="1">
140 <name>maxValue</name>
141 <number>2037</number>
142 </property>
143 <property stdset="1">
144 <name>minValue</name>
145 <number>1970</number>
146 </property>
147 <property stdset="1">
148 <name>value</name>
149 <number>2002</number>
150 </property>
151 </widget>
152 <widget>
153 <class>QSpinBox</class>
154 <property stdset="1">
155 <name>name</name>
156 <cstring>spinWeek</cstring>
157 </property>
158 <property stdset="1">
159 <name>sizePolicy</name>
160 <sizepolicy>
161 <hsizetype>0</hsizetype>
162 <vsizetype>0</vsizetype>
163 </sizepolicy>
164 </property>
165 <property stdset="1">
166 <name>prefix</name>
167 <string>W: </string>
168 </property>
169 <property stdset="1">
170 <name>maxValue</name>
171 <number>52</number>
172 </property>
173 <property stdset="1">
174 <name>minValue</name>
175 <number>1</number>
176 </property>
177 <property stdset="1">
178 <name>value</name>
179 <number>1</number>
180 </property>
181 </widget>
182 <spacer> 122 <spacer>
183 <property> 123 <property>
184 <name>name</name> 124 <name>name</name>
185 <cstring>Spacer1_1</cstring> 125 <cstring>Spacer1_1</cstring>
186 </property> 126 </property>
187 <property stdset="1"> 127 <property stdset="1">
@@ -327,9 +267,9 @@
327 <slot access="public">yearChanged( int )</slot> 267 <slot access="public">yearChanged( int )</slot>
328 <slot access="public">nextWeek()</slot> 268 <slot access="public">nextWeek()</slot>
329 <slot access="public">prevWeek()</slot> 269 <slot access="public">prevWeek()</slot>
330 <slot access="public">weekChanged( int )</slot> 270 <slot access="public">weekChanged( int )</slot>
331 <slot access="public">nextMonth()</slot> 271 <slot access="public">nextMonth()</slot>
332 <slot access="public">prevMonth()</slot> 272 <slot access="public">prevMonth()</slot>
333 <slot access="public">pickDate()</slot> 273 <slot access="public">pickDate()</slot>
334</connections> 274</connections>
335</UI> 275</UI>
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index 5f555d5..fd792e2 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -29,26 +29,22 @@
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30 30
31/* 31/*
32 * Constructs a DateBookWeekHeader which is a child of 'parent', with the 32 * Constructs a DateBookWeekHeader which is a child of 'parent', with the
33 * name 'name' and widget flags set to 'f' 33 * name 'name' and widget flags set to 'f'
34 */ 34 */
35DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, 35DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl )
36 const char* name, WFlags fl )
37 : DateBookWeekHeaderBase( parent, name, fl ), 36 : DateBookWeekHeaderBase( parent, name, fl ),
38 bStartOnMonday( startOnMonday ) 37 bStartOnMonday( startOnMonday )
39{ 38{
40 setBackgroundMode( PaletteButton ); 39 setBackgroundMode( PaletteButton );
41 labelDate->setBackgroundMode( PaletteButton ); 40 labelDate->setBackgroundMode( PaletteButton );
42 41 backmonth->setPixmap( Resource::loadPixmap("fastback") );
43 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 42 backweek->setPixmap( Resource::loadPixmap("back") );
44 backweek->setPixmap( Resource::loadPixmap("back") ); 43 forwardweek->setPixmap( Resource::loadPixmap("forward") );
45 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 44 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
46 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
47 spinYear->hide();
48 spinWeek->hide();
49} 45}
50 46
51/* 47/*
52 * Destroys the object and frees any allocated resources 48 * Destroys the object and frees any allocated resources
53 */ 49 */
54DateBookWeekHeader::~DateBookWeekHeader() 50DateBookWeekHeader::~DateBookWeekHeader()
@@ -57,124 +53,87 @@ DateBookWeekHeader::~DateBookWeekHeader()
57} 53}
58 54
59void DateBookWeekHeader::pickDate() 55void DateBookWeekHeader::pickDate()
60{ 56{
61 static QPopupMenu *m1 = 0; 57 static QPopupMenu *m1 = 0;
62 static DateBookMonth *picker = 0; 58 static DateBookMonth *picker = 0;
63 QDate currDate = dateFromWeek( week, year, bStartOnMonday );
64 if ( !m1 ) { 59 if ( !m1 ) {
65 m1 = new QPopupMenu( this ); 60 m1 = new QPopupMenu( this );
66 picker = new DateBookMonth( m1, 0, TRUE ); 61 picker = new DateBookMonth( m1, 0, TRUE );
67 m1->insertItem( picker ); 62 m1->insertItem( picker );
68 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 63 connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) );
69 this, SLOT( setDate( int, int, int ) ) ); 64 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) );
70 // connect( m1, SIGNAL( aboutToHide() ),
71 // this, SLOT( gotHide() ) );
72 } 65 }
73 picker->setDate( currDate.year(), currDate.month(), currDate.day() ); 66 picker->setDate( date.year(), date.month(), date.day() );
74 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); 67 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
75 picker->setFocus(); 68 picker->setFocus();
76} 69}
77/* 70
78 * public slot
79 */
80void DateBookWeekHeader::yearChanged( int y )
81{
82 setDate( y, week );
83}
84void DateBookWeekHeader::nextMonth() 71void DateBookWeekHeader::nextMonth()
85{ 72{
86 QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week 73 setDate(date.addDays(28));
87 calcWeek( mydate.addDays(28), week, year, bStartOnMonday ); // Add 4 weeks.
88 setDate( year, week ); // update view
89} 74}
90void DateBookWeekHeader::prevMonth() 75void DateBookWeekHeader::prevMonth()
91{ 76{
92 QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week 77 setDate(date.addDays(-28));
93 calcWeek( mydate.addDays(-28), week, year, bStartOnMonday ); // Subtract 4 weeks
94 setDate( year, week ); // update view
95} 78}
96/*
97 * public slot
98 */
99void DateBookWeekHeader::nextWeek() 79void DateBookWeekHeader::nextWeek()
100{ 80{
101 QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week 81 setDate(date.addDays(7));
102 calcWeek( mydate.addDays(7), week, year, bStartOnMonday); // Add 1 week
103// if ( week < 52 )
104 //week++;
105 setDate( year, week );
106} 82}
107/*
108 * public slot
109 */
110void DateBookWeekHeader::prevWeek() 83void DateBookWeekHeader::prevWeek()
111{ 84{
112 QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week 85 setDate(date.addDays(-7));
113 calcWeek( mydate.addDays(-7), week, year, bStartOnMonday); // Add 1 week
114// if ( week > 1 )
115 //week--;
116 setDate( year, week );
117}
118/*
119 * public slot
120 */
121void DateBookWeekHeader::weekChanged( int w )
122{
123 setDate( year, w );
124} 86}
125 87
126void DateBookWeekHeader::setDate( int y, int m, int d ) 88void DateBookWeekHeader::setDate( int y, int m, int d )
127{ 89{
128 calcWeek( QDate(y,m,d), week, year, bStartOnMonday ); 90 setDate(QDate(y,m,d));
129 setDate( year, week );
130} 91}
131 92
132void DateBookWeekHeader::setDate( int y, int w ) 93void DateBookWeekHeader::setDate(const QDate &d) {
133{ 94 int year,week,dayofweek;
134 year = y; 95 date=d;
135 week = w; 96 dayofweek=d.dayOfWeek();
136 spinYear->setValue( y ); 97 if(bStartOnMonday) dayofweek--;
137 spinWeek->setValue( w ); 98 date=date.addDays(-dayofweek);
138
139 QDate d = dateFromWeek( week, year, bStartOnMonday );
140
141 QString s = QString::number( d.day() ) + ". " + d.monthName( d.month() )
142 + "-";
143 d = d.addDays( 6 );
144 s += QString::number( d.day() ) + ". " + d.monthName( d.month() );
145 s += " ("+tr("week")+":"+QString::number( w )+")";
146 labelDate->setText( s );
147 99
148 emit dateChanged( y, w ); 100 calcWeek(date,week,year,bStartOnMonday);
101 QDate start=date;
102 QDate stop=start.addDays(6);
103 labelDate->setText( QString::number(start.day()) + "." +
104 start.monthName(start.month()) + "-" +
105 QString::number(stop.day()) + "." +
106 start.monthName(stop.month()) +" ("+
107 tr("w")+":"+QString::number( week ) +")");
108 emit dateChanged(year,week);
149} 109}
150 110
151void DateBookWeekHeader::setStartOfWeek( bool onMonday ) 111void DateBookWeekHeader::setStartOfWeek( bool onMonday )
152{ 112{
153 bStartOnMonday = onMonday; 113 bStartOnMonday = onMonday;
154 setDate( year, week ); 114 setDate( date );
155} 115}
156 116
157// dateFromWeek 117// dateFromWeek
158// compute the date from the week in the year 118// compute the date from the week in the year
159
160QDate dateFromWeek( int week, int year, bool startOnMonday ) 119QDate dateFromWeek( int week, int year, bool startOnMonday )
161{ 120{
162 QDate d; 121 QDate d;
163 d.setYMD( year, 1, 1 ); 122 d.setYMD( year, 1, 1 );
164 int dayOfWeek = d.dayOfWeek(); 123 int dayOfWeek = d.dayOfWeek();
165 if ( startOnMonday ) { 124 if ( startOnMonday ) {
166 if ( dayOfWeek <= 4 ) { 125 if ( dayOfWeek <= 4 ) {
167 d = d.addDays( ( week - 1 ) * 7 - dayOfWeek + 1 ); 126 d = d.addDays( ( week - 1 ) * 7 - dayOfWeek + 1 );
168 } else { 127 } else {
169 d = d.addDays( (week) * 7 - dayOfWeek + 1 ); 128 d = d.addDays( (week) * 7 - dayOfWeek + 1 );
170 } 129 }
171 } else {
172 if ( dayOfWeek <= 4 || dayOfWeek == 7) {
173 d = d.addDays( ( week - 1 ) * 7 - dayOfWeek % 7 );
174 } else { 130 } else {
175 d = d.addDays( ( week ) * 7 - dayOfWeek % 7 ); 131 if ( dayOfWeek <= 4 || dayOfWeek == 7) {
132 d = d.addDays( ( week - 1 ) * 7 - dayOfWeek % 7 );
133 } else {
134 d = d.addDays( ( week ) * 7 - dayOfWeek % 7 );
135 }
176 } 136 }
177 } 137 return d;
178 return d;
179} 138}
180 139
diff --git a/core/pim/datebook/datebookweekheaderimpl.h b/core/pim/datebook/datebookweekheaderimpl.h
index 2e5a6ca..1ab1d52 100644
--- a/core/pim/datebook/datebookweekheaderimpl.h
+++ b/core/pim/datebook/datebookweekheaderimpl.h
@@ -29,38 +29,31 @@ class DateBookWeekHeader : public DateBookWeekHeaderBase
29 29
30public: 30public:
31 DateBookWeekHeader( bool startOnMonday, QWidget* parent = 0, 31 DateBookWeekHeader( bool startOnMonday, QWidget* parent = 0,
32 const char* name = 0, WFlags fl = 0 ); 32 const char* name = 0, WFlags fl = 0 );
33 ~DateBookWeekHeader(); 33 ~DateBookWeekHeader();
34 34
35 void setDate( int y, int w ); 35 void setDate(const QDate &d);
36 void setStartOfWeek( bool onMonday ); 36 void setStartOfWeek( bool onMonday );
37 37
38signals: 38signals:
39 void dateChanged( int y, int w ); 39 void dateChanged( int y, int w );
40 40
41public slots: 41public slots:
42 void pickDate(); 42 void pickDate();
43 void yearChanged( int );
44 void nextMonth(); 43 void nextMonth();
45 void prevMonth(); 44 void prevMonth();
46 void nextWeek(); 45 void nextWeek();
47 void prevWeek(); 46 void prevWeek();
48 void weekChanged( int );
49 void setDate( int y, int m, int d); 47 void setDate( int y, int m, int d);
50 48
51protected slots: 49protected slots:
52 void keyPressEvent(QKeyEvent *e) 50 void keyPressEvent(QKeyEvent *e) { e->ignore(); }
53 {
54 e->ignore();
55 }
56 51
57private: 52private:
58 int year, 53 QDate date;
59 week; 54 bool bStartOnMonday;
60 bool bStartOnMonday;
61
62}; 55};
63 56
64QDate dateFromWeek( int week, int year, bool startOnMonday ); 57QDate dateFromWeek( int week, int year, bool startOnMonday );
65 58
66#endif // DATEBOOKDAYHEADER_H 59#endif // DATEBOOKDAYHEADER_H
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 3c8fc89..a39ff40 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -24,121 +24,133 @@
24#include <qtoolbutton.h> 24#include <qtoolbutton.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qsizepolicy.h> 26#include <qsizepolicy.h>
27#include <qabstractlayout.h> 27#include <qabstractlayout.h>
28#include <qtl.h> 28#include <qtl.h>
29 29
30bool calcWeek(const QDate &d, int &week, int &year, 30bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false);
31 bool startOnMonday = false);
32 31
33DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, 32DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl)
34 const char* name, WFlags fl)
35 : DateBookWeekLstHeaderBase(parent, name, fl) 33 : DateBookWeekLstHeaderBase(parent, name, fl)
36{ 34{
37 setBackgroundMode( PaletteButton ); 35 setBackgroundMode( PaletteButton );
38 labelDate->setBackgroundMode( PaletteButton ); 36 labelDate->setBackgroundMode( PaletteButton );
39 labelWeek->setBackgroundMode( PaletteButton ); 37 forwardweek->setBackgroundMode( PaletteButton );
40 forward->setBackgroundMode( PaletteButton ); 38 forwardweek->setPixmap( Resource::loadPixmap("forward") );
41 forward->setPixmap( Resource::loadPixmap("forward") ); 39 forwardmonth->setBackgroundMode( PaletteButton );
42 back->setBackgroundMode( PaletteButton ); 40 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
43 back->setPixmap( Resource::loadPixmap("back") ); 41 backweek->setBackgroundMode( PaletteButton );
44 DateBookWeekLstHeaderBaseLayout->setSpacing(0); 42 backweek->setPixmap( Resource::loadPixmap("back") );
45 DateBookWeekLstHeaderBaseLayout->setMargin(0); 43 backmonth->setBackgroundMode( PaletteButton );
46 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); 44 backmonth->setPixmap( Resource::loadPixmap("fastback") );
47 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 45 DateBookWeekLstHeaderBaseLayout->setSpacing(0);
48 46 DateBookWeekLstHeaderBaseLayout->setMargin(0);
49 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); 47 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
50 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); 48 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
51 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); 49
52 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); 50 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth()));
53 onMonday=onM; 51 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek()));
52 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek()));
53 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth()));
54 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate()));
55 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
56 bStartOnMonday=onM;
54} 57}
55DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 58DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
59
56void DateBookWeekLstHeader::setDate(const QDate &d) { 60void DateBookWeekLstHeader::setDate(const QDate &d) {
57 date=d; 61 int year,week,dayofweek;
58 62 date=d;
59 int year,week; 63 dayofweek=d.dayOfWeek();
60 calcWeek(d,week,year,onMonday); 64 if(bStartOnMonday) dayofweek--;
61 labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) ); 65 date=date.addDays(-dayofweek);
62 66
63 QDate start=date; 67 calcWeek(date,week,year,bStartOnMonday);
64 QDate stop=start.addDays(6); 68 QDate start=date;
65 labelDate->setText( QString::number(start.day()) + " " + 69 QDate stop=start.addDays(6);
66 start.monthName(start.month()) + " - " + 70 labelDate->setText( QString::number(start.day()) + "." +
67 QString::number(stop.day()) + " " + 71 start.monthName(start.month()) + "-" +
68 start.monthName(stop.month()) ); 72 QString::number(stop.day()) + "." +
69 emit dateChanged(year,week); 73 start.monthName(stop.month()) +" ("+
74 tr("w")+":"+QString::number( week ) +")");
75 emit dateChanged(year,week);
70} 76}
77
71void DateBookWeekLstHeader::pickDate() { 78void DateBookWeekLstHeader::pickDate() {
72 static QPopupMenu *m1 = 0; 79 static QPopupMenu *m1 = 0;
73 static DateBookMonth *picker = 0; 80 static DateBookMonth *picker = 0;
74 if ( !m1 ) { 81 if ( !m1 ) {
75 m1 = new QPopupMenu( this ); 82 m1 = new QPopupMenu( this );
76 picker = new DateBookMonth( m1, 0, TRUE ); 83 picker = new DateBookMonth( m1, 0, TRUE );
77 m1->insertItem( picker ); 84 m1->insertItem( picker );
78 connect( picker, SIGNAL( dateClicked( int, int, int ) ), 85 connect( picker, SIGNAL( dateClicked( int, int, int ) ),this, SLOT( setDate( int, int, int ) ) );
79 this, SLOT( setDate( int, int, int ) ) ); 86 //connect( m1, SIGNAL( aboutToHide() ),
80 //connect( m1, SIGNAL( aboutToHide() ), 87 //this, SLOT( gotHide() ) );
81 //this, SLOT( gotHide() ) ); 88 }
82 } 89 picker->setDate( date.year(), date.month(), date.day() );
83 picker->setDate( date.year(), date.month(), date.day() ); 90 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
84 m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); 91 picker->setFocus();
85 picker->setFocus();
86} 92}
87void DateBookWeekLstHeader::setDate(int y, int m, int d) { 93void DateBookWeekLstHeader::setDate(int y, int m, int d) {
88 QDate new_date(y,m,d); 94 setDate(QDate(y,m,d));
89 setDate(new_date);
90} 95}
91 96
92void DateBookWeekLstHeader::nextWeek() { 97void DateBookWeekLstHeader::nextWeek() {
93 setDate(date.addDays(7)); 98 setDate(date.addDays(7));
94} 99}
95void DateBookWeekLstHeader::prevWeek() { 100void DateBookWeekLstHeader::prevWeek() {
96 setDate(date.addDays(-7)); 101 setDate(date.addDays(-7));
102}
103void DateBookWeekLstHeader::nextMonth()
104{
105 setDate(date.addDays(28));
106}
107void DateBookWeekLstHeader::prevMonth()
108{
109 setDate(date.addDays(-28));
97} 110}
98 111
99DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, 112DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
100 QWidget* parent, 113 QWidget* parent,
101 const char* name, 114 const char* name,
102 WFlags fl ) 115 WFlags fl )
103 : DateBookWeekLstDayHdrBase(parent, name, fl) { 116 : DateBookWeekLstDayHdrBase(parent, name, fl) {
104 117
105 date=d; 118 date=d;
106 119
107 static const char *wdays={"MTWTFSS"}; 120 static const char *wdays={"MTWTFSS"};
108 char day=wdays[d.dayOfWeek()-1]; 121 char day=wdays[d.dayOfWeek()-1];
109 122
110 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " + 123 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
111 QString::number(d.day()) ); 124 add->setText("+");
112 add->setText("+"); 125
113 126 if (d == QDate::currentDate()) {
114 if (d == QDate::currentDate()) { 127 QPalette pal=label->palette();
115 QPalette pal=label->palette(); 128 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
116 pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); 129 label->setPalette(pal);
117 label->setPalette(pal); 130
118 131 /*
119 /* 132 QFont f=label->font();
120 QFont f=label->font(); 133 f.setItalic(true);
121 f.setItalic(true); 134 label->setFont(f);
122 label->setFont(f); 135 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor()));
123 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); 136 */
124 */ 137 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday
125 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday 138 QPalette pal=label->palette();
126 QPalette pal=label->palette(); 139 pal.setColor(QColorGroup::Foreground, QColor(255,0,0));
127 pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); 140 label->setPalette(pal);
128 label->setPalette(pal); 141 }
129 }
130
131 142
132 connect (label, SIGNAL(clicked()), this, SLOT(showDay())); 143 connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
133 connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); 144 connect (add, SIGNAL(clicked()), this, SLOT(newEvent()));
134} 145}
135 146
136void DateBookWeekLstDayHdr::showDay() { 147void DateBookWeekLstDayHdr::showDay() {
137 emit showDate(date.year(), date.month(), date.day()); 148 emit showDate(date.year(), date.month(), date.day());
138} 149}
150
139void DateBookWeekLstDayHdr::newEvent() { 151void DateBookWeekLstDayHdr::newEvent() {
140 QDateTime start, stop; 152 QDateTime start, stop;
141 start=stop=date; 153 start=stop=date;
142 start.setTime(QTime(10,0)); 154 start.setTime(QTime(10,0));
143 stop.setTime(QTime(12,0)); 155 stop.setTime(QTime(12,0));
144 156
@@ -201,35 +213,34 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
201{ 213{
202 Config config("DateBook"); 214 Config config("DateBook");
203 config.setGroup("Main"); 215 config.setGroup("Main");
204 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); 216 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
205 qDebug("Read weeklistviewconfig: %d",weeklistviewconfig); 217 qDebug("Read weeklistviewconfig: %d",weeklistviewconfig);
206 218
207 onMonday=onM; 219 bStartOnMonday=onM;
208 setPalette(white); 220 setPalette(white);
209 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 221 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
210 222
211 QVBoxLayout *layout = new QVBoxLayout( this ); 223 QVBoxLayout *layout = new QVBoxLayout( this );
212 224
213 qBubbleSort(ev); 225 qBubbleSort(ev);
214 QValueListIterator<EffectiveEvent> it; 226 QValueListIterator<EffectiveEvent> it;
215 it=ev.begin(); 227 it=ev.begin();
216 228
217 int dayOrder[7]; 229 int dayOrder[7];
218 if (onMonday) { 230 if (bStartOnMonday) {
219 for (int d=0; d<7; d++) dayOrder[d]=d+1; 231 for (int d=0; d<7; d++) dayOrder[d]=d+1;
220 } else { 232 } else {
221 for (int d=0; d<7; d++) dayOrder[d]=d; 233 for (int d=0; d<7; d++) dayOrder[d]=d;
222 dayOrder[0]=7; 234 dayOrder[0]=7;
223 } 235 }
224 236
225 for (int i=0; i<7; i++) { 237 for (int i=0; i<7; i++) {
226 // Header 238 // Header
227 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), onMonday,this); 239 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), bStartOnMonday,this);
228 connect(hdr, SIGNAL(showDate(int,int,int)), 240 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
229 this, SIGNAL(showDate(int,int,int)));
230 connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 241 connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
231 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 242 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
232 layout->addWidget(hdr); 243 layout->addWidget(hdr);
233 244
234 // Events 245 // Events
235 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 246 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
@@ -276,26 +287,24 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
276 QWidget *parent, 287 QWidget *parent,
277 const char *name ) 288 const char *name )
278 : QWidget( parent, name ), 289 : QWidget( parent, name ),
279 db( newDB ), 290 db( newDB ),
280 startTime( 0 ), 291 startTime( 0 ),
281 ampm( ap ), 292 ampm( ap ),
282 onMonday(onM) 293 bStartOnMonday(onM)
283{ 294{
284 setFocusPolicy(StrongFocus); 295 setFocusPolicy(StrongFocus);
285 layout = new QVBoxLayout( this ); 296 layout = new QVBoxLayout( this );
286 layout->setMargin(0); 297 layout->setMargin(0);
287 298
288 header=new DateBookWeekLstHeader(onM, this); 299 header=new DateBookWeekLstHeader(onM, this);
289 layout->addWidget( header ); 300 layout->addWidget( header );
290 connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); 301 connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int)));
291 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); 302 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool)));
292 303
293 scroll=new QScrollView(this); 304 scroll=new QScrollView(this);
294 //scroll->setVScrollBarMode(QScrollView::AlwaysOn);
295 //scroll->setHScrollBarMode(QScrollView::AlwaysOff);
296 scroll->setResizePolicy(QScrollView::AutoOneFit); 305 scroll->setResizePolicy(QScrollView::AutoOneFit);
297 layout->addWidget(scroll); 306 layout->addWidget(scroll);
298 307
299 view=NULL; 308 view=NULL;
300 Config config("DateBook"); 309 Config config("DateBook");
301 config.setGroup("Main"); 310 config.setGroup("Main");
@@ -307,13 +316,13 @@ DateBookWeekLst::~DateBookWeekLst(){
307 config.setGroup("Main"); 316 config.setGroup("Main");
308 config.writeEntry("weeklst_dbl", dbl); 317 config.writeEntry("weeklst_dbl", dbl);
309} 318}
310 319
311void DateBookWeekLst::setDate(const QDate &d) { 320void DateBookWeekLst::setDate(const QDate &d) {
312 int w,y; 321 int w,y;
313 calcWeek(d,w,y,onMonday); 322 calcWeek(d,w,y,bStartOnMonday);
314 year=y; 323 year=y;
315 _week=w; 324 _week=w;
316 header->setDate(date()); 325 header->setDate(date());
317} 326}
318void DateBookWeekLst::setDbl(bool on) { 327void DateBookWeekLst::setDbl(bool on) {
319 dbl=on; 328 dbl=on;
@@ -323,13 +332,13 @@ void DateBookWeekLst::redraw() {getEvents();}
323 332
324QDate DateBookWeekLst::date() const { 333QDate DateBookWeekLst::date() const {
325 QDate d; 334 QDate d;
326 d.setYMD(year,1,1); 335 d.setYMD(year,1,1);
327 336
328 int dow= d.dayOfWeek(); 337 int dow= d.dayOfWeek();
329 if (!onMonday) 338 if (!bStartOnMonday)
330 if (dow==7) { 339 if (dow==7) {
331 dow=1; 340 dow=1;
332 } else { 341 } else {
333 dow++; 342 dow++;
334 } 343 }
335 344
@@ -344,15 +353,15 @@ void DateBookWeekLst::getEvents() {
344 353
345 if (view) delete view; 354 if (view) delete view;
346 if (dbl) { 355 if (dbl) {
347 QDate start2=start.addDays(7); 356 QDate start2=start.addDays(7);
348 stop=start2.addDays(6); 357 stop=start2.addDays(6);
349 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 358 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
350 view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll); 359 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
351 } else { 360 } else {
352 view=new DateBookWeekLstView(el,start,onMonday,scroll); 361 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll);
353 } 362 }
354 363
355 connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 364 connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
356 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 365 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
357 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 366 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
358 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 367 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
@@ -383,8 +392,7 @@ void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
383 case Key_Right: 392 case Key_Right:
384 header->nextWeek(); 393 header->nextWeek();
385 break; 394 break;
386 default: 395 default:
387 e->ignore(); 396 e->ignore();
388 } 397 }
389} 398} \ No newline at end of file
390
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index 17dc01f..f858c4f 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -22,22 +22,25 @@ public:
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 nextMonth();
31 void setDate(int y, int m, int d); 31 void prevMonth();
32 void pickDate();
33 void setDate(int y, int m, int d);
32signals: 34signals:
33 void dateChanged(int y, int w); 35 void dateChanged(int y, int w);
34 void setDbl(bool on); 36 void setDbl(bool on);
35private: 37private:
36 QDate date; 38 QDate date;
37 bool onMonday; 39 //bool onMonday;
40 bool bStartOnMonday;
38}; 41};
39 42
40class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase 43class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase
41{ 44{
42 Q_OBJECT 45 Q_OBJECT
43public: 46public:
@@ -76,20 +79,20 @@ class DateBookWeekLstView: public QWidget
76public: 79public:
77 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, 80 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM,
78 QWidget* parent = 0, const char* name = 0, 81 QWidget* parent = 0, const char* name = 0,
79 WFlags fl = 0 ); 82 WFlags fl = 0 );
80 ~DateBookWeekLstView(); 83 ~DateBookWeekLstView();
81signals: 84signals:
82 void editEvent(const Event &e); 85 void editEvent(const Event &e);
83 void showDate(int y, int m, int d); 86 void showDate(int y, int m, int d);
84 void addEvent(const QDateTime &start, const QDateTime &stop, 87 void addEvent(const QDateTime &start, const QDateTime &stop,
85 const QString &str, const QString &location); 88 const QString &str, const QString &location);
86private: 89private:
87 bool onMonday; 90 bool bStartOnMonday;
88protected slots: 91protected slots:
89 void keyPressEvent(QKeyEvent *); 92 void keyPressEvent(QKeyEvent *);
90}; 93};
91 94
92class DateBookWeekLstDblView: public QWidget { 95class DateBookWeekLstDblView: public QWidget {
93 Q_OBJECT 96 Q_OBJECT
94public: 97public:
95 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 98 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
@@ -124,22 +127,22 @@ public slots:
124 127
125protected slots: 128protected slots:
126 void keyPressEvent(QKeyEvent *); 129 void keyPressEvent(QKeyEvent *);
127 void setDbl(bool on); 130 void setDbl(bool on);
128 131
129signals: 132signals:
130 void showDate(int y, int m, int d); 133 void showDate(int y, int m, int d);
131 void addEvent(const QDateTime &start, const QDateTime &stop, 134 void addEvent(const QDateTime &start, const QDateTime &stop,
132 const QString &str, const QString &location); 135 const QString &str, const QString &location);
133 void editEvent(const Event &e); 136 void editEvent(const Event &e);
134 137
135private: 138private:
136 DateBookDB *db; 139 DateBookDB *db;
137 int startTime; 140 int startTime;
138 bool ampm; 141 bool ampm;
139 bool onMonday; 142 bool bStartOnMonday;
140 bool dbl; 143 bool dbl;
141 int year, _week; 144 int year, _week;
142 DateBookWeekLstHeader *header; 145 DateBookWeekLstHeader *header;
143 QWidget *view; 146 QWidget *view;
144 QVBoxLayout *layout; 147 QVBoxLayout *layout;
145 QScrollView *scroll; 148 QScrollView *scroll;
diff --git a/core/pim/datebook/datebookweeklstheader.ui b/core/pim/datebook/datebookweeklstheader.ui
index c71e046..e925ec3 100644
--- a/core/pim/datebook/datebookweeklstheader.ui
+++ b/core/pim/datebook/datebookweeklstheader.ui
@@ -38,13 +38,48 @@
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>backmonth</cstring>
45 </property>
46 <property stdset="1">
47 <name>text</name>
48 <string></string>
49 </property>
50 <property stdset="1">
51 <name>pixmap</name>
52 <pixmap></pixmap>
53 </property>
54 <property stdset="1">
55 <name>toggleButton</name>
56 <bool>false</bool>
57 </property>
58 <property stdset="1">
59 <name>autoRepeat</name>
60 <bool>true</bool>
61 </property>
62 <property stdset="1">
63 <name>autoRaise</name>
64 <bool>true</bool>
65 </property>
66 <property stdset="1">
67 <name>toggleButton</name>
68 <bool>false</bool>
69 </property>
70 <property>
71 <name>toolTip</name>
72 <string></string>
73 </property>
74 </widget>
75 <widget>
76 <class>QToolButton</class>
77 <property stdset="1">
78 <name>name</name>
79 <cstring>backweek</cstring>
45 </property> 80 </property>
46 <property stdset="1"> 81 <property stdset="1">
47 <name>sizePolicy</name> 82 <name>sizePolicy</name>
48 <sizepolicy> 83 <sizepolicy>
49 <hsizetype>7</hsizetype> 84 <hsizetype>7</hsizetype>
50 <vsizetype>0</vsizetype> 85 <vsizetype>0</vsizetype>
@@ -76,13 +111,13 @@
76 </property> 111 </property>
77 <property> 112 <property>
78 <name>toolTip</name> 113 <name>toolTip</name>
79 <string></string> 114 <string></string>
80 </property> 115 </property>
81 </widget> 116 </widget>
82 <spacer> 117 <spacer>
83 <property> 118 <property>
84 <name>name</name> 119 <name>name</name>
85 <cstring>Spacer1_3</cstring> 120 <cstring>Spacer1_3</cstring>
86 </property> 121 </property>
87 <property stdset="1"> 122 <property stdset="1">
88 <name>orientation</name> 123 <name>orientation</name>
@@ -101,13 +136,13 @@
101 </property> 136 </property>
102 </spacer> 137 </spacer>
103 <widget> 138 <widget>
104 <class>QToolButton</class> 139 <class>QToolButton</class>
105 <property stdset="1"> 140 <property stdset="1">
106 <name>name</name> 141 <name>name</name>
107 <cstring>labelWeek</cstring> 142 <cstring>labelDate</cstring>
108 </property> 143 </property>
109 <property stdset="1"> 144 <property stdset="1">
110 <name>sizePolicy</name> 145 <name>sizePolicy</name>
111 <sizepolicy> 146 <sizepolicy>
112 <hsizetype>7</hsizetype> 147 <hsizetype>7</hsizetype>
113 <vsizetype>0</vsizetype> 148 <vsizetype>0</vsizetype>
@@ -137,33 +172,12 @@
137 </property> 172 </property>
138 <property> 173 <property>
139 <name>toolTip</name> 174 <name>toolTip</name>
140 <string></string> 175 <string></string>
141 </property> 176 </property>
142 </widget> 177 </widget>
143 <spacer>
144 <property>
145 <name>name</name>
146 <cstring>Spacer1</cstring>
147 </property>
148 <property stdset="1">
149 <name>orientation</name>
150 <enum>Horizontal</enum>
151 </property>
152 <property stdset="1">
153 <name>sizeType</name>
154 <enum>Expanding</enum>
155 </property>
156 <property>
157 <name>sizeHint</name>
158 <size>
159 <width>20</width>
160 <height>20</height>
161 </size>
162 </property>
163 </spacer>
164 <widget> 178 <widget>
165 <class>QToolButton</class> 179 <class>QToolButton</class>
166 <property stdset="1"> 180 <property stdset="1">
167 <name>name</name> 181 <name>name</name>
168 <cstring>dbl</cstring> 182 <cstring>dbl</cstring>
169 </property> 183 </property>
@@ -220,86 +234,73 @@
220 <width>20</width> 234 <width>20</width>
221 <height>20</height> 235 <height>20</height>
222 </size> 236 </size>
223 </property> 237 </property>
224 </spacer> 238 </spacer>
225 <widget> 239 <widget>
226 <class>QLabel</class> 240 <class>QToolButton</class>
227 <property stdset="1"> 241 <property stdset="1">
228 <name>name</name> 242 <name>name</name>
229 <cstring>labelDate</cstring> 243 <cstring>forwardweek</cstring>
230 </property> 244 </property>
231 <property stdset="1"> 245 <property stdset="1">
232 <name>sizePolicy</name> 246 <name>sizePolicy</name>
233 <sizepolicy> 247 <sizepolicy>
234 <hsizetype>3</hsizetype> 248 <hsizetype>1</hsizetype>
235 <vsizetype>7</vsizetype> 249 <vsizetype>0</vsizetype>
236 </sizepolicy> 250 </sizepolicy>
237 </property> 251 </property>
238 <property stdset="1"> 252 <property stdset="1">
239 <name>font</name>
240 <font>
241 <bold>1</bold>
242 </font>
243 </property>
244 <property stdset="1">
245 <name>text</name> 253 <name>text</name>
246 <string>00 Jan-00 Jan</string> 254 <string></string>
247 </property>
248 <property>
249 <name>hAlign</name>
250 </property>
251 </widget>
252 <spacer>
253 <property>
254 <name>name</name>
255 <cstring>Spacer1_2</cstring>
256 </property> 255 </property>
257 <property stdset="1"> 256 <property stdset="1">
258 <name>orientation</name> 257 <name>pixmap</name>
259 <enum>Horizontal</enum> 258 <pixmap></pixmap>
260 </property> 259 </property>
261 <property stdset="1"> 260 <property stdset="1">
262 <name>sizeType</name> 261 <name>autoRepeat</name>
263 <enum>Expanding</enum> 262 <bool>true</bool>
264 </property> 263 </property>
265 <property> 264 <property stdset="1">
266 <name>sizeHint</name> 265 <name>autoRaise</name>
267 <size> 266 <bool>true</bool>
268 <width>20</width>
269 <height>20</height>
270 </size>
271 </property> 267 </property>
272 </spacer> 268 </widget>
273 <widget> 269 <widget>
274 <class>QToolButton</class> 270 <class>QToolButton</class>
275 <property stdset="1"> 271 <property stdset="1">
276 <name>name</name> 272 <name>name</name>
277 <cstring>forward</cstring> 273 <cstring>forwardmonth</cstring>
278 </property>
279 <property stdset="1">
280 <name>sizePolicy</name>
281 <sizepolicy>
282 <hsizetype>1</hsizetype>
283 <vsizetype>0</vsizetype>
284 </sizepolicy>
285 </property> 274 </property>
286 <property stdset="1"> 275 <property stdset="1">
287 <name>text</name> 276 <name>text</name>
288 <string></string> 277 <string></string>
289 </property> 278 </property>
290 <property stdset="1"> 279 <property stdset="1">
291 <name>pixmap</name> 280 <name>pixmap</name>
292 <pixmap></pixmap> 281 <pixmap></pixmap>
293 </property> 282 </property>
294 <property stdset="1"> 283 <property stdset="1">
284 <name>toggleButton</name>
285 <bool>false</bool>
286 </property>
287 <property stdset="1">
295 <name>autoRepeat</name> 288 <name>autoRepeat</name>
296 <bool>true</bool> 289 <bool>true</bool>
297 </property> 290 </property>
298 <property stdset="1"> 291 <property stdset="1">
299 <name>autoRaise</name> 292 <name>autoRaise</name>
300 <bool>true</bool> 293 <bool>true</bool>
301 </property> 294 </property>
295 <property stdset="1">
296 <name>toggleButton</name>
297 <bool>false</bool>
298 </property>
299 <property>
300 <name>toolTip</name>
301 <string></string>
302 </property>
302 </widget> 303 </widget>
303 </hbox> 304 </hbox>
304</widget> 305</widget>
305</UI> 306</UI>