-rw-r--r-- | libopie2/opiepim/ui/oholidayplugin.h | 6 | ||||
-rw-r--r-- | libopie2/opiepim/ui/oholidayplugincfgwidget.cpp | 14 | ||||
-rw-r--r-- | libopie2/opiepim/ui/oholidayplugincfgwidget.h | 30 | ||||
-rw-r--r-- | libopie2/opiepim/ui/oholidaypluginif.h | 8 | ||||
-rw-r--r-- | libopie2/opiepim/ui/ui.pro | 8 |
5 files changed, 58 insertions, 8 deletions
diff --git a/libopie2/opiepim/ui/oholidayplugin.h b/libopie2/opiepim/ui/oholidayplugin.h index 52db0eb..192a020 100644 --- a/libopie2/opiepim/ui/oholidayplugin.h +++ b/libopie2/opiepim/ui/oholidayplugin.h | |||
@@ -1,29 +1,33 @@ | |||
1 | #ifndef _HOLIDAY_PLUGIN_H | 1 | #ifndef _HOLIDAY_PLUGIN_H |
2 | #define _HOLIDAY_PLUGIN_H | 2 | #define _HOLIDAY_PLUGIN_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qdatetime.h> | 6 | #include <qdatetime.h> |
7 | #include <qmap.h> | 7 | #include <qmap.h> |
8 | #include <qwidget.h> | ||
8 | 9 | ||
9 | class EffectiveEvent; | 10 | class EffectiveEvent; |
10 | 11 | ||
11 | namespace Opie { | 12 | namespace Opie { |
12 | namespace Datebook { | 13 | namespace Datebook { |
13 | 14 | ||
15 | class HolidayPluginConfigWidget; | ||
16 | |||
14 | class HolidayPlugin | 17 | class HolidayPlugin |
15 | { | 18 | { |
16 | public: | 19 | public: |
17 | HolidayPlugin(){}; | 20 | HolidayPlugin(){}; |
18 | virtual ~HolidayPlugin(){}; | 21 | virtual ~HolidayPlugin(){}; |
19 | virtual QString description()=0; | 22 | virtual QString description()=0; |
20 | virtual QStringList entries(const QDate&)=0; | 23 | virtual QStringList entries(const QDate&)=0; |
21 | virtual QStringList entries(unsigned year, unsigned month, unsigned day)=0; | 24 | virtual QStringList entries(unsigned year, unsigned month, unsigned day)=0; |
22 | virtual QMap<QDate,QStringList> entries(const QDate&,const QDate&)=0; | 25 | virtual QMap<QDate,QStringList> entries(const QDate&,const QDate&)=0; |
23 | virtual QValueList<EffectiveEvent> events(const QDate&,const QDate&)=0; | 26 | virtual QValueList<EffectiveEvent> events(const QDate&,const QDate&)=0; |
24 | }; | ||
25 | 27 | ||
28 | virtual HolidayPluginConfigWidget*configWidget(QWidget *parent=0, const char *name = 0, QWidget::WFlags fl = 0 ){return 0;} | ||
29 | }; | ||
26 | } | 30 | } |
27 | } | 31 | } |
28 | #endif | 32 | #endif |
29 | 33 | ||
diff --git a/libopie2/opiepim/ui/oholidayplugincfgwidget.cpp b/libopie2/opiepim/ui/oholidayplugincfgwidget.cpp new file mode 100644 index 0000000..43380bb --- a/dev/null +++ b/libopie2/opiepim/ui/oholidayplugincfgwidget.cpp | |||
@@ -0,0 +1,14 @@ | |||
1 | #include "oholidayplugincfgwidget.h" | ||
2 | |||
3 | namespace Opie { | ||
4 | namespace Datebook { | ||
5 | HolidayPluginConfigWidget::HolidayPluginConfigWidget( QWidget* parent, const char* name, WFlags fl ) | ||
6 | : QWidget( parent, name, fl ) | ||
7 | {} | ||
8 | |||
9 | HolidayPluginConfigWidget::~HolidayPluginConfigWidget() | ||
10 | {} | ||
11 | |||
12 | } | ||
13 | } | ||
14 | |||
diff --git a/libopie2/opiepim/ui/oholidayplugincfgwidget.h b/libopie2/opiepim/ui/oholidayplugincfgwidget.h new file mode 100644 index 0000000..17af467 --- a/dev/null +++ b/libopie2/opiepim/ui/oholidayplugincfgwidget.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef _HOLIDAY_PLUGIN_CFG_WIDGET | ||
2 | #define _HOLIDAY_PLUGIN_CFG_WIDGET | ||
3 | #include <qwidget.h> | ||
4 | |||
5 | namespace Opie { | ||
6 | namespace Datebook { | ||
7 | class HolidayPluginConfigWidget:public QWidget | ||
8 | { | ||
9 | Q_OBJECT | ||
10 | public: | ||
11 | /** | ||
12 | * This will construct the widget. The widget gets deleted once the parent | ||
13 | * gets deleted as in any Qt application | ||
14 | * | ||
15 | * A Parent is required! | ||
16 | * | ||
17 | * @param parent The parent of the widget | ||
18 | * @param name The name of the object | ||
19 | */ | ||
20 | HolidayPluginConfigWidget(QWidget *parent, const char *name = 0, WFlags fl = 0 ); | ||
21 | virtual ~HolidayPluginConfigWidget(); | ||
22 | |||
23 | virtual void saveConfig()=0; | ||
24 | }; | ||
25 | |||
26 | } | ||
27 | } | ||
28 | |||
29 | #endif | ||
30 | |||
diff --git a/libopie2/opiepim/ui/oholidaypluginif.h b/libopie2/opiepim/ui/oholidaypluginif.h index 825d3ad..618d371 100644 --- a/libopie2/opiepim/ui/oholidaypluginif.h +++ b/libopie2/opiepim/ui/oholidaypluginif.h | |||
@@ -1,62 +1,60 @@ | |||
1 | #ifndef _O_HOLIDAY_PLUGIN_IF_H | 1 | #ifndef _O_HOLIDAY_PLUGIN_IF_H |
2 | #define _O_HOLIDAY_PLUGIN_IF_H | 2 | #define _O_HOLIDAY_PLUGIN_IF_H |
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <qpe/qcom.h> | 4 | #include <qpe/qcom.h> |
5 | 5 | ||
6 | #ifndef QT_NO_COMPONENT | 6 | #ifndef QT_NO_COMPONENT |
7 | //017f90d4-34fc-4dc5-aed7-498c6da6571e | 7 | //c0a5f73f-975e-4492-9285-af555284c4ab |
8 | #define IID_HOLIDAY_PLUGIN QUuid(0x017f90d4,0x34fc,0x4dc5,0xae,0xd7,0x49,0x8c,0x6d,0xa6,0x57,0x1e) | 8 | #define IID_HOLIDAY_PLUGIN QUuid(0xc0a5f73f,0x975e,0x4492,0x92,0x85,0xaf,0x55,0x52,0x84,0xc4,0xab) |
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | namespace Opie { | 11 | namespace Opie { |
12 | namespace Datebook { | 12 | namespace Datebook { |
13 | 13 | ||
14 | class HolidayPlugin; | 14 | class HolidayPlugin; |
15 | 15 | ||
16 | class HolidayPluginIf:public QUnknownInterface | 16 | class HolidayPluginIf:public QUnknownInterface |
17 | { | 17 | { |
18 | public: | 18 | public: |
19 | HolidayPluginIf():QUnknownInterface(){} | 19 | HolidayPluginIf():QUnknownInterface(){} |
20 | virtual ~HolidayPluginIf(){} | 20 | virtual ~HolidayPluginIf(){} |
21 | 21 | ||
22 | virtual HolidayPlugin*plugin()=0; | 22 | virtual HolidayPlugin*plugin()=0; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | template<class T> class HolidayPluginWrapper:public HolidayPluginIf | 25 | template<class T> class HolidayPluginWrapper:public HolidayPluginIf |
26 | { | 26 | { |
27 | public: | 27 | public: |
28 | HolidayPluginWrapper():HolidayPluginIf(),_plugin(0){} | 28 | HolidayPluginWrapper():HolidayPluginIf(),_plugin(0){} |
29 | virtual ~HolidayPluginWrapper(){if (_plugin) delete _plugin;} | 29 | virtual ~HolidayPluginWrapper(){if (_plugin) delete _plugin;} |
30 | 30 | ||
31 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) { | 31 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) { |
32 | odebug << "HolidayPluginWrapper::queryInterface()" << oendl; | ||
33 | *iface = 0; | 32 | *iface = 0; |
34 | if (uuid == IID_HOLIDAY_PLUGIN || uuid == IID_QUnknown) { | 33 | if (uuid == IID_HOLIDAY_PLUGIN || uuid == IID_QUnknown) { |
35 | *iface = this; | 34 | *iface = this; |
36 | } else { | 35 | } else { |
37 | return QS_FALSE; | 36 | return QS_FALSE; |
38 | } | 37 | } |
39 | if (*iface) (*iface)->addRef(); | 38 | if (*iface) (*iface)->addRef(); |
40 | return QS_OK; | 39 | return QS_OK; |
41 | } | 40 | } |
42 | 41 | ||
43 | // from qcom | 42 | // from qcom |
44 | Q_REFCOUNT | 43 | Q_REFCOUNT |
45 | 44 | ||
46 | virtual T*plugin() { | 45 | virtual T*plugin() { |
47 | if (!_plugin) {_plugin = new T();} | 46 | if (!_plugin) {_plugin = new T();} |
48 | return _plugin; | 47 | return _plugin; |
49 | } | 48 | } |
50 | protected: | 49 | protected: |
51 | T*_plugin; | 50 | T*_plugin; |
52 | }; | 51 | }; |
53 | 52 | ||
54 | #define EXPORT_HOLIDAY_PLUGIN( Plugin ) \ | 53 | #define EXPORT_HOLIDAY_PLUGIN( Plugin ) \ |
55 | Q_EXPORT_INTERFACE() { \ | 54 | Q_EXPORT_INTERFACE() { \ |
56 | Q_CREATE_INSTANCE( Opie::Datebook::HolidayPluginWrapper<Plugin> ) \ | 55 | Q_CREATE_INSTANCE( Opie::Datebook::HolidayPluginWrapper<Plugin> ) \ |
57 | } | 56 | } |
58 | |||
59 | } | 57 | } |
60 | } | 58 | } |
61 | #endif | 59 | #endif |
62 | 60 | ||
diff --git a/libopie2/opiepim/ui/ui.pro b/libopie2/opiepim/ui/ui.pro index 53c7ae2..97c8d81 100644 --- a/libopie2/opiepim/ui/ui.pro +++ b/libopie2/opiepim/ui/ui.pro | |||
@@ -1,10 +1,14 @@ | |||
1 | HEADERS += ui/opimmainwindow.h \ | 1 | HEADERS += ui/opimmainwindow.h \ |
2 | ui/opimrecurrencewidget.h \ | 2 | ui/opimrecurrencewidget.h \ |
3 | ui/todayconfigwidget.h \ | 3 | ui/todayconfigwidget.h \ |
4 | ui/todayplugininterface.h | 4 | ui/todayplugininterface.h \ |
5 | ui/oholidayplugin.h \ | ||
6 | ui/oholidayplugincfgwidget.h \ | ||
7 | ui/oholidaypluginif.h | ||
5 | 8 | ||
6 | SOURCES += ui/opimmainwindow.cpp \ | 9 | SOURCES += ui/opimmainwindow.cpp \ |
7 | ui/opimrecurrencewidget.cpp \ | 10 | ui/opimrecurrencewidget.cpp \ |
8 | ui/todayconfigwidget.cpp | 11 | ui/todayconfigwidget.cpp \ |
12 | ui/oholidayplugincfgwidget.cpp | ||
9 | 13 | ||
10 | INTERFACES += ui/opimrecurrencebase.ui | 14 | INTERFACES += ui/opimrecurrencebase.ui |