author | alwin <alwin> | 2005-03-18 16:57:24 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-18 16:57:24 (UTC) |
commit | 977193cc46768da220ddb01aca74286b28e6b7ee (patch) (side-by-side diff) | |
tree | eff59fc4011b0b3a6fd610b2b04e934eb21a0687 /libopie2 | |
parent | f32b76432aeb554204f06ca15ed1ec8d5387fb12 (diff) | |
download | opie-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.
-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 @@ #ifndef _HOLIDAY_PLUGIN_H #define _HOLIDAY_PLUGIN_H #include <qstring.h> #include <qstringlist.h> #include <qdatetime.h> #include <qmap.h> +#include <qwidget.h> class EffectiveEvent; namespace Opie { namespace Datebook { +class HolidayPluginConfigWidget; + class HolidayPlugin { public: HolidayPlugin(){}; virtual ~HolidayPlugin(){}; virtual QString description()=0; virtual QStringList entries(const QDate&)=0; virtual QStringList entries(unsigned year, unsigned month, unsigned day)=0; virtual QMap<QDate,QStringList> entries(const QDate&,const QDate&)=0; virtual QValueList<EffectiveEvent> events(const QDate&,const QDate&)=0; -}; + virtual HolidayPluginConfigWidget*configWidget(QWidget *parent=0, const char *name = 0, QWidget::WFlags fl = 0 ){return 0;} +}; } } #endif 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 @@ +#include "oholidayplugincfgwidget.h" + +namespace Opie { +namespace Datebook { +HolidayPluginConfigWidget::HolidayPluginConfigWidget( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{} + +HolidayPluginConfigWidget::~HolidayPluginConfigWidget() +{} + +} +} + 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 @@ +#ifndef _HOLIDAY_PLUGIN_CFG_WIDGET +#define _HOLIDAY_PLUGIN_CFG_WIDGET +#include <qwidget.h> + +namespace Opie { +namespace Datebook { +class HolidayPluginConfigWidget:public QWidget +{ + Q_OBJECT +public: + /** + * This will construct the widget. The widget gets deleted once the parent + * gets deleted as in any Qt application + * + * A Parent is required! + * + * @param parent The parent of the widget + * @param name The name of the object + */ + HolidayPluginConfigWidget(QWidget *parent, const char *name = 0, WFlags fl = 0 ); + virtual ~HolidayPluginConfigWidget(); + + virtual void saveConfig()=0; +}; + +} +} + +#endif + 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,44 +1,43 @@ #ifndef _O_HOLIDAY_PLUGIN_IF_H #define _O_HOLIDAY_PLUGIN_IF_H #include <opie2/odebug.h> #include <qpe/qcom.h> #ifndef QT_NO_COMPONENT -//017f90d4-34fc-4dc5-aed7-498c6da6571e -#define IID_HOLIDAY_PLUGIN QUuid(0x017f90d4,0x34fc,0x4dc5,0xae,0xd7,0x49,0x8c,0x6d,0xa6,0x57,0x1e) +//c0a5f73f-975e-4492-9285-af555284c4ab +#define IID_HOLIDAY_PLUGIN QUuid(0xc0a5f73f,0x975e,0x4492,0x92,0x85,0xaf,0x55,0x52,0x84,0xc4,0xab) #endif namespace Opie { namespace Datebook { class HolidayPlugin; class HolidayPluginIf:public QUnknownInterface { public: HolidayPluginIf():QUnknownInterface(){} virtual ~HolidayPluginIf(){} - + virtual HolidayPlugin*plugin()=0; }; template<class T> class HolidayPluginWrapper:public HolidayPluginIf { public: HolidayPluginWrapper():HolidayPluginIf(),_plugin(0){} virtual ~HolidayPluginWrapper(){if (_plugin) delete _plugin;} QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) { - odebug << "HolidayPluginWrapper::queryInterface()" << oendl; *iface = 0; if (uuid == IID_HOLIDAY_PLUGIN || uuid == IID_QUnknown) { *iface = this; } else { return QS_FALSE; } if (*iface) (*iface)->addRef(); return QS_OK; } // from qcom Q_REFCOUNT @@ -46,17 +45,16 @@ public: virtual T*plugin() { if (!_plugin) {_plugin = new T();} return _plugin; } protected: T*_plugin; }; #define EXPORT_HOLIDAY_PLUGIN( Plugin ) \ Q_EXPORT_INTERFACE() { \ Q_CREATE_INSTANCE( Opie::Datebook::HolidayPluginWrapper<Plugin> ) \ } - } } #endif 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 @@ HEADERS += ui/opimmainwindow.h \ ui/opimrecurrencewidget.h \ ui/todayconfigwidget.h \ - ui/todayplugininterface.h + ui/todayplugininterface.h \ + ui/oholidayplugin.h \ + ui/oholidayplugincfgwidget.h \ + ui/oholidaypluginif.h SOURCES += ui/opimmainwindow.cpp \ ui/opimrecurrencewidget.cpp \ - ui/todayconfigwidget.cpp + ui/todayconfigwidget.cpp \ + ui/oholidayplugincfgwidget.cpp INTERFACES += ui/opimrecurrencebase.ui |