summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp78
-rw-r--r--core/pim/datebook/datebook.h29
-rw-r--r--core/pim/datebook/datebookday.cpp14
-rw-r--r--core/pim/datebook/datebookday.h4
-rw-r--r--core/pim/datebook/datebookdayallday.cpp37
-rw-r--r--core/pim/datebook/datebookdayallday.h4
-rw-r--r--core/pim/datebook/holiday/dummy/config.in8
-rw-r--r--core/pim/datebook/holiday/dummy/dummy.pro20
-rw-r--r--core/pim/datebook/holiday/dummy/dummyholiday.cpp20
-rw-r--r--core/pim/datebook/holiday/dummy/dummyholiday.h19
10 files changed, 229 insertions, 4 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index a18a5b4..f6aab0c 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -27,12 +27,14 @@
27#include "datebooksettings.h" 27#include "datebooksettings.h"
28#include "datebookweek.h" 28#include "datebookweek.h"
29#include "datebookweeklst.h" 29#include "datebookweeklst.h"
30#include "dateentryimpl.h" 30#include "dateentryimpl.h"
31 31
32#include <opie2/odebug.h> 32#include <opie2/odebug.h>
33#include <opie2/oholidaypluginif.h>
34#include <opie2/oholidayplugin.h>
33 35
34#include <qpe/datebookmonth.h> 36#include <qpe/datebookmonth.h>
35#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
36#include <qpe/config.h> 38#include <qpe/config.h>
37#include <qpe/finddialog.h> 39#include <qpe/finddialog.h>
38#include <qpe/ir.h> 40#include <qpe/ir.h>
@@ -46,12 +48,14 @@
46#include <qlayout.h> 48#include <qlayout.h>
47#include <qmessagebox.h> 49#include <qmessagebox.h>
48#include <qtimer.h> 50#include <qtimer.h>
49#include <qtl.h> 51#include <qtl.h>
50#include <qtoolbar.h> 52#include <qtoolbar.h>
51#include <qwidgetstack.h> 53#include <qwidgetstack.h>
54#include <qdir.h>
55#include <qtopia/qlibrary.h>
52 56
53#include <sys/stat.h> 57#include <sys/stat.h>
54#include <sys/types.h> 58#include <sys/types.h>
55#include <fcntl.h> 59#include <fcntl.h>
56#include <unistd.h> 60#include <unistd.h>
57 61
@@ -70,12 +74,14 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
70{ 74{
71 bool needEvilHack= false; // if we need an Evil Hack 75 bool needEvilHack= false; // if we need an Evil Hack
72 QTime t; 76 QTime t;
73 t.start(); 77 t.start();
74 db = new DateBookDBHack; 78 db = new DateBookDBHack;
75 odebug << "loading db t=" << t.elapsed() << oendl; 79 odebug << "loading db t=" << t.elapsed() << oendl;
80 db_holiday = new DateBookHoliday();
81
76 loadSettings(); 82 loadSettings();
77 setCaption( tr("Calendar") ); 83 setCaption( tr("Calendar") );
78 setIcon( Resource::loadPixmap( "datebook_icon" ) ); 84 setIcon( Resource::loadPixmap( "datebook_icon" ) );
79 85
80 setToolBarsMovable( FALSE ); 86 setToolBarsMovable( FALSE );
81 87
@@ -222,12 +228,13 @@ void DateBook::receive( const QCString &msg, const QByteArray &data )
222 viewDefault(day); 228 viewDefault(day);
223 } 229 }
224} 230}
225 231
226DateBook::~DateBook() 232DateBook::~DateBook()
227{ 233{
234 delete db_holiday;
228} 235}
229 236
230void DateBook::slotSettings() 237void DateBook::slotSettings()
231{ 238{
232 DateBookSettings frmSettings( ampm, this ); 239 DateBookSettings frmSettings( ampm, this );
233 frmSettings.setStartTime( startTime ); 240 frmSettings.setStartTime( startTime );
@@ -509,13 +516,13 @@ void DateBook::showDay( int year, int month, int day )
509 view(DAY,d); 516 view(DAY,d);
510} 517}
511 518
512void DateBook::initDay() 519void DateBook::initDay()
513{ 520{
514 if ( !dayView ) { 521 if ( !dayView ) {
515 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); 522 dayView = new DateBookDay( ampm, onMonday, db, db_holiday, views, "day view" );
516 views->addWidget( dayView, DAY ); 523 views->addWidget( dayView, DAY );
517 dayView->setJumpToCurTime( bJumpToCurTime ); 524 dayView->setJumpToCurTime( bJumpToCurTime );
518 dayView->setStartViewTime( startTime ); 525 dayView->setStartViewTime( startTime );
519 dayView->setRowStyle( rowStyle ); 526 dayView->setRowStyle( rowStyle );
520 connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); 527 connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) );
521 connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); 528 connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) );
@@ -1070,6 +1077,75 @@ Event DateBookDBHack::eventByUID(int uid) {
1070 if ((*it).uid() == uid) return *it; 1077 if ((*it).uid() == uid) return *it;
1071 } 1078 }
1072 1079
1073 Event ev; 1080 Event ev;
1074 return ev; // return at least 1081 return ev; // return at least
1075} 1082}
1083
1084DateBookHoliday::DateBookHoliday()
1085{
1086 _pluginlist.clear();
1087 init();
1088}
1089
1090DateBookHoliday::~DateBookHoliday()
1091{
1092 deinit();
1093}
1094
1095void DateBookHoliday::deinit()
1096{
1097 QValueList<HPlugin*>::Iterator it;
1098 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
1099 HPlugin*_pl = *it;
1100 // destructs itself?
1101 _pl->_if->release();
1102 _pl->_lib->unload();
1103 delete _pl->_lib;
1104 delete _pl;
1105 }
1106 _pluginlist.clear();
1107}
1108
1109void DateBookHoliday::init()
1110{
1111 deinit();
1112 QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday";
1113 QDir dir( path, "lib*.so" );
1114 QStringList list = dir.entryList();
1115 QStringList::Iterator it;
1116 for (it=list.begin();it!=list.end();++it) {
1117 Opie::Datebook::HolidayPluginIf*hif = 0;
1118 QLibrary*lib=new QLibrary(path+"/"+*it);
1119 if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) {
1120 Opie::Datebook::HolidayPlugin*pl = hif->plugin();
1121 if (pl) {
1122 HPlugin*_pl=new HPlugin;
1123 _pl->_plugin = pl;
1124 odebug << "Found holiday " << pl->description()<<oendl;
1125 _pl->_lib = lib;
1126 _pl->_if = hif;
1127 _pluginlist.append(_pl);
1128 } else {
1129 }
1130 } else {
1131 delete lib;
1132 }
1133 }
1134}
1135
1136QStringList DateBookHoliday::holidaylist(const QDate&aDate)
1137{
1138 QStringList ret;
1139 QValueList<HPlugin*>::Iterator it;
1140 for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
1141 HPlugin*_pl = *it;
1142 ret+=_pl->_plugin->entries(aDate);
1143 }
1144 return ret;
1145}
1146
1147QStringList DateBookHoliday::holidaylist(unsigned year, unsigned month, unsigned day)
1148{
1149 return holidaylist(QDate(year,month,day));
1150}
1151
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
index d7cfb33..54ffcfb 100644
--- a/core/pim/datebook/datebook.h
+++ b/core/pim/datebook/datebook.h
@@ -33,18 +33,46 @@ class DateBookDay;
33class DateBookWeek; 33class DateBookWeek;
34class DateBookWeekLst; 34class DateBookWeekLst;
35class DateBookMonth; 35class DateBookMonth;
36class Event; 36class Event;
37class QDate; 37class QDate;
38class Ir; 38class Ir;
39class QLibrary;
40
41namespace Opie {
42namespace Datebook {
43 class HolidayPlugin;
44 class HolidayPluginIf;
45}
46}
39 47
40class DateBookDBHack : public DateBookDB { 48class DateBookDBHack : public DateBookDB {
41 public: 49 public:
42 Event eventByUID(int id); 50 Event eventByUID(int id);
43}; 51};
44 52
53class DateBookHoliday
54{
55public:
56 DateBookHoliday();
57 virtual ~DateBookHoliday();
58
59 QStringList holidaylist(const QDate&);
60 QStringList holidaylist(unsigned year, unsigned month, unsigned day);
61protected:
62 void init();
63 void deinit();
64
65 struct HPlugin {
66 Opie::Datebook::HolidayPlugin*_plugin;
67 QLibrary*_lib;
68 Opie::Datebook::HolidayPluginIf*_if;
69 };
70 QValueList<HPlugin*>_pluginlist;
71};
72
45class DateBook : public QMainWindow 73class DateBook : public QMainWindow
46{ 74{
47 Q_OBJECT 75 Q_OBJECT
48 76
49public: 77public:
50 static QString appName() { return QString::fromLatin1("datebook"); } 78 static QString appName() { return QString::fromLatin1("datebook"); }
@@ -107,12 +135,13 @@ private:
107 void initMonth(); 135 void initMonth();
108 void loadSettings(); 136 void loadSettings();
109 void saveSettings(); 137 void saveSettings();
110 138
111private: 139private:
112 DateBookDBHack *db; 140 DateBookDBHack *db;
141 DateBookHoliday*db_holiday;
113 QWidgetStack *views; 142 QWidgetStack *views;
114 DateBookDay *dayView; 143 DateBookDay *dayView;
115 DateBookWeek *weekView; 144 DateBookWeek *weekView;
116 DateBookMonth *monthView; 145 DateBookMonth *monthView;
117 DateBookWeekLst *weekLstView; 146 DateBookWeekLst *weekLstView;
118 QAction *dayAction, *weekAction, *weekLstAction, *monthAction; 147 QAction *dayAction, *weekAction, *weekLstAction, *monthAction;
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index ca63dc5..dfe39e5 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -19,12 +19,13 @@
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "datebookday.h" 21#include "datebookday.h"
22#include "datebookdayheaderimpl.h" 22#include "datebookdayheaderimpl.h"
23#include "datebookdayallday.h" 23#include "datebookdayallday.h"
24 24
25#include <opie2/oholidayplugin.h>
25#include <qpe/resource.h> 26#include <qpe/resource.h>
26#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
27#include <qpe/ir.h> 28#include <qpe/ir.h>
28 29
29#include <qsimplerichtext.h> 30#include <qsimplerichtext.h>
30#include <qpopupmenu.h> 31#include <qpopupmenu.h>
@@ -223,16 +224,17 @@ void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent* /* e */)
223{ 224{
224 slotReturnPressed(); // Reuse code to add event and close this widget. 225 slotReturnPressed(); // Reuse code to add event and close this widget.
225} 226}
226 227
227//=========================================================================== 228//===========================================================================
228 229
229DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) 230DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, DateBookHoliday*newHdb, QWidget *parent, const char *name )
230 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) 231 : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 )
231{ 232{
232 widgetList.setAutoDelete( true ); 233 widgetList.setAutoDelete( true );
234 _holiday_db = newHdb;
233 header = new DateBookDayHeader( startOnMonday, this, "day header" ); 235 header = new DateBookDayHeader( startOnMonday, this, "day header" );
234 header->setDate( currDate.year(), currDate.month(), currDate.day() ); 236 header->setDate( currDate.year(), currDate.month(), currDate.day() );
235 237
236 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); 238 m_allDays = new DatebookdayAllday(newDb, this, "all day event list" );
237 m_allDays->hide(); 239 m_allDays->hide();
238 240
@@ -354,15 +356,23 @@ void DateBookDay::getEvents()
354 widgetList.clear(); 356 widgetList.clear();
355 357
356 /* clear the AllDay List */ 358 /* clear the AllDay List */
357 m_allDays->hide(); // just in case 359 m_allDays->hide(); // just in case
358 m_allDays->removeAllEvents(); 360 m_allDays->removeAllEvents();
359 361
362 QStringList hdays = _holiday_db->holidaylist(currDate);
363 QStringList::Iterator sit;
364 QObject* object = 0;
365 for (sit=hdays.begin();sit!=hdays.end();++sit) {
366 object = m_allDays->addHoliday(*sit);
367 if (!object) continue;
368 /* not to do something with it */
369 }
360 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); 370 QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate );
361 QValueListIterator<EffectiveEvent> it; 371 QValueListIterator<EffectiveEvent> it;
362 QObject* object = 0; 372
363 for ( it = eventList.begin(); it != eventList.end(); ++it ) { 373 for ( it = eventList.begin(); it != eventList.end(); ++it ) {
364 EffectiveEvent ev=*it; 374 EffectiveEvent ev=*it;
365 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day. 375 if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day.
366 if (ev.event().type() == Event::AllDay ) { 376 if (ev.event().type() == Event::AllDay ) {
367 object = m_allDays->addEvent( ev ); 377 object = m_allDays->addEvent( ev );
368 if (!object) 378 if (!object)
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h
index c8cb26b..3e44364 100644
--- a/core/pim/datebook/datebookday.h
+++ b/core/pim/datebook/datebookday.h
@@ -177,15 +177,16 @@ class WidgetListClass : public QList<DateBookDayWidget>
177class DateBookDay : public QVBox 177class DateBookDay : public QVBox
178{ 178{
179 Q_OBJECT 179 Q_OBJECT
180 180
181 friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB 181 friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB
182public: 182public:
183 DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, 183 DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb,DateBookHoliday*newHdb,
184 QWidget *parent, const char *name ); 184 QWidget *parent, const char *name );
185 void selectedDates( QDateTime &start, QDateTime &end ); 185 void selectedDates( QDateTime &start, QDateTime &end );
186
186 QDate date() const; 187 QDate date() const;
187 DateBookDayView *dayView() const { return view; } 188 DateBookDayView *dayView() const { return view; }
188 void setStartViewTime( int startHere ); 189 void setStartViewTime( int startHere );
189 int startViewTime() const; 190 int startViewTime() const;
190 void setSelectedWidget( DateBookDayWidget * ); 191 void setSelectedWidget( DateBookDayWidget * );
191 DateBookDayWidget * getSelectedWidget( void ); 192 DateBookDayWidget * getSelectedWidget( void );
@@ -228,9 +229,10 @@ private:
228 WidgetListClass widgetList;//reimplemented QList for sorting widgets by height 229 WidgetListClass widgetList;//reimplemented QList for sorting widgets by height
229 int startTime; 230 int startTime;
230 bool jumpToCurTime;//should we jump to current time in dayview? 231 bool jumpToCurTime;//should we jump to current time in dayview?
231 int rowStyle; 232 int rowStyle;
232 DateBookDayWidget *selectedWidget; //actual selected widget (obviously) 233 DateBookDayWidget *selectedWidget; //actual selected widget (obviously)
233 DateBookDayTimeMarker *timeMarker;//marker for current time 234 DateBookDayTimeMarker *timeMarker;//marker for current time
235 DateBookHoliday*_holiday_db;
234}; 236};
235 237
236#endif 238#endif
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp
index a0aefd3..3c3f482 100644
--- a/core/pim/datebook/datebookdayallday.cpp
+++ b/core/pim/datebook/datebookdayallday.cpp
@@ -63,12 +63,26 @@ DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev)
63 connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); 63 connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&)));
64 ++item_count; 64 ++item_count;
65 65
66 return lb; 66 return lb;
67} 67}
68 68
69DatebookAlldayDisp* DatebookdayAllday::addHoliday(const QString&e)
70{
71 DatebookAlldayDisp * lb;
72 lb = new DatebookAlldayDisp(e,m_MainFrame,NULL);
73 lb->show();
74 datebookdayalldayLayout->addWidget(lb);
75 subWidgets.append(lb);
76
77 connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&)));
78 ++item_count;
79
80 return lb;
81}
82
69void DatebookdayAllday::removeAllEvents() 83void DatebookdayAllday::removeAllEvents()
70{ 84{
71 subWidgets.clear(); 85 subWidgets.clear();
72 item_count = 0; 86 item_count = 0;
73} 87}
74 88
@@ -82,20 +96,41 @@ DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev,
82 setText(strDesc); 96 setText(strDesc);
83 setFrameStyle(QFrame::Raised|QFrame::Panel); 97 setFrameStyle(QFrame::Raised|QFrame::Panel);
84 98
85 int s = QFontMetrics(font()).height()+4; 99 int s = QFontMetrics(font()).height()+4;
86 setMaximumHeight( s ); 100 setMaximumHeight( s );
87 setMinimumSize( QSize( 0, s ) ); 101 setMinimumSize( QSize( 0, s ) );
102 m_holiday = false;
103}
104
105DatebookAlldayDisp::DatebookAlldayDisp(const QString&aholiday,QWidget* parent,const char* name, WFlags fl)
106 : QLabel(parent,name,fl),m_Ev(),dateBook(0)
107{
108 QString strDesc = aholiday;
109 strDesc = strDesc.replace(QRegExp("<"),"&#60;");
110 Event ev;
111 ev.setDescription(strDesc);
112 ev.setAllDay(true);
113 m_Ev.setEvent(ev);
114 setBackgroundColor(yellow);
115 setText(strDesc);
116 setFrameStyle(QFrame::Raised|QFrame::Panel);
117
118 int s = QFontMetrics(font()).height()+4;
119 setMaximumHeight( s );
120 setMinimumSize( QSize( 0, s ) );
121 m_holiday = true;
88} 122}
89 123
90DatebookAlldayDisp::~DatebookAlldayDisp() 124DatebookAlldayDisp::~DatebookAlldayDisp()
91{ 125{
92} 126}
93 127
94void DatebookAlldayDisp::beam_single_event() 128void DatebookAlldayDisp::beam_single_event()
95{ 129{
130 if (m_holiday) return;
96 // create an Event and beam it... 131 // create an Event and beam it...
97 /* 132 /*
98 * Start with the easy stuff. If start and end date is the same we can just use 133 * Start with the easy stuff. If start and end date is the same we can just use
99 * the values of effective m_Events 134 * the values of effective m_Events
100 * If it is a multi day m_Event we need to find the real start and end date... 135 * If it is a multi day m_Event we need to find the real start and end date...
101 */ 136 */
@@ -148,17 +183,19 @@ void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e)
148{ 183{
149 Event ev = m_Ev.event(); 184 Event ev = m_Ev.event();
150 QColor b = backgroundColor(); 185 QColor b = backgroundColor();
151 setBackgroundColor(green); 186 setBackgroundColor(green);
152 update(); 187 update();
153 QPopupMenu m; 188 QPopupMenu m;
189 if (!m_holiday) {
154 m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); 190 m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 );
155 m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); 191 m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 );
156 m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); 192 m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 );
157 if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); 193 if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 );
158 if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); 194 if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 );
195 }
159 m.insertItem( tr( "Info"),6); 196 m.insertItem( tr( "Info"),6);
160 int r = m.exec( e->globalPos() ); 197 int r = m.exec( e->globalPos() );
161 setBackgroundColor(b); 198 setBackgroundColor(b);
162 update(); 199 update();
163 switch (r) { 200 switch (r) {
164 case 1: 201 case 1:
diff --git a/core/pim/datebook/datebookdayallday.h b/core/pim/datebook/datebookdayallday.h
index f5867e5..4f5cffa 100644
--- a/core/pim/datebook/datebookdayallday.h
+++ b/core/pim/datebook/datebookdayallday.h
@@ -21,12 +21,13 @@ class DatebookdayAllday : public QScrollView
21 21
22public: 22public:
23 DatebookdayAllday(DateBookDB* db, 23 DatebookdayAllday(DateBookDB* db,
24 QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 24 QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
25 ~DatebookdayAllday(); 25 ~DatebookdayAllday();
26 DatebookAlldayDisp* addEvent(const EffectiveEvent&e); 26 DatebookAlldayDisp* addEvent(const EffectiveEvent&e);
27 DatebookAlldayDisp* addHoliday(const QString&e);
27 const unsigned int items()const{return item_count;} 28 const unsigned int items()const{return item_count;}
28 29
29public slots: 30public slots:
30 void removeAllEvents(); 31 void removeAllEvents();
31 32
32protected: 33protected:
@@ -42,12 +43,14 @@ class DatebookAlldayDisp : public QLabel
42{ 43{
43 Q_OBJECT 44 Q_OBJECT
44 45
45public: 46public:
46 DatebookAlldayDisp(DateBookDB* db,const EffectiveEvent& e, 47 DatebookAlldayDisp(DateBookDB* db,const EffectiveEvent& e,
47 QWidget* parent=0,const char* name = 0, WFlags fl=0); 48 QWidget* parent=0,const char* name = 0, WFlags fl=0);
49 DatebookAlldayDisp(const QString&aholiday,
50 QWidget* parent=0,const char* name = 0, WFlags fl=0);
48 virtual ~DatebookAlldayDisp(); 51 virtual ~DatebookAlldayDisp();
49 52
50signals: 53signals:
51 void deleteMe( const Event &e ); 54 void deleteMe( const Event &e );
52 void duplicateMe( const Event &e ); 55 void duplicateMe( const Event &e );
53 void editMe( const Event &e ); 56 void editMe( const Event &e );
@@ -58,12 +61,13 @@ public slots:
58 61
59protected: 62protected:
60 EffectiveEvent m_Ev; 63 EffectiveEvent m_Ev;
61 DateBookDB* dateBook; 64 DateBookDB* dateBook;
62 void mousePressEvent( QMouseEvent *e ); 65 void mousePressEvent( QMouseEvent *e );
63 void beam_single_event(); 66 void beam_single_event();
67 bool m_holiday:1;
64}; 68};
65 69
66class DatebookEventDesc: public QLabel 70class DatebookEventDesc: public QLabel
67{ 71{
68 Q_OBJECT 72 Q_OBJECT
69 73
diff --git a/core/pim/datebook/holiday/dummy/config.in b/core/pim/datebook/holiday/dummy/config.in
new file mode 100644
index 0000000..caa90bc
--- a/dev/null
+++ b/core/pim/datebook/holiday/dummy/config.in
@@ -0,0 +1,8 @@
1 config DATEBOOK_DUMMY_HOLIDAY
2 boolean "opie-datebook-dummyholidayplugin"
3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM
5
6 comment "opie-datebook-dummyholidayplugin requires libopie2core, libopie2ui, libopie2pim"
7 depends !( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM )
8
diff --git a/core/pim/datebook/holiday/dummy/dummy.pro b/core/pim/datebook/holiday/dummy/dummy.pro
new file mode 100644
index 0000000..768bb77
--- a/dev/null
+++ b/core/pim/datebook/holiday/dummy/dummy.pro
@@ -0,0 +1,20 @@
1TEMPLATE = lib
2CONFIG -= moc
3CONFIG += qt plugin
4
5# Input
6HEADERS = dummyholiday.h
7SOURCES = dummyholiday.cpp
8INTERFACES=
9
10INCLUDEPATH += $(OPIEDIR)/include \
11 ../ ../library
12DEPENDPATH += $(OPIEDIR)/include \
13 ../ ../library
14
15LIBS+= -lqpe -lopiecore2 -lopieui2
16
17DESTDIR = $(OPIEDIR)/plugins/datebook/holiday
18TARGET = dummyholidayplugin
19
20include( $(OPIEDIR)/include.pro )
diff --git a/core/pim/datebook/holiday/dummy/dummyholiday.cpp b/core/pim/datebook/holiday/dummy/dummyholiday.cpp
new file mode 100644
index 0000000..dd00b9b
--- a/dev/null
+++ b/core/pim/datebook/holiday/dummy/dummyholiday.cpp
@@ -0,0 +1,20 @@
1#include "dummyholiday.h"
2
3#include <qobject.h>
4
5QString DummyHoliday::description()
6{
7 return QObject::tr("Test holiday plugin","dummyholiday");
8}
9
10QStringList DummyHoliday::entries(const QDate&aDate)
11{
12 return entries(0,0,aDate.day());
13}
14
15QStringList DummyHoliday::entries(unsigned year, unsigned month, unsigned day)
16{
17 QStringList ret;
18 if (day%2==0) ret.append(QObject::tr("You have a holiday!","dummyholiday"));
19 return ret;
20}
diff --git a/core/pim/datebook/holiday/dummy/dummyholiday.h b/core/pim/datebook/holiday/dummy/dummyholiday.h
new file mode 100644
index 0000000..9b28f24
--- a/dev/null
+++ b/core/pim/datebook/holiday/dummy/dummyholiday.h
@@ -0,0 +1,19 @@
1#ifndef __DUMMY_HOLIDAY_H
2#define __DUMMY_HOLIDAY_H
3
4#include <opie2/oholidayplugin.h>
5#include <opie2/oholidaypluginif.h>
6
7class DummyHoliday:public Opie::Datebook::HolidayPlugin
8{
9public:
10 DummyHoliday():Opie::Datebook::HolidayPlugin(){}
11 virtual ~DummyHoliday(){}
12
13 virtual QString description();
14 virtual QStringList entries(const QDate&);
15 virtual QStringList entries(unsigned year, unsigned month, unsigned day);
16};
17
18EXPORT_HOLIDAY_PLUGIN(DummyHoliday);
19#endif