summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/output.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/output.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/output.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index a60cea6..33abdfc 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -4,25 +4,19 @@
4** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> 4** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com>
5****************************************************************************/ 5****************************************************************************/
6#include "output.h" 6#include "output.h"
7 7
8#include <opie/oprocess.h> 8#include <opie/oprocess.h>
9 9
10#include <qpe/filemanager.h>
11#include <qpe/qpeapplication.h> 10#include <qpe/qpeapplication.h>
12#include <qpe/applnk.h> 11#include <qpe/applnk.h>
13 12
14#include <qmessagebox.h>
15#include <qstringlist.h>
16#include <qfile.h> 13#include <qfile.h>
17#include <qcstring.h>
18#include <qlineedit.h>
19#include <qmultilineedit.h> 14#include <qmultilineedit.h>
20#include <qpushbutton.h> 15#include <qpushbutton.h>
21#include <qlayout.h> 16#include <qlayout.h>
22#include <qvariant.h>
23 17
24#include <errno.h> 18#include <errno.h>
25 19
26/* XPM */ 20/* XPM */
27static char * filesave_xpm[] = { 21static char * filesave_xpm[] = {
28"16 16 78 1", 22"16 16 78 1",
@@ -124,19 +118,19 @@ static char * filesave_xpm[] = {
124Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) 118Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl)
125 : QDialog( parent, name, modal, fl ) 119 : QDialog( parent, name, modal, fl )
126{ 120{
127 QStringList cmmds; 121 QStringList cmmds;
128// cmmds=QStringList::split( " ", commands, false); 122// cmmds=QStringList::split( " ", commands, false);
129 cmmds=commands; 123 cmmds=commands;
130// qDebug("count %d", cmmds.count()); 124// qDebug("count %d", cmmds.count());
131 if ( !name ) 125 if ( !name )
132 setName( tr("Output")); 126 setName( tr("Output"));
133 resize( 196, 269 ); 127 resize( 196, 269 );
134 setCaption( name ); 128 setCaption( name );
135 129
136 OutputLayout = new QGridLayout( this ); 130 OutputLayout = new QGridLayout( this );
137 OutputLayout->setSpacing( 2); 131 OutputLayout->setSpacing( 2);
138 OutputLayout->setMargin( 2); 132 OutputLayout->setMargin( 2);
139 133
140 QPushButton *docButton; 134 QPushButton *docButton;
141 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); 135 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton");
142 docButton->setFixedSize( QSize( 20, 20 ) ); 136 docButton->setFixedSize( QSize( 20, 20 ) );
@@ -158,24 +152,24 @@ Output::Output( const QStringList commands, QWidget* parent, const char* name,
158 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), 152 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)),
159 this, SLOT(commandStderr(OProcess *, char *, int))); 153 this, SLOT(commandStderr(OProcess *, char *, int)));
160 154
161// connect( , SIGNAL(received(const QByteArray &)), 155// connect( , SIGNAL(received(const QByteArray &)),
162// this, SLOT(commandStdin(const QByteArray &))); 156// this, SLOT(commandStdin(const QByteArray &)));
163 157
164// * proc << commands.latin1(); 158// * proc << commands.latin1();
165 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { 159 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) {
166 qDebug( "%s", (*it).latin1() ); 160 qDebug( "%s", (*it).latin1() );
167 * proc << (*it).latin1(); 161 * proc << (*it).latin1();
168 } 162 }
169 163
170 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { 164 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) {
171 165
172 OutputEdit->append("Process could not start"); 166 OutputEdit->append(tr("Process could not start") );
173 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 167 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
174 perror("Error: "); 168 perror("Error: ");
175 QString errorMsg="Error\n"+(QString)strerror(errno); 169 QString errorMsg=tr("Error\n")+(QString)strerror(errno);
176 OutputEdit->append( errorMsg); 170 OutputEdit->append( errorMsg);
177 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 171 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
178 } 172 }
179} 173}
180 174
181Output::~Output() { 175Output::~Output() {
@@ -184,13 +178,13 @@ Output::~Output() {
184void Output::saveOutput() { 178void Output::saveOutput() {
185 179
186 InputDialog *fileDlg; 180 InputDialog *fileDlg;
187 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 181 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
188 fileDlg->exec(); 182 fileDlg->exec();
189 if( fileDlg->result() == 1 ) { 183 if( fileDlg->result() == 1 ) {
190 QString filename = QPEApplication::documentDir(); 184 QString filename = QPEApplication::documentDir();
191 if(filename.right(1).find('/') == -1) 185 if(filename.right(1).find('/') == -1)
192 filename+="/"; 186 filename+="/";
193 QString name = fileDlg->LineEdit1->text(); 187 QString name = fileDlg->LineEdit1->text();
194 filename+="text/plain/"+name; 188 filename+="text/plain/"+name;
195 qDebug(filename); 189 qDebug(filename);
196 190
@@ -242,13 +236,13 @@ void Output::commandStderr(OProcess*, char *buffer, int buflen) {
242 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 236 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
243} 237}
244 238
245void Output::processFinished() { 239void Output::processFinished() {
246 240
247 delete proc; 241 delete proc;
248 OutputEdit->append( "\nFinished\n"); 242 OutputEdit->append( tr("\nFinished\n") );
249 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 243 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
250// close(); 244// close();
251// disconnect( layer(), SIGNAL(received(const QByteArray &)), 245// disconnect( layer(), SIGNAL(received(const QByteArray &)),
252// this, SLOT(commandStdin(const QByteArray &))); 246// this, SLOT(commandStdin(const QByteArray &)));
253} 247}
254 248
@@ -256,13 +250,13 @@ void Output::processFinished() {
256 250
257InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 251InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
258 : QDialog( parent, name, modal, fl ) 252 : QDialog( parent, name, modal, fl )
259{ 253{
260 if ( !name ) 254 if ( !name )
261 setName( "InputDialog" ); 255 setName( "InputDialog" );
262 resize( 234, 50 ); 256 resize( 234, 50 );
263 setMaximumSize( QSize( 240, 50 ) ); 257 setMaximumSize( QSize( 240, 50 ) );
264 setCaption( tr(name ) ); 258 setCaption( tr(name ) );
265 259
266 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 260 LineEdit1 = new QLineEdit( this, "LineEdit1" );
267 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); 261 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
268 LineEdit1->setFocus(); 262 LineEdit1->setFocus();