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