summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp4
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp28
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp10
-rw-r--r--noncore/apps/advancedfm/output.cpp18
4 files changed, 30 insertions, 30 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index c44d387..2ba3dca 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -4,98 +4,98 @@
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#include "advancedfm.h" 13#include "advancedfm.h"
14 14
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/config.h> 16#include <qpe/config.h>
17#include <qpe/mimetype.h> 17#include <qpe/mimetype.h>
18#include <qpe/applnk.h> 18#include <qpe/applnk.h>
19#include <qpe/resource.h> 19#include <qpe/resource.h>
20#include <qpe/menubutton.h> 20#include <qpe/menubutton.h>
21 21
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qpopupmenu.h> 23#include <qpopupmenu.h>
24#include <qlistview.h> 24#include <qlistview.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27 27
28 28
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <time.h> 30#include <time.h>
31#include <dirent.h> 31#include <dirent.h>
32#include <fcntl.h> 32#include <fcntl.h>
33#include <sys/vfs.h> 33#include <sys/vfs.h>
34#include <mntent.h> 34#include <mntent.h>
35 35
36#ifdef NOQUICKLAUNCH 36#ifdef NOQUICKLAUNCH
37AdvancedFm::AdvancedFm( ) 37AdvancedFm::AdvancedFm( )
38#else 38#else
39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags ) 39AdvancedFm::AdvancedFm(QWidget *,const char*, WFlags )
40#endif 40#endif
41 : QMainWindow( ) { 41 : QMainWindow( ) {
42 init(); 42 init();
43 renameBox = 0; 43 renameBox = 0;
44 44
45 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); 45 unknownXpm = Resource::loadImage( "UnknownDocument" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
46 46
47 initConnections(); 47 initConnections();
48 whichTab=1; 48 whichTab=1;
49 rePopulate(); 49 rePopulate();
50 currentPathCombo->setFocus(); 50 currentPathCombo->setFocus();
51 channel = new QCopChannel( "QPE/Application/advancedfm", this ); 51 channel = new QCopChannel( "QPE/Application/advancedfm", this );
52 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 52 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
53 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 53 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
54} 54}
55 55
56AdvancedFm::~AdvancedFm() { 56AdvancedFm::~AdvancedFm() {
57} 57}
58 58
59 59
60void AdvancedFm::cleanUp() { 60void AdvancedFm::cleanUp() {
61 QString sfile=QDir::homeDirPath(); 61 QString sfile=QDir::homeDirPath();
62 if(sfile.right(1) != "/") 62 if(sfile.right(1) != "/")
63 sfile+="/._temp"; 63 sfile+="/._temp";
64 else 64 else
65 sfile+="._temp"; 65 sfile+="._temp";
66 QFile file( sfile); 66 QFile file( sfile);
67 if(file.exists()) 67 if(file.exists())
68 file.remove(); 68 file.remove();
69} 69}
70 70
71void AdvancedFm::tabChanged(QWidget *) { 71void AdvancedFm::tabChanged(QWidget *) {
72// qWarning("tab changed"); 72// qWarning("tab changed");
73 QString path = CurrentDir()->canonicalPath(); 73 QString path = CurrentDir()->canonicalPath();
74 currentPathCombo->lineEdit()->setText( path ); 74 currentPathCombo->lineEdit()->setText( path );
75 75
76 if(whichTab == 1) { 76 if(whichTab == 1) {
77 viewMenu->setItemChecked(viewMenu->idAt(0), true); 77 viewMenu->setItemChecked(viewMenu->idAt(0), true);
78 viewMenu->setItemChecked(viewMenu->idAt(1), false); 78 viewMenu->setItemChecked(viewMenu->idAt(1), false);
79 } else { 79 } else {
80 viewMenu->setItemChecked(viewMenu->idAt(0), false); 80 viewMenu->setItemChecked(viewMenu->idAt(0), false);
81 viewMenu->setItemChecked(viewMenu->idAt(1), true); 81 viewMenu->setItemChecked(viewMenu->idAt(1), true);
82 } 82 }
83 83
84 QString fs= getFileSystemType( (const QString &) path); 84 QString fs= getFileSystemType( (const QString &) path);
85 85
86 setCaption(tr("AdvancedFm :: ")+fs+" :: " 86 setCaption(tr("AdvancedFm :: ")+fs+" :: "
87 +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); 87 +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
88 chdir( path.latin1()); 88 chdir( path.latin1());
89} 89}
90 90
91 91
92void AdvancedFm::populateView() { 92void AdvancedFm::populateView() {
93 93
94// qWarning("PopulateView"); 94// qWarning("PopulateView");
95 QPixmap pm; 95 QPixmap pm;
96 QListView *thisView = CurrentView(); 96 QListView *thisView = CurrentView();
97 QDir *thisDir = CurrentDir(); 97 QDir *thisDir = CurrentDir();
98 QString path = thisDir->canonicalPath(); 98 QString path = thisDir->canonicalPath();
99 99
100//qWarning("path is "+path); 100//qWarning("path is "+path);
101 thisView->clear(); 101 thisView->clear();
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 763ae34..f791c77 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -208,79 +208,79 @@ void AdvancedFm::init() {
208 /////////////// 208 ///////////////
209 209
210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) 210 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
211 zaurusDevice=TRUE; 211 zaurusDevice=TRUE;
212 else 212 else
213 zaurusDevice=FALSE; 213 zaurusDevice=FALSE;
214 214
215 215
216 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) { 216 if( !StorageInfo::hasSd() || !StorageInfo::hasMmc()) {
217 qDebug("not have sd"); 217 qDebug("not have sd");
218 sdButton->hide(); 218 sdButton->hide();
219 } 219 }
220 if( !StorageInfo::hasCf() ) { 220 if( !StorageInfo::hasCf() ) {
221 qDebug("not have cf"); 221 qDebug("not have cf");
222 cfButton->hide(); 222 cfButton->hide();
223 } 223 }
224 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 224 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
225 currentDir.setPath( QDir::currentDirPath()); 225 currentDir.setPath( QDir::currentDirPath());
226 226
227 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 227 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
228 currentRemoteDir.setPath( QDir::currentDirPath()); 228 currentRemoteDir.setPath( QDir::currentDirPath());
229 229
230 // b = TRUE; 230 // b = TRUE;
231 231
232 filterStr="*"; 232 filterStr="*";
233 b=FALSE; 233 b=FALSE;
234 showMenuHidden(); 234 showMenuHidden();
235 TabWidget->setCurrentWidget(0); 235 TabWidget->setCurrentWidget(0);
236 236
237} 237}
238 238
239void AdvancedFm::initConnections() 239void AdvancedFm::initConnections()
240{ 240{
241 241
242 connect( qApp,SIGNAL( aboutToQuit()), 242 connect( qApp,SIGNAL( aboutToQuit()),
243 this, SLOT( cleanUp()) ); 243 this, SLOT( cleanUp()) );
244 connect( qpeDirButton ,SIGNAL(released()), 244 connect( qpeDirButton ,SIGNAL(released()),
245 this,SLOT( QPEButtonPushed()) ); 245 this,SLOT( QPEButtonPushed()) );
246 connect( cfButton ,SIGNAL(released()), 246 connect( cfButton ,SIGNAL(released()),
247 this,SLOT( CFButtonPushed()) ); 247 this,SLOT( CFButtonPushed()) );
248 connect( sdButton ,SIGNAL(released()), 248 connect( sdButton ,SIGNAL(released()),
249 this,SLOT( SDButtonPushed()) ); 249 this,SLOT( SDButtonPushed()) );
250 connect( cdUpButton ,SIGNAL(released()), 250 connect( cdUpButton ,SIGNAL(released()),
251 this,SLOT( upDir()) ); 251 this,SLOT( upDir()) );
252 connect( docButton,SIGNAL(released()), 252 connect( docButton,SIGNAL(released()),
253 this,SLOT( docButtonPushed()) ); 253 this,SLOT( docButtonPushed()) );
254 connect( homeButton,SIGNAL(released()), 254 connect( homeButton,SIGNAL(released()),
255 this,SLOT( homeButtonPushed()) ); 255 this,SLOT( homeButtonPushed()) );
256 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 256 connect( currentPathCombo, SIGNAL( activated(const QString&) ),
257 this, SLOT( currentPathComboActivated( const QString & ) ) ); 257 this, SLOT( currentPathComboActivated(const QString&) ) );
258 258
259 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 259 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
260 this,SLOT(currentPathComboChanged())); 260 this,SLOT(currentPathComboChanged()));
261 261
262 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 262 connect( Local_View, SIGNAL( clicked(QListViewItem*)),
263 this,SLOT( ListClicked(QListViewItem *)) ); 263 this,SLOT( ListClicked(QListViewItem*)) );
264 264
265 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 265 connect( Local_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
266 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 266 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
267 267
268 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 268 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
269 269
270 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 270 connect( Remote_View, SIGNAL( clicked(QListViewItem*)),
271 this,SLOT( ListClicked(QListViewItem *)) ); 271 this,SLOT( ListClicked(QListViewItem*)) );
272 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 272 connect( Remote_View, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)),
273 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 273 this,SLOT( ListPressed(int,QListViewItem*,const QPoint&,int)) );
274 274
275 connect( TabWidget,SIGNAL(currentChanged(QWidget *)), 275 connect( TabWidget,SIGNAL(currentChanged(QWidget*)),
276 this,SLOT(tabChanged(QWidget*))); 276 this,SLOT(tabChanged(QWidget*)));
277 277
278 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 278 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
279 279
280 connect( menuButton, SIGNAL( selected(const QString &)), SLOT(gotoCustomDir(const QString&))); 280 connect( menuButton, SIGNAL( selected(const QString&)), SLOT(gotoCustomDir(const QString&)));
281// connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int))); 281// connect( menuButton, SIGNAL( selected(int)), SLOT( dirMenuSelected(int)));
282 connect( viewMenu, SIGNAL( activated(int )), this, SLOT(slotSwitchMenu(int ))); 282 connect( viewMenu, SIGNAL( activated(int)), this, SLOT(slotSwitchMenu(int)));
283// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int))); 283// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int)));
284 284
285} 285}
286 286
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 9ad1146..9e740d0 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -636,122 +636,122 @@ void AdvancedFm::rn() {
636} 636}
637 637
638void AdvancedFm::del() { 638void AdvancedFm::del() {
639 doDelete(); 639 doDelete();
640} 640}
641 641
642void AdvancedFm::mkSym() { 642void AdvancedFm::mkSym() {
643 QString cmd; 643 QString cmd;
644 QStringList curFileList = getPath(); 644 QStringList curFileList = getPath();
645 if( curFileList.count() > 0) { 645 if( curFileList.count() > 0) {
646 QDir *thisDir = CurrentDir(); 646 QDir *thisDir = CurrentDir();
647 QDir * thatDir = OtherDir(); 647 QDir * thatDir = OtherDir();
648 648
649 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 649 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
650 650
651 QString destName = thatDir->canonicalPath()+"/"+(*it); 651 QString destName = thatDir->canonicalPath()+"/"+(*it);
652 if(destName.right(1) == "/") { 652 if(destName.right(1) == "/") {
653 destName = destName.left( destName.length() -1); 653 destName = destName.left( destName.length() -1);
654 } 654 }
655 655
656 QString curFile = thisDir->canonicalPath()+"/"+(*it); 656 QString curFile = thisDir->canonicalPath()+"/"+(*it);
657 657
658 if( curFile.right(1) == "/") { 658 if( curFile.right(1) == "/") {
659 curFile = curFile.left( curFile.length() -1); 659 curFile = curFile.left( curFile.length() -1);
660 } 660 }
661 661
662 cmd = "ln -s "+curFile+" "+destName; 662 cmd = "ln -s "+curFile+" "+destName;
663// qDebug(cmd); 663// qDebug(cmd);
664 startProcess( (const QString)cmd ); 664 startProcess( (const QString)cmd );
665 } 665 }
666 rePopulate(); 666 rePopulate();
667 setOtherTabCurrent(); 667 setOtherTabCurrent();
668 } 668 }
669} 669}
670 670
671void AdvancedFm::doBeam() { 671void AdvancedFm::doBeam() {
672 Ir ir; 672 Ir ir;
673 if(!ir.supported()) { 673 if(!ir.supported()) {
674 } else { 674 } else {
675 QStringList curFileList = getPath(); 675 QStringList curFileList = getPath();
676 if( curFileList.count() > 0) { 676 if( curFileList.count() > 0) {
677 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 677 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
678 QString curFile = (*it); 678 QString curFile = (*it);
679 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 679 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
680 if( curFilePath.right(1) == "/") { 680 if( curFilePath.right(1) == "/") {
681 curFilePath = curFilePath.left( curFilePath.length() -1); 681 curFilePath = curFilePath.left( curFilePath.length() -1);
682 } 682 }
683 Ir *file = new Ir(this, "IR"); 683 Ir *file = new Ir(this, "IR");
684 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 684 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
685 file->send( curFilePath, curFile ); 685 file->send( curFilePath, curFile );
686 } 686 }
687 } 687 }
688 } 688 }
689} 689}
690 690
691void AdvancedFm::fileBeamFinished( Ir *) { 691void AdvancedFm::fileBeamFinished( Ir *) {
692 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 692 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
693} 693}
694 694
695void AdvancedFm::selectAll() { 695void AdvancedFm::selectAll() {
696 QListView *thisView = CurrentView(); 696 QListView *thisView = CurrentView();
697 thisView->selectAll(true); 697 thisView->selectAll(true);
698 thisView->setSelected( thisView->firstChild(),false); 698 thisView->setSelected( thisView->firstChild(),false);
699} 699}
700 700
701void AdvancedFm::startProcess(const QString & cmd) { 701void AdvancedFm::startProcess(const QString & cmd) {
702 QStringList command; 702 QStringList command;
703 OProcess *process; 703 OProcess *process;
704 process = new OProcess(); 704 process = new OProcess();
705 connect(process, SIGNAL(processExited(OProcess *)), 705 connect(process, SIGNAL(processExited(OProcess*)),
706 this, SLOT( processEnded(OProcess *))); 706 this, SLOT( processEnded(OProcess*)));
707 707
708 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), 708 connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)),
709 this, SLOT( oprocessStderr(OProcess *, char *, int))); 709 this, SLOT( oprocessStderr(OProcess*,char*,int)));
710 710
711 command << "/bin/sh"; 711 command << "/bin/sh";
712 command << "-c"; 712 command << "-c";
713 command << cmd.latin1(); 713 command << cmd.latin1();
714 *process << command; 714 *process << command;
715 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 715 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
716 qDebug("could not start process"); 716 qDebug("could not start process");
717} 717}
718 718
719void AdvancedFm::processEnded(OProcess *) { 719void AdvancedFm::processEnded(OProcess *) {
720 rePopulate(); 720 rePopulate();
721} 721}
722 722
723void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 723void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
724// qWarning("received stderrt %d bytes", buflen); 724// qWarning("received stderrt %d bytes", buflen);
725 725
726 QString lineStr = buffer; 726 QString lineStr = buffer;
727 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 727 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
728} 728}
729 729
730bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 730bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
731 if ( o->inherits( "QLineEdit" ) ) { 731 if ( o->inherits( "QLineEdit" ) ) {
732 if ( e->type() == QEvent::KeyPress ) { 732 if ( e->type() == QEvent::KeyPress ) {
733 QKeyEvent *ke = (QKeyEvent*)e; 733 QKeyEvent *ke = (QKeyEvent*)e;
734 if ( ke->key() == Key_Return || 734 if ( ke->key() == Key_Return ||
735 ke->key() == Key_Enter ) { 735 ke->key() == Key_Enter ) {
736 okRename(); 736 okRename();
737 return true; 737 return true;
738 } 738 }
739 else if ( ke->key() == Key_Escape ) { 739 else if ( ke->key() == Key_Escape ) {
740 cancelRename(); 740 cancelRename();
741 return true; 741 return true;
742 } 742 }
743 } 743 }
744 else if ( e->type() == QEvent::FocusOut ) { 744 else if ( e->type() == QEvent::FocusOut ) {
745 cancelRename(); 745 cancelRename();
746 return true; 746 return true;
747 } 747 }
748 } 748 }
749 if ( o->inherits( "QListView" ) ) { 749 if ( o->inherits( "QListView" ) ) {
750 if ( e->type() == QEvent::FocusIn ) { 750 if ( e->type() == QEvent::FocusIn ) {
751 if( o == Local_View) { //keep track of which view 751 if( o == Local_View) { //keep track of which view
752 whichTab=1; 752 whichTab=1;
753 } 753 }
754 else { 754 else {
755 whichTab=2; 755 whichTab=2;
756 } 756 }
757 } 757 }
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 7dc2416..0bba1d8 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -96,181 +96,181 @@ static char * filesave_xpm[] = {
96"K c #323232", 96"K c #323232",
97"L c #D0D0D0", 97"L c #D0D0D0",
98"M c #1C1C1C", 98"M c #1C1C1C",
99" ...+ ", 99" ...+ ",
100" @#$%&..+ ", 100" @#$%&..+ ",
101" .*=-;;>,..+ ", 101" .*=-;;>,..+ ",
102" ')!~;;;;;;{]..", 102" ')!~;;;;;;{]..",
103" ^/(-;;;;;;;_:<", 103" ^/(-;;;;;;;_:<",
104" [}|;;;;;;;{12$", 104" [}|;;;;;;;{12$",
105" #34-55;;;;678$+", 105" #34-55;;;;678$+",
106" 90ab=c;dd;e1fg ", 106" 90ab=c;dd;e1fg ",
107" [ahij((kbl0mn$ ", 107" [ahij((kbl0mn$ ",
108" op^q^^7r&]s/$+ ", 108" op^q^^7r&]s/$+ ",
109"@btu;vbwxy]zAB ", 109"@btu;vbwxy]zAB ",
110"CzDEvEv;;DssF$ ", 110"CzDEvEv;;DssF$ ",
111"G.H{E{E{IxsJ$+ ", 111"G.H{E{E{IxsJ$+ ",
112" +...vEKxzLM ", 112" +...vEKxzLM ",
113" +...z]n$ ", 113" +...z]n$ ",
114" +... "}; 114" +... "};
115 115
116Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) 116Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl)
117 : QDialog( parent, name, modal, fl ) 117 : QDialog( parent, name, modal, fl )
118{ 118{
119 QStringList cmmds; 119 QStringList cmmds;
120// cmmds=QStringList::split( " ", commands, false); 120// cmmds=QStringList::split( " ", commands, false);
121 cmmds=commands; 121 cmmds=commands;
122// qDebug("count %d", cmmds.count()); 122// qDebug("count %d", cmmds.count());
123 if ( !name ) 123 if ( !name )
124 setName( tr("Output")); 124 setName( tr("Output"));
125 resize( 196, 269 ); 125 resize( 196, 269 );
126 setCaption( name ); 126 setCaption( name );
127 127
128 OutputLayout = new QGridLayout( this ); 128 OutputLayout = new QGridLayout( this );
129 OutputLayout->setSpacing( 2); 129 OutputLayout->setSpacing( 2);
130 OutputLayout->setMargin( 2); 130 OutputLayout->setMargin( 2);
131 131
132 QPushButton *docButton; 132 QPushButton *docButton;
133 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); 133 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton");
134 docButton->setFixedSize( QSize( 20, 20 ) ); 134 docButton->setFixedSize( QSize( 20, 20 ) );
135 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); 135 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() ));
136 // docButton->setFlat(TRUE); 136 // docButton->setFlat(TRUE);
137 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); 137 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 );
138 138
139 OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); 139 OutputEdit = new QMultiLineEdit( this, "OutputEdit" );
140 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); 140 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 );
141 141
142 proc = new OProcess(); 142 proc = new OProcess();
143 143
144 connect(proc, SIGNAL(processExited(OProcess *)), 144 connect(proc, SIGNAL(processExited(OProcess*)),
145 this, SLOT( processFinished())); 145 this, SLOT( processFinished()));
146 146
147 connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), 147 connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)),
148 this, SLOT(commandStdout(OProcess *, char *, int))); 148 this, SLOT(commandStdout(OProcess*,char*,int)));
149 149
150 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), 150 connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)),
151 this, SLOT(commandStderr(OProcess *, char *, int))); 151 this, SLOT(commandStderr(OProcess*,char*,int)));
152 152
153// connect( , SIGNAL(received(const QByteArray &)), 153// connect( , SIGNAL(received(const QByteArray&)),
154// this, SLOT(commandStdin(const QByteArray &))); 154// this, SLOT(commandStdin(const QByteArray&)));
155 155
156// * proc << commands.latin1(); 156// * proc << commands.latin1();
157 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { 157 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) {
158 qDebug( "%s", (*it).latin1() ); 158 qDebug( "%s", (*it).latin1() );
159 * proc << (*it).latin1(); 159 * proc << (*it).latin1();
160 } 160 }
161 161
162 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { 162 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) {
163 163
164 OutputEdit->append(tr("Process could not start") ); 164 OutputEdit->append(tr("Process could not start") );
165 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 165 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
166 perror("Error: "); 166 perror("Error: ");
167 QString errorMsg=tr("Error\n")+(QString)strerror(errno); 167 QString errorMsg=tr("Error\n")+(QString)strerror(errno);
168 OutputEdit->append( errorMsg); 168 OutputEdit->append( errorMsg);
169 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 169 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
170 } 170 }
171} 171}
172 172
173Output::~Output() { 173Output::~Output() {
174} 174}
175 175
176void Output::saveOutput() { 176void Output::saveOutput() {
177 177
178 InputDialog *fileDlg; 178 InputDialog *fileDlg;
179 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 179 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
180 fileDlg->exec(); 180 fileDlg->exec();
181 if( fileDlg->result() == 1 ) { 181 if( fileDlg->result() == 1 ) {
182 QString filename = QPEApplication::documentDir(); 182 QString filename = QPEApplication::documentDir();
183 if(filename.right(1).find('/') == -1) 183 if(filename.right(1).find('/') == -1)
184 filename+="/"; 184 filename+="/";
185 QString name = fileDlg->LineEdit1->text(); 185 QString name = fileDlg->LineEdit1->text();
186 filename+="text/plain/"+name; 186 filename+="text/plain/"+name;
187 qDebug(filename); 187 qDebug(filename);
188 188
189 QFile f(filename); 189 QFile f(filename);
190 f.open( IO_WriteOnly); 190 f.open( IO_WriteOnly);
191 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { 191 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
192 DocLnk lnk; 192 DocLnk lnk;
193 lnk.setName(name); //sets file name 193 lnk.setName(name); //sets file name
194 lnk.setFile(filename); //sets File property 194 lnk.setFile(filename); //sets File property
195 lnk.setType("text/plain"); 195 lnk.setType("text/plain");
196 if(!lnk.writeLink()) { 196 if(!lnk.writeLink()) {
197 qDebug("Writing doclink did not work"); 197 qDebug("Writing doclink did not work");
198 } 198 }
199 } else 199 } else
200 qWarning("Could not write file"); 200 qWarning("Could not write file");
201 f.close(); 201 f.close();
202 } 202 }
203} 203}
204 204
205void Output::commandStdout(OProcess*, char *buffer, int buflen) { 205void Output::commandStdout(OProcess*, char *buffer, int buflen) {
206 qWarning("received stdout %d bytes", buflen); 206 qWarning("received stdout %d bytes", buflen);
207 207
208// QByteArray data(buflen); 208// QByteArray data(buflen);
209// data.fill(*buffer, buflen); 209// data.fill(*buffer, buflen);
210// for (uint i = 0; i < data.count(); i++ ) { 210// for (uint i = 0; i < data.count(); i++ ) {
211// printf("%c", buffer[i] ); 211// printf("%c", buffer[i] );
212// } 212// }
213// printf("\n"); 213// printf("\n");
214 214
215 QString lineStr = buffer; 215 QString lineStr = buffer;
216 lineStr=lineStr.left(lineStr.length()-1); 216 lineStr=lineStr.left(lineStr.length()-1);
217 OutputEdit->append(lineStr); 217 OutputEdit->append(lineStr);
218 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 218 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
219} 219}
220 220
221 221
222void Output::commandStdin( const QByteArray &data) { 222void Output::commandStdin( const QByteArray &data) {
223 qWarning("received stdin %d bytes", data.size()); 223 qWarning("received stdin %d bytes", data.size());
224 // recieved data from the io layer goes to sz 224 // recieved data from the io layer goes to sz
225 proc->writeStdin(data.data(), data.size()); 225 proc->writeStdin(data.data(), data.size());
226} 226}
227 227
228void Output::commandStderr(OProcess*, char *buffer, int buflen) { 228void Output::commandStderr(OProcess*, char *buffer, int buflen) {
229 qWarning("received stderrt %d bytes", buflen); 229 qWarning("received stderrt %d bytes", buflen);
230 230
231 QString lineStr = buffer; 231 QString lineStr = buffer;
232// lineStr=lineStr.left(lineStr.length()-1); 232// lineStr=lineStr.left(lineStr.length()-1);
233 OutputEdit->append(lineStr); 233 OutputEdit->append(lineStr);
234 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 234 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
235} 235}
236 236
237void Output::processFinished() { 237void Output::processFinished() {
238 238
239 delete proc; 239 delete proc;
240 OutputEdit->append( tr("\nFinished\n") ); 240 OutputEdit->append( tr("\nFinished\n") );
241 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); 241 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
242// close(); 242// close();
243// disconnect( layer(), SIGNAL(received(const QByteArray &)), 243// disconnect( layer(), SIGNAL(received(const QByteArray&)),
244// this, SLOT(commandStdin(const QByteArray &))); 244// this, SLOT(commandStdin(const QByteArray&)));
245} 245}
246 246
247//============================== 247//==============================
248 248
249InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 249InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
250 : QDialog( parent, name, modal, fl ) 250 : QDialog( parent, name, modal, fl )
251{ 251{
252 if ( !name ) 252 if ( !name )
253 setName( "InputDialog" ); 253 setName( "InputDialog" );
254 resize( 234, 50 ); 254 resize( 234, 50 );
255 setMaximumSize( QSize( 240, 50 ) ); 255 setMaximumSize( QSize( 240, 50 ) );
256 setCaption( tr(name ) ); 256 setCaption( tr(name ) );
257 257
258 LineEdit1 = new QLineEdit( this, "LineEdit1" ); 258 LineEdit1 = new QLineEdit( this, "LineEdit1" );
259 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); 259 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
260 LineEdit1->setFocus(); 260 LineEdit1->setFocus();
261 LineEdit1->setFocus(); 261 LineEdit1->setFocus();
262 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); 262 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() ));
263} 263}
264 264
265InputDialog::~InputDialog() { 265InputDialog::~InputDialog() {
266 inputText = LineEdit1->text(); 266 inputText = LineEdit1->text();
267} 267}
268 268
269void InputDialog::setInputText(const QString &string) { 269void InputDialog::setInputText(const QString &string) {
270 LineEdit1->setText( string); 270 LineEdit1->setText( string);
271} 271}
272 272
273void InputDialog::returned() { 273void InputDialog::returned() {
274 inputText = LineEdit1->text(); 274 inputText = LineEdit1->text();
275 this->accept(); 275 this->accept();
276} 276}