-rw-r--r-- | libopie2/opiepim/ui/oholidayplugin.h | 24 | ||||
-rw-r--r-- | libopie2/opiepim/ui/oholidaypluginif.h | 64 |
2 files changed, 88 insertions, 0 deletions
diff --git a/libopie2/opiepim/ui/oholidayplugin.h b/libopie2/opiepim/ui/oholidayplugin.h new file mode 100644 index 0000000..f4958c8 --- a/dev/null +++ b/libopie2/opiepim/ui/oholidayplugin.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef _HOLIDAY_PLUGIN_H | ||
2 | #define _HOLIDAY_PLUGIN_H | ||
3 | |||
4 | namespace Opie { | ||
5 | namespace Datebook { | ||
6 | |||
7 | #include <qstring.h> | ||
8 | #include <qstringlist.h> | ||
9 | #include <qdate.h> | ||
10 | |||
11 | class HolidayPlugin | ||
12 | { | ||
13 | public: | ||
14 | HolidayPlugin(){}; | ||
15 | virtual ~HolidayPlugin(){}; | ||
16 | virtual QString description()=0; | ||
17 | virtual QStringList entries(const QDate&)=0; | ||
18 | virtual QStringList entries(unsigned year, unsigned month, unsigned day)=0; | ||
19 | }; | ||
20 | |||
21 | } | ||
22 | } | ||
23 | #endif | ||
24 | |||
diff --git a/libopie2/opiepim/ui/oholidaypluginif.h b/libopie2/opiepim/ui/oholidaypluginif.h new file mode 100644 index 0000000..6d36f08 --- a/dev/null +++ b/libopie2/opiepim/ui/oholidaypluginif.h | |||
@@ -0,0 +1,64 @@ | |||
1 | #ifndef _O_HOLIDAY_PLUGIN_IF_H | ||
2 | #define _O_HOLIDAY_PLUGIN_IF_H | ||
3 | |||
4 | #include <opie2/odebug.h> | ||
5 | |||
6 | #include <qpe/qcom.h> | ||
7 | |||
8 | #ifndef QT_NO_COMPONENT | ||
9 | //"b981b4e9-6d5d-4ee0-a193-f8d0e443809b" | ||
10 | #define IID_HOLIDAY_PLUGIN QUuid(0xb981b4e9, 0x6d5d, 0x4ee0 0xa1, 0x93,0xf8, 0xd0, 0xe4, 0x43, 0x80, 0x9b) | ||
11 | #endif | ||
12 | |||
13 | namespace Opie { | ||
14 | namespace Datebook { | ||
15 | |||
16 | class HolidayPlugin; | ||
17 | |||
18 | class HolidayPluginIf:public QUnknownInterface | ||
19 | { | ||
20 | public: | ||
21 | HolidayPluginIf():QUnknownInterface(){} | ||
22 | virtual ~HolidayPluginIf(){} | ||
23 | |||
24 | virtual HolidayPlugin*plugin()=0; | ||
25 | }; | ||
26 | |||
27 | template<class T>HolidayPluginWrapper:public HolidayPluginIf | ||
28 | { | ||
29 | public: | ||
30 | HolidayPluginWrapper():HolidayPluginIf(),_plugin(0){} | ||
31 | virtual ~HolidayPluginWrapper(){if (_plugin) delete _plugin;} | ||
32 | |||
33 | QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) { | ||
34 | odebug << "HolidayPluginWrapper::queryInterface()" << oendl; | ||
35 | *iface = 0; | ||
36 | if (uuid==IID_HOLIDAY_PLUGIN||uuid==IID_QUnknown) { | ||
37 | *iface = this; | ||
38 | } else { | ||
39 | return QS_FALSE; | ||
40 | } | ||
41 | if (*iface) *iface->addRef(); | ||
42 | return QS_OK; | ||
43 | } | ||
44 | |||
45 | // from qcom | ||
46 | Q_REFCOUNT | ||
47 | |||
48 | virtual T*plugin() { | ||
49 | if (!_plugin) {_plugin = new T();} | ||
50 | return _plugin; | ||
51 | } | ||
52 | protected: | ||
53 | T*_plugin; | ||
54 | }; | ||
55 | |||
56 | #define EXPORT_HOLIDAY_PLUGIN( Plugin ) \ | ||
57 | Q_EXPORT_INTERFACE() { \ | ||
58 | Q_CREATE_INSTANCE( Opie::Datebook::HolidayPluginWrapper<Plugin> ) \ | ||
59 | } | ||
60 | |||
61 | } | ||
62 | } | ||
63 | #endif | ||
64 | |||