Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 36c4bd7..a7f6691 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -29,12 +29,14 @@ | |||
29 | #include "datebookweeklst.h" | 29 | #include "datebookweeklst.h" |
30 | #include "dateentryimpl.h" | 30 | #include "dateentryimpl.h" |
31 | 31 | ||
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | #include <opie2/oholidaypluginif.h> | 33 | #include <opie2/oholidaypluginif.h> |
34 | #include <opie2/oholidayplugin.h> | 34 | #include <opie2/oholidayplugin.h> |
35 | #include <opie2/opluginloader.h> | ||
36 | #include <opie2/todayplugininterface.h> | ||
35 | 37 | ||
36 | #include <qpe/datebookmonth.h> | 38 | #include <qpe/datebookmonth.h> |
37 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
38 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
39 | #include <qpe/finddialog.h> | 41 | #include <qpe/finddialog.h> |
40 | #include <qpe/ir.h> | 42 | #include <qpe/ir.h> |
@@ -1082,37 +1084,67 @@ Event DateBookDBHack::eventByUID(int uid) { | |||
1082 | return ev; // return at least | 1084 | return ev; // return at least |
1083 | } | 1085 | } |
1084 | 1086 | ||
1085 | DateBookHoliday::DateBookHoliday() | 1087 | DateBookHoliday::DateBookHoliday() |
1086 | { | 1088 | { |
1087 | _pluginlist.clear(); | 1089 | _pluginlist.clear(); |
1090 | m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false); | ||
1091 | m_pluginLoader->setAutoDelete(true); | ||
1088 | init(); | 1092 | init(); |
1089 | } | 1093 | } |
1090 | 1094 | ||
1091 | DateBookHoliday::~DateBookHoliday() | 1095 | DateBookHoliday::~DateBookHoliday() |
1092 | { | 1096 | { |
1093 | deinit(); | 1097 | deinit(); |
1098 | delete m_pluginLoader; | ||
1094 | } | 1099 | } |
1095 | 1100 | ||
1096 | void DateBookHoliday::deinit() | 1101 | void DateBookHoliday::deinit() |
1097 | { | 1102 | { |
1103 | /* | ||
1098 | QValueList<HPlugin*>::Iterator it; | 1104 | QValueList<HPlugin*>::Iterator it; |
1099 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { | 1105 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { |
1100 | HPlugin*_pl = *it; | 1106 | HPlugin*_pl = *it; |
1101 | // destructs itself? | 1107 | // destructs itself? |
1102 | _pl->_if->release(); | 1108 | _pl->_if->release(); |
1103 | _pl->_lib->unload(); | 1109 | _pl->_lib->unload(); |
1104 | delete _pl->_lib; | 1110 | delete _pl->_lib; |
1105 | delete _pl; | 1111 | delete _pl; |
1106 | } | 1112 | } |
1107 | _pluginlist.clear(); | 1113 | _pluginlist.clear(); |
1114 | */ | ||
1108 | } | 1115 | } |
1109 | 1116 | ||
1117 | #if 0 | ||
1118 | void debugLst( const Opie::Core::OPluginItem::List& lst ) { | ||
1119 | for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) | ||
1120 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; | ||
1121 | } | ||
1122 | #endif | ||
1123 | |||
1110 | void DateBookHoliday::init() | 1124 | void DateBookHoliday::init() |
1111 | { | 1125 | { |
1126 | #if 0 | ||
1112 | deinit(); | 1127 | deinit(); |
1128 | #endif | ||
1129 | Opie::Core::OPluginItem::List lst = m_pluginLoader->allAvailable( false ); | ||
1130 | // debugLst( lst ); | ||
1131 | 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); | ||
1133 | if (hif) { | ||
1134 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); | ||
1135 | if (pl) { | ||
1136 | HPlugin*_pl=new HPlugin; | ||
1137 | _pl->_plugin = pl; | ||
1138 | odebug << "Found holiday " << pl->description()<<oendl; | ||
1139 | _pluginlist.append(_pl); | ||
1140 | //_pl->_if = hif; | ||
1141 | } | ||
1142 | } | ||
1143 | } | ||
1144 | #if 0 | ||
1113 | QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; | 1145 | QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; |
1114 | QDir dir( path, "lib*.so" ); | 1146 | QDir dir( path, "lib*.so" ); |
1115 | QStringList list = dir.entryList(); | 1147 | QStringList list = dir.entryList(); |
1116 | QStringList::Iterator it; | 1148 | QStringList::Iterator it; |
1117 | for (it=list.begin();it!=list.end();++it) { | 1149 | for (it=list.begin();it!=list.end();++it) { |
1118 | Opie::Datebook::HolidayPluginIf*hif = 0; | 1150 | Opie::Datebook::HolidayPluginIf*hif = 0; |
@@ -1129,12 +1161,13 @@ void DateBookHoliday::init() | |||
1129 | } else { | 1161 | } else { |
1130 | } | 1162 | } |
1131 | } else { | 1163 | } else { |
1132 | delete lib; | 1164 | delete lib; |
1133 | } | 1165 | } |
1134 | } | 1166 | } |
1167 | #endif | ||
1135 | } | 1168 | } |
1136 | 1169 | ||
1137 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) | 1170 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) |
1138 | { | 1171 | { |
1139 | QStringList ret; | 1172 | QStringList ret; |
1140 | QValueList<HPlugin*>::Iterator it; | 1173 | QValueList<HPlugin*>::Iterator it; |