summaryrefslogtreecommitdiff
Unidiff
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
@@ -102,15 +102,13 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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
@@ -119,4 +117,3 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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() ) );
@@ -124,2 +121,4 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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 );
@@ -127,3 +126,5 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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
@@ -132,3 +133,3 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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 );
@@ -140,3 +141,3 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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 );
@@ -147,3 +148,3 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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 );
@@ -154,3 +155,3 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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 );
@@ -158,3 +159,5 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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()) );
@@ -162,5 +165,5 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
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
@@ -375,9 +378,2 @@ void DateBook::view(int v, const QDate &d) {
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);
@@ -528,16 +524,9 @@ void DateBook::initDay()
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 }
@@ -551,6 +540,4 @@ void DateBook::initWeek()
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 }
@@ -570,4 +557,2 @@ void DateBook::initWeek()
570 } 557 }
571 if ( totWeeks != weekView->totalWeeks() )
572 weekView->setTotalWeeks( totWeeks );
573} 558}
@@ -576,4 +561,3 @@ void 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 );
@@ -581,14 +565,7 @@ void DateBook::initWeekLst() {
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 }
@@ -602,6 +579,4 @@ void DateBook::initMonth()
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();
@@ -631,2 +606,3 @@ void DateBook::loadSettings()
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++) {
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
@@ -369,20 +369,10 @@ DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
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}
@@ -420,4 +410,2 @@ void 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));
@@ -430,3 +418,3 @@ void DateBookWeek::setDate(QDate date)
430 calcWeek( date, w, y, bStartOnMonday ); 418 calcWeek( date, w, y, bStartOnMonday );
431 header->setDate( y, w ); 419 header->setDate( date );
432} 420}
@@ -460,4 +448,3 @@ void DateBookWeek::getEvents()
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 );
@@ -470,4 +457,3 @@ void DateBookWeek::generateAllDayTooltext( QString& text ) {
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>: ";
@@ -576,15 +562,2 @@ void DateBookWeek::slotYearChanged( int y )
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}
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
@@ -111,4 +111,2 @@ public:
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;
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
@@ -121,62 +121,2 @@
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>
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
@@ -34,4 +34,3 @@
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 ),
@@ -41,3 +40,2 @@ DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent,
41 labelDate->setBackgroundMode( PaletteButton ); 40 labelDate->setBackgroundMode( PaletteButton );
42
43 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 41 backmonth->setPixmap( Resource::loadPixmap("fastback") );
@@ -46,4 +44,2 @@ DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent,
46 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 44 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
47 spinYear->hide();
48 spinWeek->hide();
49} 45}
@@ -62,3 +58,2 @@ void DateBookWeekHeader::pickDate()
62 static DateBookMonth *picker = 0; 58 static DateBookMonth *picker = 0;
63 QDate currDate = dateFromWeek( week, year, bStartOnMonday );
64 if ( !m1 ) { 59 if ( !m1 ) {
@@ -67,8 +62,6 @@ void DateBookWeekHeader::pickDate()
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())));
@@ -76,14 +69,6 @@ void DateBookWeekHeader::pickDate()
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}
@@ -91,34 +76,11 @@ void 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}
@@ -127,23 +89,21 @@ void 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}
@@ -153,3 +113,3 @@ void DateBookWeekHeader::setStartOfWeek( bool onMonday )
153 bStartOnMonday = onMonday; 113 bStartOnMonday = onMonday;
154 setDate( year, week ); 114 setDate( date );
155} 115}
@@ -158,3 +118,2 @@ void DateBookWeekHeader::setStartOfWeek( bool onMonday )
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 )
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
@@ -34,3 +34,3 @@ public:
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 );
@@ -42,3 +42,2 @@ public slots:
42 void pickDate(); 42 void pickDate();
43 void yearChanged( int );
44 void nextMonth(); 43 void nextMonth();
@@ -47,3 +46,2 @@ public slots:
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);
@@ -51,12 +49,7 @@ public slots:
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};
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
@@ -29,7 +29,5 @@
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)
@@ -38,7 +36,10 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
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);
@@ -48,24 +49,30 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
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() {
@@ -77,4 +84,3 @@ void DateBookWeekLstHeader::pickDate() {
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() ),
@@ -83,3 +89,3 @@ void DateBookWeekLstHeader::pickDate() {
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();
@@ -87,4 +93,3 @@ void DateBookWeekLstHeader::pickDate() {
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}
@@ -97,2 +102,10 @@ void DateBookWeekLstHeader::prevWeek() {
97} 102}
103void DateBookWeekLstHeader::nextMonth()
104{
105 setDate(date.addDays(28));
106}
107void DateBookWeekLstHeader::prevMonth()
108{
109 setDate(date.addDays(-28));
110}
98 111
@@ -109,4 +122,3 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
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("+");
@@ -130,3 +142,2 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /*onM*/,
130 142
131
132 connect (label, SIGNAL(clicked()), this, SLOT(showDay())); 143 connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
@@ -138,2 +149,3 @@ void DateBookWeekLstDayHdr::showDay() {
138} 149}
150
139void DateBookWeekLstDayHdr::newEvent() { 151void DateBookWeekLstDayHdr::newEvent() {
@@ -206,3 +218,3 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
206 218
207 onMonday=onM; 219 bStartOnMonday=onM;
208 setPalette(white); 220 setPalette(white);
@@ -217,3 +229,3 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
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;
@@ -226,5 +238,4 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
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 &)),
@@ -281,3 +292,3 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
281 ampm( ap ), 292 ampm( ap ),
282 onMonday(onM) 293 bStartOnMonday(onM)
283{ 294{
@@ -293,4 +304,2 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
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);
@@ -312,3 +321,3 @@ void 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;
@@ -328,3 +337,3 @@ QDate DateBookWeekLst::date() const {
328 int dow= d.dayOfWeek(); 337 int dow= d.dayOfWeek();
329 if (!onMonday) 338 if (!bStartOnMonday)
330 if (dow==7) { 339 if (dow==7) {
@@ -349,5 +358,5 @@ void DateBookWeekLst::getEvents() {
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 }
@@ -389,2 +398 @@ void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
389} }
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
@@ -29,2 +29,4 @@ public slots:
29 void prevWeek(); 29 void prevWeek();
30 void nextMonth();
31 void prevMonth();
30 void pickDate(); 32 void pickDate();
@@ -36,3 +38,4 @@ private:
36 QDate date; 38 QDate date;
37 bool onMonday; 39 //bool onMonday;
40 bool bStartOnMonday;
38}; 41};
@@ -86,3 +89,3 @@ signals:
86private: 89private:
87 bool onMonday; 90 bool bStartOnMonday;
88protected slots: 91protected slots:
@@ -138,3 +141,3 @@ private:
138 bool ampm; 141 bool ampm;
139 bool onMonday; 142 bool bStartOnMonday;
140 bool dbl; 143 bool dbl;
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
@@ -43,3 +43,38 @@
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>
@@ -106,3 +141,3 @@
106 <name>name</name> 141 <name>name</name>
107 <cstring>labelWeek</cstring> 142 <cstring>labelDate</cstring>
108 </property> 143 </property>
@@ -142,23 +177,2 @@
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>
@@ -225,6 +239,6 @@
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>
@@ -233,4 +247,4 @@
233 <sizepolicy> 247 <sizepolicy>
234 <hsizetype>3</hsizetype> 248 <hsizetype>1</hsizetype>
235 <vsizetype>7</vsizetype> 249 <vsizetype>0</vsizetype>
236 </sizepolicy> 250 </sizepolicy>
@@ -238,36 +252,18 @@
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>
@@ -276,10 +272,3 @@
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>
@@ -294,2 +283,6 @@
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>
@@ -301,2 +294,10 @@
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>