author | alwin <alwin> | 2005-03-18 16:57:24 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-18 16:57:24 (UTC) |
commit | 977193cc46768da220ddb01aca74286b28e6b7ee (patch) (unidiff) | |
tree | eff59fc4011b0b3a6fd610b2b04e934eb21a0687 | |
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-- | core/pim/datebook/datebook.cpp | 1 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 28 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.h | 6 | ||||
-rw-r--r-- | core/pim/datebook/holiday/national/national-holidays.pro | 4 | ||||
-rw-r--r-- | core/pim/datebook/holiday/national/nationalcfg.cpp | 11 | ||||
-rw-r--r-- | core/pim/datebook/holiday/national/nationalcfgwidget.cpp | 99 | ||||
-rw-r--r-- | core/pim/datebook/holiday/national/nationalcfgwidget.h | 39 | ||||
-rw-r--r-- | core/pim/datebook/holiday/national/nationalholiday.cpp | 13 | ||||
-rw-r--r-- | core/pim/datebook/holiday/national/nationalholiday.h | 2 | ||||
-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 |
14 files changed, 247 insertions, 22 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 8ae4f84..70dd7b5 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -250,32 +250,33 @@ void DateBook::slotSettings() | |||
250 | 250 | ||
251 | bool found=false; | 251 | bool found=false; |
252 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { | 252 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { |
253 | if ( frmSettings.comboLocation->text(i) == defaultLocation ) { | 253 | if ( frmSettings.comboLocation->text(i) == defaultLocation ) { |
254 | frmSettings.comboLocation->setCurrentItem(i); | 254 | frmSettings.comboLocation->setCurrentItem(i); |
255 | found=true; | 255 | found=true; |
256 | break; | 256 | break; |
257 | } | 257 | } |
258 | } | 258 | } |
259 | if(!found) { | 259 | if(!found) { |
260 | frmSettings.comboLocation->insertItem(defaultLocation); | 260 | frmSettings.comboLocation->insertItem(defaultLocation); |
261 | frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); | 261 | frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); |
262 | } | 262 | } |
263 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); | 263 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); |
264 | 264 | ||
265 | if ( QPEApplication::execDialog( &frmSettings ) ) { | 265 | if ( QPEApplication::execDialog( &frmSettings ) ) { |
266 | frmSettings.savePlugins(); | ||
266 | db_holiday->pluginManager()->save(); | 267 | db_holiday->pluginManager()->save(); |
267 | db_holiday->reloadPlugins(); | 268 | db_holiday->reloadPlugins(); |
268 | 269 | ||
269 | aPreset = frmSettings.alarmPreset(); | 270 | aPreset = frmSettings.alarmPreset(); |
270 | presetTime = frmSettings.presetTime(); | 271 | presetTime = frmSettings.presetTime(); |
271 | startTime = frmSettings.startTime(); | 272 | startTime = frmSettings.startTime(); |
272 | bJumpToCurTime = frmSettings.jumpToCurTime(); | 273 | bJumpToCurTime = frmSettings.jumpToCurTime(); |
273 | rowStyle = frmSettings.rowStyle(); | 274 | rowStyle = frmSettings.rowStyle(); |
274 | defaultView=frmSettings.comboDefaultView->currentItem()+1; | 275 | defaultView=frmSettings.comboDefaultView->currentItem()+1; |
275 | weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); | 276 | weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); |
276 | defaultLocation=frmSettings.comboLocation->currentText(); | 277 | defaultLocation=frmSettings.comboLocation->currentText(); |
277 | defaultCategories=frmSettings.comboCategory->currentCategories(); | 278 | defaultCategories=frmSettings.comboCategory->currentCategories(); |
278 | 279 | ||
279 | if ( dayView ) { | 280 | if ( dayView ) { |
280 | dayView->setStartViewTime( startTime ); | 281 | dayView->setStartViewTime( startTime ); |
281 | dayView->setJumpToCurTime( bJumpToCurTime ); | 282 | dayView->setJumpToCurTime( bJumpToCurTime ); |
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp index 861e266..561dc38 100644 --- a/core/pim/datebook/datebooksettings.cpp +++ b/core/pim/datebook/datebooksettings.cpp | |||
@@ -9,39 +9,44 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "datebooksettings.h" | 21 | #include "datebooksettings.h" |
22 | 22 | ||
23 | #include <opie2/opluginloader.h> | 23 | #include <opie2/opluginloader.h> |
24 | #include <opie2/odebug.h> | 24 | #include <opie2/odebug.h> |
25 | #include <opie2/oholidaypluginif.h> | ||
26 | #include <opie2/oholidayplugin.h> | ||
27 | #include <opie2/oholidayplugincfgwidget.h> | ||
25 | 28 | ||
26 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
27 | 30 | ||
28 | #include <qspinbox.h> | 31 | #include <qspinbox.h> |
29 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
30 | #include <qlistview.h> | 33 | #include <qlistview.h> |
31 | #include <qheader.h> | 34 | #include <qheader.h> |
35 | #include <qtabwidget.h> | ||
36 | #include <qlayout.h> | ||
32 | 37 | ||
33 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, | 38 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, |
34 | const char *name, bool modal, WFlags fl ) | 39 | const char *name, bool modal, WFlags fl ) |
35 | : DateBookSettingsBase( parent, name, modal, fl ), | 40 | : DateBookSettingsBase( parent, name, modal, fl ), |
36 | ampm( whichClock ) | 41 | ampm( whichClock ) |
37 | { | 42 | { |
38 | init(); | 43 | init(); |
39 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); | 44 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); |
40 | QArray<int> categories; | 45 | QArray<int> categories; |
41 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); | 46 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); |
42 | m_loader = 0; | 47 | m_loader = 0; |
43 | m_manager = 0; | 48 | m_manager = 0; |
44 | m_PluginListView->header()->hide(); | 49 | m_PluginListView->header()->hide(); |
45 | m_PluginListView->setSorting(-1); | 50 | m_PluginListView->setSorting(-1); |
46 | } | 51 | } |
47 | 52 | ||
@@ -77,32 +82,55 @@ int DateBookSettings::startTime() const | |||
77 | returnMe = 0; | 82 | returnMe = 0; |
78 | } | 83 | } |
79 | return returnMe; | 84 | return returnMe; |
80 | } | 85 | } |
81 | 86 | ||
82 | void DateBookSettings::setPluginList(Opie::Core::OPluginManager*aManager,Opie::Core::OPluginLoader*aLoader) | 87 | void DateBookSettings::setPluginList(Opie::Core::OPluginManager*aManager,Opie::Core::OPluginLoader*aLoader) |
83 | { | 88 | { |
84 | m_manager = aManager; | 89 | m_manager = aManager; |
85 | m_loader = aLoader; | 90 | m_loader = aLoader; |
86 | if (!aManager||!aLoader) return; | 91 | if (!aManager||!aLoader) return; |
87 | Opie::Core::OPluginItem::List inLst = m_loader->allAvailable(true); | 92 | Opie::Core::OPluginItem::List inLst = m_loader->allAvailable(true); |
88 | QCheckListItem *pitem = 0; | 93 | QCheckListItem *pitem = 0; |
89 | 94 | ||
90 | for ( Opie::Core::OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { | 95 | for ( Opie::Core::OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { |
91 | pitem = new QCheckListItem(m_PluginListView,(*it).name(),QCheckListItem::CheckBox); | 96 | pitem = new QCheckListItem(m_PluginListView,(*it).name(),QCheckListItem::CheckBox); |
92 | pitem->setOn( (*it).isEnabled() ); | 97 | pitem->setOn( (*it).isEnabled() ); |
98 | |||
99 | Opie::Datebook::HolidayPluginIf*hif = m_loader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN); | ||
100 | if (!hif) continue; | ||
101 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); | ||
102 | if (!pl) continue; | ||
103 | Opie::Datebook::HolidayPluginConfigWidget*cfg = pl->configWidget(); | ||
104 | if (!cfg) continue; | ||
105 | QWidget * dtab = new QWidget(TabWidget,pl->description()); | ||
106 | QVBoxLayout*dlayout = new QVBoxLayout(dtab); | ||
107 | dlayout->setMargin(2); | ||
108 | dlayout->setSpacing(2); | ||
109 | cfg->reparent(dtab,0,QPoint(0,0)); | ||
110 | dlayout->addWidget(cfg); | ||
111 | TabWidget->insertTab(dtab,pl->description()); | ||
112 | |||
113 | m_cfgWidgets.append(cfg); | ||
114 | } | ||
115 | } | ||
116 | void DateBookSettings::savePlugins() | ||
117 | { | ||
118 | QValueList<Opie::Datebook::HolidayPluginConfigWidget*>::Iterator it; | ||
119 | for (it=m_cfgWidgets.begin();it!=m_cfgWidgets.end();++it) { | ||
120 | (*it)->saveConfig(); | ||
93 | } | 121 | } |
94 | } | 122 | } |
95 | 123 | ||
96 | void DateBookSettings::pluginItemClicked(QListViewItem *aItem) | 124 | void DateBookSettings::pluginItemClicked(QListViewItem *aItem) |
97 | { | 125 | { |
98 | if (!aItem||!m_manager||!m_loader) return; | 126 | if (!aItem||!m_manager||!m_loader) return; |
99 | QCheckListItem*pitem = ((QCheckListItem*)aItem); | 127 | QCheckListItem*pitem = ((QCheckListItem*)aItem); |
100 | 128 | ||
101 | Opie::Core::OPluginItem::List lst = m_loader->allAvailable( true ); | 129 | Opie::Core::OPluginItem::List lst = m_loader->allAvailable( true ); |
102 | for ( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 130 | for ( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
103 | if ( QString::compare( (*it).name() , pitem->text(0) ) == 0 ) { | 131 | if ( QString::compare( (*it).name() , pitem->text(0) ) == 0 ) { |
104 | m_manager->setEnabled((*it),pitem->isOn()); | 132 | m_manager->setEnabled((*it),pitem->isOn()); |
105 | break; | 133 | break; |
106 | } | 134 | } |
107 | } | 135 | } |
108 | } | 136 | } |
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index df7d32c..912088f 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h | |||
@@ -9,63 +9,69 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef DATEBOOKSETTINGS_H | 21 | #ifndef DATEBOOKSETTINGS_H |
22 | #define DATEBOOKSETTINGS_H | 22 | #define DATEBOOKSETTINGS_H |
23 | #include "datebooksettingsbase.h" | 23 | #include "datebooksettingsbase.h" |
24 | #include <qpe/categoryselect.h> | 24 | #include <qpe/categoryselect.h> |
25 | #include <qvaluelist.h> | ||
25 | 26 | ||
26 | namespace Opie { | 27 | namespace Opie { |
27 | namespace Core { | 28 | namespace Core { |
28 | class OPluginManager; | 29 | class OPluginManager; |
29 | class OGenericPluginLoader; | 30 | class OGenericPluginLoader; |
30 | class OPluginLoader; | 31 | class OPluginLoader; |
31 | } | 32 | } |
32 | namespace Ui { | 33 | namespace Ui { |
33 | class OPluginConfigWidget; | 34 | class OPluginConfigWidget; |
34 | } | 35 | } |
36 | namespace Datebook { | ||
37 | class HolidayPluginConfigWidget; | ||
38 | } | ||
35 | } | 39 | } |
36 | 40 | ||
37 | class DateBookSettings : public DateBookSettingsBase | 41 | class DateBookSettings : public DateBookSettingsBase |
38 | { | 42 | { |
39 | Q_OBJECT | 43 | Q_OBJECT |
40 | public: | 44 | public: |
41 | DateBookSettings( bool whichClock, QWidget *parent = 0, | 45 | DateBookSettings( bool whichClock, QWidget *parent = 0, |
42 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); | 46 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); |
43 | ~DateBookSettings(); | 47 | ~DateBookSettings(); |
44 | void setStartTime( int newStartViewTime ); | 48 | void setStartTime( int newStartViewTime ); |
45 | int startTime() const; | 49 | int startTime() const; |
46 | void setAlarmPreset( bool bAlarm, int presetTime ); | 50 | void setAlarmPreset( bool bAlarm, int presetTime ); |
47 | bool alarmPreset() const; | 51 | bool alarmPreset() const; |
48 | int presetTime() const; | 52 | int presetTime() const; |
49 | void setAlarmType( int alarmType ); | 53 | void setAlarmType( int alarmType ); |
50 | int alarmType() const; | 54 | int alarmType() const; |
51 | 55 | ||
52 | void setJumpToCurTime( bool bJump ); | 56 | void setJumpToCurTime( bool bJump ); |
53 | bool jumpToCurTime() const; | 57 | bool jumpToCurTime() const; |
54 | void setRowStyle( int style ); | 58 | void setRowStyle( int style ); |
55 | int rowStyle() const; | 59 | int rowStyle() const; |
56 | 60 | ||
57 | void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); | 61 | void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); |
62 | void savePlugins(); | ||
58 | private slots: | 63 | private slots: |
59 | void slot12Hour( int ); | 64 | void slot12Hour( int ); |
60 | void slotChangeClock( bool ); | 65 | void slotChangeClock( bool ); |
61 | protected slots: | 66 | protected slots: |
62 | virtual void pluginItemClicked(QListViewItem *); | 67 | virtual void pluginItemClicked(QListViewItem *); |
63 | 68 | ||
64 | protected: | 69 | protected: |
65 | void init(); | 70 | void init(); |
66 | bool ampm; | 71 | bool ampm; |
67 | int oldtime; | 72 | int oldtime; |
68 | Opie::Core::OPluginManager*m_manager; | 73 | Opie::Core::OPluginManager*m_manager; |
69 | Opie::Core::OPluginLoader*m_loader; | 74 | Opie::Core::OPluginLoader*m_loader; |
75 | QValueList<Opie::Datebook::HolidayPluginConfigWidget*> m_cfgWidgets; | ||
70 | }; | 76 | }; |
71 | #endif | 77 | #endif |
diff --git a/core/pim/datebook/holiday/national/national-holidays.pro b/core/pim/datebook/holiday/national/national-holidays.pro index 8b2b33e..3da9c3b 100644 --- a/core/pim/datebook/holiday/national/national-holidays.pro +++ b/core/pim/datebook/holiday/national/national-holidays.pro | |||
@@ -1,20 +1,20 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG -= moc | 2 | CONFIG -= moc |
3 | CONFIG += qt plugin | 3 | CONFIG += qt plugin |
4 | 4 | ||
5 | # Input | 5 | # Input |
6 | HEADERS = nationalholiday.h nationalcfg.h | 6 | HEADERS = nationalholiday.h nationalcfg.h nationalcfgwidget.h |
7 | SOURCES = nationalholiday.cpp nationalcfg.cpp | 7 | SOURCES = nationalholiday.cpp nationalcfg.cpp nationalcfgwidget.cpp |
8 | INTERFACES= | 8 | INTERFACES= |
9 | 9 | ||
10 | INCLUDEPATH += $(OPIEDIR)/include \ | 10 | INCLUDEPATH += $(OPIEDIR)/include \ |
11 | ../ ../library | 11 | ../ ../library |
12 | DEPENDPATH += $(OPIEDIR)/include \ | 12 | DEPENDPATH += $(OPIEDIR)/include \ |
13 | ../ ../library | 13 | ../ ../library |
14 | 14 | ||
15 | LIBS+= -lqpe -lopiecore2 -lopieui2 | 15 | LIBS+= -lqpe -lopiecore2 -lopieui2 |
16 | 16 | ||
17 | DESTDIR = $(OPIEDIR)/plugins/holidays | 17 | DESTDIR = $(OPIEDIR)/plugins/holidays |
18 | TARGET = nationaldayplugin | 18 | TARGET = nationaldayplugin |
19 | 19 | ||
20 | include( $(OPIEDIR)/include.pro ) | 20 | include( $(OPIEDIR)/include.pro ) |
diff --git a/core/pim/datebook/holiday/national/nationalcfg.cpp b/core/pim/datebook/holiday/national/nationalcfg.cpp index a293251..52c453f 100644 --- a/core/pim/datebook/holiday/national/nationalcfg.cpp +++ b/core/pim/datebook/holiday/national/nationalcfg.cpp | |||
@@ -12,51 +12,46 @@ static QString _content_name="name"; | |||
12 | static QString _content_date="date"; | 12 | static QString _content_date="date"; |
13 | 13 | ||
14 | NHcfg::NHcfg() | 14 | NHcfg::NHcfg() |
15 | :QXmlDefaultHandler(),err(""),_path("") | 15 | :QXmlDefaultHandler(),err(""),_path("") |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | NHcfg::~NHcfg() | 19 | NHcfg::~NHcfg() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | bool NHcfg::load(const QString&aPath) | 23 | bool NHcfg::load(const QString&aPath) |
24 | { | 24 | { |
25 | _path=aPath; | 25 | _path=aPath; |
26 | stage = 0; | 26 | stage = 0; |
27 | _content.clear(); | 27 | _content.clear(); |
28 | odebug << "Start loading file "<<_path<<oendl; | ||
29 | QFile *f=new QFile(_path); | 28 | QFile *f=new QFile(_path); |
30 | if (!f) { | 29 | if (!f) { |
31 | oerr << "Could not open file" << oendl; | 30 | oerr << "Could not open file" << oendl; |
32 | return false; | 31 | return false; |
33 | } | 32 | } |
34 | odebug << "Source" << oendl; | ||
35 | QXmlInputSource is(*f); | 33 | QXmlInputSource is(*f); |
36 | odebug << "Reader" << oendl; | ||
37 | QXmlSimpleReader reader; | 34 | QXmlSimpleReader reader; |
38 | odebug << "Handler" << oendl; | ||
39 | reader.setContentHandler(this); | 35 | reader.setContentHandler(this); |
40 | odebug << "Error handler" << oendl; | ||
41 | reader.setErrorHandler(this); | 36 | reader.setErrorHandler(this); |
42 | 37 | ||
43 | err = ""; | 38 | err = ""; |
44 | odebug << "parse it" << oendl; | ||
45 | bool ret = reader.parse(is); | 39 | bool ret = reader.parse(is); |
46 | odebug << "Errors: " << err << oendl; | 40 | if (err.length()>0) |
41 | odebug << "Errors: " << err << oendl; | ||
47 | return ret; | 42 | return ret; |
48 | } | 43 | } |
49 | 44 | ||
50 | const tholidaylist&NHcfg::days()const | 45 | const tholidaylist&NHcfg::days()const |
51 | { | 46 | { |
52 | return _content; | 47 | return _content; |
53 | } | 48 | } |
54 | 49 | ||
55 | bool NHcfg::warning(const QXmlParseException& e) | 50 | bool NHcfg::warning(const QXmlParseException& e) |
56 | { | 51 | { |
57 | QString tmp; | 52 | QString tmp; |
58 | 53 | ||
59 | tmp.sprintf("%d: warning: %s\n", e.lineNumber(), | 54 | tmp.sprintf("%d: warning: %s\n", e.lineNumber(), |
60 | (const char*) e.message().utf8()); | 55 | (const char*) e.message().utf8()); |
61 | 56 | ||
62 | err += tmp; | 57 | err += tmp; |
@@ -78,33 +73,32 @@ bool NHcfg::error(const QXmlParseException& e) | |||
78 | 73 | ||
79 | bool NHcfg::fatalError(const QXmlParseException& e) | 74 | bool NHcfg::fatalError(const QXmlParseException& e) |
80 | { | 75 | { |
81 | QString tmp; | 76 | QString tmp; |
82 | 77 | ||
83 | tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(), | 78 | tmp.sprintf("%d: fatal error: %s\n", e.lineNumber(), |
84 | (const char*) e.message().utf8()); | 79 | (const char*) e.message().utf8()); |
85 | 80 | ||
86 | err += tmp; | 81 | err += tmp; |
87 | 82 | ||
88 | return false; | 83 | return false; |
89 | } | 84 | } |
90 | 85 | ||
91 | bool NHcfg::startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr) | 86 | bool NHcfg::startElement(const QString&, const QString&,const QString& name, const QXmlAttributes& attr) |
92 | { | 87 | { |
93 | bool ret = false; | 88 | bool ret = false; |
94 | odebug << "startElement: " << name << oendl; | ||
95 | if (name==_key_doc) { | 89 | if (name==_key_doc) { |
96 | stage = 1; | 90 | stage = 1; |
97 | return true; | 91 | return true; |
98 | } | 92 | } |
99 | if (stage == 0) { | 93 | if (stage == 0) { |
100 | err = "This is not a national holiday config file"; | 94 | err = "This is not a national holiday config file"; |
101 | return false; | 95 | return false; |
102 | } | 96 | } |
103 | if (name==_key_desc) { | 97 | if (name==_key_desc) { |
104 | stage = 2; | 98 | stage = 2; |
105 | ret = setName(attr); | 99 | ret = setName(attr); |
106 | return ret; | 100 | return ret; |
107 | } | 101 | } |
108 | if (stage<2) {return false;} | 102 | if (stage<2) {return false;} |
109 | if (name==_key_list) {stage=3;return true;} | 103 | if (name==_key_list) {stage=3;return true;} |
110 | if (stage<3) {return false;} | 104 | if (stage<3) {return false;} |
@@ -131,19 +125,18 @@ bool NHcfg::endElement(const QString&, const QString&,const QString& name) | |||
131 | { | 125 | { |
132 | return true; | 126 | return true; |
133 | } | 127 | } |
134 | 128 | ||
135 | const QString&NHcfg::errorString()const | 129 | const QString&NHcfg::errorString()const |
136 | { | 130 | { |
137 | return err; | 131 | return err; |
138 | } | 132 | } |
139 | 133 | ||
140 | bool NHcfg::setName(const QXmlAttributes&attr) | 134 | bool NHcfg::setName(const QXmlAttributes&attr) |
141 | { | 135 | { |
142 | int nindx = attr.index("value"); | 136 | int nindx = attr.index("value"); |
143 | if (nindx==-1) { | 137 | if (nindx==-1) { |
144 | return false; | 138 | return false; |
145 | } | 139 | } |
146 | _contentname = attr.value(nindx); | 140 | _contentname = attr.value(nindx); |
147 | odebug << "Contentname = " << _contentname<<oendl; | ||
148 | return true; | 141 | return true; |
149 | } | 142 | } |
diff --git a/core/pim/datebook/holiday/national/nationalcfgwidget.cpp b/core/pim/datebook/holiday/national/nationalcfgwidget.cpp new file mode 100644 index 0000000..6e3dd7d --- a/dev/null +++ b/core/pim/datebook/holiday/national/nationalcfgwidget.cpp | |||
@@ -0,0 +1,99 @@ | |||
1 | #include "nationalcfgwidget.h" | ||
2 | |||
3 | #include <opie2/odebug.h> | ||
4 | |||
5 | #include <qpe/config.h> | ||
6 | #include <qpe/qpeapplication.h> | ||
7 | |||
8 | #include <qheader.h> | ||
9 | #include <qlabel.h> | ||
10 | #include <qlistview.h> | ||
11 | #include <qpushbutton.h> | ||
12 | #include <qlayout.h> | ||
13 | #include <qvariant.h> | ||
14 | #include <qtooltip.h> | ||
15 | #include <qwhatsthis.h> | ||
16 | #include <qheader.h> | ||
17 | #include <qdir.h> | ||
18 | |||
19 | /* | ||
20 | * Constructs a NationalHolidayConfig which is a child of 'parent', with the | ||
21 | * name 'name' and widget flags set to 'f' | ||
22 | */ | ||
23 | NationalHolidayConfigWidget::NationalHolidayConfigWidget( QWidget* parent, const char* name, WFlags fl ) | ||
24 | : Opie::Datebook::HolidayPluginConfigWidget( parent, name, fl ) | ||
25 | { | ||
26 | if ( !name ) | ||
27 | setName( "NationalHolidayConfig" ); | ||
28 | resize( 206, 210 ); | ||
29 | setCaption( tr( "Select national config" ) ); | ||
30 | NationalHolidayConfigLayout = new QVBoxLayout( this ); | ||
31 | NationalHolidayConfigLayout->setSpacing( 2 ); | ||
32 | NationalHolidayConfigLayout->setMargin( 2 ); | ||
33 | |||
34 | m_headLabel = new QLabel( this, "m_headLabel" ); | ||
35 | m_headLabel->setText( tr( "Select one or more configs to load" ) ); | ||
36 | m_headLabel->setAlignment( int( QLabel::AlignCenter ) ); | ||
37 | NationalHolidayConfigLayout->addWidget( m_headLabel ); | ||
38 | |||
39 | m_Configlist = new QListView( this, "m_Configlist" ); | ||
40 | m_Configlist->addColumn( tr( "configfiles" ) ); | ||
41 | QWhatsThis::add( m_Configlist, tr( "List of found xml-files which may load." ) ); | ||
42 | NationalHolidayConfigLayout->addWidget( m_Configlist ); | ||
43 | |||
44 | // signals and slots connections | ||
45 | connect( m_Configlist, SIGNAL( clicked(QListViewItem*) ), this, SLOT( listItemClicked(QListViewItem*) ) ); | ||
46 | init(); | ||
47 | } | ||
48 | |||
49 | void NationalHolidayConfigWidget::init() | ||
50 | { | ||
51 | m_Configlist->header()->hide(); | ||
52 | m_Configlist->setSorting(-1); | ||
53 | |||
54 | QString path = QPEApplication::qpeDir() + "etc/nationaldays"; | ||
55 | QDir dir( path, "*.xml" ); | ||
56 | QStringList list = dir.entryList(); | ||
57 | QStringList::Iterator it; | ||
58 | Config cfg("nationaldays"); | ||
59 | cfg.setGroup("entries"); | ||
60 | files = cfg.readListEntry("files"); | ||
61 | QCheckListItem *pitem = 0; | ||
62 | |||
63 | for (it=list.begin();it!=list.end();++it) { | ||
64 | pitem = new QCheckListItem(m_Configlist,(*it),QCheckListItem::CheckBox); | ||
65 | if (files.find((*it)) != files.end()) { | ||
66 | pitem->setOn(true); | ||
67 | } else { | ||
68 | pitem->setOn(false); | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | * Destroys the object and frees any allocated resources | ||
75 | */ | ||
76 | NationalHolidayConfigWidget::~NationalHolidayConfigWidget() | ||
77 | { | ||
78 | // no need to delete child widgets, Qt does it all for us | ||
79 | } | ||
80 | |||
81 | void NationalHolidayConfigWidget::listItemClicked(QListViewItem*item) | ||
82 | { | ||
83 | if (!item) return; | ||
84 | QCheckListItem*pitem = ((QCheckListItem*)item); | ||
85 | QStringList::Iterator it = files.find(pitem->text(0)); | ||
86 | if (pitem->isOn()&&it==files.end()) { | ||
87 | files.append(pitem->text(0)); | ||
88 | } else if (!pitem->isOn() && it!=files.end()) { | ||
89 | files.remove(it); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | void NationalHolidayConfigWidget::saveConfig() | ||
94 | { | ||
95 | Config cfg("nationaldays"); | ||
96 | cfg.setGroup("entries"); | ||
97 | cfg.writeEntry("files",files); | ||
98 | } | ||
99 | |||
diff --git a/core/pim/datebook/holiday/national/nationalcfgwidget.h b/core/pim/datebook/holiday/national/nationalcfgwidget.h new file mode 100644 index 0000000..9f16aa4 --- a/dev/null +++ b/core/pim/datebook/holiday/national/nationalcfgwidget.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef NATIONALHOLIDAYCONFIGWIDGET_H | ||
2 | #define NATIONALHOLIDAYCONFIGWIDGET_H | ||
3 | |||
4 | #include <opie2/oholidayplugincfgwidget.h> | ||
5 | |||
6 | #include <qvariant.h> | ||
7 | #include <qwidget.h> | ||
8 | #include <qstringlist.h> | ||
9 | |||
10 | class QVBoxLayout; | ||
11 | class QHBoxLayout; | ||
12 | class QGridLayout; | ||
13 | class QLabel; | ||
14 | class QListView; | ||
15 | class QListViewItem; | ||
16 | |||
17 | class NationalHolidayConfigWidget : public Opie::Datebook::HolidayPluginConfigWidget | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | |||
21 | public: | ||
22 | NationalHolidayConfigWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
23 | virtual ~NationalHolidayConfigWidget(); | ||
24 | |||
25 | virtual void saveConfig(); | ||
26 | |||
27 | protected slots: | ||
28 | virtual void listItemClicked(QListViewItem*); | ||
29 | |||
30 | protected: | ||
31 | void init(); | ||
32 | |||
33 | QVBoxLayout* NationalHolidayConfigLayout; | ||
34 | QLabel* m_headLabel; | ||
35 | QListView* m_Configlist; | ||
36 | QStringList files; | ||
37 | }; | ||
38 | |||
39 | #endif // NATIONALHOLIDAYCONFIG_H | ||
diff --git a/core/pim/datebook/holiday/national/nationalholiday.cpp b/core/pim/datebook/holiday/national/nationalholiday.cpp index 26cd913..52f3489 100644 --- a/core/pim/datebook/holiday/national/nationalholiday.cpp +++ b/core/pim/datebook/holiday/national/nationalholiday.cpp | |||
@@ -1,56 +1,58 @@ | |||
1 | #include "nationalholiday.h" | 1 | #include "nationalholiday.h" |
2 | #include "nationalcfg.h" | 2 | #include "nationalcfg.h" |
3 | #include "nationalcfgwidget.h" | ||
3 | 4 | ||
4 | #include <opie2/odebug.h> | 5 | #include <opie2/odebug.h> |
5 | 6 | ||
6 | #include <qobject.h> | 7 | #include <qobject.h> |
7 | #include <qpe/event.h> | 8 | #include <qpe/event.h> |
8 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
9 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
10 | 11 | ||
11 | NationalHoliday::NationalHoliday() | 12 | NationalHoliday::NationalHoliday() |
12 | :Opie::Datebook::HolidayPlugin() | 13 | :Opie::Datebook::HolidayPlugin() |
13 | { | 14 | { |
14 | _lastyear=0; | 15 | _lastyear=0; |
15 | init_done = false; | 16 | init_done = false; |
16 | init(); | 17 | init(); |
17 | } | 18 | } |
18 | 19 | ||
19 | QString NationalHoliday::description() | 20 | QString NationalHoliday::description() |
20 | { | 21 | { |
21 | return QObject::tr("National holidays","holidays"); | 22 | return QObject::tr("National holidays","holidays"); |
22 | } | 23 | } |
23 | 24 | ||
24 | void NationalHoliday::init() | 25 | void NationalHoliday::init() |
25 | { | 26 | { |
26 | Config cfg("nationaldays"); | 27 | Config cfg("nationaldays"); |
27 | cfg.setGroup("entries"); | 28 | cfg.setGroup("entries"); |
28 | files = cfg.readListEntry("files"); | 29 | files = cfg.readListEntry("files"); |
29 | odebug << "Read " << files << oendl; | ||
30 | } | 30 | } |
31 | 31 | ||
32 | void NationalHoliday::load_days() | 32 | void NationalHoliday::load_days() |
33 | { | 33 | { |
34 | if (init_done) return; | 34 | if (init_done) return; |
35 | Config cfg("nationaldays"); | ||
36 | cfg.setGroup("entries"); | ||
35 | QStringList::ConstIterator it; | 37 | QStringList::ConstIterator it; |
36 | NHcfg readit; | 38 | NHcfg readit; |
37 | for (it=files.begin();it!=files.end();++it) { | 39 | for (it=files.begin();it!=files.end();++it) { |
38 | odebug << QPEApplication::qpeDir()+"/etc/nationaldays/"+(*it) << oendl; | 40 | if (!readit.load(QPEApplication::qpeDir()+"/etc/nationaldays/"+(*it))) { |
39 | if (!readit.load(QPEApplication::qpeDir()+"/etc/nationaldays/"+(*it))) | ||
40 | continue; | 41 | continue; |
42 | } | ||
41 | tholidaylist::ConstIterator it; | 43 | tholidaylist::ConstIterator it; |
42 | for (it=readit.days().begin();it!=readit.days().end();++it) { | 44 | for (it=readit.days().begin();it!=readit.days().end();++it) { |
43 | _days[it.key()]+=(it.data()); | 45 | _days[it.key()]+=(it.data()); |
44 | } | 46 | } |
45 | 47 | ||
46 | } | 48 | } |
47 | init_done = true; | 49 | init_done = true; |
48 | } | 50 | } |
49 | 51 | ||
50 | QStringList NationalHoliday::entries(const QDate&aDate) | 52 | QStringList NationalHoliday::entries(const QDate&aDate) |
51 | { | 53 | { |
52 | load_days(); | 54 | load_days(); |
53 | QStringList ret; | 55 | QStringList ret; |
54 | QDate d(0,aDate.month(),aDate.day()); | 56 | QDate d(0,aDate.month(),aDate.day()); |
55 | 57 | ||
56 | tholidaylist::Iterator it = _days.find(d); | 58 | tholidaylist::Iterator it = _days.find(d); |
@@ -107,17 +109,22 @@ QValueList<EffectiveEvent> NationalHoliday::events(const QDate&start,const QDate | |||
107 | temp = entries(d.addDays(i)); | 109 | temp = entries(d.addDays(i)); |
108 | if (temp.count()==0) { | 110 | if (temp.count()==0) { |
109 | continue; | 111 | continue; |
110 | } | 112 | } |
111 | for (unsigned j=0;j<temp.count();++j) { | 113 | for (unsigned j=0;j<temp.count();++j) { |
112 | Event ev; | 114 | Event ev; |
113 | ev.setDescription(temp[j]); | 115 | ev.setDescription(temp[j]); |
114 | ev.setStart(d.addDays(i)); | 116 | ev.setStart(d.addDays(i)); |
115 | ev.setAllDay(true); | 117 | ev.setAllDay(true); |
116 | ret.append(EffectiveEvent(ev,d.addDays(i))); | 118 | ret.append(EffectiveEvent(ev,d.addDays(i))); |
117 | } | 119 | } |
118 | } | 120 | } |
119 | 121 | ||
120 | return ret; | 122 | return ret; |
121 | } | 123 | } |
122 | 124 | ||
125 | Opie::Datebook::HolidayPluginConfigWidget*NationalHoliday::configWidget(QWidget *parent, const char *name, QWidget::WFlags fl) | ||
126 | { | ||
127 | return new NationalHolidayConfigWidget(parent,name,fl); | ||
128 | } | ||
129 | |||
123 | EXPORT_HOLIDAY_PLUGIN(NationalHoliday); | 130 | EXPORT_HOLIDAY_PLUGIN(NationalHoliday); |
diff --git a/core/pim/datebook/holiday/national/nationalholiday.h b/core/pim/datebook/holiday/national/nationalholiday.h index 6581263..afce3f4 100644 --- a/core/pim/datebook/holiday/national/nationalholiday.h +++ b/core/pim/datebook/holiday/national/nationalholiday.h | |||
@@ -1,34 +1,36 @@ | |||
1 | #ifndef __NATIONAL_HOLIDAY_H | 1 | #ifndef __NATIONAL_HOLIDAY_H |
2 | #define __NATIONAL_HOLIDAY_H | 2 | #define __NATIONAL_HOLIDAY_H |
3 | 3 | ||
4 | #include "nationalcfg.h" | 4 | #include "nationalcfg.h" |
5 | 5 | ||
6 | #include <opie2/oholidayplugin.h> | 6 | #include <opie2/oholidayplugin.h> |
7 | #include <opie2/oholidaypluginif.h> | 7 | #include <opie2/oholidaypluginif.h> |
8 | #include <opie2/oholidayplugincfgwidget.h> | ||
8 | 9 | ||
9 | #include <qmap.h> | 10 | #include <qmap.h> |
10 | #include <qstringlist.h> | 11 | #include <qstringlist.h> |
11 | 12 | ||
12 | class NationalHoliday:public Opie::Datebook::HolidayPlugin | 13 | class NationalHoliday:public Opie::Datebook::HolidayPlugin |
13 | { | 14 | { |
14 | 15 | ||
15 | public: | 16 | public: |
16 | NationalHoliday(); | 17 | NationalHoliday(); |
17 | virtual ~NationalHoliday(){} | 18 | virtual ~NationalHoliday(){} |
18 | 19 | ||
19 | virtual QString description(); | 20 | virtual QString description(); |
20 | virtual QStringList entries(const QDate&); | 21 | virtual QStringList entries(const QDate&); |
21 | virtual QStringList entries(unsigned year, unsigned month, unsigned day); | 22 | virtual QStringList entries(unsigned year, unsigned month, unsigned day); |
22 | virtual QMap<QDate,QStringList> entries(const QDate&,const QDate&); | 23 | virtual QMap<QDate,QStringList> entries(const QDate&,const QDate&); |
23 | virtual QValueList<EffectiveEvent> events(const QDate&,const QDate&); | 24 | virtual QValueList<EffectiveEvent> events(const QDate&,const QDate&); |
25 | virtual Opie::Datebook::HolidayPluginConfigWidget*configWidget(QWidget *parent=0, const char *name = 0, QWidget::WFlags fl = 0); | ||
24 | 26 | ||
25 | protected: | 27 | protected: |
26 | void init(); | 28 | void init(); |
27 | unsigned int _lastyear; | 29 | unsigned int _lastyear; |
28 | tholidaylist _days; | 30 | tholidaylist _days; |
29 | QStringList files; | 31 | QStringList files; |
30 | bool init_done:1; | 32 | bool init_done:1; |
31 | void load_days(); | 33 | void load_days(); |
32 | }; | 34 | }; |
33 | 35 | ||
34 | #endif | 36 | #endif |
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 |