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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
index b210fa9..e6a0d09 100644
--- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp
+++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp
@@ -43,42 +43,42 @@ FortunePluginWidget::~FortunePluginWidget() {
43 } 43 }
44} 44}
45 45
46/** 46/**
47 * Get the fortunes 47 * Get the fortunes
48 */ 48 */
49void FortunePluginWidget::getFortune() { 49void FortunePluginWidget::getFortune() {
50 50
51 QVBoxLayout* layoutFortune = new QVBoxLayout( this ); 51 QVBoxLayout* layoutFortune = new QVBoxLayout( this );
52 52
53 if ( fortune ) { 53 if ( fortune ) {
54 delete fortune; 54 delete fortune;
55 } 55 }
56 56
57 fortune = new OTicker( this ); 57 fortune = new OTicker( this );
58 //fortune->setReadOnly( TRUE ); 58 //fortune->setReadOnly( TRUE );
59 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); 59 //fortune->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
60 60
61 fortune->setText( QString("Obtaining fortune...") ); 61 fortune->setText( QString("Obtaining fortune...") );
62 layoutFortune->addWidget( fortune ); 62 layoutFortune->addWidget( fortune );
63 63
64 fortuneProcess = new OProcess(); 64 fortuneProcess = new OProcess();
65 *fortuneProcess << "fortune"; 65 *fortuneProcess << "fortune";
66 66
67 connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*, char*, int ) ), 67 connect(fortuneProcess, SIGNAL(receivedStdout(OProcess*,char*,int) ),
68 this, SLOT(slotStdOut(OProcess*, char*, int) ) ); 68 this, SLOT(slotStdOut(OProcess*,char*,int) ) );
69 69
70 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 70 if(!fortuneProcess->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
71 qWarning("could not start :("); 71 qWarning("could not start :(");
72 fortune->setText( QString("Failed to obtain fortune.") ); 72 fortune->setText( QString("Failed to obtain fortune.") );
73 delete fortuneProcess; 73 delete fortuneProcess;
74 fortuneProcess = 0; 74 fortuneProcess = 0;
75 } 75 }
76 76
77} 77}
78 78
79void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) 79void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len )
80{ 80{
81 QCString s( buf, len ); 81 QCString s( buf, len );
82 s.replace( QRegExp("\n"), "" ); 82 s.replace( QRegExp("\n"), "" );
83 fortune->setText( s ); 83 fortune->setText( s );
84} 84}