-rw-r--r-- | core/pim/datebook/datebook.cpp | 3 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 43 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 35 |
3 files changed, 72 insertions, 9 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 0a47bb8..a18a5b4 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -562,8 +562,11 @@ void DateBook::initWeekLst() { | |||
562 | connect( weekLstView, SIGNAL( addEvent(const QDateTime&,const QDateTime&,const QString&, const QString&) ), | 562 | connect( weekLstView, SIGNAL( addEvent(const QDateTime&,const QDateTime&,const QString&, const QString&) ), |
563 | this, SLOT( slotNewEntry(const QDateTime&,const QDateTime&,const QString&, const QString&) ) ); | 563 | this, SLOT( slotNewEntry(const QDateTime&,const QDateTime&,const QString&, const QString&) ) ); |
564 | connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) ); | 564 | connect( this, SIGNAL( newEvent() ), weekLstView, SLOT( redraw() ) ); |
565 | connect( weekLstView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) ); | 565 | connect( weekLstView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) ); |
566 | connect( weekLstView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) ); | ||
567 | connect( weekLstView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) ); | ||
568 | connect( weekLstView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) ); | ||
566 | } | 569 | } |
567 | } | 570 | } |
568 | 571 | ||
569 | 572 | ||
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index fe2ab51..771aa00 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -6,8 +6,9 @@ | |||
6 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
7 | 7 | ||
8 | #include <qpe/datebookmonth.h> | 8 | #include <qpe/datebookmonth.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/ir.h> | ||
10 | #include <qpe/resource.h> | 11 | #include <qpe/resource.h> |
11 | 12 | ||
12 | #include <qlayout.h> | 13 | #include <qlayout.h> |
13 | #include <qtoolbutton.h> | 14 | #include <qtoolbutton.h> |
@@ -191,15 +192,37 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, | |||
191 | } else { | 192 | } else { |
192 | s=""; | 193 | s=""; |
193 | } | 194 | } |
194 | setText(QString(s) + " " + ev.description()); | 195 | setText(QString(s) + " " + ev.description()); |
195 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 196 | //connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
196 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 197 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
197 | } | 198 | } |
198 | void DateBookWeekLstEvent::editMe() { | 199 | void DateBookWeekLstEvent::editMe() { |
199 | emit editEvent(event.event()); | 200 | emit editEvent(event.event()); |
200 | } | 201 | } |
201 | 202 | void DateBookWeekLstEvent::duplicateMe() | |
203 | { | ||
204 | emit duplicateEvent(event.event()); | ||
205 | } | ||
206 | void DateBookWeekLstEvent::deleteMe() | ||
207 | { | ||
208 | emit removeEvent(event.event()); | ||
209 | emit redraw(); | ||
210 | } | ||
211 | void DateBookWeekLstEvent::beamMe() | ||
212 | { | ||
213 | emit beamEvent( event.event() ); | ||
214 | } | ||
215 | void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) | ||
216 | { | ||
217 | popmenue = new QPopupMenu; | ||
218 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); | ||
219 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); | ||
220 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); | ||
221 | if(Ir::supported()) | ||
222 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); | ||
223 | popmenue->popup( mapToGlobal( e->pos() )); | ||
224 | } | ||
202 | 225 | ||
203 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 226 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
204 | const QDate &d, bool onM, | 227 | const QDate &d, bool onM, |
205 | QWidget* parent, | 228 | QWidget* parent, |
@@ -247,8 +270,12 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
247 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. | 270 | if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. |
248 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); | 271 | DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); |
249 | layout->addWidget(l); | 272 | layout->addWidget(l); |
250 | connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 273 | connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
274 | connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
275 | connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
276 | connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
277 | connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
251 | } | 278 | } |
252 | it++; | 279 | it++; |
253 | } | 280 | } |
254 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 281 | layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
@@ -268,16 +295,24 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | |||
268 | 295 | ||
269 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); | 296 | DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); |
270 | layout->addWidget(w); | 297 | layout->addWidget(w); |
271 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 298 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
299 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
300 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
301 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
302 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
272 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 303 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
273 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 304 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
274 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 305 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
275 | 306 | ||
276 | 307 | ||
277 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | 308 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); |
278 | layout->addWidget(w); | 309 | layout->addWidget(w); |
279 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 310 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
311 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
312 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
313 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
314 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
280 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 315 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
281 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 316 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
282 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 317 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
283 | } | 318 | } |
@@ -361,8 +396,12 @@ void DateBookWeekLst::getEvents() { | |||
361 | view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); | 396 | view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); |
362 | } | 397 | } |
363 | 398 | ||
364 | connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 399 | connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); |
400 | connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
401 | connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
402 | connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
403 | connect (view, SIGNAL(redraw()), this, SLOT(redraw())); | ||
365 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 404 | connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); |
366 | connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 405 | connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), |
367 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 406 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
368 | 407 | ||
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h index 32fa23f..3bc7f2f 100644 --- a/core/pim/datebook/datebookweeklst.h +++ b/core/pim/datebook/datebookweeklst.h | |||
@@ -1,11 +1,11 @@ | |||
1 | #ifndef DATEBOOKWEEKLST | 1 | #ifndef DATEBOOKWEEKLST |
2 | #define DATEBOOKWEEKLST | 2 | #define DATEBOOKWEEKLST |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qdatetime.h> | 5 | #include <qdatetime.h> |
6 | #include <qpe/event.h> | 6 | #include <qpe/event.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qscrollview.h> | 8 | #include <qscrollview.h> |
9 | 9 | ||
10 | #include "datebookweeklstheader.h" | 10 | #include "datebookweeklstheader.h" |
11 | #include "datebookweeklstdayhdr.h" | 11 | #include "datebookweeklstdayhdr.h" |
@@ -18,13 +18,13 @@ class DateBookDB; | |||
18 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase | 18 | class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase |
19 | { | 19 | { |
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | public: | 21 | public: |
22 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, | 22 | DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, |
23 | WFlags fl = 0 ); | 23 | WFlags fl = 0 ); |
24 | ~DateBookWeekLstHeader(); | 24 | ~DateBookWeekLstHeader(); |
25 | void setDate(const QDate &d); | 25 | void setDate(const QDate &d); |
26 | 26 | ||
27 | public slots: | 27 | public slots: |
28 | void nextWeek(); | 28 | void nextWeek(); |
29 | void prevWeek(); | 29 | void prevWeek(); |
30 | void nextMonth(); | 30 | void nextMonth(); |
@@ -44,34 +44,44 @@ class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase | |||
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | DateBookWeekLstDayHdr(const QDate &d, bool onM, | 47 | DateBookWeekLstDayHdr(const QDate &d, bool onM, |
48 | QWidget* parent = 0, const char* name = 0, | 48 | QWidget* parent = 0, const char* name = 0, |
49 | WFlags fl = 0 ); | 49 | WFlags fl = 0 ); |
50 | public slots: | 50 | public slots: |
51 | void showDay(); | 51 | void showDay(); |
52 | void newEvent(); | 52 | void newEvent(); |
53 | signals: | 53 | signals: |
54 | void showDate(int y, int m, int d); | 54 | void showDate(int y, int m, int d); |
55 | void addEvent(const QDateTime &start, const QDateTime &stop, | 55 | void addEvent(const QDateTime &start, const QDateTime &stop, |
56 | const QString &str, const QString &location); | 56 | const QString &str, const QString &location); |
57 | private: | 57 | private: |
58 | QDate date; | 58 | QDate date; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | class DateBookWeekLstEvent: public Opie::Ui::OClickableLabel | 61 | class DateBookWeekLstEvent: public Opie::Ui::OClickableLabel |
62 | { | 62 | { |
63 | Q_OBJECT | 63 | Q_OBJECT |
64 | public: | 64 | public: |
65 | DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, | 65 | DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, |
66 | QWidget* parent = 0, const char* name = 0, | 66 | QWidget* parent = 0, const char* name = 0, |
67 | WFlags fl = 0); | 67 | WFlags fl = 0); |
68 | signals: | 68 | signals: |
69 | void editEvent(const Event &e); | 69 | void editEvent(const Event &e); |
70 | void duplicateEvent(const Event &e); | ||
71 | void removeEvent(const Event &e); | ||
72 | void beamEvent(const Event &e); | ||
73 | void redraw(); | ||
70 | private slots: | 74 | private slots: |
71 | void editMe(); | 75 | void editMe(); |
76 | void duplicateMe(); | ||
77 | void deleteMe(); | ||
78 | void beamMe(); | ||
72 | private: | 79 | private: |
73 | const EffectiveEvent event; | 80 | const EffectiveEvent event; |
81 | QPopupMenu* popmenue; | ||
82 | protected: | ||
83 | void mousePressEvent( QMouseEvent *e ); | ||
74 | }; | 84 | }; |
75 | 85 | ||
76 | class DateBookWeekLstView: public QWidget | 86 | class DateBookWeekLstView: public QWidget |
77 | { | 87 | { |
@@ -82,8 +92,12 @@ public: | |||
82 | WFlags fl = 0 ); | 92 | WFlags fl = 0 ); |
83 | ~DateBookWeekLstView(); | 93 | ~DateBookWeekLstView(); |
84 | signals: | 94 | signals: |
85 | void editEvent(const Event &e); | 95 | void editEvent(const Event &e); |
96 | void duplicateEvent(const Event &e); | ||
97 | void removeEvent(const Event &e); | ||
98 | void beamEvent(const Event &e); | ||
99 | void redraw(); | ||
86 | void showDate(int y, int m, int d); | 100 | void showDate(int y, int m, int d); |
87 | void addEvent(const QDateTime &start, const QDateTime &stop, | 101 | void addEvent(const QDateTime &start, const QDateTime &stop, |
88 | const QString &str, const QString &location); | 102 | const QString &str, const QString &location); |
89 | private: | 103 | private: |
@@ -101,8 +115,12 @@ public: | |||
101 | QWidget* parent = 0, const char* name = 0, | 115 | QWidget* parent = 0, const char* name = 0, |
102 | WFlags fl = 0 ); | 116 | WFlags fl = 0 ); |
103 | signals: | 117 | signals: |
104 | void editEvent(const Event &e); | 118 | void editEvent(const Event &e); |
119 | void duplicateEvent(const Event &e); | ||
120 | void removeEvent(const Event &e); | ||
121 | void beamEvent(const Event &e); | ||
122 | void redraw(); | ||
105 | void showDate(int y, int m, int d); | 123 | void showDate(int y, int m, int d); |
106 | void addEvent(const QDateTime &start, const QDateTime &stop, | 124 | void addEvent(const QDateTime &start, const QDateTime &stop, |
107 | const QString &str, const QString &location); | 125 | const QString &str, const QString &location); |
108 | }; | 126 | }; |
@@ -134,8 +152,11 @@ signals: | |||
134 | void showDate(int y, int m, int d); | 152 | void showDate(int y, int m, int d); |
135 | void addEvent(const QDateTime &start, const QDateTime &stop, | 153 | void addEvent(const QDateTime &start, const QDateTime &stop, |
136 | const QString &str, const QString &location); | 154 | const QString &str, const QString &location); |
137 | void editEvent(const Event &e); | 155 | void editEvent(const Event &e); |
156 | void duplicateEvent(const Event &e); | ||
157 | void removeEvent(const Event &e); | ||
158 | void beamEvent(const Event &e); | ||
138 | 159 | ||
139 | private: | 160 | private: |
140 | DateBookDB *db; | 161 | DateBookDB *db; |
141 | int startTime; | 162 | int startTime; |