summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/holiday/christian/christian-holidays.pro2
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.cpp61
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.h5
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp130
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstdblview.h17
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.cpp49
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.h13
7 files changed, 222 insertions, 55 deletions
diff --git a/core/pim/datebook/holiday/christian/christian-holidays.pro b/core/pim/datebook/holiday/christian/christian-holidays.pro
index db3c777..c943510 100644
--- a/core/pim/datebook/holiday/christian/christian-holidays.pro
+++ b/core/pim/datebook/holiday/christian/christian-holidays.pro
@@ -14,3 +14,3 @@ DEPENDPATH += $(OPIEDIR)/include \
-LIBS+= -lqpe -lopiecore2 -lopieui2 -opiepim2
+LIBS+= -lqpe -lopiecore2 -lopieui2 -lopiepim2
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
index 47bc597..6556373 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklst.cpp
@@ -29,2 +29,3 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
setFocusPolicy(StrongFocus);
+ dateset = false;
layout = new QVBoxLayout( this );
@@ -41,3 +42,3 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
- view=NULL;
+ m_CurrentView=NULL;
Config config("DateBook");
@@ -47,2 +48,3 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
}
+
DateBookWeekLst::~DateBookWeekLst(){
@@ -60,4 +62,11 @@ void DateBookWeekLst::setDbl(bool on) {
dbl=on;
- redraw();
+ bool displayed = false;
+ if (m_CurrentView) {
+ displayed = m_CurrentView->toggleDoubleView(on);
+ }
+ if (!displayed||dbl) {
+ getEvents();
+ }
}
+
void DateBookWeekLst::redraw() {getEvents();}
@@ -84,30 +93,40 @@ QDate DateBookWeekLst::weekDate() const
void DateBookWeekLst::getEvents() {
+ if (!dateset) return;
QDate start = weekDate(); //date();
QDate stop = start.addDays(6);
+ QDate start2;
+
+
QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
+ QValueList<EffectiveEvent> el2;
- setUpdatesEnabled(false);
- if (view) delete view;
if (dbl) {
- QDate start2=start.addDays(7);
+ start2 = start.addDays(7);
stop=start2.addDays(6);
- QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
- view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
+ el2 = db->getEffectiveEvents(start2, stop);
+ }
+ if (!m_CurrentView) {
+ if (dbl) {
+ m_CurrentView=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
} else {
- view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll);
+ m_CurrentView=new DateBookWeekLstDblView(el,start,bStartOnMonday,scroll);
}
-
- connect (view, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
- connect (view, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
- connect (view, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
- connect (view, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
- connect (view, SIGNAL(redraw()), this, SLOT(redraw()));
- connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
- connect (view, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
+ m_CurrentView->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
+ connect (m_CurrentView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
+ connect (m_CurrentView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
+ connect (m_CurrentView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
+ connect (m_CurrentView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
+ connect (m_CurrentView, SIGNAL(redraw()), this, SLOT(redraw()));
+ connect (m_CurrentView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (m_CurrentView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
-
- scroll->addChild(view);
- view->show();
+ scroll->addChild(m_CurrentView);
+ } else {
+ if (dbl) {
+ m_CurrentView->setEvents(el,el2,start,bStartOnMonday);
+ } else {
+ m_CurrentView->setEvents(el,start,bStartOnMonday);
+ }
+ }
scroll->updateScrollBars();
- setUpdatesEnabled(true);
}
@@ -115,3 +134,5 @@ void DateBookWeekLst::getEvents() {
void DateBookWeekLst::dateChanged(QDate &newdate) {
+ dateset = true;
bdate=newdate;
+ odebug << "Date changed " << oendl;
getEvents();
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklst.h b/core/pim/datebook/modules/weeklst/datebookweeklst.h
index 3922fa1..505810b 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklst.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklst.h
@@ -12,3 +12,3 @@ class DateBookWeekLstHeader;
class DateBookWeekLstEvent;
-class DateBookWeekLstView;
+class DateBookWeekLstDblView;
class QVBoxLayout;
@@ -57,5 +57,6 @@ private:
DateBookWeekLstHeader *header;
- QWidget *view;
QVBoxLayout *layout;
QScrollView *scroll;
+ DateBookWeekLstDblView*m_CurrentView;
+ bool dateset:1;
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
@@ -12,26 +12,116 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
{
- QHBoxLayout *layout = new QHBoxLayout( this );
-
- DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
- layout->addWidget(w);
- connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
- connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
- connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
- connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
- connect (w, SIGNAL(redraw()), this, SIGNAL(redraw()));
- connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
- connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
+ m_MainLayout = new QHBoxLayout( this );
+
+ leftView = 0;
+ rightView = 0;
+ setEvents(ev1,ev2,d,onM);
+}
+
+DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
+ QDate &d, bool onM,
+ QWidget* parent,
+ const char* name, WFlags fl)
+ : QWidget( parent, name, fl )
+{
+ m_MainLayout = new QHBoxLayout( this );
+
+ leftView = 0;
+ rightView = 0;
+ setEvents(ev1,d,onM);
+}
+
+/* setting the variant with both views */
+void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QValueList<EffectiveEvent> &ev2,QDate &d, bool onM)
+{
+ setUpdatesEnabled(false);
+ if (!leftView) {
+ leftView=new DateBookWeekLstView(ev1,d,onM,this);
+ m_MainLayout->addWidget(leftView);
+ connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
+ connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
+ connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
+ connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
+ connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw()));
+ connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
+ this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
+
+ } else {
+ leftView->hide();
+ leftView->setEvents(ev1,d,onM);
+ }
+
+ if (!rightView) {
+ rightView=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
+ m_MainLayout->addWidget(rightView);
+ connect (rightView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
+ connect (rightView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
+ connect (rightView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
+ connect (rightView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
+ connect (rightView, SIGNAL(redraw()), this, SIGNAL(redraw()));
+ connect (rightView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (rightView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
+ this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
+ } else {
+ rightView->hide();
+ rightView->setEvents(ev2,d.addDays(7),onM);
+ }
+
+ leftView->show();
+ rightView->show();
+ setUpdatesEnabled(true);
+}
+
+void DateBookWeekLstDblView::setEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM)
+{
+ if (!leftView) {
+ leftView=new DateBookWeekLstView(ev1,d,onM,this);
+ m_MainLayout->addWidget(leftView);
+ connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
+ connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
+ connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
+ connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
+ connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw()));
+ connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
+ } else {
+ leftView->hide();
+ leftView->setEvents(ev1,d,onM);
+ }
+ leftView->show();
+ if (rightView) {
+ rightView->hide();
+ }
+}
- w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
- layout->addWidget(w);
- connect (w, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
- connect (w, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
- connect (w, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
- connect (w, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
- connect (w, SIGNAL(redraw()), this, SIGNAL(redraw()));
- connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
- connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
+void DateBookWeekLstDblView::setRightEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM)
+{
+ if (!rightView) {
+ rightView=new DateBookWeekLstView(ev1,d,onM,this);
+ m_MainLayout->addWidget(rightView);
+ connect (leftView, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
+ connect (leftView, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
+ connect (leftView, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
+ connect (leftView, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
+ connect (leftView, SIGNAL(redraw()), this, SIGNAL(redraw()));
+ connect (leftView, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (leftView, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
+ } else {
+ rightView->hide();
+ rightView->setEvents(ev1,d,onM);
+ }
+ rightView->show();
+}
+
+bool DateBookWeekLstDblView::toggleDoubleView(bool how)
+{
+ if (rightView) {
+ if (how) rightView->show();
+ else rightView->hide();
+ return true;
+ }
+ return false;
}
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
index 57e9690..808556e 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstdblview.h
@@ -10,2 +10,5 @@
+class DateBookWeekLstView;
+class QHBoxLayout;
+
class DateBookWeekLstDblView: public QWidget {
@@ -18,3 +21,13 @@ public:
WFlags fl = 0 );
+ DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
+ QDate &d, bool onM,
+ QWidget* parent = 0, const char* name = 0,
+ WFlags fl = 0 );
virtual ~DateBookWeekLstDblView();
+ void setEvents(QValueList<EffectiveEvent> &ev1,QValueList<EffectiveEvent> &ev2,QDate &d, bool onM);
+ void setEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM);
+ void setRightEvents(QValueList<EffectiveEvent> &ev1,QDate &d, bool onM);
+
+ bool toggleDoubleView(bool how);
+
signals:
@@ -28,2 +41,6 @@ signals:
const QString &str, const QString &location);
+
+protected:
+ QHBoxLayout*m_MainLayout;
+ DateBookWeekLstView *leftView,*rightView;
};
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
index efb4c01..82b9c6d 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
@@ -19,2 +19,18 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
{
+ childs.clear();
+ m_MainLayout = new QVBoxLayout( this );
+ setEvents(ev,d,onM);
+}
+
+void DateBookWeekLstView::setEvents(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM)
+{
+ QValueList<QObject*>::Iterator wIter;
+ for (wIter=childs.begin();wIter!=childs.end();++wIter) {
+ QObject*w = (*wIter);
+ delete w;
+ }
+ childs.clear();
+
+ setUpdatesEnabled(false);
+// m_MainLayout->deleteAllItems();
Config config("DateBook");
@@ -28,4 +44,2 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
- QVBoxLayout *layout = new QVBoxLayout( this );
-
qBubbleSort(ev);
@@ -48,4 +62,9 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
for (int i=0; i<7; i++) {
+ QWidget*w = new QWidget(this);
+ w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
+ w->setPalette(white);
+ QVBoxLayout * tlayout = new QVBoxLayout(w);
+ childs.append(w);
// Header
- DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this);
+ DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,w);
connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
@@ -53,3 +72,3 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
- layout->addWidget(hdr);
+ tlayout->addWidget(hdr);
@@ -58,4 +77,4 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day.
- DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this);
- layout->addWidget(l);
+ DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,w);
+ tlayout->addWidget(l);
connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
@@ -68,6 +87,18 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
}
- layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ tlayout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
+ m_MainLayout->addWidget(w);
+/*
+ QSpacerItem * tmp = new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding);
+ m_MainLayout->addItem(tmp);
+*/
+ }
+ setUpdatesEnabled(true);
}
+
+DateBookWeekLstView::~DateBookWeekLstView()
+{}
+
+void DateBookWeekLstView::keyPressEvent(QKeyEvent *e)
+{
+ e->ignore();
}
-DateBookWeekLstView::~DateBookWeekLstView(){}
-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
index 2428f1f..3d47842 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstview.h
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.h
@@ -11,2 +11,3 @@
class QKeyEvent;
+class QVBoxLayout;
@@ -16,6 +17,8 @@ class DateBookWeekLstView: public QWidget
public:
- DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM,
- QWidget* parent = 0, const char* name = 0,
+ DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, QWidget* parent = 0, const char* name = 0,
WFlags fl = 0 );
~DateBookWeekLstView();
+
+ void setEvents(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM);
+
signals:
@@ -29,4 +32,8 @@ signals:
const QString &str, const QString &location);
-private:
+protected:
bool bStartOnMonday;
+ QValueList<QObject*> childs;
+
+ QVBoxLayout*m_MainLayout;
+
protected slots: