author | zecke <zecke> | 2004-09-12 20:28:36 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-12 20:28:36 (UTC) |
commit | 90aaa298cc69522e88e1f81ade7d5259131b1544 (patch) (unidiff) | |
tree | 86bdb0a2bb94938754ba94f2ded9dc6ec5fb5207 /examples/todayplugin | |
parent | 00952f16786dcd069820e45df83a00b6c477893b (diff) | |
download | opie-90aaa298cc69522e88e1f81ade7d5259131b1544.zip opie-90aaa298cc69522e88e1f81ade7d5259131b1544.tar.gz opie-90aaa298cc69522e88e1f81ade7d5259131b1544.tar.bz2 |
Follow the defined Ownership and have a maybe not needed
sanity check
-rw-r--r-- | examples/todayplugin/exampleplugin.cpp | 10 | ||||
-rw-r--r-- | examples/todayplugin/exampleplugin.h | 8 |
2 files changed, 6 insertions, 12 deletions
diff --git a/examples/todayplugin/exampleplugin.cpp b/examples/todayplugin/exampleplugin.cpp index 94a5836..41bbfe2 100644 --- a/examples/todayplugin/exampleplugin.cpp +++ b/examples/todayplugin/exampleplugin.cpp | |||
@@ -1,57 +1,55 @@ | |||
1 | /* | 1 | /* |
2 | * exampleplugin.cpp | 2 | * exampleplugin.cpp |
3 | * | 3 | * |
4 | * email : harlekin@handhelds.org | 4 | * email : harlekin@handhelds.org |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | #include "exampleplugin.h" | 7 | #include "exampleplugin.h" |
8 | 8 | ||
9 | ExamplePlugin::ExamplePlugin() { | 9 | ExamplePlugin::ExamplePlugin() |
10 | m_widget = 0l; | 10 | : m_widget(0l) |
11 | { | ||
11 | } | 12 | } |
12 | 13 | ||
13 | ExamplePlugin::~ExamplePlugin() { | 14 | ExamplePlugin::~ExamplePlugin() { |
14 | delete (ExamplePluginWidget*)m_widget; | ||
15 | } | 15 | } |
16 | 16 | ||
17 | QString ExamplePlugin::pluginName() const { | 17 | QString ExamplePlugin::pluginName() const { |
18 | return QObject::tr( "Example plugin" ); | 18 | return QObject::tr( "Example plugin" ); |
19 | } | 19 | } |
20 | 20 | ||
21 | double ExamplePlugin::versionNumber() const { | 21 | double ExamplePlugin::versionNumber() const { |
22 | return 0.1; | 22 | return 0.1; |
23 | } | 23 | } |
24 | 24 | ||
25 | // this sets the image that will be shown on the left side of the plugin | 25 | // this sets the image that will be shown on the left side of the plugin |
26 | QString ExamplePlugin::pixmapNameWidget() const { | 26 | QString ExamplePlugin::pixmapNameWidget() const { |
27 | return QString::fromLatin1("Tux"); | 27 | return QString::fromLatin1("Tux"); |
28 | } | 28 | } |
29 | 29 | ||
30 | QWidget* ExamplePlugin::widget( QWidget * wid ) { | 30 | QWidget* ExamplePlugin::widget( QWidget * wid ) { |
31 | if(!m_widget) { | 31 | m_widget = new ExamplePluginWidget( wid, "Example" ); |
32 | m_widget = new ExamplePluginWidget( wid, "Example" ); | ||
33 | } | ||
34 | return m_widget; | 32 | return m_widget; |
35 | } | 33 | } |
36 | 34 | ||
37 | 35 | ||
38 | // that would be the icon of the config widget in todays config view | 36 | // that would be the icon of the config widget in todays config view |
39 | QString ExamplePlugin::pixmapNameConfig() const { | 37 | QString ExamplePlugin::pixmapNameConfig() const { |
40 | return 0l; | 38 | return 0l; |
41 | } | 39 | } |
42 | 40 | ||
43 | // No config widget yet, look at the datebook plugin for an example of that | 41 | // No config widget yet, look at the datebook plugin for an example of that |
44 | TodayConfigWidget* ExamplePlugin::configWidget( QWidget* /*parent*/ ) { | 42 | TodayConfigWidget* ExamplePlugin::configWidget( QWidget* /*parent*/ ) { |
45 | return 0l; | 43 | return 0l; |
46 | } | 44 | } |
47 | 45 | ||
48 | // add the binary name of the app to launch here | 46 | // add the binary name of the app to launch here |
49 | QString ExamplePlugin::appName() const { | 47 | QString ExamplePlugin::appName() const { |
50 | return QString::null; | 48 | return QString::null; |
51 | } | 49 | } |
52 | 50 | ||
53 | // if the plugin should be excluded form the refresh cycles that can be set in the today app | 51 | // if the plugin should be excluded form the refresh cycles that can be set in the today app |
54 | bool ExamplePlugin::excludeFromRefresh() const { | 52 | bool ExamplePlugin::excludeFromRefresh() const { |
55 | return false; | 53 | return false; |
56 | } | 54 | } |
57 | 55 | ||
diff --git a/examples/todayplugin/exampleplugin.h b/examples/todayplugin/exampleplugin.h index 94f5b37..90d3485 100644 --- a/examples/todayplugin/exampleplugin.h +++ b/examples/todayplugin/exampleplugin.h | |||
@@ -1,42 +1,38 @@ | |||
1 | /* | 1 | /* |
2 | * exampleplugin.h | 2 | * exampleplugin.h |
3 | * | 3 | * |
4 | * email : harlekin@handhelds.org | 4 | * email : harlekin@handhelds.org |
5 | * | 5 | * |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
9 | #ifndef EXAMPLE_PLUGIN_H | 9 | #ifndef EXAMPLE_PLUGIN_H |
10 | #define EXAMPLE_PLUGIN_H | 10 | #define EXAMPLE_PLUGIN_H |
11 | 11 | ||
12 | #include <qwidget.h> | ||
13 | #include <qguardedptr.h> | ||
14 | |||
15 | #include <opie2/todayplugininterface.h> | 12 | #include <opie2/todayplugininterface.h> |
16 | #include <opie2/todayconfigwidget.h> | 13 | #include <opie2/todayconfigwidget.h> |
17 | 14 | ||
18 | #include "examplepluginwidget.h" | 15 | #include "examplepluginwidget.h" |
19 | 16 | ||
20 | // implementation of the today plugin interface | 17 | // implementation of the today plugin interface |
21 | class ExamplePlugin : public TodayPluginObject { | 18 | class ExamplePlugin : public TodayPluginObject { |
22 | 19 | ||
23 | public: | 20 | public: |
24 | ExamplePlugin(); | 21 | ExamplePlugin(); |
25 | ~ExamplePlugin(); | 22 | ~ExamplePlugin(); |
26 | 23 | ||
27 | QString pluginName() const; | 24 | QString pluginName() const; |
28 | double versionNumber() const; | 25 | double versionNumber() const; |
29 | QString pixmapNameWidget() const; | 26 | QString pixmapNameWidget() const; |
30 | QWidget* widget(QWidget *); | 27 | QWidget* widget(QWidget *); |
31 | QString pixmapNameConfig() const; | 28 | QString pixmapNameConfig() const; |
32 | TodayConfigWidget* configWidget(QWidget *); | 29 | TodayConfigWidget* configWidget(QWidget *); |
33 | QString appName() const; | 30 | QString appName() const; |
34 | bool excludeFromRefresh() const; | 31 | bool excludeFromRefresh() const; |
35 | void refresh(); | 32 | void refresh(); |
36 | void reinitialize(); | 33 | void reinitialize(); |
37 | 34 | private: | |
38 | private: | 35 | ExamplePluginWidget *m_widget; |
39 | QGuardedPtr<ExamplePluginWidget> m_widget; | ||
40 | }; | 36 | }; |
41 | 37 | ||
42 | #endif | 38 | #endif |