summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-11-04 00:32:59 (UTC)
committer kergoth <kergoth>2002-11-04 00:32:59 (UTC)
commitdc44b0babe9ffa7b29cc6269596703bab8edf6ab (patch) (unidiff)
treed1a3e10c58737597832b3d34e4fe3173f307c324
parent829eeff0374389891aa88b12fcafffb55f480797 (diff)
downloadopie-dc44b0babe9ffa7b29cc6269596703bab8edf6ab.zip
opie-dc44b0babe9ffa7b29cc6269596703bab8edf6ab.tar.gz
opie-dc44b0babe9ffa7b29cc6269596703bab8edf6ab.tar.bz2
fortune plugin, though it doesnt like me
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/fortune/.cvsignore2
-rw-r--r--noncore/todayplugins/fortune/fortune.pro19
-rw-r--r--noncore/todayplugins/fortune/fortuneplugin.cpp71
-rw-r--r--noncore/todayplugins/fortune/fortuneplugin.h43
-rw-r--r--noncore/todayplugins/fortune/fortunepluginimpl.cpp49
-rw-r--r--noncore/todayplugins/fortune/fortunepluginimpl.h41
-rw-r--r--noncore/todayplugins/fortune/fortunepluginwidget.cpp83
-rw-r--r--noncore/todayplugins/fortune/fortunepluginwidget.h49
-rw-r--r--noncore/todayplugins/fortune/opie-today-fortuneplugin.control8
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 @@
1Makefile*
2moc*
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 @@
1TEMPLATE = lib
2#CONFIG -= moc
3CONFIG += qt debug
4
5# Input
6HEADERS = fortuneplugin.h fortunepluginimpl.h \
7 fortunepluginwidget.h
8SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \
9 fortunepluginwidget.cpp
10
11INCLUDEPATH += $(OPIEDIR)/include \
12 ../ ../library
13DEPENDPATH += $(OPIEDIR)/include \
14 ../ ../library
15
16LIBS+= -lqpe -lopie
17
18DESTDIR = $(OPIEDIR)/plugins/today
19TARGET = 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
23FortunePlugin::FortunePlugin()
24{
25}
26
27FortunePlugin::~FortunePlugin()
28{
29}
30
31QString FortunePlugin::pluginName() const
32{
33 return QObject::tr( "Fortune plugin" );
34}
35
36double FortunePlugin::versionNumber() const
37{
38 return 0.1;
39}
40
41QString FortunePlugin::pixmapNameWidget() const
42{
43 return "Fortune";
44}
45
46QWidget* FortunePlugin::widget( QWidget *wid )
47{
48 return new FortunePluginWidget( wid, "Fortune" );
49}
50
51QString FortunePlugin::pixmapNameConfig() const
52{
53 return "Fortune";
54}
55
56TodayConfigWidget* FortunePlugin::configWidget( QWidget* wid )
57{
58// return new FortunePluginConfig( wid , "Fortune" );
59 return NULL;
60}
61
62QString FortunePlugin::appName() const
63{
64 return "fortune";
65}
66
67
68bool 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
26class FortunePlugin : public TodayPluginObject
27{
28
29public:
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
20FortunePluginImpl::FortunePluginImpl()
21{
22 fortunePlugin = new FortunePlugin();
23}
24
25FortunePluginImpl::~FortunePluginImpl()
26{
27}
28
29
30TodayPluginObject* FortunePluginImpl::guiPart()
31{
32 return fortunePlugin;
33}
34
35QRESULT 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
46Q_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
22class FortunePlugin;
23
24class FortunePluginImpl : public TodayPluginInterface
25{
26
27public:
28 FortunePluginImpl();
29 virtual ~FortunePluginImpl();
30
31 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
32 Q_REFCOUNT
33
34 virtual TodayPluginObject *guiPart();
35
36private:
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
32FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name )
33 : QWidget( parent, name )
34{
35
36 fortune = NULL;
37 getFortune();
38}
39
40FortunePluginWidget::~FortunePluginWidget() {
41 if( fortuneProcess ){
42 delete fortuneProcess;
43 }
44}
45
46/**
47 * Get the fortunes
48 */
49void 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
79void 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
27class FortunePluginWidget : public QWidget
28{
29
30 Q_OBJECT
31
32public:
33 FortunePluginWidget( QWidget *parent, const char *name );
34 ~FortunePluginWidget();
35
36protected slots:
37 void startFortune();
38
39private:
40 OTicker *fortune;
41 OProcess *fortuneProcess;
42
43 void getFortune();
44
45private 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 @@
1Files: plugins/today/libtodayfortuneplugin.so*
2Priority: optional
3Section: opie/applications
4Maintainer: Chris Larson <kergoth@handhelds.org>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION
7Depends: qt-embedded (>=$QTE_VERSION), opie-today
8Description: 'fortune' plugin for today