summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2003-03-24 09:48:03 (UTC)
committer umopapisdn <umopapisdn>2003-03-24 09:48:03 (UTC)
commit1471e2c49d27b352682448e2653e59073b556abc (patch) (unidiff)
tree28ba9126851cdb06fcf7e564c7ed7aa554eaee59
parentfea2436fef9e7096b31840e7170a23280f3d6e39 (diff)
downloadopie-1471e2c49d27b352682448e2653e59073b556abc.zip
opie-1471e2c49d27b352682448e2653e59073b556abc.tar.gz
opie-1471e2c49d27b352682448e2653e59073b556abc.tar.bz2
New feature: (bug/feature request #0000227) In dayview, to icons have been added to navigate 1 week back and forward.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookdayheader.cpp207
-rw-r--r--core/pim/datebook/datebookdayheader.h56
-rw-r--r--core/pim/datebook/datebookdayheaderimpl.cpp18
-rw-r--r--core/pim/datebook/datebookdayheaderimpl.h2
4 files changed, 283 insertions, 0 deletions
diff --git a/core/pim/datebook/datebookdayheader.cpp b/core/pim/datebook/datebookdayheader.cpp
new file mode 100644
index 0000000..82a143f
--- a/dev/null
+++ b/core/pim/datebook/datebookdayheader.cpp
@@ -0,0 +1,207 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'datebookdayheader.ui'
3**
4** Created: Mon Mar 24 10:42:07 2003
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "datebookdayheader.h"
10
11#include <qbuttongroup.h>
12#include <qpushbutton.h>
13#include <qtoolbutton.h>
14#include <qlayout.h>
15#include <qvariant.h>
16#include <qtooltip.h>
17#include <qwhatsthis.h>
18#include <qimage.h>
19#include <qpixmap.h>
20
21
22/*
23 * Constructs a DateBookDayHeaderBase which is a child of 'parent', with the
24 * name 'name' and widget flags set to 'f'
25 */
26DateBookDayHeaderBase::DateBookDayHeaderBase( QWidget* parent, const char* name, WFlags fl )
27 : QWidget( parent, name, fl )
28{
29 if ( !name )
30 setName( "DateBookDayHeaderBase" );
31 resize( 249, 26 );
32 DateBookDayHeaderBaseLayout = new QHBoxLayout( this );
33 DateBookDayHeaderBaseLayout->setSpacing( 0 );
34 DateBookDayHeaderBaseLayout->setMargin( 0 );
35
36 backweek = new QToolButton( this, "backweek" );
37 backweek->setText( tr( "" ) );
38 backweek->setToggleButton( FALSE );
39 backweek->setAutoRepeat( TRUE );
40 backweek->setAutoRaise( TRUE );
41 backweek->setToggleButton( FALSE );
42 QToolTip::add( backweek, tr( "" ) );
43 DateBookDayHeaderBaseLayout->addWidget( backweek );
44
45 back = new QToolButton( this, "back" );
46 back->setText( tr( "" ) );
47 back->setToggleButton( FALSE );
48 back->setAutoRepeat( TRUE );
49 back->setAutoRaise( TRUE );
50 back->setToggleButton( FALSE );
51 QToolTip::add( back, tr( "" ) );
52 DateBookDayHeaderBaseLayout->addWidget( back );
53
54 date = new QToolButton( this, "date" );
55 date->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)1, date->sizePolicy().hasHeightForWidth() ) );
56 QFont date_font( date->font() );
57 date_font.setBold( TRUE );
58 date->setFont( date_font );
59 date->setText( tr( "" ) );
60 date->setAutoRepeat( FALSE );
61 date->setAutoRaise( FALSE );
62 DateBookDayHeaderBaseLayout->addWidget( date );
63
64 grpDays = new QButtonGroup( this, "grpDays" );
65 grpDays->setFrameShape( QButtonGroup::NoFrame );
66 grpDays->setFrameShadow( QButtonGroup::Plain );
67 grpDays->setTitle( tr( "" ) );
68 grpDays->setExclusive( TRUE );
69 grpDays->setColumnLayout(0, Qt::Vertical );
70 grpDays->layout()->setSpacing( 0 );
71 grpDays->layout()->setMargin( 0 );
72 grpDaysLayout = new QHBoxLayout( grpDays->layout() );
73 grpDaysLayout->setAlignment( Qt::AlignTop );
74 grpDaysLayout->setSpacing( 1 );
75 grpDaysLayout->setMargin( 0 );
76
77 cmdDay1 = new QToolButton( grpDays, "cmdDay1" );
78 cmdDay1->setText( tr( "M" ) );
79 cmdDay1->setToggleButton( TRUE );
80 cmdDay1->setAutoRaise( TRUE );
81 cmdDay1->setToggleButton( TRUE );
82 QToolTip::add( cmdDay1, tr( "" ) );
83 grpDaysLayout->addWidget( cmdDay1 );
84
85 cmdDay2 = new QToolButton( grpDays, "cmdDay2" );
86 cmdDay2->setText( tr( "T" ) );
87 cmdDay2->setToggleButton( TRUE );
88 cmdDay2->setAutoRaise( TRUE );
89 cmdDay2->setToggleButton( TRUE );
90 QToolTip::add( cmdDay2, tr( "" ) );
91 grpDaysLayout->addWidget( cmdDay2 );
92
93 cmdDay3 = new QToolButton( grpDays, "cmdDay3" );
94 cmdDay3->setText( tr( "W" ) );
95 cmdDay3->setToggleButton( TRUE );
96 cmdDay3->setAutoRaise( TRUE );
97 cmdDay3->setToggleButton( TRUE );
98 QToolTip::add( cmdDay3, tr( "" ) );
99 grpDaysLayout->addWidget( cmdDay3 );
100
101 cmdDay4 = new QToolButton( grpDays, "cmdDay4" );
102 cmdDay4->setText( tr( "T" ) );
103 cmdDay4->setToggleButton( TRUE );
104 cmdDay4->setAutoRepeat( FALSE );
105 cmdDay4->setAutoRaise( TRUE );
106 cmdDay4->setToggleButton( TRUE );
107 QToolTip::add( cmdDay4, tr( "" ) );
108 grpDaysLayout->addWidget( cmdDay4 );
109
110 cmdDay5 = new QToolButton( grpDays, "cmdDay5" );
111 cmdDay5->setText( tr( "F" ) );
112 cmdDay5->setToggleButton( TRUE );
113 cmdDay5->setAutoRaise( TRUE );
114 cmdDay5->setToggleButton( TRUE );
115 QToolTip::add( cmdDay5, tr( "" ) );
116 grpDaysLayout->addWidget( cmdDay5 );
117
118 cmdDay6 = new QToolButton( grpDays, "cmdDay6" );
119 cmdDay6->setText( tr( "S" ) );
120 cmdDay6->setToggleButton( TRUE );
121 cmdDay6->setAutoRaise( TRUE );
122 cmdDay6->setToggleButton( TRUE );
123 QToolTip::add( cmdDay6, tr( "" ) );
124 grpDaysLayout->addWidget( cmdDay6 );
125
126 cmdDay7 = new QToolButton( grpDays, "cmdDay7" );
127 cmdDay7->setText( tr( "S" ) );
128 cmdDay7->setToggleButton( TRUE );
129 cmdDay7->setAutoRaise( TRUE );
130 cmdDay7->setToggleButton( TRUE );
131 QToolTip::add( cmdDay7, tr( "" ) );
132 grpDaysLayout->addWidget( cmdDay7 );
133 DateBookDayHeaderBaseLayout->addWidget( grpDays );
134
135 forward = new QToolButton( this, "forward" );
136 forward->setText( tr( "" ) );
137 forward->setAutoRepeat( TRUE );
138 forward->setAutoRaise( TRUE );
139 DateBookDayHeaderBaseLayout->addWidget( forward );
140
141 forwardweek = new QToolButton( this, "forwardweek" );
142 forwardweek->setText( tr( "" ) );
143 forwardweek->setAutoRepeat( TRUE );
144 forwardweek->setAutoRaise( TRUE );
145 DateBookDayHeaderBaseLayout->addWidget( forwardweek );
146
147 // signals and slots connections
148 connect( forwardweek, SIGNAL( clicked() ), this, SLOT( goForwardWeek() ) );
149 connect( forward, SIGNAL( clicked() ), this, SLOT( goForward() ) );
150 connect( back, SIGNAL( clicked() ), this, SLOT( goBack() ) );
151 connect( backweek, SIGNAL( clicked() ), this, SLOT( goBackWeek() ) );
152 connect( grpDays, SIGNAL( clicked(int) ), this, SLOT( setDay( int ) ) );
153}
154
155/*
156 * Destroys the object and frees any allocated resources
157 */
158DateBookDayHeaderBase::~DateBookDayHeaderBase()
159{
160 // no need to delete child widgets, Qt does it all for us
161}
162
163/*
164 * Main event handler. Reimplemented to handle application
165 * font changes
166 */
167bool DateBookDayHeaderBase::event( QEvent* ev )
168{
169 bool ret = QWidget::event( ev );
170 if ( ev->type() == QEvent::ApplicationFontChange ) {
171 QFont date_font( date->font() );
172 date_font.setBold( TRUE );
173 date->setFont( date_font );
174 }
175 return ret;
176}
177
178void DateBookDayHeaderBase::goBack()
179{
180 qWarning( "DateBookDayHeaderBase::goBack(): Not implemented yet!" );
181}
182
183void DateBookDayHeaderBase::goBackWeek()
184{
185 qWarning( "DateBookDayHeaderBase::goBackWeek(): Not implemented yet!" );
186}
187
188void DateBookDayHeaderBase::goForward()
189{
190 qWarning( "DateBookDayHeaderBase::goForward(): Not implemented yet!" );
191}
192
193void DateBookDayHeaderBase::goForwardWeek()
194{
195 qWarning( "DateBookDayHeaderBase::goForwardWeek(): Not implemented yet!" );
196}
197
198void DateBookDayHeaderBase::setDate( int, int, int )
199{
200 qWarning( "DateBookDayHeaderBase::setDate( int, int, int ): Not implemented yet!" );
201}
202
203void DateBookDayHeaderBase::setDay( int )
204{
205 qWarning( "DateBookDayHeaderBase::setDay( int ): Not implemented yet!" );
206}
207
diff --git a/core/pim/datebook/datebookdayheader.h b/core/pim/datebook/datebookdayheader.h
new file mode 100644
index 0000000..12f6fcf
--- a/dev/null
+++ b/core/pim/datebook/datebookdayheader.h
@@ -0,0 +1,56 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'datebookdayheader.ui'
3**
4** Created: Mon Mar 10 20:49:12 2003
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef DATEBOOKDAYHEADERBASE_H
10#define DATEBOOKDAYHEADERBASE_H
11
12#include <qvariant.h>
13#include <qwidget.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QButtonGroup;
18class QToolButton;
19
20class DateBookDayHeaderBase : public QWidget
21{
22 Q_OBJECT
23
24public:
25 DateBookDayHeaderBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
26 ~DateBookDayHeaderBase();
27
28 QToolButton* backweek;
29 QToolButton* back;
30 QToolButton* date;
31 QButtonGroup* grpDays;
32 QToolButton* cmdDay1;
33 QToolButton* cmdDay2;
34 QToolButton* cmdDay3;
35 QToolButton* cmdDay4;
36 QToolButton* cmdDay5;
37 QToolButton* cmdDay6;
38 QToolButton* cmdDay7;
39 QToolButton* forward;
40 QToolButton* forwardweek;
41
42public slots:
43 virtual void goBackWeek();
44 virtual void goBack();
45 virtual void goForward();
46 virtual void goForwardWeek();
47 virtual void setDate( int, int, int );
48 virtual void setDay( int );
49
50protected:
51 QHBoxLayout* DateBookDayHeaderBaseLayout;
52 QHBoxLayout* grpDaysLayout;
53 bool event( QEvent* );
54};
55
56#endif // DATEBOOKDAYHEADERBASE_H
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
@@ -48,6 +48,8 @@ DateBookDayHeader::DateBookDayHeader( bool useMonday,
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 );
@@ -130,6 +132,22 @@ void DateBookDayHeader::goForward()
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/*
diff --git a/core/pim/datebook/datebookdayheaderimpl.h b/core/pim/datebook/datebookdayheaderimpl.h
index 43f3a93..a07bd67 100644
--- a/core/pim/datebook/datebookdayheaderimpl.h
+++ b/core/pim/datebook/datebookdayheaderimpl.h
@@ -36,6 +36,8 @@ public:
36public slots: 36public slots:
37 void goBack(); 37 void goBack();
38 void goForward(); 38 void goForward();
39 void goBackWeek();
40 void goForwardWeek();
39 void setDate( int, int, int ); 41 void setDate( int, int, int );
40 void setDay( int ); 42 void setDay( int );
41 void gotHide(); 43 void gotHide();