summaryrefslogtreecommitdiff
path: root/noncore/todayplugins/fortune/fortunepluginwidget.cpp
Unidiff
Diffstat (limited to 'noncore/todayplugins/fortune/fortunepluginwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/fortune/fortunepluginwidget.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
index e6a0d09..3aa978c 100644
--- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp
+++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
@@ -7,37 +7,34 @@
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#include <qpe/config.h>
20#include <qpe/qcopenvelope_qws.h>
21
19#include <qvaluelist.h> 22#include <qvaluelist.h>
20#include <qtl.h> 23#include <qtl.h>
21#include <qstring.h> 24#include <qstring.h>
22#include <qscrollview.h> 25#include <qscrollview.h>
23#include <qobject.h> 26#include <qobject.h>
24#include <qlayout.h> 27#include <qlayout.h>
25 28
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 ) 29FortunePluginWidget::FortunePluginWidget( QWidget *parent, const char* name )
33 : QWidget( parent, name ) 30 : QWidget( parent, name )
34{ 31{
35 32
36 fortune = NULL; 33 fortune = NULL;
37 getFortune(); 34 getFortune();
38} 35}
39 36
40FortunePluginWidget::~FortunePluginWidget() { 37FortunePluginWidget::~FortunePluginWidget() {
41 if( fortuneProcess ){ 38 if( fortuneProcess ){
42 delete fortuneProcess; 39 delete fortuneProcess;
43 } 40 }
@@ -54,31 +51,31 @@ void FortunePluginWidget::getFortune() {
54 delete fortune; 51 delete fortune;
55 } 52 }
56 53
57 fortune = new OTicker( this ); 54 fortune = new OTicker( this );
58 //fortune->setReadOnly( TRUE ); 55 //fortune->setReadOnly( TRUE );
59 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); 56 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
60 57
61 fortune->setText( QString("Obtaining fortune...") ); 58 fortune->setText( QString("Obtaining fortune...") );
62 layoutFortune->addWidget( fortune ); 59 layoutFortune->addWidget( fortune );
63 60
64 fortuneProcess = new OProcess(); 61 fortuneProcess = new OProcess();
65 *fortuneProcess << "fortune"; 62 *fortuneProcess << "fortune";
66 63
67 connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ), 64 connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ),
68 this, SLOT(slotStdOut(OProcess*,char*,int) ) ); 65 this, SLOT(slotStdOut(OProcess*,char*,int) ) );
69 66
70 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 67 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
71 qWarning("could not start :("); 68 qWarning("could not start :(");
72 fortune->setText( QString("Failed to obtain fortune.") ); 69 fortune->setText( QString("Failed to obtain fortune.") );
73 delete fortuneProcess; 70 delete fortuneProcess;
74 fortuneProcess = 0; 71 fortuneProcess = 0;
75 } 72 }
76 73
77} 74}
78 75
79void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) 76void FortunePluginWidget::slotStdOut( OProcess* /*proc*/, char* buf, int len )
80{ 77{
81 QCString s( buf, len ); 78 QCString s( buf, len );
82 s.replace( QRegExp("\n"), "" ); 79 s.replace( QRegExp("\n"), "" );
83 fortune->setText( s ); 80 fortune->setText( s );
84} 81}