author | harlekin <harlekin> | 2002-09-22 22:29:34 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-22 22:29:34 (UTC) |
commit | a26d188b7b91f9bdce1e6a44c40ce874cd50abde (patch) (side-by-side diff) | |
tree | 26a7efeca0a0778d3a96f876cb030dd414a177be | |
parent | e49230a12104b718c46a34c81b6c0e608c9d40be (diff) | |
download | opie-a26d188b7b91f9bdce1e6a44c40ce874cd50abde.zip opie-a26d188b7b91f9bdce1e6a44c40ce874cd50abde.tar.gz opie-a26d188b7b91f9bdce1e6a44c40ce874cd50abde.tar.bz2 |
interface updates
-rw-r--r-- | core/pim/today/configwidget.h | 17 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.cpp | 10 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.h | 4 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginconfig.cpp | 2 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginconfig.h | 6 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.cpp | 11 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.h | 7 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.cpp | 9 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 5 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginconfig.cpp | 2 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginconfig.h | 4 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 11 | ||||
-rw-r--r-- | core/pim/today/todayconfigwidget.h | 21 | ||||
-rw-r--r-- | core/pim/today/todayplugininterface.h | 13 |
14 files changed, 49 insertions, 73 deletions
diff --git a/core/pim/today/configwidget.h b/core/pim/today/configwidget.h deleted file mode 100644 index 02ce37a..0000000 --- a/core/pim/today/configwidget.h +++ b/dev/null @@ -1,17 +0,0 @@ - -#ifndef CONFIG_WIDGET_H -#define CONFIG_WIDGET_H - - -class ConfigWidget : public QWidget { - - -public: - - ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; - virtual ~ConfigWidget() {}; - - virtual void writeConfig() = 0; -}; - -#endif diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp index a1721f6..4ebb178 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.cpp +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp @@ -1,67 +1,59 @@ /* * datebookplugin.cpp * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "datebookevent.h" #include "datebookplugin.h" #include "datebookpluginwidget.h" #include "datebookpluginconfig.h" DatebookPlugin::DatebookPlugin() { } DatebookPlugin::~DatebookPlugin() { } QString DatebookPlugin::pluginName() const { return "Datebook plugin"; } double DatebookPlugin::versionNumber() const { return 1.0; } QString DatebookPlugin::pixmapNameWidget() const { return "DateBook"; } QWidget* DatebookPlugin::widget( QWidget* wid ) { return new DatebookPluginWidget( wid, "Datebook" ); } QString DatebookPlugin::pixmapNameConfig() const { return "DateBook"; } -ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { +TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { return new DatebookPluginConfig( wid , "Datebook" ); } QString DatebookPlugin::appName() const { return QObject::tr( "Datebook" ); } -int DatebookPlugin::minHeight() const { - return 10; -} - -int DatebookPlugin::maxHeight() const { - return 100; -} - diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h index 61dc9f3..625c7cd 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.h +++ b/core/pim/today/plugins/datebook/datebookplugin.h @@ -1,46 +1,44 @@ /* * datebookplugin.h * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef DATEBOOK_PLUGIN_H #define DATEBOOK_PLUGIN_H #include <qstring.h> #include <qwidget.h> #include <opie/oclickablelabel.h> #include "../../todayplugininterface.h" class DatebookPlugin : public TodayPluginObject { public: DatebookPlugin(); ~DatebookPlugin(); QString pluginName() const; double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget( QWidget *); QString pixmapNameConfig() const; - ConfigWidget* configWidget( QWidget *); + TodayConfigWidget* configWidget( QWidget *); QString appName() const; - virtual int minHeight() const; - virtual int maxHeight() const; }; #endif diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp index 0f60c28..606916b 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp @@ -1,78 +1,78 @@ #include "datebookpluginconfig.h" #include <qpe/config.h> #include <qlayout.h> #include <qtoolbutton.h> #include <qlabel.h> #include <qhbox.h> #include <qvbox.h> DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) - : ConfigWidget( parent, name ) { + : TodayConfigWidget( parent, name ) { QVBoxLayout * layout = new QVBoxLayout( this ); layout->setMargin( 20 ); QHBox *box1 = new QHBox( this ); QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" ); TextLabel4->setText( tr( "Show location" ) ); CheckBox1 = new QCheckBox( box1, "CheckBox1" ); QHBox *box2 = new QHBox( this ); QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" ); TextLabel5->setText( tr( "Show notes" ) ); CheckBox2 = new QCheckBox( box2, "CheckBox2" ); QHBox *box3 = new QHBox( this ); QLabel* TextLabel6 = new QLabel( box3, "All Day"); TextLabel6->setText( tr( "Show only later\n appointments") ); CheckBox3 = new QCheckBox ( box3, "CheckBox3" ); QHBox *box4 = new QHBox( this ); QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" ); TextLabel3->setText( tr( "How many \nappointment\n" "should be \nshown?" ) ); SpinBox1 = new QSpinBox( box4, "SpinBox1" ); SpinBox1->setMaxValue( 10 ); SpinBox1->setValue( 5 ); layout->addWidget( box1 ); layout->addWidget( box2 ); layout->addWidget( box3 ); layout->addWidget( box4 ); readConfig(); } void DatebookPluginConfig::readConfig() { Config cfg( "todaydatebookplugin" ); cfg.setGroup( "config" ); m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); SpinBox1->setValue( m_max_lines_meet ); m_show_location = cfg.readNumEntry( "showlocation", 1 ); CheckBox1->setChecked( m_show_location ); m_show_notes = cfg.readNumEntry( "shownotes", 0 ); CheckBox2->setChecked( m_show_notes ); m_only_later = cfg.readNumEntry( "onlylater", 1 ); CheckBox3->setChecked( m_only_later ); } void DatebookPluginConfig::writeConfig() { Config cfg( "todaydatebookplugin" ); cfg.setGroup( "config" ); m_max_lines_meet = SpinBox1->value(); cfg.writeEntry( "maxlinesmeet", m_max_lines_meet); m_show_location = CheckBox1->isChecked(); cfg.writeEntry( "showlocation", m_show_location); m_show_notes = CheckBox2->isChecked(); cfg.writeEntry( "shownotes", m_show_notes ); m_only_later = CheckBox3->isChecked(); cfg.writeEntry( "onlylater", m_only_later ); cfg.write(); } diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h index 9505a2d..99aa76c 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.h +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h @@ -1,48 +1,48 @@ #ifndef DATEBOOK_PLUGIN_CONFIG_H #define DATEBOOK_PLUGIN_CONFIG_H -//#include <qwidget.h> + #include <qcheckbox.h> #include <qspinbox.h> -#include "../../configwidget.h" +#include "../../todayconfigwidget.h" -class DatebookPluginConfig : public ConfigWidget { +class DatebookPluginConfig : public TodayConfigWidget { public: DatebookPluginConfig( QWidget *parent, const char *name ); ~DatebookPluginConfig(); void writeConfig(); private: /** * if changed then save */ bool changed(); void readConfig(); QCheckBox* CheckBox2; QCheckBox* CheckBox1; QCheckBox* CheckBox3; QSpinBox* SpinBox1; // how many lines should be showed in the datebook section int m_max_lines_meet; // If location is to be showed too, 1 to activate it. int m_show_location; // if notes should be shown int m_show_notes; // should only later appointments be shown or all for the current day. int m_only_later; }; #endif diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp index 4241228..3ddf16e 100644 --- a/core/pim/today/plugins/mail/mailplugin.cpp +++ b/core/pim/today/plugins/mail/mailplugin.cpp @@ -1,63 +1,56 @@ /* * mailplugin.cpp * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "mailplugin.h" #include "mailpluginwidget.h" MailPlugin::MailPlugin() { } MailPlugin::~MailPlugin() { } QString MailPlugin::pluginName() const { return "Mail plugin"; } double MailPlugin::versionNumber() const { - return 0.1; + return 0.5; } QString MailPlugin::pixmapNameWidget() const { return "mail/desktopicon"; } QWidget* MailPlugin::widget( QWidget * wid ) { return new MailPluginWidget( wid, "Mail" ); } QString MailPlugin::pixmapNameConfig() const { return 0l; } -ConfigWidget* MailPlugin::configWidget( QWidget* wid ) { +TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) { return 0l; } QString MailPlugin::appName() const { return "Mail"; } -int MailPlugin::minHeight() const { - return 10; -} - -int MailPlugin::maxHeight() const { - return 10; -} diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h index 96c73ed..a27f4c7 100644 --- a/core/pim/today/plugins/mail/mailplugin.h +++ b/core/pim/today/plugins/mail/mailplugin.h @@ -1,48 +1,47 @@ /* * mailplugin.h * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef MAIL_PLUGIN_H #define MAIL_PLUGIN_H #include <qstring.h> #include <qwidget.h> #include <opie/tododb.h> #include <opie/oclickablelabel.h> #include "../../todayplugininterface.h" -#include "../../configwidget.h" +#include "../../todayconfigwidget.h" class MailPlugin : public TodayPluginObject { public: MailPlugin(); ~MailPlugin(); QString pluginName() const; double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget(QWidget *); QString pixmapNameConfig() const; - ConfigWidget* configWidget(QWidget *); + TodayConfigWidget* configWidget(QWidget *); QString appName() const; - virtual int minHeight() const; - virtual int maxHeight() const; + }; #endif diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp index 7ab27a0..19d9f37 100644 --- a/core/pim/today/plugins/todolist/todoplugin.cpp +++ b/core/pim/today/plugins/todolist/todoplugin.cpp @@ -1,65 +1,58 @@ /* * todoplugin.cpp * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "todoplugin.h" #include "todopluginconfig.h" #include "todopluginwidget.h" TodolistPlugin::TodolistPlugin() { } TodolistPlugin::~TodolistPlugin() { } QString TodolistPlugin::pluginName() const { return "Todolist plugin"; } double TodolistPlugin::versionNumber() const { return 0.7; } QString TodolistPlugin::pixmapNameWidget() const { return "TodoList"; } QWidget* TodolistPlugin::widget( QWidget *wid ) { return new TodolistPluginWidget( wid, "Todolist" ); } QString TodolistPlugin::pixmapNameConfig() const { return "TodoList"; } -ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { +TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { return new TodolistPluginConfig( wid , "Todolist" ); } QString TodolistPlugin::appName() const { return QObject::tr( "Todolist" ); } -int TodolistPlugin::minHeight() const { - return 10; -} - -int TodolistPlugin::maxHeight() const { - return 100; -} diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h index 7e5006f..2c03389 100644 --- a/core/pim/today/plugins/todolist/todoplugin.h +++ b/core/pim/today/plugins/todolist/todoplugin.h @@ -1,45 +1,44 @@ /* * todoplugin.h * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TODOLIST_PLUGIN_H #define TODOLIST_PLUGIN_H #include <qstring.h> #include <qwidget.h> #include <opie/tododb.h> #include <opie/oclickablelabel.h> #include "../../todayplugininterface.h" class TodolistPlugin : public TodayPluginObject { public: TodolistPlugin(); ~TodolistPlugin(); QString pluginName() const; double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget(QWidget *); QString pixmapNameConfig() const; - ConfigWidget* configWidget(QWidget *); + TodayConfigWidget* configWidget(QWidget *); QString appName() const; - virtual int minHeight() const; - virtual int maxHeight() const; + }; #endif diff --git a/core/pim/today/plugins/todolist/todopluginconfig.cpp b/core/pim/today/plugins/todolist/todopluginconfig.cpp index 69ad727..110b2e0 100644 --- a/core/pim/today/plugins/todolist/todopluginconfig.cpp +++ b/core/pim/today/plugins/todolist/todopluginconfig.cpp @@ -1,79 +1,79 @@ /* * todopluginconfig.cpp * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "todopluginconfig.h" #include <qpe/config.h> #include <qlayout.h> #include <qhbox.h> #include <qtoolbutton.h> #include <qlabel.h> TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) - : ConfigWidget(parent, name ) { + : TodayConfigWidget(parent, name ) { QVBoxLayout * layout = new QVBoxLayout( this ); layout->setMargin( 20 ); QHBox *box1 = new QHBox( this ); QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); TextLabel6->setText( tr( "How many\n tasks should \n" "be shown?" ) ); SpinBox2 = new QSpinBox( box1, "SpinBox2" ); SpinBox2->setMaxValue( 40 ); QHBox *box2 = new QHBox( this ); QLabel* clipLabel = new QLabel( box2, "" ); clipLabel->setText( tr( "Clip line after\n X chars" ) ); SpinBoxClip = new QSpinBox( box2, "SpinClip" ); SpinBoxClip->setMaxValue( 200 ); layout->addWidget( box1 ); layout->addWidget( box2 ); readConfig(); } void TodolistPluginConfig::readConfig() { Config cfg( "todaytodoplugin" ); cfg.setGroup( "config" ); m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); SpinBox2->setValue( m_max_lines_task ); m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); SpinBoxClip->setValue( m_maxCharClip ); } void TodolistPluginConfig::writeConfig() { Config cfg( "todaytodoplugin" ); cfg.setGroup( "config" ); m_max_lines_task = SpinBox2->value(); cfg.writeEntry( "maxlinestask", m_max_lines_task ); m_maxCharClip = SpinBoxClip->value(); cfg.writeEntry( "maxcharclip", m_maxCharClip ); cfg.write(); } TodolistPluginConfig::~TodolistPluginConfig() { } diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h index 934b319..26557d5 100644 --- a/core/pim/today/plugins/todolist/todopluginconfig.h +++ b/core/pim/today/plugins/todolist/todopluginconfig.h @@ -1,57 +1,57 @@ /* * todopluginconfig.h * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TODOLIST_PLUGIN_CONFIG_H #define TODOLIST_PLUGIN_CONFIG_H #include <qwidget.h> #include <qspinbox.h> -#include "../../configwidget.h" +#include "../../todayconfigwidget.h" -class TodolistPluginConfig : public ConfigWidget { +class TodolistPluginConfig : public TodayConfigWidget { public: TodolistPluginConfig( QWidget *parent, const char *name ); ~TodolistPluginConfig(); private: /** * if changed then save */ bool changed(); void readConfig(); void writeConfig(); QSpinBox* SpinBox2; QSpinBox* SpinBoxClip; // how many lines should be showed in the todolist section int m_max_lines_task; // clip the lines after X chars int m_maxCharClip; }; #endif diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 7673df5..f5f88f8 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -1,83 +1,83 @@ /* * today.cpp * * copyright : (c) 2002 by Maximilian Reiß * email : harlekin@handhelds.org * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "today.h" -#include "configwidget.h" +#include "todayconfigwidget.h" #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/contact.h> #include <qdir.h> #include <qfile.h> #include <qpushbutton.h> #include <qlabel.h> #include <qtimer.h> #include <qpixmap.h> #include <qlayout.h> #include <qhbox.h> #include <opie/otabwidget.h> #include <qdialog.h> struct TodayPlugin { QLibrary *library; TodayPluginInterface *iface; TodayPluginObject *guiPart; QWidget *guiBox; QString name; bool active; int pos; }; static QValueList<TodayPlugin> pluginList; Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl ) { QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); #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(); refresh(); 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 ); } } /** @@ -108,219 +108,220 @@ 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", ',' ); } /** * 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; 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(); // 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 ); OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 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() ); + // 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 ); boxLayout->setStretchFactor( plugIcon, 1 ); boxLayout->setStretchFactor( sv, 9 ); // "prebuffer" it in one more list, to get the sorting done tempList.insert( plugin.name, plugin ); // on first start the list is off course empty if ( m_allApplets.isEmpty() ) { layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); } } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; } } 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 ); } } } } /** * 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 ); return; } uint count = 0; TodayPlugin plugin; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; if ( plugin.active ) { // qDebug( plugin.name + " is ACTIVE " ); plugin.guiBox->show(); } else { // qDebug( plugin.name + " is INACTIVE" ); plugin.guiBox->hide(); } count++; } if ( count == 0 ) { QLabel *noPluginsActive = new QLabel( this ); noPluginsActive->setText( tr( "No plugins activated" ) ); layout->addWidget( noPluginsActive ); } layout->addStretch(0); } /** * The method for the configuration dialog. */ void Today::startConfig() { TodayConfig conf( this, "dialog", true ); TodayPlugin plugin; - QList<ConfigWidget> configWidgetList; + 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 ) { - ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); + TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); configWidgetList.append( widget ); conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() , plugin.guiPart->appName() ); } // set the order/activate tab conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); } if ( conf.exec() == QDialog::Accepted ) { conf.writeConfig(); - ConfigWidget *confWidget; + TodayConfigWidget *confWidget; for ( confWidget = configWidgetList.first(); confWidget != 0; confWidget = configWidgetList.next() ) { confWidget->writeConfig(); } refresh(); } } /** * Refresh for the view. Reload all applets * */ void Today::refresh() { init(); // 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 ); loadPlugins(); draw(); } void Today::startAddressbook() { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( "addressbook" ); } /** * launch addressbook (personal card) */ void Today::editCard() { startAddressbook(); while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { qApp->processEvents(); } QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); } Today::~Today() { } diff --git a/core/pim/today/todayconfigwidget.h b/core/pim/today/todayconfigwidget.h new file mode 100644 index 0000000..48cf379 --- a/dev/null +++ b/core/pim/today/todayconfigwidget.h @@ -0,0 +1,21 @@ + +#ifndef CONFIG_WIDGET_H +#define CONFIG_WIDGET_H + + +class TodayConfigWidget : public QWidget { + + +public: + + TodayConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; + virtual ~TodayConfigWidget() {}; + + /** + * Plugins need to reimplement this in the config widget + * Used when the config dialog is closed to write config stuff + */ + virtual void writeConfig() = 0; +}; + +#endif diff --git a/core/pim/today/todayplugininterface.h b/core/pim/today/todayplugininterface.h index 01e7d58..becb79c 100644 --- a/core/pim/today/todayplugininterface.h +++ b/core/pim/today/todayplugininterface.h @@ -1,82 +1,79 @@ #ifndef TODAY_PLUGIN_INTERFACE #define TODAY_PLUGIN_INTERFACE #include <qpe/qcom.h> -#include "configwidget.h" +#include "todayconfigwidget.h" class QString; class QWidget; #ifndef IID_TodayPluginInterface #define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) #endif /** * * * */ class TodayPluginObject { Q_OBJECT public: virtual ~TodayPluginObject() {}; /** * The name if the plugin */ virtual QString pluginName() const = 0; /** * Version numbering */ virtual double versionNumber() const = 0; - /** - * the path and name of the identifer icon that should be shown - * in "Resource" notation, that means only subdir/picname form $QPEDIR/pics - */ + virtual QString pixmapNameWidget() const = 0; /** widget for the today view * It _needs_ a parent here. */ virtual QWidget* widget( QWidget * ) = 0; /** * Pixmap used in the config widget */ virtual QString pixmapNameConfig() const = 0; /** * Config plugin widget - optional * If the plugin has a config widget, it _needs_ a parent here. */ - virtual ConfigWidget* configWidget( QWidget * ) = 0; + virtual TodayConfigWidget* configWidget( QWidget * ) = 0; /** * The application that should be assigned to the button (pixmap) */ virtual QString appName() const = 0; /** * minimum height the plugin at least should have */ - virtual int minHeight() const = 0; + // virtual int minHeight() const = 0; /** * maximum height that should be used before starting scrolling */ - virtual int maxHeight() const = 0; + // virtual int maxHeight() const = 0; }; struct TodayPluginInterface : public QUnknownInterface { virtual TodayPluginObject *guiPart() = 0; }; #endif |