summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Unidiff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/today.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index a8c8651..be7cbce 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -27,8 +27,9 @@
27 27
28#include <qdir.h> 28#include <qdir.h>
29#include <qtimer.h> 29#include <qtimer.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31#include <qmessagebox.h>
31 32
32using namespace Opie::Ui; 33using namespace Opie::Ui;
33using Opie::Core::OPluginItem; 34using Opie::Core::OPluginItem;
34using Opie::Core::OPluginLoader; 35using Opie::Core::OPluginLoader;
@@ -53,16 +54,14 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
53 54
54 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 55 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
55 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 56 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
56 57
57 #if defined(Q_WS_QWS)
58 #if !defined(QT_NO_COP) 58 #if !defined(QT_NO_COP)
59 59
60 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 60 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
61 connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), 61 connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ),
62 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); 62 this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) );
63 #endif 63 #endif
64 #endif
65 64
66 setOwnerField(); 65 setOwnerField();
67 m_big_box = 0L; 66 m_big_box = 0L;
68 67
@@ -83,9 +82,8 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
83 82
84 init(); 83 init();
85 loadPlugins(); 84 loadPlugins();
86 initialize(); 85 initialize();
87 QPEApplication::showWidget( this );
88} 86}
89 87
90/** 88/**
91 * Qcop receive method. 89 * Qcop receive method.
@@ -178,13 +176,26 @@ void Today::loadPlugins() {
178 176
179 m_pluginLoader = new OPluginLoader( "today", true ); 177 m_pluginLoader = new OPluginLoader( "today", true );
180 m_pluginLoader->setAutoDelete( true ); 178 m_pluginLoader->setAutoDelete( true );
181 179
182 OPluginItem::List lst = m_pluginLoader->allAvailable( true );
183
184 m_manager = new OPluginManager( m_pluginLoader ); 180 m_manager = new OPluginManager( m_pluginLoader );
185 m_manager->load(); 181 m_manager->load();
186 182
183 /*
184 * check if loading of Plugins crashed
185 */
186 if( m_pluginLoader->isInSafeMode() ) {
187 QMessageBox::information(this, tr("Today Error"),
188 tr("<qt>The plugin '%1' caused Today to crash."
189 " It could be that the plugin is not properly"
190 " installed.<br>Today tries to continue loading"
191 " plugins.</qt>")
192 .arg( m_manager->crashedPlugin().name()));
193 }
194
195 OPluginItem::List lst = m_pluginLoader->filtered( true );
196
197
187 for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { 198 for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
188 TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); 199 TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface );
189 200
190 TodayPlugin plugin; 201 TodayPlugin plugin;
@@ -232,9 +243,9 @@ void Today::startConfig() {
232 243
233 TodayConfig conf( this, "dialog", true ); 244 TodayConfig conf( this, "dialog", true );
234 conf.setUpPlugins( m_manager, m_pluginLoader ); 245 conf.setUpPlugins( m_manager, m_pluginLoader );
235 246
236 if ( conf.exec() == QDialog::Accepted ) { 247 if ( QPEApplication::execDialog(&conf) == QDialog::Accepted ) {
237 conf.writeConfig(); 248 conf.writeConfig();
238 initialize(); 249 initialize();
239 } else { 250 } else {
240 // since reinitialize is not called in that case , reconnect the signal 251 // since reinitialize is not called in that case , reconnect the signal
@@ -343,12 +354,11 @@ void Today::editCard() {
343} 354}
344 355
345 356
346Today::~Today() { 357Today::~Today() {
347 if (m_pluginLoader) { 358 for(QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); it != pluginList.end(); ++it )
359 delete it.data().guiBox;
360
348 delete m_pluginLoader; 361 delete m_pluginLoader;
349 }
350 if (m_manager) {
351 delete m_manager; 362 delete m_manager;
352 } 363 }
353}
354 364