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.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 35758d5..34ec3cb 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -105,46 +105,47 @@ void Today::setOwnerField( QString &message ) {
/**
* Init stuff needed for today. Reads the config file.
*/
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 );
}
/**
* Load the plugins
*/
void Today::loadPlugins() {
QValueList<TodayPlugin>::Iterator tit;
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;
-
QMap<QString, TodayPlugin> tempList;
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 ) {
qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
qDebug( QString(*it) );
TodayPlugin plugin;
plugin.library = lib;
@@ -154,27 +155,29 @@ void Today::loadPlugins() {
// 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();
// package the whole thing into a qwidget so it can be shown and hidden
plugin.guiBox = new QWidget( this );
QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
QPixmap plugPix;
- plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
+ plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 );
OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
plugIcon->setPixmap( plugPix );
+ plugIcon->setName( plugin.guiPart->appName() );
+ 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( 10 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setHScrollBarMode( QScrollView::AlwaysOff );
sv->setFrameShape( QFrame::NoFrame );
sv->addChild( plugWidget );
// make sure the icon is on the top alligned
boxLayout->addWidget( plugIcon, 0, AlignTop );
boxLayout->addWidget( sv, 0, AlignTop );
@@ -242,25 +245,25 @@ void Today::draw() {
}
layout->addStretch(0);
}
/**
* The method for the configuration dialog.
*/
void Today::startConfig() {
TodayConfig conf( this, "dialog", true );
- TodayPlugin plugin;
+ TodayPlugin plugin;
QList<TodayConfigWidget> configWidgetList;
for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) {
plugin = pluginList[i];
// load the config widgets in the tabs
if ( plugin.guiPart->configWidget( this ) != 0l ) {
TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
configWidgetList.append( widget );
conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
, plugin.guiPart->appName() );
}
@@ -302,24 +305,29 @@ void Today::refresh() {
layout->addWidget( OwnerField );
loadPlugins();
draw();
}
void Today::startAddressbook() {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << QString( "addressbook" );
}
+void Today::startApplication() {
+ QCopEnvelope e( "QPE/System", "execute(QString)" );
+ e << QString( sender()->name() );
+}
+
/**
* launch addressbook (personal card)
*/
void Today::editCard() {
startAddressbook();
while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) {
qApp->processEvents();
}
QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" );
}
Today::~Today() {