author | alwin <alwin> | 2005-03-18 12:49:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-18 12:49:14 (UTC) |
commit | b7996a25adab32e6f2e4d278a9d9801ad66f90c7 (patch) (unidiff) | |
tree | f90bf3aa5cd274c467a8ff3e84566fdfa6a1a6c5 /core/pim/datebook/datebook.cpp | |
parent | d7fdcc3dac4a1d8cbd823d17ea52d17cb67b16f8 (diff) | |
download | opie-b7996a25adab32e6f2e4d278a9d9801ad66f90c7.zip opie-b7996a25adab32e6f2e4d278a9d9801ad66f90c7.tar.gz opie-b7996a25adab32e6f2e4d278a9d9801ad66f90c7.tar.bz2 |
made plugins configureable, eg, if them will load or not (or switch on/off
at runtime)
events generated from plugins will not editable and so on (check for a
wrong Uid) so them are just text inside datebook.
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 50 |
1 files changed, 17 insertions, 33 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 | |||
@@ -246,6 +246,7 @@ void DateBook::slotSettings() | |||
246 | frmSettings.setRowStyle( rowStyle ); | 246 | frmSettings.setRowStyle( rowStyle ); |
247 | frmSettings.comboDefaultView->setCurrentItem(defaultView-1); | 247 | frmSettings.comboDefaultView->setCurrentItem(defaultView-1); |
248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); | 248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); |
249 | frmSettings.setPluginList(db_holiday->pluginManager(),db_holiday->pluginLoader()); | ||
249 | 250 | ||
250 | bool found=false; | 251 | bool found=false; |
251 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { | 252 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { |
@@ -262,6 +263,9 @@ void DateBook::slotSettings() | |||
262 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); | 263 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); |
263 | 264 | ||
264 | if ( QPEApplication::execDialog( &frmSettings ) ) { | 265 | if ( QPEApplication::execDialog( &frmSettings ) ) { |
266 | db_holiday->pluginManager()->save(); | ||
267 | db_holiday->reloadPlugins(); | ||
268 | |||
265 | aPreset = frmSettings.alarmPreset(); | 269 | aPreset = frmSettings.alarmPreset(); |
266 | presetTime = frmSettings.presetTime(); | 270 | presetTime = frmSettings.presetTime(); |
267 | startTime = frmSettings.startTime(); | 271 | startTime = frmSettings.startTime(); |
@@ -1089,6 +1093,15 @@ DateBookHoliday::DateBookHoliday() | |||
1089 | _pluginlist.clear(); | 1093 | _pluginlist.clear(); |
1090 | m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false); | 1094 | m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false); |
1091 | m_pluginLoader->setAutoDelete(true); | 1095 | m_pluginLoader->setAutoDelete(true); |
1096 | m_pluginManager = new Opie::Core::OPluginManager(m_pluginLoader); | ||
1097 | m_pluginManager->load(); | ||
1098 | |||
1099 | init(); | ||
1100 | } | ||
1101 | |||
1102 | void DateBookHoliday::reloadPlugins() | ||
1103 | { | ||
1104 | deinit(); | ||
1092 | init(); | 1105 | init(); |
1093 | } | 1106 | } |
1094 | 1107 | ||
@@ -1096,22 +1109,18 @@ DateBookHoliday::~DateBookHoliday() | |||
1096 | { | 1109 | { |
1097 | deinit(); | 1110 | deinit(); |
1098 | delete m_pluginLoader; | 1111 | delete m_pluginLoader; |
1112 | delete m_pluginManager; | ||
1099 | } | 1113 | } |
1100 | 1114 | ||
1101 | void DateBookHoliday::deinit() | 1115 | void DateBookHoliday::deinit() |
1102 | { | 1116 | { |
1103 | /* | ||
1104 | QValueList<HPlugin*>::Iterator it; | 1117 | QValueList<HPlugin*>::Iterator it; |
1105 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { | 1118 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { |
1106 | HPlugin*_pl = *it; | 1119 | HPlugin*_pl = *it; |
1107 | // destructs itself? | 1120 | *it = 0; |
1108 | _pl->_if->release(); | ||
1109 | _pl->_lib->unload(); | ||
1110 | delete _pl->_lib; | ||
1111 | delete _pl; | 1121 | delete _pl; |
1112 | } | 1122 | } |
1113 | _pluginlist.clear(); | 1123 | _pluginlist.clear(); |
1114 | */ | ||
1115 | } | 1124 | } |
1116 | 1125 | ||
1117 | #if 0 | 1126 | #if 0 |
@@ -1123,10 +1132,9 @@ void debugLst( const Opie::Core::OPluginItem::List& lst ) { | |||
1123 | 1132 | ||
1124 | void DateBookHoliday::init() | 1133 | void DateBookHoliday::init() |
1125 | { | 1134 | { |
1126 | #if 0 | ||
1127 | deinit(); | 1135 | deinit(); |
1128 | #endif | 1136 | |
1129 | Opie::Core::OPluginItem::List lst = m_pluginLoader->allAvailable( false ); | 1137 | Opie::Core::OPluginItem::List lst = m_pluginLoader->filtered(true); |
1130 | // debugLst( lst ); | 1138 | // debugLst( lst ); |
1131 | for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ | 1139 | for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ |
1132 | Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN); | 1140 | Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN); |
@@ -1141,30 +1149,6 @@ void DateBookHoliday::init() | |||
1141 | } | 1149 | } |
1142 | } | 1150 | } |
1143 | } | 1151 | } |
1144 | #if 0 | ||
1145 | QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; | ||
1146 | QDir dir( path, "lib*.so" ); | ||
1147 | QStringList list = dir.entryList(); | ||
1148 | QStringList::Iterator it; | ||
1149 | for (it=list.begin();it!=list.end();++it) { | ||
1150 | Opie::Datebook::HolidayPluginIf*hif = 0; | ||
1151 | QLibrary*lib=new QLibrary(path+"/"+*it); | ||
1152 | if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) { | ||
1153 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); | ||
1154 | if (pl) { | ||
1155 | HPlugin*_pl=new HPlugin; | ||
1156 | _pl->_plugin = pl; | ||
1157 | odebug << "Found holiday " << pl->description()<<oendl; | ||
1158 | _pl->_lib = lib; | ||
1159 | _pl->_if = hif; | ||
1160 | _pluginlist.append(_pl); | ||
1161 | } else { | ||
1162 | } | ||
1163 | } else { | ||
1164 | delete lib; | ||
1165 | } | ||
1166 | } | ||
1167 | #endif | ||
1168 | } | 1152 | } |
1169 | 1153 | ||
1170 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) | 1154 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) |