summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-16 10:05:50 (UTC)
committer alwin <alwin>2005-03-16 10:05:50 (UTC)
commit954092e015c34ea0848f41d8acb7b957b12d6384 (patch) (unidiff)
treedab1b992308a6dc7ce91163a2d5acef94f4f6f12
parentf53596e1ab4c64bc0b714c58060f78b198c22f5f (diff)
downloadopie-954092e015c34ea0848f41d8acb7b957b12d6384.zip
opie-954092e015c34ea0848f41d8acb7b957b12d6384.tar.gz
opie-954092e015c34ea0848f41d8acb7b957b12d6384.tar.bz2
first shot of a generic interface for holiday plugin in datebook
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ui/oholidayplugin.h24
-rw-r--r--libopie2/opiepim/ui/oholidaypluginif.h64
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
4namespace Opie {
5namespace Datebook {
6
7#include <qstring.h>
8#include <qstringlist.h>
9#include <qdate.h>
10
11class HolidayPlugin
12{
13public:
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
13namespace Opie {
14namespace Datebook {
15
16class HolidayPlugin;
17
18class HolidayPluginIf:public QUnknownInterface
19{
20public:
21 HolidayPluginIf():QUnknownInterface(){}
22 virtual ~HolidayPluginIf(){}
23
24 virtual HolidayPlugin*plugin()=0;
25};
26
27template<class T>HolidayPluginWrapper:public HolidayPluginIf
28{
29public:
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 }
52protected:
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