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 /core/pim/datebook/datebooksettings.cpp | |
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.
Diffstat (limited to 'core/pim/datebook/datebooksettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
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 | |||
@@ -13,31 +13,36 @@ | |||
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; |
@@ -81,24 +86,47 @@ int DateBookSettings::startTime() const | |||
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()); |