summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-22 12:16:36 (UTC)
committer llornkcor <llornkcor>2002-04-22 12:16:36 (UTC)
commitc4cbc0428d013fdd3fc5744edc416669d5564ade (patch) (unidiff)
treebec11f4abf32164731bb16e6544e6a2586f146cb
parente79c930fb498f2bc3387da7133a57cd085244346 (diff)
downloadopie-c4cbc0428d013fdd3fc5744edc416669d5564ade.zip
opie-c4cbc0428d013fdd3fc5744edc416669d5564ade.tar.gz
opie-c4cbc0428d013fdd3fc5744edc416669d5564ade.tar.bz2
bug fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index fed15b4..1083f23 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,1270 +1,1270 @@
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#define DEVELOPERS_VERSION 12#define DEVELOPERS_VERSION
13#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties 13#define QTOPIA_INTERNAL_FSLP // to get access to fileproperties
14 14
15#include "advancedfm.h" 15#include "advancedfm.h"
16#include "inputDialog.h" 16#include "inputDialog.h"
17#include "filePermissions.h" 17#include "filePermissions.h"
18#include "output.h" 18#include "output.h"
19 19
20#include <qpe/lnkproperties.h> 20#include <qpe/lnkproperties.h>
21#include <qpe/filemanager.h> 21#include <qpe/filemanager.h>
22#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
23#include <qpe/qpemenubar.h> 23#include <qpe/qpemenubar.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qcopenvelope_qws.h> 27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <qpe/mimetype.h> 29#include <qpe/mimetype.h>
30#include <qpe/applnk.h> 30#include <qpe/applnk.h>
31 31
32//#include <opie/ofileselector.h> 32//#include <opie/ofileselector.h>
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34 34
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37#include <qtoolbutton.h> 37#include <qtoolbutton.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qdir.h> 39#include <qdir.h>
40#include <qfile.h> 40#include <qfile.h>
41#include <qstring.h> 41#include <qstring.h>
42#include <qcombobox.h> 42#include <qcombobox.h>
43#include <qpopupmenu.h> 43#include <qpopupmenu.h>
44#include <qlistview.h> 44#include <qlistview.h>
45#include <qmainwindow.h> 45#include <qmainwindow.h>
46#include <qlabel.h> 46#include <qlabel.h>
47#include <qprogressbar.h> 47#include <qprogressbar.h>
48#include <qspinbox.h> 48#include <qspinbox.h>
49#include <qtabwidget.h> 49#include <qtabwidget.h>
50#include <qwidget.h> 50#include <qwidget.h>
51#include <qlayout.h> 51#include <qlayout.h>
52#include <qimage.h> 52#include <qimage.h>
53#include <qpixmap.h> 53#include <qpixmap.h>
54#include <qmessagebox.h> 54#include <qmessagebox.h>
55#include <qlineedit.h> 55#include <qlineedit.h>
56#include <qregexp.h> 56#include <qregexp.h>
57 57
58#include <unistd.h> 58#include <unistd.h>
59#include <stdlib.h> 59#include <stdlib.h>
60#include <sys/stat.h> 60#include <sys/stat.h>
61#include <dirent.h> 61#include <dirent.h>
62#include <stdio.h> 62#include <stdio.h>
63#include <time.h> 63#include <time.h>
64#include <fcntl.h> 64#include <fcntl.h>
65 65
66AdvancedFm::AdvancedFm( ) 66AdvancedFm::AdvancedFm( )
67 : QMainWindow( ) 67 : QMainWindow( )
68{ 68{
69 setCaption( tr( "AdvancedFm" ) ); 69 setCaption( tr( "AdvancedFm" ) );
70 70
71 QGridLayout *layout = new QGridLayout( this ); 71 QGridLayout *layout = new QGridLayout( this );
72 layout->setSpacing( 2); 72 layout->setSpacing( 2);
73 layout->setMargin( 2); 73 layout->setMargin( 2);
74 74
75 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 75 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
76 76
77 QPEMenuBar *menuBar = new QPEMenuBar(this); 77 QPEMenuBar *menuBar = new QPEMenuBar(this);
78// fileMenu = new QPopupMenu( this ); 78// fileMenu = new QPopupMenu( this );
79 fileMenu = new QPopupMenu( this ); 79 fileMenu = new QPopupMenu( this );
80 viewMenu = new QPopupMenu( this ); 80 viewMenu = new QPopupMenu( this );
81 81
82 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 82 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
83 83
84 menuBar->insertItem( tr( "File" ), fileMenu); 84 menuBar->insertItem( tr( "File" ), fileMenu);
85 menuBar->insertItem( tr( "View" ), viewMenu); 85 menuBar->insertItem( tr( "View" ), viewMenu);
86 86
87 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton"); 87 cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
88 cfButton ->setFixedSize( QSize( 20, 20 ) ); 88 cfButton ->setFixedSize( QSize( 20, 20 ) );
89 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 89 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
90 cfButton->setFlat(TRUE); 90 cfButton->setFlat(TRUE);
91 layout->addMultiCellWidget( cfButton , 0, 0, 2, 2); 91 layout->addMultiCellWidget( cfButton , 0, 0, 2, 2);
92 92
93 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton"); 93 sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
94 sdButton->setFixedSize( QSize( 20, 20 ) ); 94 sdButton->setFixedSize( QSize( 20, 20 ) );
95 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 95 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
96 sdButton->setFlat(TRUE); 96 sdButton->setFlat(TRUE);
97 layout->addMultiCellWidget( sdButton , 0, 0, 3, 3); 97 layout->addMultiCellWidget( sdButton , 0, 0, 3, 3);
98 98
99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton"); 99 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
100 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 100 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
101 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 101 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
102 cdUpButton ->setFlat(TRUE); 102 cdUpButton ->setFlat(TRUE);
103 layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4); 103 layout->addMultiCellWidget( cdUpButton , 0, 0, 4, 4);
104 104
105 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton"); 105 docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
106 docButton->setFixedSize( QSize( 20, 20 ) ); 106 docButton->setFixedSize( QSize( 20, 20 ) );
107 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 107 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
108 docButton->setFlat(TRUE); 108 docButton->setFlat(TRUE);
109 layout->addMultiCellWidget( docButton, 0, 0, 5, 5); 109 layout->addMultiCellWidget( docButton, 0, 0, 5, 5);
110 110
111 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton"); 111 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
112 homeButton->setFixedSize( QSize( 20, 20 ) ); 112 homeButton->setFixedSize( QSize( 20, 20 ) );
113 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 113 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
114 homeButton->setFlat(TRUE); 114 homeButton->setFlat(TRUE);
115 layout->addMultiCellWidget( homeButton, 0, 0, 6, 6); 115 layout->addMultiCellWidget( homeButton, 0, 0, 6, 6);
116// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); 116// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
117// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); 117// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
118// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); 118// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
119 119
120 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 120 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
121 fileMenu->insertSeparator(); 121 fileMenu->insertSeparator();
122 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 122 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
123 fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 123 fileMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
124 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 124 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
125 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 125 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
126 fileMenu->insertSeparator(); 126 fileMenu->insertSeparator();
127 fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 127 fileMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
128 fileMenu->setCheckable(TRUE); 128 fileMenu->setCheckable(TRUE);
129 129
130 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 130 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
131 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 131 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
132 viewMenu->insertSeparator(); 132 viewMenu->insertSeparator();
133 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 133 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
134 viewMenu->setCheckable(TRUE); 134 viewMenu->setCheckable(TRUE);
135 135
136 TabWidget = new QTabWidget( this, "TabWidget" ); 136 TabWidget = new QTabWidget( this, "TabWidget" );
137 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6); 137 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 6);
138 138
139 tab = new QWidget( TabWidget, "tab" ); 139 tab = new QWidget( TabWidget, "tab" );
140 tabLayout = new QGridLayout( tab ); 140 tabLayout = new QGridLayout( tab );
141 tabLayout->setSpacing( 2); 141 tabLayout->setSpacing( 2);
142 tabLayout->setMargin( 2); 142 tabLayout->setMargin( 2);
143 143
144 Local_View = new QListView( tab, "Local_View" ); 144 Local_View = new QListView( tab, "Local_View" );
145// Local_View->setResizePolicy( QListView::AutoOneFit ); 145// Local_View->setResizePolicy( QListView::AutoOneFit );
146 Local_View->addColumn( tr("File"),140); 146 Local_View->addColumn( tr("File"),130);
147 Local_View->addColumn( tr("Date"),-1);
148 Local_View->setColumnAlignment(1,QListView::AlignRight);
149 Local_View->addColumn( tr("Size"),-1); 147 Local_View->addColumn( tr("Size"),-1);
148 Local_View->setColumnAlignment(1,QListView::AlignRight);
149 Local_View->addColumn( tr("Date"),-1);
150 Local_View->setColumnAlignment(2,QListView::AlignRight); 150 Local_View->setColumnAlignment(2,QListView::AlignRight);
151 Local_View->setAllColumnsShowFocus(TRUE); 151 Local_View->setAllColumnsShowFocus(TRUE);
152// Local_View->setMultiSelection( TRUE ); 152// Local_View->setMultiSelection( TRUE );
153// Local_View->setSelectionMode(QListView::Extended); 153// Local_View->setSelectionMode(QListView::Extended);
154 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 154 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
155 155
156 tabLayout->addWidget( Local_View, 0, 0 ); 156 tabLayout->addWidget( Local_View, 0, 0 );
157 157
158 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 158 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
159 this,SLOT( localListClicked(QListViewItem *)) ); 159 this,SLOT( localListClicked(QListViewItem *)) );
160 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 160 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
161 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 161 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
162 162
163 TabWidget->insertTab( tab, tr("1")); 163 TabWidget->insertTab( tab, tr("1"));
164 164
165 tab_2 = new QWidget( TabWidget, "tab_2" ); 165 tab_2 = new QWidget( TabWidget, "tab_2" );
166 tabLayout_2 = new QGridLayout( tab_2 ); 166 tabLayout_2 = new QGridLayout( tab_2 );
167 tabLayout_2->setSpacing( 2); 167 tabLayout_2->setSpacing( 2);
168 tabLayout_2->setMargin( 2); 168 tabLayout_2->setMargin( 2);
169 169
170 Remote_View = new QListView( tab_2, "Remote_View" ); 170 Remote_View = new QListView( tab_2, "Remote_View" );
171 Remote_View->addColumn( tr("File"),140); 171 Remote_View->addColumn( tr("File"),130);
172 Remote_View->addColumn( tr("Date"),-1);
173 Remote_View->setColumnAlignment(1,QListView::AlignRight);
174 Remote_View->addColumn( tr("Size"),-1); 172 Remote_View->addColumn( tr("Size"),-1);
173 Remote_View->setColumnAlignment(1,QListView::AlignRight);
174 Remote_View->addColumn( tr("Date"),-1);
175 Remote_View->setColumnAlignment(2,QListView::AlignRight); 175 Remote_View->setColumnAlignment(2,QListView::AlignRight);
176 Remote_View->setAllColumnsShowFocus(TRUE); 176 Remote_View->setAllColumnsShowFocus(TRUE);
177// Remote_View->setMultiSelection( TRUE ); 177// Remote_View->setMultiSelection( TRUE );
178// Remote_View->setSelectionMode(QListView::Extended); 178// Remote_View->setSelectionMode(QListView::Extended);
179 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 179 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
180 180
181 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 181 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
182 this,SLOT( remoteListClicked(QListViewItem *)) ); 182 this,SLOT( remoteListClicked(QListViewItem *)) );
183 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 183 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
184 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 184 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
185 185
186 tabLayout_2->addWidget( Remote_View, 0, 0 ); 186 tabLayout_2->addWidget( Remote_View, 0, 0 );
187 187
188 TabWidget->insertTab( tab_2, tr( "2")); 188 TabWidget->insertTab( tab_2, tr( "2"));
189 189
190 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 190 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
191 this,SLOT(tabChanged(QWidget*))); 191 this,SLOT(tabChanged(QWidget*)));
192 192
193// tab_3 = new QWidget( TabWidget, "tab_3" ); 193// tab_3 = new QWidget( TabWidget, "tab_3" );
194// tabLayout_3 = new QGridLayout( tab_3 ); 194// tabLayout_3 = new QGridLayout( tab_3 );
195// tabLayout_3->setSpacing( 2); 195// tabLayout_3->setSpacing( 2);
196// tabLayout_3->setMargin( 2); 196// tabLayout_3->setMargin( 2);
197 197
198// OFileSelector *fileSelector; 198// OFileSelector *fileSelector;
199// fileSelector = new OFileSelector(tab_3,0,0,"/","","*"); 199// fileSelector = new OFileSelector(tab_3,0,0,"/","","*");
200// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 ); 200// tabLayout_3->addMultiCellWidget( fileSelector, 0, 0, 0, 3 );
201 201
202// TabWidget->insertTab( tab_3, tr( "Files" ) ); 202// TabWidget->insertTab( tab_3, tr( "Files" ) );
203 203
204 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 204 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
205 currentDir.setPath( QDir::currentDirPath()); 205 currentDir.setPath( QDir::currentDirPath());
206 206
207 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 207 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
208 currentRemoteDir.setPath( QDir::currentDirPath()); 208 currentRemoteDir.setPath( QDir::currentDirPath());
209 209
210 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 210 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
211 currentPathCombo->setEditable(TRUE); 211 currentPathCombo->setEditable(TRUE);
212 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); 212 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6);
213 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 213 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
214 214
215 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 215 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
216 this, SLOT( currentPathComboActivated( const QString & ) ) ); 216 this, SLOT( currentPathComboActivated( const QString & ) ) );
217 217
218 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 218 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
219 this,SLOT(currentPathComboChanged())); 219 this,SLOT(currentPathComboChanged()));
220 220
221 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 221 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
222 222
223 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6); 223 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 6);
224 224
225 filterStr="*"; 225 filterStr="*";
226 b=FALSE; 226 b=FALSE;
227 populateLocalView(); 227 populateLocalView();
228 populateRemoteView(); 228 populateRemoteView();
229} 229}
230 230
231AdvancedFm::~AdvancedFm() 231AdvancedFm::~AdvancedFm()
232{ 232{
233} 233}
234 234
235void AdvancedFm::cleanUp() 235void AdvancedFm::cleanUp()
236{ 236{
237 QString sfile=QDir::homeDirPath(); 237 QString sfile=QDir::homeDirPath();
238 if(sfile.right(1) != "/") 238 if(sfile.right(1) != "/")
239 sfile+="/._temp"; 239 sfile+="/._temp";
240 else 240 else
241 sfile+="._temp"; 241 sfile+="._temp";
242 QFile file( sfile); 242 QFile file( sfile);
243 if(file.exists()) 243 if(file.exists())
244 file.remove(); 244 file.remove();
245} 245}
246 246
247void AdvancedFm::tabChanged(QWidget *w) 247void AdvancedFm::tabChanged(QWidget *w)
248{ 248{
249 if (TabWidget->currentPageIndex() == 0) { 249 if (TabWidget->currentPageIndex() == 0) {
250 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 250 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
251 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 251 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
252 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 252 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
253 } 253 }
254 if (TabWidget->currentPageIndex() == 1) { 254 if (TabWidget->currentPageIndex() == 1) {
255 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 255 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
256 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 256 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
257 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 257 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
258 } 258 }
259} 259}
260 260
261 261
262void AdvancedFm::populateLocalView() 262void AdvancedFm::populateLocalView()
263{ 263{
264// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 264// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
265// QListViewItemIterator it( Local_View ); 265// QListViewItemIterator it( Local_View );
266// for ( ; it.current(); ++it ) { 266// for ( ; it.current(); ++it ) {
267// if ( it.current()->isSelected() ) { 267// if ( it.current()->isSelected() ) {
268// QString strItem = it.current()->text(0); 268// QString strItem = it.current()->text(0);
269// QString localFile = currentDir.canonicalPath()+"/"+strItem; 269// QString localFile = currentDir.canonicalPath()+"/"+strItem;
270// QFileInfo fi(localFile); 270// QFileInfo fi(localFile);
271// } 271// }
272// } 272// }
273 QPixmap pm; 273 QPixmap pm;
274 Local_View->clear(); 274 Local_View->clear();
275 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 275 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
276 currentDir.setMatchAllDirs(TRUE); 276 currentDir.setMatchAllDirs(TRUE);
277 currentDir.setNameFilter(filterStr); 277 currentDir.setNameFilter(filterStr);
278 QString fileL, fileS, fileDate; 278 QString fileL, fileS, fileDate;
279// qDebug(currentDir.canonicalPath()); 279// qDebug(currentDir.canonicalPath());
280 280
281 bool isDir=FALSE; 281 bool isDir=FALSE;
282 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 282 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
283 QFileInfoListIterator it(*list); 283 QFileInfoListIterator it(*list);
284 QFileInfo *fi; 284 QFileInfo *fi;
285 while ( (fi=it.current()) ) { 285 while ( (fi=it.current()) ) {
286 if (fi->isSymLink() ) { 286 if (fi->isSymLink() ) {
287 QString symLink=fi->readLink(); 287 QString symLink=fi->readLink();
288// qDebug("Symlink detected "+symLink); 288// qDebug("Symlink detected "+symLink);
289 QFileInfo sym( symLink); 289 QFileInfo sym( symLink);
290 fileS.sprintf( "%10li", sym.size() ); 290 fileS.sprintf( "%10li", sym.size() );
291 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 291 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
292 fileDate = sym.lastModified().toString(); 292 fileDate = sym.lastModified().toString();
293 } else { 293 } else {
294 fileS.sprintf( "%10li", fi->size() ); 294 fileS.sprintf( "%10li", fi->size() );
295 fileL.sprintf( "%s",fi->fileName().data() ); 295 fileL.sprintf( "%s",fi->fileName().data() );
296 fileDate= fi->lastModified().toString(); 296 fileDate= fi->lastModified().toString();
297 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 297 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
298 fileL+="/"; 298 fileL+="/";
299 isDir=TRUE; 299 isDir=TRUE;
300// qDebug( fileL); 300// qDebug( fileL);
301 } 301 }
302 } 302 }
303 if(fileL !="./" && fi->exists()) { 303 if(fileL !="./" && fi->exists()) {
304 item= new QListViewItem( Local_View, fileL , fileDate, fileS); 304 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
305 305
306 if(isDir || fileL.find("/",0,TRUE) != -1) { 306 if(isDir || fileL.find("/",0,TRUE) != -1) {
307 if( !QDir( fi->filePath() ).isReadable()) 307 if( !QDir( fi->filePath() ).isReadable())
308 pm = Resource::loadPixmap( "lockedfolder" ); 308 pm = Resource::loadPixmap( "lockedfolder" );
309 else 309 else
310 pm= Resource::loadPixmap( "folder" ); 310 pm= Resource::loadPixmap( "folder" );
311 item->setPixmap( 0,pm ); 311 item->setPixmap( 0,pm );
312 } else { 312 } else {
313 if( !fi->isReadable() ) 313 if( !fi->isReadable() )
314 pm = Resource::loadPixmap( "locked" ); 314 pm = Resource::loadPixmap( "locked" );
315 else { 315 else {
316 MimeType mt(fi->filePath()); 316 MimeType mt(fi->filePath());
317 pm=mt.pixmap(); //sets the correct pixmap for mimetype 317 pm=mt.pixmap(); //sets the correct pixmap for mimetype
318 if(pm.isNull()) 318 if(pm.isNull())
319 pm = Resource::loadPixmap( "UnknownDocument-14" ); 319 pm = Resource::loadPixmap( "UnknownDocument-14" );
320 item->setPixmap( 0,pm); 320 item->setPixmap( 0,pm);
321 } 321 }
322 } 322 }
323 if( fileL.find("->",0,TRUE) != -1) { 323 if( fileL.find("->",0,TRUE) != -1) {
324 // overlay link image 324 // overlay link image
325 pm= Resource::loadPixmap( "folder" ); 325 pm= Resource::loadPixmap( "folder" );
326 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 326 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
327 QPainter painter( &pm ); 327 QPainter painter( &pm );
328 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 328 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
329 pm.setMask( pm.createHeuristicMask( FALSE ) ); 329 pm.setMask( pm.createHeuristicMask( FALSE ) );
330 item->setPixmap( 0, pm); 330 item->setPixmap( 0, pm);
331 } 331 }
332 } isDir=FALSE; 332 } isDir=FALSE;
333 ++it; 333 ++it;
334 } 334 }
335 335
336 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 336 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
337 struct stat buf; 337 struct stat buf;
338 struct stat st; 338 struct stat st;
339 dev_t devT; 339 dev_t devT;
340 mode_t mode; 340 mode_t mode;
341 DIR *dir; 341 DIR *dir;
342 int fd = 0; 342 int fd = 0;
343 struct dirent *mydirent; 343 struct dirent *mydirent;
344 int i = 1; 344 int i = 1;
345 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 345 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
346 while ((mydirent = readdir(dir)) != NULL) { 346 while ((mydirent = readdir(dir)) != NULL) {
347 lstat( mydirent->d_name, &buf); 347 lstat( mydirent->d_name, &buf);
348 qDebug(mydirent->d_name); 348 qDebug(mydirent->d_name);
349// mode = buf.st_mode; 349// mode = buf.st_mode;
350 fileL.sprintf("%s", mydirent->d_name); 350 fileL.sprintf("%s", mydirent->d_name);
351// fileS.sprintf("%d, %d", ); //this isn't correct 351// fileS.sprintf("%d, %d", ); //this isn't correct
352 devT = buf.st_dev; 352 devT = buf.st_dev;
353 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 353 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
354// fileS.sprintf("%d,%d", devT, devT); 354// fileS.sprintf("%d,%d", devT, devT);
355 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 355 fileDate.sprintf("%s", ctime( &buf.st_mtime));
356 if( fileL.find(".") == -1 ){ 356 if( fileL.find(".") == -1 ){
357 item= new QListViewItem( Local_View, fileL, fileDate, fileS); 357 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
358 pm = Resource::loadPixmap( "UnknownDocument-14" ); 358 pm = Resource::loadPixmap( "UnknownDocument-14" );
359 item->setPixmap( 0,pm); 359 item->setPixmap( 0,pm);
360 } 360 }
361 } 361 }
362 362
363 closedir(dir); 363 closedir(dir);
364 } 364 }
365 365
366 Local_View->setSorting( 3,FALSE); 366 Local_View->setSorting( 3,FALSE);
367 fillCombo( (const QString &) currentDir.canonicalPath()); 367 fillCombo( (const QString &) currentDir.canonicalPath());
368} 368}
369 369
370void AdvancedFm::populateRemoteView() 370void AdvancedFm::populateRemoteView()
371{ 371{
372// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 372// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
373// QListViewItemIterator it( Remote_View ); 373// QListViewItemIterator it( Remote_View );
374// for ( ; it.current(); ++it ) { 374// for ( ; it.current(); ++it ) {
375// if ( it.current()->isSelected() ) { 375// if ( it.current()->isSelected() ) {
376// QString strItem = it.current()->text(0); 376// QString strItem = it.current()->text(0);
377// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 377// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
378// QFileInfo fi(localFile); 378// QFileInfo fi(localFile);
379// } 379// }
380// } 380// }
381 QPixmap pm; 381 QPixmap pm;
382 Remote_View->clear(); 382 Remote_View->clear();
383 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 383 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
384 currentRemoteDir.setMatchAllDirs(TRUE); 384 currentRemoteDir.setMatchAllDirs(TRUE);
385 currentRemoteDir.setNameFilter(filterStr); 385 currentRemoteDir.setNameFilter(filterStr);
386 QString fileL, fileS, fileDate; 386 QString fileL, fileS, fileDate;
387 bool isDir=FALSE; 387 bool isDir=FALSE;
388 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 388 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
389 QFileInfoListIterator it(*list); 389 QFileInfoListIterator it(*list);
390 QFileInfo *fi; 390 QFileInfo *fi;
391 while ( (fi=it.current()) ) { 391 while ( (fi=it.current()) ) {
392 if (fi->isSymLink() ){ 392 if (fi->isSymLink() ){
393 QString symLink=fi->readLink(); 393 QString symLink=fi->readLink();
394// qDebug("Symlink detected "+symLink); 394// qDebug("Symlink detected "+symLink);
395 QFileInfo sym( symLink); 395 QFileInfo sym( symLink);
396 fileS.sprintf( "%10li", sym.size() ); 396 fileS.sprintf( "%10li", sym.size() );
397 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 397 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
398 fileDate = sym.lastModified().toString(); 398 fileDate = sym.lastModified().toString();
399 } else { 399 } else {
400// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 400// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
401 fileS.sprintf( "%10li", fi->size() ); 401 fileS.sprintf( "%10li", fi->size() );
402 fileL.sprintf( "%s",fi->fileName().data() ); 402 fileL.sprintf( "%s",fi->fileName().data() );
403 fileDate= fi->lastModified().toString(); 403 fileDate= fi->lastModified().toString();
404 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 404 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
405 fileL+="/"; 405 fileL+="/";
406 isDir=TRUE; 406 isDir=TRUE;
407// qDebug( fileL); 407// qDebug( fileL);
408 } 408 }
409 } 409 }
410 if(fileL !="./" && fi->exists()) { 410 if(fileL !="./" && fi->exists()) {
411 item= new QListViewItem( Remote_View, fileL, fileDate, fileS); 411 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
412 QPixmap pm; 412 QPixmap pm;
413 413
414 if(isDir || fileL.find("/",0,TRUE) != -1) { 414 if(isDir || fileL.find("/",0,TRUE) != -1) {
415 if( !QDir( fi->filePath() ).isReadable()) 415 if( !QDir( fi->filePath() ).isReadable())
416 pm = Resource::loadPixmap( "lockedfolder" ); 416 pm = Resource::loadPixmap( "lockedfolder" );
417 else 417 else
418 pm= Resource::loadPixmap( "folder" ); 418 pm= Resource::loadPixmap( "folder" );
419 item->setPixmap( 0,pm ); 419 item->setPixmap( 0,pm );
420 } else { 420 } else {
421 if( !fi->isReadable() ) 421 if( !fi->isReadable() )
422 pm = Resource::loadPixmap( "locked" ); 422 pm = Resource::loadPixmap( "locked" );
423 else { 423 else {
424 MimeType mt(fi->filePath()); 424 MimeType mt(fi->filePath());
425 pm=mt.pixmap(); //sets the correct pixmap for mimetype 425 pm=mt.pixmap(); //sets the correct pixmap for mimetype
426 if(pm.isNull()) 426 if(pm.isNull())
427 pm = Resource::loadPixmap( "UnknownDocument-14" ); 427 pm = Resource::loadPixmap( "UnknownDocument-14" );
428 item->setPixmap( 0,pm); 428 item->setPixmap( 0,pm);
429 } 429 }
430 } 430 }
431 if( fileL.find("->",0,TRUE) != -1) { 431 if( fileL.find("->",0,TRUE) != -1) {
432 // overlay link image 432 // overlay link image
433 pm= Resource::loadPixmap( "folder" ); 433 pm= Resource::loadPixmap( "folder" );
434 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 434 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
435 QPainter painter( &pm ); 435 QPainter painter( &pm );
436 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 436 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
437 pm.setMask( pm.createHeuristicMask( FALSE ) ); 437 pm.setMask( pm.createHeuristicMask( FALSE ) );
438 item->setPixmap( 0, pm); 438 item->setPixmap( 0, pm);
439 } 439 }
440 } isDir=FALSE; 440 } isDir=FALSE;
441 ++it; 441 ++it;
442 } 442 }
443 443
444 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 444 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
445 struct stat buf; 445 struct stat buf;
446 struct stat st; 446 struct stat st;
447 mode_t mode; 447 mode_t mode;
448 DIR *dir; 448 DIR *dir;
449 int fd = 0; 449 int fd = 0;
450 struct dirent *mydirent; 450 struct dirent *mydirent;
451 int i = 1; 451 int i = 1;
452 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 452 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
453 while ((mydirent = readdir(dir)) != NULL) { 453 while ((mydirent = readdir(dir)) != NULL) {
454 lstat( mydirent->d_name, &buf); 454 lstat( mydirent->d_name, &buf);
455 qDebug(mydirent->d_name); 455 qDebug(mydirent->d_name);
456// mode = buf.st_mode; 456// mode = buf.st_mode;
457 fileL.sprintf("%s", mydirent->d_name); 457 fileL.sprintf("%s", mydirent->d_name);
458// fileS.sprintf("%d, %d", ); //this isn't correct 458// fileS.sprintf("%d, %d", ); //this isn't correct
459 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 459 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
460 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 460 fileDate.sprintf("%s", ctime( &buf.st_mtime));
461 if( fileL.find(".") == -1 ){ 461 if( fileL.find(".") == -1 ){
462 item= new QListViewItem( Remote_View, fileL, fileDate, fileS); 462 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
463 pm = Resource::loadPixmap( "UnknownDocument-14" ); 463 pm = Resource::loadPixmap( "UnknownDocument-14" );
464 item->setPixmap( 0,pm); 464 item->setPixmap( 0,pm);
465 } 465 }
466 } 466 }
467 467
468 closedir(dir); 468 closedir(dir);
469 } 469 }
470 470
471 Remote_View->setSorting( 3,FALSE); 471 Remote_View->setSorting( 3,FALSE);
472 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 472 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
473} 473}
474 474
475void AdvancedFm::localListClicked(QListViewItem *selectedItem) 475void AdvancedFm::localListClicked(QListViewItem *selectedItem)
476{ 476{
477 if(selectedItem) { 477 if(selectedItem) {
478 QString strItem=selectedItem->text(0); 478 QString strItem=selectedItem->text(0);
479 QString strSize=selectedItem->text(1); 479 QString strSize=selectedItem->text(1);
480 strSize=strSize.stripWhiteSpace(); 480 strSize=strSize.stripWhiteSpace();
481 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 481 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
482 // is symlink 482 // is symlink
483 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 483 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
484 if(QDir(strItem2).exists() ) { 484 if(QDir(strItem2).exists() ) {
485 currentDir.cd(strItem2, TRUE); 485 currentDir.cd(strItem2, TRUE);
486 populateLocalView(); 486 populateLocalView();
487 } 487 }
488 } else { // not a symlink 488 } else { // not a symlink
489 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 489 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
490 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 490 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
491 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 491 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
492 currentDir.cd(strItem,FALSE); 492 currentDir.cd(strItem,FALSE);
493 populateLocalView(); 493 populateLocalView();
494 } else { 494 } else {
495 currentDir.cdUp(); 495 currentDir.cdUp();
496 populateLocalView(); 496 populateLocalView();
497 } 497 }
498 if(QDir(strItem).exists()){ 498 if(QDir(strItem).exists()){
499 currentDir.cd(strItem, TRUE); 499 currentDir.cd(strItem, TRUE);
500 populateLocalView(); 500 populateLocalView();
501 } 501 }
502 } else { 502 } else {
503 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 503 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
504 if( QFile::exists(strItem ) ) { 504 if( QFile::exists(strItem ) ) {
505// qDebug("upload "+strItem); 505// qDebug("upload "+strItem);
506 } 506 }
507 } //end not symlink 507 } //end not symlink
508 chdir(strItem.latin1()); 508 chdir(strItem.latin1());
509 } 509 }
510 } 510 }
511} 511}
512 512
513void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 513void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
514{ 514{
515 if(selectedItem) { 515 if(selectedItem) {
516 QString strItem=selectedItem->text(0); 516 QString strItem=selectedItem->text(0);
517 QString strSize=selectedItem->text(1); 517 QString strSize=selectedItem->text(1);
518 strSize=strSize.stripWhiteSpace(); 518 strSize=strSize.stripWhiteSpace();
519 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 519 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
520 // is symlink 520 // is symlink
521 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 521 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
522 if(QDir(strItem2).exists() ) { 522 if(QDir(strItem2).exists() ) {
523 currentRemoteDir.cd(strItem2, TRUE); 523 currentRemoteDir.cd(strItem2, TRUE);
524 populateRemoteView(); 524 populateRemoteView();
525 } 525 }
526 } else { // not a symlink 526 } else { // not a symlink
527 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 527 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
528 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 528 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
529 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 529 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
530 currentRemoteDir.cd(strItem,FALSE); 530 currentRemoteDir.cd(strItem,FALSE);
531 populateRemoteView(); 531 populateRemoteView();
532 } else { 532 } else {
533 currentRemoteDir.cdUp(); 533 currentRemoteDir.cdUp();
534 populateRemoteView(); 534 populateRemoteView();
535 } 535 }
536 if(QDir(strItem).exists()){ 536 if(QDir(strItem).exists()){
537 currentRemoteDir.cd(strItem, TRUE); 537 currentRemoteDir.cd(strItem, TRUE);
538 populateRemoteView(); 538 populateRemoteView();
539 } 539 }
540 } else { 540 } else {
541 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 541 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
542 if( QFile::exists(strItem ) ) { 542 if( QFile::exists(strItem ) ) {
543// qDebug("upload "+strItem); 543// qDebug("upload "+strItem);
544 } 544 }
545 } //end not symlink 545 } //end not symlink
546 chdir(strItem.latin1()); 546 chdir(strItem.latin1());
547 } 547 }
548 } 548 }
549} 549}
550 550
551void AdvancedFm::doLocalCd() 551void AdvancedFm::doLocalCd()
552{ 552{
553 localListClicked( Local_View->currentItem()); 553 localListClicked( Local_View->currentItem());
554} 554}
555 555
556void AdvancedFm::doRemoteCd() 556void AdvancedFm::doRemoteCd()
557{ 557{
558 localListClicked( Remote_View->currentItem()); 558 localListClicked( Remote_View->currentItem());
559} 559}
560 560
561void AdvancedFm::showHidden() 561void AdvancedFm::showHidden()
562{ 562{
563 if (!b) { 563 if (!b) {
564 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 564 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
565// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 565// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
566// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 566// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
567 b=TRUE; 567 b=TRUE;
568 568
569 } else { 569 } else {
570 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 570 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
571// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 571// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
572// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 572// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
573 b=FALSE; 573 b=FALSE;
574 } 574 }
575 populateLocalView(); 575 populateLocalView();
576} 576}
577 577
578void AdvancedFm::showRemoteHidden() 578void AdvancedFm::showRemoteHidden()
579{ 579{
580 if (!b) { 580 if (!b) {
581 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 581 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
582// viewMenu->setItemChecked(localMenu->idAt(0),TRUE); 582// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
583// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 583// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
584 b=TRUE; 584 b=TRUE;
585 585
586 } else { 586 } else {
587 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 587 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
588// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 588// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
589// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 589// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
590 b=FALSE; 590 b=FALSE;
591 } 591 }
592 populateRemoteView(); 592 populateRemoteView();
593} 593}
594 594
595void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 595void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
596{ 596{
597 switch (mouse) { 597 switch (mouse) {
598 case 1: 598 case 1:
599 break; 599 break;
600 case 2: 600 case 2:
601 showLocalMenu(item); 601 showLocalMenu(item);
602 Local_View->clearSelection(); 602 Local_View->clearSelection();
603 break; 603 break;
604 }; 604 };
605} 605}
606 606
607void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 607void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
608{ 608{
609 switch (mouse) { 609 switch (mouse) {
610 case 1: 610 case 1:
611 break; 611 break;
612 case 2: 612 case 2:
613 showRemoteMenu(item); 613 showRemoteMenu(item);
614 Remote_View->clearSelection(); 614 Remote_View->clearSelection();
615 break; 615 break;
616 }; 616 };
617} 617}
618 618
619void AdvancedFm::showLocalMenu(QListViewItem * item) 619void AdvancedFm::showLocalMenu(QListViewItem * item)
620{ 620{
621 if(item) { 621 if(item) {
622 QPopupMenu m; 622 QPopupMenu m;
623 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 623 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
624 m.insertSeparator(); 624 m.insertSeparator();
625 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 625 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
626 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 626 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
627 else 627 else
628 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 628 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
629 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 629 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
630 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 630 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
631 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 631 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
632 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 632 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
633 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 633 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
634 m.insertItem( tr( "Move" ), this, SLOT( move() )); 634 m.insertItem( tr( "Move" ), this, SLOT( move() ));
635 m.insertSeparator(); 635 m.insertSeparator();
636 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 636 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
637 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 637 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
638 m.insertSeparator(); 638 m.insertSeparator();
639 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 639 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
640 m.insertSeparator(); 640 m.insertSeparator();
641 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 641 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
642 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 642 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
643 m.setCheckable(TRUE); 643 m.setCheckable(TRUE);
644 if (b) 644 if (b)
645 m.setItemChecked(m.idAt(0),TRUE); 645 m.setItemChecked(m.idAt(0),TRUE);
646 else 646 else
647 m.setItemChecked(m.idAt(0),FALSE); 647 m.setItemChecked(m.idAt(0),FALSE);
648 m.exec( QCursor::pos() ); 648 m.exec( QCursor::pos() );
649 } 649 }
650} 650}
651 651
652void AdvancedFm::showRemoteMenu(QListViewItem * item) 652void AdvancedFm::showRemoteMenu(QListViewItem * item)
653{ 653{
654 if(item) { 654 if(item) {
655 QPopupMenu m; 655 QPopupMenu m;
656 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 656 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
657 m.insertSeparator(); 657 m.insertSeparator();
658 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 658 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
659 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 659 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
660 else 660 else
661 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 661 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
662 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 662 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
663 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 663 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
664 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 664 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
665 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 665 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
666 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 666 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
667 m.insertItem( tr( "Move" ), this, SLOT( move() )); 667 m.insertItem( tr( "Move" ), this, SLOT( move() ));
668 m.insertSeparator(); 668 m.insertSeparator();
669 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 669 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
670 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 670 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
671 m.insertSeparator(); 671 m.insertSeparator();
672 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 672 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
673 m.insertSeparator(); 673 m.insertSeparator();
674 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 674 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
675 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 675 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
676 m.setCheckable(TRUE); 676 m.setCheckable(TRUE);
677 if (b) 677 if (b)
678 m.setItemChecked(m.idAt(0),TRUE); 678 m.setItemChecked(m.idAt(0),TRUE);
679 else 679 else
680 m.setItemChecked(m.idAt(0),FALSE); 680 m.setItemChecked(m.idAt(0),FALSE);
681 m.exec( QCursor::pos() ); 681 m.exec( QCursor::pos() );
682 } 682 }
683} 683}
684 684
685void AdvancedFm::runThis() { 685void AdvancedFm::runThis() {
686// QFileInfo *fi; 686// QFileInfo *fi;
687 if (TabWidget->currentPageIndex() == 0) { 687 if (TabWidget->currentPageIndex() == 0) {
688 QString curFile = Local_View->currentItem()->text(0); 688 QString curFile = Local_View->currentItem()->text(0);
689 curFile = currentDir.canonicalPath()+"/"+curFile; 689 curFile = currentDir.canonicalPath()+"/"+curFile;
690 DocLnk nf(curFile); 690 DocLnk nf(curFile);
691 QString execStr = nf.exec(); 691 QString execStr = nf.exec();
692 qDebug( execStr); 692 qDebug( execStr);
693 if( execStr.isEmpty() ) { 693 if( execStr.isEmpty() ) {
694 } else { 694 } else {
695 nf.execute(); 695 nf.execute();
696 } 696 }
697// MimeType mt( curFile); 697// MimeType mt( curFile);
698 } else { 698 } else {
699 QString curFile = Remote_View->currentItem()->text(0); 699 QString curFile = Remote_View->currentItem()->text(0);
700 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 700 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
701 DocLnk nf(curFile); 701 DocLnk nf(curFile);
702 QString execStr = nf.exec(); 702 QString execStr = nf.exec();
703 qDebug(execStr); 703 qDebug(execStr);
704 if( execStr.isEmpty() ) { 704 if( execStr.isEmpty() ) {
705 } else { 705 } else {
706 nf.execute(); 706 nf.execute();
707 } 707 }
708// MimeType mt( curFile); 708// MimeType mt( curFile);
709 } 709 }
710} 710}
711 711
712void AdvancedFm::runText() { 712void AdvancedFm::runText() {
713 if (TabWidget->currentPageIndex() == 0) { 713 if (TabWidget->currentPageIndex() == 0) {
714 QString curFile = Local_View->currentItem()->text(0); 714 QString curFile = Local_View->currentItem()->text(0);
715 curFile = currentDir.canonicalPath()+"/"+curFile; 715 curFile = currentDir.canonicalPath()+"/"+curFile;
716 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 716 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
717 e << curFile; 717 e << curFile;
718 } else { 718 } else {
719 QString curFile = Remote_View->currentItem()->text(0); 719 QString curFile = Remote_View->currentItem()->text(0);
720 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 720 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
721 DocLnk nf(curFile); 721 DocLnk nf(curFile);
722 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 722 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
723 e << curFile; 723 e << curFile;
724 } 724 }
725} 725}
726 726
727void AdvancedFm::localMakDir() 727void AdvancedFm::localMakDir()
728{ 728{
729 InputDialog *fileDlg; 729 InputDialog *fileDlg;
730 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 730 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
731 fileDlg->exec(); 731 fileDlg->exec();
732 if( fileDlg->result() == 1 ) { 732 if( fileDlg->result() == 1 ) {
733 QString filename = fileDlg->LineEdit1->text(); 733 QString filename = fileDlg->LineEdit1->text();
734 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 734 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
735 } 735 }
736 populateLocalView(); 736 populateLocalView();
737} 737}
738 738
739void AdvancedFm::remoteMakDir() 739void AdvancedFm::remoteMakDir()
740{ 740{
741 InputDialog *fileDlg; 741 InputDialog *fileDlg;
742 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 742 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
743 fileDlg->exec(); 743 fileDlg->exec();
744 if( fileDlg->result() == 1 ) { 744 if( fileDlg->result() == 1 ) {
745 QString filename = fileDlg->LineEdit1->text(); 745 QString filename = fileDlg->LineEdit1->text();
746 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 746 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
747 } 747 }
748 populateRemoteView(); 748 populateRemoteView();
749} 749}
750 750
751void AdvancedFm::localDelete() 751void AdvancedFm::localDelete()
752{ 752{
753 QString f = Local_View->currentItem()->text(0); 753 QString f = Local_View->currentItem()->text(0);
754 if(QDir(f).exists() ) { 754 if(QDir(f).exists() ) {
755 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 755 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
756 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 756 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
757 case 0: { 757 case 0: {
758 f=currentDir.canonicalPath()+"/"+f; 758 f=currentDir.canonicalPath()+"/"+f;
759 QString cmd="rmdir "+f; 759 QString cmd="rmdir "+f;
760 system( cmd.latin1()); 760 system( cmd.latin1());
761 populateLocalView(); 761 populateLocalView();
762 } 762 }
763 break; 763 break;
764 case 1: 764 case 1:
765 // exit 765 // exit
766 break; 766 break;
767 }; 767 };
768 768
769 } else { 769 } else {
770 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 770 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
771 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 771 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
772 case 0: { 772 case 0: {
773 f=currentDir.canonicalPath()+"/"+f; 773 f=currentDir.canonicalPath()+"/"+f;
774 QString cmd="rm "+f; 774 QString cmd="rm "+f;
775 system( cmd.latin1()); 775 system( cmd.latin1());
776 populateLocalView(); 776 populateLocalView();
777 } 777 }
778 break; 778 break;
779 case 1: 779 case 1:
780 // exit 780 // exit
781 break; 781 break;
782 }; 782 };
783 } 783 }
784} 784}
785 785
786void AdvancedFm::remoteDelete() 786void AdvancedFm::remoteDelete()
787{ 787{
788 QString f = Remote_View->currentItem()->text(0); 788 QString f = Remote_View->currentItem()->text(0);
789 if(QDir(f).exists() ) { 789 if(QDir(f).exists() ) {
790 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 790 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
791 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 791 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
792 case 0: { 792 case 0: {
793 f = currentRemoteDir.canonicalPath()+"/"+f; 793 f = currentRemoteDir.canonicalPath()+"/"+f;
794 QString cmd="rmdir "+f; 794 QString cmd="rmdir "+f;
795 system( cmd.latin1()); 795 system( cmd.latin1());
796 populateRemoteView(); 796 populateRemoteView();
797 } 797 }
798 break; 798 break;
799 case 1: 799 case 1:
800 // exit 800 // exit
801 break; 801 break;
802 }; 802 };
803 803
804 } else { 804 } else {
805 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 805 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
806 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 806 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
807 case 0: { 807 case 0: {
808 f = currentRemoteDir.canonicalPath()+"/"+f; 808 f = currentRemoteDir.canonicalPath()+"/"+f;
809 QString cmd="rm "+f; 809 QString cmd="rm "+f;
810 system( cmd.latin1()); 810 system( cmd.latin1());
811 populateRemoteView(); 811 populateRemoteView();
812 } 812 }
813 break; 813 break;
814 case 1: 814 case 1:
815 // exit 815 // exit
816 break; 816 break;
817 }; 817 };
818 } 818 }
819} 819}
820 820
821void AdvancedFm::localRename() 821void AdvancedFm::localRename()
822{ 822{
823 QString curFile = Local_View->currentItem()->text(0); 823 QString curFile = Local_View->currentItem()->text(0);
824 InputDialog *fileDlg; 824 InputDialog *fileDlg;
825 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 825 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
826 fileDlg->setInputText((const QString &)curFile); 826 fileDlg->setInputText((const QString &)curFile);
827 fileDlg->exec(); 827 fileDlg->exec();
828 if( fileDlg->result() == 1 ) { 828 if( fileDlg->result() == 1 ) {
829 QString oldname = currentDir.canonicalPath() + "/" + curFile; 829 QString oldname = currentDir.canonicalPath() + "/" + curFile;
830 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 830 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
831 if( rename(oldname.latin1(), newName.latin1())== -1) 831 if( rename(oldname.latin1(), newName.latin1())== -1)
832 QMessageBox::message(tr("Note"),tr("Could not rename")); 832 QMessageBox::message(tr("Note"),tr("Could not rename"));
833 } 833 }
834 populateLocalView(); 834 populateLocalView();
835} 835}
836 836
837void AdvancedFm::remoteRename() 837void AdvancedFm::remoteRename()
838{ 838{
839 QString curFile = Local_View->currentItem()->text(0); 839 QString curFile = Local_View->currentItem()->text(0);
840 InputDialog *fileDlg; 840 InputDialog *fileDlg;
841 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 841 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
842 fileDlg->setInputText((const QString &)curFile); 842 fileDlg->setInputText((const QString &)curFile);
843 fileDlg->exec(); 843 fileDlg->exec();
844 if( fileDlg->result() == 1 ) { 844 if( fileDlg->result() == 1 ) {
845 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 845 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
846 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 846 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
847 if( rename(oldname.latin1(), newName.latin1())== -1) 847 if( rename(oldname.latin1(), newName.latin1())== -1)
848 QMessageBox::message(tr("Note"),tr("Could not rename")); 848 QMessageBox::message(tr("Note"),tr("Could not rename"));
849 } 849 }
850 populateRemoteView(); 850 populateRemoteView();
851} 851}
852 852
853void AdvancedFm::switchToLocalTab() 853void AdvancedFm::switchToLocalTab()
854{ 854{
855 TabWidget->setCurrentPage(0); 855 TabWidget->setCurrentPage(0);
856} 856}
857 857
858void AdvancedFm::switchToRemoteTab() 858void AdvancedFm::switchToRemoteTab()
859{ 859{
860 TabWidget->setCurrentPage(1); 860 TabWidget->setCurrentPage(1);
861} 861}
862 862
863void AdvancedFm::readConfig() 863void AdvancedFm::readConfig()
864{ 864{
865 Config cfg("AdvancedFm"); 865 Config cfg("AdvancedFm");
866} 866}
867 867
868void AdvancedFm::writeConfig() 868void AdvancedFm::writeConfig()
869{ 869{
870 Config cfg("AdvancedFm"); 870 Config cfg("AdvancedFm");
871} 871}
872 872
873void AdvancedFm::currentPathComboChanged() 873void AdvancedFm::currentPathComboChanged()
874{ 874{
875 if (TabWidget->currentPageIndex() == 0) { 875 if (TabWidget->currentPageIndex() == 0) {
876 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 876 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
877 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 877 currentDir.setPath( currentPathCombo->lineEdit()->text() );
878 populateLocalView(); 878 populateLocalView();
879 } else { 879 } else {
880 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 880 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
881 } 881 }
882 } 882 }
883 if (TabWidget->currentPageIndex() == 0) { 883 if (TabWidget->currentPageIndex() == 0) {
884 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 884 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
885 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 885 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
886 populateRemoteView(); 886 populateRemoteView();
887 } else { 887 } else {
888 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 888 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
889 } 889 }
890 } 890 }
891} 891}
892 892
893void AdvancedFm::fillCombo(const QString &currentPath) { 893void AdvancedFm::fillCombo(const QString &currentPath) {
894 894
895 if (TabWidget->currentPageIndex() == 0) { 895 if (TabWidget->currentPageIndex() == 0) {
896 currentPathCombo->lineEdit()->setText( currentPath); 896 currentPathCombo->lineEdit()->setText( currentPath);
897 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 897 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
898 currentPathCombo->clear(); 898 currentPathCombo->clear();
899 localDirPathStringList.prepend( currentPath ); 899 localDirPathStringList.prepend( currentPath );
900 currentPathCombo->insertStringList( localDirPathStringList,-1); 900 currentPathCombo->insertStringList( localDirPathStringList,-1);
901 } 901 }
902 } else { 902 } else {
903 currentPathCombo->lineEdit()->setText( currentPath); 903 currentPathCombo->lineEdit()->setText( currentPath);
904 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 904 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
905 currentPathCombo->clear(); 905 currentPathCombo->clear();
906 remoteDirPathStringList.prepend( currentPath ); 906 remoteDirPathStringList.prepend( currentPath );
907 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 907 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
908 } 908 }
909 } 909 }
910} 910}
911 911
912void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 912void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
913 if (TabWidget->currentPageIndex() == 0) { 913 if (TabWidget->currentPageIndex() == 0) {
914 chdir( currentPath.latin1() ); 914 chdir( currentPath.latin1() );
915 currentDir.cd( currentPath, TRUE); 915 currentDir.cd( currentPath, TRUE);
916 populateLocalView(); 916 populateLocalView();
917 update(); 917 update();
918 } else { 918 } else {
919 chdir( currentPath.latin1() ); 919 chdir( currentPath.latin1() );
920 currentRemoteDir.cd( currentPath, TRUE); 920 currentRemoteDir.cd( currentPath, TRUE);
921 populateRemoteView(); 921 populateRemoteView();
922 update(); 922 update();
923 } 923 }
924} 924}
925 925
926void AdvancedFm::filePerms() { 926void AdvancedFm::filePerms() {
927 QString curFile = getPath(); 927 QString curFile = getPath();
928 filePermissions *filePerm; 928 filePermissions *filePerm;
929 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile)); 929 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(curFile));
930 filePerm->showMaximized(); 930 filePerm->showMaximized();
931 filePerm->exec(); 931 filePerm->exec();
932 if( filePerm) 932 if( filePerm)
933 delete filePerm; 933 delete filePerm;
934} 934}
935 935
936void AdvancedFm::doProperties() { 936void AdvancedFm::doProperties() {
937 937
938 DocLnk lnk( getPath()); 938 DocLnk lnk( getPath());
939 LnkProperties prop( &lnk ); 939 LnkProperties prop( &lnk );
940// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 940// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
941 prop.showMaximized(); 941 prop.showMaximized();
942 prop.exec(); 942 prop.exec();
943} 943}
944 944
945QString AdvancedFm::getPath() { 945QString AdvancedFm::getPath() {
946 if (TabWidget->currentPageIndex() == 0) { 946 if (TabWidget->currentPageIndex() == 0) {
947 return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0); 947 return currentDir.canonicalPath()+"/"+ Local_View->currentItem()->text(0);
948 } else { 948 } else {
949 return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); 949 return currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
950 } 950 }
951} 951}
952 952
953void AdvancedFm::homeButtonPushed() { 953void AdvancedFm::homeButtonPushed() {
954 QString current = QDir::homeDirPath(); 954 QString current = QDir::homeDirPath();
955 chdir( current.latin1() ); 955 chdir( current.latin1() );
956 if (TabWidget->currentPageIndex() == 0) { 956 if (TabWidget->currentPageIndex() == 0) {
957 currentDir.cd( current, TRUE); 957 currentDir.cd( current, TRUE);
958 populateLocalView(); 958 populateLocalView();
959 } else { 959 } else {
960 currentRemoteDir.cd( current, TRUE); 960 currentRemoteDir.cd( current, TRUE);
961 populateRemoteView(); 961 populateRemoteView();
962 } 962 }
963 update(); 963 update();
964} 964}
965 965
966void AdvancedFm::docButtonPushed() { 966void AdvancedFm::docButtonPushed() {
967 QString current = QPEApplication::documentDir(); 967 QString current = QPEApplication::documentDir();
968 chdir( current.latin1() ); 968 chdir( current.latin1() );
969 if (TabWidget->currentPageIndex() == 0) { 969 if (TabWidget->currentPageIndex() == 0) {
970 currentDir.cd( current, TRUE); 970 currentDir.cd( current, TRUE);
971 populateLocalView(); 971 populateLocalView();
972 } else { 972 } else {
973 currentRemoteDir.cd( current, TRUE); 973 currentRemoteDir.cd( current, TRUE);
974 populateRemoteView(); 974 populateRemoteView();
975 } 975 }
976 update(); 976 update();
977} 977}
978 978
979void AdvancedFm::SDButtonPushed() { 979void AdvancedFm::SDButtonPushed() {
980 QString current = "/mnt/card"; 980 QString current = "/mnt/card";
981 chdir( current.latin1() ); 981 chdir( current.latin1() );
982 if (TabWidget->currentPageIndex() == 0) { 982 if (TabWidget->currentPageIndex() == 0) {
983 currentDir.cd( current, TRUE); 983 currentDir.cd( current, TRUE);
984 populateLocalView(); 984 populateLocalView();
985 } else { 985 } else {
986 currentRemoteDir.cd( current, TRUE); 986 currentRemoteDir.cd( current, TRUE);
987 populateRemoteView(); 987 populateRemoteView();
988 } 988 }
989 update(); 989 update();
990 990
991} 991}
992 992
993void AdvancedFm::CFButtonPushed() { 993void AdvancedFm::CFButtonPushed() {
994 QString current = "/mnt/cf"; 994 QString current = "/mnt/cf";
995 chdir( current.latin1() ); 995 chdir( current.latin1() );
996 if (TabWidget->currentPageIndex() == 0) { 996 if (TabWidget->currentPageIndex() == 0) {
997 currentDir.cd( current, TRUE); 997 currentDir.cd( current, TRUE);
998 populateLocalView(); 998 populateLocalView();
999 } else { 999 } else {
1000 currentRemoteDir.cd( current, TRUE); 1000 currentRemoteDir.cd( current, TRUE);
1001 populateRemoteView(); 1001 populateRemoteView();
1002 } 1002 }
1003 update(); 1003 update();
1004 1004
1005} 1005}
1006 1006
1007 1007
1008void AdvancedFm::upDir() 1008void AdvancedFm::upDir()
1009{ 1009{
1010 if (TabWidget->currentPageIndex() == 0) { 1010 if (TabWidget->currentPageIndex() == 0) {
1011 QString current = currentDir.canonicalPath(); 1011 QString current = currentDir.canonicalPath();
1012 QDir dir(current); 1012 QDir dir(current);
1013 dir.cdUp(); 1013 dir.cdUp();
1014 current = dir.canonicalPath(); 1014 current = dir.canonicalPath();
1015 chdir( current.latin1() ); 1015 chdir( current.latin1() );
1016 currentDir.cd( current, TRUE); 1016 currentDir.cd( current, TRUE);
1017 populateLocalView(); 1017 populateLocalView();
1018 update(); 1018 update();
1019 } else { 1019 } else {
1020 QString current = currentRemoteDir.canonicalPath(); 1020 QString current = currentRemoteDir.canonicalPath();
1021 QDir dir(current); 1021 QDir dir(current);
1022 dir.cdUp(); 1022 dir.cdUp();
1023 current = dir.canonicalPath(); 1023 current = dir.canonicalPath();
1024 chdir( current.latin1() ); 1024 chdir( current.latin1() );
1025 currentRemoteDir.cd( current, TRUE); 1025 currentRemoteDir.cd( current, TRUE);
1026 populateRemoteView(); 1026 populateRemoteView();
1027 update(); 1027 update();
1028 } 1028 }
1029} 1029}
1030 1030
1031void AdvancedFm::copy() 1031void AdvancedFm::copy()
1032{ 1032{
1033 QString curFile = getPath(); 1033 QString curFile = getPath();
1034 if (TabWidget->currentPageIndex() == 0) { 1034 if (TabWidget->currentPageIndex() == 0) {
1035 QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0); 1035 QString destFile = currentRemoteDir.canonicalPath()+"/"+Local_View->currentItem()->text(0);
1036 QFile f(destFile); 1036 QFile f(destFile);
1037 if( f.exists()) 1037 if( f.exists())
1038 f.remove(); 1038 f.remove();
1039 if(!copyFile(destFile, curFile) ) 1039 if(!copyFile(destFile, curFile) )
1040 qWarning("nothin doing"); 1040 qWarning("nothin doing");
1041 populateRemoteView(); 1041 populateRemoteView();
1042 TabWidget->setCurrentPage(1); 1042 TabWidget->setCurrentPage(1);
1043 } else { 1043 } else {
1044 QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0); 1044 QString destFile = currentDir.canonicalPath()+"/"+Remote_View->currentItem()->text(0);
1045 QFile f(destFile); 1045 QFile f(destFile);
1046 if( f.exists()) 1046 if( f.exists())
1047 f.remove(); 1047 f.remove();
1048 if(!copyFile(destFile, curFile) ) 1048 if(!copyFile(destFile, curFile) )
1049 qWarning("nothin doing"); 1049 qWarning("nothin doing");
1050 populateLocalView(); 1050 populateLocalView();
1051 TabWidget->setCurrentPage(0); 1051 TabWidget->setCurrentPage(0);
1052 } 1052 }
1053} 1053}
1054 1054
1055void AdvancedFm::copyAs() 1055void AdvancedFm::copyAs()
1056{ 1056{
1057 QString curFile = getPath(); 1057 QString curFile = getPath();
1058 if (TabWidget->currentPageIndex() == 0) { 1058 if (TabWidget->currentPageIndex() == 0) {
1059 QString destFile = Local_View->currentItem()->text(0); 1059 QString destFile = Local_View->currentItem()->text(0);
1060 InputDialog *fileDlg; 1060 InputDialog *fileDlg;
1061 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1061 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1062 fileDlg->setInputText((const QString &) destFile ); 1062 fileDlg->setInputText((const QString &) destFile );
1063 fileDlg->exec(); 1063 fileDlg->exec();
1064 if( fileDlg->result() == 1 ) { 1064 if( fileDlg->result() == 1 ) {
1065 QString filename = fileDlg->LineEdit1->text(); 1065 QString filename = fileDlg->LineEdit1->text();
1066 destFile = currentRemoteDir.canonicalPath()+"/"+destFile; 1066 destFile = currentRemoteDir.canonicalPath()+"/"+destFile;
1067 1067
1068 QFile f(destFile); 1068 QFile f(destFile);
1069 if( f.exists()) 1069 if( f.exists())
1070 f.remove(); 1070 f.remove();
1071 if(!copyFile(destFile, curFile) ) 1071 if(!copyFile(destFile, curFile) )
1072 qWarning("nothin doing"); 1072 qWarning("nothin doing");
1073 } 1073 }
1074 populateRemoteView(); 1074 populateRemoteView();
1075 TabWidget->setCurrentPage(1); 1075 TabWidget->setCurrentPage(1);
1076 } else { 1076 } else {
1077 QString destFile = Remote_View->currentItem()->text(0); 1077 QString destFile = Remote_View->currentItem()->text(0);
1078 InputDialog *fileDlg; 1078 InputDialog *fileDlg;
1079 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1079 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1080 fileDlg->setInputText((const QString &) destFile); 1080 fileDlg->setInputText((const QString &) destFile);
1081 fileDlg->exec(); 1081 fileDlg->exec();
1082 if( fileDlg->result() == 1 ) { 1082 if( fileDlg->result() == 1 ) {
1083 QString filename = fileDlg->LineEdit1->text(); 1083 QString filename = fileDlg->LineEdit1->text();
1084 destFile = currentDir.canonicalPath()+"/"+destFile; 1084 destFile = currentDir.canonicalPath()+"/"+destFile;
1085 1085
1086 QFile f(destFile); 1086 QFile f(destFile);
1087 if( f.exists()) 1087 if( f.exists())
1088 f.remove(); 1088 f.remove();
1089 if(!copyFile(destFile, curFile) ) 1089 if(!copyFile(destFile, curFile) )
1090 qWarning("nothin doing"); 1090 qWarning("nothin doing");
1091 } 1091 }
1092 populateLocalView(); 1092 populateLocalView();
1093 TabWidget->setCurrentPage(0); 1093 TabWidget->setCurrentPage(0);
1094 } 1094 }
1095} 1095}
1096 1096
1097void AdvancedFm::move() { 1097void AdvancedFm::move() {
1098 QString curFile = getPath(); 1098 QString curFile = getPath();
1099// qDebug(curFile); 1099// qDebug(curFile);
1100 QString destFile; 1100 QString destFile;
1101 if (TabWidget->currentPageIndex() == 0) { 1101 if (TabWidget->currentPageIndex() == 0) {
1102 QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0); 1102 QString destFile = currentRemoteDir.canonicalPath() + "/" + Local_View->currentItem()->text(0);
1103 qDebug("Destination file is "+destFile); 1103 qDebug("Destination file is "+destFile);
1104 1104
1105 QFile f(destFile); 1105 QFile f(destFile);
1106 if( f.exists()) 1106 if( f.exists())
1107 f.remove(); 1107 f.remove();
1108 if(!copyFile( destFile, curFile) ) { 1108 if(!copyFile( destFile, curFile) ) {
1109 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1109 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1110 return; 1110 return;
1111 } 1111 }
1112 QFile::remove(curFile); 1112 QFile::remove(curFile);
1113 TabWidget->setCurrentPage(1); 1113 TabWidget->setCurrentPage(1);
1114 } else { 1114 } else {
1115 QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0); 1115 QString destFile = currentDir.canonicalPath() + "/" + Remote_View->currentItem()->text(0);
1116 qDebug("Destination file is "+destFile); 1116 qDebug("Destination file is "+destFile);
1117 1117
1118 QFile f(destFile); 1118 QFile f(destFile);
1119 if( f.exists()) 1119 if( f.exists())
1120 f.remove(); 1120 f.remove();
1121 if(!copyFile(destFile, curFile) ) { 1121 if(!copyFile(destFile, curFile) ) {
1122 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1122 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1123 return; 1123 return;
1124 } 1124 }
1125 QFile::remove(curFile); 1125 QFile::remove(curFile);
1126 TabWidget->setCurrentPage(0); 1126 TabWidget->setCurrentPage(0);
1127 } 1127 }
1128 populateRemoteView(); 1128 populateRemoteView();
1129 populateLocalView(); 1129 populateLocalView();
1130} 1130}
1131 1131
1132bool AdvancedFm::copyFile( const QString & dest, const QString & src ) 1132bool AdvancedFm::copyFile( const QString & dest, const QString & src )
1133{ 1133{
1134 char bf[ 50000 ]; 1134 char bf[ 50000 ];
1135 int bytesRead; 1135 int bytesRead;
1136 bool success = TRUE; 1136 bool success = TRUE;
1137 struct stat status; 1137 struct stat status;
1138 1138
1139 QFile s( src ); 1139 QFile s( src );
1140 QFile d( dest ); 1140 QFile d( dest );
1141 1141
1142 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { 1142 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) {
1143 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { 1143 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) {
1144 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 1144 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
1145 success = FALSE; 1145 success = FALSE;
1146 break; 1146 break;
1147 } 1147 }
1148 } 1148 }
1149 if( success && (bytesRead > 0) ){ 1149 if( success && (bytesRead > 0) ){
1150 d.writeBlock( bf, bytesRead ); 1150 d.writeBlock( bf, bytesRead );
1151 } 1151 }
1152 } else { 1152 } else {
1153 success = FALSE; 1153 success = FALSE;
1154 } 1154 }
1155 1155
1156 // Set file permissions 1156 // Set file permissions
1157 if( stat( (const char *) src, &status ) == 0 ){ 1157 if( stat( (const char *) src, &status ) == 0 ){
1158 chmod( (const char *) dest, status.st_mode ); 1158 chmod( (const char *) dest, status.st_mode );
1159 } 1159 }
1160 1160
1161 return success; 1161 return success;
1162} 1162}
1163 1163
1164void AdvancedFm::runCommand() { 1164void AdvancedFm::runCommand() {
1165 QString curFile; 1165 QString curFile;
1166 if (TabWidget->currentPageIndex() == 0) { 1166 if (TabWidget->currentPageIndex() == 0) {
1167 if( Local_View->currentItem()) 1167 if( Local_View->currentItem())
1168 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); 1168 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0);
1169 } else { 1169 } else {
1170 if(Remote_View->currentItem()) 1170 if(Remote_View->currentItem())
1171 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); 1171 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0);
1172 } 1172 }
1173 1173
1174 InputDialog *fileDlg; 1174 InputDialog *fileDlg;
1175 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1175 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1176 fileDlg->setInputText(curFile); 1176 fileDlg->setInputText(curFile);
1177 fileDlg->exec(); 1177 fileDlg->exec();
1178 QString command; 1178 QString command;
1179 if( fileDlg->result() == 1 ) { 1179 if( fileDlg->result() == 1 ) {
1180 command = fileDlg->LineEdit1->text(); 1180 command = fileDlg->LineEdit1->text();
1181 1181
1182 int err=0; 1182 int err=0;
1183 Output *outDlg; 1183 Output *outDlg;
1184 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1184 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1185 outDlg->showMaximized(); 1185 outDlg->showMaximized();
1186 outDlg->show(); 1186 outDlg->show();
1187 qApp->processEvents(); 1187 qApp->processEvents();
1188 FILE *fp; 1188 FILE *fp;
1189 char line[130]; 1189 char line[130];
1190 sleep(1); 1190 sleep(1);
1191// if(command.find("2>",0,TRUE) != -1) 1191// if(command.find("2>",0,TRUE) != -1)
1192 command +=" 2>&1"; 1192 command +=" 2>&1";
1193 fp = popen( (const char *) command, "r"); 1193 fp = popen( (const char *) command, "r");
1194 if ( !fp ) { 1194 if ( !fp ) {
1195 qDebug("Could not execute '" + command + "'! err=%d", fp); 1195 qDebug("Could not execute '" + command + "'! err=%d", fp);
1196 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1196 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1197 pclose(fp); 1197 pclose(fp);
1198 return; 1198 return;
1199 } else { 1199 } else {
1200 while ( fgets( line, sizeof line, fp)) { 1200 while ( fgets( line, sizeof line, fp)) {
1201 QString lineStr = line; 1201 QString lineStr = line;
1202 lineStr=lineStr.left(lineStr.length()-1); 1202 lineStr=lineStr.left(lineStr.length()-1);
1203 outDlg->OutputEdit->append(lineStr); 1203 outDlg->OutputEdit->append(lineStr);
1204 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1204 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1205 } 1205 }
1206 } 1206 }
1207 } 1207 }
1208} 1208}
1209 1209
1210void AdvancedFm::runCommandStd() { 1210void AdvancedFm::runCommandStd() {
1211 QString curFile; 1211 QString curFile;
1212 if (TabWidget->currentPageIndex() == 0) { 1212 if (TabWidget->currentPageIndex() == 0) {
1213 if( Local_View->currentItem()) 1213 if( Local_View->currentItem())
1214 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); 1214 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0);
1215 } else { 1215 } else {
1216 if(Remote_View->currentItem()) 1216 if(Remote_View->currentItem())
1217 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); 1217 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0);
1218 } 1218 }
1219 1219
1220 InputDialog *fileDlg; 1220 InputDialog *fileDlg;
1221 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1221 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1222 fileDlg->setInputText(curFile); 1222 fileDlg->setInputText(curFile);
1223 fileDlg->exec(); 1223 fileDlg->exec();
1224 QString command; 1224 QString command;
1225 if( fileDlg->result() == 1 ) { 1225 if( fileDlg->result() == 1 ) {
1226 qApp->processEvents(); 1226 qApp->processEvents();
1227 command = fileDlg->LineEdit1->text() + " &"; 1227 command = fileDlg->LineEdit1->text() + " &";
1228 system(command.latin1()); 1228 system(command.latin1());
1229 } 1229 }
1230} 1230}
1231 1231
1232void AdvancedFm::fileStatus() { 1232void AdvancedFm::fileStatus() {
1233 QString curFile; 1233 QString curFile;
1234 if (TabWidget->currentPageIndex() == 0) { 1234 if (TabWidget->currentPageIndex() == 0) {
1235 curFile = Local_View->currentItem()->text(0); 1235 curFile = Local_View->currentItem()->text(0);
1236 } else { 1236 } else {
1237 curFile = Remote_View->currentItem()->text(0); 1237 curFile = Remote_View->currentItem()->text(0);
1238 } 1238 }
1239 QString command = " stat -l "+ curFile +" 2>&1"; 1239 QString command = " stat -l "+ curFile +" 2>&1";
1240 int err=0; 1240 int err=0;
1241 Output *outDlg; 1241 Output *outDlg;
1242 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1242 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1243 outDlg->showMaximized(); 1243 outDlg->showMaximized();
1244 outDlg->show(); 1244 outDlg->show();
1245 qApp->processEvents(); 1245 qApp->processEvents();
1246 FILE *fp; 1246 FILE *fp;
1247 char line[130]; 1247 char line[130];
1248 sleep(1); 1248 sleep(1);
1249 fp = popen( (const char *) command, "r"); 1249 fp = popen( (const char *) command, "r");
1250 if ( !fp ) { 1250 if ( !fp ) {
1251 qDebug("Could not execute '" + command + "'! err=%d", fp); 1251 qDebug("Could not execute '" + command + "'! err=%d", fp);
1252 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1252 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1253 pclose(fp); 1253 pclose(fp);
1254 return; 1254 return;
1255 } else { 1255 } else {
1256 while ( fgets( line, sizeof line, fp)) { 1256 while ( fgets( line, sizeof line, fp)) {
1257 outDlg->OutputEdit->append(line); 1257 outDlg->OutputEdit->append(line);
1258 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1258 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1259 1259
1260 } 1260 }
1261 1261
1262 } 1262 }
1263} 1263}
1264 1264
1265void AdvancedFm::doAbout() { 1265void AdvancedFm::doAbout() {
1266 QMessageBox::message("AdvancedFm","Advanced FileManager\n" 1266 QMessageBox::message("AdvancedFm","Advanced FileManager\n"
1267 "is copyright 2002 by\n" 1267 "is copyright 2002 by\n"
1268 "L.J.Potter<llornkcor@handhelds.org>\n" 1268 "L.J.Potter<llornkcor@handhelds.org>\n"
1269 "and is licensed by the GPL"); 1269 "and is licensed by the GPL");
1270} 1270}