author | zecke <zecke> | 2004-09-12 20:27:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-12 20:27:35 (UTC) |
commit | 00952f16786dcd069820e45df83a00b6c477893b (patch) (unidiff) | |
tree | ceb7ec8add37ea596c4953eab704ec24890cbb31 | |
parent | b78e2e2486cdb69a173cb6ff1910c69f5381d850 (diff) | |
download | opie-00952f16786dcd069820e45df83a00b6c477893b.zip opie-00952f16786dcd069820e45df83a00b6c477893b.tar.gz opie-00952f16786dcd069820e45df83a00b6c477893b.tar.bz2 |
-Define ownership of widget and configwidget
-Implement C'tor and D'tor of TodayConfigWidget
-rw-r--r-- | libopie2/opiepim/ui/todayconfigwidget.cpp | 9 | ||||
-rw-r--r-- | libopie2/opiepim/ui/todayconfigwidget.h | 6 | ||||
-rw-r--r-- | libopie2/opiepim/ui/todayplugininterface.h | 11 | ||||
-rw-r--r-- | libopie2/opiepim/ui/ui.pro | 5 |
4 files changed, 25 insertions, 6 deletions
diff --git a/libopie2/opiepim/ui/todayconfigwidget.cpp b/libopie2/opiepim/ui/todayconfigwidget.cpp new file mode 100644 index 0000000..cc98556 --- a/dev/null +++ b/libopie2/opiepim/ui/todayconfigwidget.cpp | |||
@@ -0,0 +1,9 @@ | |||
1 | #include "todayconfigwidget.h" | ||
2 | |||
3 | |||
4 | TodayConfigWidget::TodayConfigWidget( QWidget* parent, const char* name, WFlags fl ) | ||
5 | : QWidget( parent, name, fl ) | ||
6 | {} | ||
7 | |||
8 | TodayConfigWidget::~TodayConfigWidget() | ||
9 | {} | ||
diff --git a/libopie2/opiepim/ui/todayconfigwidget.h b/libopie2/opiepim/ui/todayconfigwidget.h index 134fbdf..5048998 100644 --- a/libopie2/opiepim/ui/todayconfigwidget.h +++ b/libopie2/opiepim/ui/todayconfigwidget.h | |||
@@ -1,40 +1,40 @@ | |||
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 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * A base class for all Today Config Widgets. | 8 | * A base class for all Today Config Widgets. |
9 | * This will let a Today plugin to add the possibility of configuration. | 9 | * This will let a Today plugin to add the possibility of configuration. |
10 | * Plugins need to inherit from this class and need to implement | 10 | * Plugins need to inherit from this class and need to implement |
11 | * the pure virtual method to control configuration. | 11 | * the pure virtual method to control configuration. |
12 | * The Plugin should read its configuration during creation of the Widget | 12 | * The Plugin should read its configuration during creation of the Widget |
13 | * | 13 | * |
14 | * | 14 | * |
15 | * @author Maximilian Reiß | 15 | * @author Maximilian Reiß |
16 | * @short base class of all today config widgets | 16 | * @short base class of all today config widgets |
17 | */ | 17 | */ |
18 | class TodayConfigWidget : public QWidget { | 18 | class TodayConfigWidget : public QWidget { |
19 | 19 | Q_OBJECT | |
20 | 20 | ||
21 | public: | 21 | public: |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * This will construct the widget. The widget gets deleted once the parent | 24 | * This will construct the widget. The widget gets deleted once the parent |
25 | * gets deleted as in any Qt application | 25 | * gets deleted as in any Qt application |
26 | * | 26 | * |
27 | * @param parent The parent of the widget | 27 | * @param parent The parent of the widget |
28 | * @param name The name of the object | 28 | * @param name The name of the object |
29 | */ | 29 | */ |
30 | TodayConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; | 30 | TodayConfigWidget( QWidget *parent, const char *name = 0, WFlags fl = 0 ); |
31 | virtual ~TodayConfigWidget() {}; | 31 | virtual ~TodayConfigWidget(); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Plugins need to reimplement this in the config widget | 34 | * Plugins need to reimplement this in the config widget |
35 | * Used when the config dialog is closed to write config stuff | 35 | * Used when the config dialog is closed to write config stuff |
36 | */ | 36 | */ |
37 | virtual void writeConfig() = 0; | 37 | virtual void writeConfig() = 0; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | #endif | 40 | #endif |
diff --git a/libopie2/opiepim/ui/todayplugininterface.h b/libopie2/opiepim/ui/todayplugininterface.h index 5dfeaa8..2b7f1e5 100644 --- a/libopie2/opiepim/ui/todayplugininterface.h +++ b/libopie2/opiepim/ui/todayplugininterface.h | |||
@@ -1,133 +1,142 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> | 3 | Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | 31 | ||
32 | #ifndef TODAY_PLUGIN_INTERFACE | 32 | #ifndef TODAY_PLUGIN_INTERFACE |
33 | #define TODAY_PLUGIN_INTERFACE | 33 | #define TODAY_PLUGIN_INTERFACE |
34 | 34 | ||
35 | #include <qpe/qcom.h> | 35 | #include <qpe/qcom.h> |
36 | #include "todayconfigwidget.h" | 36 | #include "todayconfigwidget.h" |
37 | 37 | ||
38 | class QString; | 38 | class QString; |
39 | class QWidget; | 39 | class QWidget; |
40 | 40 | ||
41 | #ifndef IID_TodayPluginInterface | 41 | #ifndef IID_TodayPluginInterface |
42 | #define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) | 42 | #define IID_TodayPluginInterface QUuid( 0x70481804, 0x2b50, 0x4fba, 0x80, 0xbb, 0x0b, 0xf8, 0xdc, 0x72, 0x04, 0x14) |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * | 46 | * |
47 | * A TodayPluginObject is the base for all Today Plugins. | 47 | * A TodayPluginObject is the base for all Today Plugins. |
48 | * A plugin author needs to inherit this class and implement | 48 | * A plugin author needs to inherit this class and implement |
49 | * the pure virtual methods | 49 | * the pure virtual methods |
50 | * | 50 | * |
51 | * @short base class for today plugins | 51 | * @short base class for today plugins |
52 | * @author Maximilian Reiss | 52 | * @author Maximilian Reiss |
53 | * | 53 | * |
54 | */ | 54 | */ |
55 | class TodayPluginObject { | 55 | class TodayPluginObject { |
56 | 56 | ||
57 | public: | 57 | public: |
58 | 58 | ||
59 | virtual ~TodayPluginObject() {}; | 59 | virtual ~TodayPluginObject() {}; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * The name if the plugin | 62 | * The name if the plugin |
63 | * @return The plugin should return its name here | 63 | * @return The plugin should return its name here |
64 | */ | 64 | */ |
65 | virtual QString pluginName() const = 0; | 65 | virtual QString pluginName() const = 0; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Version numbering | 68 | * Version numbering |
69 | * @return The plugin should return the version number | 69 | * @return The plugin should return the version number |
70 | */ | 70 | */ |
71 | virtual double versionNumber() const = 0; | 71 | virtual double versionNumber() const = 0; |
72 | 72 | ||
73 | 73 | ||
74 | /** | 74 | /** |
75 | * @return the pixmap name widget?! -- FIXME | 75 | * @return the pixmap name widget?! -- FIXME |
76 | */ | 76 | */ |
77 | virtual QString pixmapNameWidget() const = 0; | 77 | virtual QString pixmapNameWidget() const = 0; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * widget for the today view | 80 | * widget for the today view |
81 | * It _needs_ a parent here. | 81 | * It _needs_ a parent here. |
82 | * Plugin authors need to take parent as parent! | 82 | * Plugin authors need to take parent as parent! |
83 | * | ||
84 | * Note that you always need to create a new QWidget | ||
85 | * on this call and the ownership is transfered to the | ||
86 | * caller. | ||
87 | * | ||
88 | * @param The parent of your to be created widget | ||
83 | */ | 89 | */ |
84 | virtual QWidget* widget( QWidget *parent ) = 0; | 90 | virtual QWidget* widget( QWidget *parent ) = 0; |
85 | 91 | ||
86 | /** | 92 | /** |
87 | * Pixmap used in the config widget | 93 | * Pixmap used in the config widget |
88 | */ | 94 | */ |
89 | virtual QString pixmapNameConfig() const = 0; | 95 | virtual QString pixmapNameConfig() const = 0; |
90 | 96 | ||
91 | /** | 97 | /** |
92 | * Config plugin widget - optional | 98 | * Config plugin widget - optional |
93 | * If the plugin has a config widget, it _needs_ a parent here. | 99 | * If the plugin has a config widget, it _needs_ a parent here. |
94 | * may return 0 if no config widget is needed | 100 | * may return 0 if no config widget is needed |
101 | * | ||
102 | * Note: Always create a new Widget on this call and ownership | ||
103 | * is transfered | ||
95 | */ | 104 | */ |
96 | virtual TodayConfigWidget* configWidget( QWidget * ) = 0; | 105 | virtual TodayConfigWidget* configWidget( QWidget *parent ) = 0; |
97 | 106 | ||
98 | /** | 107 | /** |
99 | * The application that should be assigned to the button (pixmap) | 108 | * The application that should be assigned to the button (pixmap) |
100 | * Today will show the plugin icon. On click it tries to execute the | 109 | * Today will show the plugin icon. On click it tries to execute the |
101 | * plugin related application. | 110 | * plugin related application. |
102 | */ | 111 | */ |
103 | virtual QString appName() const = 0; | 112 | virtual QString appName() const = 0; |
104 | 113 | ||
105 | 114 | ||
106 | /** | 115 | /** |
107 | * If the plugin should take part in the periodic refresh | 116 | * If the plugin should take part in the periodic refresh |
108 | */ | 117 | */ |
109 | virtual bool excludeFromRefresh() const = 0; | 118 | virtual bool excludeFromRefresh() const = 0; |
110 | 119 | ||
111 | /** | 120 | /** |
112 | * Refresh that plugins view. For updating the plugins | 121 | * Refresh that plugins view. For updating the plugins |
113 | */ | 122 | */ |
114 | virtual void refresh() {}; | 123 | virtual void refresh() {}; |
115 | 124 | ||
116 | /** | 125 | /** |
117 | * reread the plugins config and act apropiate | 126 | * reread the plugins config and act apropiate |
118 | * This is for example used when returning from the config dialog | 127 | * This is for example used when returning from the config dialog |
119 | */ | 128 | */ |
120 | virtual void reinitialize() {}; | 129 | virtual void reinitialize() {}; |
121 | }; | 130 | }; |
122 | 131 | ||
123 | /** | 132 | /** |
124 | * This is part of the QCOM works. See example plugins how to do it right | 133 | * This is part of the QCOM works. See example plugins how to do it right |
125 | */ | 134 | */ |
126 | struct TodayPluginInterface : public QUnknownInterface { | 135 | struct TodayPluginInterface : public QUnknownInterface { |
127 | /** | 136 | /** |
128 | * return the TodayPluginObject implementation | 137 | * return the TodayPluginObject implementation |
129 | */ | 138 | */ |
130 | virtual TodayPluginObject *guiPart() = 0; | 139 | virtual TodayPluginObject *guiPart() = 0; |
131 | }; | 140 | }; |
132 | 141 | ||
133 | #endif | 142 | #endif |
diff --git a/libopie2/opiepim/ui/ui.pro b/libopie2/opiepim/ui/ui.pro index 6aa01a7..53c7ae2 100644 --- a/libopie2/opiepim/ui/ui.pro +++ b/libopie2/opiepim/ui/ui.pro | |||
@@ -1,9 +1,10 @@ | |||
1 | HEADERS += ui/opimmainwindow.h \ | 1 | HEADERS += ui/opimmainwindow.h \ |
2 | ui/opimrecurrencewidget.h \ | 2 | ui/opimrecurrencewidget.h \ |
3 | ui/todayconfigwidget.h \ | 3 | ui/todayconfigwidget.h \ |
4 | ui/todayplugininterface.h | 4 | ui/todayplugininterface.h |
5 | 5 | ||
6 | SOURCES += ui/opimmainwindow.cpp \ | 6 | SOURCES += ui/opimmainwindow.cpp \ |
7 | ui/opimrecurrencewidget.cpp | 7 | ui/opimrecurrencewidget.cpp \ |
8 | ui/todayconfigwidget.cpp | ||
8 | 9 | ||
9 | INTERFACES += ui/opimrecurrencebase.ui \ No newline at end of file | 10 | INTERFACES += ui/opimrecurrencebase.ui |