summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.h3
-rw-r--r--noncore/apps/advancedfm/advancedfm.pro4
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp215
-rw-r--r--noncore/apps/advancedfm/inputDialog.cpp44
-rw-r--r--noncore/apps/advancedfm/inputDialog.h35
-rw-r--r--noncore/apps/advancedfm/output.cpp142
-rw-r--r--noncore/apps/advancedfm/output.h32
7 files changed, 274 insertions, 201 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 7bccce9..9948255 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,154 +1,157 @@
1/*************************************************************************** 1/***************************************************************************
2 advancedfm.h 2 advancedfm.h
3 ------------------- 3 -------------------
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#ifndef ADVANCEDFM_H 12#ifndef ADVANCEDFM_H
13#define ADVANCEDFM_H 13#define ADVANCEDFM_H
14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties 14#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
15#define QT_QWS_OPIE 15#define QT_QWS_OPIE
16 16
17//#include <opie/otabwidget.h> 17//#include <opie/otabwidget.h>
18#include <qpe/ir.h> 18#include <qpe/ir.h>
19 19
20#include <qvariant.h> 20#include <qvariant.h>
21#include <qdialog.h> 21#include <qdialog.h>
22#include <qmainwindow.h> 22#include <qmainwindow.h>
23#include <qstringlist.h> 23#include <qstringlist.h>
24#include <qdir.h> 24#include <qdir.h>
25#include <qstring.h> 25#include <qstring.h>
26#include <qpoint.h> 26#include <qpoint.h>
27#include <qtimer.h> 27#include <qtimer.h>
28 28
29class OTabWidget; 29class OTabWidget;
30class QVBoxLayout; 30class QVBoxLayout;
31class QHBoxLayout; 31class QHBoxLayout;
32class QGridLayout; 32class QGridLayout;
33class QComboBox; 33class QComboBox;
34class QListView; 34class QListView;
35class QListviewItem; 35class QListviewItem;
36class QLabel; 36class QLabel;
37class QProgressBar; 37class QProgressBar;
38class QSpinBox; 38class QSpinBox;
39class QTabWidget; 39class QTabWidget;
40class QWidget; 40class QWidget;
41class QPEToolBar; 41class QPEToolBar;
42class QPEMenuBar; 42class QPEMenuBar;
43class QPopupMenu; 43class QPopupMenu;
44class QFile; 44class QFile;
45class QListViewItem; 45class QListViewItem;
46class QLineEdit; 46class QLineEdit;
47//class QPushButton; 47//class QPushButton;
48class QToolButton; 48class QToolButton;
49class Ir; 49class Ir;
50 50
51class AdvancedFm : public QMainWindow 51class AdvancedFm : public QMainWindow
52{ 52{
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 AdvancedFm(); 55 AdvancedFm();
56 ~AdvancedFm(); 56 ~AdvancedFm();
57 57
58 OTabWidget *TabWidget; 58 OTabWidget *TabWidget;
59// QTabWidget *TabWidget; 59// QTabWidget *TabWidget;
60 QWidget *tab, *tab_2, *tab_3; 60 QWidget *tab, *tab_2, *tab_3;
61 QListView *Local_View, *Remote_View; 61 QListView *Local_View, *Remote_View;
62 62
63 QLineEdit *currentPathEdit; 63 QLineEdit *currentPathEdit;
64 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; 64 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
65 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 65 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
66// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 66// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
67 QDir currentDir, currentRemoteDir; 67 QDir currentDir, currentRemoteDir;
68 QComboBox *currentPathCombo; 68 QComboBox *currentPathCombo;
69 QString filterStr; 69 QString filterStr;
70 QListViewItem * item; 70 QListViewItem * item;
71 bool b; 71 bool b;
72 QStringList fileSystemTypeList, fsList; 72 QStringList fileSystemTypeList, fsList;
73 int currentServerConfig; 73 int currentServerConfig;
74protected slots: 74protected slots:
75 void selectAll(); 75 void selectAll();
76 void addToDocs(); 76 void addToDocs();
77 void doLocalCd(); 77 void doLocalCd();
78 void doRemoteCd(); 78 void doRemoteCd();
79// void copy(); 79// void copy();
80 void mkDir(); 80 void mkDir();
81 void del(); 81 void del();
82 void rn(); 82 void rn();
83 void populateLocalView(); 83 void populateLocalView();
84 void populateRemoteView(); 84 void populateRemoteView();
85 void showHidden(); 85 void showHidden();
86 void showMenuHidden(); 86 void showMenuHidden();
87 void showRemoteHidden(); 87 void showRemoteHidden();
88 void writeConfig(); 88 void writeConfig();
89 void readConfig(); 89 void readConfig();
90 void localListClicked(QListViewItem *); 90 void localListClicked(QListViewItem *);
91 void remoteListClicked(QListViewItem *); 91 void remoteListClicked(QListViewItem *);
92 void localListPressed( int, QListViewItem *, const QPoint&, int); 92 void localListPressed( int, QListViewItem *, const QPoint&, int);
93 void remoteListPressed( int, QListViewItem *, const QPoint&, int); 93 void remoteListPressed( int, QListViewItem *, const QPoint&, int);
94 void localMakDir(); 94 void localMakDir();
95 void localDelete(); 95 void localDelete();
96 void remoteMakDir(); 96 void remoteMakDir();
97 void remoteDelete(); 97 void remoteDelete();
98/* bool remoteDirList(const QString &); */ 98/* bool remoteDirList(const QString &); */
99/* bool remoteChDir(const QString &); */ 99/* bool remoteChDir(const QString &); */
100 void tabChanged(QWidget*); 100 void tabChanged(QWidget*);
101 void cleanUp(); 101 void cleanUp();
102 void remoteRename(); 102 void remoteRename();
103 void localRename(); 103 void localRename();
104 void runThis(); 104 void runThis();
105 void runText(); 105 void runText();
106 void filePerms(); 106 void filePerms();
107 void doProperties(); 107 void doProperties();
108 void runCommand(); 108 void runCommand();
109 void runCommandStd(); 109 void runCommandStd();
110 QStringList getPath(); 110 QStringList getPath();
111 void mkSym(); 111 void mkSym();
112 void switchToLocalTab(); 112 void switchToLocalTab();
113 void switchToRemoteTab(); 113 void switchToRemoteTab();
114 114
115protected: 115protected:
116 bool zaurusDevice; 116 bool zaurusDevice;
117 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 117 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
118 QStringList remoteDirPathStringList, localDirPathStringList; 118 QStringList remoteDirPathStringList, localDirPathStringList;
119 119
120 void init(); 120 void init();
121 void initConnections(); 121 void initConnections();
122 void keyReleaseEvent( QKeyEvent *); 122 void keyReleaseEvent( QKeyEvent *);
123 QString getFileSystemType(const QString &); 123 QString getFileSystemType(const QString &);
124 QString getDiskSpace(const QString &); 124 QString getDiskSpace(const QString &);
125 void parsetab(const QString &fileName); 125 void parsetab(const QString &fileName);
126 QString checkDiskSpace(const QString &); 126 QString checkDiskSpace(const QString &);
127 127
128protected slots: 128protected slots:
129 void showFileMenu(); 129 void showFileMenu();
130 void cancelMenuTimer(); 130 void cancelMenuTimer();
131 void homeButtonPushed(); 131 void homeButtonPushed();
132 void docButtonPushed(); 132 void docButtonPushed();
133 void SDButtonPushed(); 133 void SDButtonPushed();
134 void CFButtonPushed(); 134 void CFButtonPushed();
135 void QPEButtonPushed(); 135 void QPEButtonPushed();
136 void upDir(); 136 void upDir();
137 void currentPathComboChanged(); 137 void currentPathComboChanged();
138 void copy(); 138 void copy();
139 void copyAs(); 139 void copyAs();
140 void copySameDir(); 140 void copySameDir();
141 void currentPathComboActivated(const QString &); 141 void currentPathComboActivated(const QString &);
142 void fillCombo(const QString &); 142 void fillCombo(const QString &);
143 bool copyFile( const QString & , const QString & ); 143 bool copyFile( const QString & , const QString & );
144 void move(); 144 void move();
145 void fileStatus(); 145 void fileStatus();
146 void doAbout(); 146 void doAbout();
147 void doBeam(); 147 void doBeam();
148 void fileBeamFinished( Ir *); 148 void fileBeamFinished( Ir *);
149 149
150private: 150private:
151 QTimer menuTimer; 151 QTimer menuTimer;
152 void startProcess(const QString &);
153private slots:
154 void processEnded();
152}; 155};
153 156
154#endif // ADVANCEDFM_H 157#endif // ADVANCEDFM_H
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro
index bda2fdf..0e037a1 100644
--- a/noncore/apps/advancedfm/advancedfm.pro
+++ b/noncore/apps/advancedfm/advancedfm.pro
@@ -1,24 +1,24 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qt warn_on release 2CONFIG += qt warn_on release
3HEADERS = advancedfm.h inputDialog.h filePermissions.h output.h 3HEADERS = advancedfm.h filePermissions.h output.h
4SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp inputDialog.cpp filePermissions.cpp output.cpp main.cpp 4SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp
5TARGET = advancedfm 5TARGET = advancedfm
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 7DEPENDPATH += $(OPIEDIR)/include
8DESTDIR = $(OPIEDIR)/bin 8DESTDIR = $(OPIEDIR)/bin
9LIBS += -lqpe -lopie 9LIBS += -lqpe -lopie
10 10
11TRANSLATIONS = ../../../i18n/de/advancedfm.ts \ 11TRANSLATIONS = ../../../i18n/de/advancedfm.ts \
12 ../../../i18n/en/advancedfm.ts \ 12 ../../../i18n/en/advancedfm.ts \
13 ../../../i18n/es/advancedfm.ts \ 13 ../../../i18n/es/advancedfm.ts \
14 ../../../i18n/fr/advancedfm.ts \ 14 ../../../i18n/fr/advancedfm.ts \
15 ../../../i18n/hu/advancedfm.ts \ 15 ../../../i18n/hu/advancedfm.ts \
16 ../../../i18n/ja/advancedfm.ts \ 16 ../../../i18n/ja/advancedfm.ts \
17 ../../../i18n/ko/advancedfm.ts \ 17 ../../../i18n/ko/advancedfm.ts \
18 ../../../i18n/no/advancedfm.ts \ 18 ../../../i18n/no/advancedfm.ts \
19 ../../../i18n/pl/advancedfm.ts \ 19 ../../../i18n/pl/advancedfm.ts \
20 ../../../i18n/pt/advancedfm.ts \ 20 ../../../i18n/pt/advancedfm.ts \
21 ../../../i18n/pt_BR/advancedfm.ts \ 21 ../../../i18n/pt_BR/advancedfm.ts \
22 ../../../i18n/sl/advancedfm.ts \ 22 ../../../i18n/sl/advancedfm.ts \
23 ../../../i18n/zh_CN/advancedfm.ts \ 23 ../../../i18n/zh_CN/advancedfm.ts \
24 ../../../i18n/zh_TW/advancedfm.ts 24 ../../../i18n/zh_TW/advancedfm.ts
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index f89ad30..0a9f921 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,1020 +1,1037 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
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#include "advancedfm.h" 12#include "advancedfm.h"
13#include "inputDialog.h"
14#include "output.h" 13#include "output.h"
15#include "filePermissions.h" 14#include "filePermissions.h"
16 15
17#include <opie/otabwidget.h> 16#include <opie/otabwidget.h>
17#include <opie/oprocess.h>
18 18
19#include <qpe/lnkproperties.h> 19#include <qpe/lnkproperties.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21#include <qpe/qpemenubar.h> 21#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
23#include <qpe/resource.h> 23#include <qpe/resource.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/applnk.h> 25#include <qpe/applnk.h>
26#include <qpe/ir.h> 26#include <qpe/ir.h>
27 27
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <qmultilineedit.h> 29#include <qmultilineedit.h>
30 30
31#include <qstring.h> 31#include <qstring.h>
32 32
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qpopupmenu.h> 36#include <qpopupmenu.h>
37#include <qtabwidget.h> 37#include <qtabwidget.h>
38#include <qtoolbutton.h> 38#include <qtoolbutton.h>
39#include <qtabwidget.h> 39#include <qtabwidget.h>
40#include <qlineedit.h> 40#include <qlineedit.h>
41#include <qlistview.h> 41#include <qlistview.h>
42 42
43#include <stdlib.h> 43#include <stdlib.h>
44#include <unistd.h> 44#include <unistd.h>
45#include <sys/stat.h> 45#include <sys/stat.h>
46#include <dirent.h> 46#include <dirent.h>
47 47
48 48
49void AdvancedFm::doLocalCd() { 49void AdvancedFm::doLocalCd() {
50 localListClicked( Local_View->currentItem()); 50 localListClicked( Local_View->currentItem());
51} 51}
52 52
53void AdvancedFm::doRemoteCd() { 53void AdvancedFm::doRemoteCd() {
54 localListClicked( Remote_View->currentItem()); 54 localListClicked( Remote_View->currentItem());
55} 55}
56 56
57void AdvancedFm::showMenuHidden() { 57void AdvancedFm::showMenuHidden() {
58 if (b) { 58 if (b) {
59 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 59 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
60 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 60 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
61 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 61 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
62// b=FALSE; 62// b=FALSE;
63 63
64 } else { 64 } else {
65 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 65 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
66 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 66 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
67 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 67 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
68// b=TRUE; 68// b=TRUE;
69 } 69 }
70 populateLocalView(); 70 populateLocalView();
71 populateRemoteView(); 71 populateRemoteView();
72// if(TabWidget->getCurrentTab() == 0) 72// if(TabWidget->getCurrentTab() == 0)
73// showHidden(); 73// showHidden();
74// else 74// else
75// showRemoteHidden(); 75// showRemoteHidden();
76// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); 76// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
77 if(b) b = false; else b = true; 77 if(b) b = false; else b = true;
78} 78}
79 79
80void AdvancedFm::showHidden() { 80void AdvancedFm::showHidden() {
81 if (b) { 81 if (b) {
82 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 82 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
83// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 83// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
84// b=FALSE; 84// b=FALSE;
85 85
86 } else { 86 } else {
87 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 87 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
88// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 88// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
89// b=TRUE; 89// b=TRUE;
90 } 90 }
91 populateLocalView(); 91 populateLocalView();
92} 92}
93 93
94void AdvancedFm::showRemoteHidden() { 94void AdvancedFm::showRemoteHidden() {
95 if (b) { 95 if (b) {
96 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 96 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
97// b=TRUE; 97// b=TRUE;
98 98
99 } else { 99 } else {
100 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 100 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
101// b=FALSE; 101// b=FALSE;
102 } 102 }
103 populateRemoteView(); 103 populateRemoteView();
104} 104}
105 105
106void AdvancedFm::runThis() { 106void AdvancedFm::runThis() {
107 QString fs; 107 QString fs;
108 if (TabWidget->getCurrentTab() == 0) { 108 if (TabWidget->getCurrentTab() == 0) {
109 QString curFile = Local_View->currentItem()->text(0); 109 QString curFile = Local_View->currentItem()->text(0);
110 if(curFile != "../") { 110 if(curFile != "../") {
111 111
112 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 112 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
113 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 113 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
114 qDebug( fileInfo.owner()); 114 qDebug( fileInfo.owner());
115 if( (fileInfo.permission( QFileInfo::ExeUser) 115 if( (fileInfo.permission( QFileInfo::ExeUser)
116 | fileInfo.permission( QFileInfo::ExeGroup) 116 | fileInfo.permission( QFileInfo::ExeGroup)
117 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 117 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
118 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 118 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
119 QCopEnvelope e("QPE/System", "execute(QString)" ); 119 QCopEnvelope e("QPE/System", "execute(QString)" );
120 e << curFile; 120 e << curFile;
121 } else { 121 } else {
122 curFile = currentDir.canonicalPath()+"/"+curFile; 122 curFile = currentDir.canonicalPath()+"/"+curFile;
123 DocLnk nf(curFile); 123 DocLnk nf(curFile);
124 QString execStr = nf.exec(); 124 QString execStr = nf.exec();
125 qDebug( execStr); 125 qDebug( execStr);
126 if( execStr.isEmpty() ) { 126 if( execStr.isEmpty() ) {
127 } else { 127 } else {
128 nf.execute(); 128 nf.execute();
129 } 129 }
130 } 130 }
131 } 131 }
132 } else { 132 } else {
133 QString curFile = Remote_View->currentItem()->text(0); 133 QString curFile = Remote_View->currentItem()->text(0);
134 if(curFile != "../") { 134 if(curFile != "../") {
135 135
136 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 136 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
137 qDebug("Filesystemtype is "+fs); 137 qDebug("Filesystemtype is "+fs);
138 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 138 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
139 if( (fileInfo.permission( QFileInfo::ExeUser) 139 if( (fileInfo.permission( QFileInfo::ExeUser)
140 | fileInfo.permission( QFileInfo::ExeGroup) 140 | fileInfo.permission( QFileInfo::ExeGroup)
141 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 141 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
142 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 142 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
143 QCopEnvelope e("QPE/System", "execute(QString)" ); 143 QCopEnvelope e("QPE/System", "execute(QString)" );
144 e << curFile; 144 e << curFile;
145 } else { 145 } else {
146 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 146 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
147 DocLnk nf(curFile); 147 DocLnk nf(curFile);
148 QString execStr = nf.exec(); 148 QString execStr = nf.exec();
149 qDebug(execStr); 149 qDebug(execStr);
150 if( execStr.isEmpty() ) { 150 if( execStr.isEmpty() ) {
151 } else { 151 } else {
152 nf.execute(); 152 nf.execute();
153 } 153 }
154 } 154 }
155 } 155 }
156 } 156 }
157} 157}
158 158
159void AdvancedFm::runText() { 159void AdvancedFm::runText() {
160 if (TabWidget->getCurrentTab() == 0) { 160 if (TabWidget->getCurrentTab() == 0) {
161 QString curFile = Local_View->currentItem()->text(0); 161 QString curFile = Local_View->currentItem()->text(0);
162 if(curFile != "../") { 162 if(curFile != "../") {
163 curFile = currentDir.canonicalPath()+"/"+curFile; 163 curFile = currentDir.canonicalPath()+"/"+curFile;
164 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 164 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
165 e << curFile; 165 e << curFile;
166 } 166 }
167 } else { 167 } else {
168 QString curFile = Remote_View->currentItem()->text(0); 168 QString curFile = Remote_View->currentItem()->text(0);
169 if(curFile != "../") { 169 if(curFile != "../") {
170 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 170 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
171 DocLnk nf(curFile); 171 DocLnk nf(curFile);
172 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 172 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
173 e << curFile; 173 e << curFile;
174 } 174 }
175 } 175 }
176} 176}
177 177
178void AdvancedFm::localMakDir() { 178void AdvancedFm::localMakDir() {
179 InputDialog *fileDlg; 179 InputDialog *fileDlg;
180 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 180 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
181 fileDlg->exec(); 181 fileDlg->exec();
182 if( fileDlg->result() == 1 ) { 182 if( fileDlg->result() == 1 ) {
183 QString filename = fileDlg->LineEdit1->text(); 183 QString filename = fileDlg->LineEdit1->text();
184 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 184 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
185 } 185 }
186 populateLocalView(); 186 populateLocalView();
187} 187}
188 188
189void AdvancedFm::remoteMakDir() { 189void AdvancedFm::remoteMakDir() {
190 InputDialog *fileDlg; 190 InputDialog *fileDlg;
191 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 191 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
192 fileDlg->exec(); 192 fileDlg->exec();
193 if( fileDlg->result() == 1 ) { 193 if( fileDlg->result() == 1 ) {
194 QString filename = fileDlg->LineEdit1->text(); 194 QString filename = fileDlg->LineEdit1->text();
195 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 195 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
196 } 196 }
197 populateRemoteView(); 197 populateRemoteView();
198} 198}
199 199
200void AdvancedFm::localDelete() { 200void AdvancedFm::localDelete() {
201 QStringList curFileList = getPath(); 201 QStringList curFileList = getPath();
202 bool doMsg=true; 202 bool doMsg=true;
203 int count=curFileList.count(); 203 int count=curFileList.count();
204 if( count > 0) { 204 if( count > 0) {
205 if(count > 1 ){ 205 if(count > 1 ){
206 QString msg; 206 QString msg;
207 msg=tr("Really delete\n%1 files?").arg(count); 207 msg=tr("Really delete\n%1 files?").arg(count);
208 switch ( QMessageBox::warning(this,tr("Delete"),msg 208 switch ( QMessageBox::warning(this,tr("Delete"),msg
209 ,tr("Yes"),tr("No"),0,0,1) ) { 209 ,tr("Yes"),tr("No"),0,0,1) ) {
210 case 0: 210 case 0:
211 doMsg=false; 211 doMsg=false;
212 break; 212 break;
213 case 1: 213 case 1:
214 return; 214 return;
215 break; 215 break;
216 }; 216 };
217 } 217 }
218 218
219 QString myFile; 219 QString myFile;
220 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 220 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
221 myFile = (*it); 221 myFile = (*it);
222 if( myFile.find(" -> ",0,TRUE) != -1) 222 if( myFile.find(" -> ",0,TRUE) != -1)
223 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 223 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
224 224
225 QString f = currentDir.canonicalPath(); 225 QString f = currentDir.canonicalPath();
226 if(f.right(1).find("/",0,TRUE) == -1) 226 if(f.right(1).find("/",0,TRUE) == -1)
227 f+="/"; 227 f+="/";
228 f+=myFile; 228 f+=myFile;
229 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 229 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
230 switch ( QMessageBox::warning(this,tr("Delete Directory?"),tr("Really delete\n")+f+ 230 switch ( QMessageBox::warning(this,tr("Delete Directory?"),tr("Really delete\n")+f+
231 "\nand all it's contents ?" 231 "\nand all it's contents ?"
232 ,tr("Yes"),tr("No"),0,0,1) ) { 232 ,tr("Yes"),tr("No"),0,0,1) ) {
233 case 0: { 233 case 0: {
234 f=f.left(f.length()-1); 234 f=f.left(f.length()-1);
235 QString cmd="rm -rf "+f; 235 QString cmd="rm -rf "+f;
236 system( cmd.latin1()); 236 startProcess( (const QString)cmd.latin1() );
237 populateLocalView(); 237 populateLocalView();
238 } 238 }
239 break; 239 break;
240 case 1: 240 case 1:
241 // exit 241 // exit
242 break; 242 break;
243 }; 243 };
244 244
245 } else { 245 } else {
246 if(doMsg) { 246 if(doMsg) {
247 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f 247 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f
248 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 248 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
249 case 1: 249 case 1:
250 return; 250 return;
251 break; 251 break;
252 }; 252 };
253 } 253 }
254 QString cmd="rm "+f; 254 QString cmd="rm "+f;
255 QFile file(f); 255 QFile file(f);
256 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) 256 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1)
257 file.remove(); 257 file.remove();
258 // system( cmd.latin1());
259 } 258 }
260 } 259 }
261 } 260 }
262 populateLocalView(); 261 populateLocalView();
263} 262}
264 263
265void AdvancedFm::remoteDelete() { 264void AdvancedFm::remoteDelete() {
266 QStringList curFileList = getPath(); 265 QStringList curFileList = getPath();
267 bool doMsg=true; 266 bool doMsg=true;
268 int count=curFileList.count(); 267 int count=curFileList.count();
269 if( count > 0) { 268 if( count > 0) {
270 if(count > 1 ){ 269 if(count > 1 ){
271 QString msg; 270 QString msg;
272 msg=tr("Really delete\n%1 files?").arg(count); 271 msg=tr("Really delete\n%1 files?").arg(count);
273 switch ( QMessageBox::warning(this,tr("Delete"),msg 272 switch ( QMessageBox::warning(this,tr("Delete"),msg
274 ,tr("Yes"),tr("No"),0,0,1) ) { 273 ,tr("Yes"),tr("No"),0,0,1) ) {
275 case 0: 274 case 0:
276 doMsg=false; 275 doMsg=false;
277 break; 276 break;
278 case 1: 277 case 1:
279 return; 278 return;
280 break; 279 break;
281 }; 280 };
282 } 281 }
283 282
284 QString myFile; 283 QString myFile;
285 284
286 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 285 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
287 myFile = (*it); 286 myFile = (*it);
288 if(myFile.find(" -> ",0,TRUE) != -1) 287 if(myFile.find(" -> ",0,TRUE) != -1)
289 myFile = myFile.left(myFile.find(" -> ",0,TRUE)); 288 myFile = myFile.left(myFile.find(" -> ",0,TRUE));
290 QString f = currentRemoteDir.canonicalPath(); 289 QString f = currentRemoteDir.canonicalPath();
291 if(f.right(1).find("/",0,TRUE) == -1) 290 if(f.right(1).find("/",0,TRUE) == -1)
292 f+="/"; 291 f+="/";
293 f+=myFile; 292 f+=myFile;
294 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 293 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
295 switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+ 294 switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+
296 "\nand all it's contents ?", 295 "\nand all it's contents ?",
297 tr("Yes"),tr("No"),0,0,1) ) { 296 tr("Yes"),tr("No"),0,0,1) ) {
298 case 0: { 297 case 0: {
299 f=f.left(f.length()-1); 298 f=f.left(f.length()-1);
300 QString cmd="rm -rf "+f; 299 QString cmd="rm -rf "+f;
301 system( cmd.latin1()); 300 startProcess( (const QString)cmd );
302 populateRemoteView(); 301 populateRemoteView();
303 } 302 }
304 break; 303 break;
305 case 1: 304 case 1:
306 // exit 305 // exit
307 break; 306 break;
308 }; 307 };
309 308
310 } else { 309 } else {
311 if(doMsg) { 310 if(doMsg) {
312 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f 311 switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f
313 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 312 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
314 case 1: 313 case 1:
315 return; 314 return;
316 break; 315 break;
317 }; 316 };
318 } 317 }
319 QString cmd="rm "+f; 318 QString cmd="rm "+f;
320 QFile file(f); 319 QFile file(f);
321 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) 320 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1)
322 file.remove(); 321 file.remove();
323 // system( cmd.latin1());
324 } 322 }
325 } 323 }
326 } 324 }
327 populateRemoteView(); 325 populateRemoteView();
328} 326}
329 327
330void AdvancedFm::localRename() { 328void AdvancedFm::localRename() {
331 QString curFile = Local_View->currentItem()->text(0); 329 QString curFile = Local_View->currentItem()->text(0);
332 qDebug("currentItem "+curFile); 330 qDebug("currentItem "+curFile);
333 if( curFile !="../") { 331 if( curFile !="../") {
334 InputDialog *fileDlg; 332 InputDialog *fileDlg;
335 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 333 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
336 fileDlg->setInputText((const QString &)curFile); 334 fileDlg->setInputText((const QString &)curFile);
337 fileDlg->exec(); 335 fileDlg->exec();
338 if( fileDlg->result() == 1 ) { 336 if( fileDlg->result() == 1 ) {
339 QString oldname = currentDir.canonicalPath() + "/" + curFile; 337 QString oldname = currentDir.canonicalPath() + "/" + curFile;
340 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); 338 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();
341//+".playlist"; 339//+".playlist";
342 if( rename(oldname.latin1(), newName.latin1())== -1) 340 if( rename(oldname.latin1(), newName.latin1())== -1)
343 QMessageBox::message(tr("Note"),tr("Could not rename")); 341 QMessageBox::message(tr("Note"),tr("Could not rename"));
344 } 342 }
345 populateLocalView(); 343 populateLocalView();
346 } 344 }
347} 345}
348 346
349void AdvancedFm::remoteRename() 347void AdvancedFm::remoteRename()
350{ 348{
351 QString curFile = Remote_View->currentItem()->text(0); 349 QString curFile = Remote_View->currentItem()->text(0);
352 if( curFile !="../") { 350 if( curFile !="../") {
353 InputDialog *fileDlg; 351 InputDialog *fileDlg;
354 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 352 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
355 fileDlg->setInputText((const QString &)curFile); 353 fileDlg->setInputText((const QString &)curFile);
356 fileDlg->exec(); 354 fileDlg->exec();
357 if( fileDlg->result() == 1 ) { 355 if( fileDlg->result() == 1 ) {
358 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 356 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
359 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text(); 357 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();
360//+".playlist"; 358//+".playlist";
361 if( rename(oldname.latin1(), newName.latin1())== -1) 359 if( rename(oldname.latin1(), newName.latin1())== -1)
362 QMessageBox::message(tr("Note"),tr("Could not rename")); 360 QMessageBox::message(tr("Note"),tr("Could not rename"));
363 } 361 }
364 populateRemoteView(); 362 populateRemoteView();
365 } 363 }
366} 364}
367 365
368 366
369void AdvancedFm::filePerms() { 367void AdvancedFm::filePerms() {
370 368
371 QStringList curFileList = getPath(); 369 QStringList curFileList = getPath();
372 QString filePath; 370 QString filePath;
373 371
374 if (TabWidget->getCurrentTab() == 0) { 372 if (TabWidget->getCurrentTab() == 0) {
375 filePath = currentDir.canonicalPath()+"/"; 373 filePath = currentDir.canonicalPath()+"/";
376 } else { 374 } else {
377 filePath= currentRemoteDir.canonicalPath()+"/"; 375 filePath= currentRemoteDir.canonicalPath()+"/";
378 } 376 }
379 377
380 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 378 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
381 filePermissions *filePerm; 379 filePermissions *filePerm;
382 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 380 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
383 filePerm->showMaximized(); 381 filePerm->showMaximized();
384 filePerm->exec(); 382 filePerm->exec();
385 if( filePerm) 383 if( filePerm)
386 delete filePerm; 384 delete filePerm;
387 } 385 }
388 if (TabWidget->getCurrentTab() == 0) { 386 if (TabWidget->getCurrentTab() == 0) {
389 populateLocalView(); 387 populateLocalView();
390 } else { 388 } else {
391 populateRemoteView(); 389 populateRemoteView();
392 } 390 }
393} 391}
394 392
395void AdvancedFm::doProperties() { 393void AdvancedFm::doProperties() {
396#if defined(QT_QWS_OPIE) 394#if defined(QT_QWS_OPIE)
397 395
398 QStringList curFileList = getPath(); 396 QStringList curFileList = getPath();
399 397
400 QString filePath; 398 QString filePath;
401 if (TabWidget->getCurrentTab() == 0) { 399 if (TabWidget->getCurrentTab() == 0) {
402 filePath = currentDir.canonicalPath()+"/"; 400 filePath = currentDir.canonicalPath()+"/";
403 } else { 401 } else {
404 filePath= currentRemoteDir.canonicalPath()+"/"; 402 filePath= currentRemoteDir.canonicalPath()+"/";
405 } 403 }
406 qDebug("%d",curFileList.count()); 404 qDebug("%d",curFileList.count());
407 405
408 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 406 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
409 qDebug((filePath+*it)); 407 qDebug((filePath+*it));
410 DocLnk lnk( (filePath+*it)); 408 DocLnk lnk( (filePath+*it));
411 LnkProperties prop( &lnk ); 409 LnkProperties prop( &lnk );
412 prop.showMaximized(); 410 prop.showMaximized();
413 prop.exec(); 411 prop.exec();
414 } 412 }
415#endif 413#endif
416 414
417} 415}
418 416
419void AdvancedFm::upDir() { 417void AdvancedFm::upDir() {
420 if (TabWidget->getCurrentTab() == 0) { 418 if (TabWidget->getCurrentTab() == 0) {
421 QString current = currentDir.canonicalPath(); 419 QString current = currentDir.canonicalPath();
422 QDir dir(current); 420 QDir dir(current);
423 dir.cdUp(); 421 dir.cdUp();
424 current = dir.canonicalPath(); 422 current = dir.canonicalPath();
425 chdir( current.latin1() ); 423 chdir( current.latin1() );
426 currentDir.cd( current, TRUE); 424 currentDir.cd( current, TRUE);
427 populateLocalView(); 425 populateLocalView();
428 update(); 426 update();
429 } else { 427 } else {
430 QString current = currentRemoteDir.canonicalPath(); 428 QString current = currentRemoteDir.canonicalPath();
431 QDir dir(current); 429 QDir dir(current);
432 dir.cdUp(); 430 dir.cdUp();
433 current = dir.canonicalPath(); 431 current = dir.canonicalPath();
434 chdir( current.latin1() ); 432 chdir( current.latin1() );
435 currentRemoteDir.cd( current, TRUE); 433 currentRemoteDir.cd( current, TRUE);
436 populateRemoteView(); 434 populateRemoteView();
437 update(); 435 update();
438 } 436 }
439} 437}
440 438
441void AdvancedFm::copy() { 439void AdvancedFm::copy() {
442 qApp->processEvents(); 440 qApp->processEvents();
443 QStringList curFileList = getPath(); 441 QStringList curFileList = getPath();
444 bool doMsg=true; 442 bool doMsg=true;
445 int count=curFileList.count(); 443 int count=curFileList.count();
446 if( count > 0) { 444 if( count > 0) {
447 if(count > 1 ){ 445 if(count > 1 ){
448 QString msg; 446 QString msg;
449 msg=tr("Really copy\n%1 files?").arg(count); 447 msg=tr("Really copy\n%1 files?").arg(count);
450 switch ( QMessageBox::warning(this,tr("Delete"),msg 448 switch ( QMessageBox::warning(this,tr("Delete"),msg
451 ,tr("Yes"),tr("No"),0,0,1) ) { 449 ,tr("Yes"),tr("No"),0,0,1) ) {
452 case 0: 450 case 0:
453 doMsg=false; 451 doMsg=false;
454 break; 452 break;
455 case 1: 453 case 1:
456 return; 454 return;
457 break; 455 break;
458 }; 456 };
459 } 457 }
460 458
461 QString curFile, item, destFile; 459 QString curFile, item, destFile;
462 if (TabWidget->getCurrentTab() == 0) { 460 if (TabWidget->getCurrentTab() == 0) {
463 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 461 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
464 item=(*it); 462 item=(*it);
465 if(item.find("->",0,TRUE)) //symlink 463 if(item.find("->",0,TRUE)) //symlink
466 item = item.left(item.find("->",0,TRUE)); 464 item = item.left(item.find("->",0,TRUE));
467 465
468 destFile = currentRemoteDir.canonicalPath()+"/"+ item; 466 destFile = currentRemoteDir.canonicalPath()+"/"+ item;
469 qDebug("Destination file is "+destFile); 467 qDebug("Destination file is "+destFile);
470 468
471 curFile = currentDir.canonicalPath()+"/"+ item; 469 curFile = currentDir.canonicalPath()+"/"+ item;
472 qDebug("CurrentFile file is " + curFile); 470 qDebug("CurrentFile file is " + curFile);
473 471
474 QFile f(destFile); 472 QFile f(destFile);
475 if( f.exists()) { 473 if( f.exists()) {
476 if(doMsg) { 474 if(doMsg) {
477 switch ( QMessageBox::warning(this,tr("File Exists!"), 475 switch ( QMessageBox::warning(this,tr("File Exists!"),
478 item+tr("\nexists. Ok to overwrite?"), 476 item+tr("\nexists. Ok to overwrite?"),
479 tr("Yes"),tr("No"),0,0,1) ) { 477 tr("Yes"),tr("No"),0,0,1) ) {
480 case 1: 478 case 1:
481 return; 479 return;
482 break; 480 break;
483 }; 481 };
484 } 482 }
485 f.remove(); 483 f.remove();
486 } 484 }
487 if(!copyFile(destFile, curFile) ) { 485 if(!copyFile(destFile, curFile) ) {
488 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 486 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
489 return; 487 return;
490 } 488 }
491 } 489 }
492 populateRemoteView(); 490 populateRemoteView();
493 TabWidget->setCurrentTab(1); 491 TabWidget->setCurrentTab(1);
494 492
495 } else { 493 } else {
496 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 494 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
497 item= (*it); 495 item= (*it);
498 if(item.find("->",0,TRUE)) //symlink 496 if(item.find("->",0,TRUE)) //symlink
499 item = item.left(item.find("->",0,TRUE)); 497 item = item.left(item.find("->",0,TRUE));
500 498
501 destFile = currentDir.canonicalPath()+"/"+ item; 499 destFile = currentDir.canonicalPath()+"/"+ item;
502 qDebug("Destination file is "+destFile); 500 qDebug("Destination file is "+destFile);
503 501
504 curFile = currentRemoteDir.canonicalPath()+"/"+ item;; 502 curFile = currentRemoteDir.canonicalPath()+"/"+ item;;
505 qDebug("CurrentFile file is " + curFile); 503 qDebug("CurrentFile file is " + curFile);
506 504
507 QFile f(destFile); 505 QFile f(destFile);
508 if( f.exists()) { 506 if( f.exists()) {
509 switch ( QMessageBox::warning(this,tr("File Exists!"), 507 switch ( QMessageBox::warning(this,tr("File Exists!"),
510 item+tr("\nexists. Ok to overwrite?"), 508 item+tr("\nexists. Ok to overwrite?"),
511 tr("Yes"),tr("No"),0,0,1) ) { 509 tr("Yes"),tr("No"),0,0,1) ) {
512 case 1: 510 case 1:
513 return; 511 return;
514 break; 512 break;
515 }; 513 };
516 f.remove(); 514 f.remove();
517 } 515 }
518 if(!copyFile(destFile, curFile) ) { 516 if(!copyFile(destFile, curFile) ) {
519 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 517 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
520 +curFile +tr("to\n")+destFile); 518 +curFile +tr("to\n")+destFile);
521 return; 519 return;
522 520
523 } 521 }
524 } 522 }
525 populateLocalView(); 523 populateLocalView();
526 TabWidget->setCurrentTab(0); 524 TabWidget->setCurrentTab(0);
527 } 525 }
528 526
529 } 527 }
530} 528}
531 529
532void AdvancedFm::copyAs() { 530void AdvancedFm::copyAs() {
533 qApp->processEvents(); 531 qApp->processEvents();
534 532
535 QStringList curFileList = getPath(); 533 QStringList curFileList = getPath();
536 QString curFile, item; 534 QString curFile, item;
537 InputDialog *fileDlg; 535 InputDialog *fileDlg;
538 if (TabWidget->getCurrentTab() == 0) { 536 if (TabWidget->getCurrentTab() == 0) {
539 qDebug("tab 1"); 537 qDebug("tab 1");
540 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 538 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
541 QString destFile; 539 QString destFile;
542 item=(*it); 540 item=(*it);
543 curFile = currentDir.canonicalPath()+"/"+(*it); 541 curFile = currentDir.canonicalPath()+"/"+(*it);
544 fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); 542 fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0);
545 543
546 fileDlg->setInputText((const QString &) destFile ); 544 fileDlg->setInputText((const QString &) destFile );
547 fileDlg->exec(); 545 fileDlg->exec();
548 546
549 if( fileDlg->result() == 1 ) { 547 if( fileDlg->result() == 1 ) {
550 QString filename = fileDlg->LineEdit1->text(); 548 QString filename = fileDlg->LineEdit1->text();
551 destFile = currentRemoteDir.canonicalPath()+"/"+filename; 549 destFile = currentRemoteDir.canonicalPath()+"/"+filename;
552 550
553 QFile f(destFile); 551 QFile f(destFile);
554 if( f.exists()) { 552 if( f.exists()) {
555 switch (QMessageBox::warning(this,tr("File Exists!"), 553 switch (QMessageBox::warning(this,tr("File Exists!"),
556 item+tr("\nexists. Ok to overwrite?"), 554 item+tr("\nexists. Ok to overwrite?"),
557 tr("Yes"),tr("No"),0,0,1) ) { 555 tr("Yes"),tr("No"),0,0,1) ) {
558 case 0: 556 case 0:
559 f.remove(); 557 f.remove();
560 break; 558 break;
561 case 1: 559 case 1:
562 return; 560 return;
563 break; 561 break;
564 }; 562 };
565 } 563 }
566 if(!copyFile(destFile, curFile) ) { 564 if(!copyFile(destFile, curFile) ) {
567 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 565 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
568 +curFile +tr("to\n")+destFile); 566 +curFile +tr("to\n")+destFile);
569 return; 567 return;
570 } 568 }
571 } 569 }
572 delete fileDlg; 570 delete fileDlg;
573 571
574 } 572 }
575 populateRemoteView(); 573 populateRemoteView();
576 TabWidget->setCurrentTab(1); 574 TabWidget->setCurrentTab(1);
577 575
578 } else { 576 } else {
579 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 577 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
580 578
581 item=(*it); 579 item=(*it);
582 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 580 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
583 fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); 581 fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0);
584 582
585 QString destFile; 583 QString destFile;
586 fileDlg->setInputText((const QString &) destFile); 584 fileDlg->setInputText((const QString &) destFile);
587 fileDlg->exec(); 585 fileDlg->exec();
588 586
589 if( fileDlg->result() == 1 ) { 587 if( fileDlg->result() == 1 ) {
590 QString filename = fileDlg->LineEdit1->text(); 588 QString filename = fileDlg->LineEdit1->text();
591 destFile = currentDir.canonicalPath()+"/"+filename; 589 destFile = currentDir.canonicalPath()+"/"+filename;
592 590
593 QFile f( destFile); 591 QFile f( destFile);
594 if( f.exists()) { 592 if( f.exists()) {
595 switch ( QMessageBox::warning(this,tr("File Exists!"), 593 switch ( QMessageBox::warning(this,tr("File Exists!"),
596 item+tr("\nexists. Ok to overwrite?"), 594 item+tr("\nexists. Ok to overwrite?"),
597 tr("Yes"),tr("No"),0,0,1) ) { 595 tr("Yes"),tr("No"),0,0,1) ) {
598 case 0: 596 case 0:
599 f.remove(); 597 f.remove();
600 break; 598 break;
601 case 1: 599 case 1:
602 return; 600 return;
603 break; 601 break;
604 }; 602 };
605 } 603 }
606 if(!copyFile(destFile, curFile) ) { 604 if(!copyFile(destFile, curFile) ) {
607 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 605 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
608 +curFile +tr("to\n")+destFile); 606 +curFile +tr("to\n")+destFile);
609 return; 607 return;
610 } 608 }
611 609
612 } 610 }
613 delete fileDlg; 611 delete fileDlg;
614 612
615 } 613 }
616 populateLocalView(); 614 populateLocalView();
617 TabWidget->setCurrentTab(0); 615 TabWidget->setCurrentTab(0);
618 } 616 }
619} 617}
620 618
621void AdvancedFm::copySameDir() { 619void AdvancedFm::copySameDir() {
622 qApp->processEvents(); 620 qApp->processEvents();
623 QStringList curFileList = getPath(); 621 QStringList curFileList = getPath();
624 QString curFile, item, destFile; 622 QString curFile, item, destFile;
625 InputDialog *fileDlg; 623 InputDialog *fileDlg;
626 624
627 if (TabWidget->getCurrentTab() == 0) { 625 if (TabWidget->getCurrentTab() == 0) {
628 626
629 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 627 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
630 item=(*it); 628 item=(*it);
631 curFile = currentDir.canonicalPath()+"/"+ item; 629 curFile = currentDir.canonicalPath()+"/"+ item;
632 630
633 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 631 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
634 fileDlg->setInputText((const QString &) destFile ); 632 fileDlg->setInputText((const QString &) destFile );
635 fileDlg->exec(); 633 fileDlg->exec();
636 634
637 if( fileDlg->result() == 1 ) { 635 if( fileDlg->result() == 1 ) {
638 636
639 QString filename = fileDlg->LineEdit1->text(); 637 QString filename = fileDlg->LineEdit1->text();
640 destFile = currentDir.canonicalPath()+"/"+filename; 638 destFile = currentDir.canonicalPath()+"/"+filename;
641 639
642 QFile f(destFile); 640 QFile f(destFile);
643 if( f.exists()) { 641 if( f.exists()) {
644 switch (QMessageBox::warning(this,tr("Delete"), 642 switch (QMessageBox::warning(this,tr("Delete"),
645 destFile+tr(" already exists\nDo you really want to delete it?"), 643 destFile+tr(" already exists\nDo you really want to delete it?"),
646 tr("Yes"),tr("No"),0,0,1) ) { 644 tr("Yes"),tr("No"),0,0,1) ) {
647 case 0: 645 case 0:
648 646
649 f.remove(); 647 f.remove();
650 break; 648 break;
651 case 1: 649 case 1:
652 return; 650 return;
653 break; 651 break;
654 }; 652 };
655 } 653 }
656 if(!copyFile(destFile, curFile) ) { 654 if(!copyFile(destFile, curFile) ) {
657 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 655 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
658 +curFile +tr("to\n")+destFile); 656 +curFile +tr("to\n")+destFile);
659 return; 657 return;
660 } 658 }
661 659
662 qDebug("copy "+curFile+" as "+destFile); 660 qDebug("copy "+curFile+" as "+destFile);
663 } 661 }
664 delete fileDlg; 662 delete fileDlg;
665 } 663 }
666 populateLocalView(); 664 populateLocalView();
667 665
668 } else { 666 } else {
669 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 667 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
670 item=(*it); 668 item=(*it);
671 curFile = currentRemoteDir.canonicalPath()+"/"+ item; 669 curFile = currentRemoteDir.canonicalPath()+"/"+ item;
672 670
673 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 671 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
674 fileDlg->setInputText((const QString &) destFile); 672 fileDlg->setInputText((const QString &) destFile);
675 fileDlg->exec(); 673 fileDlg->exec();
676 if( fileDlg->result() == 1 ) { 674 if( fileDlg->result() == 1 ) {
677 QString filename = fileDlg->LineEdit1->text(); 675 QString filename = fileDlg->LineEdit1->text();
678 676
679 destFile = currentRemoteDir.canonicalPath()+"/"+filename; 677 destFile = currentRemoteDir.canonicalPath()+"/"+filename;
680 678
681 QFile f(destFile); 679 QFile f(destFile);
682 if( f.exists()) { 680 if( f.exists()) {
683 switch ( QMessageBox::warning(this,tr("Delete"), 681 switch ( QMessageBox::warning(this,tr("Delete"),
684 destFile+tr(" already exists\nDo you really want to delete it?"), 682 destFile+tr(" already exists\nDo you really want to delete it?"),
685 tr("Yes"),tr("No"),0,0,1) ) { 683 tr("Yes"),tr("No"),0,0,1) ) {
686 case 0: 684 case 0:
687 f.remove(); 685 f.remove();
688 break; 686 break;
689 case 1: 687 case 1:
690 return; 688 return;
691 break; 689 break;
692 }; 690 };
693 } 691 }
694 if(!copyFile(destFile, curFile) ) { 692 if(!copyFile(destFile, curFile) ) {
695 QMessageBox::message("AdvancedFm",tr("Could not copy\n") 693 QMessageBox::message("AdvancedFm",tr("Could not copy\n")
696 +curFile +tr("to\n")+destFile); 694 +curFile +tr("to\n")+destFile);
697 return; 695 return;
698 } 696 }
699 qDebug("copy "+curFile+" as "+destFile); 697 qDebug("copy "+curFile+" as "+destFile);
700 } 698 }
701 delete fileDlg; 699 delete fileDlg;
702 } 700 }
703 populateRemoteView(); 701 populateRemoteView();
704 } 702 }
705} 703}
706 704
707void AdvancedFm::move() { 705void AdvancedFm::move() {
708 qApp->processEvents(); 706 qApp->processEvents();
709 707
710 QStringList curFileList = getPath(); 708 QStringList curFileList = getPath();
711 if( curFileList.count() > 0) { 709 if( curFileList.count() > 0) {
712 QString curFile, destFile, item; 710 QString curFile, destFile, item;
713 711
714 if (TabWidget->getCurrentTab() == 0) { 712 if (TabWidget->getCurrentTab() == 0) {
715 713
716 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 714 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
717 item=(*it); 715 item=(*it);
718 QString destFile = currentRemoteDir.canonicalPath(); 716 QString destFile = currentRemoteDir.canonicalPath();
719 717
720 if(destFile.right(1).find("/",0,TRUE) == -1) 718 if(destFile.right(1).find("/",0,TRUE) == -1)
721 destFile+="/"; 719 destFile+="/";
722 destFile += item; 720 destFile += item;
723 curFile = currentDir.canonicalPath(); 721 curFile = currentDir.canonicalPath();
724 722
725 qDebug("Destination file is "+destFile); 723 qDebug("Destination file is "+destFile);
726 724
727 if(curFile.right(1).find("/",0,TRUE) == -1) 725 if(curFile.right(1).find("/",0,TRUE) == -1)
728 curFile +="/"; 726 curFile +="/";
729 727
730 curFile+= item; 728 curFile+= item;
731 qDebug("CurrentFile file is " + curFile); 729 qDebug("CurrentFile file is " + curFile);
732 730
733 QFile f( curFile); 731 QFile f( curFile);
734 if( f.exists()) { 732 if( f.exists()) {
735 if(!copyFile( destFile, curFile) ) { 733 if(!copyFile( destFile, curFile) ) {
736 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 734 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
737 return; 735 return;
738 } else 736 } else
739 QFile::remove(curFile); 737 QFile::remove(curFile);
740 } 738 }
741 } 739 }
742 740
743 TabWidget->setCurrentTab(1); 741 TabWidget->setCurrentTab(1);
744 742
745 } else { //view 2 743 } else { //view 2
746 744
747 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 745 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
748 item = (*it); 746 item = (*it);
749 QString destFile = currentDir.canonicalPath(); 747 QString destFile = currentDir.canonicalPath();
750 748
751 if(destFile.right(1).find("/",0,TRUE) == -1) 749 if(destFile.right(1).find("/",0,TRUE) == -1)
752 destFile+="/"; 750 destFile+="/";
753 751
754 destFile += item; 752 destFile += item;
755 753
756 qDebug("Destination file is "+destFile); 754 qDebug("Destination file is "+destFile);
757 755
758 curFile = currentRemoteDir.canonicalPath(); 756 curFile = currentRemoteDir.canonicalPath();
759 757
760 if(curFile.right(1).find("/",0,TRUE) == -1) 758 if(curFile.right(1).find("/",0,TRUE) == -1)
761 curFile +="/"; 759 curFile +="/";
762 curFile+= item; 760 curFile+= item;
763 qDebug("CurrentFile file is " + curFile); 761 qDebug("CurrentFile file is " + curFile);
764 762
765 QFile f( curFile); 763 QFile f( curFile);
766 if( f.exists()) { 764 if( f.exists()) {
767 if(!copyFile( destFile, curFile) ) { 765 if(!copyFile( destFile, curFile) ) {
768 QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); 766 QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile);
769 return; 767 return;
770 } else 768 } else
771 QFile::remove( curFile); 769 QFile::remove( curFile);
772 } 770 }
773 TabWidget->setCurrentTab(0); 771 TabWidget->setCurrentTab(0);
774 } 772 }
775 } 773 }
776 populateRemoteView(); 774 populateRemoteView();
777 populateLocalView(); 775 populateLocalView();
778 } 776 }
779} 777}
780 778
781bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { 779bool AdvancedFm::copyFile( const QString & dest, const QString & src ) {
782 char bf[ 50000 ]; 780 char bf[ 50000 ];
783 int bytesRead; 781 int bytesRead;
784 bool success = TRUE; 782 bool success = TRUE;
785 struct stat status; 783 struct stat status;
786 784
787 QFile s( src ); 785 QFile s( src );
788 QFile d( dest ); 786 QFile d( dest );
789 787
790 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { 788 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) {
791 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { 789 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) {
792 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 790 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
793 success = FALSE; 791 success = FALSE;
794 break; 792 break;
795 } 793 }
796 } 794 }
797 if( success && (bytesRead > 0) ){ 795 if( success && (bytesRead > 0) ){
798 d.writeBlock( bf, bytesRead ); 796 d.writeBlock( bf, bytesRead );
799 } 797 }
800 } else { 798 } else {
801 success = FALSE; 799 success = FALSE;
802 } 800 }
803 801
804 // Set file permissions 802 // Set file permissions
805 if( stat( (const char *) src, &status ) == 0 ){ 803 if( stat( (const char *) src, &status ) == 0 ){
806 chmod( (const char *) dest, status.st_mode ); 804 chmod( (const char *) dest, status.st_mode );
807 } 805 }
808 806
809 return success; 807 return success;
810} 808}
811 809
812void AdvancedFm::runCommand() { 810void AdvancedFm::runCommand() {
813 QString curFile; 811 QString curFile;
814 if (TabWidget->getCurrentTab() == 0) { 812 if (TabWidget->getCurrentTab() == 0) {
815 if( Local_View->currentItem()) 813 if( Local_View->currentItem())
816 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 814 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
817 } else {
818 if(Remote_View->currentItem())
819 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
820 }
821
822 InputDialog *fileDlg;
823 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
824 fileDlg->setInputText(curFile);
825 fileDlg->exec();
826 QString command;
827 if( fileDlg->result() == 1 ) {
828 command = fileDlg->LineEdit1->text();
829
830 Output *outDlg;
831 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
832 outDlg->showMaximized();
833 outDlg->show();
834 qApp->processEvents();
835 FILE *fp;
836 char line[130];
837 sleep(1);
838 command +=" 2>&1";
839 fp = popen( (const char *) command, "r");
840 if ( !fp ) {
841 qDebug("Could not execute '" + command + "'! err=%d", fp);
842 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") );
843 pclose(fp);
844 return;
845 } else { 815 } else {
846 while ( fgets( line, sizeof line, fp)) { 816 if(Remote_View->currentItem())
847 QString lineStr = line; 817 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
848 lineStr=lineStr.left(lineStr.length()-1);
849 outDlg->OutputEdit->append(lineStr);
850 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
851 }
852 } 818 }
853 pclose(fp);
854 819
855 } 820 InputDialog *fileDlg;
821 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
822 fileDlg->setInputText(curFile);
823 fileDlg->exec();
824 //QString command;
825
826 if( fileDlg->result() == 1 ) {
827 qDebug(fileDlg->LineEdit1->text());
828 QStringList command;
829
830 command << "/bin/sh";
831 command << "-c";
832 command << fileDlg->LineEdit1->text();
833 Output *outDlg;
834 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
835 outDlg->showMaximized();
836 outDlg->exec();
837 qApp->processEvents();
838
839 }
856} 840}
857 841
858void AdvancedFm::runCommandStd() { 842void AdvancedFm::runCommandStd() {
859 QString curFile; 843 QString curFile;
860 if (TabWidget->getCurrentTab() == 0) { 844 if (TabWidget->getCurrentTab() == 0) {
861 if( Local_View->currentItem()) 845 if( Local_View->currentItem())
862 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 846 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
863 } else { 847 } else {
864 if(Remote_View->currentItem()) 848 if(Remote_View->currentItem())
865 curFile = currentRemoteDir.canonicalPath() +"/" 849 curFile = currentRemoteDir.canonicalPath() +"/"
866 + Remote_View->currentItem()->text(0); 850 + Remote_View->currentItem()->text(0);
867 } 851 }
868 852
869 InputDialog *fileDlg; 853 InputDialog *fileDlg;
870 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 854 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
871 fileDlg->setInputText(curFile); 855 fileDlg->setInputText(curFile);
872 fileDlg->exec(); 856 fileDlg->exec();
873 QString command; 857
874 if( fileDlg->result() == 1 ) { 858 if( fileDlg->result() == 1 ) {
875 qApp->processEvents(); 859 qApp->processEvents();
876 command = fileDlg->LineEdit1->text() + " &"; 860 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
877 system(command.latin1());
878 } 861 }
879} 862}
880 863
881void AdvancedFm::fileStatus() { 864void AdvancedFm::fileStatus() {
882 QString curFile; 865 QString curFile;
883 if (TabWidget->getCurrentTab() == 0) { 866 if (TabWidget->getCurrentTab() == 0) {
884 curFile = Local_View->currentItem()->text(0); 867 curFile = Local_View->currentItem()->text(0);
885 } else { 868 } else {
886 curFile = Remote_View->currentItem()->text(0); 869 curFile = Remote_View->currentItem()->text(0);
887 } 870 }
888 QString command = " stat -l "+ curFile +" 2>&1";
889 Output *outDlg;
890 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
891 outDlg->showMaximized();
892 outDlg->show();
893 qApp->processEvents();
894 FILE *fp;
895 char line[130];
896 sleep(1);
897 fp = popen( (const char *) command, "r");
898 if ( !fp ) {
899 qDebug("Could not execute '" + command + "'! err=%d", fp);
900 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") );
901 pclose(fp);
902 return;
903 } else {
904 while ( fgets( line, sizeof line, fp)) {
905 outDlg->OutputEdit->append(line);
906 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
907 871
908 } 872 QStringList command;
873 command << "/bin/sh";
874 command << "-c";
875 command << "stat -l "+ curFile;
909 876
910 } 877 Output *outDlg;
911 pclose(fp); 878 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
879 outDlg->showMaximized();
880 outDlg->exec();
881 qApp->processEvents();
882
883
884// Output *outDlg;
885// outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
886// outDlg->showMaximized();
887// outDlg->show();
888// qApp->processEvents();
889
890// FILE *fp;
891// char line[130];
892// sleep(1);
893// fp = popen( (const char *) command, "r");
894// if ( !fp ) {
895// qDebug("Could not execute '" + command + "'! err=%d", fp);
896// QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") );
897// pclose(fp);
898// return;
899// } else {
900// while ( fgets( line, sizeof line, fp)) {
901// outDlg->OutputEdit->append(line);
902// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
903
904// }
905
906// }
907// pclose(fp);
912} 908}
913 909
910
914void AdvancedFm::mkDir() { 911void AdvancedFm::mkDir() {
915 if (TabWidget->getCurrentTab() == 0) 912 if (TabWidget->getCurrentTab() == 0)
916 localMakDir(); 913 localMakDir();
917 else 914 else
918 remoteMakDir(); 915 remoteMakDir();
919 916
920} 917}
921 918
922void AdvancedFm::rn() { 919void AdvancedFm::rn() {
923 if (TabWidget->getCurrentTab() == 0) 920 if (TabWidget->getCurrentTab() == 0)
924 localRename(); 921 localRename();
925 else 922 else
926 remoteRename(); 923 remoteRename();
927 924
928} 925}
929 926
930void AdvancedFm::del() { 927void AdvancedFm::del() {
931 if (TabWidget->getCurrentTab() == 0) 928 if (TabWidget->getCurrentTab() == 0)
932 localDelete(); 929 localDelete();
933 else 930 else
934 remoteDelete(); 931 remoteDelete();
935} 932}
936 933
937void AdvancedFm::mkSym() { 934void AdvancedFm::mkSym() {
938 QString cmd; 935 QString cmd;
939 QStringList curFileList = getPath(); 936 QStringList curFileList = getPath();
940 if( curFileList.count() > 0) { 937 if( curFileList.count() > 0) {
941 938
942 if (TabWidget->getCurrentTab() == 0) { 939 if (TabWidget->getCurrentTab() == 0) {
943 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 940 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
944 941
945 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 942 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
946 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 943 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
947 QString curFile = currentDir.canonicalPath()+"/"+(*it); 944 QString curFile = currentDir.canonicalPath()+"/"+(*it);
948 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 945 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
949 cmd = "ln -s "+curFile+" "+destName; 946 cmd = "ln -s "+curFile+" "+destName;
950 qDebug(cmd); 947 qDebug(cmd);
951 system(cmd.latin1() ); 948 startProcess( (const QString)cmd );
952 } 949 }
953 populateRemoteView(); 950 populateRemoteView();
954 TabWidget->setCurrentTab(1); 951 TabWidget->setCurrentTab(1);
955 } else { 952 } else {
956 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 953 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
957 954
958 QString destName = currentDir.canonicalPath()+"/"+(*it); 955 QString destName = currentDir.canonicalPath()+"/"+(*it);
959 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 956 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
960 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 957 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
961 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 958 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
962 959
963 cmd = "ln -s "+curFile+" "+destName; 960 cmd = "ln -s "+curFile+" "+destName;
964 qDebug(cmd); 961 qDebug(cmd);
965 system(cmd.latin1() ); 962 startProcess( (const QString)cmd );
966 } 963 }
967 populateLocalView(); 964 populateLocalView();
968 TabWidget->setCurrentTab(0); 965 TabWidget->setCurrentTab(0);
966 }
969 } 967 }
970 }
971} 968}
972 969
973void AdvancedFm::doBeam() { 970void AdvancedFm::doBeam() {
974 Ir ir; 971 Ir ir;
975 if(!ir.supported()){ 972 if(!ir.supported()){
976 } else { 973 } else {
977 974
978 QStringList curFileList = getPath(); 975 QStringList curFileList = getPath();
979 if( curFileList.count() > 0) { 976 if( curFileList.count() > 0) {
980 977
981 if (TabWidget->getCurrentTab() == 0) { 978 if (TabWidget->getCurrentTab() == 0) {
982 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 979 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
983 980
984 QString curFile = currentDir.canonicalPath()+"/"+(*it); 981 QString curFile = currentDir.canonicalPath()+"/"+(*it);
985 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 982 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
986 Ir *file = new Ir(this, "IR"); 983 Ir *file = new Ir(this, "IR");
987 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 984 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
988 file->send( curFile, curFile ); 985 file->send( curFile, curFile );
989 } 986 }
990 987
991 } else { 988 } else {
992 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 989 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
993 990
994 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 991 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
995 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 992 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
996 Ir *file = new Ir(this, "IR"); 993 Ir *file = new Ir(this, "IR");
997 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 994 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
998 file->send( curFile, curFile ); 995 file->send( curFile, curFile );
999 996
1000 } 997 }
1001 } 998 }
1002 } 999 }
1003 } 1000 }
1004 1001
1005} 1002}
1006 1003
1007void AdvancedFm::fileBeamFinished( Ir *) { 1004void AdvancedFm::fileBeamFinished( Ir *) {
1008 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 1005 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
1009 1006
1010} 1007}
1011 1008
1012void AdvancedFm::selectAll() { 1009void AdvancedFm::selectAll() {
1013 if (TabWidget->getCurrentTab() == 0) { 1010 if (TabWidget->getCurrentTab() == 0) {
1014 Local_View->selectAll(true); 1011 Local_View->selectAll(true);
1015 Local_View->setSelected( Local_View->firstChild(),false); 1012 Local_View->setSelected( Local_View->firstChild(),false);
1016 } else { 1013 } else {
1017 Remote_View->selectAll(true); 1014 Remote_View->selectAll(true);
1018 Remote_View->setSelected( Remote_View->firstChild(),false); 1015 Remote_View->setSelected( Remote_View->firstChild(),false);
1019 } 1016 }
1020} 1017}
1018
1019void AdvancedFm::startProcess(const QString & cmd) {
1020 QStringList command;
1021 OProcess *process;
1022 process = new OProcess();
1023 connect(process, SIGNAL(processExited(OProcess *)),
1024 this, SLOT( processEnded()));
1025
1026 command << "/bin/sh";
1027 command << "-c";
1028 command << cmd.latin1();
1029 *process << command;
1030 if(!process->start(OProcess::NotifyOnExit) )
1031 qDebug("could not start process");
1032}
1033
1034void AdvancedFm::processEnded() {
1035 populateLocalView();
1036 populateRemoteView();
1037}
diff --git a/noncore/apps/advancedfm/inputDialog.cpp b/noncore/apps/advancedfm/inputDialog.cpp
deleted file mode 100644
index 5af0f72..0000000
--- a/noncore/apps/advancedfm/inputDialog.cpp
+++ b/dev/null
@@ -1,44 +0,0 @@
1/****************************************************************************
2 inputDialog.cpp
3 -------------------
4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com
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 *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 ***************************************************************************/
12
13#include "inputDialog.h"
14
15#include <qlineedit.h>
16#include <qlayout.h>
17#include <qvariant.h>
18#include <qtooltip.h>
19#include <qwhatsthis.h>
20
21
22InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
23 : QDialog( parent, name, modal, fl )
24{
25 if ( !name )
26 setName( "InputDialog" );
27 resize( 234, 50 );
28 setMaximumSize( QSize( 240, 50 ) );
29 setCaption( tr(name ) );
30
31 LineEdit1 = new QLineEdit( this, "LineEdit1" );
32 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
33}
34
35InputDialog::~InputDialog()
36{
37 inputText = LineEdit1->text();
38
39}
40
41void InputDialog::setInputText(const QString &string)
42{
43LineEdit1->setText( string);
44}
diff --git a/noncore/apps/advancedfm/inputDialog.h b/noncore/apps/advancedfm/inputDialog.h
deleted file mode 100644
index 114a3a8..0000000
--- a/noncore/apps/advancedfm/inputDialog.h
+++ b/dev/null
@@ -1,35 +0,0 @@
1/***************************************************************************
2 inputDialog.h
3 -------------------
4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com
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 *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 ***************************************************************************/
12#ifndef INPUTDIALOG_H
13#define INPUTDIALOG_H
14
15#include <qvariant.h>
16#include <qdialog.h>
17class QVBoxLayout;
18class QHBoxLayout;
19class QGridLayout;
20class QLineEdit;
21
22class InputDialog : public QDialog
23{
24 Q_OBJECT
25
26public:
27 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
28 ~InputDialog();
29 QString inputText;
30 QLineEdit* LineEdit1;
31 void setInputText(const QString &);
32
33};
34
35#endif // INPUTDIALOG_H
diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp
index 82e78a7..946d038 100644
--- a/noncore/apps/advancedfm/output.cpp
+++ b/noncore/apps/advancedfm/output.cpp
@@ -1,180 +1,282 @@
1/**************************************************************************** 1/****************************************************************************
2** outputEdit.cpp 2** outputEdit.cpp
3** 3**
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#include "inputDialog.h" 7
8#include <opie/oprocess.h>
8 9
9#include <qpe/filemanager.h> 10#include <qpe/filemanager.h>
10#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
11#include <qpe/applnk.h> 12#include <qpe/applnk.h>
12 13
14#include <qmessagebox.h>
15#include <qstringlist.h>
13#include <qfile.h> 16#include <qfile.h>
14 17#include <qcstring.h>
15#include <qlineedit.h> 18#include <qlineedit.h>
16#include <qmultilineedit.h> 19#include <qmultilineedit.h>
17#include <qpushbutton.h> 20#include <qpushbutton.h>
18#include <qlayout.h> 21#include <qlayout.h>
19#include <qvariant.h> 22#include <qvariant.h>
20 23
24#include <errno.h>
25
21/* XPM */ 26/* XPM */
22static char * filesave_xpm[] = { 27static char * filesave_xpm[] = {
23"16 16 78 1", 28"16 16 78 1",
24" c None", 29" c None",
25". c #343434", 30". c #343434",
26"+ c #A0A0A0", 31"+ c #A0A0A0",
27"@ c #565656", 32"@ c #565656",
28"# c #9E9E9E", 33"# c #9E9E9E",
29"$ c #525252", 34"$ c #525252",
30"% c #929292", 35"% c #929292",
31"& c #676767", 36"& c #676767",
32"* c #848484", 37"* c #848484",
33"= c #666666", 38"= c #666666",
34"- c #D8D8D8", 39"- c #D8D8D8",
35"; c #FFFFFF", 40"; c #FFFFFF",
36"> c #DBDBDB", 41"> c #DBDBDB",
37", c #636363", 42", c #636363",
38"' c #989898", 43"' c #989898",
39") c #2D2D2D", 44") c #2D2D2D",
40"! c #909090", 45"! c #909090",
41"~ c #AEAEAE", 46"~ c #AEAEAE",
42"{ c #EAEAEA", 47"{ c #EAEAEA",
43"] c #575757", 48"] c #575757",
44"^ c #585858", 49"^ c #585858",
45"/ c #8A8A8A", 50"/ c #8A8A8A",
46"( c #828282", 51"( c #828282",
47"_ c #6F6F6F", 52"_ c #6F6F6F",
48": c #C9C9C9", 53": c #C9C9C9",
49"< c #050505", 54"< c #050505",
50"[ c #292929", 55"[ c #292929",
51"} c #777777", 56"} c #777777",
52"| c #616161", 57"| c #616161",
53"1 c #3A3A3A", 58"1 c #3A3A3A",
54"2 c #BEBEBE", 59"2 c #BEBEBE",
55"3 c #2C2C2C", 60"3 c #2C2C2C",
56"4 c #7C7C7C", 61"4 c #7C7C7C",
57"5 c #F6F6F6", 62"5 c #F6F6F6",
58"6 c #FCFCFC", 63"6 c #FCFCFC",
59"7 c #6B6B6B", 64"7 c #6B6B6B",
60"8 c #959595", 65"8 c #959595",
61"9 c #4F4F4F", 66"9 c #4F4F4F",
62"0 c #808080", 67"0 c #808080",
63"a c #767676", 68"a c #767676",
64"b c #818181", 69"b c #818181",
65"c c #B8B8B8", 70"c c #B8B8B8",
66"d c #FBFBFB", 71"d c #FBFBFB",
67"e c #F9F9F9", 72"e c #F9F9F9",
68"f c #CCCCCC", 73"f c #CCCCCC",
69"g c #030303", 74"g c #030303",
70"h c #737373", 75"h c #737373",
71"i c #7A7A7A", 76"i c #7A7A7A",
72"j c #7E7E7E", 77"j c #7E7E7E",
73"k c #6A6A6A", 78"k c #6A6A6A",
74"l c #FAFAFA", 79"l c #FAFAFA",
75"m c #505050", 80"m c #505050",
76"n c #9D9D9D", 81"n c #9D9D9D",
77"o c #333333", 82"o c #333333",
78"p c #7B7B7B", 83"p c #7B7B7B",
79"q c #787878", 84"q c #787878",
80"r c #696969", 85"r c #696969",
81"s c #494949", 86"s c #494949",
82"t c #555555", 87"t c #555555",
83"u c #949494", 88"u c #949494",
84"v c #E6E6E6", 89"v c #E6E6E6",
85"w c #424242", 90"w c #424242",
86"x c #515151", 91"x c #515151",
87"y c #535353", 92"y c #535353",
88"z c #3E3E3E", 93"z c #3E3E3E",
89"A c #D4D4D4", 94"A c #D4D4D4",
90"B c #0C0C0C", 95"B c #0C0C0C",
91"C c #353535", 96"C c #353535",
92"D c #474747", 97"D c #474747",
93"E c #ECECEC", 98"E c #ECECEC",
94"F c #919191", 99"F c #919191",
95"G c #7D7D7D", 100"G c #7D7D7D",
96"H c #000000", 101"H c #000000",
97"I c #404040", 102"I c #404040",
98"J c #858585", 103"J c #858585",
99"K c #323232", 104"K c #323232",
100"L c #D0D0D0", 105"L c #D0D0D0",
101"M c #1C1C1C", 106"M c #1C1C1C",
102" ...+ ", 107" ...+ ",
103" @#$%&..+ ", 108" @#$%&..+ ",
104" .*=-;;>,..+ ", 109" .*=-;;>,..+ ",
105" ')!~;;;;;;{]..", 110" ')!~;;;;;;{]..",
106" ^/(-;;;;;;;_:<", 111" ^/(-;;;;;;;_:<",
107" [}|;;;;;;;{12$", 112" [}|;;;;;;;{12$",
108" #34-55;;;;678$+", 113" #34-55;;;;678$+",
109" 90ab=c;dd;e1fg ", 114" 90ab=c;dd;e1fg ",
110" [ahij((kbl0mn$ ", 115" [ahij((kbl0mn$ ",
111" op^q^^7r&]s/$+ ", 116" op^q^^7r&]s/$+ ",
112"@btu;vbwxy]zAB ", 117"@btu;vbwxy]zAB ",
113"CzDEvEv;;DssF$ ", 118"CzDEvEv;;DssF$ ",
114"G.H{E{E{IxsJ$+ ", 119"G.H{E{E{IxsJ$+ ",
115" +...vEKxzLM ", 120" +...vEKxzLM ",
116" +...z]n$ ", 121" +...z]n$ ",
117" +... "}; 122" +... "};
118 123
119Output::Output( QWidget* parent, const char* name, bool modal, WFlags fl ) 124Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl)
120 : QDialog( parent, name, modal, fl ) 125 : QDialog( parent, name, modal, fl )
121{ 126{
122 if ( !name ) 127 QStringList cmmds;
123 setName( "Output" ); 128// cmmds=QStringList::split( " ", commands, false);
129 cmmds=commands;
130// qDebug("count %d", cmmds.count());
131 if ( !name )
132 setName( tr("Output"));
124 resize( 196, 269 ); 133 resize( 196, 269 );
125 setCaption( name ); 134 setCaption( name );
135
126 OutputLayout = new QGridLayout( this ); 136 OutputLayout = new QGridLayout( this );
127 OutputLayout->setSpacing( 6 ); 137 OutputLayout->setSpacing( 2);
128 OutputLayout->setMargin( 11 ); 138 OutputLayout->setMargin( 2);
129 139
130 QPushButton *docButton; 140 QPushButton *docButton;
131 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); 141 docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton");
132 docButton->setFixedSize( QSize( 20, 20 ) ); 142 docButton->setFixedSize( QSize( 20, 20 ) );
133 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); 143 connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() ));
134// docButton->setFlat(TRUE); 144 // docButton->setFlat(TRUE);
135 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); 145 OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 );
136
137 146
138 OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); 147 OutputEdit = new QMultiLineEdit( this, "OutputEdit" );
139 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); 148 OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 );
140 149
150 proc = new OProcess();
151
152 connect(proc, SIGNAL(processExited(OProcess *)),
153 this, SLOT( processFinished()));
154
155 connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)),
156 this, SLOT(commandStdout(OProcess *, char *, int)));
157
158 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)),
159 this, SLOT(commandStderr(OProcess *, char *, int)));
160
161// connect( , SIGNAL(received(const QByteArray &)),
162// this, SLOT(commandStdin(const QByteArray &)));
163
164// * proc << commands.latin1();
165 for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) {
166 qDebug( "%s", (*it).latin1() );
167 * proc << (*it).latin1();
168 }
141 169
170 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) {
171
172 OutputEdit->append("Process could not start");
173 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
174 perror("Error: ");
175 QString errorMsg="Error\n"+(QString)strerror(errno);
176 OutputEdit->append( errorMsg);
177 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
178 }
142} 179}
143 180
144/* 181Output::~Output() {
145 * Destroys the object and frees any allocated resources
146 */
147Output::~Output()
148{
149 // no need to delete child widgets, Qt does it all for us
150} 182}
151 183
152void Output::saveOutput() { 184void Output::saveOutput() {
153 185
154 InputDialog *fileDlg; 186 InputDialog *fileDlg;
155 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); 187 fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0);
156 fileDlg->exec(); 188 fileDlg->exec();
157 if( fileDlg->result() == 1 ) { 189 if( fileDlg->result() == 1 ) {
158 QString filename = QPEApplication::documentDir(); 190 QString filename = QPEApplication::documentDir();
159 if(filename.right(1).find('/') == -1) 191 if(filename.right(1).find('/') == -1)
160 filename+="/"; 192 filename+="/";
161 QString name = fileDlg->LineEdit1->text(); 193 QString name = fileDlg->LineEdit1->text();
162 filename+="text/plain/"+name; 194 filename+="text/plain/"+name;
163 qDebug(filename); 195 qDebug(filename);
164 196
165 QFile f(filename); 197 QFile f(filename);
166 f.open( IO_WriteOnly); 198 f.open( IO_WriteOnly);
167 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { 199 if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) {
168 DocLnk lnk; 200 DocLnk lnk;
169 lnk.setName(name); //sets file name 201 lnk.setName(name); //sets file name
170 lnk.setFile(filename); //sets File property 202 lnk.setFile(filename); //sets File property
171 lnk.setType("text/plain"); 203 lnk.setType("text/plain");
172 if(!lnk.writeLink()) { 204 if(!lnk.writeLink()) {
173 qDebug("Writing doclink did not work"); 205 qDebug("Writing doclink did not work");
174 } 206 }
175 } else 207 } else
176 qWarning("Could not write file"); 208 qWarning("Could not write file");
177 f.close(); 209 f.close();
178
179 } 210 }
180} 211}
212
213void Output::commandStdout(OProcess*, char *buffer, int buflen) {
214 qWarning("received stdout %d bytes", buflen);
215
216// QByteArray data(buflen);
217// data.fill(*buffer, buflen);
218// for (uint i = 0; i < data.count(); i++ ) {
219// printf("%c", buffer[i] );
220// }
221// printf("\n");
222
223 QString lineStr = buffer;
224 lineStr=lineStr.left(lineStr.length()-1);
225 OutputEdit->append(lineStr);
226 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
227}
228
229
230void Output::commandStdin( const QByteArray &data) {
231 qWarning("received stdin %d bytes", data.size());
232 // recieved data from the io layer goes to sz
233 proc->writeStdin(data.data(), data.size());
234}
235
236void Output::commandStderr(OProcess*, char *buffer, int buflen) {
237 qWarning("received stderrt %d bytes", buflen);
238
239 QString lineStr = buffer;
240// lineStr=lineStr.left(lineStr.length()-1);
241 OutputEdit->append(lineStr);
242 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
243}
244
245void Output::processFinished() {
246
247 delete proc;
248 OutputEdit->append( "\nFinished\n");
249 OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
250// close();
251// disconnect( layer(), SIGNAL(received(const QByteArray &)),
252// this, SLOT(commandStdin(const QByteArray &)));
253}
254
255//==============================
256
257InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
258 : QDialog( parent, name, modal, fl )
259{
260 if ( !name )
261 setName( "InputDialog" );
262 resize( 234, 50 );
263 setMaximumSize( QSize( 240, 50 ) );
264 setCaption( tr(name ) );
265
266 LineEdit1 = new QLineEdit( this, "LineEdit1" );
267 LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) );
268 connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() ));
269}
270
271InputDialog::~InputDialog() {
272 inputText = LineEdit1->text();
273}
274
275void InputDialog::setInputText(const QString &string) {
276 LineEdit1->setText( string);
277}
278
279void InputDialog::returned() {
280 inputText = LineEdit1->text();
281 this->accept();
282}
diff --git a/noncore/apps/advancedfm/output.h b/noncore/apps/advancedfm/output.h
index c1e48da..199a684 100644
--- a/noncore/apps/advancedfm/output.h
+++ b/noncore/apps/advancedfm/output.h
@@ -1,35 +1,65 @@
1/**************************************************************************** 1/****************************************************************************
2** Form interface generated from reading ui file 'outputEdit.ui' 2** Form interface generated from reading ui file 'outputEdit.ui'
3** 3**
4** Created: Fri Apr 12 15:12:44 2002 4** Created: Fri Apr 12 15:12:44 2002
5** by: The User Interface Compiler (uic) 5** by: The User Interface Compiler (uic)
6** 6**
7** WARNING! All changes made in this file will be lost! 7** WARNING! All changes made in this file will be lost!
8****************************************************************************/ 8****************************************************************************/
9#ifndef OUTPUT_H 9#ifndef OUTPUT_H
10#define OUTPUT_H 10#define OUTPUT_H
11 11
12#include <qvariant.h> 12#include <qvariant.h>
13#include <qdialog.h> 13#include <qdialog.h>
14#include <qcstring.h>
15#include <qstringlist.h>
16#include <qlineedit.h>
17#include <qwhatsthis.h>
18
19#include <opie/oprocess.h>
20
14class QVBoxLayout; 21class QVBoxLayout;
15class QHBoxLayout; 22class QHBoxLayout;
16class QGridLayout; 23class QGridLayout;
17class QMultiLineEdit; 24class QMultiLineEdit;
18 25
19class Output : public QDialog 26class Output : public QDialog
20{ 27{
21 Q_OBJECT 28 Q_OBJECT
22 29
23public: 30public:
24 Output( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 31 Output(const QStringList commands=0, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
25 ~Output(); 32 ~Output();
26 33
27 QMultiLineEdit* OutputEdit; 34 QMultiLineEdit* OutputEdit;
28 35
29protected: 36protected:
30 QGridLayout* OutputLayout; 37 QGridLayout* OutputLayout;
38 OProcess *proc;
31protected slots: 39protected slots:
32 void saveOutput(); 40 void saveOutput();
41 void commandStdout(OProcess*, char *, int);
42 void commandStdin(const QByteArray &);
43 void commandStderr(OProcess*, char *, int);
44 void processFinished();
45 private:
46 QString cmmd;
47
48};
49
50class InputDialog : public QDialog
51{
52 Q_OBJECT
53
54public:
55 InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
56 ~InputDialog();
57 QString inputText;
58 QLineEdit* LineEdit1;
59 void setInputText(const QString &);
60private slots:
61 void returned();
62
33}; 63};
34 64
35#endif // OUTPUT_H 65#endif // OUTPUT_H