summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookdayheaderimpl.cpp
Unidiff
Diffstat (limited to 'core/pim/datebook/datebookdayheaderimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookdayheaderimpl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/pim/datebook/datebookdayheaderimpl.cpp b/core/pim/datebook/datebookdayheaderimpl.cpp
index 7d77153..3e965f5 100644
--- a/core/pim/datebook/datebookdayheaderimpl.cpp
+++ b/core/pim/datebook/datebookdayheaderimpl.cpp
@@ -27,48 +27,50 @@
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qtimer.h> 29#include <qtimer.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31 31
32 32
33/* 33/*
34 * Constructs a DateBookDayHeader which is a child of 'parent', with the 34 * Constructs a DateBookDayHeader which is a child of 'parent', with the
35 * name 'name' and widget flags set to 'f' 35 * name 'name' and widget flags set to 'f'
36 * 36 *
37 * The dialog will by default be modeless, unless you set 'modal' to 37 * The dialog will by default be modeless, unless you set 'modal' to
38 * TRUE to construct a modal dialog. 38 * TRUE to construct a modal dialog.
39 */ 39 */
40DateBookDayHeader::DateBookDayHeader( bool useMonday, 40DateBookDayHeader::DateBookDayHeader( bool useMonday,
41 QWidget* parent, const char* name ) 41 QWidget* parent, const char* name )
42 : DateBookDayHeaderBase( parent, name ), 42 : DateBookDayHeaderBase( parent, name ),
43 bUseMonday( useMonday ) 43 bUseMonday( useMonday )
44{ 44{
45 connect(date,SIGNAL(pressed()),this,SLOT(pickDate())); 45 connect(date,SIGNAL(pressed()),this,SLOT(pickDate()));
46 46
47 setupNames(); 47 setupNames();
48 48
49 forward->setPixmap( Resource::loadPixmap( "forward" ) ); 49 forward->setPixmap( Resource::loadPixmap( "forward" ) );
50 back->setPixmap( Resource::loadPixmap( "back" ) ); 50 back->setPixmap( Resource::loadPixmap( "back" ) );
51 forwardweek->setPixmap( Resource::loadPixmap( "fastforward" ) );
52 backweek->setPixmap( Resource::loadPixmap( "fastback" ) );
51 53
52 setBackgroundMode( PaletteButton ); 54 setBackgroundMode( PaletteButton );
53 grpDays->setBackgroundMode( PaletteButton ); 55 grpDays->setBackgroundMode( PaletteButton );
54} 56}
55 57
56/* 58/*
57 * Destroys the object and frees any allocated resources 59 * Destroys the object and frees any allocated resources
58 */ 60 */
59DateBookDayHeader::~DateBookDayHeader() 61DateBookDayHeader::~DateBookDayHeader()
60{ 62{
61 // no need to delete child widgets, Qt does it all for us 63 // no need to delete child widgets, Qt does it all for us
62} 64}
63 65
64void DateBookDayHeader::setStartOfWeek( bool onMonday ) 66void DateBookDayHeader::setStartOfWeek( bool onMonday )
65{ 67{
66 bUseMonday = onMonday; 68 bUseMonday = onMonday;
67 setupNames(); 69 setupNames();
68 setDate( currDate.year(), currDate.month(), currDate.day() ); 70 setDate( currDate.year(), currDate.month(), currDate.day() );
69} 71}
70 72
71void DateBookDayHeader::setupNames() 73void DateBookDayHeader::setupNames()
72{ 74{
73 if ( bUseMonday ) { 75 if ( bUseMonday ) {
74 cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) ); 76 cmdDay1->setText( DateBookDayHeaderBase::tr("Monday").left(1) );
@@ -109,48 +111,64 @@ void DateBookDayHeader::pickDate()
109} 111}
110 112
111void DateBookDayHeader::gotHide() 113void DateBookDayHeader::gotHide()
112{ 114{
113 // we have to redo the button... 115 // we have to redo the button...
114 date->setDown( false ); 116 date->setDown( false );
115} 117}
116 118
117/* 119/*
118 * public slot 120 * public slot
119 */ 121 */
120void DateBookDayHeader::goBack() 122void DateBookDayHeader::goBack()
121{ 123{
122 currDate = currDate.addDays( -1 ); 124 currDate = currDate.addDays( -1 );
123 setDate( currDate.year(), currDate.month(), currDate.day() ); 125 setDate( currDate.year(), currDate.month(), currDate.day() );
124} 126}
125/* 127/*
126 * public slot 128 * public slot
127 */ 129 */
128void DateBookDayHeader::goForward() 130void DateBookDayHeader::goForward()
129{ 131{
130 currDate = currDate.addDays( 1 ); 132 currDate = currDate.addDays( 1 );
131 setDate( currDate.year(), currDate.month(), currDate.day() ); 133 setDate( currDate.year(), currDate.month(), currDate.day() );
132} 134}
135/*
136 * public slot
137 */
138void DateBookDayHeader::goBackWeek()
139{
140 currDate = currDate.addDays( -7 );
141 setDate( currDate.year(), currDate.month(), currDate.day() );
142}
143/*
144 * public slot
145 */
146void DateBookDayHeader::goForwardWeek()
147{
148 currDate = currDate.addDays( 7 );
149 setDate( currDate.year(), currDate.month(), currDate.day() );
150}
133 151
134 152
135/* 153/*
136 * public slot 154 * public slot
137 */ 155 */
138void DateBookDayHeader::setDate( int y, int m, int d ) 156void DateBookDayHeader::setDate( int y, int m, int d )
139{ 157{
140 currDate.setYMD( y, m, d ); 158 currDate.setYMD( y, m, d );
141 date->setText( TimeString::shortDate( currDate ) ); 159 date->setText( TimeString::shortDate( currDate ) );
142 160
143 int iDayOfWeek = currDate.dayOfWeek(); 161 int iDayOfWeek = currDate.dayOfWeek();
144 // cleverly adjust the day depending on how we start the week 162 // cleverly adjust the day depending on how we start the week
145 if ( bUseMonday ) 163 if ( bUseMonday )
146 iDayOfWeek--; 164 iDayOfWeek--;
147 else { 165 else {
148 if ( iDayOfWeek == 7 ) // Sunday 166 if ( iDayOfWeek == 7 ) // Sunday
149 iDayOfWeek = 0; 167 iDayOfWeek = 0;
150 } 168 }
151 grpDays->setButton( iDayOfWeek ); 169 grpDays->setButton( iDayOfWeek );
152 emit dateChanged( y, m, d ); 170 emit dateChanged( y, m, d );
153} 171}
154 172
155/* 173/*
156 * public slot 174 * public slot