summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/today.cpp54
1 files changed, 20 insertions, 34 deletions
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
@@ -61,15 +61,13 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
#endif
#endif
setOwnerField();
- init();
- loadPlugins();
- draw();
+ refresh();
showMaximized();
}
/**
* Qcop receive method.
*/
@@ -115,13 +113,12 @@ void Today::init() {
QString time = ( tr( date.toString() ) );
DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
// read config
Config cfg( "today" );
-
cfg.setGroup( "Applets" );
m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
}
/**
@@ -133,19 +130,19 @@ void Today::loadPlugins() {
for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
(*tit).library->unload();
delete (*tit).library;
}
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 );
qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
@@ -153,12 +150,13 @@ void Today::loadPlugins() {
qDebug( QString(*it) );
TodayPlugin plugin;
plugin.library = lib;
plugin.iface = iface;
plugin.name = QString(*it);
+ // find out if plugins should be shown
if ( m_excludeApplets.grep( *it ).isEmpty() ) {
plugin.active = true;
} else {
plugin.active = false;
}
plugin.guiPart = plugin.iface->guiPart();
@@ -173,13 +171,12 @@ void Today::loadPlugins() {
plugIcon->setPixmap( plugPix );
// a scrollview for each plugin
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 );
sv->addChild( plugWidget );
// make sure the icon is on the top alligned
@@ -187,13 +184,12 @@ void Today::loadPlugins() {
boxLayout->addWidget( sv, 0, AlignTop );
boxLayout->setStretchFactor( plugIcon, 1 );
boxLayout->setStretchFactor( sv, 9 );
layout->addWidget( plugin.guiBox );
pluginList.append( plugin );
- count++;
} else {
qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
delete lib;
}
}
}
@@ -228,26 +224,25 @@ void Today::draw() {
if ( count == 0 ) {
QLabel *noPluginsActive = new QLabel( this );
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 ) );
}
/**
* The method for the configuration dialog.
*/
void Today::startConfig() {
TodayConfig conf( this, "dialog", true );
TodayPlugin plugin;
-
QList<ConfigWidget> configWidgetList;
for ( uint i = 0; i < pluginList.count(); i++ ) {
plugin = pluginList[i];
// load the config widgets in the tabs
if ( plugin.guiPart->configWidget( this ) != 0l ) {
@@ -264,35 +259,34 @@ void Today::startConfig() {
conf.writeConfig();
ConfigWidget *confWidget;
for ( confWidget = configWidgetList.first(); confWidget != 0;
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)" );
e << QString( "addressbook" );
}
@@ -305,17 +299,9 @@ void Today::editCard() {
while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) {
qApp->processEvents();
}
QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" );
}
-/*
- * launches an App
- */
-void Today::launchApp( QString appName ) {
- QCopEnvelope e( "QPE/System", "execute(QString)" );
- e << QString( appName );
-}
-
Today::~Today() {
}