author | harlekin <harlekin> | 2002-09-18 09:52:51 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-18 09:52:51 (UTC) |
commit | 15ecc4aa71878039ad40ce270fae06282d8e98c2 (patch) (side-by-side diff) | |
tree | 1b1cae7b89bdd3960da222542e99c05332610231 /core/pim/today | |
parent | 01d31aeaa8d513bde8237a07ea0a48ac1b85c3c0 (diff) | |
download | opie-15ecc4aa71878039ad40ce270fae06282d8e98c2.zip opie-15ecc4aa71878039ad40ce270fae06282d8e98c2.tar.gz opie-15ecc4aa71878039ad40ce270fae06282d8e98c2.tar.bz2 |
reload plugins now on config change
-rw-r--r-- | core/pim/today/plugins/datebook/datebookevent.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.cpp | 6 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 54 | ||||
-rw-r--r-- | core/pim/today/today.h | 7 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 6 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 2 |
6 files changed, 31 insertions, 48 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index 1caf061..d4e8e1e 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp @@ -30,6 +30,8 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, WFlags fl) : OClickableLabel(parent,name,fl), event(ev) { + setAlignment( AlignTop ); + QString msg; Config config( "qpe" ); @@ -90,8 +92,6 @@ QString DateBookEvent::ampmTime( QTime tm ) { } -//extern QPEApplication *todayApp; - /* * starts the edit dialog as known from datebook */ diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index e4667ae..7948656 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -59,6 +59,8 @@ void DatebookPluginWidget::getDates() { QDate date = QDate::currentDate(); QVBoxLayout* layoutDates = new QVBoxLayout( this ); + layoutDates->setSpacing( 1 ); + layoutDates->setMargin( 1 ); if ( db ) { delete db; @@ -105,8 +107,8 @@ void DatebookPluginWidget::getDates() { noEvents->setText( QObject::tr( "No appointments today" ) ); layoutDates->addWidget( noEvents ); } - - layoutDates->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + //layoutDates->addStretch(0); +// layoutDates->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); // how often refresh - later have qcop update calls in *db //QTimer::singleShot( 20*1000, this , SLOT( getDates() ) ); diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index f052a9f..7537631 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -64,9 +64,7 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) #endif setOwnerField(); - init(); - loadPlugins(); - draw(); + refresh(); showMaximized(); } @@ -118,7 +116,6 @@ void Today::init() { // read config Config cfg( "today" ); - cfg.setGroup( "Applets" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); } @@ -136,13 +133,13 @@ void Today::loadPlugins() { } pluginList.clear(); + QString path = QPEApplication::qpeDir() + "/plugins/today"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; - uint count = 0; for ( it = list.begin(); it != list.end(); ++it ) { TodayPluginInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); @@ -156,6 +153,7 @@ void Today::loadPlugins() { plugin.iface = iface; plugin.name = QString(*it); + // find out if plugins should be shown if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; } else { @@ -176,7 +174,6 @@ void Today::loadPlugins() { QScrollView* sv = new QScrollView( plugin.guiBox ); QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); sv->setMinimumHeight( plugin.guiPart->minHeight() ); - //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setHScrollBarMode( QScrollView::AlwaysOff ); sv->setFrameShape( QFrame::NoFrame ); @@ -190,7 +187,6 @@ void Today::loadPlugins() { layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); - count++; } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; @@ -231,8 +227,8 @@ void Today::draw() { noPluginsActive->setText( tr( "No plugins activated" ) ); layout->addWidget( noPluginsActive ); } - - layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + //layout->addStretch(0); + //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); } @@ -244,7 +240,6 @@ void Today::startConfig() { TodayConfig conf( this, "dialog", true ); TodayPlugin plugin; - QList<ConfigWidget> configWidgetList; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; @@ -267,29 +262,28 @@ void Today::startConfig() { confWidget = configWidgetList.next() ) { confWidget->writeConfig(); } + refresh(); + } +} - init(); - TodayPlugin plugin; - QValueList<TodayPlugin> plugList; - for ( uint i = 0; i < pluginList.count(); i++ ) { - plugin = pluginList[i]; +/** + * Refresh for the view. Reload all applets + * + */ +void Today::refresh() { + init(); - if ( m_excludeApplets.grep( plugin.name ).isEmpty() ) { - qDebug("CONFIG " + plugin.name + " ACTIVE"); - plugin.active = true; - } else { - qDebug("CONFIG " + plugin.name + " INACTIVE"); - plugin.active = false; + if ( layout ) { + delete layout; } - plugList.append( plugin ); - } - pluginList = plugList; + layout = new QVBoxLayout( this ); + layout->addWidget( Frame ); + layout->addWidget( OwnerField ); + loadPlugins(); draw(); } -} - void Today::startAddressbook() { QCopEnvelope e( "QPE/System", "execute(QString)" ); @@ -308,14 +302,6 @@ void Today::editCard() { QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); } -/* - * launches an App - */ -void Today::launchApp( QString appName ) { - QCopEnvelope e( "QPE/System", "execute(QString)" ); - e << QString( appName ); -} - Today::~Today() { } diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 0a9a705..672adc4 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h @@ -45,15 +45,16 @@ class Today : public TodayBase { private slots: void startConfig(); void startAddressbook(); - void launchApp( QString appName ); void editCard(); - void draw(); + void refresh(); private: void init(); void setOwnerField(); void setOwnerField(QString &string); void loadPlugins(); + void draw(); + private slots: void channelReceived(const QCString &msg, const QByteArray & data); @@ -62,8 +63,6 @@ private slots: TodayConfig *conf; QStringList m_excludeApplets; - QVBoxLayout *pluginLayout; - // QString m_autoStartTimer; int m_newStart; // int m_autoStart; diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index 74f4fa0..800ca5d 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp @@ -34,6 +34,8 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) layout = new QVBoxLayout( this ); + QVBoxLayout *mainLayout = new QVBoxLayout( this ); + QPalette pal = this->palette(); QColor col = pal.color( QPalette::Active, QColorGroup::Background ); pal.setColor( QPalette::Active, QColorGroup::Button, col ); @@ -93,10 +95,6 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 30, 25, 21 ) ); ConfigButton->setPixmap( config ); ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); - - // -- layout -- - layout->addWidget( Frame ); - layout->addWidget( OwnerField ); } /** diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 79c4d1f..4f23471 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp @@ -57,8 +57,6 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags QVBoxLayout *layout = new QVBoxLayout( this ); TabWidget3 = new QTabWidget( this, "TabWidget3" ); - // TabWidget3->setFrameShape( QFrame::NoFrame ); - //TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); TabWidget3->setAutoMask( FALSE ); TabWidget3->setTabShape( QTabWidget::Rounded ); layout->addWidget( TabWidget3 ); |