summaryrefslogtreecommitdiff
path: root/libopie2
authoralwin <alwin>2005-03-18 16:57:24 (UTC)
committer alwin <alwin>2005-03-18 16:57:24 (UTC)
commit977193cc46768da220ddb01aca74286b28e6b7ee (patch) (unidiff)
treeeff59fc4011b0b3a6fd610b2b04e934eb21a0687 /libopie2
parentf32b76432aeb554204f06ca15ed1ec8d5387fb12 (diff)
downloadopie-977193cc46768da220ddb01aca74286b28e6b7ee.zip
opie-977193cc46768da220ddb01aca74286b28e6b7ee.tar.gz
opie-977193cc46768da220ddb01aca74286b28e6b7ee.tar.bz2
work on plugins finished.
these plugins now may have a config-widget (sorry guys - I had to change the plugininterface and so the UUID again.) the plugin for nationalholidays now has such a widget, the datebook will insert configwidgets into its settingsdialog. corrected the .pro file of opiepim2/ui so it contains the header/cpp files for that pluginsystem.
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/ui/oholidayplugin.h6
-rw-r--r--libopie2/opiepim/ui/oholidayplugincfgwidget.cpp14
-rw-r--r--libopie2/opiepim/ui/oholidayplugincfgwidget.h30
-rw-r--r--libopie2/opiepim/ui/oholidaypluginif.h8
-rw-r--r--libopie2/opiepim/ui/ui.pro8
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
9class EffectiveEvent; 10class EffectiveEvent;
10 11
11namespace Opie { 12namespace Opie {
12namespace Datebook { 13namespace Datebook {
13 14
15class HolidayPluginConfigWidget;
16
14class HolidayPlugin 17class HolidayPlugin
15{ 18{
16public: 19public:
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
3namespace Opie {
4namespace Datebook {
5HolidayPluginConfigWidget::HolidayPluginConfigWidget( QWidget* parent, const char* name, WFlags fl )
6 : QWidget( parent, name, fl )
7{}
8
9HolidayPluginConfigWidget::~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
5namespace Opie {
6namespace Datebook {
7class HolidayPluginConfigWidget:public QWidget
8{
9 Q_OBJECT
10public:
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
11namespace Opie { 11namespace Opie {
12namespace Datebook { 12namespace Datebook {
13 13
14class HolidayPlugin; 14class HolidayPlugin;
15 15
16class HolidayPluginIf:public QUnknownInterface 16class HolidayPluginIf:public QUnknownInterface
17{ 17{
18public: 18public:
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
25template<class T> class HolidayPluginWrapper:public HolidayPluginIf 25template<class T> class HolidayPluginWrapper:public HolidayPluginIf
26{ 26{
27public: 27public:
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 }
50protected: 49protected:
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 @@
1HEADERS += ui/opimmainwindow.h \ 1HEADERS += 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
6SOURCES += ui/opimmainwindow.cpp \ 9SOURCES += 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
10INTERFACES += ui/opimrecurrencebase.ui 14INTERFACES += ui/opimrecurrencebase.ui