summaryrefslogtreecommitdiff
authorwaspe <waspe>2003-11-04 16:41:07 (UTC)
committer waspe <waspe>2003-11-04 16:41:07 (UTC)
commitda5c9b06fe0081050ab8165cf3d189dbc8117bf6 (patch) (side-by-side diff)
tree30dd36ad48413c39aa348ff5a49e130ef6ee2e4e
parentefcd8d6a743261194b55df3afeec956fde9886d4 (diff)
downloadopie-da5c9b06fe0081050ab8165cf3d189dbc8117bf6.zip
opie-da5c9b06fe0081050ab8165cf3d189dbc8117bf6.tar.gz
opie-da5c9b06fe0081050ab8165cf3d189dbc8117bf6.tar.bz2
resolved merge conflict
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp152
1 files changed, 114 insertions, 38 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index cb18c1c..dd8d59b 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -50,2 +50,4 @@ static QValueList<TodayPlugin> pluginList;
+static QMap<QString, TodayPlugin> tempList;
+
Today::Today( QWidget* parent, const char* name, WFlags fl )
@@ -68,3 +70,18 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
m_refreshTimer->start( 15000 );
- //init();
+ m_big_box = 0L;
+
+
+ layout = new QVBoxLayout( this );
+ layout->addWidget( Frame );
+ layout->addWidget( OwnerField );
+
+ m_sv = new QScrollView( this );
+ m_sv->setResizePolicy( QScrollView::AutoOneFit );
+ m_sv->setHScrollBarMode( QScrollView::AlwaysOff );
+ m_sv->setFrameShape( QFrame::NoFrame );
+
+ layout->addWidget( m_sv );
+ layout->setStretchFactor( m_sv,4 );
+
+ qApp->processEvents();
loadPlugins();
@@ -134,3 +151,3 @@ void Today::init() {
m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
- setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
+ setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
@@ -138,7 +155,3 @@ void Today::init() {
QDate date = QDate::currentDate();
- DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
-
- if ( layout ) {
- delete layout;
- }
+ DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
@@ -152,5 +165,9 @@ void Today::init() {
- layout = new QVBoxLayout( this );
- layout->addWidget( Frame );
- layout->addWidget( OwnerField );
+ 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 );
}
@@ -163,2 +180,3 @@ void Today::loadPlugins() {
init();
+
QValueList<TodayPlugin>::Iterator tit;
@@ -186,5 +204,3 @@ void Today::loadPlugins() {
- qWarning("Found: %d entries !", list.count() );
-
- QMap<QString, TodayPlugin> tempList;
+ // QMap<QString, TodayPlugin> tempList;
@@ -224,2 +240,3 @@ void Today::loadPlugins() {
+
// find out if plugins should be shown
@@ -235,3 +252,3 @@ void Today::loadPlugins() {
// package the whole thing into a qwidget so it can be shown and hidden
- plugin.guiBox = new QWidget( this );
+ plugin.guiBox = new QWidget( m_big_box );
QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
@@ -244,17 +261,10 @@ void Today::loadPlugins() {
connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) );
- // a scrollview for each plugin
- QScrollView* sv = new QScrollView( plugin.guiBox );
- QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
- // not sure if that is good .-)
- sv->setMinimumHeight( 12 );
- sv->setResizePolicy( QScrollView::AutoOneFit );
- sv->setHScrollBarMode( QScrollView::AlwaysOff );
- sv->setFrameShape( QFrame::NoFrame );
- sv->addChild( plugWidget );
- // make sure the icon is on the top alligned
+
+ QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox );
boxLayout->addWidget( plugIcon, 0, AlignTop );
- boxLayout->addWidget( sv, 0, AlignTop );
+ boxLayout->addWidget( plugWidget, 0, AlignTop );
boxLayout->setStretchFactor( plugIcon, 1 );
- boxLayout->setStretchFactor( sv, 9 );
- // "prebuffer" it in one more list, to get the sorting done
+ boxLayout->setStretchFactor( plugWidget, 9 );
+
+ // "prebuffer" it in one more list, to get the sorting done
tempList.insert( plugin.name, plugin );
@@ -263,4 +273,4 @@ void Today::loadPlugins() {
if ( m_allApplets.isEmpty() ) {
- layout->addWidget( plugin.guiBox );
pluginList.append( plugin );
+ m_bblayout->addWidget( plugin.guiBox );
}
@@ -269,3 +279,2 @@ void Today::loadPlugins() {
else if ( !m_allApplets.contains( plugin.name ) ) {
- layout->addWidget( plugin.guiBox );
pluginList.append( plugin );
@@ -276,4 +285,6 @@ void Today::loadPlugins() {
}
+
}
+
if ( !m_allApplets.isEmpty() ) {
@@ -285,4 +296,4 @@ void Today::loadPlugins() {
if ( !( (tempPlugin.name).isEmpty() ) ) {
- layout->addWidget( tempPlugin.guiBox );
pluginList.append( tempPlugin );
+ m_bblayout->addWidget( tempPlugin.guiBox );
}
@@ -290,2 +301,3 @@ void Today::loadPlugins() {
}
+ m_bblayout->addStretch( 2 );
draw();
@@ -294,2 +306,4 @@ void Today::loadPlugins() {
+
+
/**
@@ -326,3 +340,3 @@ void Today::draw() {
}
- layout->addStretch(0);
+ repaint();
}
@@ -366,7 +380,11 @@ void Today::startConfig() {
}
- loadPlugins();
+
+ // make the plugins to reinitialize ( reread its configs )
+ reinitialize();
+ draw();
+
} else {
// since refresh is not called in that case , reconnect the signal
- m_refreshTimer->start( 15000 ); // get the config value in here later
- connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
+ m_refreshTimer->start( 15000 ); // get the config value in here later
+ connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
}
@@ -375,2 +393,59 @@ void Today::startConfig() {
+
+void Today::reinitialize() {
+
+ Config cfg( "today" );
+ cfg.setGroup( "Plugins" );
+ m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
+ m_allApplets = cfg.readListEntry( "AllApplets", ',' );
+
+ /* reinitialize all plugins */
+ QValueList<TodayPlugin>::Iterator it;
+ for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
+ if ( !(*it).excludeRefresh ) {
+ (*it).guiPart->reinitialize();
+ qDebug( "reinit" );
+ }
+
+ /* check if plugins is still to be shown */
+ if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) {
+ (*it).active = true;
+ } else {
+ (*it).active = false;
+ }
+
+ }
+
+ 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();
+ }
+
+ delete m_bblayout;
+ m_bblayout = new QVBoxLayout( m_big_box );
+ TodayPlugin tempPlugin;
+ QStringList::Iterator stringit;
+
+ for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
+ tempPlugin = ( tempList.find( *stringit ) ).data();
+ if ( !( (tempPlugin.name).isEmpty() ) ) {
+ m_bblayout->addWidget( tempPlugin.guiBox );
+ }
+ }
+ m_bblayout->addStretch( 2 );
+
+}
+
/**
@@ -381,4 +456,2 @@ void Today::refresh() {
- init();
-
QValueList<TodayPlugin>::Iterator it;
@@ -387,3 +460,2 @@ void Today::refresh() {
(*it).guiPart->refresh();
- layout->addWidget( (*it).guiBox );
qDebug( "refresh" );
@@ -391,3 +463,7 @@ void Today::refresh() {
}
- layout->addStretch(0);
+
+ DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) );
+
+ updateGeometry();
+ repaint();
}