summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweekheaderimpl.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookweekheaderimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index eaa9730..c237b2d 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -11,97 +11,97 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "datebookweekheaderimpl.h" 20#include "datebookweekheaderimpl.h"
21#include "datebookweek.h" 21#include "datebookweek.h"
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/datebookmonth.h> 23#include <qpe/datebookmonth.h>
24 24
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26 26
27/* 27/*
28 * Constructs a DateBookWeekHeader which is a child of 'parent', with the 28 * Constructs a DateBookWeekHeader which is a child of 'parent', with the
29 * name 'name' and widget flags set to 'f' 29 * name 'name' and widget flags set to 'f'
30 */ 30 */
31DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl ) 31DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl )
32 : DateBookWeekHeaderBase( parent, name, fl ), 32 : DateBookWeekHeaderBase( parent, name, fl ),
33 bStartOnMonday( startOnMonday ) 33 bStartOnMonday( startOnMonday )
34{ 34{
35 setBackgroundMode( PaletteButton ); 35 setBackgroundMode( PaletteButton );
36 labelDate->setBackgroundMode( PaletteButton ); 36 labelDate->setBackgroundMode( PaletteButton );
37 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 37 backmonth->setPixmap( Resource::loadPixmap("fastback") );
38 backweek->setPixmap( Resource::loadPixmap("back") ); 38 backweek->setPixmap( Resource::loadPixmap("back") );
39 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 39 forwardweek->setPixmap( Resource::loadPixmap("forward") );
40 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 40 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
41} 41}
42 42
43/* 43/*
44 * Destroys the object and frees any allocated resources 44 * Destroys the object and frees any allocated resources
45 */ 45 */
46DateBookWeekHeader::~DateBookWeekHeader() 46DateBookWeekHeader::~DateBookWeekHeader()
47{ 47{
48 // no need to delete child widgets, Qt does it all for us 48 // no need to delete child widgets, Qt does it all for us
49} 49}
50 50
51void DateBookWeekHeader::pickDate() 51void DateBookWeekHeader::pickDate()
52{ 52{
53 static QPopupMenu *m1 = 0; 53 static QPopupMenu *m1 = 0;
54 static DateBookMonth *picker = 0; 54 static DateBookMonth *picker = 0;
55 if ( !m1 ) { 55 if ( !m1 ) {
56 m1 = new QPopupMenu( this ); 56 m1 = new QPopupMenu( this );
57 picker = new DateBookMonth( m1, 0, TRUE ); 57 picker = new DateBookMonth( m1, 0, TRUE );
58 m1->insertItem( picker ); 58 m1->insertItem( picker );
59 connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) ); 59 connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) );
60 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); 60 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) );
61 } 61 }
62 picker->setDate( date.year(), date.month(), date.day() ); 62 picker->setDate( date.year(), date.month(), date.day() );
63 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); 63 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
64 picker->setFocus(); 64 picker->setFocus();
65} 65}
66 66
67void DateBookWeekHeader::nextMonth() 67void DateBookWeekHeader::nextMonth()
68{ 68{
69 qWarning("nextMonth() " ); 69 qWarning("nextMonth() " );
70 setDate(date.addDays(28)); 70 setDate(date.addDays(28));
71} 71}
72void DateBookWeekHeader::prevMonth() 72void DateBookWeekHeader::prevMonth()
73{ 73{
74 qWarning("prevMonth() " ); 74 qWarning("prevMonth() " );
75 setDate(date.addDays(-28)); 75 setDate(date.addDays(-28));
76} 76}
77void DateBookWeekHeader::nextWeek() 77void DateBookWeekHeader::nextWeek()
78{ 78{
79 qWarning("nextWeek() " ); 79 qWarning("nextWeek() " );
80 setDate(date.addDays(7)); 80 setDate(date.addDays(7));
81} 81}
82void DateBookWeekHeader::prevWeek() 82void DateBookWeekHeader::prevWeek()
83{ 83{
84 qWarning("prevWeek() "); 84 qWarning("prevWeek() ");
85 setDate(date.addDays(-7)); 85 setDate(date.addDays(-7));
86} 86}
87 87
88void DateBookWeekHeader::setDate( int y, int m, int d ) 88void DateBookWeekHeader::setDate( int y, int m, int d )
89{ 89{
90 setDate(QDate(y,m,d)); 90 setDate(QDate(y,m,d));
91} 91}
92 92
93void DateBookWeekHeader::setDate(const QDate &d) { 93void DateBookWeekHeader::setDate(const QDate &d) {
94 int year,week,dayofweek; 94 int year,week,dayofweek;
95 date=d; 95 date=d;
96 dayofweek=d.dayOfWeek(); 96 dayofweek=d.dayOfWeek();
97 if(bStartOnMonday) 97 if(bStartOnMonday)
98 dayofweek--; 98 dayofweek--;
99 else if( dayofweek == 7 ) 99 else if( dayofweek == 7 )
100 // we already have the right day -7 would lead to the current week.. 100 // we already have the right day -7 would lead to the current week..
101 dayofweek = 0; 101 dayofweek = 0;
102 102
103 date=date.addDays(-dayofweek); 103 date=date.addDays(-dayofweek);
104 calcWeek(date,week,year,bStartOnMonday); 104 calcWeek(date,week,year,bStartOnMonday);
105 QDate start=date; 105 QDate start=date;
106 QDate stop=start.addDays(6); 106 QDate stop=start.addDays(6);
107 labelDate->setText( QString::number(start.day()) + "." + 107 labelDate->setText( QString::number(start.day()) + "." +