summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp2
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp2
-rw-r--r--core/pim/today/today.cpp172
-rw-r--r--core/pim/today/today.h8
-rw-r--r--core/pim/today/todayconfig.cpp7
5 files changed, 76 insertions, 115 deletions
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index 892a0ad..bef284e 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -48,3 +48,3 @@ QString DatebookPlugin::pixmapNameConfig() const {
TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) {
- return new DatebookPluginConfig( wid , "Datebook" );
+ return new DatebookPluginConfig( wid , "Datebook Config" );
}
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp
index 6cfcbe0..4be5673 100644
--- a/core/pim/today/plugins/todolist/todoplugin.cpp
+++ b/core/pim/today/plugins/todolist/todoplugin.cpp
@@ -49,3 +49,3 @@ QString TodolistPlugin::pixmapNameConfig() const {
TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) {
- return new TodolistPluginConfig( wid , "Todolist" );
+ return new TodolistPluginConfig( wid , "Todolist Config" );
}
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index be7cbce..3e895a4 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -52,6 +52,7 @@ static QMap<QString, TodayPlugin> pluginList;
Today::Today( QWidget* parent, const char* name, WFlags fl )
-: TodayBase( parent, name, fl ) {
+: TodayBase( parent, name, fl | WStyle_ContextHelp) {
- QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
- QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
+ setCaption( tr("Today") );
+ connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
+ connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
@@ -65,3 +66,4 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
setOwnerField();
- m_big_box = 0L;
+ m_big_box = 0l;
+ m_bblayout = 0l;
@@ -71,2 +73,6 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
+
+ m_informationLabel = new QLabel( tr("No plugins activated"), this );
+ layout->addWidget( m_informationLabel );
+
m_sv = new QScrollView( this );
@@ -82,5 +88,5 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
- init();
loadPlugins();
- initialize();
+ loadShellContent();
+ loadPluginWidgets();
}
@@ -135,10 +141,16 @@ void Today::setOwnerField( QString &message ) {
/**
- * Init stuff needed for today. Reads the config file.
+ * Load the plugins
*/
-void Today::init() {
- // read config
- OConfig cfg( "today" );
+void Today::loadPlugins() {
+ m_pluginLoader = new OPluginLoader( "today", true );
+ m_pluginLoader->setAutoDelete( true );
+
+ m_manager = new OPluginManager( m_pluginLoader );
+ m_manager->load();
+}
+
+void Today::loadShellContent() {
+ Config cfg( "today" );
cfg.setGroup( "Plugins" );
- // m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
- // m_allApplets = cfg.readListEntry( "AllApplets", ',' );
+
@@ -160,24 +172,5 @@ void Today::init() {
}
-
- if ( m_big_box ) {
- delete m_big_box;
- }
-
- m_big_box = new QWidget( m_sv->viewport() );
- m_sv->addChild( m_big_box );
- m_bblayout = new QVBoxLayout ( m_big_box );
}
-
-/**
- * Load the plugins
- */
-void Today::loadPlugins() {
-
- m_pluginLoader = new OPluginLoader( "today", true );
- m_pluginLoader->setAutoDelete( true );
-
- m_manager = new OPluginManager( m_pluginLoader );
- m_manager->load();
-
+void Today::loadPluginWidgets() {
/*
@@ -196,2 +189,17 @@ void Today::loadPlugins() {
+ /*
+ * Show or Hide the information of no plugin installed
+ */
+ if ( lst.isEmpty() )
+ m_informationLabel->show();
+ else
+ m_informationLabel->hide();
+
+
+ /*
+ * Now let us add the plugins
+ */
+ m_big_box = new QWidget( m_sv->viewport() );
+ m_sv->addChild( m_big_box );
+ m_bblayout = new QVBoxLayout( m_big_box );
@@ -231,2 +239,3 @@ void Today::loadPlugins() {
m_bblayout->addStretch( 1 );
+ m_big_box->show();
}
@@ -238,3 +247,2 @@ void Today::loadPlugins() {
void Today::startConfig() {
-
// disconnect timer to prevent problems while being on config dialog
@@ -248,3 +256,5 @@ void Today::startConfig() {
conf.writeConfig();
- initialize();
+ clearPluginWidgets();
+ loadShellContent();
+ loadPluginWidgets();
} else {
@@ -256,67 +266,2 @@ void Today::startConfig() {
-
-void Today::initialize() {
-
- Config cfg( "today" );
- cfg.setGroup( "Plugins" );
-
-
- cfg.setGroup( "General" );
- m_iconSize = cfg.readNumEntry( "IconSize", 18 );
- m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
- setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
-
- // set the date in top label
- QDate date = QDate::currentDate();
- DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
-
- if ( m_hideBanner ) {
- Opiezilla->hide();
- TodayLabel->hide();
- } else {
- Opiezilla->show();
- TodayLabel->show();
- }
-
- if ( m_bblayout ) {
- delete m_bblayout;
- }
- m_bblayout = new QVBoxLayout ( m_big_box );
-
- if ( pluginList.count() == 0 ) {
- QLabel *noPlugins = new QLabel( this );
- noPlugins->setText( tr( "No plugins found" ) );
- layout->addWidget( noPlugins );
- } else {
-
- uint count = 0;
- TodayPlugin tempPlugin;
- OPluginItem::List lst = m_pluginLoader->allAvailable( true );
- for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
-
- TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface );
-
- tempPlugin = ( pluginList.find( (*it).name() ).data() );
- if ( !( (tempPlugin.name).isEmpty() ) ) {
- if ( (*it).isEnabled() ) {
- iface->guiPart()->reinitialize();
- odebug << "reinit" << oendl;
- tempPlugin.guiBox->show();
- m_bblayout->addWidget(tempPlugin.guiBox);
- count++;
- } else {
- tempPlugin.guiBox->hide();
- }
- }
- }
- if ( count == 0 ) {
- QLabel *noPluginsActive = new QLabel( this );
- noPluginsActive->setText( tr( "No plugins activated" ) );
- layout->addWidget( noPluginsActive );
- }
- }
- m_bblayout->addStretch( 1 );
- repaint();
-}
-
/**
@@ -326,10 +271,5 @@ void Today::initialize() {
void Today::refresh() {
-
- OPluginItem::List lst = m_pluginLoader->filtered( true );
-
- for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
- TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface );
- iface->guiPart()->refresh();
- odebug << "refresh" << oendl;
- }
+ for ( QMap<QString, TodayPlugin>::Iterator it = pluginList.begin();
+ it != pluginList.end(); ++it )
+ it.data().guiPart->refresh();
@@ -357,5 +297,3 @@ void Today::editCard() {
Today::~Today() {
- for(QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); it != pluginList.end(); ++it )
- delete it.data().guiBox;
-
+ clearPluginWidgets();
delete m_pluginLoader;
@@ -364 +302,15 @@ Today::~Today() {
+
+void Today::clearPluginWidgets() {
+ for(QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); it != pluginList.end(); ++it ) {
+ delete it.data().guiBox;
+ it.data().guiBox = 0;
+ }
+
+ pluginList.clear();
+
+ delete m_bblayout;
+ delete m_big_box;
+ m_bblayout = 0;
+ m_big_box = 0;
+}
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index dfc819d..8dbe9aa 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -58,6 +58,4 @@ private slots:
private:
- void init();
void setOwnerField();
void setOwnerField(QString &string);
- void initialize();
@@ -65,2 +63,7 @@ private:
+ void clearPluginWidgets();
+ void loadPluginWidgets();
+ void loadShellContent();
+
+
private slots:
@@ -77,2 +80,3 @@ private:
QVBoxLayout *m_bblayout;
+ QLabel *m_informationLabel;
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index dacce8b..864c708 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -95,3 +95,2 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
- connect ( m_appletListView , SIGNAL( clicked(QListViewItem*) ), this, SLOT( appletChanged() ) );
previousItem = 0l;
@@ -183,2 +182,4 @@ void TodayConfig::writeConfig() {
if ( QString::compare( (*it).name() , list_it.current()->text(0) ) == 0 ) {
+ qWarning( "Enabling %d and make it %d", position-1,
+ ((QCheckListItem*)list_it.current())->isOn() );
(*it).setPosition(position--);
@@ -189,2 +190,5 @@ void TodayConfig::writeConfig() {
+ /*
+ * save and get the changes back
+ */
m_pluginManager->save();
@@ -211,2 +215,3 @@ void TodayConfig::writeConfig() {
m_configMap[iface]->writeConfig();
+
}