summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2003-05-05 21:44:39 (UTC)
committer umopapisdn <umopapisdn>2003-05-05 21:44:39 (UTC)
commit3b193b852133a82b5c1708b68a7e460c63629768 (patch) (unidiff)
tree8cd0ff3adc14f0b937d24ab99fca327fb3f16875
parent12a700f8903eedeba03d3aba7990b9d660410045 (diff)
downloadopie-3b193b852133a82b5c1708b68a7e460c63629768.zip
opie-3b193b852133a82b5c1708b68a7e460c63629768.tar.gz
opie-3b193b852133a82b5c1708b68a7e460c63629768.tar.bz2
UI and code cleanup. Both UI and code is now more consistent. Also removed menus in favor of toolbuttons. (why were they even available as menus in the first place?)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp106
-rw-r--r--core/pim/datebook/datebookweek.cpp47
-rw-r--r--core/pim/datebook/datebookweek.h2
-rw-r--r--core/pim/datebook/datebookweekheader.ui60
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp93
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.h13
-rw-r--r--core/pim/datebook/datebookweeklst.cpp90
-rw-r--r--core/pim/datebook/datebookweeklst.h9
-rw-r--r--core/pim/datebook/datebookweeklstheader.ui125
9 files changed, 198 insertions, 347 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
@@ -100,37 +100,38 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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 );
112 QPopupMenu *settings = new QPopupMenu( this );
113 111
114 mb->insertItem( tr( "View" ), view ); 112 QPEToolBar *sub_bar = new QPEToolBar(this);
115 mb->insertItem( tr( "Settings" ), settings ); 113 sub_bar->setHorizontalStretchable(TRUE);
116 114
117 QActionGroup *g = new QActionGroup( this ); 115 QActionGroup *g = new QActionGroup( this );
118 g->setExclusive( TRUE ); 116 g->setExclusive( TRUE );
119 117
120 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), 118 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
121 QString::null, 0, this, 0 );
122 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 119 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
123 a->addTo( sub_bar ); 120 a->addTo( sub_bar );
124 121
122 sub_bar->addSeparator();
123
125 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); 124 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 );
126 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 125 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
127 a->addTo( sub_bar ); 126 a->addTo( sub_bar );
128 a->addTo( view ); 127 //a->addTo( view );
128
129 sub_bar->addSeparator();
129 130
130 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); 131 a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 );
131 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 132 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
132 a->addTo( sub_bar ); 133 a->addTo( sub_bar );
133 a->addTo( view ); 134// a->addTo( view );
134 a->setToggleAction( TRUE ); 135 a->setToggleAction( TRUE );
135 a->setOn( TRUE ); 136 a->setOn( TRUE );
136 dayAction = a; 137 dayAction = a;
@@ -138,31 +139,33 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
138 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); 139 a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 );
139 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); 140 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
140 a->addTo( sub_bar ); 141 a->addTo( sub_bar );
141 a->addTo( view ); 142// a->addTo( view );
142 a->setToggleAction( TRUE ); 143 a->setToggleAction( TRUE );
143 weekAction = a; 144 weekAction = a;
144 145
145 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); 146 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 );
146 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); 147 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
147 a->addTo( sub_bar ); 148 a->addTo( sub_bar );
148 a->addTo( view ); 149// a->addTo( view );
149 a->setToggleAction( TRUE ); 150 a->setToggleAction( TRUE );
150 weekLstAction = a; 151 weekLstAction = a;
151 152
152 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); 153 a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 );
153 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); 154 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
154 a->addTo( sub_bar ); 155 a->addTo( sub_bar );
155 a->addTo( view ); 156// a->addTo( view );
156 a->setToggleAction( TRUE ); 157 a->setToggleAction( TRUE );
157 monthAction = a; 158 monthAction = a;
158 159
159 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); 160 sub_bar->addSeparator();
161
162 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 );
160 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 163 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
161 a->addTo( sub_bar ); 164 a->addTo( sub_bar );
162 165
163 a = new QAction( tr( "Edit..." ), QString::null, 0, 0 ); 166 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 );
164 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 167 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
165 a->addTo( settings ); 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();
@@ -373,13 +376,6 @@ void DateBook::view(int v, const QDate &d) {
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
@@ -526,20 +522,13 @@ void DateBook::initDay()
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 & ) ) );
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 } 532 }
544} 533}
545 534
@@ -549,10 +538,8 @@ void DateBook::initWeek()
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
@@ -568,29 +555,19 @@ void DateBook::initWeek()
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" );
579 views->addWidget( weekLstView, WEEKLST ); 563 views->addWidget( weekLstView, WEEKLST );
580 564
581 //weekLstView->setStartViewTime( startTime ); 565 //weekLstView->setStartViewTime( startTime );
582 connect( weekLstView, SIGNAL( showDate( int, int, int ) ), 566 connect( weekLstView, SIGNAL( showDate( int, int, int ) ), this, SLOT( showDay( int, int, int ) ) );
583 this, SLOT( showDay( int, int, int ) ) ); 567 connect( weekLstView, SIGNAL( addEvent( const QDateTime &, const QDateTime &, const QString & , const QString &) ),
584 connect( weekLstView, SIGNAL( addEvent( const QDateTime &, 568 this, SLOT( slotNewEntry( const QDateTime &, const QDateTime &, const QString & , const QString &) ) );
585 const QDateTime &, 569 connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) );
586 const QString & , const QString &) ), 570 connect( weekLstView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) );
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 } 571 }
595} 572}
596 573
@@ -600,10 +577,8 @@ void DateBook::initMonth()
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() ),
606 monthView, SLOT( redraw() ) );
607 qApp->processEvents(); 582 qApp->processEvents();
608 } 583 }
609} 584}
@@ -629,6 +604,7 @@ void DateBook::loadSettings()
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();
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
@@ -367,24 +367,14 @@ DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
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 ) ) );
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()); 377 setDate(QDate::currentDate());
387
388} 378}
389 379
390void DateBookWeek::keyPressEvent(QKeyEvent *e) 380void DateBookWeek::keyPressEvent(QKeyEvent *e)
@@ -418,8 +408,6 @@ void DateBookWeek::showDay( int day )
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;
422 date.setYMD( y, m, d );
423 setDate(QDate(y, m, d)); 411 setDate(QDate(y, m, d));
424} 412}
425 413
@@ -428,7 +416,7 @@ void DateBookWeek::setDate(QDate date)
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 )
@@ -458,8 +446,7 @@ void DateBookWeek::getEvents()
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);
463 view->showEvents( eventList ); 450 view->showEvents( eventList );
464 view->moveToHour( startTime ); 451 view->moveToHour( startTime );
465} 452}
@@ -468,8 +455,7 @@ void 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 ) {
473 str += "<b>" + QObject::tr("Start") + "</b>: "; 459 str += "<b>" + QObject::tr("Start") + "</b>: ";
474 str += TimeString::timeString( ev.event().start().time(), ampm, FALSE ); 460 str += TimeString::timeString( ev.event().start().time(), ampm, FALSE );
475 if( ev.startDate()!=ev.endDate() ) { 461 if( ev.startDate()!=ev.endDate() ) {
@@ -574,19 +560,6 @@ void DateBookWeek::slotYearChanged( int y )
574 d = d.addDays( -1 ); 560 d = d.addDays( -1 );
575 calcWeek( d, totWeek, throwAway, bStartOnMonday ); 561 calcWeek( d, totWeek, throwAway, bStartOnMonday );
576 } 562 }
577 if ( totWeek != totalWeeks() )
578 setTotalWeeks( totWeek );
579}
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 )
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
@@ -109,8 +109,6 @@ public:
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:
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
@@ -119,66 +119,6 @@
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>
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
@@ -32,20 +32,16 @@
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
43 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 41 backmonth->setPixmap( Resource::loadPixmap("fastback") );
44 backweek->setPixmap( Resource::loadPixmap("back") ); 42 backweek->setPixmap( Resource::loadPixmap("back") );
45 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 43 forwardweek->setPixmap( Resource::loadPixmap("forward") );
46 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 44 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
47 spinYear->hide();
48 spinWeek->hide();
49} 45}
50 46
51/* 47/*
@@ -60,103 +56,66 @@ void 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 99
141 QString s = QString::number( d.day() ) + ". " + d.monthName( d.month() ) 100 calcWeek(date,week,year,bStartOnMonday);
142 + "-"; 101 QDate start=date;
143 d = d.addDays( 6 ); 102 QDate stop=start.addDays(6);
144 s += QString::number( d.day() ) + ". " + d.monthName( d.month() ); 103 labelDate->setText( QString::number(start.day()) + "." +
145 s += " ("+tr("week")+":"+QString::number( w )+")"; 104 start.monthName(start.month()) + "-" +
146 labelDate->setText( s ); 105 QString::number(stop.day()) + "." +
147 106 start.monthName(stop.month()) +" ("+
148 emit dateChanged( y, w ); 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;
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
@@ -32,7 +32,7 @@ public:
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:
@@ -40,25 +40,18 @@ signals:
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;
60 bool bStartOnMonday; 54 bool bStartOnMonday;
61
62}; 55};
63 56
64QDate dateFromWeek( int week, int year, bool startOnMonday ); 57QDate dateFromWeek( int week, int year, bool startOnMonday );
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
@@ -27,47 +27,54 @@
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 );
42 backweek->setPixmap( Resource::loadPixmap("back") );
43 backmonth->setBackgroundMode( PaletteButton );
44 backmonth->setPixmap( Resource::loadPixmap("fastback") );
44 DateBookWeekLstHeaderBaseLayout->setSpacing(0); 45 DateBookWeekLstHeaderBaseLayout->setSpacing(0);
45 DateBookWeekLstHeaderBaseLayout->setMargin(0); 46 DateBookWeekLstHeaderBaseLayout->setMargin(0);
46 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); 47 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
47 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 48 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
48 49
49 connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); 50 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth()));
50 connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); 51 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek()));
51 connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); 52 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek()));
53 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth()));
54 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate()));
52 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); 55 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
53 onMonday=onM; 56 bStartOnMonday=onM;
54} 57}
55DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 58DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
59
56void DateBookWeekLstHeader::setDate(const QDate &d) { 60void DateBookWeekLstHeader::setDate(const QDate &d) {
61 int year,week,dayofweek;
57 date=d; 62 date=d;
63 dayofweek=d.dayOfWeek();
64 if(bStartOnMonday) dayofweek--;
65 date=date.addDays(-dayofweek);
58 66
59 int year,week; 67 calcWeek(date,week,year,bStartOnMonday);
60 calcWeek(d,week,year,onMonday);
61 labelWeek->setText(tr( "W: %1" ).arg( ( QString::number(week)) ) );
62
63 QDate start=date; 68 QDate start=date;
64 QDate stop=start.addDays(6); 69 QDate stop=start.addDays(6);
65 labelDate->setText( QString::number(start.day()) + " " + 70 labelDate->setText( QString::number(start.day()) + "." +
66 start.monthName(start.month()) + " - " + 71 start.monthName(start.month()) + " - " +
67 QString::number(stop.day()) + " " + 72 QString::number(stop.day()) + "." +
68 start.monthName(stop.month()) ); 73 start.monthName(stop.month()) +" ("+
74 tr("w")+":"+QString::number( week ) +")");
69 emit dateChanged(year,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;
@@ -75,18 +82,16 @@ void DateBookWeekLstHeader::pickDate() {
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 ) ) );
80 //connect( m1, SIGNAL( aboutToHide() ), 86 //connect( m1, SIGNAL( aboutToHide() ),
81 //this, SLOT( gotHide() ) ); 87 //this, SLOT( gotHide() ) );
82 } 88 }
83 picker->setDate( date.year(), date.month(), date.day() ); 89 picker->setDate( date.year(), date.month(), date.day() );
84 m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); 90 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
85 picker->setFocus(); 91 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() {
@@ -95,6 +100,14 @@ void DateBookWeekLstHeader::nextWeek() {
95void DateBookWeekLstHeader::prevWeek() { 100void DateBookWeekLstHeader::prevWeek() {
96 setDate(date.addDays(-7)); 101 setDate(date.addDays(-7));
97} 102}
103void DateBookWeekLstHeader::nextMonth()
104{
105 setDate(date.addDays(28));
106}
107void DateBookWeekLstHeader::prevMonth()
108{
109 setDate(date.addDays(-28));
110}
98 111
99DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/, 112DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
100 QWidget* parent, 113 QWidget* parent,
@@ -107,8 +120,7 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
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()) );
112 add->setText("+"); 124 add->setText("+");
113 125
114 if (d == QDate::currentDate()) { 126 if (d == QDate::currentDate()) {
@@ -128,7 +140,6 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
128 label->setPalette(pal); 140 label->setPalette(pal);
129 } 141 }
130 142
131
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}
@@ -136,6 +147,7 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
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;
@@ -204,7 +216,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
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
@@ -215,7 +227,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
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;
@@ -224,9 +236,8 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
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);
@@ -279,7 +290,7 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
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 );
@@ -291,8 +302,6 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
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
@@ -310,7 +319,7 @@ DateBookWeekLst::~DateBookWeekLst(){
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());
@@ -326,7 +335,7 @@ QDate DateBookWeekLst::date() const {
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 {
@@ -347,9 +356,9 @@ void DateBookWeekLst::getEvents() {
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 &)));
@@ -387,4 +396,3 @@ void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
387 e->ignore(); 396 e->ignore();
388 } 397 }
389} 398}
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
@@ -27,6 +27,8 @@ public:
27public slots: 27public slots:
28 void nextWeek(); 28 void nextWeek();
29 void prevWeek(); 29 void prevWeek();
30 void nextMonth();
31 void prevMonth();
30 void pickDate(); 32 void pickDate();
31 void setDate(int y, int m, int d); 33 void setDate(int y, int m, int d);
32signals: 34signals:
@@ -34,7 +36,8 @@ signals:
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
@@ -84,7 +87,7 @@ signals:
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};
@@ -136,7 +139,7 @@ private:
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;
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
@@ -41,7 +41,42 @@
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>
@@ -104,7 +139,7 @@
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>
@@ -140,27 +175,6 @@
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">
@@ -223,65 +237,40 @@
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>
@@ -292,6 +281,10 @@
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>
@@ -299,6 +292,14 @@
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>