author | harlekin <harlekin> | 2002-09-17 09:36:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-17 09:36:43 (UTC) |
commit | 03abe825f26678c34142e14f93cabd8f097d5bea (patch) (unidiff) | |
tree | 39ea534ae903bf7699237dc8d19c4f34d955c0bf | |
parent | 537aee09b7df89a166debf5ffd14286cbb636898 (diff) | |
download | opie-03abe825f26678c34142e14f93cabd8f097d5bea.zip opie-03abe825f26678c34142e14f93cabd8f097d5bea.tar.gz opie-03abe825f26678c34142e14f93cabd8f097d5bea.tar.bz2 |
some changes
-rw-r--r-- | core/pim/today/configwidget.h | 4 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.cpp | 8 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.h | 1 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginconfig.cpp | 3 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginconfig.h | 6 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 2 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todopluginconfig.h | 1 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 167 | ||||
-rw-r--r-- | core/pim/today/today.h | 10 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 15 |
10 files changed, 105 insertions, 112 deletions
diff --git a/core/pim/today/configwidget.h b/core/pim/today/configwidget.h index f449db4..02ce37a 100644 --- a/core/pim/today/configwidget.h +++ b/core/pim/today/configwidget.h | |||
@@ -1,17 +1,17 @@ | |||
1 | 1 | ||
2 | #ifndef CONFIG_WIDGET_H | 2 | #ifndef CONFIG_WIDGET_H |
3 | #define CONFIG_WIDGET_H | 3 | #define CONFIG_WIDGET_H |
4 | 4 | ||
5 | 5 | ||
6 | |||
7 | class ConfigWidget : public QWidget { | 6 | class ConfigWidget : public QWidget { |
8 | 7 | ||
8 | |||
9 | public: | 9 | public: |
10 | 10 | ||
11 | ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {}; | 11 | ConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; |
12 | virtual ~ConfigWidget() {}; | 12 | virtual ~ConfigWidget() {}; |
13 | 13 | ||
14 | virtual void writeConfig() = 0; | 14 | virtual void writeConfig() = 0; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #endif | 17 | #endif |
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp index d2a73df..9800e61 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.cpp +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp | |||
@@ -1,73 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | * datebookplugin.cpp | 2 | * datebookplugin.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 "datebookevent.h" | 19 | #include "datebookevent.h" |
20 | #include "datebookplugin.h" | 20 | #include "datebookplugin.h" |
21 | #include "datebookpluginwidget.h" | 21 | #include "datebookpluginwidget.h" |
22 | #include "datebookpluginconfig.h" | 22 | #include "datebookpluginconfig.h" |
23 | 23 | ||
24 | #include "../../configwidget.h" | ||
25 | |||
26 | #include <qpe/timestring.h> | ||
27 | #include <qpe/config.h> | ||
28 | |||
29 | 24 | ||
30 | DatebookPlugin::DatebookPlugin() { | 25 | DatebookPlugin::DatebookPlugin() { |
31 | } | 26 | } |
32 | 27 | ||
33 | DatebookPlugin::~DatebookPlugin() { | 28 | DatebookPlugin::~DatebookPlugin() { |
34 | } | 29 | } |
35 | 30 | ||
36 | QString DatebookPlugin::pluginName() const { | 31 | QString DatebookPlugin::pluginName() const { |
37 | return "Datebook plugin"; | 32 | return "Datebook plugin"; |
38 | } | 33 | } |
39 | 34 | ||
40 | double DatebookPlugin::versionNumber() const { | 35 | double DatebookPlugin::versionNumber() const { |
41 | return 0.1; | 36 | return 0.1; |
42 | } | 37 | } |
43 | 38 | ||
44 | QString DatebookPlugin::pixmapNameWidget() const { | 39 | QString DatebookPlugin::pixmapNameWidget() const { |
45 | return "DateBook"; | 40 | return "DateBook"; |
46 | } | 41 | } |
47 | 42 | ||
48 | QWidget* DatebookPlugin::widget( QWidget* wid ) { | 43 | QWidget* DatebookPlugin::widget( QWidget* wid ) { |
49 | return new DatebookPluginWidget( wid, "Datebook" ); | 44 | return new DatebookPluginWidget( wid, "Datebook" ); |
50 | } | 45 | } |
51 | 46 | ||
52 | QString DatebookPlugin::pixmapNameConfig() const { | 47 | QString DatebookPlugin::pixmapNameConfig() const { |
53 | return "DateBook"; | 48 | return "DateBook"; |
54 | } | 49 | } |
55 | 50 | ||
56 | ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { | 51 | ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { |
57 | return new DatebookPluginConfig( wid , "Datebook" ); | 52 | return new DatebookPluginConfig( wid , "Datebook" ); |
58 | } | 53 | } |
59 | 54 | ||
60 | QString DatebookPlugin::appName() const { | 55 | QString DatebookPlugin::appName() const { |
61 | return "datebook"; | 56 | return "datebook"; |
62 | } | 57 | } |
63 | 58 | ||
64 | int DatebookPlugin::minHeight() const { | 59 | int DatebookPlugin::minHeight() const { |
65 | return 10; | 60 | return 10; |
66 | } | 61 | } |
67 | 62 | ||
68 | int DatebookPlugin::maxHeight() const { | 63 | int DatebookPlugin::maxHeight() const { |
69 | return 100; | 64 | return 100; |
70 | } | 65 | } |
71 | 66 | ||
72 | 67 | ||
73 | 68 | int main() { | |
69 | } | ||
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h index f2c4446..61dc9f3 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.h +++ b/core/pim/today/plugins/datebook/datebookplugin.h | |||
@@ -1,47 +1,46 @@ | |||
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 <qpe/datebookdb.h> | ||
24 | #include <opie/oclickablelabel.h> | 23 | #include <opie/oclickablelabel.h> |
25 | 24 | ||
26 | #include "../../todayplugininterface.h" | 25 | #include "../../todayplugininterface.h" |
27 | 26 | ||
28 | class DatebookPlugin : public TodayPluginObject { | 27 | class DatebookPlugin : public TodayPluginObject { |
29 | 28 | ||
30 | public: | 29 | public: |
31 | DatebookPlugin(); | 30 | DatebookPlugin(); |
32 | ~DatebookPlugin(); | 31 | ~DatebookPlugin(); |
33 | 32 | ||
34 | QString pluginName() const; | 33 | QString pluginName() const; |
35 | double versionNumber() const; | 34 | double versionNumber() const; |
36 | QString pixmapNameWidget() const; | 35 | QString pixmapNameWidget() const; |
37 | QWidget* widget( QWidget *); | 36 | QWidget* widget( QWidget *); |
38 | QString pixmapNameConfig() const; | 37 | QString pixmapNameConfig() const; |
39 | ConfigWidget* configWidget( QWidget *); | 38 | ConfigWidget* configWidget( QWidget *); |
40 | QString appName() const; | 39 | QString appName() const; |
41 | virtual int minHeight() const; | 40 | virtual int minHeight() const; |
42 | virtual int maxHeight() const; | 41 | virtual int maxHeight() const; |
43 | 42 | ||
44 | }; | 43 | }; |
45 | 44 | ||
46 | 45 | ||
47 | #endif | 46 | #endif |
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp index 7482f5e..51be40e 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp | |||
@@ -1,47 +1,46 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include "datebookpluginconfig.h" | 3 | #include "datebookpluginconfig.h" |
4 | 4 | ||
5 | |||
6 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
7 | 6 | ||
8 | #include <qlayout.h> | 7 | #include <qlayout.h> |
9 | #include <qtoolbutton.h> | 8 | #include <qtoolbutton.h> |
10 | #include <qlabel.h> | 9 | #include <qlabel.h> |
11 | #include <qhbox.h> | 10 | #include <qhbox.h> |
12 | #include <qvbox.h> | 11 | #include <qvbox.h> |
13 | 12 | ||
14 | DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) | 13 | DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) |
15 | : ConfigWidget( parent, name ) { | 14 | : ConfigWidget( parent, name ) { |
16 | 15 | ||
17 | QVBoxLayout * layout = new QVBoxLayout( this ); | 16 | QVBoxLayout * layout = new QVBoxLayout( this ); |
18 | 17 | ||
19 | QHBox *box1 = new QHBox( this ); | 18 | QHBox *box1 = new QHBox( this ); |
20 | QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" ); | 19 | QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" ); |
21 | TextLabel4->setText( tr( "Show location" ) ); | 20 | TextLabel4->setText( tr( "Show location" ) ); |
22 | CheckBox1 = new QCheckBox( box1, "CheckBox1" ); | 21 | CheckBox1 = new QCheckBox( box1, "CheckBox1" ); |
23 | 22 | ||
24 | QHBox *box2 = new QHBox( this ); | 23 | QHBox *box2 = new QHBox( this ); |
25 | QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" ); | 24 | QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" ); |
26 | TextLabel5->setText( tr( "Show notes" ) ); | 25 | TextLabel5->setText( tr( "Show notes" ) ); |
27 | CheckBox2 = new QCheckBox( box2, "CheckBox2" ); | 26 | CheckBox2 = new QCheckBox( box2, "CheckBox2" ); |
28 | 27 | ||
29 | QHBox *box3 = new QHBox( this ); | 28 | QHBox *box3 = new QHBox( this ); |
30 | QLabel* TextLabel6 = new QLabel( box3, "All Day"); | 29 | QLabel* TextLabel6 = new QLabel( box3, "All Day"); |
31 | TextLabel6->setText( tr( "Show only later\n" | 30 | TextLabel6->setText( tr( "Show only later\n" |
32 | "appointments") ); | 31 | "appointments") ); |
33 | CheckBox3 = new QCheckBox ( box3, "CheckBox3" ); | 32 | CheckBox3 = new QCheckBox ( box3, "CheckBox3" ); |
34 | 33 | ||
35 | QHBox *box4 = new QHBox( this ); | 34 | QHBox *box4 = new QHBox( this ); |
36 | QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" ); | 35 | QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" ); |
37 | TextLabel3->setText( tr( "How many \nappointment\n" | 36 | TextLabel3->setText( tr( "How many \nappointment\n" |
38 | "should be \nshown?" ) ); | 37 | "should be \nshown?" ) ); |
39 | SpinBox1 = new QSpinBox( box4, "SpinBox1" ); | 38 | SpinBox1 = new QSpinBox( box4, "SpinBox1" ); |
40 | SpinBox1->setMaxValue( 10 ); | 39 | SpinBox1->setMaxValue( 10 ); |
41 | SpinBox1->setValue( 5 ); | 40 | SpinBox1->setValue( 5 ); |
42 | 41 | ||
43 | layout->addWidget( box1 ); | 42 | layout->addWidget( box1 ); |
44 | layout->addWidget( box2 ); | 43 | layout->addWidget( box2 ); |
45 | layout->addWidget( box3 ); | 44 | layout->addWidget( box3 ); |
46 | layout->addWidget( box4 ); | 45 | layout->addWidget( box4 ); |
47 | 46 | ||
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h index 33d3c4e..9505a2d 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 | //#include <qwidget.h> |
6 | #include <qcheckbox.h> | 6 | #include <qcheckbox.h> |
7 | #include <qspinbox.h> | 7 | #include <qspinbox.h> |
8 | 8 | ||
9 | #include "../../configwidget.h" | 9 | #include "../../configwidget.h" |
10 | 10 | ||
11 | class DatebookPluginConfig : public ConfigWidget { | 11 | class DatebookPluginConfig : public ConfigWidget { |
12 | 12 | ||
13 | Q_OBJECT | 13 | |
14 | 14 | ||
15 | public: | 15 | public: |
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(); |
20 | private: | 20 | private: |
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/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h index 77889d6..7e5006f 100644 --- a/core/pim/today/plugins/todolist/todoplugin.h +++ b/core/pim/today/plugins/todolist/todoplugin.h | |||
@@ -1,47 +1,45 @@ | |||
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 | #include "../../configwidget.h" | ||
28 | 27 | ||
29 | class TodolistPlugin : public TodayPluginObject { | 28 | class TodolistPlugin : public TodayPluginObject { |
30 | 29 | ||
31 | |||
32 | public: | 30 | public: |
33 | TodolistPlugin(); | 31 | TodolistPlugin(); |
34 | ~TodolistPlugin(); | 32 | ~TodolistPlugin(); |
35 | 33 | ||
36 | QString pluginName() const; | 34 | QString pluginName() const; |
37 | double versionNumber() const; | 35 | double versionNumber() const; |
38 | QString pixmapNameWidget() const; | 36 | QString pixmapNameWidget() const; |
39 | QWidget* widget(QWidget *); | 37 | QWidget* widget(QWidget *); |
40 | QString pixmapNameConfig() const; | 38 | QString pixmapNameConfig() const; |
41 | ConfigWidget* configWidget(QWidget *); | 39 | ConfigWidget* configWidget(QWidget *); |
42 | QString appName() const; | 40 | QString appName() const; |
43 | virtual int minHeight() const; | 41 | virtual int minHeight() const; |
44 | virtual int maxHeight() const; | 42 | virtual int maxHeight() const; |
45 | }; | 43 | }; |
46 | 44 | ||
47 | #endif | 45 | #endif |
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h index a46cc7c..6be4b1e 100644 --- a/core/pim/today/plugins/todolist/todopluginconfig.h +++ b/core/pim/today/plugins/todolist/todopluginconfig.h | |||
@@ -1,55 +1,54 @@ | |||
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 "../../configwidget.h" |
24 | 24 | ||
25 | class TodolistPluginConfig : public ConfigWidget { | 25 | class TodolistPluginConfig : public ConfigWidget { |
26 | 26 | ||
27 | Q_OBJECT | ||
28 | 27 | ||
29 | public: | 28 | public: |
30 | 29 | ||
31 | TodolistPluginConfig( QWidget *parent, const char *name ); | 30 | TodolistPluginConfig( QWidget *parent, const char *name ); |
32 | ~TodolistPluginConfig(); | 31 | ~TodolistPluginConfig(); |
33 | 32 | ||
34 | private: | 33 | private: |
35 | /** | 34 | /** |
36 | * if changed then save | 35 | * if changed then save |
37 | */ | 36 | */ |
38 | bool changed(); | 37 | bool changed(); |
39 | void readConfig(); | 38 | void readConfig(); |
40 | void writeConfig(); | 39 | void writeConfig(); |
41 | 40 | ||
42 | QSpinBox* SpinBox2; | 41 | QSpinBox* SpinBox2; |
43 | 42 | ||
44 | // how many lines should be showed in the todolist section | 43 | // how many lines should be showed in the todolist section |
45 | int m_max_lines_task; | 44 | int m_max_lines_task; |
46 | 45 | ||
47 | 46 | ||
48 | 47 | ||
49 | }; | 48 | }; |
50 | 49 | ||
51 | 50 | ||
52 | 51 | ||
53 | 52 | ||
54 | 53 | ||
55 | #endif | 54 | #endif |
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 09540bd..d78b5b5 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -3,89 +3,101 @@ | |||
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 "configwidget.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 <qtabwidget.h> | 36 | #include <qtabwidget.h> |
36 | #include <qdialog.h> | 37 | #include <qdialog.h> |
37 | 38 | ||
38 | 39 | ||
40 | struct TodayPlugin { | ||
41 | QLibrary *library; | ||
42 | TodayPluginInterface *iface; | ||
43 | TodayPluginObject *guiPart; | ||
44 | QHBox *guiBox; | ||
45 | QString name; | ||
46 | bool active; | ||
47 | int pos; | ||
48 | }; | ||
49 | |||
39 | static QValueList<TodayPlugin> pluginList; | 50 | static QValueList<TodayPlugin> pluginList; |
40 | 51 | ||
41 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 52 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
42 | : TodayBase( parent, name, fl ) { | 53 | : TodayBase( parent, name, fl ) { |
43 | 54 | ||
44 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 55 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
45 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 56 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
46 | 57 | ||
47 | #if defined(Q_WS_QWS) | 58 | #if defined(Q_WS_QWS) |
48 | #if !defined(QT_NO_COP) | 59 | #if !defined(QT_NO_COP) |
49 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 60 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
50 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 61 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
51 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 62 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
52 | #endif | 63 | #endif |
53 | #endif | 64 | #endif |
54 | 65 | ||
55 | pluginLayout = 0l; | 66 | // pluginLayout = 0l; |
56 | 67 | ||
57 | setOwnerField(); | 68 | setOwnerField(); |
58 | init(); | 69 | init(); |
59 | refresh(); | 70 | loadPlugins(); |
71 | draw(); | ||
60 | showMaximized(); | 72 | showMaximized(); |
61 | } | 73 | } |
62 | 74 | ||
63 | /** | 75 | /** |
64 | * Qcop receive method. | 76 | * Qcop receive method. |
65 | */ | 77 | */ |
66 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 78 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
67 | QDataStream stream( data, IO_ReadOnly ); | 79 | QDataStream stream( data, IO_ReadOnly ); |
68 | if ( msg == "message(QString)" ) { | 80 | if ( msg == "message(QString)" ) { |
69 | QString message; | 81 | QString message; |
70 | stream >> message; | 82 | stream >> message; |
71 | setOwnerField( message ); | 83 | setOwnerField( message ); |
72 | } | 84 | } |
73 | } | 85 | } |
74 | 86 | ||
75 | /** | 87 | /** |
76 | * Initialises the owner field with the default value, the username | 88 | * Initialises the owner field with the default value, the username |
77 | */ | 89 | */ |
78 | void Today::setOwnerField() { | 90 | void Today::setOwnerField() { |
79 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 91 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); |
80 | if ( QFile::exists( file ) ) { | 92 | if ( QFile::exists( file ) ) { |
81 | Contact cont = Contact::readVCard( file )[0]; | 93 | Contact cont = Contact::readVCard( file )[0]; |
82 | QString returnString = cont.fullName(); | 94 | QString returnString = cont.fullName(); |
83 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 95 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
84 | } else { | 96 | } else { |
85 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 97 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
86 | } | 98 | } |
87 | } | 99 | } |
88 | 100 | ||
89 | /** | 101 | /** |
90 | * Set the owner field with a given QString, for example per qcop. | 102 | * Set the owner field with a given QString, for example per qcop. |
91 | */ | 103 | */ |
@@ -95,211 +107,212 @@ void Today::setOwnerField( QString &message ) { | |||
95 | } | 107 | } |
96 | } | 108 | } |
97 | 109 | ||
98 | 110 | ||
99 | /** | 111 | /** |
100 | * Init stuff needed for today. Reads the config file. | 112 | * Init stuff needed for today. Reads the config file. |
101 | */ | 113 | */ |
102 | void Today::init() { | 114 | void Today::init() { |
103 | 115 | ||
104 | QDate date = QDate::currentDate(); | 116 | QDate date = QDate::currentDate(); |
105 | QString time = ( tr( date.toString() ) ); | 117 | QString time = ( tr( date.toString() ) ); |
106 | 118 | ||
107 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 119 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
108 | 120 | ||
109 | // read config | 121 | // read config |
110 | Config cfg( "today" ); | 122 | Config cfg( "today" ); |
111 | 123 | ||
112 | cfg.setGroup( "Applets" ); | 124 | cfg.setGroup( "Applets" ); |
113 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 125 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
114 | } | 126 | } |
115 | 127 | ||
116 | 128 | ||
117 | /** | 129 | /** |
118 | * Load the plugins | 130 | * Load the plugins |
119 | */ | 131 | */ |
120 | void Today::loadPlugins() { | 132 | void Today::loadPlugins() { |
121 | 133 | ||
122 | QValueList<TodayPlugin>::Iterator tit; | 134 | QValueList<TodayPlugin>::Iterator tit; |
123 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 135 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
124 | (*tit).library->unload(); | 136 | (*tit).library->unload(); |
125 | delete (*tit).library; | 137 | delete (*tit).library; |
126 | } | 138 | } |
139 | pluginList.clear(); | ||
127 | 140 | ||
128 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 141 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
129 | QDir dir( path, "lib*.so" ); | 142 | QDir dir( path, "lib*.so" ); |
130 | 143 | ||
131 | QStringList list = dir.entryList(); | 144 | QStringList list = dir.entryList(); |
132 | QStringList::Iterator it; | 145 | QStringList::Iterator it; |
133 | 146 | ||
134 | uint count = 0; | 147 | uint count = 0; |
135 | for ( it = list.begin(); it != list.end(); ++it ) { | 148 | for ( it = list.begin(); it != list.end(); ++it ) { |
136 | TodayPluginInterface *iface = 0; | 149 | TodayPluginInterface *iface = 0; |
137 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 150 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
138 | 151 | ||
139 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 152 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
140 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 153 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
141 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | 154 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); |
142 | qDebug( QString(*it).latin1() ); | 155 | qDebug( QString(*it) ); |
143 | TodayPlugin plugin; | 156 | TodayPlugin plugin; |
144 | plugin.library = lib; | 157 | plugin.library = lib; |
145 | plugin.iface = iface; | 158 | plugin.iface = iface; |
146 | plugin.name = QString(*it).latin1(); | 159 | plugin.name = QString(*it); |
147 | 160 | ||
148 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 161 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
149 | plugin.active = true; | 162 | plugin.active = true; |
150 | } else { | 163 | } else { |
151 | plugin.active = false; | 164 | plugin.active = false; |
152 | } | 165 | } |
153 | plugin.guiPart = plugin.iface->guiPart(); | 166 | plugin.guiPart = plugin.iface->guiPart(); |
167 | |||
168 | plugin.guiBox = new QHBox( this ); | ||
169 | QPixmap plugPix; | ||
170 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); | ||
171 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | ||
172 | plugIcon->setPixmap( plugPix ); | ||
173 | QScrollView* sv = new QScrollView( plugin.guiBox ); | ||
174 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | ||
175 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); | ||
176 | //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); | ||
177 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
178 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
179 | sv->setFrameShape( QFrame::NoFrame ); | ||
180 | sv->addChild( plugWidget ); | ||
181 | |||
182 | //plugin.guiBox->addWidget( plugIcon, 0, AlignTop ); | ||
183 | //plugin.guiBox->addWidget( sv, 0, AlignTop ); | ||
184 | plugin.guiBox->setStretchFactor( plugIcon, 1 ); | ||
185 | plugin.guiBox->setStretchFactor( sv, 9 ); | ||
186 | layout->addWidget( plugin.guiBox ); | ||
187 | |||
154 | pluginList.append( plugin ); | 188 | pluginList.append( plugin ); |
155 | count++; | 189 | count++; |
156 | } else { | 190 | } else { |
157 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 191 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
158 | delete lib; | 192 | delete lib; |
159 | } | 193 | } |
160 | } | 194 | } |
161 | } | 195 | } |
162 | 196 | ||
163 | 197 | ||
164 | /** | 198 | /** |
165 | * Repaint method. Reread all fields. | 199 | * Repaint method. Reread all fields. |
166 | */ | 200 | */ |
167 | void Today::draw() { | 201 | void Today::draw() { |
168 | 202 | ||
169 | if ( pluginLayout ) { | ||
170 | delete pluginLayout; | ||
171 | } | ||
172 | pluginLayout = new QVBoxLayout( layout ); | ||
173 | |||
174 | if ( pluginList.count() == 0 ) { | 203 | if ( pluginList.count() == 0 ) { |
175 | QLabel *noPlugins = new QLabel( this ); | 204 | QLabel *noPlugins = new QLabel( this ); |
176 | noPlugins->setText( tr( "No plugins found" ) ); | 205 | noPlugins->setText( tr( "No plugins found" ) ); |
177 | layout->addWidget( noPlugins ); | 206 | layout->addWidget( noPlugins ); |
178 | return; | 207 | return; |
179 | } | 208 | } |
180 | 209 | ||
181 | uint count = 0; | 210 | uint count = 0; |
182 | TodayPlugin plugin; | 211 | TodayPlugin plugin; |
183 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 212 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
184 | plugin = pluginList[i]; | 213 | plugin = pluginList[i]; |
185 | 214 | ||
186 | if ( plugin.active ) { | 215 | if ( plugin.active ) { |
187 | QHBoxLayout* plugLayout = new QHBoxLayout( this ); | 216 | qDebug( plugin.name + " is ACTIVE " ); |
188 | QPixmap plugPix; | 217 | // QHBoxLayout* plugLayout = new QHBoxLayout( this ); |
189 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); | 218 | plugin.guiBox->show(); |
190 | OClickableLabel* plugIcon = new OClickableLabel( this ); | 219 | } else { |
191 | plugIcon->setPixmap( plugPix ); | 220 | // plugin.guiWidget->hide(); |
192 | QScrollView* sv = new QScrollView( this ); | 221 | qDebug( plugin.name + " is INACTIVE" ); |
193 | QWidget* plugWidget = plugin.guiPart->widget( sv->viewport() ); | 222 | plugin.guiBox->hide(); |
194 | // plugWidget->reparent( sv->viewport(), QPoint( 0, 0 ) ); | 223 | } |
195 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); | 224 | count++; |
196 | //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); | ||
197 | |||
198 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
199 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
200 | sv->setFrameShape( QFrame::NoFrame ); | ||
201 | sv->addChild( plugWidget ); | ||
202 | |||
203 | plugLayout->addWidget( plugIcon, 0, AlignTop ); | ||
204 | plugLayout->addWidget( sv, 0, AlignTop ); | ||
205 | plugLayout->setStretchFactor( plugIcon, 1 ); | ||
206 | plugLayout->setStretchFactor( sv, 9 ); | ||
207 | pluginLayout->addLayout( plugLayout ); | ||
208 | count++; | ||
209 | } | ||
210 | } | 225 | } |
211 | 226 | ||
212 | if ( count == 0 ) { | 227 | if ( count == 0 ) { |
213 | QLabel *noPluginsActive = new QLabel( this ); | 228 | QLabel *noPluginsActive = new QLabel( this ); |
214 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 229 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
215 | layout->addWidget( noPluginsActive ); | 230 | layout->addWidget( noPluginsActive ); |
216 | } | 231 | } |
217 | 232 | ||
218 | layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 233 | layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
219 | |||
220 | |||
221 | // how often refresh - later have qcop update calls in *db | ||
222 | // QTimer::singleShot( 20*1000, this, SLOT( draw() ) ); | ||
223 | } | ||
224 | |||
225 | |||
226 | void Today::refresh() { | ||
227 | loadPlugins(); | ||
228 | draw(); | ||
229 | qDebug( "redraw" ); | ||
230 | // QTimer::singleShot( 30*1000, this, SLOT( refresh() ) ); | ||
231 | } | 234 | } |
232 | 235 | ||
233 | 236 | ||
234 | /** | 237 | /** |
235 | * The method for the configuration dialog. | 238 | * The method for the configuration dialog. |
236 | */ | 239 | */ |
237 | void Today::startConfig() { | 240 | void Today::startConfig() { |
238 | conf = new TodayConfig ( this, "", true ); | 241 | |
239 | 242 | TodayConfig conf( this, "dialog", true ); | |
240 | uint count = 0; | 243 | |
241 | TodayPlugin plugin; | 244 | TodayPlugin plugin; |
242 | 245 | ||
243 | QList<ConfigWidget> configWidgetList; | 246 | QList<ConfigWidget> configWidgetList; |
244 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 247 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
245 | plugin = pluginList[i]; | 248 | plugin = pluginList[i]; |
246 | 249 | ||
247 | // load the config widgets in the tabs | 250 | // load the config widgets in the tabs |
248 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 251 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
249 | ConfigWidget* widget = plugin.guiPart->configWidget( this ); | 252 | ConfigWidget* widget = plugin.guiPart->configWidget( this ); |
250 | widget->reparent( conf , QPoint( 0,0 ) ); | 253 | configWidgetList.append( widget ); |
251 | configWidgetList.append( widget ); | 254 | conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() ); |
252 | conf->TabWidget3->insertTab( widget, plugin.guiPart->appName() ); | 255 | } |
253 | } | 256 | // set the order/activate tab |
254 | // set the order/activate tab | 257 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), |
255 | conf->pluginManagement( plugin.name, plugin.guiPart->pluginName(), | ||
256 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | 258 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); |
257 | count++; | 259 | } |
258 | } | ||
259 | 260 | ||
260 | conf->showMaximized(); | 261 | conf.exec(); |
262 | if ( conf.exec() == QDialog::Accepted ) { | ||
263 | conf.writeConfig(); | ||
264 | ConfigWidget *confWidget; | ||
265 | for ( confWidget = configWidgetList.first(); confWidget != 0; | ||
266 | confWidget = configWidgetList.next() ) { | ||
267 | confWidget->writeConfig(); | ||
268 | } | ||
269 | init(); | ||
261 | 270 | ||
262 | if ( conf->exec() == QDialog::Accepted ) { | ||
263 | ConfigWidget *confWidget; | ||
264 | for ( confWidget=configWidgetList.first(); confWidget != 0; | ||
265 | confWidget = configWidgetList.next() ) { | ||
266 | confWidget->writeConfig(); | ||
267 | } | ||
268 | conf->writeConfig(); | ||
269 | 271 | ||
270 | init(); | 272 | TodayPlugin plugin; |
271 | loadPlugins(); | 273 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
272 | draw(); | 274 | plugin = pluginList[i]; |
273 | } | 275 | |
274 | delete conf; | 276 | if ( m_excludeApplets.grep( plugin.name ).isEmpty() ) { |
277 | qDebug("CONFIG" + plugin.name + "ACTIVE"); | ||
278 | plugin.active = true; | ||
279 | } else { | ||
280 | qDebug("CONFIG" + plugin.name + "INACTIVE"); | ||
281 | |||
282 | plugin.active = false; | ||
283 | } | ||
284 | } | ||
285 | |||
286 | draw(); | ||
287 | } | ||
275 | } | 288 | } |
276 | 289 | ||
277 | 290 | ||
278 | void Today::startAddressbook() { | 291 | void Today::startAddressbook() { |
279 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 292 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
280 | e << QString( "addressbook" ); | 293 | e << QString( "addressbook" ); |
281 | } | 294 | } |
282 | 295 | ||
283 | 296 | ||
284 | /** | 297 | /** |
285 | * launch addressbook (personal card) | 298 | * launch addressbook (personal card) |
286 | */ | 299 | */ |
287 | void Today::editCard() { | 300 | void Today::editCard() { |
288 | startAddressbook(); | 301 | startAddressbook(); |
289 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { | 302 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { |
290 | qApp->processEvents(); | 303 | qApp->processEvents(); |
291 | } | 304 | } |
292 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); | 305 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); |
293 | } | 306 | } |
294 | 307 | ||
295 | /* | 308 | /* |
296 | * launches an App | 309 | * launches an App |
297 | */ | 310 | */ |
298 | void Today::launchApp( QString appName ) { | 311 | void Today::launchApp( QString appName ) { |
299 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 312 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
300 | e << QString( appName ); | 313 | e << QString( appName ); |
301 | } | 314 | } |
302 | 315 | ||
303 | Today::~Today() { | 316 | Today::~Today() { |
304 | } | 317 | } |
305 | 318 | ||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index ca17020..0a9a705 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -1,81 +1,73 @@ | |||
1 | /* | 1 | /* |
2 | * today.h | 2 | * today.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 TODAY_H | 18 | #ifndef TODAY_H |
19 | #define TODAY_H | 19 | #define TODAY_H |
20 | 20 | ||
21 | #include <opie/tododb.h> | 21 | #include <opie/tododb.h> |
22 | 22 | ||
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | #include <qhbox.h> | ||
25 | 26 | ||
26 | #include <qpe/qlibrary.h> | 27 | #include <qpe/qlibrary.h> |
27 | #include <qpe/event.h> | 28 | #include <qpe/event.h> |
28 | 29 | ||
29 | #include "todayconfig.h" | 30 | #include "todayconfig.h" |
30 | #include "todaybase.h" | 31 | #include "todaybase.h" |
31 | #include "todayplugininterface.h" | 32 | #include "todayplugininterface.h" |
32 | 33 | ||
33 | class QVBoxLayout; | 34 | class QVBoxLayout; |
34 | 35 | ||
35 | struct TodayPlugin { | ||
36 | QLibrary *library; | ||
37 | TodayPluginInterface *iface; | ||
38 | TodayPluginObject *guiPart; | ||
39 | QString name; | ||
40 | bool active; | ||
41 | int pos; | ||
42 | }; | ||
43 | 36 | ||
44 | class Today : public TodayBase { | 37 | class Today : public TodayBase { |
45 | 38 | ||
46 | Q_OBJECT | 39 | Q_OBJECT |
47 | 40 | ||
48 | public: | 41 | public: |
49 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 42 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
50 | ~Today(); | 43 | ~Today(); |
51 | 44 | ||
52 | private slots: | 45 | private slots: |
53 | void startConfig(); | 46 | void startConfig(); |
54 | void startAddressbook(); | 47 | void startAddressbook(); |
55 | void launchApp( QString appName ); | 48 | void launchApp( QString appName ); |
56 | void editCard(); | 49 | void editCard(); |
57 | void draw(); | 50 | void draw(); |
58 | void refresh(); | ||
59 | 51 | ||
60 | private: | 52 | private: |
61 | void init(); | 53 | void init(); |
62 | void setOwnerField(); | 54 | void setOwnerField(); |
63 | void setOwnerField(QString &string); | 55 | void setOwnerField(QString &string); |
64 | void loadPlugins(); | 56 | void loadPlugins(); |
65 | 57 | ||
66 | private slots: | 58 | private slots: |
67 | void channelReceived(const QCString &msg, const QByteArray & data); | 59 | void channelReceived(const QCString &msg, const QByteArray & data); |
68 | 60 | ||
69 | private: | 61 | private: |
70 | TodayConfig *conf; | 62 | TodayConfig *conf; |
71 | QStringList m_excludeApplets; | 63 | QStringList m_excludeApplets; |
72 | 64 | ||
73 | QVBoxLayout *pluginLayout; | 65 | QVBoxLayout *pluginLayout; |
74 | 66 | ||
75 | // QString m_autoStartTimer; | 67 | // QString m_autoStartTimer; |
76 | int m_newStart; | 68 | int m_newStart; |
77 | // int m_autoStart; | 69 | // int m_autoStart; |
78 | int m_maxCharClip; | 70 | int m_maxCharClip; |
79 | }; | 71 | }; |
80 | 72 | ||
81 | #endif | 73 | #endif |
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 08e59c0..79c4d1f 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -1,141 +1,138 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.cpp | 2 | * todayconfig.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 "todayconfig.h" | 17 | #include "todayconfig.h" |
18 | 18 | ||
19 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | 22 | ||
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qheader.h> | 28 | #include <qheader.h> |
29 | #include <qhbox.h> | 29 | #include <qhbox.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | #include <qtoolbutton.h> | 31 | #include <qtoolbutton.h> |
32 | 32 | ||
33 | // for getenv | ||
34 | #include <stdlib.h> | ||
35 | |||
36 | class ToolButton : public QToolButton { | 33 | class ToolButton : public QToolButton { |
34 | |||
37 | public: | 35 | public: |
38 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 36 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
39 | : QToolButton( parent, name ) { | 37 | : QToolButton( parent, name ) { |
40 | setTextLabel( name ); | 38 | // setTextLabel( name ); |
41 | setPixmap( Resource::loadPixmap( icon ) ); | 39 | setPixmap( Resource::loadPixmap( icon ) ); |
42 | setAutoRaise( TRUE ); | 40 | setAutoRaise( TRUE ); |
43 | setFocusPolicy( QWidget::NoFocus ); | 41 | setFocusPolicy( QWidget::NoFocus ); |
44 | setToggleButton( t ); | 42 | setToggleButton( t ); |
45 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 43 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
46 | } | 44 | } |
47 | }; | 45 | }; |
48 | 46 | ||
49 | 47 | ||
50 | /** | 48 | /** |
51 | * The class has currently quite some duplicate code. | 49 | * The class has currently quite some duplicate code. |
52 | * By that way it would be real easy to have it as seperate app in settings tab | 50 | * By that way it would be real easy to have it as seperate app in settings tab |
53 | * | 51 | * |
54 | */ | 52 | */ |
55 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) | 53 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) |
56 | : QDialog( parent, name, modal, fl ) { | 54 | : QDialog( parent, name, modal, fl ) { |
57 | 55 | ||
58 | if ( !name ) { | ||
59 | setName( "todayconfig" ); | ||
60 | } | ||
61 | setCaption( tr( "Today config" ) ); | 56 | setCaption( tr( "Today config" ) ); |
62 | 57 | ||
63 | QVBoxLayout *layout = new QVBoxLayout( this ); | 58 | QVBoxLayout *layout = new QVBoxLayout( this ); |
64 | TabWidget3 = new QTabWidget( this, "TabWidget3" ); | 59 | TabWidget3 = new QTabWidget( this, "TabWidget3" ); |
65 | TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); | 60 | // TabWidget3->setFrameShape( QFrame::NoFrame ); |
61 | //TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); | ||
66 | TabWidget3->setAutoMask( FALSE ); | 62 | TabWidget3->setAutoMask( FALSE ); |
67 | TabWidget3->setTabShape( QTabWidget::Rounded ); | 63 | TabWidget3->setTabShape( QTabWidget::Rounded ); |
68 | layout->addWidget( TabWidget3 ); | 64 | layout->addWidget( TabWidget3 ); |
69 | 65 | ||
70 | tab_2 = new QWidget( TabWidget3, "tab_2" ); | 66 | tab_2 = new QWidget( TabWidget3, "tab_2" ); |
71 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); | 67 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); |
72 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); | 68 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); |
73 | tab2Layout->addWidget( l ); | 69 | tab2Layout->addWidget( l ); |
74 | QHBox *hbox1 = new QHBox( tab_2 ); | 70 | QHBox *hbox1 = new QHBox( tab_2 ); |
75 | m_appletListView = new QListView( hbox1 ); | 71 | m_appletListView = new QListView( hbox1 ); |
76 | m_appletListView->addColumn( "PluginList" ); | 72 | m_appletListView->addColumn( "PluginList" ); |
77 | m_appletListView->header()->hide(); | 73 | m_appletListView->header()->hide(); |
78 | QVBox *vbox1 = new QVBox( hbox1 ); | 74 | QVBox *vbox1 = new QVBox( hbox1 ); |
79 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); | 75 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); |
80 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); | 76 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); |
81 | tab2Layout->addWidget( hbox1 ); | 77 | tab2Layout->addWidget( hbox1 ); |
82 | 78 | ||
83 | TabWidget3->insertTab( tab_2, tr( "active/order" ) ); | 79 | TabWidget3->insertTab( tab_2, tr( "active/order" ) ); |
84 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | 80 | tab_3 = new QWidget( TabWidget3, "tab_3" ); |
85 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | 81 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); |
86 | QHBox *hbox_clip = new QHBox( tab_3 ); | 82 | QHBox *hbox_clip = new QHBox( tab_3 ); |
87 | TextLabel1 = new QLabel( hbox_clip, "TextLabel1" ); | 83 | TextLabel1 = new QLabel( hbox_clip, "TextLabel1" ); |
88 | TextLabel1->setText( tr( "Clip after how\n" | 84 | TextLabel1->setText( tr( "Clip after how\n" |
89 | "many letters" ) ); | 85 | "many letters" ) ); |
90 | SpinBox7 = new QSpinBox( hbox_clip, "SpinBox7" ); | 86 | SpinBox7 = new QSpinBox( hbox_clip, "SpinBox7" ); |
91 | SpinBox7->setMaxValue( 80 ); | 87 | SpinBox7->setMaxValue( 80 ); |
92 | QHBox *hbox_auto = new QHBox( tab_3 ); | 88 | QHBox *hbox_auto = new QHBox( tab_3 ); |
93 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); | 89 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); |
94 | TextLabel2->setText( tr( "autostart on \nresume? (Opie only)" ) ); | 90 | TextLabel2->setText( tr( "autostart on \nresume? (Opie only)" ) ); |
95 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); | 91 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); |
96 | QHBox *hbox_inactive = new QHBox( tab_3 ); | 92 | QHBox *hbox_inactive = new QHBox( tab_3 ); |
97 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); | 93 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); |
98 | TimeLabel->setText( tr( "minutes inactive" ) ); | 94 | TimeLabel->setText( tr( "minutes inactive" ) ); |
99 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner"); | 95 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner"); |
100 | tab3Layout->addWidget( hbox_clip ); | 96 | tab3Layout->addWidget( hbox_clip ); |
101 | tab3Layout->addWidget( hbox_auto ); | 97 | tab3Layout->addWidget( hbox_auto ); |
102 | tab3Layout->addWidget( hbox_inactive ); | 98 | tab3Layout->addWidget( hbox_inactive ); |
103 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); | 99 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); |
104 | 100 | ||
105 | m_applets_changed = false; | 101 | m_applets_changed = false; |
106 | 102 | ||
107 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); | 103 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); |
108 | 104 | ||
109 | readConfig(); | 105 | readConfig(); |
106 | showMaximized(); | ||
110 | } | 107 | } |
111 | 108 | ||
112 | 109 | ||
113 | /** | 110 | /** |
114 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 111 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
115 | * If registered against that today ist started on each resume. | 112 | * If registered against that today ist started on each resume. |
116 | */ | 113 | */ |
117 | void TodayConfig::setAutoStart() { | 114 | void TodayConfig::setAutoStart() { |
118 | Config cfg( "today" ); | 115 | Config cfg( "today" ); |
119 | cfg.setGroup( "Autostart" ); | 116 | cfg.setGroup( "Autostart" ); |
120 | int autostart = cfg.readNumEntry( "autostart", 1); | 117 | int autostart = cfg.readNumEntry( "autostart", 1); |
121 | if ( autostart ) { | 118 | if ( autostart ) { |
122 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 119 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
123 | e << QString( "add" ); | 120 | e << QString( "add" ); |
124 | e << QString( "today" ); | 121 | e << QString( "today" ); |
125 | e << m_autoStartTimer; | 122 | e << m_autoStartTimer; |
126 | } else { | 123 | } else { |
127 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); | 124 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); |
128 | e << QString( "remove"); | 125 | e << QString( "remove"); |
129 | e << QString( "today" ); | 126 | e << QString( "today" ); |
130 | } | 127 | } |
131 | } | 128 | } |
132 | 129 | ||
133 | /** | 130 | /** |
134 | * Read the config part | 131 | * Read the config part |
135 | */ | 132 | */ |
136 | void TodayConfig::readConfig() { | 133 | void TodayConfig::readConfig() { |
137 | Config cfg( "today" ); | 134 | Config cfg( "today" ); |
138 | cfg.setGroup( "Autostart" ); | 135 | cfg.setGroup( "Autostart" ); |
139 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 136 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
140 | CheckBoxAuto->setChecked( m_autoStart ); | 137 | CheckBoxAuto->setChecked( m_autoStart ); |
141 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); | 138 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); |