summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-17 14:01:23 (UTC)
committer alwin <alwin>2005-03-17 14:01:23 (UTC)
commit8752141a5341877369f89a42fa1f0b5d08f56dbd (patch) (side-by-side diff)
tree63dc48ee207a4e9fbb6b9e8abddb239ec724c155
parentafee05f4b4c1e8dab8463e3423fcfc8f9d45aa8b (diff)
downloadopie-8752141a5341877369f89a42fa1f0b5d08f56dbd.zip
opie-8752141a5341877369f89a42fa1f0b5d08f56dbd.tar.gz
opie-8752141a5341877369f89a42fa1f0b5d08f56dbd.tar.bz2
1. datebookweeklist - a week has SEVEN days, not SIX. I'm wondering why
events on sunday never showed there ;) 2. extra file datebooktypes contains some special classes used by datebook so other classes must not include the big mainheader file. 3. added support for holiday-plugins to week-views. Month view is a little bit more tricky 'cause TT has never heard about virtual methods and so I have the choice between complete copy the monthview and make the modifications or changing the interface of datebookdb-class to virtual. both isn't nice.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp45
-rw-r--r--core/pim/datebook/datebook.h37
-rw-r--r--core/pim/datebook/datebookday.cpp5
-rw-r--r--core/pim/datebook/datebookday.h6
-rw-r--r--core/pim/datebook/datebookdayallday.cpp12
-rw-r--r--core/pim/datebook/datebooktypes.h59
-rw-r--r--core/pim/datebook/datebookweek.cpp3
-rw-r--r--core/pim/datebook/datebookweek.h5
-rw-r--r--core/pim/datebook/datebookweeklst.cpp9
-rw-r--r--core/pim/datebook/datebookweeklst.h5
10 files changed, 135 insertions, 51 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index f6aab0c..36c4bd7 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -77,5 +77,6 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
t.start();
- db = new DateBookDBHack;
+ db = new DateBookDBHoliday;
odebug << "loading db t=" << t.elapsed() << oendl;
db_holiday = new DateBookHoliday();
+ db->db_holiday=db_holiday;
@@ -1151 +1152,43 @@ QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned
+QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
+{
+ QValueList<EffectiveEvent> ret;
+ QValueList<HPlugin*>::Iterator it;
+ for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
+ HPlugin*_pl = *it;
+ ret+=_pl->_plugin->events(from,to);
+ }
+ return ret;
+}
+
+QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDate &from,const QDate &to )
+{
+ return DateBookDBHack::getEffectiveEvents(from,to);
+}
+
+QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEventsNoHoliday(const QDateTime &start)
+{
+ return DateBookDBHack::getEffectiveEvents(start);
+}
+
+QValueList<EffectiveEvent> DateBookHoliday::getEffectiveEvents(const QDateTime &start)
+{
+ return getEffectiveEvents(start.date(),start.date());
+}
+
+QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents(const QDate &from,const QDate &to )
+{
+ QValueList<EffectiveEvent> ret;
+ odebug << "Ueberlagert 1" << oendl;
+ if (db_holiday) {
+ ret+=db_holiday->getEffectiveEvents(from,to);
+ }
+ ret+=getEffectiveEventsNoHoliday(from,to);
+ return ret;
+}
+
+QValueList<EffectiveEvent> DateBookDBHoliday::getEffectiveEvents( const QDateTime &start)
+{
+ odebug << "Ueberlagert 2" << oendl;
+ return DateBookDBHack::getEffectiveEvents(start);
+}
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
index 54ffcfb..3d7f5b5 100644
--- a/core/pim/datebook/datebook.h
+++ b/core/pim/datebook/datebook.h
@@ -22,2 +22,4 @@
+#include "datebooktypes.h"
+
#include <qpe/datebookdb.h>
@@ -38,35 +40,2 @@ class QDate;
class Ir;
-class QLibrary;
-
-namespace Opie {
-namespace Datebook {
- class HolidayPlugin;
- class HolidayPluginIf;
-}
-}
-
-class DateBookDBHack : public DateBookDB {
- public:
- Event eventByUID(int id);
-};
-
-class DateBookHoliday
-{
-public:
- DateBookHoliday();
- virtual ~DateBookHoliday();
-
- QStringList holidaylist(const QDate&);
- QStringList holidaylist(unsigned year, unsigned month, unsigned day);
-protected:
- void init();
- void deinit();
-
- struct HPlugin {
- Opie::Datebook::HolidayPlugin*_plugin;
- QLibrary*_lib;
- Opie::Datebook::HolidayPluginIf*_if;
- };
- QValueList<HPlugin*>_pluginlist;
-};
@@ -139,3 +108,3 @@ private:
private:
- DateBookDBHack *db;
+ DateBookDBHoliday *db;
DateBookHoliday*db_holiday;
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index dfe39e5..00ddd05 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -21,2 +21,3 @@
#include "datebookday.h"
+#include "datebooktypes.h"
#include "datebookdayheaderimpl.h"
@@ -229,3 +230,3 @@ void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */)
-DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name )
+DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name )
: QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 )
@@ -369,3 +370,3 @@ void DateBookDay::getEvents()
}
- QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate );
+ QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate );
QValueListIterator<EffectiveEvent> it;
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h
index 3e44364..3b75eba 100644
--- a/core/pim/datebook/datebookday.h
+++ b/core/pim/datebook/datebookday.h
@@ -30,2 +30,3 @@
#include "datebook.h"
+#include "datebooktypes.h"
#include <qlineedit.h>
@@ -34,2 +35,3 @@ class DateBookDayHeader;
class DateBookDB;
+class DateBookDBHoliday;
class DatebookdayAllday;
@@ -182,3 +184,3 @@ class DateBookDay : public QVBox
public:
- DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb,DateBookHoliday*newHdb,
+ DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb,DateBookHoliday*newHdb,
QWidget *parent, const char *name );
@@ -227,3 +229,3 @@ private:
DatebookdayAllday *m_allDays;
- DateBookDB *db;
+ DateBookDBHoliday *db;
WidgetListClass widgetList; //reimplemented QList for sorting widgets by height
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp
index 3c3f482..5b40246 100644
--- a/core/pim/datebook/datebookdayallday.cpp
+++ b/core/pim/datebook/datebookdayallday.cpp
@@ -32,3 +32,4 @@ DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const cha
setFrameStyle(QFrame::NoFrame|QFrame::Plain);
- setResizePolicy( QScrollView::Default );
+ //setResizePolicy( QScrollView::Default );
+ setResizePolicy(QScrollView::AutoOneFit);
setHScrollBarMode( AlwaysOff );
@@ -113,5 +114,9 @@ DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,co
m_Ev.setEvent(ev);
- setBackgroundColor(yellow);
setText(strDesc);
- setFrameStyle(QFrame::Raised|QFrame::Panel);
+
+ setAlignment(AlignHCenter);
+ setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum));
+
+ //setFrameStyle(QFrame::Raised|QFrame::Panel);
+ //setBackgroundColor(yellow);
@@ -120,2 +125,3 @@ DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,co
setMinimumSize( QSize( 0, s ) );
+
m_holiday = true;
diff --git a/core/pim/datebook/datebooktypes.h b/core/pim/datebook/datebooktypes.h
new file mode 100644
index 0000000..9eb7e89
--- a/dev/null
+++ b/core/pim/datebook/datebooktypes.h
@@ -0,0 +1,59 @@
+#ifndef _DATEBOOK_TYPES_H
+#define _DATEBOOK_TYPES_H
+
+#include <qpe/datebookdb.h>
+
+#include <qvaluelist.h>
+#include <qstringlist.h>
+
+namespace Opie {
+namespace Datebook {
+ class HolidayPlugin;
+ class HolidayPluginIf;
+}
+}
+
+class QLibrary;
+
+class DateBookDBHack : virtual public DateBookDB {
+ public:
+ virtual ~DateBookDBHack(){}
+ Event eventByUID(int id);
+};
+
+class DateBookHoliday
+{
+public:
+ DateBookHoliday();
+ virtual ~DateBookHoliday();
+
+ QStringList holidaylist(const QDate&);
+ QStringList holidaylist(unsigned year, unsigned month, unsigned day);
+ virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to );
+ virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start);
+
+protected:
+ void init();
+ void deinit();
+
+ struct HPlugin {
+ Opie::Datebook::HolidayPlugin*_plugin;
+ QLibrary*_lib;
+ Opie::Datebook::HolidayPluginIf*_if;
+ };
+ QValueList<HPlugin*>_pluginlist;
+};
+
+class DateBookDBHoliday:virtual public DateBookDBHack {
+public:
+ DateBookDBHoliday():DateBookDBHack(){db_holiday=0;}
+ virtual ~DateBookDBHoliday(){}
+ virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to );
+ virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start);
+ virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to );
+ virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start);
+
+ DateBookHoliday*db_holiday;
+};
+
+#endif
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 7503751..a509d89 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -21,2 +21,3 @@
#include "datebookweekheaderimpl.h"
+#include "datebooktypes.h"
@@ -342,3 +343,3 @@ void DateBookWeekView::setStartOfWeek( bool bStartOnMonday )
-DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB,
+DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDBHoliday *newDB,
QWidget *parent, const char *name )
diff --git a/core/pim/datebook/datebookweek.h b/core/pim/datebook/datebookweek.h
index c273e30..ddf54ed 100644
--- a/core/pim/datebook/datebookweek.h
+++ b/core/pim/datebook/datebookweek.h
@@ -30,2 +30,3 @@
class DateBookDB;
+class DateBookDBHoliday;
class DateBookWeekHeader;
@@ -102,3 +103,3 @@ class DateBookWeek : public QWidget
public:
- DateBookWeek( bool ampm, bool weekOnMonday, DateBookDB *newDB,
+ DateBookWeek( bool ampm, bool weekOnMonday, DateBookDBHoliday *newDB,
QWidget *parent = 0, const char *name = 0 );
@@ -155,3 +156,3 @@ private:
DateBookWeekView *view;
- DateBookDB *db;
+ DateBookDBHoliday *db;
QLabel *lblDesc;
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 771aa00..0555bc7 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -4,2 +4,3 @@
#include "datebook.h"
+#include "datebooktypes.h"
@@ -319,3 +320,3 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
-DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
+DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB,
QWidget *parent,
@@ -385,3 +386,3 @@ void DateBookWeekLst::getEvents() {
QDate start = weekDate(); //date();
- QDate stop = start.addDays(6);
+ QDate stop = start.addDays(7);
QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
@@ -390,4 +391,4 @@ void DateBookWeekLst::getEvents() {
if (dbl) {
- QDate start2=start.addDays(7);
- stop=start2.addDays(6);
+ QDate start2=start.addDays(8);
+ stop=start2.addDays(7);
QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index 3bc7f2f..38d7777 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -16,2 +16,3 @@ class QDateTime;
class DateBookDB;
+class DateBookDBHoliday;
@@ -132,3 +133,3 @@ class DateBookWeekLst : public QWidget
public:
- DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB,
+ DateBookWeekLst( bool ampm, bool onM, DateBookDBHoliday *newDB,
QWidget *parent = 0,
@@ -160,3 +161,3 @@ signals:
private:
- DateBookDB *db;
+ DateBookDBHoliday *db;
int startTime;