summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/holiday/christian/christian-holidays.pro2
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.cpp65
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklst.h5
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstdblview.cpp132
-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, 225 insertions, 58 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
@@ -13,5 +13,5 @@ DEPENDPATH += $(OPIEDIR)/include \
../ ../library
-LIBS+= -lqpe -lopiecore2 -lopieui2 -opiepim2
+LIBS+= -lqpe -lopiecore2 -lopieui2 -lopiepim2
DESTDIR = $(OPIEDIR)/plugins/holidays
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
@@ -28,4 +28,5 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
{
setFocusPolicy(StrongFocus);
+ dateset = false;
layout = new QVBoxLayout( this );
layout->setMargin(0);
@@ -40,5 +41,5 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
layout->addWidget(scroll);
- view=NULL;
+ m_CurrentView=NULL;
Config config("DateBook");
config.setGroup("Main");
@@ -46,4 +47,5 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
header->dbl->setOn(dbl);
}
+
DateBookWeekLst::~DateBookWeekLst(){
Config config("DateBook");
@@ -59,6 +61,13 @@ void DateBookWeekLst::setDate(const QDate &d) {
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();}
@@ -83,36 +92,48 @@ 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);
- stop=start2.addDays(6);
- QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
- view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
+ start2 = start.addDays(7);
+ stop = start2.addDays(6);
+ el2 = db->getEffectiveEvents(start2, stop);
+ }
+ if (!m_CurrentView) {
+ if (dbl) {
+ m_CurrentView=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
+ } else {
+ m_CurrentView=new DateBookWeekLstDblView(el,start,bStartOnMonday,scroll);
+ }
+ 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(m_CurrentView);
} else {
- view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll);
+ if (dbl) {
+ m_CurrentView->setEvents(el,el2,start,bStartOnMonday);
+ } else {
+ m_CurrentView->setEvents(el,start,bStartOnMonday);
+ }
}
-
- 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&)),
- this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
-
- scroll->addChild(view);
- view->show();
scroll->updateScrollBars();
- setUpdatesEnabled(true);
}
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
@@ -11,5 +11,5 @@ class DateBookDBHoliday;
class DateBookWeekLstHeader;
class DateBookWeekLstEvent;
-class DateBookWeekLstView;
+class DateBookWeekLstDblView;
class QVBoxLayout;
class QScrollView;
@@ -56,7 +56,8 @@ private:
int year, _week,dow;
DateBookWeekLstHeader *header;
- QWidget *view;
QVBoxLayout *layout;
QScrollView *scroll;
+ DateBookWeekLstDblView*m_CurrentView;
+ bool dateset:1;
void getEvents();
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
@@ -11,28 +11,118 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
: QWidget( parent, name, fl )
{
- 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&)),
- this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
+ m_MainLayout = new QHBoxLayout( this );
+ leftView = 0;
+ rightView = 0;
+ setEvents(ev1,ev2,d,onM);
+}
- 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&)),
+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();
+ }
+}
+
+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
@@ -9,4 +9,7 @@
#include <qstring.h>
+class DateBookWeekLstView;
+class QHBoxLayout;
+
class DateBookWeekLstDblView: public QWidget {
Q_OBJECT
@@ -17,5 +20,15 @@ public:
QWidget* parent = 0, const char* name = 0,
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:
void editEvent(const Event &e);
@@ -27,4 +40,8 @@ signals:
void addEvent(const QDateTime &start, const QDateTime &stop,
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
@@ -18,4 +18,20 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
: QWidget( parent, name, fl )
{
+ 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");
config.setGroup("Main");
@@ -27,6 +43,4 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
- QVBoxLayout *layout = new QVBoxLayout( this );
-
qBubbleSort(ev);
QValueListIterator<EffectiveEvent> it;
@@ -47,16 +61,21 @@ 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)));
connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
- layout->addWidget(hdr);
+ tlayout->addWidget(hdr);
// Events
while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
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&)));
connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
@@ -67,7 +86,19 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
it++;
}
- 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
@@ -10,4 +10,5 @@
class QKeyEvent;
+class QVBoxLayout;
class DateBookWeekLstView: public QWidget
@@ -15,8 +16,10 @@ class DateBookWeekLstView: public QWidget
Q_OBJECT
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:
void editEvent(const Event &e);
@@ -28,6 +31,10 @@ signals:
void addEvent(const QDateTime &start, const QDateTime &stop,
const QString &str, const QString &location);
-private:
+protected:
bool bStartOnMonday;
+ QValueList<QObject*> childs;
+
+ QVBoxLayout*m_MainLayout;
+
protected slots:
void keyPressEvent(QKeyEvent *);