-rw-r--r-- | core/pim/datebook/datebook.cpp | 45 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 37 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 12 | ||||
-rw-r--r-- | core/pim/datebook/datebooktypes.h | 59 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 3 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.h | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 9 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.h | 5 |
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 @@ -62,35 +62,36 @@ #include <stdlib.h> DateBook::DateBook( QWidget *parent, const char *, WFlags f ) : QMainWindow( parent, "datebook", f ), aPreset( FALSE ), presetTime( -1 ), startTime( 8 ), // an acceptable default rowStyle( 0 ), bJumpToCurTime(FALSE), syncing(FALSE), inSearch(FALSE), alarmCounter(0) { bool needEvilHack= false; // if we need an Evil Hack QTime t; t.start(); - db = new DateBookDBHack; + db = new DateBookDBHoliday; odebug << "loading db t=" << t.elapsed() << oendl; db_holiday = new DateBookHoliday(); + db->db_holiday=db_holiday; loadSettings(); setCaption( tr("Calendar") ); setIcon( Resource::loadPixmap( "datebook_icon" ) ); setToolBarsMovable( FALSE ); views = new QWidgetStack( this ); setCentralWidget( views ); dayView = 0; weekView = 0; weekLstView = 0; monthView = 0; // QToolBar *bar = new QToolBar( this ); @@ -1136,16 +1137,58 @@ void DateBookHoliday::init() QStringList DateBookHoliday::holidaylist(const QDate&aDate) { QStringList ret; QValueList<HPlugin*>::Iterator it; for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { HPlugin*_pl = *it; ret+=_pl->_plugin->entries(aDate); } return ret; } QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day) { return holidaylist(QDate(year,month,day)); } +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 @@ -7,81 +7,50 @@ ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef DATEBOOK_H #define DATEBOOK_H +#include "datebooktypes.h" + #include <qpe/datebookdb.h> #include <qmainwindow.h> enum { DAY=1,WEEK,WEEKLST,MONTH }; // defaultView values enum { NONE=0,NORMAL,EXTENDED }; // WeekLstView's modes. class QAction; class QWidgetStack; class DateBookDay; class DateBookWeek; class DateBookWeekLst; class DateBookMonth; class Event; 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; -}; class DateBook : public QMainWindow { Q_OBJECT public: static QString appName() { return QString::fromLatin1("datebook"); } DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); ~DateBook(); signals: void newEvent(); void signalNotFound(); void signalWrapAround(); protected: @@ -124,33 +93,33 @@ private slots: void receive( const QCString &msg, const QByteArray &data ); void setDocument( const QString & ); void beamEvent( const Event &e ); void beamDone( Ir *ir ); private: void addEvent( const Event &e ); void initDay(); void initWeek(); void initWeekLst(); void initMonth(); void loadSettings(); void saveSettings(); private: - DateBookDBHack *db; + DateBookDBHoliday *db; DateBookHoliday*db_holiday; QWidgetStack *views; DateBookDay *dayView; DateBookWeek *weekView; DateBookMonth *monthView; DateBookWeekLst *weekLstView; QAction *dayAction, *weekAction, *weekLstAction, *monthAction; int weeklistviewconfig; bool aPreset; // have everything set to alarm? int presetTime; // the standard time for the alarm int startTime; int rowStyle; int defaultView; QArray<int> defaultCategories; QString defaultLocation; bool bJumpToCurTime; //should jump to current time in dayview? 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 @@ -6,32 +6,33 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "datebookday.h" +#include "datebooktypes.h" #include "datebookdayheaderimpl.h" #include "datebookdayallday.h" #include <opie2/oholidayplugin.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> #include <qpe/ir.h> #include <qsimplerichtext.h> #include <qpopupmenu.h> #include <qtimer.h> DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, const char *name ) : QTable( 24, 1, parent, name ), ampm( whichClock ), currDate( QDate::currentDate() ) @@ -214,33 +215,33 @@ void DateBookDayViewQuickLineEdit::slotReturnPressed() active=0; } /* we need to return to this object.. */ QTimer::singleShot(500, this, SLOT(finallyCallClose()) ); // Close and also delete this widget } void DateBookDayViewQuickLineEdit::finallyCallClose() { close(true); // also deletes this widget... } void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */) { slotReturnPressed(); // Reuse code to add event and close this widget. } //=========================================================================== -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 ) { widgetList.setAutoDelete( true ); _holiday_db = newHdb; header = new DateBookDayHeader( startOnMonday, this, "day header" ); header->setDate( currDate.year(), currDate.month(), currDate.day() ); m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); m_allDays->hide(); view = new DateBookDayView( ampm, this, "day view" ); connect( header, SIGNAL( dateChanged(int,int,int) ), this, SLOT( dateChanged(int,int,int) ) ); connect( header, SIGNAL( dateChanged(int,int,int) ), view, SLOT( slotDateChanged(int,int,int) ) ); connect( view, SIGNAL( sigColWidthChanged() ), this, SLOT( slotColWidthChanged() ) ); connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); @@ -354,33 +355,33 @@ void DateBookDay::redraw() void DateBookDay::getEvents() { widgetList.clear(); /* clear the AllDay List */ m_allDays->hide(); // just in case m_allDays->removeAllEvents(); QStringList hdays = _holiday_db->holidaylist(currDate); QStringList::Iterator sit; QObject* object = 0; for (sit=hdays.begin();sit!=hdays.end();++sit) { object = m_allDays->addHoliday(*sit); if (!object) continue; /* not to do something with it */ } - QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); + QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate ); QValueListIterator<EffectiveEvent> it; for ( it = eventList.begin(); it != eventList.end(); ++it ) { EffectiveEvent ev=*it; if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. if (ev.event().type() == Event::AllDay ) { object = m_allDays->addEvent( ev ); if (!object) continue; }else { DateBookDayWidget* w = new DateBookDayWidget( *it, this ); widgetList.append( w ); object = w; } connect( object, SIGNAL( deleteMe(const Event&) ), this, SIGNAL( removeEvent(const Event&) ) ); 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 @@ -15,36 +15,38 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef DATEBOOKDAY_H #define DATEBOOKDAY_H #include <qpe/event.h> #include <qdatetime.h> #include <qtable.h> #include <qvbox.h> #include <qlist.h> #include "datebook.h" +#include "datebooktypes.h" #include <qlineedit.h> class DateBookDayHeader; class DateBookDB; +class DateBookDBHoliday; class DatebookdayAllday; class QDateTime; class QMouseEvent; class QPaintEvent; class QResizeEvent; class DateBookDayViewQuickLineEdit : public QLineEdit { Q_OBJECT public: DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0); protected: Event quickEvent; int active; void focusOutEvent( QFocusEvent *e ); protected slots: @@ -167,33 +169,33 @@ class WidgetListClass : public QList<DateBookDayWidget> return -1; } else { return 1; } } }; class DateBookDay : public QVBox { Q_OBJECT friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB public: - DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb,DateBookHoliday*newHdb, + DateBookDay( bool ampm, bool startOnMonday, DateBookDBHoliday *newDb,DateBookHoliday*newHdb, QWidget *parent, const char *name ); void selectedDates( QDateTime &start, QDateTime &end ); QDate date() const; DateBookDayView *dayView() const { return view; } void setStartViewTime( int startHere ); int startViewTime() const; void setSelectedWidget( DateBookDayWidget * ); DateBookDayWidget * getSelectedWidget( void ); void setJumpToCurTime( bool bJump ); void setRowStyle( int style ); static QDate findRealStart( int uid, const QDate& isIncluded, DateBookDB* ); public slots: void setDate( int y, int m, int d ); @@ -212,27 +214,27 @@ signals: protected slots: void keyPressEvent(QKeyEvent *); private slots: void dateChanged( int y, int m, int d ); void slotColWidthChanged() { relayoutPage(); }; private: void getEvents(); void relayoutPage( bool fromResize = false ); DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); QDate currDate; DateBookDayView *view; DateBookDayHeader *header; DatebookdayAllday *m_allDays; - DateBookDB *db; + DateBookDBHoliday *db; WidgetListClass widgetList; //reimplemented QList for sorting widgets by height int startTime; bool jumpToCurTime; //should we jump to current time in dayview? int rowStyle; DateBookDayWidget *selectedWidget; //actual selected widget (obviously) DateBookDayTimeMarker *timeMarker; //marker for current time DateBookHoliday*_holiday_db; }; #endif 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 @@ -17,33 +17,34 @@ /* * Constructs a DatebookdayAllday which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) : QScrollView( parent, name ),item_count(0),dateBook(db) { if ( !name ) setName( "DatebookdayAllday" ); setMinimumSize( QSize( 0, 0 ) ); setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); m_MainFrame = new QFrame(viewport()); m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); setFrameStyle(QFrame::NoFrame|QFrame::Plain); - setResizePolicy( QScrollView::Default ); + //setResizePolicy( QScrollView::Default ); + setResizePolicy(QScrollView::AutoOneFit); setHScrollBarMode( AlwaysOff ); addChild(m_MainFrame); datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); datebookdayalldayLayout->setSpacing( 0 ); datebookdayalldayLayout->setMargin( 0 ); lblDesc = new DatebookEventDesc(parent->parentWidget(),""); lblDesc->setBackgroundColor(Qt::yellow); lblDesc->hide(); subWidgets.setAutoDelete(true); } /* * Destroys the object and frees any allocated resources */ @@ -98,39 +99,44 @@ DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, int s = QFontMetrics(font()).height()+4; setMaximumHeight( s ); setMinimumSize( QSize( 0, s ) ); m_holiday = false; } DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,const char* name, WFlags fl) : QLabel(parent,name,fl),m_Ev(),dateBook(0) { QString strDesc = aholiday; strDesc = strDesc.replace(QRegExp("<"),"<"); Event ev; ev.setDescription(strDesc); ev.setAllDay(true); 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); int s = QFontMetrics(font()).height()+4; setMaximumHeight( s ); setMinimumSize( QSize( 0, s ) ); + m_holiday = true; } DatebookAlldayDisp::~DatebookAlldayDisp() { } void DatebookAlldayDisp::beam_single_event() { if (m_holiday) return; // create an Event and beam it... /* * Start with the easy stuff. If start and end date is the same we can just use * the values of effective m_Events * If it is a multi day m_Event we need to find the real start and end date... */ 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 @@ -6,32 +6,33 @@ ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "datebookweek.h" #include "datebookweekheaderimpl.h" +#include "datebooktypes.h" #include <qpe/datebookdb.h> #include <qpe/qpeapplication.h> #include <qpe/calendar.h> #include <qheader.h> #include <qlabel.h> #include <qlayout.h> #include <qtimer.h> //----------------------------------------------------------------- DateBookWeekItem::DateBookWeekItem( const EffectiveEvent e ) : ev( e ) { @@ -327,33 +328,33 @@ void DateBookWeekView::resizeEvent( QResizeEvent *e ) header->resizeSection( 0, hourWidth ); int sw = (avail - hourWidth) / 7; for ( int i = 1; i < 7; i++ ) header->resizeSection( i, sw ); header->resizeSection( 7, avail - hourWidth - sw*6 ); } void DateBookWeekView::setStartOfWeek( bool bStartOnMonday ) { bOnMonday = bStartOnMonday; initNames(); } //------------------------------------------------------------------- -DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDB *newDB, +DateBookWeek::DateBookWeek( bool ap, bool startOnMonday, DateBookDBHoliday *newDB, QWidget *parent, const char *name ) : QWidget( parent, name ), db( newDB ), startTime( 0 ), ampm( ap ), bStartOnMonday( startOnMonday ) { setFocusPolicy(StrongFocus); QVBoxLayout *vb = new QVBoxLayout( this ); header = new DateBookWeekHeader( bStartOnMonday, this ); view = new DateBookWeekView( ampm, startOnMonday, this ); vb->addWidget( header ); vb->addWidget( view ); lblDesc = new QLabel( this, "event label" ); lblDesc->setFrameStyle( QFrame::Plain | QFrame::Box ); 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 @@ -15,32 +15,33 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef DATEBOOKWEEK #define DATEBOOKWEEK #include <qpe/event.h> #include <qlist.h> #include <qscrollview.h> #include <qstring.h> #include <qvaluelist.h> class DateBookDB; +class DateBookDBHoliday; class DateBookWeekHeader; class QDate; class QLabel; class QResizeEvent; class QSpinBox; class QTimer; class QHeader; class DateBookWeekItem { public: DateBookWeekItem( const EffectiveEvent e ); void setGeometry( int x, int y, int w, int h ); QRect geometry() const { return r; } @@ -87,33 +88,33 @@ private: void initNames(); private: bool ampm; bool bOnMonday; QHeader *header; QList<DateBookWeekItem> items; int rowHeight; bool showingEvent; }; class DateBookWeek : public QWidget { Q_OBJECT public: - DateBookWeek( bool ampm, bool weekOnMonday, DateBookDB *newDB, + DateBookWeek( bool ampm, bool weekOnMonday, DateBookDBHoliday *newDB, QWidget *parent = 0, const char *name = 0 ); void setDate( int y, int m, int d ); void setDate( QDate d ); QDate date() const; DateBookWeekView *weekView() const { return view; } void setStartViewTime( int startHere ); int startViewTime() const; int week() const { return _week; }; QDate weekDate() const; public slots: void redraw(); void slotWeekChanged( bool bStartOnMonday ); void slotClockChanged( bool a ); signals: @@ -140,27 +141,27 @@ private: * */ void generateAllDayTooltext( QString& text ); /** * This will add the times to the text * It will be shown in the Tooltip bubble */ void generateNormalTooltext( QString& text, const EffectiveEvent &ev); int year; int _week; int dow; QDate bdate; DateBookWeekHeader *header; DateBookWeekView *view; - DateBookDB *db; + DateBookDBHoliday *db; QLabel *lblDesc; QTimer *tHide; int startTime; bool ampm; bool bStartOnMonday; }; bool calcWeek( const QDate &d, int &week, int &year, bool startOnMonday = false ); #endif 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 @@ -1,20 +1,21 @@ #include "namespace_hack.h" #include "datebookweeklst.h" #include "datebook.h" +#include "datebooktypes.h" #include <opie2/odebug.h> #include <qpe/datebookmonth.h> #include <qpe/config.h> #include <qpe/ir.h> #include <qpe/resource.h> #include <qlayout.h> #include <qtoolbutton.h> #include <qtl.h> bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); using namespace Opie::Ui; DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) @@ -304,33 +305,33 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, connect (w, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); 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&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); } -DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, +DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDBHoliday *newDB, QWidget *parent, const char *name ) : QWidget( parent, name ), db( newDB ), startTime( 0 ), ampm( ap ), bStartOnMonday(onM) { setFocusPolicy(StrongFocus); layout = new QVBoxLayout( this ); layout->setMargin(0); header=new DateBookWeekLstHeader(onM, this); layout->addWidget( header ); connect(header, SIGNAL(dateChanged(QDate&)), this, SLOT(dateChanged(QDate&))); connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); @@ -370,39 +371,39 @@ QDate DateBookWeekLst::date() { // copied from DateBookWeek QDate DateBookWeekLst::weekDate() const { QDate d=bdate; // Calculate offset to first day of week. int dayoffset=d.dayOfWeek(); if(bStartOnMonday) dayoffset--; else if( dayoffset == 7 ) dayoffset = 0; return d.addDays(-dayoffset); } void DateBookWeekLst::getEvents() { QDate start = weekDate(); //date(); - QDate stop = start.addDays(6); + QDate stop = start.addDays(7); QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); if (view) delete view; 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); view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); } else { view=new DateBookWeekLstView(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&)), this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); scroll->addChild(view); 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 @@ -1,32 +1,33 @@ #ifndef DATEBOOKWEEKLST #define DATEBOOKWEEKLST #include <qwidget.h> #include <qdatetime.h> #include <qpe/event.h> #include <qlabel.h> #include <qscrollview.h> #include "datebookweeklstheader.h" #include "datebookweeklstdayhdr.h" #include <opie2/oclickablelabel.h> class QDateTime; class DateBookDB; +class DateBookDBHoliday; class DateBookWeekLstHeader: public DateBookWeekLstHeaderBase { Q_OBJECT public: DateBookWeekLstHeader(bool onM, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~DateBookWeekLstHeader(); void setDate(const QDate &d); public slots: void nextWeek(); void prevWeek(); void nextMonth(); void prevMonth(); void pickDate(); @@ -117,61 +118,61 @@ public: signals: void editEvent(const Event &e); void duplicateEvent(const Event &e); void removeEvent(const Event &e); void beamEvent(const Event &e); void redraw(); void showDate(int y, int m, int d); void addEvent(const QDateTime &start, const QDateTime &stop, const QString &str, const QString &location); }; class DateBookWeekLst : public QWidget { Q_OBJECT public: - DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, + DateBookWeekLst( bool ampm, bool onM, DateBookDBHoliday *newDB, QWidget *parent = 0, const char *name = 0 ); ~DateBookWeekLst(); void setDate( int y, int w ); void setDate(const QDate &d ); int week() const { return _week; }; QDate date(); QDate weekDate() const; public slots: void redraw(); void dateChanged(QDate &date); protected slots: void keyPressEvent(QKeyEvent *); void setDbl(bool on); signals: void showDate(int y, int m, int d); void addEvent(const QDateTime &start, const QDateTime &stop, const QString &str, const QString &location); void editEvent(const Event &e); void duplicateEvent(const Event &e); void removeEvent(const Event &e); void beamEvent(const Event &e); private: - DateBookDB *db; + DateBookDBHoliday *db; int startTime; bool ampm; bool bStartOnMonday; bool dbl; QDate bdate; int year, _week,dow; DateBookWeekLstHeader *header; QWidget *view; QVBoxLayout *layout; QScrollView *scroll; void getEvents(); }; #endif |