summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 91028c8..1f758f2 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -61,25 +61,26 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
#if defined(Q_WS_QWS)
#if !defined(QT_NO_COP)
QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
#endif
#endif
setOwnerField();
m_refreshTimer = new QTimer( this );
connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
m_refreshTimer->start( 15000 );
- refresh();
+ init();
+ loadPlugins();
showMaximized();
}
/**
* Qcop receive method.
*/
void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
QDataStream stream( data, IO_ReadOnly );
if ( msg == "message(QString)" ) {
QString message;
stream >> message;
setOwnerField( message );
@@ -127,24 +128,39 @@ void Today::setOwnerField( QString &message ) {
*/
void Today::init() {
// read config
Config cfg( "today" );
cfg.setGroup( "Plugins" );
m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
m_allApplets = cfg.readListEntry( "AllApplets", ',' );
cfg.setGroup( "General" );
m_iconSize = cfg.readNumEntry( "IconSize", 18 );
setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
+
+
+ // qDebug(" refresh ");
+ // set the date in top label
+ QDate date = QDate::currentDate();
+ QString time = ( tr( date.toString() ) );
+
+ DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
+
+ if ( layout ) {
+ delete layout;
+ }
+ layout = new QVBoxLayout( this );
+ layout->addWidget( Frame );
+ layout->addWidget( OwnerField );
}
/**
* Load the plugins
*/
void Today::loadPlugins() {
// extra list for plugins that exclude themself from periodic refresh
QMap<QString, TodayPlugin> pluginListRefreshExclude;
QValueList<TodayPlugin>::Iterator tit;
@@ -257,24 +273,25 @@ void Today::loadPlugins() {
if ( !m_allApplets.isEmpty() ) {
TodayPlugin tempPlugin;
QStringList::Iterator stringit;
for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
tempPlugin = ( tempList.find( *stringit ) ).data();
if ( !( (tempPlugin.name).isEmpty() ) ) {
layout->addWidget( tempPlugin.guiBox );
pluginList.append( tempPlugin );
}
}
}
+ draw();
}
/**
* Repaint method. Reread all fields.
*/
void Today::draw() {
if ( pluginList.count() == 0 ) {
QLabel *noPlugins = new QLabel( this );
noPlugins->setText( tr( "No plugins found" ) );
layout->addWidget( noPlugins );
@@ -331,55 +348,46 @@ void Today::startConfig() {
// set the order/activate tab
conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
}
if ( conf.exec() == QDialog::Accepted ) {
conf.writeConfig();
TodayConfigWidget *confWidget;
for ( confWidget = configWidgetList.first(); confWidget != 0;
confWidget = configWidgetList.next() ) {
confWidget->writeConfig();
}
- refresh();
+ loadPlugins();
} else {
// since refresh is not called in that case , reconnect the signal
connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
}
}
/**
* Refresh for the view. Reload all applets
*
*/
void Today::refresh() {
init();
- // qDebug(" refresh ");
- // set the date in top label
- QDate date = QDate::currentDate();
- QString time = ( tr( date.toString() ) );
-
- DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
-
- if ( layout ) {
- delete layout;
+ QValueList<TodayPlugin>::Iterator it;
+ for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
+ if ( !(*it).excludeRefresh ) {
+ (*it).guiPart->refresh();
+ qDebug( "refresh" );
+ }
}
- layout = new QVBoxLayout( this );
- layout->addWidget( Frame );
- layout->addWidget( OwnerField );
-
- loadPlugins();
- draw();
}
void Today::startApplication() {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << QString( sender()->name() );
}
/**
* launch addressbook (personal card)
*/
void Today::editCard() {
QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" );