author | kergoth <kergoth> | 2003-01-26 04:34:14 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-01-26 04:34:14 (UTC) |
commit | c3347d556ea8caf355c17a169070a4c052f266de (patch) (unidiff) | |
tree | 4a13ff90baeed8e03a9149e4524a52a5d02624d3 | |
parent | 2b0f00c32cb051f8cf074747e26387620f541ca0 (diff) | |
download | opie-c3347d556ea8caf355c17a169070a4c052f266de.zip opie-c3347d556ea8caf355c17a169070a4c052f266de.tar.gz opie-c3347d556ea8caf355c17a169070a4c052f266de.tar.bz2 |
Strip newlines from the fortune.
-rw-r--r-- | noncore/todayplugins/fortune/fortunepluginwidget.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/todayplugins/fortune/fortunepluginwidget.cpp b/noncore/todayplugins/fortune/fortunepluginwidget.cpp index 583bf0b..b210fa9 100644 --- a/noncore/todayplugins/fortune/fortunepluginwidget.cpp +++ b/noncore/todayplugins/fortune/fortunepluginwidget.cpp | |||
@@ -57,27 +57,28 @@ void FortunePluginWidget::getFortune() { | |||
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 | ||
79 | void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) | 79 | void FortunePluginWidget::slotStdOut( OProcess* proc, char* buf, int len ) |
80 | { | 80 | { |
81 | QCString cstring( buf, len ); | 81 | QCString s( buf, len ); |
82 | fortune->setText( cstring ); | 82 | s.replace( QRegExp("\n"), "" ); |
83 | fortune->setText( s ); | ||
83 | } | 84 | } |