-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 @@ +Makefile* +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 @@ +TEMPLATE = lib +#CONFIG -= moc +CONFIG += qt debug + +# Input +HEADERS = fortuneplugin.h fortunepluginimpl.h \ + fortunepluginwidget.h +SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ + fortunepluginwidget.cpp + +INCLUDEPATH += $(OPIEDIR)/include \ + ../ ../library +DEPENDPATH += $(OPIEDIR)/include \ + ../ ../library + +LIBS+= -lqpe -lopie + +DESTDIR = $(OPIEDIR)/plugins/today +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 @@ +/* + * fortuneplugin.cpp + * + * copyright : (c) 2002 by Chris Larson + * email : kergoth@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + + +#include "fortuneplugin.h" +#include "fortunepluginwidget.h" + + +FortunePlugin::FortunePlugin() +{ +} + +FortunePlugin::~FortunePlugin() +{ +} + +QString FortunePlugin::pluginName() const +{ + return QObject::tr( "Fortune plugin" ); +} + +double FortunePlugin::versionNumber() const +{ + return 0.1; +} + +QString FortunePlugin::pixmapNameWidget() const +{ + return "Fortune"; +} + +QWidget* FortunePlugin::widget( QWidget *wid ) +{ + return new FortunePluginWidget( wid, "Fortune" ); +} + +QString FortunePlugin::pixmapNameConfig() const +{ + return "Fortune"; +} + +TodayConfigWidget* FortunePlugin::configWidget( QWidget* wid ) +{ +// return new FortunePluginConfig( wid , "Fortune" ); + return NULL; +} + +QString FortunePlugin::appName() const +{ + return "fortune"; +} + + +bool FortunePlugin::excludeFromRefresh() const +{ + return false; +} 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 @@ +/* + * fortuneplugin.h + * + * copyright : (c) 2002 by Chris Larson + * email : kergoth@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef FORTUNE_PLUGIN_H +#define FORTUNE_PLUGIN_H + +#include <qstring.h> +#include <qwidget.h> + +#include <opie/oclickablelabel.h> +#include <opie/todayplugininterface.h> + +class FortunePlugin : public TodayPluginObject +{ + +public: + FortunePlugin(); + ~FortunePlugin(); + + QString pluginName() const; + double versionNumber() const; + QString pixmapNameWidget() const; + QWidget* widget( QWidget * ); + QString pixmapNameConfig() const; + TodayConfigWidget* configWidget( QWidget * ); + QString appName() const; + bool excludeFromRefresh() const; +}; + +#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 @@ +/* + * fortunepluginimpl.cpp + * + * copyright : (c) 2002 by Chris Larson + * email : kergoth@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "fortuneplugin.h" +#include "fortunepluginimpl.h" + +FortunePluginImpl::FortunePluginImpl() +{ + fortunePlugin = new FortunePlugin(); +} + +FortunePluginImpl::~FortunePluginImpl() +{ +} + + +TodayPluginObject* FortunePluginImpl::guiPart() +{ + return fortunePlugin; +} + +QRESULT FortunePluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) +{ + *iface = 0; + qWarning("FortunePluginImpl::queryInterface called\n"); + if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) { + *iface = this, (*iface)->addRef(); + } + return QS_OK; + +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( FortunePluginImpl ); +} 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 @@ +/* + * todopluginimpl.h + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef FORTUNE_PLUGIN_IMPL_H +#define FORTUNE_PLUGIN_IMPL_H + +#include <opie/todayplugininterface.h> + +class FortunePlugin; + +class FortunePluginImpl : public TodayPluginInterface +{ + +public: + FortunePluginImpl(); + virtual ~FortunePluginImpl(); + + QRESULT queryInterface( const QUuid &, QUnknownInterface** ); + Q_REFCOUNT + + virtual TodayPluginObject *guiPart(); + +private: + FortunePlugin *fortunePlugin; + ulong ref; +}; + +#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 @@ +/* + * fortunepluginwidget.cpp + * + * copyright : (c) 2002 by Maximilian Reiß + * email : harlekin@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "fortunepluginwidget.h" + +#include <qvaluelist.h> +#include <qtl.h> +#include <qstring.h> +#include <qscrollview.h> +#include <qobject.h> +#include <qlayout.h> + +#include <qpe/config.h> +#include <qpe/qcopenvelope_qws.h> + +#include <opie/oprocess.h> +#include <opie/oticker.h> + +FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) + : QWidget( parent, name ) +{ + + fortune = NULL; + getFortune(); +} + +FortunePluginWidget::~FortunePluginWidget() { + if( fortuneProcess ){ + delete fortuneProcess; + } +} + +/** + * Get the fortunes + */ +void FortunePluginWidget::getFortune() { + + QVBoxLayout* layoutFortune = new QVBoxLayout( this ); + + if ( fortune ) { + delete fortune; + } + + fortune = new OTicker( this ); +// fortune->setReadOnly( TRUE ); +// fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); + + fortune->setText( QString("Obtaining fortune...") ); + layoutFortune->addWidget( fortune ); + + fortuneProcess = new OProcess(); + *fortuneProcess << "fortune"; + + connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*, char*, int ) ), + this, SLOT(slotStdOut(OProcess*, char*, int) ) ); + + if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { + qWarning("could not start :("); + fortune->setText( QString("Failed to obtain fortune.") ); + delete fortuneProcess; + fortuneProcess = 0; + } + +} + +void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) +{ + QCString cstring( buf, len ); + fortune->setText( cstring ); +} 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 @@ +/* + * fortunepluginwidget.h + * + * copyright : (c) 2002 by Chris Larson + * email : kergoth@handhelds.org + * + */ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef FORTUNE_PLUGIN_WIDGET_H +#define FORTUNE_PLUGIN_WIDGET_H + +#include <qstring.h> +#include <qwidget.h> + +#include <opie/oticker.h> +#include <opie/oprocess.h> + + +class FortunePluginWidget : public QWidget +{ + + Q_OBJECT + +public: + FortunePluginWidget( QWidget *parent, const char *name ); + ~FortunePluginWidget(); + +protected slots: + void startFortune(); + +private: + OTicker *fortune; + OProcess *fortuneProcess; + + void getFortune(); + +private slots: + void slotStdOut( OProcess*, char*, int ); +}; + +#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 @@ +Files: plugins/today/libtodayfortuneplugin.so* +Priority: optional +Section: opie/applications +Maintainer: Chris Larson <kergoth@handhelds.org> +Architecture: arm +Version: $QPE_VERSION-$SUB_VERSION +Depends: qt-embedded (>=$QTE_VERSION), opie-today +Description: 'fortune' plugin for today |