-rw-r--r-- | examples/todayplugin/config.in | 5 | ||||
-rw-r--r-- | examples/todayplugin/example.pro | 19 | ||||
-rw-r--r-- | examples/todayplugin/exampleplugin.cpp | 76 | ||||
-rw-r--r-- | examples/todayplugin/exampleplugin.h | 51 | ||||
-rw-r--r-- | examples/todayplugin/examplepluginimpl.cpp | 48 | ||||
-rw-r--r-- | examples/todayplugin/examplepluginimpl.h | 40 | ||||
-rw-r--r-- | examples/todayplugin/examplepluginwidget.cpp | 71 | ||||
-rw-r--r-- | examples/todayplugin/examplepluginwidget.h | 44 | ||||
-rw-r--r-- | examples/todayplugin/opie-today-exampleplugin.control | 9 |
9 files changed, 363 insertions, 0 deletions
diff --git a/examples/todayplugin/config.in b/examples/todayplugin/config.in new file mode 100644 index 0000000..1f1efd9 --- a/dev/null +++ b/examples/todayplugin/config.in | |||
@@ -0,0 +1,5 @@ | |||
1 | config TODAY_EXAMPLE | ||
2 | boolean "example" | ||
3 | default "n" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | ||
5 | comment "opie today example plugin" | ||
diff --git a/examples/todayplugin/example.pro b/examples/todayplugin/example.pro new file mode 100644 index 0000000..931e056 --- a/dev/null +++ b/examples/todayplugin/example.pro | |||
@@ -0,0 +1,19 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG -= moc | ||
3 | CONFIG += qt release | ||
4 | |||
5 | # Input | ||
6 | HEADERS = exampleplugin.h examplepluginimpl.h examplepluginwidget.h | ||
7 | SOURCES = exampleplugin.cpp examplepluginimpl.cpp examplepluginwidget.cpp | ||
8 | |||
9 | INCLUDEPATH += $(OPIEDIR)/include \ | ||
10 | ../ ../library | ||
11 | DEPENDPATH += $(OPIEDIR)/include \ | ||
12 | ../ ../library | ||
13 | |||
14 | LIBS+= -lqpe -lopie | ||
15 | |||
16 | DESTDIR = $(OPIEDIR)/plugins/today | ||
17 | TARGET = todayexampleplugin | ||
18 | |||
19 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/examples/todayplugin/exampleplugin.cpp b/examples/todayplugin/exampleplugin.cpp new file mode 100644 index 0000000..e5d75df --- a/dev/null +++ b/examples/todayplugin/exampleplugin.cpp | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * exampleplugin.cpp | ||
3 | * | ||
4 | * copyright : (c) 2002,2003,2004 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
9 | * * | ||
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 * | ||
12 | * the Free Software Foundation; either version 2 of the License, or * | ||
13 | * (at your option) any later version. * | ||
14 | * * | ||
15 | ***************************************************************************/ | ||
16 | |||
17 | |||
18 | #include "exampleplugin.h" | ||
19 | |||
20 | ExamplePlugin::ExamplePlugin() { | ||
21 | m_widget = 0l; | ||
22 | } | ||
23 | |||
24 | ExamplePlugin::~ExamplePlugin() { | ||
25 | delete (ExamplePluginWidget*)m_widget; | ||
26 | } | ||
27 | |||
28 | QString ExamplePlugin::pluginName() const { | ||
29 | return QObject::tr( "Example plugin" ); | ||
30 | } | ||
31 | |||
32 | double ExamplePlugin::versionNumber() const { | ||
33 | return 0.1; | ||
34 | } | ||
35 | |||
36 | // this sets the image that will be shown on the left side of the plugin | ||
37 | QString ExamplePlugin::pixmapNameWidget() const { | ||
38 | return "Tux"; | ||
39 | } | ||
40 | |||
41 | QWidget* ExamplePlugin::widget( QWidget * wid ) { | ||
42 | if(!m_widget) { | ||
43 | m_widget = new ExamplePluginWidget( wid, "Example" ); | ||
44 | } | ||
45 | return m_widget; | ||
46 | } | ||
47 | |||
48 | |||
49 | // that would be the icon of the config widget in todays config view | ||
50 | QString ExamplePlugin::pixmapNameConfig() const { | ||
51 | return 0l; | ||
52 | } | ||
53 | |||
54 | // No config widget yet, look at the datebook plugin for an example of that | ||
55 | TodayConfigWidget* ExamplePlugin::configWidget( QWidget* ) { | ||
56 | return 0l; | ||
57 | } | ||
58 | |||
59 | // add the binary name of the app to launch here | ||
60 | QString ExamplePlugin::appName() const { | ||
61 | return ""; | ||
62 | } | ||
63 | |||
64 | // if the plugin should be excluded form the refresh cycles that can be set in the today app | ||
65 | bool ExamplePlugin::excludeFromRefresh() const { | ||
66 | return false; | ||
67 | } | ||
68 | |||
69 | void ExamplePlugin::refresh() { | ||
70 | if ( m_widget ) { | ||
71 | m_widget->refresh(); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void ExamplePlugin::reinitialize() { | ||
76 | } | ||
diff --git a/examples/todayplugin/exampleplugin.h b/examples/todayplugin/exampleplugin.h new file mode 100644 index 0000000..0d9f11d --- a/dev/null +++ b/examples/todayplugin/exampleplugin.h | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * exampleplugin.h | ||
3 | * | ||
4 | * copyright : (c) 2004 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
9 | * * | ||
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 * | ||
12 | * the Free Software Foundation; either version 2 of the License, or * | ||
13 | * (at your option) any later version. * | ||
14 | * * | ||
15 | ***************************************************************************/ | ||
16 | |||
17 | |||
18 | #ifndef EXAMPLE_PLUGIN_H | ||
19 | #define EXAMPLE_PLUGIN_H | ||
20 | |||
21 | #include <qwidget.h> | ||
22 | #include <qguardedptr.h> | ||
23 | |||
24 | #include <opie/todayplugininterface.h> | ||
25 | #include <opie/todayconfigwidget.h> | ||
26 | |||
27 | #include "examplepluginwidget.h" | ||
28 | |||
29 | // implementation of the today plugin interface | ||
30 | class ExamplePlugin : public TodayPluginObject { | ||
31 | |||
32 | public: | ||
33 | ExamplePlugin(); | ||
34 | ~ExamplePlugin(); | ||
35 | |||
36 | QString pluginName() const; | ||
37 | double versionNumber() const; | ||
38 | QString pixmapNameWidget() const; | ||
39 | QWidget* widget(QWidget *); | ||
40 | QString pixmapNameConfig() const; | ||
41 | TodayConfigWidget* configWidget(QWidget *); | ||
42 | QString appName() const; | ||
43 | bool excludeFromRefresh() const; | ||
44 | void refresh(); | ||
45 | void reinitialize(); | ||
46 | |||
47 | private: | ||
48 | QGuardedPtr<ExamplePluginWidget> m_widget; | ||
49 | }; | ||
50 | |||
51 | #endif | ||
diff --git a/examples/todayplugin/examplepluginimpl.cpp b/examples/todayplugin/examplepluginimpl.cpp new file mode 100644 index 0000000..9ab6164 --- a/dev/null +++ b/examples/todayplugin/examplepluginimpl.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * examplepluginimpl.cpp | ||
3 | * | ||
4 | * copyright : (c) 2004 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
9 | * * | ||
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 * | ||
12 | * the Free Software Foundation; either version 2 of the License, or * | ||
13 | * (at your option) any later version. * | ||
14 | * * | ||
15 | ***************************************************************************/ | ||
16 | |||
17 | |||
18 | |||
19 | #include "exampleplugin.h" | ||
20 | #include "examplepluginimpl.h" | ||
21 | |||
22 | ExamplePluginImpl::ExamplePluginImpl() { | ||
23 | examplePlugin = new ExamplePlugin(); | ||
24 | } | ||
25 | |||
26 | ExamplePluginImpl::~ExamplePluginImpl() { | ||
27 | delete examplePlugin; | ||
28 | } | ||
29 | |||
30 | |||
31 | TodayPluginObject* ExamplePluginImpl::guiPart() { | ||
32 | return examplePlugin; | ||
33 | } | ||
34 | |||
35 | QRESULT ExamplePluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { | ||
36 | *iface = 0; | ||
37 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { | ||
38 | *iface = this, (*iface)->addRef(); | ||
39 | }else | ||
40 | return QS_FALSE; | ||
41 | |||
42 | return QS_OK; | ||
43 | |||
44 | } | ||
45 | |||
46 | Q_EXPORT_INTERFACE() { | ||
47 | Q_CREATE_INSTANCE( ExamplePluginImpl ); | ||
48 | } | ||
diff --git a/examples/todayplugin/examplepluginimpl.h b/examples/todayplugin/examplepluginimpl.h new file mode 100644 index 0000000..2c10583 --- a/dev/null +++ b/examples/todayplugin/examplepluginimpl.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * examplepluginimpl.h | ||
3 | * | ||
4 | * copyright : (c) 2004 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
9 | * * | ||
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 * | ||
12 | * the Free Software Foundation; either version 2 of the License, or * | ||
13 | * (at your option) any later version. * | ||
14 | * * | ||
15 | ***************************************************************************/ | ||
16 | |||
17 | #ifndef EXAMPLE_PLUGIN_IMPL_H | ||
18 | #define EXAMPLE_PLUGIN_IMPL_H | ||
19 | |||
20 | #include <opie/todayplugininterface.h> | ||
21 | |||
22 | class ExamplePlugin; | ||
23 | |||
24 | class ExamplePluginImpl : public TodayPluginInterface{ | ||
25 | |||
26 | public: | ||
27 | ExamplePluginImpl(); | ||
28 | virtual ~ExamplePluginImpl(); | ||
29 | |||
30 | QRESULT queryInterface( const QUuid &, QUnknownInterface** ); | ||
31 | Q_REFCOUNT | ||
32 | |||
33 | virtual TodayPluginObject *guiPart(); | ||
34 | |||
35 | private: | ||
36 | ExamplePlugin *examplePlugin; | ||
37 | ulong ref; | ||
38 | }; | ||
39 | |||
40 | #endif | ||
diff --git a/examples/todayplugin/examplepluginwidget.cpp b/examples/todayplugin/examplepluginwidget.cpp new file mode 100644 index 0000000..14f1020 --- a/dev/null +++ b/examples/todayplugin/examplepluginwidget.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * examplepluginwidget.cpp | ||
3 | * | ||
4 | * copyright : (c) 2004 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
9 | * * | ||
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 * | ||
12 | * the Free Software Foundation; either version 2 of the License, or * | ||
13 | * (at your option) any later version. * | ||
14 | * * | ||
15 | ***************************************************************************/ | ||
16 | |||
17 | #include <qpe/config.h> | ||
18 | #include <qpe/qcopenvelope_qws.h> | ||
19 | |||
20 | #include "examplepluginwidget.h" | ||
21 | |||
22 | ExamplePluginWidget::ExamplePluginWidget( QWidget *parent, const char* name) | ||
23 | : QWidget(parent, name ) { | ||
24 | |||
25 | m_exampleLabel = 0l; | ||
26 | m_layout = 0l; | ||
27 | |||
28 | if ( m_exampleLabel ) { | ||
29 | delete m_exampleLabel; | ||
30 | } | ||
31 | |||
32 | // since here a OClickableLabel is used, the plugin part will be clickable, and the actions | ||
33 | // that should be triggered when clicked are defined in slotClicked() | ||
34 | // of course also normal widgets can be used. | ||
35 | m_exampleLabel = new OClickableLabel( this ); | ||
36 | connect( m_exampleLabel, SIGNAL( clicked() ), this, SLOT( slotClicked() ) ); | ||
37 | |||
38 | if ( m_layout ) { | ||
39 | delete m_layout; | ||
40 | } | ||
41 | m_layout = new QHBoxLayout( this ); | ||
42 | m_layout->setAutoAdd( true ); | ||
43 | |||
44 | readConfig(); | ||
45 | getInfo(); | ||
46 | } | ||
47 | |||
48 | |||
49 | ExamplePluginWidget::~ExamplePluginWidget() { | ||
50 | delete m_exampleLabel; | ||
51 | delete m_layout; | ||
52 | } | ||
53 | |||
54 | |||
55 | void ExamplePluginWidget::readConfig() { | ||
56 | // we dont have any config entries in this plugin | ||
57 | // normally this method is used after today config was used | ||
58 | } | ||
59 | |||
60 | |||
61 | void ExamplePluginWidget::refresh() { | ||
62 | |||
63 | } | ||
64 | |||
65 | void ExamplePluginWidget::getInfo() { | ||
66 | m_exampleLabel->setText( "Example text" ); | ||
67 | } | ||
68 | |||
69 | void ExamplePluginWidget::slotClicked() { | ||
70 | getInfo(); | ||
71 | } | ||
diff --git a/examples/todayplugin/examplepluginwidget.h b/examples/todayplugin/examplepluginwidget.h new file mode 100644 index 0000000..c94d2cf --- a/dev/null +++ b/examples/todayplugin/examplepluginwidget.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * examplepluginwidget.h | ||
3 | * | ||
4 | * copyright : (c) 2004 by Maximilian Reiß | ||
5 | * email : harlekin@handhelds.org | ||
6 | * | ||
7 | */ | ||
8 | /*************************************************************************** | ||
9 | * * | ||
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 * | ||
12 | * the Free Software Foundation; either version 2 of the License, or * | ||
13 | * (at your option) any later version. * | ||
14 | * * | ||
15 | ***************************************************************************/ | ||
16 | |||
17 | #ifndef EXAMPLE_PLUGIN_WIDGET_H | ||
18 | #define EXAMPLE_PLUGIN_WIDGET_H | ||
19 | |||
20 | #include <qlayout.h> | ||
21 | |||
22 | #include <opie/oclickablelabel.h> | ||
23 | |||
24 | class ExamplePluginWidget : public QWidget { | ||
25 | |||
26 | Q_OBJECT | ||
27 | |||
28 | public: | ||
29 | ExamplePluginWidget( QWidget *parent, const char *name ); | ||
30 | ~ExamplePluginWidget(); | ||
31 | |||
32 | void refresh(); | ||
33 | |||
34 | private slots: | ||
35 | void slotClicked(); | ||
36 | |||
37 | private: | ||
38 | OClickableLabel* m_exampleLabel; | ||
39 | QHBoxLayout* m_layout; | ||
40 | void readConfig(); | ||
41 | void getInfo(); | ||
42 | }; | ||
43 | |||
44 | #endif | ||
diff --git a/examples/todayplugin/opie-today-exampleplugin.control b/examples/todayplugin/opie-today-exampleplugin.control new file mode 100644 index 0000000..b4e591f --- a/dev/null +++ b/examples/todayplugin/opie-today-exampleplugin.control | |||
@@ -0,0 +1,9 @@ | |||
1 | Package: opie-today-exampleplugin | ||
2 | Files: plugins/today/libtodayexampleplugin.so* | ||
3 | Priority: optional | ||
4 | Section: opie/applications | ||
5 | Maintainer: Maximilian Reiss <harlekin@handhelds.org> | ||
6 | Architecture: arm | ||
7 | Version: $QPE_VERSION-$SUB_VERSION | ||
8 | Depends: libqte2, opie-today | ||
9 | Description: an example plugin for today | ||