author | umopapisdn <umopapisdn> | 2003-03-25 23:44:32 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-03-25 23:44:32 (UTC) |
commit | c98faafefdf2e9b9e16dcf2b1d57525f38282296 (patch) (unidiff) | |
tree | 75a6bc72f13ee81b86c368517aba3496b2c7e800 /core/pim/datebook | |
parent | aca404f0c049c5b1bace7e842e7e64b987f04616 (diff) | |
download | opie-c98faafefdf2e9b9e16dcf2b1d57525f38282296.zip opie-c98faafefdf2e9b9e16dcf2b1d57525f38282296.tar.gz opie-c98faafefdf2e9b9e16dcf2b1d57525f38282296.tar.bz2 |
Revamped the userinterface of the header for weekview to look more like the other views.
-rw-r--r-- | core/pim/datebook/datebookweekheader.ui | 198 | ||||
-rw-r--r-- | core/pim/datebook/datebookweekheaderimpl.cpp | 64 | ||||
-rw-r--r-- | core/pim/datebook/datebookweekheaderimpl.h | 12 |
3 files changed, 252 insertions, 22 deletions
diff --git a/core/pim/datebook/datebookweekheader.ui b/core/pim/datebook/datebookweekheader.ui index f7b20f8..591b625 100644 --- a/core/pim/datebook/datebookweekheader.ui +++ b/core/pim/datebook/datebookweekheader.ui | |||
@@ -32,4 +32,4 @@ | |||
32 | <y>0</y> | 32 | <y>0</y> |
33 | <width>281</width> | 33 | <width>249</width> |
34 | <height>30</height> | 34 | <height>26</height> |
35 | </rect> | 35 | </rect> |
@@ -49,5 +49,75 @@ | |||
49 | <name>spacing</name> | 49 | <name>spacing</name> |
50 | <number>6</number> | 50 | <number>0</number> |
51 | </property> | 51 | </property> |
52 | <widget> | 52 | <widget> |
53 | <class>QToolButton</class> | ||
54 | <property stdset="1"> | ||
55 | <name>name</name> | ||
56 | <cstring>backmonth</cstring> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>text</name> | ||
60 | <string></string> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>pixmap</name> | ||
64 | <pixmap></pixmap> | ||
65 | </property> | ||
66 | <property stdset="1"> | ||
67 | <name>toggleButton</name> | ||
68 | <bool>false</bool> | ||
69 | </property> | ||
70 | <property stdset="1"> | ||
71 | <name>autoRepeat</name> | ||
72 | <bool>true</bool> | ||
73 | </property> | ||
74 | <property stdset="1"> | ||
75 | <name>autoRaise</name> | ||
76 | <bool>true</bool> | ||
77 | </property> | ||
78 | <property stdset="1"> | ||
79 | <name>toggleButton</name> | ||
80 | <bool>false</bool> | ||
81 | </property> | ||
82 | <property> | ||
83 | <name>toolTip</name> | ||
84 | <string></string> | ||
85 | </property> | ||
86 | </widget> | ||
87 | <widget> | ||
88 | <class>QToolButton</class> | ||
89 | <property stdset="1"> | ||
90 | <name>name</name> | ||
91 | <cstring>backweek</cstring> | ||
92 | </property> | ||
93 | <property stdset="1"> | ||
94 | <name>text</name> | ||
95 | <string></string> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>pixmap</name> | ||
99 | <pixmap></pixmap> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>toggleButton</name> | ||
103 | <bool>false</bool> | ||
104 | </property> | ||
105 | <property stdset="1"> | ||
106 | <name>autoRepeat</name> | ||
107 | <bool>true</bool> | ||
108 | </property> | ||
109 | <property stdset="1"> | ||
110 | <name>autoRaise</name> | ||
111 | <bool>true</bool> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>toggleButton</name> | ||
115 | <bool>false</bool> | ||
116 | </property> | ||
117 | <property> | ||
118 | <name>toolTip</name> | ||
119 | <string></string> | ||
120 | </property> | ||
121 | </widget> | ||
122 | <widget> | ||
53 | <class>QSpinBox</class> | 123 | <class>QSpinBox</class> |
@@ -111,4 +181,25 @@ | |||
111 | </widget> | 181 | </widget> |
182 | <spacer> | ||
183 | <property> | ||
184 | <name>name</name> | ||
185 | <cstring>Spacer1_1</cstring> | ||
186 | </property> | ||
187 | <property stdset="1"> | ||
188 | <name>orientation</name> | ||
189 | <enum>Horizontal</enum> | ||
190 | </property> | ||
191 | <property stdset="1"> | ||
192 | <name>sizeType</name> | ||
193 | <enum>Expanding</enum> | ||
194 | </property> | ||
195 | <property> | ||
196 | <name>sizeHint</name> | ||
197 | <size> | ||
198 | <width>20</width> | ||
199 | <height>20</height> | ||
200 | </size> | ||
201 | </property> | ||
202 | </spacer> | ||
112 | <widget> | 203 | <widget> |
113 | <class>QLabel</class> | 204 | <class>QToolButton</class> |
114 | <property stdset="1"> | 205 | <property stdset="1"> |
@@ -134,8 +225,68 @@ | |||
134 | </property> | 225 | </property> |
226 | </widget> | ||
227 | <spacer> | ||
228 | <property> | ||
229 | <name>name</name> | ||
230 | <cstring>Spacer1_2</cstring> | ||
231 | </property> | ||
232 | <property stdset="1"> | ||
233 | <name>orientation</name> | ||
234 | <enum>Horizontal</enum> | ||
235 | </property> | ||
135 | <property stdset="1"> | 236 | <property stdset="1"> |
136 | <name>alignment</name> | 237 | <name>sizeType</name> |
137 | <set>AlignCenter</set> | 238 | <enum>Expanding</enum> |
138 | </property> | 239 | </property> |
139 | <property> | 240 | <property> |
140 | <name>hAlign</name> | 241 | <name>sizeHint</name> |
242 | <size> | ||
243 | <width>20</width> | ||
244 | <height>20</height> | ||
245 | </size> | ||
246 | </property> | ||
247 | </spacer> | ||
248 | <widget> | ||
249 | <class>QToolButton</class> | ||
250 | <property stdset="1"> | ||
251 | <name>name</name> | ||
252 | <cstring>forwardweek</cstring> | ||
253 | </property> | ||
254 | <property stdset="1"> | ||
255 | <name>text</name> | ||
256 | <string></string> | ||
257 | </property> | ||
258 | <property stdset="1"> | ||
259 | <name>pixmap</name> | ||
260 | <pixmap></pixmap> | ||
261 | </property> | ||
262 | <property stdset="1"> | ||
263 | <name>autoRepeat</name> | ||
264 | <bool>true</bool> | ||
265 | </property> | ||
266 | <property stdset="1"> | ||
267 | <name>autoRaise</name> | ||
268 | <bool>true</bool> | ||
269 | </property> | ||
270 | </widget> | ||
271 | <widget> | ||
272 | <class>QToolButton</class> | ||
273 | <property stdset="1"> | ||
274 | <name>name</name> | ||
275 | <cstring>forwardmonth</cstring> | ||
276 | </property> | ||
277 | <property stdset="1"> | ||
278 | <name>text</name> | ||
279 | <string></string> | ||
280 | </property> | ||
281 | <property stdset="1"> | ||
282 | <name>pixmap</name> | ||
283 | <pixmap></pixmap> | ||
284 | </property> | ||
285 | <property stdset="1"> | ||
286 | <name>autoRepeat</name> | ||
287 | <bool>true</bool> | ||
288 | </property> | ||
289 | <property stdset="1"> | ||
290 | <name>autoRaise</name> | ||
291 | <bool>true</bool> | ||
141 | </property> | 292 | </property> |
@@ -146,12 +297,30 @@ | |||
146 | <connection> | 297 | <connection> |
147 | <sender>spinYear</sender> | 298 | <sender>backmonth</sender> |
148 | <signal>valueChanged(int)</signal> | 299 | <signal>clicked()</signal> |
300 | <receiver>DateBookWeekHeaderBase</receiver> | ||
301 | <slot>prevMonth()</slot> | ||
302 | </connection> | ||
303 | <connection> | ||
304 | <sender>backweek</sender> | ||
305 | <signal>clicked()</signal> | ||
306 | <receiver>DateBookWeekHeaderBase</receiver> | ||
307 | <slot>prevWeek()</slot> | ||
308 | </connection> | ||
309 | <connection> | ||
310 | <sender>forwardweek</sender> | ||
311 | <signal>clicked()</signal> | ||
312 | <receiver>DateBookWeekHeaderBase</receiver> | ||
313 | <slot>nextWeek()</slot> | ||
314 | </connection> | ||
315 | <connection> | ||
316 | <sender>forwardmonth</sender> | ||
317 | <signal>clicked()</signal> | ||
149 | <receiver>DateBookWeekHeaderBase</receiver> | 318 | <receiver>DateBookWeekHeaderBase</receiver> |
150 | <slot>yearChanged( int )</slot> | 319 | <slot>nextMonth()</slot> |
151 | </connection> | 320 | </connection> |
152 | <connection> | 321 | <connection> |
153 | <sender>spinWeek</sender> | 322 | <sender>labelDate</sender> |
154 | <signal>valueChanged(int)</signal> | 323 | <signal>clicked()</signal> |
155 | <receiver>DateBookWeekHeaderBase</receiver> | 324 | <receiver>DateBookWeekHeaderBase</receiver> |
156 | <slot>weekChanged( int )</slot> | 325 | <slot>pickDate()</slot> |
157 | </connection> | 326 | </connection> |
@@ -161,2 +330,5 @@ | |||
161 | <slot access="public">weekChanged( int )</slot> | 330 | <slot access="public">weekChanged( int )</slot> |
331 | <slot access="public">nextMonth()</slot> | ||
332 | <slot access="public">prevMonth()</slot> | ||
333 | <slot access="public">pickDate()</slot> | ||
162 | </connections> | 334 | </connections> |
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp index e7c7208..5f555d5 100644 --- a/core/pim/datebook/datebookweekheaderimpl.cpp +++ b/core/pim/datebook/datebookweekheaderimpl.cpp | |||
@@ -20,2 +20,4 @@ | |||
20 | #include "datebookweekheaderimpl.h" | 20 | #include "datebookweekheaderimpl.h" |
21 | #include "datebookweekheader.h" | ||
22 | #include "datebookweek.h" | ||
21 | #include <qlabel.h> | 23 | #include <qlabel.h> |
@@ -23,2 +25,6 @@ | |||
23 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qpe/resource.h> | ||
27 | #include <qpe/datebookmonth.h> | ||
28 | |||
29 | #include <qtoolbutton.h> | ||
24 | 30 | ||
@@ -35,2 +41,9 @@ DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, | |||
35 | labelDate->setBackgroundMode( PaletteButton ); | 41 | labelDate->setBackgroundMode( PaletteButton ); |
42 | |||
43 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | ||
44 | backweek->setPixmap( Resource::loadPixmap("back") ); | ||
45 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | ||
46 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | ||
47 | spinYear->hide(); | ||
48 | spinWeek->hide(); | ||
36 | } | 49 | } |
@@ -45,2 +58,20 @@ DateBookWeekHeader::~DateBookWeekHeader() | |||
45 | 58 | ||
59 | void DateBookWeekHeader::pickDate() | ||
60 | { | ||
61 | static QPopupMenu *m1 = 0; | ||
62 | static DateBookMonth *picker = 0; | ||
63 | QDate currDate = dateFromWeek( week, year, bStartOnMonday ); | ||
64 | if ( !m1 ) { | ||
65 | m1 = new QPopupMenu( this ); | ||
66 | picker = new DateBookMonth( m1, 0, TRUE ); | ||
67 | m1->insertItem( picker ); | ||
68 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | ||
69 | this, SLOT( setDate( int, int, int ) ) ); | ||
70 | // connect( m1, SIGNAL( aboutToHide() ), | ||
71 | // this, SLOT( gotHide() ) ); | ||
72 | } | ||
73 | picker->setDate( currDate.year(), currDate.month(), currDate.day() ); | ||
74 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | ||
75 | picker->setFocus(); | ||
76 | } | ||
46 | /* | 77 | /* |
@@ -52,2 +83,14 @@ void DateBookWeekHeader::yearChanged( int y ) | |||
52 | } | 83 | } |
84 | void DateBookWeekHeader::nextMonth() | ||
85 | { | ||
86 | QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week | ||
87 | calcWeek( mydate.addDays(28), week, year, bStartOnMonday ); // Add 4 weeks. | ||
88 | setDate( year, week ); // update view | ||
89 | } | ||
90 | void DateBookWeekHeader::prevMonth() | ||
91 | { | ||
92 | QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week | ||
93 | calcWeek( mydate.addDays(-28), week, year, bStartOnMonday ); // Subtract 4 weeks | ||
94 | setDate( year, week ); // update view | ||
95 | } | ||
53 | /* | 96 | /* |
@@ -57,4 +100,6 @@ void DateBookWeekHeader::nextWeek() | |||
57 | { | 100 | { |
58 | if ( week < 52 ) | 101 | QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week |
59 | week++; | 102 | calcWeek( mydate.addDays(7), week, year, bStartOnMonday); // Add 1 week |
103 | // if ( week < 52 ) | ||
104 | //week++; | ||
60 | setDate( year, week ); | 105 | setDate( year, week ); |
@@ -66,4 +111,6 @@ void DateBookWeekHeader::prevWeek() | |||
66 | { | 111 | { |
67 | if ( week > 1 ) | 112 | QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week |
68 | week--; | 113 | calcWeek( mydate.addDays(-7), week, year, bStartOnMonday); // Add 1 week |
114 | // if ( week > 1 ) | ||
115 | //week--; | ||
69 | setDate( year, week ); | 116 | setDate( year, week ); |
@@ -78,2 +125,8 @@ void DateBookWeekHeader::weekChanged( int w ) | |||
78 | 125 | ||
126 | void DateBookWeekHeader::setDate( int y, int m, int d ) | ||
127 | { | ||
128 | calcWeek( QDate(y,m,d), week, year, bStartOnMonday ); | ||
129 | setDate( year, week ); | ||
130 | } | ||
131 | |||
79 | void DateBookWeekHeader::setDate( int y, int w ) | 132 | void DateBookWeekHeader::setDate( int y, int w ) |
@@ -91,3 +144,4 @@ void DateBookWeekHeader::setDate( int y, int w ) | |||
91 | s += QString::number( d.day() ) + ". " + d.monthName( d.month() ); | 144 | s += QString::number( d.day() ) + ". " + d.monthName( d.month() ); |
92 | labelDate->setText( s ); | 145 | s += " ("+tr("week")+":"+QString::number( w )+")"; |
146 | labelDate->setText( s ); | ||
93 | 147 | ||
diff --git a/core/pim/datebook/datebookweekheaderimpl.h b/core/pim/datebook/datebookweekheaderimpl.h index 2abef46..2e5a6ca 100644 --- a/core/pim/datebook/datebookweekheaderimpl.h +++ b/core/pim/datebook/datebookweekheaderimpl.h | |||
@@ -41,6 +41,10 @@ signals: | |||
41 | public slots: | 41 | public slots: |
42 | void yearChanged( int ); | 42 | void pickDate(); |
43 | void nextWeek(); | 43 | void yearChanged( int ); |
44 | void prevWeek(); | 44 | void nextMonth(); |
45 | void weekChanged( int ); | 45 | void prevMonth(); |
46 | void nextWeek(); | ||
47 | void prevWeek(); | ||
48 | void weekChanged( int ); | ||
49 | void setDate( int y, int m, int d); | ||
46 | 50 | ||