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