-rw-r--r-- | core/pim/datebook/datebook.cpp | 78 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 29 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 14 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 4 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 37 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.h | 4 | ||||
-rw-r--r-- | core/pim/datebook/holiday/dummy/config.in | 8 | ||||
-rw-r--r-- | core/pim/datebook/holiday/dummy/dummy.pro | 20 | ||||
-rw-r--r-- | core/pim/datebook/holiday/dummy/dummyholiday.cpp | 20 | ||||
-rw-r--r-- | core/pim/datebook/holiday/dummy/dummyholiday.h | 19 |
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 @@ -17,75 +17,81 @@ ** not clear to you. ** ** $Id$ ** **********************************************************************/ #define QTOPIA_INTERNAL_FD #include "datebook.h" #include "datebookday.h" #include "datebooksettings.h" #include "datebookweek.h" #include "datebookweeklst.h" #include "dateentryimpl.h" #include <opie2/odebug.h> +#include <opie2/oholidaypluginif.h> +#include <opie2/oholidayplugin.h> #include <qpe/datebookmonth.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/finddialog.h> #include <qpe/ir.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/tzselect.h> #include <qaction.h> #include <qcopchannel_qws.h> #include <qlayout.h> #include <qmessagebox.h> #include <qtimer.h> #include <qtl.h> #include <qtoolbar.h> #include <qwidgetstack.h> +#include <qdir.h> +#include <qtopia/qlibrary.h> #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #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; odebug << "loading db t=" << t.elapsed() << oendl; + db_holiday = new DateBookHoliday(); + 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 ); // bar->setHorizontalStretchable( TRUE ); @@ -212,32 +218,33 @@ void DateBook::receive( const QCString &msg, const QByteArray &data ) viewMonth(); } else if (msg == "editEvent(int)") { int uid; stream >> uid; Event e=db->eventByUID(uid); editEvent(e); }else if (msg == "viewDefault(QDate)"){ QDate day; stream >> day; viewDefault(day); } } DateBook::~DateBook() { + delete db_holiday; } void DateBook::slotSettings() { DateBookSettings frmSettings( ampm, this ); frmSettings.setStartTime( startTime ); frmSettings.setAlarmPreset( aPreset, presetTime ); frmSettings.setJumpToCurTime( bJumpToCurTime ); frmSettings.setRowStyle( rowStyle ); frmSettings.comboDefaultView->setCurrentItem(defaultView-1); frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); bool found=false; for (int i=0; i<(frmSettings.comboLocation->count()); i++) { if ( frmSettings.comboLocation->text(i) == defaultLocation ) { frmSettings.comboLocation->setCurrentItem(i); @@ -499,33 +506,33 @@ void DateBook::removeEvent( const Event &e ) void DateBook::addEvent( const Event &e ) { QDate d = e.start().date(); initDay(); dayView->setDate( d ); } void DateBook::showDay( int year, int month, int day ) { QDate d(year, month, day); view(DAY,d); } void DateBook::initDay() { if ( !dayView ) { - dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); + dayView = new DateBookDay( ampm, onMonday, db, db_holiday, views, "day view" ); views->addWidget( dayView, DAY ); dayView->setJumpToCurTime( bJumpToCurTime ); dayView->setStartViewTime( startTime ); dayView->setRowStyle( rowStyle ); connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); connect( dayView, SIGNAL( removeEvent(const Event&) ), this, SLOT( removeEvent(const Event&) ) ); connect( dayView, SIGNAL( editEvent(const Event&) ), this, SLOT( editEvent(const Event&) ) ); connect( dayView, SIGNAL( duplicateEvent(const Event&) ), this, SLOT( duplicateEvent(const Event&) ) ); connect( dayView, SIGNAL( beamEvent(const Event&) ), this, SLOT( beamEvent(const Event&) ) ); connect( dayView, SIGNAL(sigNewEvent(const QString&)), this, SLOT(slotNewEventFromKey(const QString&)) ); } } void DateBook::initWeek() { @@ -1060,16 +1067,85 @@ Event DateBookDBHack::eventByUID(int uid) { QDate end=start.addDays(-1); QValueList<Event> myEventList=getNonRepeatingEvents(start,end); QValueList<Event> myRepeatEvents=getRawRepeats(); QValueList<Event>::ConstIterator it; for (it = myEventList.begin(); it != myEventList.end(); it++) { if ((*it).uid() == uid) return *it; } for (it = myRepeatEvents.begin(); it != myRepeatEvents.end(); it++) { if ((*it).uid() == uid) return *it; } Event ev; return ev; // return at least } + +DateBookHoliday::DateBookHoliday() +{ + _pluginlist.clear(); + init(); +} + +DateBookHoliday::~DateBookHoliday() +{ + deinit(); +} + +void DateBookHoliday::deinit() +{ + QValueList<HPlugin*>::Iterator it; + for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { + HPlugin*_pl = *it; + // destructs itself? + _pl->_if->release(); + _pl->_lib->unload(); + delete _pl->_lib; + delete _pl; + } + _pluginlist.clear(); +} + +void DateBookHoliday::init() +{ + deinit(); + QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; + QDir dir( path, "lib*.so" ); + QStringList list = dir.entryList(); + QStringList::Iterator it; + for (it=list.begin();it!=list.end();++it) { + Opie::Datebook::HolidayPluginIf*hif = 0; + QLibrary*lib=new QLibrary(path+"/"+*it); + if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) { + Opie::Datebook::HolidayPlugin*pl = hif->plugin(); + if (pl) { + HPlugin*_pl=new HPlugin; + _pl->_plugin = pl; + odebug << "Found holiday " << pl->description()<<oendl; + _pl->_lib = lib; + _pl->_if = hif; + _pluginlist.append(_pl); + } else { + } + } else { + delete lib; + } + } +} + +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)); +} + 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 @@ -23,38 +23,66 @@ #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: QDate currentDate(); @@ -97,32 +125,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; + 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? bool ampm; 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 @@ -9,32 +9,33 @@ ** 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 "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() ) { enableClipper(TRUE); setTopMargin( 0 ); horizontalHeader()->hide(); @@ -213,36 +214,37 @@ 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, QWidget *parent, const char *name ) +DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *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)) ); connect( view, SIGNAL(sigCapturedKey(const QString&)), this, SIGNAL(sigNewEvent(const QString&)) ); QTimer *timer = new QTimer( this ); @@ -344,35 +346,43 @@ void DateBookDay::dateChanged( int y, int m, int d ) } void DateBookDay::redraw() { if ( isUpdatesEnabled() ) relayoutPage(); } 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 ); QValueListIterator<EffectiveEvent> it; - QObject* object = 0; + 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&) ) ); connect( object, SIGNAL( duplicateMe(const Event&) ), this, SIGNAL( duplicateEvent(const Event&) ) ); connect( object, SIGNAL( editMe(const Event&) ), this, SIGNAL( editEvent(const Event&) ) ); 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 @@ -167,35 +167,36 @@ 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, + DateBookDay( bool ampm, bool startOnMonday, DateBookDB *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 ); void setDate( QDate ); void redraw(); void slotWeekChanged( bool bStartOnMonday ); @@ -218,19 +219,20 @@ private slots: 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; 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 a0aefd3..3c3f482 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp @@ -53,59 +53,94 @@ DatebookdayAllday::~DatebookdayAllday() } DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) { DatebookAlldayDisp * lb; lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); lb->show(); datebookdayalldayLayout->addWidget(lb); subWidgets.append(lb); connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); ++item_count; return lb; } +DatebookAlldayDisp* DatebookdayAllday::addHoliday(const QString&e) +{ + DatebookAlldayDisp * lb; + lb = new DatebookAlldayDisp(e,m_MainFrame,NULL); + lb->show(); + datebookdayalldayLayout->addWidget(lb); + subWidgets.append(lb); + + connect(lb,SIGNAL(displayMe(const Event&)),lblDesc,SLOT(disp_event(const Event&))); + ++item_count; + + return lb; +} + void DatebookdayAllday::removeAllEvents() { subWidgets.clear(); item_count = 0; } DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, QWidget* parent,const char* name,WFlags f) : QLabel(parent,name,f),m_Ev(ev),dateBook(db) { QString strDesc = m_Ev.description(); strDesc = strDesc.replace(QRegExp("<"),"<"); setBackgroundColor(yellow); setText(strDesc); setFrameStyle(QFrame::Raised|QFrame::Panel); 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); + + 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... */ if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { Event m_Event( m_Ev.event() ); QDateTime dt( m_Ev.date(), m_Ev.start() ); m_Event.setStart( dt ); dt.setTime( m_Ev.end() ); m_Event.setEnd( dt ); emit beamMe( m_Event ); }else { @@ -138,37 +173,39 @@ void DatebookAlldayDisp::beam_single_event() end.setDate( start.date().addDays( days ) ); } Event m_Event( m_Ev.event() ); m_Event.setStart( start ); m_Event.setEnd ( end ); emit beamMe( m_Event ); } } void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) { Event ev = m_Ev.event(); QColor b = backgroundColor(); setBackgroundColor(green); update(); QPopupMenu m; + if (!m_holiday) { m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); + } m.insertItem( tr( "Info"),6); int r = m.exec( e->globalPos() ); setBackgroundColor(b); update(); switch (r) { case 1: emit editMe( ev ); break; case 2: emit deleteMe( ev ); break; case 3: emit beamMe( ev ); break; case 4: emit duplicateMe( ev ); 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 @@ -11,69 +11,73 @@ class QVBoxLayout; class QHBoxLayout; class QGridLayout; class DatebookAlldayDisp; class DatebookEventDesc; class DateBookDB; class DatebookdayAllday : public QScrollView { Q_OBJECT public: DatebookdayAllday(DateBookDB* db, QWidget* parent = 0, const char* name = 0, WFlags fl = 0); ~DatebookdayAllday(); DatebookAlldayDisp* addEvent(const EffectiveEvent&e); + DatebookAlldayDisp* addHoliday(const QString&e); const unsigned int items()const{return item_count;} public slots: void removeAllEvents(); protected: QFrame * m_MainFrame; QVBoxLayout* datebookdayalldayLayout; DatebookEventDesc * lblDesc; unsigned int item_count; QList<DatebookAlldayDisp> subWidgets; DateBookDB *dateBook; }; class DatebookAlldayDisp : public QLabel { Q_OBJECT public: DatebookAlldayDisp(DateBookDB* db,const EffectiveEvent& e, QWidget* parent=0,const char* name = 0, WFlags fl=0); + DatebookAlldayDisp(const QString&aholiday, + QWidget* parent=0,const char* name = 0, WFlags fl=0); virtual ~DatebookAlldayDisp(); signals: void deleteMe( const Event &e ); void duplicateMe( const Event &e ); void editMe( const Event &e ); void beamMe( const Event &e ); void displayMe(const Event &e); public slots: protected: EffectiveEvent m_Ev; DateBookDB* dateBook; void mousePressEvent( QMouseEvent *e ); void beam_single_event(); + bool m_holiday:1; }; class DatebookEventDesc: public QLabel { Q_OBJECT public: DatebookEventDesc(QWidget* Parent=0,const char* name = 0); virtual ~DatebookEventDesc(); public slots: void disp_event(const Event&e); protected: void mousePressEvent(QMouseEvent*e); QTimer* m_Timer; 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 @@ + config DATEBOOK_DUMMY_HOLIDAY + boolean "opie-datebook-dummyholidayplugin" + default "n" + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM + + comment "opie-datebook-dummyholidayplugin requires libopie2core, libopie2ui, libopie2pim" + depends !( ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI && LIBOPIE2PIM ) + 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 @@ +TEMPLATE = lib +CONFIG -= moc +CONFIG += qt plugin + +# Input +HEADERS = dummyholiday.h +SOURCES = dummyholiday.cpp +INTERFACES= + +INCLUDEPATH += $(OPIEDIR)/include \ + ../ ../library +DEPENDPATH += $(OPIEDIR)/include \ + ../ ../library + +LIBS+= -lqpe -lopiecore2 -lopieui2 + +DESTDIR = $(OPIEDIR)/plugins/datebook/holiday +TARGET = dummyholidayplugin + +include( $(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 @@ +#include "dummyholiday.h"
+
+#include <qobject.h>
+
+QString DummyHoliday::description()
+{
+ return QObject::tr("Test holiday plugin","dummyholiday");
+}
+
+QStringList DummyHoliday::entries(const QDate&aDate)
+{
+ return entries(0,0,aDate.day());
+}
+
+QStringList DummyHoliday::entries(unsigned year, unsigned month, unsigned day)
+{
+ QStringList ret;
+ if (day%2==0) ret.append(QObject::tr("You have a holiday!","dummyholiday"));
+ return ret;
+}
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 @@ +#ifndef __DUMMY_HOLIDAY_H
+#define __DUMMY_HOLIDAY_H
+
+#include <opie2/oholidayplugin.h>
+#include <opie2/oholidaypluginif.h>
+
+class DummyHoliday:public Opie::Datebook::HolidayPlugin
+{
+public:
+ DummyHoliday():Opie::Datebook::HolidayPlugin(){}
+ virtual ~DummyHoliday(){}
+
+ virtual QString description();
+ virtual QStringList entries(const QDate&);
+ virtual QStringList entries(unsigned year, unsigned month, unsigned day);
+};
+
+EXPORT_HOLIDAY_PLUGIN(DummyHoliday);
+#endif
|