summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/configwidget.h17
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp10
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h4
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp2
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h6
-rw-r--r--core/pim/today/plugins/mail/mailplugin.cpp11
-rw-r--r--core/pim/today/plugins/mail/mailplugin.h7
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp9
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h5
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.cpp2
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.h4
-rw-r--r--core/pim/today/today.cpp11
-rw-r--r--core/pim/today/todayconfigwidget.h21
-rw-r--r--core/pim/today/todayplugininterface.h13
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 @@
1
2#ifndef CONFIG_WIDGET_H
3#define CONFIG_WIDGET_H
4
5
6class ConfigWidget : public QWidget {
7
8
9public:
10
11 ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ;
12 virtual ~ConfigWidget() {};
13
14 virtual void writeConfig() = 0;
15};
16
17#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 @@
1 1
2/* 2/*
3 * datebookplugin.cpp 3 * datebookplugin.cpp
4 * 4 *
5 * copyright : (c) 2002 by Maximilian Reiß 5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : harlekin@handhelds.org 6 * email : harlekin@handhelds.org
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18 18
19 19
20#include "datebookevent.h" 20#include "datebookevent.h"
21#include "datebookplugin.h" 21#include "datebookplugin.h"
22#include "datebookpluginwidget.h" 22#include "datebookpluginwidget.h"
23#include "datebookpluginconfig.h" 23#include "datebookpluginconfig.h"
24 24
25 25
26DatebookPlugin::DatebookPlugin() { 26DatebookPlugin::DatebookPlugin() {
27} 27}
28 28
29DatebookPlugin::~DatebookPlugin() { 29DatebookPlugin::~DatebookPlugin() {
30} 30}
31 31
32QString DatebookPlugin::pluginName() const { 32QString DatebookPlugin::pluginName() const {
33 return "Datebook plugin"; 33 return "Datebook plugin";
34} 34}
35 35
36double DatebookPlugin::versionNumber() const { 36double DatebookPlugin::versionNumber() const {
37 return 1.0; 37 return 1.0;
38} 38}
39 39
40QString DatebookPlugin::pixmapNameWidget() const { 40QString DatebookPlugin::pixmapNameWidget() const {
41 return "DateBook"; 41 return "DateBook";
42} 42}
43 43
44QWidget* DatebookPlugin::widget( QWidget* wid ) { 44QWidget* DatebookPlugin::widget( QWidget* wid ) {
45 return new DatebookPluginWidget( wid, "Datebook" ); 45 return new DatebookPluginWidget( wid, "Datebook" );
46} 46}
47 47
48QString DatebookPlugin::pixmapNameConfig() const { 48QString DatebookPlugin::pixmapNameConfig() const {
49 return "DateBook"; 49 return "DateBook";
50} 50}
51 51
52ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { 52TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) {
53 return new DatebookPluginConfig( wid , "Datebook" ); 53 return new DatebookPluginConfig( wid , "Datebook" );
54} 54}
55 55
56QString DatebookPlugin::appName() const { 56QString DatebookPlugin::appName() const {
57 return QObject::tr( "Datebook" ); 57 return QObject::tr( "Datebook" );
58} 58}
59 59
60int DatebookPlugin::minHeight() const {
61 return 10;
62}
63
64int DatebookPlugin::maxHeight() const {
65 return 100;
66}
67
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 @@
1/* 1/*
2 * datebookplugin.h 2 * datebookplugin.h
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef DATEBOOK_PLUGIN_H 17#ifndef DATEBOOK_PLUGIN_H
18#define DATEBOOK_PLUGIN_H 18#define DATEBOOK_PLUGIN_H
19 19
20#include <qstring.h> 20#include <qstring.h>
21#include <qwidget.h> 21#include <qwidget.h>
22 22
23#include <opie/oclickablelabel.h> 23#include <opie/oclickablelabel.h>
24 24
25#include "../../todayplugininterface.h" 25#include "../../todayplugininterface.h"
26 26
27class DatebookPlugin : public TodayPluginObject { 27class DatebookPlugin : public TodayPluginObject {
28 28
29public: 29public:
30 DatebookPlugin(); 30 DatebookPlugin();
31 ~DatebookPlugin(); 31 ~DatebookPlugin();
32 32
33 QString pluginName() const; 33 QString pluginName() const;
34 double versionNumber() const; 34 double versionNumber() const;
35 QString pixmapNameWidget() const; 35 QString pixmapNameWidget() const;
36 QWidget* widget( QWidget *); 36 QWidget* widget( QWidget *);
37 QString pixmapNameConfig() const; 37 QString pixmapNameConfig() const;
38 ConfigWidget* configWidget( QWidget *); 38 TodayConfigWidget* configWidget( QWidget *);
39 QString appName() const; 39 QString appName() const;
40 virtual int minHeight() const;
41 virtual int maxHeight() const;
42 40
43}; 41};
44 42
45 43
46#endif 44#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,81 +1,81 @@
1 1
2 2
3#include "datebookpluginconfig.h" 3#include "datebookpluginconfig.h"
4 4
5#include <qpe/config.h> 5#include <qpe/config.h>
6 6
7#include <qlayout.h> 7#include <qlayout.h>
8#include <qtoolbutton.h> 8#include <qtoolbutton.h>
9#include <qlabel.h> 9#include <qlabel.h>
10#include <qhbox.h> 10#include <qhbox.h>
11#include <qvbox.h> 11#include <qvbox.h>
12 12
13DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) 13DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name)
14 : ConfigWidget( parent, name ) { 14 : TodayConfigWidget( parent, name ) {
15 15
16 QVBoxLayout * layout = new QVBoxLayout( this ); 16 QVBoxLayout * layout = new QVBoxLayout( this );
17 layout->setMargin( 20 ); 17 layout->setMargin( 20 );
18 18
19 QHBox *box1 = new QHBox( this ); 19 QHBox *box1 = new QHBox( this );
20 QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" ); 20 QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" );
21 TextLabel4->setText( tr( "Show location" ) ); 21 TextLabel4->setText( tr( "Show location" ) );
22 CheckBox1 = new QCheckBox( box1, "CheckBox1" ); 22 CheckBox1 = new QCheckBox( box1, "CheckBox1" );
23 23
24 QHBox *box2 = new QHBox( this ); 24 QHBox *box2 = new QHBox( this );
25 QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" ); 25 QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" );
26 TextLabel5->setText( tr( "Show notes" ) ); 26 TextLabel5->setText( tr( "Show notes" ) );
27 CheckBox2 = new QCheckBox( box2, "CheckBox2" ); 27 CheckBox2 = new QCheckBox( box2, "CheckBox2" );
28 28
29 QHBox *box3 = new QHBox( this ); 29 QHBox *box3 = new QHBox( this );
30 QLabel* TextLabel6 = new QLabel( box3, "All Day"); 30 QLabel* TextLabel6 = new QLabel( box3, "All Day");
31 TextLabel6->setText( tr( "Show only later\n appointments") ); 31 TextLabel6->setText( tr( "Show only later\n appointments") );
32 CheckBox3 = new QCheckBox ( box3, "CheckBox3" ); 32 CheckBox3 = new QCheckBox ( box3, "CheckBox3" );
33 33
34 QHBox *box4 = new QHBox( this ); 34 QHBox *box4 = new QHBox( this );
35 QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" ); 35 QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" );
36 TextLabel3->setText( tr( "How many \nappointment\n" 36 TextLabel3->setText( tr( "How many \nappointment\n"
37 "should be \nshown?" ) ); 37 "should be \nshown?" ) );
38 SpinBox1 = new QSpinBox( box4, "SpinBox1" ); 38 SpinBox1 = new QSpinBox( box4, "SpinBox1" );
39 SpinBox1->setMaxValue( 10 ); 39 SpinBox1->setMaxValue( 10 );
40 SpinBox1->setValue( 5 ); 40 SpinBox1->setValue( 5 );
41 41
42 layout->addWidget( box1 ); 42 layout->addWidget( box1 );
43 layout->addWidget( box2 ); 43 layout->addWidget( box2 );
44 layout->addWidget( box3 ); 44 layout->addWidget( box3 );
45 layout->addWidget( box4 ); 45 layout->addWidget( box4 );
46 46
47 readConfig(); 47 readConfig();
48} 48}
49 49
50void DatebookPluginConfig::readConfig() { 50void DatebookPluginConfig::readConfig() {
51 Config cfg( "todaydatebookplugin" ); 51 Config cfg( "todaydatebookplugin" );
52 cfg.setGroup( "config" ); 52 cfg.setGroup( "config" );
53 53
54 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); 54 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
55 SpinBox1->setValue( m_max_lines_meet ); 55 SpinBox1->setValue( m_max_lines_meet );
56 m_show_location = cfg.readNumEntry( "showlocation", 1 ); 56 m_show_location = cfg.readNumEntry( "showlocation", 1 );
57 CheckBox1->setChecked( m_show_location ); 57 CheckBox1->setChecked( m_show_location );
58 m_show_notes = cfg.readNumEntry( "shownotes", 0 ); 58 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
59 CheckBox2->setChecked( m_show_notes ); 59 CheckBox2->setChecked( m_show_notes );
60 m_only_later = cfg.readNumEntry( "onlylater", 1 ); 60 m_only_later = cfg.readNumEntry( "onlylater", 1 );
61 CheckBox3->setChecked( m_only_later ); 61 CheckBox3->setChecked( m_only_later );
62} 62}
63 63
64 64
65void DatebookPluginConfig::writeConfig() { 65void DatebookPluginConfig::writeConfig() {
66 Config cfg( "todaydatebookplugin" ); 66 Config cfg( "todaydatebookplugin" );
67 cfg.setGroup( "config" ); 67 cfg.setGroup( "config" );
68 68
69 m_max_lines_meet = SpinBox1->value(); 69 m_max_lines_meet = SpinBox1->value();
70 cfg.writeEntry( "maxlinesmeet", m_max_lines_meet); 70 cfg.writeEntry( "maxlinesmeet", m_max_lines_meet);
71 m_show_location = CheckBox1->isChecked(); 71 m_show_location = CheckBox1->isChecked();
72 cfg.writeEntry( "showlocation", m_show_location); 72 cfg.writeEntry( "showlocation", m_show_location);
73 m_show_notes = CheckBox2->isChecked(); 73 m_show_notes = CheckBox2->isChecked();
74 cfg.writeEntry( "shownotes", m_show_notes ); 74 cfg.writeEntry( "shownotes", m_show_notes );
75 m_only_later = CheckBox3->isChecked(); 75 m_only_later = CheckBox3->isChecked();
76 cfg.writeEntry( "onlylater", m_only_later ); 76 cfg.writeEntry( "onlylater", m_only_later );
77 cfg.write(); 77 cfg.write();
78} 78}
79 79
80DatebookPluginConfig::~DatebookPluginConfig() { 80DatebookPluginConfig::~DatebookPluginConfig() {
81} 81}
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 @@
1 1
2#ifndef DATEBOOK_PLUGIN_CONFIG_H 2#ifndef DATEBOOK_PLUGIN_CONFIG_H
3#define DATEBOOK_PLUGIN_CONFIG_H 3#define DATEBOOK_PLUGIN_CONFIG_H
4 4
5//#include <qwidget.h> 5
6#include <qcheckbox.h> 6#include <qcheckbox.h>
7#include <qspinbox.h> 7#include <qspinbox.h>
8 8
9#include "../../configwidget.h" 9#include "../../todayconfigwidget.h"
10 10
11class DatebookPluginConfig : public ConfigWidget { 11class DatebookPluginConfig : public TodayConfigWidget {
12 12
13 13
14 14
15public: 15public:
16 DatebookPluginConfig( QWidget *parent, const char *name ); 16 DatebookPluginConfig( QWidget *parent, const char *name );
17 ~DatebookPluginConfig(); 17 ~DatebookPluginConfig();
18 18
19 void writeConfig(); 19 void writeConfig();
20private: 20private:
21 /** 21 /**
22 * if changed then save 22 * if changed then save
23 */ 23 */
24 bool changed(); 24 bool changed();
25 void readConfig(); 25 void readConfig();
26 26
27 QCheckBox* CheckBox2; 27 QCheckBox* CheckBox2;
28 QCheckBox* CheckBox1; 28 QCheckBox* CheckBox1;
29 QCheckBox* CheckBox3; 29 QCheckBox* CheckBox3;
30 QSpinBox* SpinBox1; 30 QSpinBox* SpinBox1;
31 31
32 // how many lines should be showed in the datebook section 32 // how many lines should be showed in the datebook section
33 int m_max_lines_meet; 33 int m_max_lines_meet;
34 // If location is to be showed too, 1 to activate it. 34 // If location is to be showed too, 1 to activate it.
35 int m_show_location; 35 int m_show_location;
36 // if notes should be shown 36 // if notes should be shown
37 int m_show_notes; 37 int m_show_notes;
38 // should only later appointments be shown or all for the current day. 38 // should only later appointments be shown or all for the current day.
39 int m_only_later; 39 int m_only_later;
40 40
41 41
42}; 42};
43 43
44 44
45 45
46 46
47 47
48#endif 48#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 @@
1/* 1/*
2 * mailplugin.cpp 2 * mailplugin.cpp
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18#include "mailplugin.h" 18#include "mailplugin.h"
19#include "mailpluginwidget.h" 19#include "mailpluginwidget.h"
20 20
21 21
22MailPlugin::MailPlugin() { 22MailPlugin::MailPlugin() {
23} 23}
24 24
25MailPlugin::~MailPlugin() { 25MailPlugin::~MailPlugin() {
26} 26}
27 27
28QString MailPlugin::pluginName() const { 28QString MailPlugin::pluginName() const {
29 return "Mail plugin"; 29 return "Mail plugin";
30} 30}
31 31
32double MailPlugin::versionNumber() const { 32double MailPlugin::versionNumber() const {
33 return 0.1; 33 return 0.5;
34} 34}
35 35
36QString MailPlugin::pixmapNameWidget() const { 36QString MailPlugin::pixmapNameWidget() const {
37 return "mail/desktopicon"; 37 return "mail/desktopicon";
38} 38}
39 39
40QWidget* MailPlugin::widget( QWidget * wid ) { 40QWidget* MailPlugin::widget( QWidget * wid ) {
41 return new MailPluginWidget( wid, "Mail" ); 41 return new MailPluginWidget( wid, "Mail" );
42} 42}
43 43
44QString MailPlugin::pixmapNameConfig() const { 44QString MailPlugin::pixmapNameConfig() const {
45 return 0l; 45 return 0l;
46} 46}
47 47
48ConfigWidget* MailPlugin::configWidget( QWidget* wid ) { 48TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) {
49 return 0l; 49 return 0l;
50} 50}
51 51
52QString MailPlugin::appName() const { 52QString MailPlugin::appName() const {
53 return "Mail"; 53 return "Mail";
54} 54}
55 55
56int MailPlugin::minHeight() const {
57 return 10;
58}
59
60int MailPlugin::maxHeight() const {
61 return 10;
62}
63 56
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 @@
1/* 1/*
2 * mailplugin.h 2 * mailplugin.h
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18#ifndef MAIL_PLUGIN_H 18#ifndef MAIL_PLUGIN_H
19#define MAIL_PLUGIN_H 19#define MAIL_PLUGIN_H
20 20
21#include <qstring.h> 21#include <qstring.h>
22#include <qwidget.h> 22#include <qwidget.h>
23 23
24#include <opie/tododb.h> 24#include <opie/tododb.h>
25#include <opie/oclickablelabel.h> 25#include <opie/oclickablelabel.h>
26 26
27#include "../../todayplugininterface.h" 27#include "../../todayplugininterface.h"
28#include "../../configwidget.h" 28#include "../../todayconfigwidget.h"
29 29
30class MailPlugin : public TodayPluginObject { 30class MailPlugin : public TodayPluginObject {
31 31
32public: 32public:
33 MailPlugin(); 33 MailPlugin();
34 ~MailPlugin(); 34 ~MailPlugin();
35 35
36 QString pluginName() const; 36 QString pluginName() const;
37 double versionNumber() const; 37 double versionNumber() const;
38 QString pixmapNameWidget() const; 38 QString pixmapNameWidget() const;
39 QWidget* widget(QWidget *); 39 QWidget* widget(QWidget *);
40 QString pixmapNameConfig() const; 40 QString pixmapNameConfig() const;
41 ConfigWidget* configWidget(QWidget *); 41 TodayConfigWidget* configWidget(QWidget *);
42 QString appName() const; 42 QString appName() const;
43 virtual int minHeight() const; 43
44 virtual int maxHeight() const;
45 44
46}; 45};
47 46
48#endif 47#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 @@
1/* 1/*
2 * todoplugin.cpp 2 * todoplugin.cpp
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18 18
19#include "todoplugin.h" 19#include "todoplugin.h"
20#include "todopluginconfig.h" 20#include "todopluginconfig.h"
21#include "todopluginwidget.h" 21#include "todopluginwidget.h"
22 22
23 23
24TodolistPlugin::TodolistPlugin() { 24TodolistPlugin::TodolistPlugin() {
25} 25}
26 26
27TodolistPlugin::~TodolistPlugin() { 27TodolistPlugin::~TodolistPlugin() {
28} 28}
29 29
30QString TodolistPlugin::pluginName() const { 30QString TodolistPlugin::pluginName() const {
31 return "Todolist plugin"; 31 return "Todolist plugin";
32} 32}
33 33
34double TodolistPlugin::versionNumber() const { 34double TodolistPlugin::versionNumber() const {
35 return 0.7; 35 return 0.7;
36} 36}
37 37
38QString TodolistPlugin::pixmapNameWidget() const { 38QString TodolistPlugin::pixmapNameWidget() const {
39 return "TodoList"; 39 return "TodoList";
40} 40}
41 41
42QWidget* TodolistPlugin::widget( QWidget *wid ) { 42QWidget* TodolistPlugin::widget( QWidget *wid ) {
43 return new TodolistPluginWidget( wid, "Todolist" ); 43 return new TodolistPluginWidget( wid, "Todolist" );
44} 44}
45 45
46QString TodolistPlugin::pixmapNameConfig() const { 46QString TodolistPlugin::pixmapNameConfig() const {
47 return "TodoList"; 47 return "TodoList";
48} 48}
49 49
50ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { 50TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) {
51 return new TodolistPluginConfig( wid , "Todolist" ); 51 return new TodolistPluginConfig( wid , "Todolist" );
52} 52}
53 53
54QString TodolistPlugin::appName() const { 54QString TodolistPlugin::appName() const {
55 return QObject::tr( "Todolist" ); 55 return QObject::tr( "Todolist" );
56} 56}
57 57
58int TodolistPlugin::minHeight() const {
59 return 10;
60}
61
62int TodolistPlugin::maxHeight() const {
63 return 100;
64}
65 58
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 @@
1/* 1/*
2 * todoplugin.h 2 * todoplugin.h
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef TODOLIST_PLUGIN_H 17#ifndef TODOLIST_PLUGIN_H
18#define TODOLIST_PLUGIN_H 18#define TODOLIST_PLUGIN_H
19 19
20#include <qstring.h> 20#include <qstring.h>
21#include <qwidget.h> 21#include <qwidget.h>
22 22
23#include <opie/tododb.h> 23#include <opie/tododb.h>
24#include <opie/oclickablelabel.h> 24#include <opie/oclickablelabel.h>
25 25
26#include "../../todayplugininterface.h" 26#include "../../todayplugininterface.h"
27 27
28class TodolistPlugin : public TodayPluginObject { 28class TodolistPlugin : public TodayPluginObject {
29 29
30public: 30public:
31 TodolistPlugin(); 31 TodolistPlugin();
32 ~TodolistPlugin(); 32 ~TodolistPlugin();
33 33
34 QString pluginName() const; 34 QString pluginName() const;
35 double versionNumber() const; 35 double versionNumber() const;
36 QString pixmapNameWidget() const; 36 QString pixmapNameWidget() const;
37 QWidget* widget(QWidget *); 37 QWidget* widget(QWidget *);
38 QString pixmapNameConfig() const; 38 QString pixmapNameConfig() const;
39 ConfigWidget* configWidget(QWidget *); 39 TodayConfigWidget* configWidget(QWidget *);
40 QString appName() const; 40 QString appName() const;
41 virtual int minHeight() const; 41
42 virtual int maxHeight() const;
43}; 42};
44 43
45#endif 44#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 @@
1/* 1/*
2 * todopluginconfig.cpp 2 * todopluginconfig.cpp
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "todopluginconfig.h" 17#include "todopluginconfig.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20 20
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qtoolbutton.h> 23#include <qtoolbutton.h>
24#include <qlabel.h> 24#include <qlabel.h>
25 25
26 26
27 27
28TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) 28TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name)
29 : ConfigWidget(parent, name ) { 29 : TodayConfigWidget(parent, name ) {
30 30
31 QVBoxLayout * layout = new QVBoxLayout( this ); 31 QVBoxLayout * layout = new QVBoxLayout( this );
32 layout->setMargin( 20 ); 32 layout->setMargin( 20 );
33 33
34 QHBox *box1 = new QHBox( this ); 34 QHBox *box1 = new QHBox( this );
35 35
36 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); 36 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" );
37 TextLabel6->setText( tr( "How many\n tasks should \n" 37 TextLabel6->setText( tr( "How many\n tasks should \n"
38 "be shown?" ) ); 38 "be shown?" ) );
39 39
40 SpinBox2 = new QSpinBox( box1, "SpinBox2" ); 40 SpinBox2 = new QSpinBox( box1, "SpinBox2" );
41 SpinBox2->setMaxValue( 40 ); 41 SpinBox2->setMaxValue( 40 );
42 42
43 QHBox *box2 = new QHBox( this ); 43 QHBox *box2 = new QHBox( this );
44 44
45 QLabel* clipLabel = new QLabel( box2, "" ); 45 QLabel* clipLabel = new QLabel( box2, "" );
46 clipLabel->setText( tr( "Clip line after\n X chars" ) ); 46 clipLabel->setText( tr( "Clip line after\n X chars" ) );
47 47
48 SpinBoxClip = new QSpinBox( box2, "SpinClip" ); 48 SpinBoxClip = new QSpinBox( box2, "SpinClip" );
49 SpinBoxClip->setMaxValue( 200 ); 49 SpinBoxClip->setMaxValue( 200 );
50 50
51 layout->addWidget( box1 ); 51 layout->addWidget( box1 );
52 layout->addWidget( box2 ); 52 layout->addWidget( box2 );
53 53
54 readConfig(); 54 readConfig();
55} 55}
56 56
57void TodolistPluginConfig::readConfig() { 57void TodolistPluginConfig::readConfig() {
58 Config cfg( "todaytodoplugin" ); 58 Config cfg( "todaytodoplugin" );
59 cfg.setGroup( "config" ); 59 cfg.setGroup( "config" );
60 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); 60 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
61 SpinBox2->setValue( m_max_lines_task ); 61 SpinBox2->setValue( m_max_lines_task );
62 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 62 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
63 SpinBoxClip->setValue( m_maxCharClip ); 63 SpinBoxClip->setValue( m_maxCharClip );
64} 64}
65 65
66 66
67void TodolistPluginConfig::writeConfig() { 67void TodolistPluginConfig::writeConfig() {
68 Config cfg( "todaytodoplugin" ); 68 Config cfg( "todaytodoplugin" );
69 cfg.setGroup( "config" ); 69 cfg.setGroup( "config" );
70 m_max_lines_task = SpinBox2->value(); 70 m_max_lines_task = SpinBox2->value();
71 cfg.writeEntry( "maxlinestask", m_max_lines_task ); 71 cfg.writeEntry( "maxlinestask", m_max_lines_task );
72 m_maxCharClip = SpinBoxClip->value(); 72 m_maxCharClip = SpinBoxClip->value();
73 cfg.writeEntry( "maxcharclip", m_maxCharClip ); 73 cfg.writeEntry( "maxcharclip", m_maxCharClip );
74 cfg.write(); 74 cfg.write();
75} 75}
76 76
77 77
78TodolistPluginConfig::~TodolistPluginConfig() { 78TodolistPluginConfig::~TodolistPluginConfig() {
79} 79}
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 @@
1/* 1/*
2 * todopluginconfig.h 2 * todopluginconfig.h
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef TODOLIST_PLUGIN_CONFIG_H 17#ifndef TODOLIST_PLUGIN_CONFIG_H
18#define TODOLIST_PLUGIN_CONFIG_H 18#define TODOLIST_PLUGIN_CONFIG_H
19 19
20#include <qwidget.h> 20#include <qwidget.h>
21#include <qspinbox.h> 21#include <qspinbox.h>
22 22
23#include "../../configwidget.h" 23#include "../../todayconfigwidget.h"
24 24
25class TodolistPluginConfig : public ConfigWidget { 25class TodolistPluginConfig : public TodayConfigWidget {
26 26
27 27
28public: 28public:
29 29
30 TodolistPluginConfig( QWidget *parent, const char *name ); 30 TodolistPluginConfig( QWidget *parent, const char *name );
31 ~TodolistPluginConfig(); 31 ~TodolistPluginConfig();
32 32
33private: 33private:
34 /** 34 /**
35 * if changed then save 35 * if changed then save
36 */ 36 */
37 bool changed(); 37 bool changed();
38 void readConfig(); 38 void readConfig();
39 void writeConfig(); 39 void writeConfig();
40 40
41 QSpinBox* SpinBox2; 41 QSpinBox* SpinBox2;
42 QSpinBox* SpinBoxClip; 42 QSpinBox* SpinBoxClip;
43 43
44 // how many lines should be showed in the todolist section 44 // how many lines should be showed in the todolist section
45 int m_max_lines_task; 45 int m_max_lines_task;
46 // clip the lines after X chars 46 // clip the lines after X chars
47 int m_maxCharClip; 47 int m_maxCharClip;
48 48
49 49
50 50
51}; 51};
52 52
53 53
54 54
55 55
56 56
57#endif 57#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,326 +1,327 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
3 * 3 *
4 * copyright : (c) 2002 by Maximilian Reiß 4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18#include "today.h" 18#include "today.h"
19#include "configwidget.h" 19#include "todayconfigwidget.h"
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/contact.h> 26#include <qpe/contact.h>
27 27
28#include <qdir.h> 28#include <qdir.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qpixmap.h> 33#include <qpixmap.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <opie/otabwidget.h> 36#include <opie/otabwidget.h>
37#include <qdialog.h> 37#include <qdialog.h>
38 38
39 39
40struct TodayPlugin { 40struct TodayPlugin {
41 QLibrary *library; 41 QLibrary *library;
42 TodayPluginInterface *iface; 42 TodayPluginInterface *iface;
43 TodayPluginObject *guiPart; 43 TodayPluginObject *guiPart;
44 QWidget *guiBox; 44 QWidget *guiBox;
45 QString name; 45 QString name;
46 bool active; 46 bool active;
47 int pos; 47 int pos;
48}; 48};
49 49
50static QValueList<TodayPlugin> pluginList; 50static QValueList<TodayPlugin> pluginList;
51 51
52Today::Today( QWidget* parent, const char* name, WFlags fl ) 52Today::Today( QWidget* parent, const char* name, WFlags fl )
53 : TodayBase( parent, name, fl ) { 53 : TodayBase( parent, name, fl ) {
54 54
55 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 55 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
56 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 56 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
57 57
58#if defined(Q_WS_QWS) 58#if defined(Q_WS_QWS)
59#if !defined(QT_NO_COP) 59#if !defined(QT_NO_COP)
60 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 60 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
61 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 61 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
62 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 62 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
63#endif 63#endif
64#endif 64#endif
65 65
66 setOwnerField(); 66 setOwnerField();
67 refresh(); 67 refresh();
68 showMaximized(); 68 showMaximized();
69} 69}
70 70
71/** 71/**
72 * Qcop receive method. 72 * Qcop receive method.
73 */ 73 */
74void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 74void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
75 QDataStream stream( data, IO_ReadOnly ); 75 QDataStream stream( data, IO_ReadOnly );
76 if ( msg == "message(QString)" ) { 76 if ( msg == "message(QString)" ) {
77 QString message; 77 QString message;
78 stream >> message; 78 stream >> message;
79 setOwnerField( message ); 79 setOwnerField( message );
80 } 80 }
81} 81}
82 82
83/** 83/**
84 * Initialises the owner field with the default value, the username 84 * Initialises the owner field with the default value, the username
85 */ 85 */
86void Today::setOwnerField() { 86void Today::setOwnerField() {
87 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 87 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
88 if ( QFile::exists( file ) ) { 88 if ( QFile::exists( file ) ) {
89 Contact cont = Contact::readVCard( file )[0]; 89 Contact cont = Contact::readVCard( file )[0];
90 QString returnString = cont.fullName(); 90 QString returnString = cont.fullName();
91 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 91 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
92 } else { 92 } else {
93 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 93 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
94 } 94 }
95} 95}
96 96
97/** 97/**
98 * Set the owner field with a given QString, for example per qcop. 98 * Set the owner field with a given QString, for example per qcop.
99 */ 99 */
100void Today::setOwnerField( QString &message ) { 100void Today::setOwnerField( QString &message ) {
101 if ( !message.isEmpty() ) { 101 if ( !message.isEmpty() ) {
102 OwnerField->setText( "<b>" + message + "</b>" ); 102 OwnerField->setText( "<b>" + message + "</b>" );
103 } 103 }
104} 104}
105 105
106 106
107/** 107/**
108 * Init stuff needed for today. Reads the config file. 108 * Init stuff needed for today. Reads the config file.
109 */ 109 */
110void Today::init() { 110void Today::init() {
111 // read config 111 // read config
112 Config cfg( "today" ); 112 Config cfg( "today" );
113 cfg.setGroup( "Plugins" ); 113 cfg.setGroup( "Plugins" );
114 114
115 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 115 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
116 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 116 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
117} 117}
118 118
119 119
120/** 120/**
121 * Load the plugins 121 * Load the plugins
122 */ 122 */
123void Today::loadPlugins() { 123void Today::loadPlugins() {
124 124
125 QValueList<TodayPlugin>::Iterator tit; 125 QValueList<TodayPlugin>::Iterator tit;
126 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 126 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
127 (*tit).library->unload(); 127 (*tit).library->unload();
128 delete (*tit).library; 128 delete (*tit).library;
129 } 129 }
130 pluginList.clear(); 130 pluginList.clear();
131 131
132 QString path = QPEApplication::qpeDir() + "/plugins/today"; 132 QString path = QPEApplication::qpeDir() + "/plugins/today";
133 QDir dir( path, "lib*.so" ); 133 QDir dir( path, "lib*.so" );
134 134
135 QStringList list = dir.entryList(); 135 QStringList list = dir.entryList();
136 QStringList::Iterator it; 136 QStringList::Iterator it;
137 137
138 138
139 QMap<QString, TodayPlugin> tempList; 139 QMap<QString, TodayPlugin> tempList;
140 140
141 for ( it = list.begin(); it != list.end(); ++it ) { 141 for ( it = list.begin(); it != list.end(); ++it ) {
142 TodayPluginInterface *iface = 0; 142 TodayPluginInterface *iface = 0;
143 QLibrary *lib = new QLibrary( path + "/" + *it ); 143 QLibrary *lib = new QLibrary( path + "/" + *it );
144 144
145 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 145 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
146 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 146 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
147 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 147 qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
148 qDebug( QString(*it) ); 148 qDebug( QString(*it) );
149 TodayPlugin plugin; 149 TodayPlugin plugin;
150 plugin.library = lib; 150 plugin.library = lib;
151 plugin.iface = iface; 151 plugin.iface = iface;
152 plugin.name = QString(*it); 152 plugin.name = QString(*it);
153 153
154 // find out if plugins should be shown 154 // find out if plugins should be shown
155 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 155 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
156 plugin.active = true; 156 plugin.active = true;
157 } else { 157 } else {
158 plugin.active = false; 158 plugin.active = false;
159 } 159 }
160 plugin.guiPart = plugin.iface->guiPart(); 160 plugin.guiPart = plugin.iface->guiPart();
161 161
162 // package the whole thing into a qwidget so it can be shown and hidden 162 // package the whole thing into a qwidget so it can be shown and hidden
163 plugin.guiBox = new QWidget( this ); 163 plugin.guiBox = new QWidget( this );
164 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 164 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
165 QPixmap plugPix; 165 QPixmap plugPix;
166 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); 166 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
167 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 167 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
168 plugIcon->setPixmap( plugPix ); 168 plugIcon->setPixmap( plugPix );
169 // a scrollview for each plugin 169 // a scrollview for each plugin
170 QScrollView* sv = new QScrollView( plugin.guiBox ); 170 QScrollView* sv = new QScrollView( plugin.guiBox );
171 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); 171 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
172 sv->setMinimumHeight( plugin.guiPart->minHeight() ); 172 // not sure if that is good .-)
173 sv->setMinimumHeight( 10 );
173 sv->setResizePolicy( QScrollView::AutoOneFit ); 174 sv->setResizePolicy( QScrollView::AutoOneFit );
174 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 175 sv->setHScrollBarMode( QScrollView::AlwaysOff );
175 sv->setFrameShape( QFrame::NoFrame ); 176 sv->setFrameShape( QFrame::NoFrame );
176 sv->addChild( plugWidget ); 177 sv->addChild( plugWidget );
177 // make sure the icon is on the top alligned 178 // make sure the icon is on the top alligned
178 boxLayout->addWidget( plugIcon, 0, AlignTop ); 179 boxLayout->addWidget( plugIcon, 0, AlignTop );
179 boxLayout->addWidget( sv, 0, AlignTop ); 180 boxLayout->addWidget( sv, 0, AlignTop );
180 boxLayout->setStretchFactor( plugIcon, 1 ); 181 boxLayout->setStretchFactor( plugIcon, 1 );
181 boxLayout->setStretchFactor( sv, 9 ); 182 boxLayout->setStretchFactor( sv, 9 );
182 // "prebuffer" it in one more list, to get the sorting done 183 // "prebuffer" it in one more list, to get the sorting done
183 tempList.insert( plugin.name, plugin ); 184 tempList.insert( plugin.name, plugin );
184 185
185 // on first start the list is off course empty 186 // on first start the list is off course empty
186 if ( m_allApplets.isEmpty() ) { 187 if ( m_allApplets.isEmpty() ) {
187 layout->addWidget( plugin.guiBox ); 188 layout->addWidget( plugin.guiBox );
188 pluginList.append( plugin ); 189 pluginList.append( plugin );
189 } 190 }
190 } else { 191 } else {
191 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 192 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
192 delete lib; 193 delete lib;
193 } 194 }
194 } 195 }
195 196
196 if ( !m_allApplets.isEmpty() ) { 197 if ( !m_allApplets.isEmpty() ) {
197 TodayPlugin tempPlugin; 198 TodayPlugin tempPlugin;
198 QStringList::Iterator stringit; 199 QStringList::Iterator stringit;
199 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 200 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
200 tempPlugin = ( tempList.find( *stringit ) ).data(); 201 tempPlugin = ( tempList.find( *stringit ) ).data();
201 if ( !( (tempPlugin.name).isEmpty() ) ) { 202 if ( !( (tempPlugin.name).isEmpty() ) ) {
202 layout->addWidget( tempPlugin.guiBox ); 203 layout->addWidget( tempPlugin.guiBox );
203 pluginList.append( tempPlugin ); 204 pluginList.append( tempPlugin );
204 } 205 }
205 } 206 }
206 } 207 }
207} 208}
208 209
209 210
210/** 211/**
211 * Repaint method. Reread all fields. 212 * Repaint method. Reread all fields.
212 */ 213 */
213void Today::draw() { 214void Today::draw() {
214 215
215 if ( pluginList.count() == 0 ) { 216 if ( pluginList.count() == 0 ) {
216 QLabel *noPlugins = new QLabel( this ); 217 QLabel *noPlugins = new QLabel( this );
217 noPlugins->setText( tr( "No plugins found" ) ); 218 noPlugins->setText( tr( "No plugins found" ) );
218 layout->addWidget( noPlugins ); 219 layout->addWidget( noPlugins );
219 return; 220 return;
220 } 221 }
221 222
222 uint count = 0; 223 uint count = 0;
223 TodayPlugin plugin; 224 TodayPlugin plugin;
224 for ( uint i = 0; i < pluginList.count(); i++ ) { 225 for ( uint i = 0; i < pluginList.count(); i++ ) {
225 plugin = pluginList[i]; 226 plugin = pluginList[i];
226 227
227 if ( plugin.active ) { 228 if ( plugin.active ) {
228 // qDebug( plugin.name + " is ACTIVE " ); 229 // qDebug( plugin.name + " is ACTIVE " );
229 plugin.guiBox->show(); 230 plugin.guiBox->show();
230 } else { 231 } else {
231 // qDebug( plugin.name + " is INACTIVE" ); 232 // qDebug( plugin.name + " is INACTIVE" );
232 plugin.guiBox->hide(); 233 plugin.guiBox->hide();
233 } 234 }
234 count++; 235 count++;
235 } 236 }
236 237
237 if ( count == 0 ) { 238 if ( count == 0 ) {
238 QLabel *noPluginsActive = new QLabel( this ); 239 QLabel *noPluginsActive = new QLabel( this );
239 noPluginsActive->setText( tr( "No plugins activated" ) ); 240 noPluginsActive->setText( tr( "No plugins activated" ) );
240 layout->addWidget( noPluginsActive ); 241 layout->addWidget( noPluginsActive );
241 } 242 }
242 layout->addStretch(0); 243 layout->addStretch(0);
243} 244}
244 245
245 246
246/** 247/**
247 * The method for the configuration dialog. 248 * The method for the configuration dialog.
248 */ 249 */
249void Today::startConfig() { 250void Today::startConfig() {
250 251
251 TodayConfig conf( this, "dialog", true ); 252 TodayConfig conf( this, "dialog", true );
252 253
253 TodayPlugin plugin; 254 TodayPlugin plugin;
254 QList<ConfigWidget> configWidgetList; 255 QList<TodayConfigWidget> configWidgetList;
255 256
256 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { 257 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) {
257 plugin = pluginList[i]; 258 plugin = pluginList[i];
258 259
259 // load the config widgets in the tabs 260 // load the config widgets in the tabs
260 if ( plugin.guiPart->configWidget( this ) != 0l ) { 261 if ( plugin.guiPart->configWidget( this ) != 0l ) {
261 ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); 262 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
262 configWidgetList.append( widget ); 263 configWidgetList.append( widget );
263 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() 264 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
264 , plugin.guiPart->appName() ); 265 , plugin.guiPart->appName() );
265 } 266 }
266 // set the order/activate tab 267 // set the order/activate tab
267 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), 268 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
268 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 269 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
269 } 270 }
270 271
271 if ( conf.exec() == QDialog::Accepted ) { 272 if ( conf.exec() == QDialog::Accepted ) {
272 conf.writeConfig(); 273 conf.writeConfig();
273 ConfigWidget *confWidget; 274 TodayConfigWidget *confWidget;
274 for ( confWidget = configWidgetList.first(); confWidget != 0; 275 for ( confWidget = configWidgetList.first(); confWidget != 0;
275 confWidget = configWidgetList.next() ) { 276 confWidget = configWidgetList.next() ) {
276 confWidget->writeConfig(); 277 confWidget->writeConfig();
277 } 278 }
278 refresh(); 279 refresh();
279 } 280 }
280} 281}
281 282
282 283
283/** 284/**
284 * Refresh for the view. Reload all applets 285 * Refresh for the view. Reload all applets
285 * 286 *
286 */ 287 */
287void Today::refresh() { 288void Today::refresh() {
288 init(); 289 init();
289 290
290 // set the date in top label 291 // set the date in top label
291 QDate date = QDate::currentDate(); 292 QDate date = QDate::currentDate();
292 QString time = ( tr( date.toString() ) ); 293 QString time = ( tr( date.toString() ) );
293 294
294 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); 295 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
295 296
296 if ( layout ) { 297 if ( layout ) {
297 delete layout; 298 delete layout;
298 } 299 }
299 layout = new QVBoxLayout( this ); 300 layout = new QVBoxLayout( this );
300 layout->addWidget( Frame ); 301 layout->addWidget( Frame );
301 layout->addWidget( OwnerField ); 302 layout->addWidget( OwnerField );
302 303
303 loadPlugins(); 304 loadPlugins();
304 draw(); 305 draw();
305} 306}
306 307
307void Today::startAddressbook() { 308void Today::startAddressbook() {
308 QCopEnvelope e( "QPE/System", "execute(QString)" ); 309 QCopEnvelope e( "QPE/System", "execute(QString)" );
309 e << QString( "addressbook" ); 310 e << QString( "addressbook" );
310} 311}
311 312
312 313
313/** 314/**
314 * launch addressbook (personal card) 315 * launch addressbook (personal card)
315 */ 316 */
316void Today::editCard() { 317void Today::editCard() {
317 startAddressbook(); 318 startAddressbook();
318 while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { 319 while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) {
319 qApp->processEvents(); 320 qApp->processEvents();
320 } 321 }
321 QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); 322 QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" );
322} 323}
323 324
324Today::~Today() { 325Today::~Today() {
325} 326}
326 327
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 @@
1
2#ifndef CONFIG_WIDGET_H
3#define CONFIG_WIDGET_H
4
5
6class TodayConfigWidget : public QWidget {
7
8
9public:
10
11 TodayConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ;
12 virtual ~TodayConfigWidget() {};
13
14 /**
15 * Plugins need to reimplement this in the config widget
16 * Used when the config dialog is closed to write config stuff
17 */
18 virtual void writeConfig() = 0;
19};
20
21#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 @@
1 1
2#ifndef TODAY_PLUGIN_INTERFACE 2#ifndef TODAY_PLUGIN_INTERFACE
3#define TODAY_PLUGIN_INTERFACE 3#define TODAY_PLUGIN_INTERFACE
4 4
5#include <qpe/qcom.h> 5#include <qpe/qcom.h>
6#include "configwidget.h" 6#include "todayconfigwidget.h"
7 7
8class QString; 8class QString;
9class QWidget; 9class QWidget;
10 10
11#ifndef IID_TodayPluginInterface 11#ifndef IID_TodayPluginInterface
12#define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) 12#define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14)
13#endif 13#endif
14 14
15/** 15/**
16 * 16 *
17 * 17 *
18 * 18 *
19 */ 19 */
20class TodayPluginObject { 20class TodayPluginObject {
21 21
22 Q_OBJECT 22 Q_OBJECT
23 23
24public: 24public:
25 25
26 virtual ~TodayPluginObject() {}; 26 virtual ~TodayPluginObject() {};
27 27
28 /** 28 /**
29 * The name if the plugin 29 * The name if the plugin
30 */ 30 */
31 virtual QString pluginName() const = 0; 31 virtual QString pluginName() const = 0;
32 32
33 /** 33 /**
34 * Version numbering 34 * Version numbering
35 */ 35 */
36 virtual double versionNumber() const = 0; 36 virtual double versionNumber() const = 0;
37 37
38 /** 38
39 * the path and name of the identifer icon that should be shown
40 * in "Resource" notation, that means only subdir/picname form $QPEDIR/pics
41 */
42 virtual QString pixmapNameWidget() const = 0; 39 virtual QString pixmapNameWidget() const = 0;
43 40
44 /** widget for the today view 41 /** widget for the today view
45 * It _needs_ a parent here. 42 * It _needs_ a parent here.
46 */ 43 */
47 virtual QWidget* widget( QWidget * ) = 0; 44 virtual QWidget* widget( QWidget * ) = 0;
48 45
49 /** 46 /**
50 * Pixmap used in the config widget 47 * Pixmap used in the config widget
51 */ 48 */
52 virtual QString pixmapNameConfig() const = 0; 49 virtual QString pixmapNameConfig() const = 0;
53 50
54 /** 51 /**
55 * Config plugin widget - optional 52 * Config plugin widget - optional
56 * If the plugin has a config widget, it _needs_ a parent here. 53 * If the plugin has a config widget, it _needs_ a parent here.
57 */ 54 */
58 virtual ConfigWidget* configWidget( QWidget * ) = 0; 55 virtual TodayConfigWidget* configWidget( QWidget * ) = 0;
59 56
60 /** 57 /**
61 * The application that should be assigned to the button (pixmap) 58 * The application that should be assigned to the button (pixmap)
62 */ 59 */
63 virtual QString appName() const = 0; 60 virtual QString appName() const = 0;
64 61
65 /** 62 /**
66 * minimum height the plugin at least should have 63 * minimum height the plugin at least should have
67 */ 64 */
68 virtual int minHeight() const = 0; 65 // virtual int minHeight() const = 0;
69 66
70 /** 67 /**
71 * maximum height that should be used before starting scrolling 68 * maximum height that should be used before starting scrolling
72 */ 69 */
73 virtual int maxHeight() const = 0; 70 // virtual int maxHeight() const = 0;
74 71
75}; 72};
76 73
77 74
78struct TodayPluginInterface : public QUnknownInterface { 75struct TodayPluginInterface : public QUnknownInterface {
79 virtual TodayPluginObject *guiPart() = 0; 76 virtual TodayPluginObject *guiPart() = 0;
80}; 77};
81 78
82#endif 79#endif