author | hakan <hakan> | 2002-03-09 11:39:21 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-03-09 11:39:21 (UTC) |
commit | 603e969bb8cef91534a1785e27106ba71eb03ba6 (patch) (unidiff) | |
tree | 20642ed29acb08ab0cecc1dffd1d63baa8914ae2 /core | |
parent | 3d03d0e3f679578080bbbf7d8b7f9eba1b9560db (diff) | |
download | opie-603e969bb8cef91534a1785e27106ba71eb03ba6.zip opie-603e969bb8cef91534a1785e27106ba71eb03ba6.tar.gz opie-603e969bb8cef91534a1785e27106ba71eb03ba6.tar.bz2 |
Added a WeekLst view showing an entire week and appointment descriptions and made default view configurable
-rw-r--r-- | core/pim/datebook/clickablelabel.cpp | 31 | ||||
-rw-r--r-- | core/pim/datebook/clickablelabel.h | 20 | ||||
-rw-r--r-- | core/pim/datebook/datebook.cpp | 106 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 8 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 10 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 314 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 131 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklstdayhdr.ui | 149 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklstheader.ui | 238 | ||||
-rw-r--r-- | core/pim/datebook/dateentry.ui | 4 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 8 |
11 files changed, 1006 insertions, 13 deletions
diff --git a/core/pim/datebook/clickablelabel.cpp b/core/pim/datebook/clickablelabel.cpp new file mode 100644 index 0000000..6912c34 --- a/dev/null +++ b/core/pim/datebook/clickablelabel.cpp | |||
@@ -0,0 +1,31 @@ | |||
1 | #include "clickablelabel.h" | ||
2 | |||
3 | ClickableLabel::ClickableLabel(QWidget* parent = 0, | ||
4 | const char* name = 0, | ||
5 | WFlags fl = 0) : | ||
6 | QLabel(parent,name,fl) | ||
7 | { | ||
8 | setFrameShape(NoFrame); | ||
9 | setFrameShadow(Sunken); | ||
10 | } | ||
11 | |||
12 | void ClickableLabel::mousePressEvent( QMouseEvent *e ) { | ||
13 | setFrameShape(Panel); | ||
14 | repaint(); | ||
15 | } | ||
16 | |||
17 | void ClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | ||
18 | setFrameShape(NoFrame); | ||
19 | repaint(); | ||
20 | if (rect().contains(e->pos())) { | ||
21 | emit clicked(); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | void ClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | ||
26 | if (rect().contains(e->pos())) { | ||
27 | setFrameShape(Panel); | ||
28 | } else { | ||
29 | setFrameShape(NoFrame); | ||
30 | } | ||
31 | } | ||
diff --git a/core/pim/datebook/clickablelabel.h b/core/pim/datebook/clickablelabel.h new file mode 100644 index 0000000..b6d33ad --- a/dev/null +++ b/core/pim/datebook/clickablelabel.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #ifndef CLICKABLELABEL | ||
2 | #define CLICKABLELABEL | ||
3 | |||
4 | #include <qlabel.h> | ||
5 | |||
6 | class ClickableLabel: public QLabel | ||
7 | { | ||
8 | Q_OBJECT | ||
9 | public: | ||
10 | ClickableLabel(QWidget* parent = 0, const char* name = 0, | ||
11 | WFlags fl = 0); | ||
12 | protected: | ||
13 | void mousePressEvent( QMouseEvent *e ); | ||
14 | void mouseReleaseEvent( QMouseEvent *e ); | ||
15 | void mouseMoveEvent( QMouseEvent *e ); | ||
16 | signals: | ||
17 | void clicked(); | ||
18 | }; | ||
19 | |||
20 | #endif | ||
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index e8d808f..9880e2d 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "datebookday.h" | 26 | #include "datebookday.h" |
27 | #include "datebooksettings.h" | 27 | #include "datebooksettings.h" |
28 | #include "datebookweek.h" | 28 | #include "datebookweek.h" |
29 | #include "datebookweeklst.h" | ||
29 | #include "dateentryimpl.h" | 30 | #include "dateentryimpl.h" |
30 | 31 | ||
31 | #include <qpe/datebookmonth.h> | 32 | #include <qpe/datebookmonth.h> |
@@ -69,6 +70,7 @@ | |||
69 | 70 | ||
70 | #define DAY 1 | 71 | #define DAY 1 |
71 | #define WEEK 2 | 72 | #define WEEK 2 |
73 | #define WEEKLST 4 | ||
72 | #define MONTH 3 | 74 | #define MONTH 3 |
73 | 75 | ||
74 | 76 | ||
@@ -90,6 +92,14 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
90 | 92 | ||
91 | setToolBarsMovable( FALSE ); | 93 | setToolBarsMovable( FALSE ); |
92 | 94 | ||
95 | views = new QWidgetStack( this ); | ||
96 | setCentralWidget( views ); | ||
97 | |||
98 | dayView = 0; | ||
99 | weekView = 0; | ||
100 | weekLstView = 0; | ||
101 | monthView = 0; | ||
102 | |||
93 | QPEToolBar *bar = new QPEToolBar( this ); | 103 | QPEToolBar *bar = new QPEToolBar( this ); |
94 | bar->setHorizontalStretchable( TRUE ); | 104 | bar->setHorizontalStretchable( TRUE ); |
95 | 105 | ||
@@ -124,12 +134,21 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
124 | a->setToggleAction( TRUE ); | 134 | a->setToggleAction( TRUE ); |
125 | a->setOn( TRUE ); | 135 | a->setOn( TRUE ); |
126 | dayAction = a; | 136 | dayAction = a; |
137 | |||
127 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); | 138 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); |
128 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); | 139 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); |
129 | a->addTo( sub_bar ); | 140 | a->addTo( sub_bar ); |
130 | a->addTo( view ); | 141 | a->addTo( view ); |
131 | a->setToggleAction( TRUE ); | 142 | a->setToggleAction( TRUE ); |
132 | weekAction = a; | 143 | weekAction = a; |
144 | |||
145 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "weeklst" ), QString::null, 0, g, 0 ); | ||
146 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); | ||
147 | a->addTo( sub_bar ); | ||
148 | a->addTo( view ); | ||
149 | a->setToggleAction( TRUE ); | ||
150 | weekLstAction = a; | ||
151 | |||
133 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); | 152 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); |
134 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); | 153 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); |
135 | a->addTo( sub_bar ); | 154 | a->addTo( sub_bar ); |
@@ -145,14 +164,34 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | |||
145 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 164 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
146 | a->addTo( settings ); | 165 | a->addTo( settings ); |
147 | 166 | ||
148 | views = new QWidgetStack( this ); | 167 | QPopupMenu *default_view = new QPopupMenu(this); |
149 | setCentralWidget( views ); | 168 | settings->insertItem( tr( "Default View" ),default_view ); |
169 | default_view->setCheckable(TRUE); | ||
150 | 170 | ||
151 | dayView = 0; | ||
152 | weekView = 0; | ||
153 | monthView = 0; | ||
154 | 171 | ||
155 | viewDay(); | 172 | Config config("DateBook"); |
173 | config.setGroup("Main"); | ||
174 | int current=config.readNumEntry("defaultview", DAY); | ||
175 | |||
176 | QActionGroup *ag = new QActionGroup(this); | ||
177 | a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); | ||
178 | if (current==DAY) a->setOn(true), viewDay(); | ||
179 | ag->insert(a); | ||
180 | a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); | ||
181 | if (current==WEEK) a->setOn(true), viewWeek(); | ||
182 | ag->insert(a); | ||
183 | a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); | ||
184 | if (current==WEEKLST) a->setOn(true), viewWeekLst(); | ||
185 | ag->insert(a); | ||
186 | a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); | ||
187 | if (current==MONTH) a->setOn(true), viewMonth(); | ||
188 | ag->insert(a); | ||
189 | |||
190 | ag->addTo(default_view); | ||
191 | connect(ag, SIGNAL( selected ( QAction * ) ), | ||
192 | this, SLOT( newDefaultView(QAction *) ) | ||
193 | ); | ||
194 | |||
156 | connect( qApp, SIGNAL(clockChanged(bool)), | 195 | connect( qApp, SIGNAL(clockChanged(bool)), |
157 | this, SLOT(changeClock(bool)) ); | 196 | this, SLOT(changeClock(bool)) ); |
158 | connect( qApp, SIGNAL(weekChanged(bool)), | 197 | connect( qApp, SIGNAL(weekChanged(bool)), |
@@ -264,6 +303,8 @@ QDate DateBook::currentDate() | |||
264 | d = dayView->date(); | 303 | d = dayView->date(); |
265 | } else if ( weekView && views->visibleWidget() == weekView ) { | 304 | } else if ( weekView && views->visibleWidget() == weekView ) { |
266 | d = weekView->date(); | 305 | d = weekView->date(); |
306 | } else if ( weekLstView && views->visibleWidget() == weekLstView ) { | ||
307 | d = weekLstView->date(); | ||
267 | } else if ( monthView && views->visibleWidget() == monthView ) { | 308 | } else if ( monthView && views->visibleWidget() == monthView ) { |
268 | d = monthView->selectedDate(); | 309 | d = monthView->selectedDate(); |
269 | } | 310 | } |
@@ -291,6 +332,15 @@ void DateBook::viewWeek() | |||
291 | weekView->redraw(); | 332 | weekView->redraw(); |
292 | } | 333 | } |
293 | 334 | ||
335 | void DateBook::viewWeekLst() { | ||
336 | initWeekLst(); | ||
337 | weekLstAction->setOn( TRUE ); | ||
338 | QDate d=currentDate(); | ||
339 | weekLstView->setDate(d); | ||
340 | views->raiseWidget( weekLstView ); | ||
341 | weekLstView->redraw(); | ||
342 | } | ||
343 | |||
294 | void DateBook::viewMonth() | 344 | void DateBook::viewMonth() |
295 | { | 345 | { |
296 | initMonth(); | 346 | initMonth(); |
@@ -331,7 +381,8 @@ void DateBook::editEvent( const Event &e ) | |||
331 | QString error = checkEvent(newEv); | 381 | QString error = checkEvent(newEv); |
332 | if (!error.isNull()) { | 382 | if (!error.isNull()) { |
333 | if (QMessageBox::warning(this, "error box", | 383 | if (QMessageBox::warning(this, "error box", |
334 | error, "Fix it", "Continue", 0, 0, 1) == 0) | 384 | error, "Fix it", "Continue", |
385 | 0, 0, 1) == 0) | ||
335 | continue; | 386 | continue; |
336 | } | 387 | } |
337 | db->editEvent(e, newEv); | 388 | db->editEvent(e, newEv); |
@@ -422,6 +473,28 @@ void DateBook::initWeek() | |||
422 | if ( totWeeks != weekView->totalWeeks() ) | 473 | if ( totWeeks != weekView->totalWeeks() ) |
423 | weekView->setTotalWeeks( totWeeks ); | 474 | weekView->setTotalWeeks( totWeeks ); |
424 | } | 475 | } |
476 | void DateBook::initWeekLst() { | ||
477 | if ( !weekLstView ) { | ||
478 | weekLstView = new DateBookWeekLst( ampm, onMonday, db, | ||
479 | views, "weeklst view" ); | ||
480 | views->addWidget( weekLstView, WEEKLST ); | ||
481 | |||
482 | //weekLstView->setStartViewTime( startTime ); | ||
483 | connect( weekLstView, SIGNAL( showDate( int, int, int ) ), | ||
484 | this, SLOT( showDay( int, int, int ) ) ); | ||
485 | connect( weekLstView, SIGNAL( addEvent( const QDateTime &, | ||
486 | const QDateTime &, | ||
487 | const QString & ) ), | ||
488 | this, SLOT( slotNewEntry( const QDateTime &, | ||
489 | const QDateTime &, | ||
490 | const QString & ) ) ); | ||
491 | connect( this, SIGNAL( newEvent() ), | ||
492 | weekLstView, SLOT( redraw() ) ); | ||
493 | connect( weekLstView, SIGNAL( editEvent( const Event & ) ), | ||
494 | this, SLOT( editEvent( const Event & ) ) ); | ||
495 | } | ||
496 | } | ||
497 | |||
425 | 498 | ||
426 | void DateBook::initMonth() | 499 | void DateBook::initMonth() |
427 | { | 500 | { |
@@ -464,6 +537,18 @@ void DateBook::saveSettings() | |||
464 | configDB.writeEntry("presettime",presetTime); | 537 | configDB.writeEntry("presettime",presetTime); |
465 | } | 538 | } |
466 | 539 | ||
540 | void DateBook::newDefaultView(QAction *a) { | ||
541 | int val=DAY; | ||
542 | if (a->text() == "Day") val=DAY; | ||
543 | if (a->text() == "Week") val=WEEK; | ||
544 | if (a->text() == "WeekLst") val=WEEKLST; | ||
545 | if (a->text() == "Month") val=MONTH; | ||
546 | |||
547 | Config configDB( "DateBook" ); | ||
548 | configDB.setGroup( "Main" ); | ||
549 | configDB.writeEntry("defaultview",val); | ||
550 | } | ||
551 | |||
467 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) | 552 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) |
468 | { | 553 | { |
469 | bool needShow = FALSE; | 554 | bool needShow = FALSE; |
@@ -536,6 +621,8 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
536 | if ( cur == dayView ) | 621 | if ( cur == dayView ) |
537 | viewWeek(); | 622 | viewWeek(); |
538 | else if ( cur == weekView ) | 623 | else if ( cur == weekView ) |
624 | viewWeekLst(); | ||
625 | else if ( cur == weekLstView ) | ||
539 | viewMonth(); | 626 | viewMonth(); |
540 | else if ( cur == monthView ) | 627 | else if ( cur == monthView ) |
541 | viewDay(); | 628 | viewDay(); |
@@ -590,6 +677,7 @@ void DateBook::changeClock( bool newClock ) | |||
590 | // repaint the affected objects... | 677 | // repaint the affected objects... |
591 | if (dayView) dayView->redraw(); | 678 | if (dayView) dayView->redraw(); |
592 | if (weekView) weekView->redraw(); | 679 | if (weekView) weekView->redraw(); |
680 | if (weekLstView) weekLstView->redraw(); | ||
593 | } | 681 | } |
594 | 682 | ||
595 | void DateBook::changeWeek( bool m ) | 683 | void DateBook::changeWeek( bool m ) |
@@ -660,7 +748,9 @@ void DateBook::slotNewEventFromKey( const QString &str ) | |||
660 | start.setTime( QTime( 10, 0 ) ); | 748 | start.setTime( QTime( 10, 0 ) ); |
661 | end.setTime( QTime( 12, 0 ) ); | 749 | end.setTime( QTime( 12, 0 ) ); |
662 | } | 750 | } |
663 | 751 | slotNewEntry(start, end, str); | |
752 | } | ||
753 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str) { | ||
664 | // argh! This really needs to be encapsulated in a class | 754 | // argh! This really needs to be encapsulated in a class |
665 | // or function. | 755 | // or function. |
666 | QDialog newDlg( this, 0, TRUE ); | 756 | QDialog newDlg( this, 0, TRUE ); |
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index 44627bb..fcdbfec 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -28,6 +28,7 @@ class QAction; | |||
28 | class QWidgetStack; | 28 | class QWidgetStack; |
29 | class DateBookDay; | 29 | class DateBookDay; |
30 | class DateBookWeek; | 30 | class DateBookWeek; |
31 | class DateBookWeekLst; | ||
31 | class DateBookMonth; | 32 | class DateBookMonth; |
32 | class Event; | 33 | class Event; |
33 | class QDate; | 34 | class QDate; |
@@ -57,7 +58,9 @@ public slots: | |||
57 | 58 | ||
58 | private slots: | 59 | private slots: |
59 | void fileNew(); | 60 | void fileNew(); |
61 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str); | ||
60 | void slotSettings(); | 62 | void slotSettings(); |
63 | void newDefaultView(QAction *a); | ||
61 | void slotToday();// view today | 64 | void slotToday();// view today |
62 | void changeClock( bool newClock ); | 65 | void changeClock( bool newClock ); |
63 | void changeWeek( bool newDay ); | 66 | void changeWeek( bool newDay ); |
@@ -69,6 +72,7 @@ private slots: | |||
69 | 72 | ||
70 | void viewDay(); | 73 | void viewDay(); |
71 | void viewWeek(); | 74 | void viewWeek(); |
75 | void viewWeekLst(); | ||
72 | void viewMonth(); | 76 | void viewMonth(); |
73 | 77 | ||
74 | void showDay( int y, int m, int d ); | 78 | void showDay( int y, int m, int d ); |
@@ -85,6 +89,7 @@ private: | |||
85 | void addEvent( const Event &e ); | 89 | void addEvent( const Event &e ); |
86 | void initDay(); | 90 | void initDay(); |
87 | void initWeek(); | 91 | void initWeek(); |
92 | void initWeekLst(); | ||
88 | void initMonth(); | 93 | void initMonth(); |
89 | void loadSettings(); | 94 | void loadSettings(); |
90 | void saveSettings(); | 95 | void saveSettings(); |
@@ -95,7 +100,8 @@ private: | |||
95 | DateBookDay *dayView; | 100 | DateBookDay *dayView; |
96 | DateBookWeek *weekView; | 101 | DateBookWeek *weekView; |
97 | DateBookMonth *monthView; | 102 | DateBookMonth *monthView; |
98 | QAction *dayAction, *weekAction, *monthAction; | 103 | DateBookWeekLst *weekLstView; |
104 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; | ||
99 | bool aPreset; // have everything set to alarm? | 105 | bool aPreset; // have everything set to alarm? |
100 | int presetTime; // the standard time for the alarm | 106 | int presetTime; // the standard time for the alarm |
101 | int startTime; | 107 | int startTime; |
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index fae5d2b..bbe07af 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro | |||
@@ -8,8 +8,10 @@ HEADERS = datebookday.h \ | |||
8 | datebookdayheaderimpl.h \ | 8 | datebookdayheaderimpl.h \ |
9 | datebooksettings.h \ | 9 | datebooksettings.h \ |
10 | datebookweek.h \ | 10 | datebookweek.h \ |
11 | datebookweeklst.h \ | ||
11 | datebookweekheaderimpl.h \ | 12 | datebookweekheaderimpl.h \ |
12 | repeatentry.h | 13 | repeatentry.h \ |
14 | clickablelabel.h | ||
13 | 15 | ||
14 | SOURCES= main.cpp \ | 16 | SOURCES= main.cpp \ |
15 | datebookday.cpp \ | 17 | datebookday.cpp \ |
@@ -18,13 +20,17 @@ SOURCES = main.cpp \ | |||
18 | datebookdayheaderimpl.cpp \ | 20 | datebookdayheaderimpl.cpp \ |
19 | datebooksettings.cpp \ | 21 | datebooksettings.cpp \ |
20 | datebookweek.cpp \ | 22 | datebookweek.cpp \ |
23 | datebookweeklst.cpp \ | ||
21 | datebookweekheaderimpl.cpp \ | 24 | datebookweekheaderimpl.cpp \ |
22 | repeatentry.cpp | 25 | repeatentry.cpp \ |
26 | clickablelabel.cpp | ||
23 | 27 | ||
24 | INTERFACES= dateentry.ui \ | 28 | INTERFACES= dateentry.ui \ |
25 | datebookdayheader.ui \ | 29 | datebookdayheader.ui \ |
26 | datebooksettingsbase.ui \ | 30 | datebooksettingsbase.ui \ |
27 | datebookweekheader.ui \ | 31 | datebookweekheader.ui \ |
32 | datebookweeklstheader.ui \ | ||
33 | datebookweeklstdayhdr.ui \ | ||
28 | repeatentrybase.ui | 34 | repeatentrybase.ui |
29 | 35 | ||
30 | INCLUDEPATH += $(OPIEDIR)/include | 36 | INCLUDEPATH += $(OPIEDIR)/include |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp new file mode 100644 index 0000000..05e36be --- a/dev/null +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -0,0 +1,314 @@ | |||
1 | #include "datebookweeklst.h" | ||
2 | |||
3 | #include "datebookweekheaderimpl.h" | ||
4 | |||
5 | #include <qpe/calendar.h> | ||
6 | #include <qpe/datebookdb.h> | ||
7 | #include <qpe/event.h> | ||
8 | #include <qpe/qpeapplication.h> | ||
9 | #include <qpe/timestring.h> | ||
10 | #include <qpe/datebookmonth.h> | ||
11 | |||
12 | #include <qdatetime.h> | ||
13 | #include <qheader.h> | ||
14 | #include <qlabel.h> | ||
15 | #include <qlayout.h> | ||
16 | #include <qpainter.h> | ||
17 | #include <qpopupmenu.h> | ||
18 | #include <qtimer.h> | ||
19 | #include <qstyle.h> | ||
20 | #include <qtoolbutton.h> | ||
21 | #include <qvbox.h> | ||
22 | #include <qsizepolicy.h> | ||
23 | #include <qabstractlayout.h> | ||
24 | #include <qtl.h> | ||
25 | |||
26 | bool calcWeek(const QDate &d, int &week, int &year, | ||
27 | bool startOnMonday = false); | ||
28 | |||
29 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, | ||
30 | const char* name, WFlags fl) | ||
31 | : DateBookWeekLstHeaderBase(parent, name, fl) | ||
32 | { | ||
33 | setBackgroundMode( PaletteButton ); | ||
34 | labelDate->setBackgroundMode( PaletteButton ); | ||
35 | labelWeek->setBackgroundMode( PaletteButton ); | ||
36 | forward->setBackgroundMode( PaletteButton ); | ||
37 | back->setBackgroundMode( PaletteButton ); | ||
38 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | ||
39 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | ||
40 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | ||
41 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | ||
42 | |||
43 | connect(back, SIGNAL(clicked()), this, SLOT(prevWeek())); | ||
44 | connect(forward, SIGNAL(clicked()), this, SLOT(nextWeek())); | ||
45 | connect(labelWeek, SIGNAL(clicked()), this, SLOT(pickDate())); | ||
46 | onMonday=onM; | ||
47 | } | ||
48 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | ||
49 | void DateBookWeekLstHeader::setDate(QDate d) { | ||
50 | date=d; | ||
51 | |||
52 | int year,week; | ||
53 | calcWeek(d,week,year,onMonday); | ||
54 | labelWeek->setText("W: " + QString::number(week)); | ||
55 | |||
56 | QDate start=date; | ||
57 | QDate stop=start.addDays(6); | ||
58 | labelDate->setText( QString::number(start.day()) + " " + | ||
59 | start.monthName(start.month()) + " - " + | ||
60 | QString::number(stop.day()) + " " + | ||
61 | start.monthName(stop.month()) ); | ||
62 | emit dateChanged(year,week); | ||
63 | } | ||
64 | void DateBookWeekLstHeader::pickDate() { | ||
65 | static QPopupMenu *m1 = 0; | ||
66 | static DateBookMonth *picker = 0; | ||
67 | if ( !m1 ) { | ||
68 | m1 = new QPopupMenu( this ); | ||
69 | picker = new DateBookMonth( m1, 0, TRUE ); | ||
70 | m1->insertItem( picker ); | ||
71 | connect( picker, SIGNAL( dateClicked( int, int, int ) ), | ||
72 | this, SLOT( setDate( int, int, int ) ) ); | ||
73 | //connect( m1, SIGNAL( aboutToHide() ), | ||
74 | //this, SLOT( gotHide() ) ); | ||
75 | } | ||
76 | picker->setDate( date.year(), date.month(), date.day() ); | ||
77 | m1->popup(mapToGlobal(labelWeek->pos()+QPoint(0,labelWeek->height()))); | ||
78 | picker->setFocus(); | ||
79 | } | ||
80 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | ||
81 | QDate new_date(y,m,d); | ||
82 | setDate(new_date); | ||
83 | } | ||
84 | |||
85 | void DateBookWeekLstHeader::nextWeek() { | ||
86 | setDate(date.addDays(7)); | ||
87 | } | ||
88 | void DateBookWeekLstHeader::prevWeek() { | ||
89 | setDate(date.addDays(-7)); | ||
90 | } | ||
91 | |||
92 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, | ||
93 | QWidget* parent = 0, | ||
94 | const char* name = 0, | ||
95 | WFlags fl = 0 ) | ||
96 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | ||
97 | |||
98 | date=d; | ||
99 | |||
100 | static const char *wdays="MTWTFSS"; | ||
101 | char day=wdays[d.dayOfWeek()-1]; | ||
102 | |||
103 | label->setText( QString(QChar(day)) + " " + | ||
104 | QString::number(d.day()) ); | ||
105 | add->setText("+"); | ||
106 | |||
107 | if (d == QDate::currentDate()) { | ||
108 | QPalette pal=label->palette(); | ||
109 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | ||
110 | label->setPalette(pal); | ||
111 | |||
112 | /* | ||
113 | QFont f=label->font(); | ||
114 | f.setItalic(true); | ||
115 | label->setFont(f); | ||
116 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | ||
117 | */ | ||
118 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | ||
119 | QPalette pal=label->palette(); | ||
120 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | ||
121 | label->setPalette(pal); | ||
122 | } | ||
123 | |||
124 | |||
125 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | ||
126 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | ||
127 | } | ||
128 | |||
129 | void DateBookWeekLstDayHdr::showDay() { | ||
130 | emit showDate(date.year(), date.month(), date.day()); | ||
131 | } | ||
132 | void DateBookWeekLstDayHdr::newEvent() { | ||
133 | QDateTime start, stop; | ||
134 | start=stop=date; | ||
135 | start.setTime(QTime(10,0)); | ||
136 | stop.setTime(QTime(12,0)); | ||
137 | |||
138 | emit addEvent(start,stop,""); | ||
139 | } | ||
140 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | ||
141 | QWidget* parent = 0, | ||
142 | const char* name = 0, | ||
143 | WFlags fl = 0) : | ||
144 | ClickableLabel(parent,name,fl), | ||
145 | event(ev) | ||
146 | { | ||
147 | char s[10]; | ||
148 | if ( ev.startDate() != ev.date() ) { // multiday event (not first day) | ||
149 | if ( ev.endDate() == ev.date() ) { // last day | ||
150 | strcpy(s, "__|__"); | ||
151 | } else { | ||
152 | strcpy(s, " |---"); | ||
153 | } | ||
154 | } else { | ||
155 | sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
156 | } | ||
157 | setText(QString(s) + " " + ev.description()); | ||
158 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | ||
159 | } | ||
160 | void DateBookWeekLstEvent::editMe() { | ||
161 | emit editEvent(event.event()); | ||
162 | } | ||
163 | |||
164 | |||
165 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | ||
166 | QDate &d, bool onM, | ||
167 | QWidget* parent, | ||
168 | const char* name, WFlags fl) | ||
169 | : QWidget( parent, name, fl ) | ||
170 | { | ||
171 | onMonday=onM; | ||
172 | setPalette(white); | ||
173 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | ||
174 | |||
175 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
176 | |||
177 | qBubbleSort(ev); | ||
178 | QValueListIterator<EffectiveEvent> it; | ||
179 | it=ev.begin(); | ||
180 | |||
181 | int dayOrder[7]; | ||
182 | if (onMonday) | ||
183 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | ||
184 | else { | ||
185 | for (int d=0; d<7; d++) dayOrder[d]=d; | ||
186 | dayOrder[0]=7; | ||
187 | } | ||
188 | |||
189 | for (int i=0; i<7; i++) { | ||
190 | // Header | ||
191 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), | ||
192 | onMonday,this); | ||
193 | connect(hdr, SIGNAL(showDate(int,int,int)), | ||
194 | this, SIGNAL(showDate(int,int,int))); | ||
195 | connect(hdr, SIGNAL(addEvent(const QDateTime &, | ||
196 | const QDateTime &, | ||
197 | const QString &)), | ||
198 | this, SIGNAL(addEvent(const QDateTime &, | ||
199 | const QDateTime &, | ||
200 | const QString &))); | ||
201 | layout->addWidget(hdr); | ||
202 | |||
203 | // Events | ||
204 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | ||
205 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); | ||
206 | layout->addWidget(l); | ||
207 | connect (l, SIGNAL(editEvent(const Event &)), | ||
208 | this, SIGNAL(editEvent(const Event &))); | ||
209 | it++; | ||
210 | } | ||
211 | |||
212 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | ||
213 | } | ||
214 | } | ||
215 | DateBookWeekLstView::~DateBookWeekLstView(){} | ||
216 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | ||
217 | |||
218 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, | ||
219 | QWidget *parent, | ||
220 | const char *name ) | ||
221 | : QWidget( parent, name ), | ||
222 | db( newDB ), | ||
223 | startTime( 0 ), | ||
224 | ampm( ap ), | ||
225 | onMonday(onM) | ||
226 | { | ||
227 | setFocusPolicy(StrongFocus); | ||
228 | layout = new QVBoxLayout( this ); | ||
229 | layout->setMargin(0); | ||
230 | |||
231 | header=new DateBookWeekLstHeader(onM, this); | ||
232 | layout->addWidget( header ); | ||
233 | connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); | ||
234 | |||
235 | scroll=new QScrollView(this); | ||
236 | //scroll->setVScrollBarMode(QScrollView::AlwaysOn); | ||
237 | //scroll->setHScrollBarMode(QScrollView::AlwaysOff); | ||
238 | scroll->setResizePolicy(QScrollView::AutoOneFit); | ||
239 | layout->addWidget(scroll); | ||
240 | |||
241 | view=NULL; | ||
242 | } | ||
243 | |||
244 | |||
245 | void DateBookWeekLst::setDate( QDate &d ) { | ||
246 | int w,y; | ||
247 | calcWeek(d,w,y,onMonday); | ||
248 | year=y; | ||
249 | _week=w; | ||
250 | header->setDate(date()); | ||
251 | } | ||
252 | void DateBookWeekLst::redraw() {getEvents();} | ||
253 | |||
254 | QDate DateBookWeekLst::date() const { | ||
255 | QDate d; | ||
256 | d.setYMD(year,1,1); | ||
257 | |||
258 | int dow= d.dayOfWeek(); | ||
259 | if (!onMonday) | ||
260 | if (dow==7) dow=1; | ||
261 | else dow++; | ||
262 | |||
263 | d=d.addDays( (_week-1)*7 - dow + 1 ); | ||
264 | return d; | ||
265 | } | ||
266 | |||
267 | void DateBookWeekLst::getEvents() { | ||
268 | QDate start = date(); | ||
269 | QDate stop = start.addDays(6); | ||
270 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); | ||
271 | |||
272 | if (view) delete view; | ||
273 | view=new DateBookWeekLstView(el,start,onMonday,scroll); | ||
274 | |||
275 | connect (view, SIGNAL(editEvent(const Event &)), | ||
276 | this, SIGNAL(editEvent(const Event &))); | ||
277 | connect (view, SIGNAL(showDate(int,int,int)), | ||
278 | this, SIGNAL(showDate(int,int,int))); | ||
279 | connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
280 | const QString &)), | ||
281 | this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, | ||
282 | const QString &))); | ||
283 | |||
284 | scroll->addChild(view); | ||
285 | view->show(); | ||
286 | scroll->updateScrollBars(); | ||
287 | } | ||
288 | |||
289 | void DateBookWeekLst::dateChanged(int y, int w) { | ||
290 | year=y; | ||
291 | _week=w; | ||
292 | getEvents(); | ||
293 | } | ||
294 | |||
295 | void DateBookWeekLst::keyPressEvent(QKeyEvent *e) | ||
296 | { | ||
297 | switch(e->key()) { | ||
298 | case Key_Up: | ||
299 | scroll->scrollBy(0, -20); | ||
300 | break; | ||
301 | case Key_Down: | ||
302 | scroll->scrollBy(0, 20); | ||
303 | break; | ||
304 | case Key_Left: | ||
305 | header->prevWeek(); | ||
306 | break; | ||
307 | case Key_Right: | ||
308 | header->nextWeek(); | ||
309 | break; | ||
310 | default: | ||
311 | e->ignore(); | ||
312 | } | ||
313 | } | ||
314 | |||
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h new file mode 100644 index 0000000..d2a07cc --- a/dev/null +++ b/core/pim/datebook/datebookweeklst.h | |||
@@ -0,0 +1,131 @@ | |||
1 | #ifndef DATEBOOKWEEKLST | ||
2 | #define DATEBOOKWEEKLST | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | #include <qdatetime.h> | ||
6 | #include <qpe/event.h> | ||
7 | #include <qlabel.h> | ||
8 | #include <qscrollview.h> | ||
9 | |||
10 | #include "datebookweeklstheader.h" | ||
11 | #include "datebookweeklstdayhdr.h" | ||
12 | |||
13 | #include "clickablelabel.h" | ||
14 | |||
15 | class QDateTime; | ||
16 | class DateBookDB; | ||
17 | |||
18 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase | ||
19 | { | ||
20 | Q_OBJECT | ||
21 | public: | ||
22 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, | ||
23 | WFlags fl = 0 ); | ||
24 | ~DateBookWeekLstHeader(); | ||
25 | void setDate(QDate d); | ||
26 | |||
27 | public slots: | ||
28 | void nextWeek(); | ||
29 | void prevWeek(); | ||
30 | void pickDate(); | ||
31 | void setDate(int y, int m, int d); | ||
32 | signals: | ||
33 | void dateChanged(int y, int w); | ||
34 | private: | ||
35 | QDate date; | ||
36 | bool onMonday; | ||
37 | }; | ||
38 | |||
39 | class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase | ||
40 | { | ||
41 | Q_OBJECT | ||
42 | public: | ||
43 | DateBookWeekLstDayHdr(const QDate &d, bool onM, | ||
44 | QWidget* parent = 0, const char* name = 0, | ||
45 | WFlags fl = 0 ); | ||
46 | public slots: | ||
47 | void showDay(); | ||
48 | void newEvent(); | ||
49 | signals: | ||
50 | void showDate(int y, int m, int d); | ||
51 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
52 | const QString &str); | ||
53 | private: | ||
54 | QDate date; | ||
55 | }; | ||
56 | |||
57 | class DateBookWeekLstEvent: public ClickableLabel | ||
58 | { | ||
59 | Q_OBJECT | ||
60 | public: | ||
61 | DateBookWeekLstEvent(const EffectiveEvent &ev, | ||
62 | QWidget* parent = 0, const char* name = 0, | ||
63 | WFlags fl = 0); | ||
64 | signals: | ||
65 | void editEvent(const Event &e); | ||
66 | private slots: | ||
67 | void editMe(); | ||
68 | private: | ||
69 | const EffectiveEvent event; | ||
70 | }; | ||
71 | |||
72 | class DateBookWeekLstView: public QWidget | ||
73 | { | ||
74 | Q_OBJECT | ||
75 | public: | ||
76 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, QDate &d, bool onM, | ||
77 | QWidget* parent = 0, const char* name = 0, | ||
78 | WFlags fl = 0 ); | ||
79 | ~DateBookWeekLstView(); | ||
80 | signals: | ||
81 | void editEvent(const Event &e); | ||
82 | void showDate(int y, int m, int d); | ||
83 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
84 | const QString &str); | ||
85 | private: | ||
86 | bool onMonday; | ||
87 | protected slots: | ||
88 | void keyPressEvent(QKeyEvent *); | ||
89 | }; | ||
90 | |||
91 | class DateBookWeekLst : public QWidget | ||
92 | { | ||
93 | Q_OBJECT | ||
94 | |||
95 | public: | ||
96 | DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, | ||
97 | QWidget *parent = 0, | ||
98 | const char *name = 0 ); | ||
99 | void setDate( int y, int w ); | ||
100 | void setDate( QDate &d ); | ||
101 | int week() const { return _week; }; | ||
102 | QDate date() const; | ||
103 | |||
104 | public slots: | ||
105 | void redraw(); | ||
106 | void dateChanged(int y, int w); | ||
107 | protected slots: | ||
108 | void keyPressEvent(QKeyEvent *); | ||
109 | |||
110 | signals: | ||
111 | void showDate(int y, int m, int d); | ||
112 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
113 | const QString &str); | ||
114 | void editEvent(const Event &e); | ||
115 | |||
116 | private: | ||
117 | DateBookDB *db; | ||
118 | int startTime; | ||
119 | bool ampm; | ||
120 | bool onMonday; | ||
121 | int year, _week; | ||
122 | DateBookWeekLstHeader *header; | ||
123 | DateBookWeekLstView *view; | ||
124 | QVBoxLayout *layout; | ||
125 | QScrollView *scroll; | ||
126 | |||
127 | void getEvents(); | ||
128 | }; | ||
129 | |||
130 | #endif | ||
131 | |||
diff --git a/core/pim/datebook/datebookweeklstdayhdr.ui b/core/pim/datebook/datebookweeklstdayhdr.ui new file mode 100644 index 0000000..3b88495 --- a/dev/null +++ b/core/pim/datebook/datebookweeklstdayhdr.ui | |||
@@ -0,0 +1,149 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>DateBookWeekLstDayHdrBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>DateBookWeekLstDayHdrBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>106</y> | ||
14 | <width>621</width> | ||
15 | <height>5</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>sizePolicy</name> | ||
20 | <sizepolicy> | ||
21 | <hsizetype>7</hsizetype> | ||
22 | <vsizetype>0</vsizetype> | ||
23 | </sizepolicy> | ||
24 | </property> | ||
25 | <property stdset="1"> | ||
26 | <name>caption</name> | ||
27 | <string>Form1</string> | ||
28 | </property> | ||
29 | <property> | ||
30 | <name>layoutMargin</name> | ||
31 | </property> | ||
32 | <hbox> | ||
33 | <property stdset="1"> | ||
34 | <name>margin</name> | ||
35 | <number>0</number> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>spacing</name> | ||
39 | <number>6</number> | ||
40 | </property> | ||
41 | <widget> | ||
42 | <class>Line</class> | ||
43 | <property stdset="1"> | ||
44 | <name>name</name> | ||
45 | <cstring>Line1</cstring> | ||
46 | </property> | ||
47 | <property stdset="1"> | ||
48 | <name>minimumSize</name> | ||
49 | <size> | ||
50 | <width>0</width> | ||
51 | <height>0</height> | ||
52 | </size> | ||
53 | </property> | ||
54 | <property stdset="1"> | ||
55 | <name>maximumSize</name> | ||
56 | <size> | ||
57 | <width>32767</width> | ||
58 | <height>32767</height> | ||
59 | </size> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>orientation</name> | ||
63 | <enum>Horizontal</enum> | ||
64 | </property> | ||
65 | </widget> | ||
66 | <widget> | ||
67 | <class>ClickableLabel</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>label</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>sizePolicy</name> | ||
74 | <sizepolicy> | ||
75 | <hsizetype>0</hsizetype> | ||
76 | <vsizetype>0</vsizetype> | ||
77 | </sizepolicy> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>font</name> | ||
81 | <font> | ||
82 | <bold>1</bold> | ||
83 | </font> | ||
84 | </property> | ||
85 | </widget> | ||
86 | <widget> | ||
87 | <class>Line</class> | ||
88 | <property stdset="1"> | ||
89 | <name>name</name> | ||
90 | <cstring>Line1_2</cstring> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>minimumSize</name> | ||
94 | <size> | ||
95 | <width>0</width> | ||
96 | <height>0</height> | ||
97 | </size> | ||
98 | </property> | ||
99 | <property stdset="1"> | ||
100 | <name>maximumSize</name> | ||
101 | <size> | ||
102 | <width>32767</width> | ||
103 | <height>32767</height> | ||
104 | </size> | ||
105 | </property> | ||
106 | <property stdset="1"> | ||
107 | <name>orientation</name> | ||
108 | <enum>Horizontal</enum> | ||
109 | </property> | ||
110 | </widget> | ||
111 | <widget> | ||
112 | <class>ClickableLabel</class> | ||
113 | <property stdset="1"> | ||
114 | <name>name</name> | ||
115 | <cstring>add</cstring> | ||
116 | </property> | ||
117 | <property stdset="1"> | ||
118 | <name>sizePolicy</name> | ||
119 | <sizepolicy> | ||
120 | <hsizetype>0</hsizetype> | ||
121 | <vsizetype>0</vsizetype> | ||
122 | </sizepolicy> | ||
123 | </property> | ||
124 | </widget> | ||
125 | </hbox> | ||
126 | </widget> | ||
127 | <customwidgets> | ||
128 | <customwidget> | ||
129 | <class>ClickableLabel</class> | ||
130 | <header location="local">clickablelabel.h</header> | ||
131 | <sizehint> | ||
132 | <width>-1</width> | ||
133 | <height>-1</height> | ||
134 | </sizehint> | ||
135 | <container>0</container> | ||
136 | <sizepolicy> | ||
137 | <hordata>5</hordata> | ||
138 | <verdata>5</verdata> | ||
139 | </sizepolicy> | ||
140 | <pixmap>image0</pixmap> | ||
141 | </customwidget> | ||
142 | </customwidgets> | ||
143 | <images> | ||
144 | <image> | ||
145 | <name>image0</name> | ||
146 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
147 | </image> | ||
148 | </images> | ||
149 | </UI> | ||
diff --git a/core/pim/datebook/datebookweeklstheader.ui b/core/pim/datebook/datebookweeklstheader.ui new file mode 100644 index 0000000..666e896 --- a/dev/null +++ b/core/pim/datebook/datebookweeklstheader.ui | |||
@@ -0,0 +1,238 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>DateBookWeekLstHeaderBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>DateBookWeekLstHeaderBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>51</y> | ||
14 | <width>535</width> | ||
15 | <height>25</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>sizePolicy</name> | ||
20 | <sizepolicy> | ||
21 | <hsizetype>7</hsizetype> | ||
22 | <vsizetype>0</vsizetype> | ||
23 | </sizepolicy> | ||
24 | </property> | ||
25 | <property stdset="1"> | ||
26 | <name>caption</name> | ||
27 | <string>Form2</string> | ||
28 | </property> | ||
29 | <property> | ||
30 | <name>layoutMargin</name> | ||
31 | </property> | ||
32 | <property> | ||
33 | <name>layoutSpacing</name> | ||
34 | </property> | ||
35 | <hbox> | ||
36 | <property stdset="1"> | ||
37 | <name>margin</name> | ||
38 | <number>0</number> | ||
39 | </property> | ||
40 | <property stdset="1"> | ||
41 | <name>spacing</name> | ||
42 | <number>6</number> | ||
43 | </property> | ||
44 | <widget> | ||
45 | <class>QToolButton</class> | ||
46 | <property stdset="1"> | ||
47 | <name>name</name> | ||
48 | <cstring>back</cstring> | ||
49 | </property> | ||
50 | <property stdset="1"> | ||
51 | <name>sizePolicy</name> | ||
52 | <sizepolicy> | ||
53 | <hsizetype>1</hsizetype> | ||
54 | <vsizetype>0</vsizetype> | ||
55 | </sizepolicy> | ||
56 | </property> | ||
57 | <property stdset="1"> | ||
58 | <name>text</name> | ||
59 | <string></string> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>pixmap</name> | ||
63 | <pixmap>image0</pixmap> | ||
64 | </property> | ||
65 | <property stdset="1"> | ||
66 | <name>autoRepeat</name> | ||
67 | <bool>true</bool> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>autoRaise</name> | ||
71 | <bool>true</bool> | ||
72 | </property> | ||
73 | </widget> | ||
74 | <spacer> | ||
75 | <property> | ||
76 | <name>name</name> | ||
77 | <cstring>Spacer1_3</cstring> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>orientation</name> | ||
81 | <enum>Horizontal</enum> | ||
82 | </property> | ||
83 | <property stdset="1"> | ||
84 | <name>sizeType</name> | ||
85 | <enum>Expanding</enum> | ||
86 | </property> | ||
87 | <property> | ||
88 | <name>sizeHint</name> | ||
89 | <size> | ||
90 | <width>20</width> | ||
91 | <height>20</height> | ||
92 | </size> | ||
93 | </property> | ||
94 | </spacer> | ||
95 | <widget> | ||
96 | <class>QToolButton</class> | ||
97 | <property stdset="1"> | ||
98 | <name>name</name> | ||
99 | <cstring>labelWeek</cstring> | ||
100 | </property> | ||
101 | <property stdset="1"> | ||
102 | <name>sizePolicy</name> | ||
103 | <sizepolicy> | ||
104 | <hsizetype>7</hsizetype> | ||
105 | <vsizetype>0</vsizetype> | ||
106 | </sizepolicy> | ||
107 | </property> | ||
108 | <property stdset="1"> | ||
109 | <name>font</name> | ||
110 | <font> | ||
111 | <bold>1</bold> | ||
112 | </font> | ||
113 | </property> | ||
114 | <property stdset="1"> | ||
115 | <name>text</name> | ||
116 | <string>W: 00,00</string> | ||
117 | </property> | ||
118 | <property stdset="1"> | ||
119 | <name>autoRaise</name> | ||
120 | <bool>false</bool> | ||
121 | </property> | ||
122 | </widget> | ||
123 | <spacer> | ||
124 | <property> | ||
125 | <name>name</name> | ||
126 | <cstring>Spacer1</cstring> | ||
127 | </property> | ||
128 | <property stdset="1"> | ||
129 | <name>orientation</name> | ||
130 | <enum>Horizontal</enum> | ||
131 | </property> | ||
132 | <property stdset="1"> | ||
133 | <name>sizeType</name> | ||
134 | <enum>Expanding</enum> | ||
135 | </property> | ||
136 | <property> | ||
137 | <name>sizeHint</name> | ||
138 | <size> | ||
139 | <width>20</width> | ||
140 | <height>20</height> | ||
141 | </size> | ||
142 | </property> | ||
143 | </spacer> | ||
144 | <widget> | ||
145 | <class>QLabel</class> | ||
146 | <property stdset="1"> | ||
147 | <name>name</name> | ||
148 | <cstring>labelDate</cstring> | ||
149 | </property> | ||
150 | <property stdset="1"> | ||
151 | <name>sizePolicy</name> | ||
152 | <sizepolicy> | ||
153 | <hsizetype>3</hsizetype> | ||
154 | <vsizetype>7</vsizetype> | ||
155 | </sizepolicy> | ||
156 | </property> | ||
157 | <property stdset="1"> | ||
158 | <name>font</name> | ||
159 | <font> | ||
160 | <bold>1</bold> | ||
161 | </font> | ||
162 | </property> | ||
163 | <property stdset="1"> | ||
164 | <name>text</name> | ||
165 | <string>00 Jan-00 Jan</string> | ||
166 | </property> | ||
167 | <property stdset="1"> | ||
168 | <name>alignment</name> | ||
169 | <set>AlignCenter</set> | ||
170 | </property> | ||
171 | <property> | ||
172 | <name>hAlign</name> | ||
173 | </property> | ||
174 | </widget> | ||
175 | <spacer> | ||
176 | <property> | ||
177 | <name>name</name> | ||
178 | <cstring>Spacer1_2</cstring> | ||
179 | </property> | ||
180 | <property stdset="1"> | ||
181 | <name>orientation</name> | ||
182 | <enum>Horizontal</enum> | ||
183 | </property> | ||
184 | <property stdset="1"> | ||
185 | <name>sizeType</name> | ||
186 | <enum>Expanding</enum> | ||
187 | </property> | ||
188 | <property> | ||
189 | <name>sizeHint</name> | ||
190 | <size> | ||
191 | <width>20</width> | ||
192 | <height>20</height> | ||
193 | </size> | ||
194 | </property> | ||
195 | </spacer> | ||
196 | <widget> | ||
197 | <class>QToolButton</class> | ||
198 | <property stdset="1"> | ||
199 | <name>name</name> | ||
200 | <cstring>forward</cstring> | ||
201 | </property> | ||
202 | <property stdset="1"> | ||
203 | <name>sizePolicy</name> | ||
204 | <sizepolicy> | ||
205 | <hsizetype>1</hsizetype> | ||
206 | <vsizetype>0</vsizetype> | ||
207 | </sizepolicy> | ||
208 | </property> | ||
209 | <property stdset="1"> | ||
210 | <name>text</name> | ||
211 | <string></string> | ||
212 | </property> | ||
213 | <property stdset="1"> | ||
214 | <name>pixmap</name> | ||
215 | <pixmap>image1</pixmap> | ||
216 | </property> | ||
217 | <property stdset="1"> | ||
218 | <name>autoRepeat</name> | ||
219 | <bool>true</bool> | ||
220 | </property> | ||
221 | <property stdset="1"> | ||
222 | <name>autoRaise</name> | ||
223 | <bool>true</bool> | ||
224 | </property> | ||
225 | </widget> | ||
226 | </hbox> | ||
227 | </widget> | ||
228 | <images> | ||
229 | <image> | ||
230 | <name>image0</name> | ||
231 | <data format="XPM.GZ" length="582">789c6dcfcd4e843010c0f13b4fd1d01b31bb6cb325211b1f41e3d1c4789876a60bcbd7aeae07637c773b6d5985d870e0f7ef50605b88e7a707516cb3f72b5c5b2b6c036fa2c08f61f87c79bdffcaf2dd5ef0558b5d7e97e51b61c5e33412df4b7f2fcbb09896a94ab557817063cd744cad74a915734aac35308740d018d9332d5ab0c8ec1229f2c2448d156a661b489ee1ab4e4cf2a08a790e24020abb0dd355442eec8e914e45526215790c749e8e89891069125de466b1fe14295705ccaa5863e2d05cc01894925b2a7e8217dd8a631eb169fd509af10fd1a9ebfbdf32008d9d0c07cd274f70ee162773ba2cdfee935c977ffe6b2edf87ec07796f81cd</data> | ||
232 | </image> | ||
233 | <image> | ||
234 | <name>image1</name> | ||
235 | <data format="XPM.GZ" length="627">789c7dcfc94ec3301006e07b9ec28a6f114a13cbb1a8108f00e28884387819676993340b07847877329ea8697a60ec83bfdf232f8784bdbfbdb0e4104db39e6bcb6ca54796b8afb6fdfef87cfe89e25cb2650ac1f2f8218a5366d96bdf01aef9b2e65928a4458a0c07b25c29890352e63293e19c53a0968f52230159e8c22981744495133552097554a1f982b4ce6aeb9013d215165c81ec894e109b4070ca85378f2b35f18c04050214b20d04d010762ba457003eecd6442f88f34a45f4817ea147762b35d1acf4c47457d784737d9f18ebee1363614bf852c6f812b6c460f90abb6e93ba694ed7c49fdbaeee2f76b83da71ba772e0db5d9ccf4b07dfdd5e858edd9b2948fff9d796fc3e457f660e8d47</data> | ||
236 | </image> | ||
237 | </images> | ||
238 | </UI> | ||
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui index 0c363a4..eac4e23 100644 --- a/core/pim/datebook/dateentry.ui +++ b/core/pim/datebook/dateentry.ui | |||
@@ -94,7 +94,7 @@ | |||
94 | <item> | 94 | <item> |
95 | <property> | 95 | <property> |
96 | <name>text</name> | 96 | <name>text</name> |
97 | <string>(None)</string> | 97 | <string></string> |
98 | </property> | 98 | </property> |
99 | </item> | 99 | </item> |
100 | <item> | 100 | <item> |
@@ -161,7 +161,7 @@ | |||
161 | <item> | 161 | <item> |
162 | <property> | 162 | <property> |
163 | <name>text</name> | 163 | <name>text</name> |
164 | <string>(Unknown)</string> | 164 | <string></string> |
165 | </property> | 165 | </property> |
166 | </item> | 166 | </item> |
167 | <item> | 167 | <item> |
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 1122f79..b2e3e3a 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -41,6 +41,8 @@ | |||
41 | 41 | ||
42 | #include <stdlib.h> | 42 | #include <stdlib.h> |
43 | 43 | ||
44 | #include <stdiostream.h> | ||
45 | |||
44 | /* | 46 | /* |
45 | * Constructs a DateEntry which is a child of 'parent', with the | 47 | * Constructs a DateEntry which is a child of 'parent', with the |
46 | * name 'name' and widget flags set to 'f' | 48 | * name 'name' and widget flags set to 'f' |
@@ -58,6 +60,7 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | |||
58 | { | 60 | { |
59 | init(); | 61 | init(); |
60 | setDates(start,end); | 62 | setDates(start,end); |
63 | setFocusProxy(comboDescription); | ||
61 | } | 64 | } |
62 | 65 | ||
63 | static void addOrPick( QComboBox* combo, const QString& t ) | 66 | static void addOrPick( QComboBox* combo, const QString& t ) |
@@ -176,6 +179,7 @@ void DateEntry::init() | |||
176 | DateEntry::~DateEntry() | 179 | DateEntry::~DateEntry() |
177 | { | 180 | { |
178 | // no need to delete child widgets, Qt does it all for us | 181 | // no need to delete child widgets, Qt does it all for us |
182 | //cout << "Del: " << comboStart->currentText() << endl; | ||
179 | } | 183 | } |
180 | 184 | ||
181 | /* | 185 | /* |
@@ -270,6 +274,7 @@ void DateEntry::startTimeChanged( int index ) | |||
270 | { | 274 | { |
271 | startTime = parseTime(comboStart->text(index),ampm); | 275 | startTime = parseTime(comboStart->text(index),ampm); |
272 | changeEndCombo( index ); | 276 | changeEndCombo( index ); |
277 | //cout << "Start: " << comboStart->currentText() << endl; | ||
273 | } | 278 | } |
274 | /* | 279 | /* |
275 | * public slot | 280 | * public slot |
@@ -382,6 +387,9 @@ Event DateEntry::event() | |||
382 | if ( rp.type != Event::NoRepeat ) | 387 | if ( rp.type != Event::NoRepeat ) |
383 | ev.setRepeat( TRUE, rp ); | 388 | ev.setRepeat( TRUE, rp ); |
384 | ev.setNotes( editNote->text() ); | 389 | ev.setNotes( editNote->text() ); |
390 | |||
391 | //cout << "Start: " << comboStart->currentText() << endl; | ||
392 | |||
385 | return ev; | 393 | return ev; |
386 | } | 394 | } |
387 | 395 | ||