Diffstat (limited to 'noncore/todayplugins/fortune') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/todayplugins/fortune/.cvsignore | 2 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortune.pro | 19 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortuneplugin.cpp | 71 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortuneplugin.h | 43 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortunepluginimpl.cpp | 49 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortunepluginimpl.h | 41 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortunepluginwidget.cpp | 83 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortunepluginwidget.h | 49 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/opie-today-fortuneplugin.control | 8 |
9 files changed, 365 insertions, 0 deletions
diff --git a/noncore/todayplugins/fortune/.cvsignore b/noncore/todayplugins/fortune/.cvsignore new file mode 100644 index 0000000..2888d4a --- a/dev/null +++ b/noncore/todayplugins/fortune/.cvsignore | |||
@@ -0,0 +1,2 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
diff --git a/noncore/todayplugins/fortune/fortune.pro b/noncore/todayplugins/fortune/fortune.pro new file mode 100644 index 0000000..01d0593 --- a/dev/null +++ b/noncore/todayplugins/fortune/fortune.pro | |||
@@ -0,0 +1,19 @@ | |||
1 | TEMPLATE = lib | ||
2 | #CONFIG -= moc | ||
3 | CONFIG += qt debug | ||
4 | |||
5 | # Input | ||
6 | HEADERS = fortuneplugin.h fortunepluginimpl.h \ | ||
7 | fortunepluginwidget.h | ||
8 | SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ | ||
9 | fortunepluginwidget.cpp | ||
10 | |||
11 | INCLUDEPATH += $(OPIEDIR)/include \ | ||
12 | ../ ../library | ||
13 | DEPENDPATH += $(OPIEDIR)/include \ | ||
14 | ../ ../library | ||
15 | |||
16 | LIBS+= -lqpe -lopie | ||
17 | |||
18 | DESTDIR = $(OPIEDIR)/plugins/today | ||
19 | TARGET = todayfortuneplugin | ||
diff --git a/noncore/todayplugins/fortune/fortuneplugin.cpp b/noncore/todayplugins/fortune/fortuneplugin.cpp new file mode 100644 index 0000000..9751e6f --- a/dev/null +++ b/noncore/todayplugins/fortune/fortuneplugin.cpp | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * fortuneplugin.cpp | ||
3 | * | ||
4 | * copyright : (c) 2002 by Chris Larson | ||
5 | * email : kergoth@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 "fortuneplugin.h" | ||
20 | #include "fortunepluginwidget.h" | ||
21 | |||
22 | |||
23 | FortunePlugin::FortunePlugin() | ||
24 | { | ||
25 | } | ||
26 | |||
27 | FortunePlugin::~FortunePlugin() | ||
28 | { | ||
29 | } | ||
30 | |||
31 | QString FortunePlugin::pluginName() const | ||
32 | { | ||
33 | return QObject::tr( "Fortune plugin" ); | ||
34 | } | ||
35 | |||
36 | double FortunePlugin::versionNumber() const | ||
37 | { | ||
38 | return 0.1; | ||
39 | } | ||
40 | |||
41 | QString FortunePlugin::pixmapNameWidget() const | ||
42 | { | ||
43 | return "Fortune"; | ||
44 | } | ||
45 | |||
46 | QWidget* FortunePlugin::widget( QWidget *wid ) | ||
47 | { | ||
48 | return new FortunePluginWidget( wid, "Fortune" ); | ||
49 | } | ||
50 | |||
51 | QString FortunePlugin::pixmapNameConfig() const | ||
52 | { | ||
53 | return "Fortune"; | ||
54 | } | ||
55 | |||
56 | TodayConfigWidget* FortunePlugin::configWidget( QWidget* wid ) | ||
57 | { | ||
58 | // return new FortunePluginConfig( wid , "Fortune" ); | ||
59 | return NULL; | ||
60 | } | ||
61 | |||
62 | QString FortunePlugin::appName() const | ||
63 | { | ||
64 | return "fortune"; | ||
65 | } | ||
66 | |||
67 | |||
68 | bool FortunePlugin::excludeFromRefresh() const | ||
69 | { | ||
70 | return false; | ||
71 | } | ||
diff --git a/noncore/todayplugins/fortune/fortuneplugin.h b/noncore/todayplugins/fortune/fortuneplugin.h new file mode 100644 index 0000000..9376771 --- a/dev/null +++ b/noncore/todayplugins/fortune/fortuneplugin.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * fortuneplugin.h | ||
3 | * | ||
4 | * copyright : (c) 2002 by Chris Larson | ||
5 | * email : kergoth@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 FORTUNE_PLUGIN_H | ||
18 | #define FORTUNE_PLUGIN_H | ||
19 | |||
20 | #include <qstring.h> | ||
21 | #include <qwidget.h> | ||
22 | |||
23 | #include <opie/oclickablelabel.h> | ||
24 | #include <opie/todayplugininterface.h> | ||
25 | |||
26 | class FortunePlugin : public TodayPluginObject | ||
27 | { | ||
28 | |||
29 | public: | ||
30 | FortunePlugin(); | ||
31 | ~FortunePlugin(); | ||
32 | |||
33 | QString pluginName() const; | ||
34 | double versionNumber() const; | ||
35 | QString pixmapNameWidget() const; | ||
36 | QWidget* widget( QWidget * ); | ||
37 | QString pixmapNameConfig() const; | ||
38 | TodayConfigWidget* configWidget( QWidget * ); | ||
39 | QString appName() const; | ||
40 | bool excludeFromRefresh() const; | ||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/noncore/todayplugins/fortune/fortunepluginimpl.cpp b/noncore/todayplugins/fortune/fortunepluginimpl.cpp new file mode 100644 index 0000000..7ef24e9 --- a/dev/null +++ b/noncore/todayplugins/fortune/fortunepluginimpl.cpp | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * fortunepluginimpl.cpp | ||
3 | * | ||
4 | * copyright : (c) 2002 by Chris Larson | ||
5 | * email : kergoth@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 "fortuneplugin.h" | ||
18 | #include "fortunepluginimpl.h" | ||
19 | |||
20 | FortunePluginImpl::FortunePluginImpl() | ||
21 | { | ||
22 | fortunePlugin = new FortunePlugin(); | ||
23 | } | ||
24 | |||
25 | FortunePluginImpl::~FortunePluginImpl() | ||
26 | { | ||
27 | } | ||
28 | |||
29 | |||
30 | TodayPluginObject* FortunePluginImpl::guiPart() | ||
31 | { | ||
32 | return fortunePlugin; | ||
33 | } | ||
34 | |||
35 | QRESULT FortunePluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) | ||
36 | { | ||
37 | *iface = 0; | ||
38 | qWarning("FortunePluginImpl::queryInterface called\n"); | ||
39 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { | ||
40 | *iface = this, (*iface)->addRef(); | ||
41 | } | ||
42 | return QS_OK; | ||
43 | |||
44 | } | ||
45 | |||
46 | Q_EXPORT_INTERFACE() | ||
47 | { | ||
48 | Q_CREATE_INSTANCE( FortunePluginImpl ); | ||
49 | } | ||
diff --git a/noncore/todayplugins/fortune/fortunepluginimpl.h b/noncore/todayplugins/fortune/fortunepluginimpl.h new file mode 100644 index 0000000..070f03e --- a/dev/null +++ b/noncore/todayplugins/fortune/fortunepluginimpl.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * todopluginimpl.h | ||
3 | * | ||
4 | * copyright : (c) 2002 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 FORTUNE_PLUGIN_IMPL_H | ||
18 | #define FORTUNE_PLUGIN_IMPL_H | ||
19 | |||
20 | #include <opie/todayplugininterface.h> | ||
21 | |||
22 | class FortunePlugin; | ||
23 | |||
24 | class FortunePluginImpl : public TodayPluginInterface | ||
25 | { | ||
26 | |||
27 | public: | ||
28 | FortunePluginImpl(); | ||
29 | virtual ~FortunePluginImpl(); | ||
30 | |||
31 | QRESULT queryInterface( const QUuid &, QUnknownInterface** ); | ||
32 | Q_REFCOUNT | ||
33 | |||
34 | virtual TodayPluginObject *guiPart(); | ||
35 | |||
36 | private: | ||
37 | FortunePlugin *fortunePlugin; | ||
38 | ulong ref; | ||
39 | }; | ||
40 | |||
41 | #endif | ||
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp new file mode 100644 index 0000000..583bf0b --- a/dev/null +++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * fortunepluginwidget.cpp | ||
3 | * | ||
4 | * copyright : (c) 2002 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 "fortunepluginwidget.h" | ||
18 | |||
19 | #include <qvaluelist.h> | ||
20 | #include <qtl.h> | ||
21 | #include <qstring.h> | ||
22 | #include <qscrollview.h> | ||
23 | #include <qobject.h> | ||
24 | #include <qlayout.h> | ||
25 | |||
26 | #include <qpe/config.h> | ||
27 | #include <qpe/qcopenvelope_qws.h> | ||
28 | |||
29 | #include <opie/oprocess.h> | ||
30 | #include <opie/oticker.h> | ||
31 | |||
32 | FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) | ||
33 | : QWidget( parent, name ) | ||
34 | { | ||
35 | |||
36 | fortune = NULL; | ||
37 | getFortune(); | ||
38 | } | ||
39 | |||
40 | FortunePluginWidget::~FortunePluginWidget() { | ||
41 | if( fortuneProcess ){ | ||
42 | delete fortuneProcess; | ||
43 | } | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * Get the fortunes | ||
48 | */ | ||
49 | void FortunePluginWidget::getFortune() { | ||
50 | |||
51 | QVBoxLayout* layoutFortune = new QVBoxLayout( this ); | ||
52 | |||
53 | if ( fortune ) { | ||
54 | delete fortune; | ||
55 | } | ||
56 | |||
57 | fortune = new OTicker( this ); | ||
58 | //fortune->setReadOnly( TRUE ); | ||
59 | //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | ||
60 | |||
61 | fortune->setText( QString("Obtaining fortune...") ); | ||
62 | layoutFortune->addWidget( fortune ); | ||
63 | |||
64 | fortuneProcess = new OProcess(); | ||
65 | *fortuneProcess << "fortune"; | ||
66 | |||
67 | connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | ||
68 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | ||
69 | |||
70 | if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | ||
71 | qWarning("could not start :("); | ||
72 | fortune->setText( QString("Failed to obtain fortune.") ); | ||
73 | delete fortuneProcess; | ||
74 | fortuneProcess = 0; | ||
75 | } | ||
76 | |||
77 | } | ||
78 | |||
79 | void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) | ||
80 | { | ||
81 | QCString cstring( buf, len ); | ||
82 | fortune->setText( cstring ); | ||
83 | } | ||
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.h b/noncore/todayplugins/fortune/fortunepluginwidget.h new file mode 100644 index 0000000..dd3cd6f --- a/dev/null +++ b/noncore/todayplugins/fortune/fortunepluginwidget.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /* | ||
2 | * fortunepluginwidget.h | ||
3 | * | ||
4 | * copyright : (c) 2002 by Chris Larson | ||
5 | * email : kergoth@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 FORTUNE_PLUGIN_WIDGET_H | ||
18 | #define FORTUNE_PLUGIN_WIDGET_H | ||
19 | |||
20 | #include <qstring.h> | ||
21 | #include <qwidget.h> | ||
22 | |||
23 | #include <opie/oticker.h> | ||
24 | #include <opie/oprocess.h> | ||
25 | |||
26 | |||
27 | class FortunePluginWidget : public QWidget | ||
28 | { | ||
29 | |||
30 | Q_OBJECT | ||
31 | |||
32 | public: | ||
33 | FortunePluginWidget( QWidget *parent, const char *name ); | ||
34 | ~FortunePluginWidget(); | ||
35 | |||
36 | protected slots: | ||
37 | void startFortune(); | ||
38 | |||
39 | private: | ||
40 | OTicker *fortune; | ||
41 | OProcess *fortuneProcess; | ||
42 | |||
43 | void getFortune(); | ||
44 | |||
45 | private slots: | ||
46 | void slotStdOut( OProcess*, char*, int ); | ||
47 | }; | ||
48 | |||
49 | #endif | ||
diff --git a/noncore/todayplugins/fortune/opie-today-fortuneplugin.control b/noncore/todayplugins/fortune/opie-today-fortuneplugin.control new file mode 100644 index 0000000..1a62afc --- a/dev/null +++ b/noncore/todayplugins/fortune/opie-today-fortuneplugin.control | |||
@@ -0,0 +1,8 @@ | |||
1 | Files: plugins/today/libtodayfortuneplugin.so* | ||
2 | Priority: optional | ||
3 | Section: opie/applications | ||
4 | Maintainer: Chris Larson <kergoth@handhelds.org> | ||
5 | Architecture: arm | ||
6 | Version: $QPE_VERSION-$SUB_VERSION | ||
7 | Depends: qt-embedded (>=$QTE_VERSION), opie-today | ||
8 | Description: 'fortune' plugin for today | ||