summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-02 02:42:45 (UTC)
committer llornkcor <llornkcor>2002-05-02 02:42:45 (UTC)
commitdd8d5784a9ef93b0d4ed7b6d1751942a904ab7cb (patch) (unidiff)
tree2f40da1aec6e66dd9c67eb73297561c9e5a64e2b
parent6dfc6f34420b8c9222d1c785efc950fc5031a7f0 (diff)
downloadopie-dd8d5784a9ef93b0d4ed7b6d1751942a904ab7cb.zip
opie-dd8d5784a9ef93b0d4ed7b6d1751942a904ab7cb.tar.gz
opie-dd8d5784a9ef93b0d4ed7b6d1751942a904ab7cb.tar.bz2
bug on vfat workaround... sorta
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 7cd8644..b224deb 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,1213 +1,1215 @@
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", fi->fileName().data(),sym.absFilePath().data() ); 298 fileL.sprintf( "%s -> %s", fi->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.permission( QFileInfo::ExeUser) 321 } else if( (fileInfo.permission( QFileInfo::ExeUser)
322 | fileInfo.permission( QFileInfo::ExeGroup) 322 | fileInfo.permission( QFileInfo::ExeGroup)
323 | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { 323 | fileInfo.permission( QFileInfo::ExeOther))
324 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
324 pm = Resource::loadPixmap( "exec"); 325 pm = Resource::loadPixmap( "exec");
325// else { //is exec 326// else { //is exec
326// pm = Resource::loadPixmap( "exec"); 327// pm = Resource::loadPixmap( "exec");
327// } 328// }
328// // item->setPixmap( 0,pm); 329// // item->setPixmap( 0,pm);
329 } else if( !fi->isReadable() ) { 330 } else if( !fi->isReadable() ) {
330 pm = Resource::loadPixmap( "locked" ); 331 pm = Resource::loadPixmap( "locked" );
331// item->setPixmap( 0,pm); 332// item->setPixmap( 0,pm);
332 } else { //everything else goes by mimetype 333 } else { //everything else goes by mimetype
333 MimeType mt(fi->filePath()); 334 MimeType mt(fi->filePath());
334 pm=mt.pixmap(); //sets the correct pixmap for mimetype 335 pm=mt.pixmap(); //sets the correct pixmap for mimetype
335 if(pm.isNull()) 336 if(pm.isNull())
336 pm = Resource::loadPixmap( "UnknownDocument-14" ); 337 pm = Resource::loadPixmap( "UnknownDocument-14" );
337// item->setPixmap( 0,pm); 338// item->setPixmap( 0,pm);
338 } 339 }
339 item->setPixmap( 0,pm); 340 item->setPixmap( 0,pm);
340 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 341 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
341 // overlay link image 342 // overlay link image
342 pm= Resource::loadPixmap( "folder" ); 343 pm= Resource::loadPixmap( "folder" );
343 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 344 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
344 QPainter painter( &pm ); 345 QPainter painter( &pm );
345 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 346 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
346 pm.setMask( pm.createHeuristicMask( FALSE ) ); 347 pm.setMask( pm.createHeuristicMask( FALSE ) );
347 item->setPixmap( 0, pm); 348 item->setPixmap( 0, pm);
348 } 349 }
349 } 350 }
350 isDir=FALSE; 351 isDir=FALSE;
351 ++it; 352 ++it;
352 } 353 }
353 354
354 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 355 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
355 struct stat buf; 356 struct stat buf;
356// struct stat st; 357// struct stat st;
357 dev_t devT; 358 dev_t devT;
358// mode_t mode; 359// mode_t mode;
359 DIR *dir; 360 DIR *dir;
360// int fd = 0; 361// int fd = 0;
361 struct dirent *mydirent; 362 struct dirent *mydirent;
362// int i = 1; 363// int i = 1;
363 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 364 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
364 while ((mydirent = readdir(dir)) != NULL) { 365 while ((mydirent = readdir(dir)) != NULL) {
365 lstat( mydirent->d_name, &buf); 366 lstat( mydirent->d_name, &buf);
366 qDebug(mydirent->d_name); 367 qDebug(mydirent->d_name);
367// mode = buf.st_mode; 368// mode = buf.st_mode;
368 fileL.sprintf("%s", mydirent->d_name); 369 fileL.sprintf("%s", mydirent->d_name);
369// fileS.sprintf("%d, %d", ); //this isn't correct 370// fileS.sprintf("%d, %d", ); //this isn't correct
370 devT = buf.st_dev; 371 devT = buf.st_dev;
371 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 372 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
372// fileS.sprintf("%d,%d", devT, devT); 373// fileS.sprintf("%d,%d", devT, devT);
373 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 374 fileDate.sprintf("%s", ctime( &buf.st_mtime));
374 if( fileL.find(".") == -1 ){ 375 if( fileL.find(".") == -1 ){
375 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 376 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
376 pm = Resource::loadPixmap( "UnknownDocument-14" ); 377 pm = Resource::loadPixmap( "UnknownDocument-14" );
377 item->setPixmap( 0,pm); 378 item->setPixmap( 0,pm);
378 } 379 }
379 } 380 }
380 381
381 closedir(dir); 382 closedir(dir);
382 } 383 }
383 384
384 Local_View->setSorting( 3,FALSE); 385 Local_View->setSorting( 3,FALSE);
385 fillCombo( (const QString &) currentDir.canonicalPath()); 386 fillCombo( (const QString &) currentDir.canonicalPath());
386} 387}
387 388
388 389
389void AdvancedFm::populateRemoteView() 390void AdvancedFm::populateRemoteView()
390{ 391{
391// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 392// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
392// QListViewItemIterator it( Remote_View ); 393// QListViewItemIterator it( Remote_View );
393// for ( ; it.current(); ++it ) { 394// for ( ; it.current(); ++it ) {
394// if ( it.current()->isSelected() ) { 395// if ( it.current()->isSelected() ) {
395// QString strItem = it.current()->text(0); 396// QString strItem = it.current()->text(0);
396// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 397// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
397// QFileInfo fi(localFile); 398// QFileInfo fi(localFile);
398// } 399// }
399// } 400// }
400 QPixmap pm; 401 QPixmap pm;
401 Remote_View->clear(); 402 Remote_View->clear();
402 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 403 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
403 currentRemoteDir.setMatchAllDirs(TRUE); 404 currentRemoteDir.setMatchAllDirs(TRUE);
404 currentRemoteDir.setNameFilter(filterStr); 405 currentRemoteDir.setNameFilter(filterStr);
405 QString fileL, fileS, fileDate; 406 QString fileL, fileS, fileDate;
406 407
407 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 408 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
408 setCaption("AdvancedFm :: "+fs); 409 setCaption("AdvancedFm :: "+fs);
409 bool isDir=FALSE; 410 bool isDir=FALSE;
410 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 411 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
411 QFileInfoListIterator it(*list); 412 QFileInfoListIterator it(*list);
412 QFileInfo *fi; 413 QFileInfo *fi;
413 while ( (fi=it.current()) ) { 414 while ( (fi=it.current()) ) {
414 if (fi->isSymLink() ){ 415 if (fi->isSymLink() ){
415 QString symLink=fi->readLink(); 416 QString symLink=fi->readLink();
416// qDebug("Symlink detected "+symLink); 417// qDebug("Symlink detected "+symLink);
417 QFileInfo sym( symLink); 418 QFileInfo sym( symLink);
418 fileS.sprintf( "%10li", sym.size() ); 419 fileS.sprintf( "%10li", sym.size() );
419 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 420 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
420 fileDate = sym.lastModified().toString(); 421 fileDate = sym.lastModified().toString();
421 } else { 422 } else {
422// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 423// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
423 fileS.sprintf( "%10li", fi->size() ); 424 fileS.sprintf( "%10li", fi->size() );
424 fileL.sprintf( "%s",fi->fileName().data() ); 425 fileL.sprintf( "%s",fi->fileName().data() );
425 fileDate= fi->lastModified().toString(); 426 fileDate= fi->lastModified().toString();
426 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 427 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
427 fileL+="/"; 428 fileL+="/";
428 isDir=TRUE; 429 isDir=TRUE;
429// qDebug( fileL); 430// qDebug( fileL);
430 } 431 }
431 } 432 }
432 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 433 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
433 if(fileL !="./" && fi->exists()) { 434 if(fileL !="./" && fi->exists()) {
434 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 435 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
435 QPixmap pm; 436 QPixmap pm;
436 437
437 if(isDir || fileL.find("/",0,TRUE) != -1) { 438 if(isDir || fileL.find("/",0,TRUE) != -1) {
438 if( !QDir( fi->filePath() ).isReadable()) 439 if( !QDir( fi->filePath() ).isReadable())
439 pm = Resource::loadPixmap( "lockedfolder" ); 440 pm = Resource::loadPixmap( "lockedfolder" );
440 else 441 else
441 pm= Resource::loadPixmap( "folder" ); 442 pm= Resource::loadPixmap( "folder" );
442// item->setPixmap( 0,pm ); 443// item->setPixmap( 0,pm );
443 } else if( (fileInfo.permission( QFileInfo::ExeUser) 444 } else if( (fileInfo.permission( QFileInfo::ExeUser)
444 | fileInfo.permission( QFileInfo::ExeGroup) 445 | fileInfo.permission( QFileInfo::ExeGroup)
445 | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { 446 | fileInfo.permission( QFileInfo::ExeOther))
447 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
446///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! 448///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!!
447 pm = Resource::loadPixmap( "exec"); 449 pm = Resource::loadPixmap( "exec");
448// item->setPixmap( 0,pm); 450// item->setPixmap( 0,pm);
449 } else if( !fi->isReadable() ) { 451 } else if( !fi->isReadable() ) {
450 pm = Resource::loadPixmap( "locked" ); 452 pm = Resource::loadPixmap( "locked" );
451// item->setPixmap( 0,pm); 453// item->setPixmap( 0,pm);
452 } else { 454 } else {
453 MimeType mt(fi->filePath()); 455 MimeType mt(fi->filePath());
454 pm=mt.pixmap(); //sets the correct pixmap for mimetype 456 pm=mt.pixmap(); //sets the correct pixmap for mimetype
455 if(pm.isNull()) 457 if(pm.isNull())
456 pm = Resource::loadPixmap( "UnknownDocument-14" ); 458 pm = Resource::loadPixmap( "UnknownDocument-14" );
457// item->setPixmap( 0,pm); 459// item->setPixmap( 0,pm);
458 } 460 }
459 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 461 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
460 // overlay link image 462 // overlay link image
461 pm= Resource::loadPixmap( "folder" ); 463 pm= Resource::loadPixmap( "folder" );
462 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 464 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
463 QPainter painter( &pm ); 465 QPainter painter( &pm );
464 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 466 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
465 pm.setMask( pm.createHeuristicMask( FALSE ) ); 467 pm.setMask( pm.createHeuristicMask( FALSE ) );
466// item->setPixmap( 0, pm); 468// item->setPixmap( 0, pm);
467 } 469 }
468 item->setPixmap( 0, pm); 470 item->setPixmap( 0, pm);
469 } 471 }
470 isDir=FALSE; 472 isDir=FALSE;
471 ++it; 473 ++it;
472 } 474 }
473 475
474 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 476 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
475 struct stat buf; 477 struct stat buf;
476// struct stat st; 478// struct stat st;
477// mode_t mode; 479// mode_t mode;
478 DIR *dir; 480 DIR *dir;
479// int fd = 0; 481// int fd = 0;
480 struct dirent *mydirent; 482 struct dirent *mydirent;
481// int i = 1; 483// int i = 1;
482 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 484 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
483 while ((mydirent = readdir(dir)) != NULL) { 485 while ((mydirent = readdir(dir)) != NULL) {
484 lstat( mydirent->d_name, &buf); 486 lstat( mydirent->d_name, &buf);
485 qDebug(mydirent->d_name); 487 qDebug(mydirent->d_name);
486// mode = buf.st_mode; 488// mode = buf.st_mode;
487 fileL.sprintf("%s", mydirent->d_name); 489 fileL.sprintf("%s", mydirent->d_name);
488// fileS.sprintf("%d, %d", ); //this isn't correct 490// fileS.sprintf("%d, %d", ); //this isn't correct
489 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 491 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
490 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 492 fileDate.sprintf("%s", ctime( &buf.st_mtime));
491 if( fileL.find(".") == -1 ){ 493 if( fileL.find(".") == -1 ){
492 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 494 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
493 pm = Resource::loadPixmap( "UnknownDocument-14" ); 495 pm = Resource::loadPixmap( "UnknownDocument-14" );
494 item->setPixmap( 0,pm); 496 item->setPixmap( 0,pm);
495 } 497 }
496 } 498 }
497 499
498 closedir(dir); 500 closedir(dir);
499 } 501 }
500 502
501 Remote_View->setSorting( 3,FALSE); 503 Remote_View->setSorting( 3,FALSE);
502 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 504 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
503} 505}
504 506
505void AdvancedFm::localListClicked(QListViewItem *selectedItem) 507void AdvancedFm::localListClicked(QListViewItem *selectedItem)
506{ 508{
507 if(selectedItem) { 509 if(selectedItem) {
508 QString strItem=selectedItem->text(0); 510 QString strItem=selectedItem->text(0);
509 QString strSize=selectedItem->text(1); 511 QString strSize=selectedItem->text(1);
510 strSize=strSize.stripWhiteSpace(); 512 strSize=strSize.stripWhiteSpace();
511 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 513 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
512 // is symlink 514 // is symlink
513 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 515 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
514 if(QDir(strItem2).exists() ) { 516 if(QDir(strItem2).exists() ) {
515 currentDir.cd(strItem2, TRUE); 517 currentDir.cd(strItem2, TRUE);
516 populateLocalView(); 518 populateLocalView();
517 } 519 }
518 } else { // not a symlink 520 } else { // not a symlink
519 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 521 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
520 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 522 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
521 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 523 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
522 currentDir.cd(strItem,FALSE); 524 currentDir.cd(strItem,FALSE);
523 populateLocalView(); 525 populateLocalView();
524 } else { 526 } else {
525 currentDir.cdUp(); 527 currentDir.cdUp();
526 populateLocalView(); 528 populateLocalView();
527 } 529 }
528 if(QDir(strItem).exists()){ 530 if(QDir(strItem).exists()){
529 currentDir.cd(strItem, TRUE); 531 currentDir.cd(strItem, TRUE);
530 populateLocalView(); 532 populateLocalView();
531 } 533 }
532 } else { 534 } else {
533 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 535 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
534 if( QFile::exists(strItem ) ) { 536 if( QFile::exists(strItem ) ) {
535// qDebug("upload "+strItem); 537// qDebug("upload "+strItem);
536 } 538 }
537 } //end not symlink 539 } //end not symlink
538 chdir(strItem.latin1()); 540 chdir(strItem.latin1());
539 } 541 }
540 } 542 }
541} 543}
542 544
543void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 545void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
544{ 546{
545 if(selectedItem) { 547 if(selectedItem) {
546 QString strItem=selectedItem->text(0); 548 QString strItem=selectedItem->text(0);
547 QString strSize=selectedItem->text(1); 549 QString strSize=selectedItem->text(1);
548 strSize=strSize.stripWhiteSpace(); 550 strSize=strSize.stripWhiteSpace();
549 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 551 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
550 // is symlink 552 // is symlink
551 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 553 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
552 if(QDir(strItem2).exists() ) { 554 if(QDir(strItem2).exists() ) {
553 currentRemoteDir.cd(strItem2, TRUE); 555 currentRemoteDir.cd(strItem2, TRUE);
554 populateRemoteView(); 556 populateRemoteView();
555 } 557 }
556 } else { // not a symlink 558 } else { // not a symlink
557 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 559 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
558 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 560 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
559 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 561 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
560 currentRemoteDir.cd(strItem,FALSE); 562 currentRemoteDir.cd(strItem,FALSE);
561 populateRemoteView(); 563 populateRemoteView();
562 } else { 564 } else {
563 currentRemoteDir.cdUp(); 565 currentRemoteDir.cdUp();
564 populateRemoteView(); 566 populateRemoteView();
565 } 567 }
566 if(QDir(strItem).exists()){ 568 if(QDir(strItem).exists()){
567 currentRemoteDir.cd(strItem, TRUE); 569 currentRemoteDir.cd(strItem, TRUE);
568 populateRemoteView(); 570 populateRemoteView();
569 } 571 }
570 } else { 572 } else {
571 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 573 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
572 if( QFile::exists(strItem ) ) { 574 if( QFile::exists(strItem ) ) {
573// qDebug("upload "+strItem); 575// qDebug("upload "+strItem);
574 } 576 }
575 } //end not symlink 577 } //end not symlink
576 chdir(strItem.latin1()); 578 chdir(strItem.latin1());
577 } 579 }
578 } 580 }
579} 581}
580 582
581void AdvancedFm::doLocalCd() 583void AdvancedFm::doLocalCd()
582{ 584{
583 localListClicked( Local_View->currentItem()); 585 localListClicked( Local_View->currentItem());
584} 586}
585 587
586void AdvancedFm::doRemoteCd() 588void AdvancedFm::doRemoteCd()
587{ 589{
588 localListClicked( Remote_View->currentItem()); 590 localListClicked( Remote_View->currentItem());
589} 591}
590 592
591void AdvancedFm::showHidden() 593void AdvancedFm::showHidden()
592{ 594{
593 if (b) { 595 if (b) {
594 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 596 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
595 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 597 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
596// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 598// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
597// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 599// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
598 b=FALSE; 600 b=FALSE;
599 601
600 } else { 602 } else {
601 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 603 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
602 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 604 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
603// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 605// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
604// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 606// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
605 b=TRUE; 607 b=TRUE;
606 } 608 }
607 populateLocalView(); 609 populateLocalView();
608 610
609} 611}
610 612
611void AdvancedFm::showRemoteHidden() 613void AdvancedFm::showRemoteHidden()
612{ 614{
613 if (b) { 615 if (b) {
614 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 616 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
615// viewMenu->setItemChecked(localMenu->idAt(0),TRUE); 617// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
616// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 618// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
617 b=TRUE; 619 b=TRUE;
618 620
619 } else { 621 } else {
620 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 622 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
621// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 623// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
622// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 624// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
623 b=FALSE; 625 b=FALSE;
624 } 626 }
625 populateRemoteView(); 627 populateRemoteView();
626} 628}
627 629
628void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 630void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
629{ 631{
630 switch (mouse) { 632 switch (mouse) {
631 case 1: 633 case 1:
632 break; 634 break;
633 case 2: 635 case 2:
634 showLocalMenu(item); 636 showLocalMenu(item);
635 Local_View->clearSelection(); 637 Local_View->clearSelection();
636 break; 638 break;
637 }; 639 };
638} 640}
639 641
640void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 642void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
641{ 643{
642 switch (mouse) { 644 switch (mouse) {
643 case 1: 645 case 1:
644 break; 646 break;
645 case 2: 647 case 2:
646 showRemoteMenu(item); 648 showRemoteMenu(item);
647 Remote_View->clearSelection(); 649 Remote_View->clearSelection();
648 break; 650 break;
649 }; 651 };
650} 652}
651 653
652void AdvancedFm::showLocalMenu(QListViewItem * item) 654void AdvancedFm::showLocalMenu(QListViewItem * item)
653{ 655{
654 if(item) { 656 if(item) {
655 QPopupMenu m; 657 QPopupMenu m;
656 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 658 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
657 m.insertSeparator(); 659 m.insertSeparator();
658 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 660 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
659 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 661 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
660 else 662 else
661 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 663 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
662 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 664 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
663 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 665 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
664 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 666 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
665 m.insertSeparator(); 667 m.insertSeparator();
666 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 668 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
667 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 669 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
668 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 670 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
669 m.insertItem( tr( "Move" ), this, SLOT( move() )); 671 m.insertItem( tr( "Move" ), this, SLOT( move() ));
670 m.insertSeparator(); 672 m.insertSeparator();
671 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 673 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
672 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 674 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
673 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 675 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
674 m.insertSeparator(); 676 m.insertSeparator();
675 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 677 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
676 m.insertSeparator(); 678 m.insertSeparator();
677 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 679 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
678 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 680 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
679 m.setCheckable(TRUE); 681 m.setCheckable(TRUE);
680 if (!b) 682 if (!b)
681 m.setItemChecked(m.idAt(0),TRUE); 683 m.setItemChecked(m.idAt(0),TRUE);
682 else 684 else
683 m.setItemChecked(m.idAt(0),FALSE); 685 m.setItemChecked(m.idAt(0),FALSE);
684 m.exec( QCursor::pos() ); 686 m.exec( QCursor::pos() );
685 } 687 }
686} 688}
687 689
688void AdvancedFm::showRemoteMenu(QListViewItem * item) 690void AdvancedFm::showRemoteMenu(QListViewItem * item)
689{ 691{
690 if(item) { 692 if(item) {
691 QPopupMenu m; 693 QPopupMenu m;
692 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 694 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
693 m.insertSeparator(); 695 m.insertSeparator();
694 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 696 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
695 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 697 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
696 else 698 else
697 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 699 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
698 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 700 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
699 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 701 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
700 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 702 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
701 m.insertSeparator(); 703 m.insertSeparator();
702 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 704 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
703 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 705 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
704 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 706 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
705 m.insertItem( tr( "Move" ), this, SLOT( move() )); 707 m.insertItem( tr( "Move" ), this, SLOT( move() ));
706 m.insertSeparator(); 708 m.insertSeparator();
707 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 709 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
708 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 710 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
709 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 711 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
710 m.insertSeparator(); 712 m.insertSeparator();
711 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 713 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
712 m.insertSeparator(); 714 m.insertSeparator();
713 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 715 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
714 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 716 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
715 m.setCheckable(TRUE); 717 m.setCheckable(TRUE);
716 if (!b) 718 if (!b)
717 m.setItemChecked(m.idAt(0),TRUE); 719 m.setItemChecked(m.idAt(0),TRUE);
718 else 720 else
719 m.setItemChecked(m.idAt(0),FALSE); 721 m.setItemChecked(m.idAt(0),FALSE);
720 m.exec( QCursor::pos() ); 722 m.exec( QCursor::pos() );
721 } 723 }
722} 724}
723 725
724void AdvancedFm::runThis() { 726void AdvancedFm::runThis() {
725// QFileInfo *fi; 727// QFileInfo *fi;
726QString fs; 728QString fs;
727 if (TabWidget->currentPageIndex() == 0) { 729 if (TabWidget->currentPageIndex() == 0) {
728 QString curFile = Local_View->currentItem()->text(0); 730 QString curFile = Local_View->currentItem()->text(0);
729 731
730 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 732 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
731 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 733 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
732 qDebug( fileInfo.owner()); 734 qDebug( fileInfo.owner());
733 if( (fileInfo.permission( QFileInfo::ExeUser) 735 if( (fileInfo.permission( QFileInfo::ExeUser)
734 | fileInfo.permission( QFileInfo::ExeGroup) 736 | fileInfo.permission( QFileInfo::ExeGroup)
735 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 737 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
736 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 738 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
737// if( fileInfo.isExecutable() | 739// if( fileInfo.isExecutable() |
738 QCopEnvelope e("QPE/System", "execute(QString)" ); 740 QCopEnvelope e("QPE/System", "execute(QString)" );
739 e << curFile; 741 e << curFile;
740 } else { 742 } else {
741 curFile = currentDir.canonicalPath()+"/"+curFile; 743 curFile = currentDir.canonicalPath()+"/"+curFile;
742 DocLnk nf(curFile); 744 DocLnk nf(curFile);
743 QString execStr = nf.exec(); 745 QString execStr = nf.exec();
744 qDebug( execStr); 746 qDebug( execStr);
745 if( execStr.isEmpty() ) { 747 if( execStr.isEmpty() ) {
746 } else { 748 } else {
747 nf.execute(); 749 nf.execute();
748 } 750 }
749 } 751 }
750// MimeType mt( curFile); 752// MimeType mt( curFile);
751 } else { 753 } else {
752 QString curFile = Remote_View->currentItem()->text(0); 754 QString curFile = Remote_View->currentItem()->text(0);
753 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 755 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
754 qDebug("Filesystemtype is "+fs); 756 qDebug("Filesystemtype is "+fs);
755 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 757 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
756 if( (fileInfo.permission( QFileInfo::ExeUser) 758 if( (fileInfo.permission( QFileInfo::ExeUser)
757 | fileInfo.permission( QFileInfo::ExeGroup) 759 | fileInfo.permission( QFileInfo::ExeGroup)
758 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 760 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
759 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 761 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
760 QCopEnvelope e("QPE/System", "execute(QString)" ); 762 QCopEnvelope e("QPE/System", "execute(QString)" );
761 e << curFile; 763 e << curFile;
762 } else { 764 } else {
763 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 765 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
764 DocLnk nf(curFile); 766 DocLnk nf(curFile);
765 QString execStr = nf.exec(); 767 QString execStr = nf.exec();
766 qDebug(execStr); 768 qDebug(execStr);
767 if( execStr.isEmpty() ) { 769 if( execStr.isEmpty() ) {
768 } else { 770 } else {
769 nf.execute(); 771 nf.execute();
770 } 772 }
771 } 773 }
772// MimeType mt( curFile); 774// MimeType mt( curFile);
773 } 775 }
774} 776}
775 777
776void AdvancedFm::runText() { 778void AdvancedFm::runText() {
777 if (TabWidget->currentPageIndex() == 0) { 779 if (TabWidget->currentPageIndex() == 0) {
778 QString curFile = Local_View->currentItem()->text(0); 780 QString curFile = Local_View->currentItem()->text(0);
779 curFile = currentDir.canonicalPath()+"/"+curFile; 781 curFile = currentDir.canonicalPath()+"/"+curFile;
780 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 782 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
781 e << curFile; 783 e << curFile;
782 } else { 784 } else {
783 QString curFile = Remote_View->currentItem()->text(0); 785 QString curFile = Remote_View->currentItem()->text(0);
784 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 786 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
785 DocLnk nf(curFile); 787 DocLnk nf(curFile);
786 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 788 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
787 e << curFile; 789 e << curFile;
788 } 790 }
789} 791}
790 792
791void AdvancedFm::localMakDir() 793void AdvancedFm::localMakDir()
792{ 794{
793 InputDialog *fileDlg; 795 InputDialog *fileDlg;
794 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 796 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
795 fileDlg->exec(); 797 fileDlg->exec();
796 if( fileDlg->result() == 1 ) { 798 if( fileDlg->result() == 1 ) {
797 QString filename = fileDlg->LineEdit1->text(); 799 QString filename = fileDlg->LineEdit1->text();
798 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 800 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
799 } 801 }
800 populateLocalView(); 802 populateLocalView();
801} 803}
802 804
803void AdvancedFm::remoteMakDir() 805void AdvancedFm::remoteMakDir()
804{ 806{
805 InputDialog *fileDlg; 807 InputDialog *fileDlg;
806 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 808 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
807 fileDlg->exec(); 809 fileDlg->exec();
808 if( fileDlg->result() == 1 ) { 810 if( fileDlg->result() == 1 ) {
809 QString filename = fileDlg->LineEdit1->text(); 811 QString filename = fileDlg->LineEdit1->text();
810 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 812 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
811 } 813 }
812 populateRemoteView(); 814 populateRemoteView();
813} 815}
814 816
815void AdvancedFm::localDelete() 817void AdvancedFm::localDelete()
816{ 818{
817 QStringList curFileList = getPath(); 819 QStringList curFileList = getPath();
818 QString myFile; 820 QString myFile;
819 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 821 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
820 myFile = (*it); 822 myFile = (*it);
821 if( myFile.find(" -> ",0,TRUE) != -1) 823 if( myFile.find(" -> ",0,TRUE) != -1)
822 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 824 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
823 825
824 QString f = currentDir.canonicalPath(); 826 QString f = currentDir.canonicalPath();
825 if(f.right(1).find("/",0,TRUE) == -1) 827 if(f.right(1).find("/",0,TRUE) == -1)
826 f+="/"; 828 f+="/";
827 f+=myFile; 829 f+=myFile;
828 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 830 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
829 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 831 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
830 "\nand all it's contents ?" 832 "\nand all it's contents ?"
831 ,tr("Yes"),tr("No"),0,0,1) ) { 833 ,tr("Yes"),tr("No"),0,0,1) ) {
832 case 0: { 834 case 0: {
833 f=f.left(f.length()-1); 835 f=f.left(f.length()-1);
834 QString cmd="rm -rf "+f; 836 QString cmd="rm -rf "+f;
835 system( cmd.latin1()); 837 system( cmd.latin1());
836 populateLocalView(); 838 populateLocalView();
837 } 839 }
838 break; 840 break;
839 case 1: 841 case 1:
840 // exit 842 // exit
841 break; 843 break;
842 }; 844 };
843 845
844 } else { 846 } else {
845 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 847 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
846 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 848 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
847 case 0: { 849 case 0: {
848 QString cmd="rm "+f; 850 QString cmd="rm "+f;
849 QFile file(f); 851 QFile file(f);
850 file.remove(); 852 file.remove();
851// system( cmd.latin1()); 853// system( cmd.latin1());
852 populateLocalView(); 854 populateLocalView();
853 } 855 }
854 break; 856 break;
855 case 1: 857 case 1:
856 // exit 858 // exit
857 break; 859 break;
858 }; 860 };
859 } 861 }
860 } 862 }
861} 863}
862 864
863void AdvancedFm::remoteDelete() 865void AdvancedFm::remoteDelete()
864{ 866{
865 QStringList curFileList = getPath(); 867 QStringList curFileList = getPath();
866 QString myFile; 868 QString myFile;
867 869
868 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 870 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
869 myFile = (*it); 871 myFile = (*it);
870 if(myFile.find(" -> ",0,TRUE) != -1) 872 if(myFile.find(" -> ",0,TRUE) != -1)
871 myFile = myFile.left(myFile.find(" -> ",0,TRUE)); 873 myFile = myFile.left(myFile.find(" -> ",0,TRUE));
872 QString f = currentRemoteDir.canonicalPath(); 874 QString f = currentRemoteDir.canonicalPath();
873 if(f.right(1).find("/",0,TRUE) == -1) 875 if(f.right(1).find("/",0,TRUE) == -1)
874 f+="/"; 876 f+="/";
875 f+=myFile; 877 f+=myFile;
876 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 878 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
877 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 879 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
878 "\nand all it's contents ?", 880 "\nand all it's contents ?",
879 tr("Yes"),tr("No"),0,0,1) ) { 881 tr("Yes"),tr("No"),0,0,1) ) {
880 case 0: { 882 case 0: {
881 f=f.left(f.length()-1); 883 f=f.left(f.length()-1);
882 QString cmd="rm -rf "+f; 884 QString cmd="rm -rf "+f;
883 system( cmd.latin1()); 885 system( cmd.latin1());
884 populateRemoteView(); 886 populateRemoteView();
885 } 887 }
886 break; 888 break;
887 case 1: 889 case 1:
888 // exit 890 // exit
889 break; 891 break;
890 }; 892 };
891 893
892 } else { 894 } else {
893 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 895 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
894 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 896 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
895 case 0: { 897 case 0: {
896 QString cmd="rm "+f; 898 QString cmd="rm "+f;
897 QFile file(f); 899 QFile file(f);
898 file.remove(); 900 file.remove();
899// system( cmd.latin1()); 901// system( cmd.latin1());
900 populateRemoteView(); 902 populateRemoteView();
901 } 903 }
902 break; 904 break;
903 case 1: 905 case 1:
904 // exit 906 // exit
905 break; 907 break;
906 }; 908 };
907 } 909 }
908 } 910 }
909} 911}
910 912
911void AdvancedFm::localRename() 913void AdvancedFm::localRename()
912{ 914{
913 QString curFile = Local_View->currentItem()->text(0); 915 QString curFile = Local_View->currentItem()->text(0);
914 InputDialog *fileDlg; 916 InputDialog *fileDlg;
915 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 917 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
916 fileDlg->setInputText((const QString &)curFile); 918 fileDlg->setInputText((const QString &)curFile);
917 fileDlg->exec(); 919 fileDlg->exec();
918 if( fileDlg->result() == 1 ) { 920 if( fileDlg->result() == 1 ) {
919 QString oldname = currentDir.canonicalPath() + "/" + curFile; 921 QString oldname = currentDir.canonicalPath() + "/" + curFile;
920 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 922 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
921 if( rename(oldname.latin1(), newName.latin1())== -1) 923 if( rename(oldname.latin1(), newName.latin1())== -1)
922 QMessageBox::message(tr("Note"),tr("Could not rename")); 924 QMessageBox::message(tr("Note"),tr("Could not rename"));
923 } 925 }
924 populateLocalView(); 926 populateLocalView();
925} 927}
926 928
927void AdvancedFm::remoteRename() 929void AdvancedFm::remoteRename()
928{ 930{
929 QString curFile = Local_View->currentItem()->text(0); 931 QString curFile = Local_View->currentItem()->text(0);
930 InputDialog *fileDlg; 932 InputDialog *fileDlg;
931 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 933 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
932 fileDlg->setInputText((const QString &)curFile); 934 fileDlg->setInputText((const QString &)curFile);
933 fileDlg->exec(); 935 fileDlg->exec();
934 if( fileDlg->result() == 1 ) { 936 if( fileDlg->result() == 1 ) {
935 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 937 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
936 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 938 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
937 if( rename(oldname.latin1(), newName.latin1())== -1) 939 if( rename(oldname.latin1(), newName.latin1())== -1)
938 QMessageBox::message(tr("Note"),tr("Could not rename")); 940 QMessageBox::message(tr("Note"),tr("Could not rename"));
939 } 941 }
940 populateRemoteView(); 942 populateRemoteView();
941} 943}
942 944
943void AdvancedFm::switchToLocalTab() 945void AdvancedFm::switchToLocalTab()
944{ 946{
945 TabWidget->setCurrentPage(0); 947 TabWidget->setCurrentPage(0);
946 Local_View->setFocus(); 948 Local_View->setFocus();
947} 949}
948 950
949void AdvancedFm::switchToRemoteTab() 951void AdvancedFm::switchToRemoteTab()
950{ 952{
951 TabWidget->setCurrentPage(1); 953 TabWidget->setCurrentPage(1);
952 Remote_View->setFocus(); 954 Remote_View->setFocus();
953} 955}
954 956
955void AdvancedFm::readConfig() 957void AdvancedFm::readConfig()
956{ 958{
957 Config cfg("AdvancedFm"); 959 Config cfg("AdvancedFm");
958} 960}
959 961
960void AdvancedFm::writeConfig() 962void AdvancedFm::writeConfig()
961{ 963{
962 Config cfg("AdvancedFm"); 964 Config cfg("AdvancedFm");
963} 965}
964 966
965void AdvancedFm::currentPathComboChanged() 967void AdvancedFm::currentPathComboChanged()
966{ 968{
967 if (TabWidget->currentPageIndex() == 0) { 969 if (TabWidget->currentPageIndex() == 0) {
968 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 970 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
969 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 971 currentDir.setPath( currentPathCombo->lineEdit()->text() );
970 populateLocalView(); 972 populateLocalView();
971 } else { 973 } else {
972 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 974 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
973 } 975 }
974 } 976 }
975 if (TabWidget->currentPageIndex() == 0) { 977 if (TabWidget->currentPageIndex() == 0) {
976 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 978 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
977 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 979 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
978 populateRemoteView(); 980 populateRemoteView();
979 } else { 981 } else {
980 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 982 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
981 } 983 }
982 } 984 }
983} 985}
984 986
985void AdvancedFm::fillCombo(const QString &currentPath) { 987void AdvancedFm::fillCombo(const QString &currentPath) {
986 988
987 if (TabWidget->currentPageIndex() == 0) { 989 if (TabWidget->currentPageIndex() == 0) {
988 currentPathCombo->lineEdit()->setText( currentPath); 990 currentPathCombo->lineEdit()->setText( currentPath);
989 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 991 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
990 currentPathCombo->clear(); 992 currentPathCombo->clear();
991 localDirPathStringList.prepend( currentPath ); 993 localDirPathStringList.prepend( currentPath );
992 currentPathCombo->insertStringList( localDirPathStringList,-1); 994 currentPathCombo->insertStringList( localDirPathStringList,-1);
993 } 995 }
994 } else { 996 } else {
995 currentPathCombo->lineEdit()->setText( currentPath); 997 currentPathCombo->lineEdit()->setText( currentPath);
996 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 998 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
997 currentPathCombo->clear(); 999 currentPathCombo->clear();
998 remoteDirPathStringList.prepend( currentPath ); 1000 remoteDirPathStringList.prepend( currentPath );
999 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1001 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1000 } 1002 }
1001 } 1003 }
1002} 1004}
1003 1005
1004void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 1006void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
1005 if (TabWidget->currentPageIndex() == 0) { 1007 if (TabWidget->currentPageIndex() == 0) {
1006 chdir( currentPath.latin1() ); 1008 chdir( currentPath.latin1() );
1007 currentDir.cd( currentPath, TRUE); 1009 currentDir.cd( currentPath, TRUE);
1008 populateLocalView(); 1010 populateLocalView();
1009 update(); 1011 update();
1010 } else { 1012 } else {
1011 chdir( currentPath.latin1() ); 1013 chdir( currentPath.latin1() );
1012 currentRemoteDir.cd( currentPath, TRUE); 1014 currentRemoteDir.cd( currentPath, TRUE);
1013 populateRemoteView(); 1015 populateRemoteView();
1014 update(); 1016 update();
1015 } 1017 }
1016} 1018}
1017 1019
1018void AdvancedFm::filePerms() { 1020void AdvancedFm::filePerms() {
1019 1021
1020 QStringList curFileList = getPath(); 1022 QStringList curFileList = getPath();
1021 QString filePath; 1023 QString filePath;
1022 1024
1023 if (TabWidget->currentPageIndex() == 0) { 1025 if (TabWidget->currentPageIndex() == 0) {
1024 filePath = currentDir.canonicalPath()+"/"; 1026 filePath = currentDir.canonicalPath()+"/";
1025 } else { 1027 } else {
1026 filePath= currentRemoteDir.canonicalPath()+"/"; 1028 filePath= currentRemoteDir.canonicalPath()+"/";
1027 } 1029 }
1028 1030
1029 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1031 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1030 filePermissions *filePerm; 1032 filePermissions *filePerm;
1031 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 1033 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
1032 filePerm->showMaximized(); 1034 filePerm->showMaximized();
1033 filePerm->exec(); 1035 filePerm->exec();
1034 if( filePerm) 1036 if( filePerm)
1035 delete filePerm; 1037 delete filePerm;
1036 } 1038 }
1037} 1039}
1038 1040
1039void AdvancedFm::doProperties() { 1041void AdvancedFm::doProperties() {
1040 QStringList curFileList = getPath(); 1042 QStringList curFileList = getPath();
1041 QString filePath; 1043 QString filePath;
1042 if (TabWidget->currentPageIndex() == 0) { 1044 if (TabWidget->currentPageIndex() == 0) {
1043 filePath = currentDir.canonicalPath()+"/"; 1045 filePath = currentDir.canonicalPath()+"/";
1044 } else { 1046 } else {
1045 filePath= currentRemoteDir.canonicalPath()+"/"; 1047 filePath= currentRemoteDir.canonicalPath()+"/";
1046 } 1048 }
1047 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1049 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1048 DocLnk lnk( (filePath+*it)); 1050 DocLnk lnk( (filePath+*it));
1049 LnkProperties prop( &lnk ); 1051 LnkProperties prop( &lnk );
1050// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 1052// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
1051 prop.showMaximized(); 1053 prop.showMaximized();
1052 prop.exec(); 1054 prop.exec();
1053 } 1055 }
1054} 1056}
1055 1057
1056QStringList AdvancedFm::getPath() { 1058QStringList AdvancedFm::getPath() {
1057 QStringList strList; 1059 QStringList strList;
1058 if (TabWidget->currentPageIndex() == 0) { 1060 if (TabWidget->currentPageIndex() == 0) {
1059 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1061 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1060 QListViewItemIterator it( Local_View ); 1062 QListViewItemIterator it( Local_View );
1061 for ( ; it.current(); ++it ) { 1063 for ( ; it.current(); ++it ) {
1062 if ( it.current()->isSelected() ) { 1064 if ( it.current()->isSelected() ) {
1063 strList << it.current()->text(0); 1065 strList << it.current()->text(0);
1064 } 1066 }
1065 } 1067 }
1066 return strList; 1068 return strList;
1067 } else { 1069 } else {
1068 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 1070 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
1069 QListViewItemIterator it( Remote_View ); 1071 QListViewItemIterator it( Remote_View );
1070 for ( ; it.current(); ++it ) { 1072 for ( ; it.current(); ++it ) {
1071 if ( it.current()->isSelected() ) { 1073 if ( it.current()->isSelected() ) {
1072 strList << it.current()->text(0); 1074 strList << it.current()->text(0);
1073 } 1075 }
1074 } 1076 }
1075 return strList; 1077 return strList;
1076 } 1078 }
1077 return ""; 1079 return "";
1078} 1080}
1079 1081
1080void AdvancedFm::homeButtonPushed() { 1082void AdvancedFm::homeButtonPushed() {
1081 QString current = QDir::homeDirPath(); 1083 QString current = QDir::homeDirPath();
1082 chdir( current.latin1() ); 1084 chdir( current.latin1() );
1083 if (TabWidget->currentPageIndex() == 0) { 1085 if (TabWidget->currentPageIndex() == 0) {
1084 currentDir.cd( current, TRUE); 1086 currentDir.cd( current, TRUE);
1085 populateLocalView(); 1087 populateLocalView();
1086 } else { 1088 } else {
1087 currentRemoteDir.cd( current, TRUE); 1089 currentRemoteDir.cd( current, TRUE);
1088 populateRemoteView(); 1090 populateRemoteView();
1089 } 1091 }
1090 update(); 1092 update();
1091} 1093}
1092 1094
1093void AdvancedFm::docButtonPushed() { 1095void AdvancedFm::docButtonPushed() {
1094 QString current = QPEApplication::documentDir(); 1096 QString current = QPEApplication::documentDir();
1095 chdir( current.latin1() ); 1097 chdir( current.latin1() );
1096 if (TabWidget->currentPageIndex() == 0) { 1098 if (TabWidget->currentPageIndex() == 0) {
1097 currentDir.cd( current, TRUE); 1099 currentDir.cd( current, TRUE);
1098 populateLocalView(); 1100 populateLocalView();
1099 } else { 1101 } else {
1100 currentRemoteDir.cd( current, TRUE); 1102 currentRemoteDir.cd( current, TRUE);
1101 populateRemoteView(); 1103 populateRemoteView();
1102 } 1104 }
1103 update(); 1105 update();
1104} 1106}
1105 1107
1106void AdvancedFm::SDButtonPushed() { 1108void AdvancedFm::SDButtonPushed() {
1107 QString current = "/mnt/card"; 1109 QString current = "/mnt/card";
1108 chdir( current.latin1() ); 1110 chdir( current.latin1() );
1109 if (TabWidget->currentPageIndex() == 0) { 1111 if (TabWidget->currentPageIndex() == 0) {
1110 currentDir.cd( current, TRUE); 1112 currentDir.cd( current, TRUE);
1111 populateLocalView(); 1113 populateLocalView();
1112 } else { 1114 } else {
1113 currentRemoteDir.cd( current, TRUE); 1115 currentRemoteDir.cd( current, TRUE);
1114 populateRemoteView(); 1116 populateRemoteView();
1115 } 1117 }
1116 update(); 1118 update();
1117 1119
1118} 1120}
1119 1121
1120void AdvancedFm::CFButtonPushed() { 1122void AdvancedFm::CFButtonPushed() {
1121 QString current = "/mnt/cf"; 1123 QString current = "/mnt/cf";
1122 chdir( current.latin1() ); 1124 chdir( current.latin1() );
1123 if (TabWidget->currentPageIndex() == 0) { 1125 if (TabWidget->currentPageIndex() == 0) {
1124 currentDir.cd( current, TRUE); 1126 currentDir.cd( current, TRUE);
1125 populateLocalView(); 1127 populateLocalView();
1126 } else { 1128 } else {
1127 currentRemoteDir.cd( current, TRUE); 1129 currentRemoteDir.cd( current, TRUE);
1128 populateRemoteView(); 1130 populateRemoteView();
1129 } 1131 }
1130 update(); 1132 update();
1131 1133
1132} 1134}
1133 1135
1134 1136
1135void AdvancedFm::upDir() 1137void AdvancedFm::upDir()
1136{ 1138{
1137 if (TabWidget->currentPageIndex() == 0) { 1139 if (TabWidget->currentPageIndex() == 0) {
1138 QString current = currentDir.canonicalPath(); 1140 QString current = currentDir.canonicalPath();
1139 QDir dir(current); 1141 QDir dir(current);
1140 dir.cdUp(); 1142 dir.cdUp();
1141 current = dir.canonicalPath(); 1143 current = dir.canonicalPath();
1142 chdir( current.latin1() ); 1144 chdir( current.latin1() );
1143 currentDir.cd( current, TRUE); 1145 currentDir.cd( current, TRUE);
1144 populateLocalView(); 1146 populateLocalView();
1145 update(); 1147 update();
1146 } else { 1148 } else {
1147 QString current = currentRemoteDir.canonicalPath(); 1149 QString current = currentRemoteDir.canonicalPath();
1148 QDir dir(current); 1150 QDir dir(current);
1149 dir.cdUp(); 1151 dir.cdUp();
1150 current = dir.canonicalPath(); 1152 current = dir.canonicalPath();
1151 chdir( current.latin1() ); 1153 chdir( current.latin1() );
1152 currentRemoteDir.cd( current, TRUE); 1154 currentRemoteDir.cd( current, TRUE);
1153 populateRemoteView(); 1155 populateRemoteView();
1154 update(); 1156 update();
1155 } 1157 }
1156} 1158}
1157 1159
1158void AdvancedFm::copy() 1160void AdvancedFm::copy()
1159{ 1161{
1160 QStringList curFileList = getPath(); 1162 QStringList curFileList = getPath();
1161 QString curFile; 1163 QString curFile;
1162 if (TabWidget->currentPageIndex() == 0) { 1164 if (TabWidget->currentPageIndex() == 0) {
1163 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1165 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1164 1166
1165 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1167 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1166// if(destFile.right(1).find("/",0,TRUE) == -1) 1168// if(destFile.right(1).find("/",0,TRUE) == -1)
1167// destFile+="/"; 1169// destFile+="/";
1168// destFile +=(*it); 1170// destFile +=(*it);
1169 1171
1170 curFile = currentDir.canonicalPath()+"/"+(*it); 1172 curFile = currentDir.canonicalPath()+"/"+(*it);
1171// if(curFile.right(1).find("/",0,TRUE) == -1) 1173// if(curFile.right(1).find("/",0,TRUE) == -1)
1172// curFile +="/"; 1174// curFile +="/";
1173// curFile +=(*it); 1175// curFile +=(*it);
1174 1176
1175 QFile f(destFile); 1177 QFile f(destFile);
1176 if( f.exists()) 1178 if( f.exists())
1177 f.remove(); 1179 f.remove();
1178 if(!copyFile(destFile, curFile) ) { 1180 if(!copyFile(destFile, curFile) ) {
1179 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1181 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1180 qWarning("nothin doing"); 1182 qWarning("nothin doing");
1181 } 1183 }
1182 } 1184 }
1183 populateRemoteView(); 1185 populateRemoteView();
1184 TabWidget->setCurrentPage(1); 1186 TabWidget->setCurrentPage(1);
1185 1187
1186 } else { 1188 } else {
1187 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1189 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1188 1190
1189 QString destFile = currentDir.canonicalPath()+"/"+(*it); 1191 QString destFile = currentDir.canonicalPath()+"/"+(*it);
1190 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1192 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1191 1193
1192 QFile f(destFile); 1194 QFile f(destFile);
1193 if( f.exists()) 1195 if( f.exists())
1194 f.remove(); 1196 f.remove();
1195 if(!copyFile(destFile, curFile) ) { 1197 if(!copyFile(destFile, curFile) ) {
1196 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1198 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1197 1199
1198 qWarning("nothin doing"); 1200 qWarning("nothin doing");
1199 } 1201 }
1200 } 1202 }
1201 populateLocalView(); 1203 populateLocalView();
1202 TabWidget->setCurrentPage(0); 1204 TabWidget->setCurrentPage(0);
1203 } 1205 }
1204} 1206}
1205 1207
1206void AdvancedFm::copyAs() 1208void AdvancedFm::copyAs()
1207{ 1209{
1208 QStringList curFileList = getPath(); 1210 QStringList curFileList = getPath();
1209 QString curFile; 1211 QString curFile;
1210 InputDialog *fileDlg; 1212 InputDialog *fileDlg;
1211 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1213 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1212 1214
1213 if (TabWidget->currentPageIndex() == 0) { 1215 if (TabWidget->currentPageIndex() == 0) {