Diffstat (limited to 'core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp | 132 |
1 files changed, 111 insertions, 21 deletions
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp index 1cea602..6389822 100644 --- a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp +++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp | |||
@@ -1,41 +1,131 @@ | |||
1 | #include "datebookweeklstdblview.h" | 1 | #include "datebookweeklstdblview.h" |
2 | #include "datebookweeklstview.h" | 2 | #include "datebookweeklstview.h" |
3 | 3 | ||
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | 5 | ||
6 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, | 6 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
7 | QValueList<EffectiveEvent> &ev2, | 7 | QValueList<EffectiveEvent> &ev2, |
8 | QDate &d, bool onM, | 8 | QDate &d, bool onM, |
9 | QWidget* parent, | 9 | QWidget* parent, |
10 | const char* name, WFlags fl) | 10 | const char* name, WFlags fl) |
11 | : QWidget( parent, name, fl ) | 11 | : QWidget( parent, name, fl ) |
12 | { | 12 | { |
13 | QHBoxLayout *layout = new QHBoxLayout( this ); | 13 | m_MainLayout = 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 | 14 | ||
15 | leftView = 0; | ||
16 | rightView = 0; | ||
17 | setEvents(ev1,ev2,d,onM); | ||
18 | } | ||
26 | 19 | ||
27 | w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | 20 | DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, |
28 | layout->addWidget(w); | 21 | QDate &d, bool onM, |
29 | connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | 22 | QWidget* parent, |
30 | connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | 23 | const char* name, WFlags fl) |
31 | connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | 24 | : QWidget( parent, name, fl ) |
32 | connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | 25 | { |
33 | connect (w, SIGNAL(redraw()), this, SIGNAL(redraw())); | 26 | m_MainLayout = new QHBoxLayout( this ); |
34 | connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | 27 | |
35 | connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | 28 | leftView = 0; |
29 | rightView = 0; | ||
30 | setEvents(ev1,d,onM); | ||
31 | } | ||
32 | |||
33 | /* setting the variant with both views */ | ||
34 | void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QValueList<EffectiveEvent> &ev2,QDate &d, bool onM) | ||
35 | { | ||
36 | setUpdatesEnabled(false); | ||
37 | if (!leftView) { | ||
38 | leftView=new DateBookWeekLstView(ev1,d,onM,this); | ||
39 | m_MainLayout->addWidget(leftView); | ||
40 | connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
41 | connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
42 | connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
43 | connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
44 | connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
45 | connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
46 | connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
36 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | 47 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); |
48 | |||
49 | } else { | ||
50 | leftView->hide(); | ||
51 | leftView->setEvents(ev1,d,onM); | ||
52 | } | ||
53 | |||
54 | if (!rightView) { | ||
55 | rightView=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); | ||
56 | m_MainLayout->addWidget(rightView); | ||
57 | connect (rightView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
58 | connect (rightView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
59 | connect (rightView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
60 | connect (rightView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
61 | connect (rightView, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
62 | connect (rightView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
63 | connect (rightView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
64 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | ||
65 | } else { | ||
66 | rightView->hide(); | ||
67 | rightView->setEvents(ev2,d.addDays(7),onM); | ||
68 | } | ||
69 | |||
70 | leftView->show(); | ||
71 | rightView->show(); | ||
72 | setUpdatesEnabled(true); | ||
73 | } | ||
74 | |||
75 | void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM) | ||
76 | { | ||
77 | if (!leftView) { | ||
78 | leftView=new DateBookWeekLstView(ev1,d,onM,this); | ||
79 | m_MainLayout->addWidget(leftView); | ||
80 | connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
81 | connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
82 | connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
83 | connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
84 | connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
85 | connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
86 | connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
87 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | ||
88 | } else { | ||
89 | leftView->hide(); | ||
90 | leftView->setEvents(ev1,d,onM); | ||
91 | } | ||
92 | leftView->show(); | ||
93 | |||
94 | if (rightView) { | ||
95 | rightView->hide(); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | void DateBookWeekLstDblView::setRightEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM) | ||
100 | { | ||
101 | if (!rightView) { | ||
102 | rightView=new DateBookWeekLstView(ev1,d,onM,this); | ||
103 | m_MainLayout->addWidget(rightView); | ||
104 | connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); | ||
105 | connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); | ||
106 | connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); | ||
107 | connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); | ||
108 | connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw())); | ||
109 | connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); | ||
110 | connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), | ||
111 | this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); | ||
112 | } else { | ||
113 | rightView->hide(); | ||
114 | rightView->setEvents(ev1,d,onM); | ||
115 | } | ||
116 | rightView->show(); | ||
117 | } | ||
118 | |||
119 | bool DateBookWeekLstDblView::toggleDoubleView(bool how) | ||
120 | { | ||
121 | if (rightView) { | ||
122 | if (how) rightView->show(); | ||
123 | else rightView->hide(); | ||
124 | return true; | ||
125 | } | ||
126 | return false; | ||
37 | } | 127 | } |
38 | 128 | ||
39 | DateBookWeekLstDblView::~DateBookWeekLstDblView() | 129 | DateBookWeekLstDblView::~DateBookWeekLstDblView() |
40 | { | 130 | { |
41 | } | 131 | } |