-rw-r--r-- | core/pim/datebook/datebook.cpp | 50 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 36 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.h | 18 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettingsbase.ui | 59 | ||||
-rw-r--r-- | core/pim/datebook/datebooktypes.h | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 5 |
8 files changed, 144 insertions, 40 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index a7f6691..8ae4f84 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -248,2 +248,3 @@ void DateBook::slotSettings() frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); + frmSettings.setPluginList(db_holiday->pluginManager(),db_holiday->pluginLoader()); @@ -264,2 +265,5 @@ void DateBook::slotSettings() if ( QPEApplication::execDialog( &frmSettings ) ) { + db_holiday->pluginManager()->save(); + db_holiday->reloadPlugins(); + aPreset = frmSettings.alarmPreset(); @@ -1091,2 +1095,11 @@ DateBookHoliday::DateBookHoliday() m_pluginLoader->setAutoDelete(true); + m_pluginManager = new Opie::Core::OPluginManager(m_pluginLoader); + m_pluginManager->load(); + + init(); +} + +void DateBookHoliday::reloadPlugins() +{ + deinit(); init(); @@ -1098,2 +1111,3 @@ DateBookHoliday::~DateBookHoliday() delete m_pluginLoader; + delete m_pluginManager; } @@ -1102,3 +1116,2 @@ void DateBookHoliday::deinit() { -/* QValueList<HPlugin*>::Iterator it; @@ -1106,6 +1119,3 @@ void DateBookHoliday::deinit() HPlugin*_pl = *it; - // destructs itself? - _pl->_if->release(); - _pl->_lib->unload(); - delete _pl->_lib; + *it = 0; delete _pl; @@ -1113,3 +1123,2 @@ void DateBookHoliday::deinit() _pluginlist.clear(); -*/ } @@ -1125,6 +1134,5 @@ void DateBookHoliday::init() { -#if 0 deinit(); -#endif - Opie::Core::OPluginItem::List lst = m_pluginLoader->allAvailable( false ); + + Opie::Core::OPluginItem::List lst = m_pluginLoader->filtered(true); // debugLst( lst ); @@ -1143,26 +1151,2 @@ void DateBookHoliday::init() } -#if 0 - QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; - QDir dir( path, "lib*.so" ); - QStringList list = dir.entryList(); - QStringList::Iterator it; - for (it=list.begin();it!=list.end();++it) { - Opie::Datebook::HolidayPluginIf*hif = 0; - QLibrary*lib=new QLibrary(path+"/"+*it); - if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) { - Opie::Datebook::HolidayPlugin*pl = hif->plugin(); - if (pl) { - HPlugin*_pl=new HPlugin; - _pl->_plugin = pl; - odebug << "Found holiday " << pl->description()<<oendl; - _pl->_lib = lib; - _pl->_if = hif; - _pluginlist.append(_pl); - } else { - } - } else { - delete lib; - } - } -#endif } diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 00ddd05..26f0303 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp @@ -365,6 +365,7 @@ void DateBookDay::getEvents() QObject* object = 0; + + /* this way we make sure that holiday dummy events are always + on top of the widgetlist. */ for (sit=hdays.begin();sit!=hdays.end();++sit) { - object = m_allDays->addHoliday(*sit); - if (!object) continue; - /* not to do something with it */ + m_allDays->addHoliday(*sit); } diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 5b40246..27fce44 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp @@ -194,3 +194,3 @@ void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) QPopupMenu m; - if (!m_holiday) { + if (ev.isValidUid()) { m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp index cb4b73b..861e266 100644 --- a/core/pim/datebook/datebooksettings.cpp +++ b/core/pim/datebook/datebooksettings.cpp @@ -22,2 +22,5 @@ +#include <opie2/opluginloader.h> +#include <opie2/odebug.h> + #include <qpe/qpeapplication.h> @@ -26,2 +29,4 @@ #include <qcheckbox.h> +#include <qlistview.h> +#include <qheader.h> @@ -36,2 +41,6 @@ DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); + m_loader = 0; + m_manager = 0; + m_PluginListView->header()->hide(); + m_PluginListView->setSorting(-1); } @@ -72,2 +81,29 @@ int DateBookSettings::startTime() const +void DateBookSettings::setPluginList(Opie::Core::OPluginManager*aManager,Opie::Core::OPluginLoader*aLoader) +{ + m_manager = aManager; + m_loader = aLoader; + if (!aManager||!aLoader) return; + Opie::Core::OPluginItem::List inLst = m_loader->allAvailable(true); + QCheckListItem *pitem = 0; + + for ( Opie::Core::OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { + pitem = new QCheckListItem(m_PluginListView,(*it).name(),QCheckListItem::CheckBox); + pitem->setOn( (*it).isEnabled() ); + } +} + +void DateBookSettings::pluginItemClicked(QListViewItem *aItem) +{ + if (!aItem||!m_manager||!m_loader) return; + QCheckListItem*pitem = ((QCheckListItem*)aItem); + + Opie::Core::OPluginItem::List lst = m_loader->allAvailable( true ); + for ( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { + if ( QString::compare( (*it).name() , pitem->text(0) ) == 0 ) { + m_manager->setEnabled((*it),pitem->isOn()); + break; + } + } +} diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index cf8a0ff..df7d32c 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h @@ -25,2 +25,13 @@ +namespace Opie { +namespace Core { + class OPluginManager; + class OGenericPluginLoader; + class OPluginLoader; +} +namespace Ui { + class OPluginConfigWidget; +} +} + class DateBookSettings : public DateBookSettingsBase @@ -45,2 +56,3 @@ public: + void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); private slots: @@ -48,4 +60,6 @@ private slots: void slotChangeClock( bool ); +protected slots: + virtual void pluginItemClicked(QListViewItem *); -private: +protected: void init(); @@ -53,2 +67,4 @@ private: int oldtime; + Opie::Core::OPluginManager*m_manager; + Opie::Core::OPluginLoader*m_loader; }; diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui index e613db1..7b3e591 100644 --- a/core/pim/datebook/datebooksettingsbase.ui +++ b/core/pim/datebook/datebooksettingsbase.ui @@ -61,3 +61,9 @@ <name>name</name> - <cstring>TabWidget2</cstring> + <cstring>TabWidget</cstring> + </property> + <property> + <name>layoutMargin</name> + </property> + <property> + <name>layoutSpacing</name> </property> @@ -670,2 +676,44 @@ </widget> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>plugintab</cstring> + </property> + <attribute> + <name>title</name> + <string>Plugins</string> + </attribute> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>2</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>2</number> + </property> + <widget> + <class>QListView</class> + <column> + <property> + <name>text</name> + <string>Pluginlist</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> + </property> + <property> + <name>resizeable</name> + <bool>true</bool> + </property> + </column> + <property stdset="1"> + <name>name</name> + <cstring>m_PluginListView</cstring> + </property> + </widget> + </vbox> + </widget> </widget> @@ -708,4 +756,11 @@ </connection> - <slot access="public">slotChangeClock( bool )</slot> + <connection> + <sender>m_PluginListView</sender> + <signal>clicked(QListViewItem*)</signal> + <receiver>DateBookSettingsBase</receiver> + <slot>pluginItemClicked(QListViewItem *)</slot> + </connection> + <slot access="protected">pluginItemClicked(QListViewItem *)</slot> <slot access="public">slot12Hour( int )</slot> + <slot access="public">slotChangeClock( bool )</slot> </connections> diff --git a/core/pim/datebook/datebooktypes.h b/core/pim/datebook/datebooktypes.h index f944e84..2966814 100644 --- a/core/pim/datebook/datebooktypes.h +++ b/core/pim/datebook/datebooktypes.h @@ -15,2 +15,3 @@ namespace Core { class OPluginLoader;
+ class OPluginManager;
}
@@ -37,2 +38,7 @@ public: + void reloadPlugins();
+
+ Opie::Core::OPluginLoader*pluginLoader(){return m_pluginLoader;}
+ Opie::Core::OPluginManager*pluginManager(){return m_pluginManager;}
+
protected:
@@ -48,2 +54,3 @@ protected: Opie::Core::OPluginLoader*m_pluginLoader;
+ Opie::Core::OPluginManager*m_pluginManager;
};
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index b0e78f1..3c871ea 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -217,3 +217,8 @@ void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) { + if (!event.event().isValidUid()) { + // this is just such a holiday event. + return; + } popmenue = new QPopupMenu; + popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); |