-rw-r--r-- | core/pim/today/today.cpp | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index dd8d59b..d4a0ae6 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -183,68 +183,59 @@ void Today::loadPlugins() { | |||
183 | if ( !pluginList.isEmpty() ) { | 183 | if ( !pluginList.isEmpty() ) { |
184 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 184 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
185 | (*tit).guiBox->hide(); | 185 | (*tit).guiBox->hide(); |
186 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); | 186 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); |
187 | delete (*tit).guiBox; | 187 | delete (*tit).guiBox; |
188 | (*tit).library->unload(); | 188 | (*tit).library->unload(); |
189 | delete (*tit).library; | 189 | delete (*tit).library; |
190 | } | 190 | } |
191 | pluginList.clear(); | 191 | pluginList.clear(); |
192 | } | 192 | } |
193 | 193 | ||
194 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 194 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
195 | qWarning("Searching for Plugins in: %s", path.latin1()); | ||
196 | #ifdef Q_OS_MACX | ||
197 | QDir dir( path, "lib*.dylib" ); | ||
198 | #else | ||
199 | QDir dir( path, "lib*.so" ); | 195 | QDir dir( path, "lib*.so" ); |
200 | #endif | ||
201 | 196 | ||
202 | QStringList list = dir.entryList(); | 197 | QStringList list = dir.entryList(); |
203 | QStringList::Iterator it; | 198 | QStringList::Iterator it; |
204 | 199 | ||
205 | // QMap<QString, TodayPlugin> tempList; | 200 | // QMap<QString, TodayPlugin> tempList; |
206 | 201 | ||
207 | for ( it = list.begin(); it != list.end(); ++it ) { | 202 | for ( it = list.begin(); it != list.end(); ++it ) { |
208 | QInterfacePtr<TodayPluginInterface> iface; | 203 | QInterfacePtr<TodayPluginInterface> iface; |
209 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 204 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
210 | 205 | ||
211 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 206 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
212 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 207 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
213 | qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); | 208 | qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); |
214 | qDebug( QString(*it) ); | 209 | qDebug( QString(*it) ); |
215 | 210 | ||
216 | TodayPlugin plugin; | 211 | TodayPlugin plugin; |
217 | plugin.library = lib; | 212 | plugin.library = lib; |
218 | plugin.iface = iface; | 213 | plugin.iface = iface; |
219 | plugin.name = QString(*it); | 214 | plugin.name = QString(*it); |
220 | 215 | ||
221 | QString type = (*it).left( (*it).find(".") ); | 216 | QString type = (*it).left( (*it).find(".") ); |
222 | 217 | ||
223 | // grr, sharp rom does not know Global::languageList(); | 218 | QString lang; |
224 | // QStringList langs = Global::languageList(); | 219 | Config config("locale"); |
225 | QString tfn = QPEApplication::qpeDir() + "/i18n/"; | 220 | config.setGroup("Language"); |
226 | QDir langDir = tfn; | 221 | lang = config.readEntry( "Language", "en" ); |
227 | QStringList langs = langDir.entryList("*", QDir::Dirs ); | 222 | |
228 | 223 | qDebug( "Languages: " + lang ); | |
229 | for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { | 224 | QTranslator * trans = new QTranslator( qApp ); |
230 | QString lang = *lit; | 225 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; |
231 | qDebug( "Languages: " + lang ); | 226 | if ( trans->load( tfn ) ) { |
232 | QTranslator * trans = new QTranslator( qApp ); | 227 | qApp->installTranslator( trans ); |
233 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; | 228 | } else { |
234 | if ( trans->load( tfn ) ) { | 229 | delete trans; |
235 | qApp->installTranslator( trans ); | ||
236 | } else { | ||
237 | delete trans; | ||
238 | } | ||
239 | } | 230 | } |
240 | 231 | ||
241 | 232 | ||
242 | // find out if plugins should be shown | 233 | // find out if plugins should be shown |
243 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 234 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
244 | plugin.active = true; | 235 | plugin.active = true; |
245 | } else { | 236 | } else { |
246 | plugin.active = false; | 237 | plugin.active = false; |
247 | } | 238 | } |
248 | 239 | ||
249 | plugin.guiPart = plugin.iface->guiPart(); | 240 | plugin.guiPart = plugin.iface->guiPart(); |
250 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | 241 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |