Diffstat (limited to 'core/pim/datebook/modules/weeklst') (more/less context) (show whitespace changes)
15 files changed, 1167 insertions, 0 deletions
diff --git a/core/pim/datebook/modules/weeklst/.cvsignore b/core/pim/datebook/modules/weeklst/.cvsignore new file mode 100644 index 0000000..2da0b2b --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/.cvsignore | |||
@@ -0,0 +1,4 @@ | |||
1 | datebookweeklstdayhdrbase.cpp | ||
2 | datebookweeklstdayhdrbase.h | ||
3 | datebookweeklstheaderbase.cpp | ||
4 | datebookweeklstheaderbase.h | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp new file mode 100644 index 0000000..47bc597 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp | |||
@@ -0,0 +1,138 @@ | |||
1 | #include "namespace_hack.h" | ||
2 | #include "datebookweeklst.h" | ||
3 | #include "datebookweeklstheader.h" | ||
4 | #include "datebookweeklstview.h" | ||
5 | #include "datebookweeklstdblview.h" | ||
6 | |||
7 | #include "datebook.h" | ||
8 | |||
9 | #include <opie2/odebug.h> | ||
10 | |||
11 | #include <qpe/datebookmonth.h> | ||
12 | #include <qpe/config.h> | ||
13 | #include <qpe/resource.h> | ||
14 | |||
15 | #include <qlayout.h> | ||
16 | #include <qtoolbutton.h> | ||
17 | |||
18 | using namespace Opie::Ui; | ||
19 | |||
20 | DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, | ||
21 | QWidget *parent, | ||
22 | const char *name ) | ||
23 | : QWidget( parent, name ), | ||
24 | db( newDB ), | ||
25 | startTime( 0 ), | ||
26 | ampm( ap ), | ||
27 | bStartOnMonday(onM) | ||
28 | { | ||
29 | setFocusPolicy(StrongFocus); | ||
30 | layout = new QVBoxLayout( this ); | ||
31 | layout->setMargin(0); | ||
32 | |||
33 | header=new DateBookWeekLstHeader(onM, this); | ||
34 | layout->addWidget( header ); | ||
35 | connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); | ||
36 | connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); | ||
37 | |||
38 | scroll=new QScrollView(this); | ||
39 | scroll->setResizePolicy(QScrollView::AutoOneFit); | ||
40 | layout->addWidget(scroll); | ||
41 | |||
42 | view=NULL; | ||
43 | Config config("DateBook"); | ||
44 | config.setGroup("Main"); | ||
45 | dbl=config.readBoolEntry("weeklst_dbl", false); | ||
46 | header->dbl->setOn(dbl); | ||
47 | } | ||
48 | DateBookWeekLst::~DateBookWeekLst(){ | ||
49 | Config config("DateBook"); | ||
50 | config.setGroup("Main"); | ||
51 | config.writeEntry("weeklst_dbl", dbl); | ||
52 | } | ||
53 | |||
54 | void DateBookWeekLst::setDate(const QDate &d) { | ||
55 | bdate=d; | ||
56 | header->setDate(d); | ||
57 | } | ||
58 | |||
59 | void DateBookWeekLst::setDbl(bool on) { | ||
60 | dbl=on; | ||
61 | redraw(); | ||
62 | } | ||
63 | void DateBookWeekLst::redraw() {getEvents();} | ||
64 | |||
65 | QDate DateBookWeekLst::date() { | ||
66 | return bdate; | ||
67 | } | ||
68 | |||
69 | // return the date at the beginning of the week... | ||
70 | // copied from DateBookWeek | ||
71 | QDate DateBookWeekLst::weekDate() const | ||
72 | { | ||
73 | QDate d=bdate; | ||
74 | |||
75 | // Calculate offset to first day of week. | ||
76 | int dayoffset=d.dayOfWeek(); | ||
77 | if(bStartOnMonday) dayoffset--; | ||
78 | else if( dayoffset == 7 ) | ||
79 | dayoffset = 0; | ||
80 | |||
81 | return d.addDays(-dayoffset); | ||
82 | } | ||
83 | |||
84 | void DateBookWeekLst::getEvents() { | ||
85 | QDate start = weekDate(); //date(); | ||
86 | QDate stop = start.addDays(6); | ||
87 | QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); | ||
88 | |||
89 | setUpdatesEnabled(false); | ||
90 | if (view) delete view; | ||
91 | if (dbl) { | ||
92 | QDate start2=start.addDays(7); | ||
93 | stop=start2.addDays(6); | ||
94 | QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); | ||
95 | view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); | ||
96 | } else { | ||
97 | view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); | ||
98 | } | ||
99 | |||
100 | connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
101 | connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
102 | connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
103 | connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
104 | connect (view, SIGNAL(redraw()), this, SLOT(redraw())); | ||
105 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
106 | connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
107 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | ||
108 | |||
109 | scroll->addChild(view); | ||
110 | view->show(); | ||
111 | scroll->updateScrollBars(); | ||
112 | setUpdatesEnabled(true); | ||
113 | } | ||
114 | |||
115 | void DateBookWeekLst::dateChanged(QDate &newdate) { | ||
116 | bdate=newdate; | ||
117 | getEvents(); | ||
118 | } | ||
119 | |||
120 | void DateBookWeekLst::keyPressEvent(QKeyEvent *e) | ||
121 | { | ||
122 | switch(e->key()) { | ||
123 | case Key_Up: | ||
124 | scroll->scrollBy(0, -20); | ||
125 | break; | ||
126 | case Key_Down: | ||
127 | scroll->scrollBy(0, 20); | ||
128 | break; | ||
129 | case Key_Left: | ||
130 | header->prevWeek(); | ||
131 | break; | ||
132 | case Key_Right: | ||
133 | header->nextWeek(); | ||
134 | break; | ||
135 | default: | ||
136 | e->ignore(); | ||
137 | } | ||
138 | } | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.h b/core/pim/datebook/modules/weeklst/datebookweeklst.h new file mode 100644 index 0000000..3922fa1 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklst.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef DATEBOOKWEEKLST | ||
2 | #define DATEBOOKWEEKLST | ||
3 | |||
4 | #include <qpe/event.h> | ||
5 | |||
6 | #include <qwidget.h> | ||
7 | #include <qdatetime.h> | ||
8 | |||
9 | class DateBookDB; | ||
10 | class DateBookDBHoliday; | ||
11 | class DateBookWeekLstHeader; | ||
12 | class DateBookWeekLstEvent; | ||
13 | class DateBookWeekLstView; | ||
14 | class QVBoxLayout; | ||
15 | class QScrollView; | ||
16 | |||
17 | class DateBookWeekLst : public QWidget | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | |||
21 | public: | ||
22 | DateBookWeekLst( bool ampm, bool onM, DateBookDBHoliday *newDB, | ||
23 | QWidget *parent = 0, | ||
24 | const char *name = 0 ); | ||
25 | ~DateBookWeekLst(); | ||
26 | void setDate( int y, int w ); | ||
27 | void setDate(const QDate &d ); | ||
28 | int week() const { return _week; }; | ||
29 | QDate date(); | ||
30 | QDate weekDate() const; | ||
31 | |||
32 | public slots: | ||
33 | void redraw(); | ||
34 | void dateChanged(QDate &date); | ||
35 | |||
36 | protected slots: | ||
37 | void keyPressEvent(QKeyEvent *); | ||
38 | void setDbl(bool on); | ||
39 | |||
40 | signals: | ||
41 | void showDate(int y, int m, int d); | ||
42 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
43 | const QString &str, const QString &location); | ||
44 | void editEvent(const Event &e); | ||
45 | void duplicateEvent(const Event &e); | ||
46 | void removeEvent(const Event &e); | ||
47 | void beamEvent(const Event &e); | ||
48 | |||
49 | private: | ||
50 | DateBookDBHoliday *db; | ||
51 | int startTime; | ||
52 | bool ampm; | ||
53 | bool bStartOnMonday; | ||
54 | bool dbl; | ||
55 | QDate bdate; | ||
56 | int year, _week,dow; | ||
57 | DateBookWeekLstHeader *header; | ||
58 | QWidget *view; | ||
59 | QVBoxLayout *layout; | ||
60 | QScrollView *scroll; | ||
61 | |||
62 | void getEvents(); | ||
63 | }; | ||
64 | |||
65 | #endif | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdayhdr.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstdayhdr.cpp new file mode 100644 index 0000000..d173444 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstdayhdr.cpp | |||
@@ -0,0 +1,53 @@ | |||
1 | #include "datebookweeklstdayhdr.h" | ||
2 | |||
3 | #include "namespace_hack.h" | ||
4 | |||
5 | DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | ||
6 | QWidget* parent, | ||
7 | const char* name, | ||
8 | WFlags fl ) | ||
9 | : DateBookWeekLstDayHdrBase(parent, name, fl) { | ||
10 | |||
11 | date=d; | ||
12 | |||
13 | static const QString wdays=tr("MTWTFSSM", "Week days"); | ||
14 | char day=wdays[d.dayOfWeek()-1]; | ||
15 | |||
16 | //dont use dayOfWeek() to save space ! | ||
17 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); | ||
18 | |||
19 | add->setText("+"); | ||
20 | |||
21 | if (d == QDate::currentDate()) { | ||
22 | QPalette pal=label->palette(); | ||
23 | pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); | ||
24 | label->setPalette(pal); | ||
25 | |||
26 | /* | ||
27 | QFont f=label->font(); | ||
28 | f.setItalic(true); | ||
29 | label->setFont(f); | ||
30 | label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); | ||
31 | */ | ||
32 | } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday | ||
33 | QPalette pal=label->palette(); | ||
34 | pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); | ||
35 | label->setPalette(pal); | ||
36 | } | ||
37 | |||
38 | connect (label, SIGNAL(clicked()), this, SLOT(showDay())); | ||
39 | connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); | ||
40 | } | ||
41 | |||
42 | void DateBookWeekLstDayHdr::showDay() { | ||
43 | emit showDate(date.year(), date.month(), date.day()); | ||
44 | } | ||
45 | |||
46 | void DateBookWeekLstDayHdr::newEvent() { | ||
47 | QDateTime start, stop; | ||
48 | start=stop=date; | ||
49 | start.setTime(QTime(10,0)); | ||
50 | stop.setTime(QTime(12,0)); | ||
51 | |||
52 | emit addEvent(start,stop,"",0); | ||
53 | } | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdayhdr.h b/core/pim/datebook/modules/weeklst/datebookweeklstdayhdr.h new file mode 100644 index 0000000..de046d8 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstdayhdr.h | |||
@@ -0,0 +1,26 @@ | |||
1 | #ifndef _DATEBOOKWEEKLSTDAYHDR_H | ||
2 | #define _DATEBOOKWEEKLSTDAYHDR_H | ||
3 | |||
4 | #include "datebookweeklstdayhdrbase.h" | ||
5 | |||
6 | #include <qdatetime.h> | ||
7 | |||
8 | class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase | ||
9 | { | ||
10 | Q_OBJECT | ||
11 | public: | ||
12 | DateBookWeekLstDayHdr(const QDate &d, bool onM, | ||
13 | QWidget* parent = 0, const char* name = 0, | ||
14 | WFlags fl = 0 ); | ||
15 | public slots: | ||
16 | void showDay(); | ||
17 | void newEvent(); | ||
18 | signals: | ||
19 | void showDate(int y, int m, int d); | ||
20 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
21 | const QString &str, const QString &location); | ||
22 | private: | ||
23 | QDate date; | ||
24 | }; | ||
25 | |||
26 | #endif | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdayhdrbase.ui b/core/pim/datebook/modules/weeklst/datebookweeklstdayhdrbase.ui new file mode 100644 index 0000000..74ea584 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstdayhdrbase.ui | |||
@@ -0,0 +1,145 @@ | |||
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> | ||
26 | <name>layoutMargin</name> | ||
27 | </property> | ||
28 | <hbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>0</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>6</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>Line</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Line1</cstring> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>minimumSize</name> | ||
45 | <size> | ||
46 | <width>0</width> | ||
47 | <height>0</height> | ||
48 | </size> | ||
49 | </property> | ||
50 | <property stdset="1"> | ||
51 | <name>maximumSize</name> | ||
52 | <size> | ||
53 | <width>32767</width> | ||
54 | <height>32767</height> | ||
55 | </size> | ||
56 | </property> | ||
57 | <property stdset="1"> | ||
58 | <name>orientation</name> | ||
59 | <enum>Horizontal</enum> | ||
60 | </property> | ||
61 | </widget> | ||
62 | <widget> | ||
63 | <class>ClickableLabel</class> | ||
64 | <property stdset="1"> | ||
65 | <name>name</name> | ||
66 | <cstring>label</cstring> | ||
67 | </property> | ||
68 | <property stdset="1"> | ||
69 | <name>sizePolicy</name> | ||
70 | <sizepolicy> | ||
71 | <hsizetype>0</hsizetype> | ||
72 | <vsizetype>0</vsizetype> | ||
73 | </sizepolicy> | ||
74 | </property> | ||
75 | <property stdset="1"> | ||
76 | <name>font</name> | ||
77 | <font> | ||
78 | <bold>1</bold> | ||
79 | </font> | ||
80 | </property> | ||
81 | </widget> | ||
82 | <widget> | ||
83 | <class>Line</class> | ||
84 | <property stdset="1"> | ||
85 | <name>name</name> | ||
86 | <cstring>Line1_2</cstring> | ||
87 | </property> | ||
88 | <property stdset="1"> | ||
89 | <name>minimumSize</name> | ||
90 | <size> | ||
91 | <width>0</width> | ||
92 | <height>0</height> | ||
93 | </size> | ||
94 | </property> | ||
95 | <property stdset="1"> | ||
96 | <name>maximumSize</name> | ||
97 | <size> | ||
98 | <width>32767</width> | ||
99 | <height>32767</height> | ||
100 | </size> | ||
101 | </property> | ||
102 | <property stdset="1"> | ||
103 | <name>orientation</name> | ||
104 | <enum>Horizontal</enum> | ||
105 | </property> | ||
106 | </widget> | ||
107 | <widget> | ||
108 | <class>ClickableLabel</class> | ||
109 | <property stdset="1"> | ||
110 | <name>name</name> | ||
111 | <cstring>add</cstring> | ||
112 | </property> | ||
113 | <property stdset="1"> | ||
114 | <name>sizePolicy</name> | ||
115 | <sizepolicy> | ||
116 | <hsizetype>0</hsizetype> | ||
117 | <vsizetype>0</vsizetype> | ||
118 | </sizepolicy> | ||
119 | </property> | ||
120 | </widget> | ||
121 | </hbox> | ||
122 | </widget> | ||
123 | <customwidgets> | ||
124 | <customwidget> | ||
125 | <class>ClickableLabel</class> | ||
126 | <header location="local">namespace_hack.h</header> | ||
127 | <sizehint> | ||
128 | <width>-1</width> | ||
129 | <height>-1</height> | ||
130 | </sizehint> | ||
131 | <container>0</container> | ||
132 | <sizepolicy> | ||
133 | <hordata>5</hordata> | ||
134 | <verdata>5</verdata> | ||
135 | </sizepolicy> | ||
136 | <pixmap>image0</pixmap> | ||
137 | </customwidget> | ||
138 | </customwidgets> | ||
139 | <images> | ||
140 | <image> | ||
141 | <name>image0</name> | ||
142 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753</data> | ||
143 | </image> | ||
144 | </images> | ||
145 | </UI> | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp new file mode 100644 index 0000000..1cea602 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp | |||
@@ -0,0 +1,41 @@ | |||
1 | #include "datebookweeklstdblview.h" | ||
2 | #include "datebookweeklstview.h" | ||
3 | |||
4 | #include <qlayout.h> | ||
5 | |||
6 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | ||
7 | QValueList<EffectiveEvent> &ev2, | ||
8 | QDate &d, bool onM, | ||
9 | QWidget* parent, | ||
10 | const char* name, WFlags fl) | ||
11 | : QWidget( parent, name, fl ) | ||
12 | { | ||
13 | QHBoxLayout *layout = new QHBoxLayout( this ); | ||
14 | |||
15 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); | ||
16 | layout->addWidget(w); | ||
17 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
18 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
19 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
20 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
21 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
22 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
23 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
24 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | ||
25 | |||
26 | |||
27 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | ||
28 | layout->addWidget(w); | ||
29 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
30 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
31 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
32 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
33 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
34 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
35 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
36 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | ||
37 | } | ||
38 | |||
39 | DateBookWeekLstDblView::~DateBookWeekLstDblView() | ||
40 | { | ||
41 | } | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h new file mode 100644 index 0000000..57e9690 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h | |||
@@ -0,0 +1,31 @@ | |||
1 | #ifndef _DATEBOOKWEEKLSTDBLVIEW_H | ||
2 | #define _DATEBOOKWEEKLSTDBLVIEW_H | ||
3 | |||
4 | #include <qpe/event.h> | ||
5 | |||
6 | #include <qwidget.h> | ||
7 | #include <qvaluelist.h> | ||
8 | #include <qdatetime.h> | ||
9 | #include <qstring.h> | ||
10 | |||
11 | class DateBookWeekLstDblView: public QWidget { | ||
12 | Q_OBJECT | ||
13 | public: | ||
14 | DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | ||
15 | QValueList<EffectiveEvent> &ev2, | ||
16 | QDate &d, bool onM, | ||
17 | QWidget* parent = 0, const char* name = 0, | ||
18 | WFlags fl = 0 ); | ||
19 | virtual ~DateBookWeekLstDblView(); | ||
20 | signals: | ||
21 | void editEvent(const Event &e); | ||
22 | void duplicateEvent(const Event &e); | ||
23 | void removeEvent(const Event &e); | ||
24 | void beamEvent(const Event &e); | ||
25 | void redraw(); | ||
26 | void showDate(int y, int m, int d); | ||
27 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
28 | const QString &str, const QString &location); | ||
29 | }; | ||
30 | |||
31 | #endif | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp new file mode 100644 index 0000000..797f766 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstevent.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | #include "datebookweeklstevent.h" | ||
2 | #include "datebooktypes.h" | ||
3 | |||
4 | #include <opie2/odebug.h> | ||
5 | |||
6 | #include <qpe/ir.h> | ||
7 | |||
8 | #include <qstring.h> | ||
9 | #include <qpopupmenu.h> | ||
10 | |||
11 | DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | ||
12 | int weeklistviewconfig, | ||
13 | QWidget* parent, | ||
14 | const char* name, | ||
15 | WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) | ||
16 | { | ||
17 | // old values... lastday = "__|__", middle=" |---", Firstday="00:00", | ||
18 | QString s,start,middle,end,day; | ||
19 | |||
20 | odebug << "weeklistviewconfig=" << weeklistviewconfig << oendl; | ||
21 | if(weeklistviewconfig==NONE) { // No times displayed. | ||
22 | // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | ||
23 | // middle.sprintf("<--->"); | ||
24 | // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | ||
25 | // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | ||
26 | } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time. | ||
27 | start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
28 | middle.sprintf(" |---"); | ||
29 | end.sprintf("__|__"); | ||
30 | day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); | ||
31 | } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. | ||
32 | start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); | ||
33 | middle.sprintf("<--->"); | ||
34 | end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); | ||
35 | day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); | ||
36 | } | ||
37 | |||
38 | if(ev.event().type() == Event::Normal) { | ||
39 | if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event. | ||
40 | s=day; | ||
41 | } else if(ev.startDate()==ev.date()) { // start event. | ||
42 | s=start; | ||
43 | } else if(ev.endDate()==ev.date()) { // end event. | ||
44 | s=end; | ||
45 | } else { // middle day. | ||
46 | s=middle; | ||
47 | } | ||
48 | } else { | ||
49 | s=""; | ||
50 | } | ||
51 | setText(QString(s) + " " + ev.description()); | ||
52 | // connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | ||
53 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | ||
54 | } | ||
55 | void DateBookWeekLstEvent::editMe() { | ||
56 | emit editEvent(event.event()); | ||
57 | } | ||
58 | void DateBookWeekLstEvent::duplicateMe() | ||
59 | { | ||
60 | emit duplicateEvent(event.event()); | ||
61 | } | ||
62 | void DateBookWeekLstEvent::deleteMe() | ||
63 | { | ||
64 | emit removeEvent(event.event()); | ||
65 | emit redraw(); | ||
66 | } | ||
67 | void DateBookWeekLstEvent::beamMe() | ||
68 | { | ||
69 | emit beamEvent( event.event() ); | ||
70 | } | ||
71 | void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) | ||
72 | { | ||
73 | if (!event.event().isValidUid()) { | ||
74 | // this is just such a holiday event. | ||
75 | return; | ||
76 | } | ||
77 | popmenue = new QPopupMenu; | ||
78 | |||
79 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); | ||
80 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); | ||
81 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); | ||
82 | if(Ir::supported()) | ||
83 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); | ||
84 | popmenue->popup( mapToGlobal( e->pos() )); | ||
85 | } | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstevent.h b/core/pim/datebook/modules/weeklst/datebookweeklstevent.h new file mode 100644 index 0000000..77f6283 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstevent.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef _DATEBOOKWEEKLSTEVENT_H | ||
2 | #define _DATEBOOKWEEKLSTEVENT_H | ||
3 | |||
4 | #include <opie2/oclickablelabel.h> | ||
5 | |||
6 | #include <qpe/event.h> | ||
7 | |||
8 | class DateBookWeekLstEvent: public Opie::Ui::OClickableLabel | ||
9 | { | ||
10 | Q_OBJECT | ||
11 | public: | ||
12 | DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, | ||
13 | QWidget* parent = 0, const char* name = 0, | ||
14 | WFlags fl = 0); | ||
15 | signals: | ||
16 | void editEvent(const Event &e); | ||
17 | void duplicateEvent(const Event &e); | ||
18 | void removeEvent(const Event &e); | ||
19 | void beamEvent(const Event &e); | ||
20 | void redraw(); | ||
21 | private slots: | ||
22 | void editMe(); | ||
23 | void duplicateMe(); | ||
24 | void deleteMe(); | ||
25 | void beamMe(); | ||
26 | private: | ||
27 | const EffectiveEvent event; | ||
28 | QPopupMenu* popmenue; | ||
29 | protected: | ||
30 | void mousePressEvent( QMouseEvent *e ); | ||
31 | }; | ||
32 | |||
33 | |||
34 | #endif | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstheader.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstheader.cpp new file mode 100644 index 0000000..81e0c31 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstheader.cpp | |||
@@ -0,0 +1,96 @@ | |||
1 | #include "datebookweeklstheader.h" | ||
2 | |||
3 | #include <qpe/resource.h> | ||
4 | #include <qpe/datebookmonth.h> | ||
5 | |||
6 | #include <qtoolbutton.h> | ||
7 | #include <qlayout.h> | ||
8 | |||
9 | /* implenented in datebookweek.cpp - HELL */ | ||
10 | bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); | ||
11 | |||
12 | DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) | ||
13 | : DateBookWeekLstHeaderBase(parent, name, fl) | ||
14 | { | ||
15 | setBackgroundMode( PaletteButton ); | ||
16 | labelDate->setBackgroundMode( PaletteButton ); | ||
17 | forwardweek->setBackgroundMode( PaletteButton ); | ||
18 | forwardweek->setPixmap( Resource::loadPixmap("forward") ); | ||
19 | forwardmonth->setBackgroundMode( PaletteButton ); | ||
20 | forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); | ||
21 | backweek->setBackgroundMode( PaletteButton ); | ||
22 | backweek->setPixmap( Resource::loadPixmap("back") ); | ||
23 | backmonth->setBackgroundMode( PaletteButton ); | ||
24 | backmonth->setPixmap( Resource::loadPixmap("fastback") ); | ||
25 | DateBookWeekLstHeaderBaseLayout->setSpacing(0); | ||
26 | DateBookWeekLstHeaderBaseLayout->setMargin(0); | ||
27 | //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); | ||
28 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); | ||
29 | |||
30 | connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); | ||
31 | connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); | ||
32 | connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); | ||
33 | connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); | ||
34 | connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); | ||
35 | connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); | ||
36 | bStartOnMonday=onM; | ||
37 | } | ||
38 | DateBookWeekLstHeader::~DateBookWeekLstHeader(){} | ||
39 | |||
40 | void DateBookWeekLstHeader::setDate(const QDate &d) { | ||
41 | int year,week,dayofweek; | ||
42 | date=d; | ||
43 | dayofweek=d.dayOfWeek(); | ||
44 | if(bStartOnMonday) | ||
45 | dayofweek--; | ||
46 | else if( dayofweek == 7 ) | ||
47 | /* we already have the right day -7 would lead to the same week */ | ||
48 | dayofweek = 0; | ||
49 | |||
50 | date=date.addDays(-dayofweek); | ||
51 | |||
52 | calcWeek(date,week,year,bStartOnMonday); | ||
53 | QDate start=date; | ||
54 | QDate stop=start.addDays(6); | ||
55 | labelDate->setText( QString::number(start.day()) + "." + | ||
56 | Calendar::nameOfMonth( start.month() ) + "-" + | ||
57 | QString::number(stop.day()) + "." + | ||
58 | Calendar::nameOfMonth( stop.month()) +" ("+ | ||
59 | tr("w")+":"+QString::number( week ) +")"); | ||
60 | date = d; // bugfix: 0001126 - date has to be the selected date, not monday! | ||
61 | emit dateChanged(date); | ||
62 | } | ||
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) ),this, SLOT( setDate(int,int,int) ) ); | ||
72 | //connect( m1, SIGNAL( aboutToHide() ), | ||
73 | //this, SLOT( gotHide() ) ); | ||
74 | } | ||
75 | picker->setDate( date.year(), date.month(), date.day() ); | ||
76 | m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); | ||
77 | picker->setFocus(); | ||
78 | } | ||
79 | void DateBookWeekLstHeader::setDate(int y, int m, int d) { | ||
80 | setDate(QDate(y,m,d)); | ||
81 | } | ||
82 | |||
83 | void DateBookWeekLstHeader::nextWeek() { | ||
84 | setDate(date.addDays(7)); | ||
85 | } | ||
86 | void DateBookWeekLstHeader::prevWeek() { | ||
87 | setDate(date.addDays(-7)); | ||
88 | } | ||
89 | void DateBookWeekLstHeader::nextMonth() | ||
90 | { | ||
91 | setDate(date.addDays(28)); | ||
92 | } | ||
93 | void DateBookWeekLstHeader::prevMonth() | ||
94 | { | ||
95 | setDate(date.addDays(-28)); | ||
96 | } | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstheader.h b/core/pim/datebook/modules/weeklst/datebookweeklstheader.h new file mode 100644 index 0000000..818b825 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstheader.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef _DATEBOOKWEEKLSTHEADER_H | ||
2 | #define _DATEBOOKWEEKLSTHEADER_H | ||
3 | |||
4 | #include "datebookweeklstheaderbase.h" | ||
5 | |||
6 | #include <qdatetime.h> | ||
7 | |||
8 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase | ||
9 | { | ||
10 | Q_OBJECT | ||
11 | public: | ||
12 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, | ||
13 | WFlags fl = 0 ); | ||
14 | ~DateBookWeekLstHeader(); | ||
15 | void setDate(const QDate &d); | ||
16 | |||
17 | public slots: | ||
18 | void nextWeek(); | ||
19 | void prevWeek(); | ||
20 | void nextMonth(); | ||
21 | void prevMonth(); | ||
22 | void pickDate(); | ||
23 | void setDate(int y, int m, int d); | ||
24 | signals: | ||
25 | void dateChanged(QDate &newdate); | ||
26 | void setDbl(bool on); | ||
27 | protected: | ||
28 | QDate date; | ||
29 | // bool onMonday; | ||
30 | bool bStartOnMonday; | ||
31 | |||
32 | }; | ||
33 | |||
34 | #endif | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstheaderbase.ui b/core/pim/datebook/modules/weeklst/datebookweeklstheaderbase.ui new file mode 100644 index 0000000..e925ec3 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstheaderbase.ui | |||
@@ -0,0 +1,306 @@ | |||
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>183</y> | ||
14 | <width>447</width> | ||
15 | <height>45</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> | ||
26 | <name>layoutMargin</name> | ||
27 | </property> | ||
28 | <property> | ||
29 | <name>layoutSpacing</name> | ||
30 | </property> | ||
31 | <hbox> | ||
32 | <property stdset="1"> | ||
33 | <name>margin</name> | ||
34 | <number>11</number> | ||
35 | </property> | ||
36 | <property stdset="1"> | ||
37 | <name>spacing</name> | ||
38 | <number>6</number> | ||
39 | </property> | ||
40 | <widget> | ||
41 | <class>QToolButton</class> | ||
42 | <property stdset="1"> | ||
43 | <name>name</name> | ||
44 | <cstring>backmonth</cstring> | ||
45 | </property> | ||
46 | <property stdset="1"> | ||
47 | <name>text</name> | ||
48 | <string></string> | ||
49 | </property> | ||
50 | <property stdset="1"> | ||
51 | <name>pixmap</name> | ||
52 | <pixmap></pixmap> | ||
53 | </property> | ||
54 | <property stdset="1"> | ||
55 | <name>toggleButton</name> | ||
56 | <bool>false</bool> | ||
57 | </property> | ||
58 | <property stdset="1"> | ||
59 | <name>autoRepeat</name> | ||
60 | <bool>true</bool> | ||
61 | </property> | ||
62 | <property stdset="1"> | ||
63 | <name>autoRaise</name> | ||
64 | <bool>true</bool> | ||
65 | </property> | ||
66 | <property stdset="1"> | ||
67 | <name>toggleButton</name> | ||
68 | <bool>false</bool> | ||
69 | </property> | ||
70 | <property> | ||
71 | <name>toolTip</name> | ||
72 | <string></string> | ||
73 | </property> | ||
74 | </widget> | ||
75 | <widget> | ||
76 | <class>QToolButton</class> | ||
77 | <property stdset="1"> | ||
78 | <name>name</name> | ||
79 | <cstring>backweek</cstring> | ||
80 | </property> | ||
81 | <property stdset="1"> | ||
82 | <name>sizePolicy</name> | ||
83 | <sizepolicy> | ||
84 | <hsizetype>7</hsizetype> | ||
85 | <vsizetype>0</vsizetype> | ||
86 | </sizepolicy> | ||
87 | </property> | ||
88 | <property stdset="1"> | ||
89 | <name>text</name> | ||
90 | <string></string> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>pixmap</name> | ||
94 | <pixmap></pixmap> | ||
95 | </property> | ||
96 | <property stdset="1"> | ||
97 | <name>toggleButton</name> | ||
98 | <bool>false</bool> | ||
99 | </property> | ||
100 | <property stdset="1"> | ||
101 | <name>autoRepeat</name> | ||
102 | <bool>true</bool> | ||
103 | </property> | ||
104 | <property stdset="1"> | ||
105 | <name>autoRaise</name> | ||
106 | <bool>true</bool> | ||
107 | </property> | ||
108 | <property stdset="1"> | ||
109 | <name>toggleButton</name> | ||
110 | <bool>false</bool> | ||
111 | </property> | ||
112 | <property> | ||
113 | <name>toolTip</name> | ||
114 | <string></string> | ||
115 | </property> | ||
116 | </widget> | ||
117 | <spacer> | ||
118 | <property> | ||
119 | <name>name</name> | ||
120 | <cstring>Spacer1_3</cstring> | ||
121 | </property> | ||
122 | <property stdset="1"> | ||
123 | <name>orientation</name> | ||
124 | <enum>Horizontal</enum> | ||
125 | </property> | ||
126 | <property stdset="1"> | ||
127 | <name>sizeType</name> | ||
128 | <enum>Expanding</enum> | ||
129 | </property> | ||
130 | <property> | ||
131 | <name>sizeHint</name> | ||
132 | <size> | ||
133 | <width>20</width> | ||
134 | <height>20</height> | ||
135 | </size> | ||
136 | </property> | ||
137 | </spacer> | ||
138 | <widget> | ||
139 | <class>QToolButton</class> | ||
140 | <property stdset="1"> | ||
141 | <name>name</name> | ||
142 | <cstring>labelDate</cstring> | ||
143 | </property> | ||
144 | <property stdset="1"> | ||
145 | <name>sizePolicy</name> | ||
146 | <sizepolicy> | ||
147 | <hsizetype>7</hsizetype> | ||
148 | <vsizetype>0</vsizetype> | ||
149 | </sizepolicy> | ||
150 | </property> | ||
151 | <property stdset="1"> | ||
152 | <name>font</name> | ||
153 | <font> | ||
154 | <bold>1</bold> | ||
155 | </font> | ||
156 | </property> | ||
157 | <property stdset="1"> | ||
158 | <name>text</name> | ||
159 | <string>W: 00,00</string> | ||
160 | </property> | ||
161 | <property stdset="1"> | ||
162 | <name>toggleButton</name> | ||
163 | <bool>false</bool> | ||
164 | </property> | ||
165 | <property stdset="1"> | ||
166 | <name>autoRaise</name> | ||
167 | <bool>false</bool> | ||
168 | </property> | ||
169 | <property stdset="1"> | ||
170 | <name>toggleButton</name> | ||
171 | <bool>false</bool> | ||
172 | </property> | ||
173 | <property> | ||
174 | <name>toolTip</name> | ||
175 | <string></string> | ||
176 | </property> | ||
177 | </widget> | ||
178 | <widget> | ||
179 | <class>QToolButton</class> | ||
180 | <property stdset="1"> | ||
181 | <name>name</name> | ||
182 | <cstring>dbl</cstring> | ||
183 | </property> | ||
184 | <property stdset="1"> | ||
185 | <name>sizePolicy</name> | ||
186 | <sizepolicy> | ||
187 | <hsizetype>3</hsizetype> | ||
188 | <vsizetype>0</vsizetype> | ||
189 | </sizepolicy> | ||
190 | </property> | ||
191 | <property stdset="1"> | ||
192 | <name>font</name> | ||
193 | <font> | ||
194 | <bold>1</bold> | ||
195 | </font> | ||
196 | </property> | ||
197 | <property stdset="1"> | ||
198 | <name>text</name> | ||
199 | <string>2</string> | ||
200 | </property> | ||
201 | <property stdset="1"> | ||
202 | <name>toggleButton</name> | ||
203 | <bool>true</bool> | ||
204 | </property> | ||
205 | <property stdset="1"> | ||
206 | <name>autoRaise</name> | ||
207 | <bool>false</bool> | ||
208 | </property> | ||
209 | <property stdset="1"> | ||
210 | <name>toggleButton</name> | ||
211 | <bool>true</bool> | ||
212 | </property> | ||
213 | <property> | ||
214 | <name>toolTip</name> | ||
215 | <string></string> | ||
216 | </property> | ||
217 | </widget> | ||
218 | <spacer> | ||
219 | <property> | ||
220 | <name>name</name> | ||
221 | <cstring>Spacer1_3_2</cstring> | ||
222 | </property> | ||
223 | <property stdset="1"> | ||
224 | <name>orientation</name> | ||
225 | <enum>Horizontal</enum> | ||
226 | </property> | ||
227 | <property stdset="1"> | ||
228 | <name>sizeType</name> | ||
229 | <enum>Expanding</enum> | ||
230 | </property> | ||
231 | <property> | ||
232 | <name>sizeHint</name> | ||
233 | <size> | ||
234 | <width>20</width> | ||
235 | <height>20</height> | ||
236 | </size> | ||
237 | </property> | ||
238 | </spacer> | ||
239 | <widget> | ||
240 | <class>QToolButton</class> | ||
241 | <property stdset="1"> | ||
242 | <name>name</name> | ||
243 | <cstring>forwardweek</cstring> | ||
244 | </property> | ||
245 | <property stdset="1"> | ||
246 | <name>sizePolicy</name> | ||
247 | <sizepolicy> | ||
248 | <hsizetype>1</hsizetype> | ||
249 | <vsizetype>0</vsizetype> | ||
250 | </sizepolicy> | ||
251 | </property> | ||
252 | <property stdset="1"> | ||
253 | <name>text</name> | ||
254 | <string></string> | ||
255 | </property> | ||
256 | <property stdset="1"> | ||
257 | <name>pixmap</name> | ||
258 | <pixmap></pixmap> | ||
259 | </property> | ||
260 | <property stdset="1"> | ||
261 | <name>autoRepeat</name> | ||
262 | <bool>true</bool> | ||
263 | </property> | ||
264 | <property stdset="1"> | ||
265 | <name>autoRaise</name> | ||
266 | <bool>true</bool> | ||
267 | </property> | ||
268 | </widget> | ||
269 | <widget> | ||
270 | <class>QToolButton</class> | ||
271 | <property stdset="1"> | ||
272 | <name>name</name> | ||
273 | <cstring>forwardmonth</cstring> | ||
274 | </property> | ||
275 | <property stdset="1"> | ||
276 | <name>text</name> | ||
277 | <string></string> | ||
278 | </property> | ||
279 | <property stdset="1"> | ||
280 | <name>pixmap</name> | ||
281 | <pixmap></pixmap> | ||
282 | </property> | ||
283 | <property stdset="1"> | ||
284 | <name>toggleButton</name> | ||
285 | <bool>false</bool> | ||
286 | </property> | ||
287 | <property stdset="1"> | ||
288 | <name>autoRepeat</name> | ||
289 | <bool>true</bool> | ||
290 | </property> | ||
291 | <property stdset="1"> | ||
292 | <name>autoRaise</name> | ||
293 | <bool>true</bool> | ||
294 | </property> | ||
295 | <property stdset="1"> | ||
296 | <name>toggleButton</name> | ||
297 | <bool>false</bool> | ||
298 | </property> | ||
299 | <property> | ||
300 | <name>toolTip</name> | ||
301 | <string></string> | ||
302 | </property> | ||
303 | </widget> | ||
304 | </hbox> | ||
305 | </widget> | ||
306 | </UI> | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp new file mode 100644 index 0000000..efb4c01 --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp | |||
@@ -0,0 +1,73 @@ | |||
1 | #include "datebookweeklstview.h" | ||
2 | #include "datebooktypes.h" | ||
3 | #include "datebookweeklstdayhdr.h" | ||
4 | #include "datebookweeklstheader.h" | ||
5 | #include "datebookweeklstevent.h" | ||
6 | |||
7 | #include <opie2/odebug.h> | ||
8 | |||
9 | #include <qpe/config.h> | ||
10 | |||
11 | #include <qlayout.h> | ||
12 | #include <qtl.h> | ||
13 | |||
14 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | ||
15 | const QDate &d, bool onM, | ||
16 | QWidget* parent, | ||
17 | const char* name, WFlags fl) | ||
18 | : QWidget( parent, name, fl ) | ||
19 | { | ||
20 | Config config("DateBook"); | ||
21 | config.setGroup("Main"); | ||
22 | int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); | ||
23 | odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; | ||
24 | |||
25 | bStartOnMonday=onM; | ||
26 | setPalette(white); | ||
27 | setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); | ||
28 | |||
29 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
30 | |||
31 | qBubbleSort(ev); | ||
32 | QValueListIterator<EffectiveEvent> it; | ||
33 | it=ev.begin(); | ||
34 | |||
35 | int dayOrder[7]; | ||
36 | if (bStartOnMonday) { | ||
37 | for (int d=0; d<7; d++) dayOrder[d]=d+1; | ||
38 | } else { | ||
39 | for (int d=0; d<7; d++) dayOrder[d]=d; | ||
40 | dayOrder[0]=7; | ||
41 | } | ||
42 | |||
43 | // Calculate offset to first day of week. | ||
44 | int dayoffset=d.dayOfWeek(); | ||
45 | if(bStartOnMonday) dayoffset--; | ||
46 | else if( dayoffset == 7 ) dayoffset = 0; | ||
47 | |||
48 | for (int i=0; i<7; i++) { | ||
49 | // Header | ||
50 | DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); | ||
51 | connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
52 | connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
53 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | ||
54 | layout->addWidget(hdr); | ||
55 | |||
56 | // Events | ||
57 | while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { | ||
58 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. | ||
59 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); | ||
60 | layout->addWidget(l); | ||
61 | connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
62 | connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
63 | connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
64 | connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
65 | connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
66 | } | ||
67 | it++; | ||
68 | } | ||
69 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | ||
70 | } | ||
71 | } | ||
72 | DateBookWeekLstView::~DateBookWeekLstView(){} | ||
73 | void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} | ||
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.h b/core/pim/datebook/modules/weeklst/datebookweeklstview.h new file mode 100644 index 0000000..2428f1f --- a/dev/null +++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef _DATEBOOKWEEKLISTVIEW_H | ||
2 | #define _DATEBOOKWEEKLISTVIEW_H | ||
3 | |||
4 | #include <qpe/event.h> | ||
5 | |||
6 | #include <qwidget.h> | ||
7 | #include <qvaluelist.h> | ||
8 | #include <qstring.h> | ||
9 | #include <qdatetime.h> | ||
10 | |||
11 | class QKeyEvent; | ||
12 | |||
13 | class DateBookWeekLstView: public QWidget | ||
14 | { | ||
15 | Q_OBJECT | ||
16 | public: | ||
17 | DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, | ||
18 | QWidget* parent = 0, const char* name = 0, | ||
19 | WFlags fl = 0 ); | ||
20 | ~DateBookWeekLstView(); | ||
21 | signals: | ||
22 | void editEvent(const Event &e); | ||
23 | void duplicateEvent(const Event &e); | ||
24 | void removeEvent(const Event &e); | ||
25 | void beamEvent(const Event &e); | ||
26 | void redraw(); | ||
27 | void showDate(int y, int m, int d); | ||
28 | void addEvent(const QDateTime &start, const QDateTime &stop, | ||
29 | const QString &str, const QString &location); | ||
30 | private: | ||
31 | bool bStartOnMonday; | ||
32 | protected slots: | ||
33 | void keyPressEvent(QKeyEvent *); | ||
34 | }; | ||
35 | |||
36 | #endif | ||