Diffstat (limited to 'noncore/todayplugins/fortune') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/todayplugins/fortune/fortune.pro | 1 | ||||
-rw-r--r-- | noncore/todayplugins/fortune/fortunepluginwidget.cpp | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/noncore/todayplugins/fortune/fortune.pro b/noncore/todayplugins/fortune/fortune.pro index 2e4b4b3..74c60b1 100644 --- a/noncore/todayplugins/fortune/fortune.pro +++ b/noncore/todayplugins/fortune/fortune.pro | |||
@@ -1,14 +1,13 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | #CONFIG -= moc | ||
3 | CONFIG += qt plugin | 2 | CONFIG += qt plugin |
4 | 3 | ||
5 | # Input | 4 | # Input |
6 | HEADERS = fortuneplugin.h fortunepluginimpl.h \ | 5 | HEADERS = fortuneplugin.h fortunepluginimpl.h \ |
7 | fortunepluginwidget.h | 6 | fortunepluginwidget.h |
8 | SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ | 7 | SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ |
9 | fortunepluginwidget.cpp | 8 | fortunepluginwidget.cpp |
10 | 9 | ||
11 | INCLUDEPATH += $(OPIEDIR)/include \ | 10 | INCLUDEPATH += $(OPIEDIR)/include \ |
12 | ../ ../library | 11 | ../ ../library |
13 | DEPENDPATH += $(OPIEDIR)/include \ | 12 | DEPENDPATH += $(OPIEDIR)/include \ |
14 | ../ ../library | 13 | ../ ../library |
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp index c3ee546..c147567 100644 --- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp +++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp | |||
@@ -7,36 +7,39 @@ | |||
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 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 * | 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 * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "fortunepluginwidget.h" | 17 | #include "fortunepluginwidget.h" |
18 | 18 | ||
19 | /* OPIE */ | ||
20 | #include <opie2/odebug.h> | ||
19 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | using namespace Opie::Core; | ||
24 | using namespace Opie::Ui; | ||
21 | 25 | ||
26 | /* QT */ | ||
22 | #include <qvaluelist.h> | 27 | #include <qvaluelist.h> |
23 | #include <qtl.h> | 28 | #include <qtl.h> |
24 | #include <qstring.h> | 29 | #include <qstring.h> |
25 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
26 | #include <qobject.h> | 31 | #include <qobject.h> |
27 | #include <qlayout.h> | 32 | #include <qlayout.h> |
28 | 33 | ||
29 | using namespace Opie::Core; | ||
30 | using namespace Opie::Ui; | ||
31 | FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) | 34 | FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name ) |
32 | : QWidget( parent, name ) | 35 | : QWidget( parent, name ) |
33 | { | 36 | { |
34 | 37 | ||
35 | fortune = NULL; | 38 | fortune = NULL; |
36 | getFortune(); | 39 | getFortune(); |
37 | } | 40 | } |
38 | 41 | ||
39 | FortunePluginWidget::~FortunePluginWidget() { | 42 | FortunePluginWidget::~FortunePluginWidget() { |
40 | if( fortuneProcess ){ | 43 | if( fortuneProcess ){ |
41 | delete fortuneProcess; | 44 | delete fortuneProcess; |
42 | } | 45 | } |
@@ -58,25 +61,25 @@ void FortunePluginWidget::getFortune() { | |||
58 | //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | 61 | //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); |
59 | 62 | ||
60 | fortune->setText( QString("Obtaining fortune...") ); | 63 | fortune->setText( QString("Obtaining fortune...") ); |
61 | layoutFortune->addWidget( fortune ); | 64 | layoutFortune->addWidget( fortune ); |
62 | 65 | ||
63 | fortuneProcess = new OProcess(); | 66 | fortuneProcess = new OProcess(); |
64 | *fortuneProcess << "fortune"; | 67 | *fortuneProcess << "fortune"; |
65 | 68 | ||
66 | connect(fortuneProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), | 69 | connect(fortuneProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), |
67 | this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int) ) ); | 70 | this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int) ) ); |
68 | 71 | ||
69 | if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 72 | if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
70 | qWarning("could not start :("); | 73 | owarn << "could not start :(" << oendl; |
71 | fortune->setText( QString("Failed to obtain fortune.") ); | 74 | fortune->setText( QString("Failed to obtain fortune.") ); |
72 | delete fortuneProcess; | 75 | delete fortuneProcess; |
73 | fortuneProcess = 0; | 76 | fortuneProcess = 0; |
74 | } | 77 | } |
75 | 78 | ||
76 | } | 79 | } |
77 | 80 | ||
78 | void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len ) | 81 | void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len ) |
79 | { | 82 | { |
80 | QCString s( buf, len ); | 83 | QCString s( buf, len ); |
81 | s.replace( QRegExp("\n"), "" ); | 84 | s.replace( QRegExp("\n"), "" ); |
82 | fortune->setText( s ); | 85 | fortune->setText( s ); |