summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-01 23:22:28 (UTC)
committer llornkcor <llornkcor>2002-05-01 23:22:28 (UTC)
commit21ddb4ef8f53ac003836535708736b91fd2c9f57 (patch) (unidiff)
tree116dd5b31b95b457c7331000be5d5f2a9624a8ee
parenta3397118d3c384655bedb40210db96ca34adc0c9 (diff)
downloadopie-21ddb4ef8f53ac003836535708736b91fd2c9f57.zip
opie-21ddb4ef8f53ac003836535708736b91fd2c9f57.tar.gz
opie-21ddb4ef8f53ac003836535708736b91fd2c9f57.tar.bz2
fixed symlink showing linked file instead of name of symlink.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index a9ba3c2..a378170 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,830 +1,829 @@
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", 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)) & fs.find("vfat",0,TRUE) == -1) {
324 pm = Resource::loadPixmap( "exec"); 324 pm = Resource::loadPixmap( "exec");
325// else { //is exec 325// else { //is exec
326// pm = Resource::loadPixmap( "exec"); 326// pm = Resource::loadPixmap( "exec");
327// } 327// }
328// // item->setPixmap( 0,pm); 328// // item->setPixmap( 0,pm);
329 } else if( !fi->isReadable() ) { 329 } else if( !fi->isReadable() ) {
330 pm = Resource::loadPixmap( "locked" ); 330 pm = Resource::loadPixmap( "locked" );
331// item->setPixmap( 0,pm); 331// item->setPixmap( 0,pm);
332 } else { //everything else goes by mimetype 332 } else { //everything else goes by mimetype
333 MimeType mt(fi->filePath()); 333 MimeType mt(fi->filePath());
334 pm=mt.pixmap(); //sets the correct pixmap for mimetype 334 pm=mt.pixmap(); //sets the correct pixmap for mimetype
335 if(pm.isNull()) 335 if(pm.isNull())
336 pm = Resource::loadPixmap( "UnknownDocument-14" ); 336 pm = Resource::loadPixmap( "UnknownDocument-14" );
337// item->setPixmap( 0,pm); 337// item->setPixmap( 0,pm);
338 } 338 }
339 item->setPixmap( 0,pm); 339 item->setPixmap( 0,pm);
340 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 340 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
341 // overlay link image 341 // overlay link image
342 pm= Resource::loadPixmap( "folder" ); 342 pm= Resource::loadPixmap( "folder" );
343 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 343 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
344 QPainter painter( &pm ); 344 QPainter painter( &pm );
345 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 345 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
346 pm.setMask( pm.createHeuristicMask( FALSE ) ); 346 pm.setMask( pm.createHeuristicMask( FALSE ) );
347 item->setPixmap( 0, pm); 347 item->setPixmap( 0, pm);
348 } 348 }
349 } 349 }
350 isDir=FALSE; 350 isDir=FALSE;
351 ++it; 351 ++it;
352 } 352 }
353 353
354 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 354 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
355 struct stat buf; 355 struct stat buf;
356// struct stat st; 356// struct stat st;
357 dev_t devT; 357 dev_t devT;
358// mode_t mode; 358// mode_t mode;
359 DIR *dir; 359 DIR *dir;
360// int fd = 0; 360// int fd = 0;
361 struct dirent *mydirent; 361 struct dirent *mydirent;
362// int i = 1; 362// int i = 1;
363 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 363 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
364 while ((mydirent = readdir(dir)) != NULL) { 364 while ((mydirent = readdir(dir)) != NULL) {
365 lstat( mydirent->d_name, &buf); 365 lstat( mydirent->d_name, &buf);
366 qDebug(mydirent->d_name); 366 qDebug(mydirent->d_name);
367// mode = buf.st_mode; 367// mode = buf.st_mode;
368 fileL.sprintf("%s", mydirent->d_name); 368 fileL.sprintf("%s", mydirent->d_name);
369// fileS.sprintf("%d, %d", ); //this isn't correct 369// fileS.sprintf("%d, %d", ); //this isn't correct
370 devT = buf.st_dev; 370 devT = buf.st_dev;
371 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 371 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
372// fileS.sprintf("%d,%d", devT, devT); 372// fileS.sprintf("%d,%d", devT, devT);
373 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 373 fileDate.sprintf("%s", ctime( &buf.st_mtime));
374 if( fileL.find(".") == -1 ){ 374 if( fileL.find(".") == -1 ){
375 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 375 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
376 pm = Resource::loadPixmap( "UnknownDocument-14" ); 376 pm = Resource::loadPixmap( "UnknownDocument-14" );
377 item->setPixmap( 0,pm); 377 item->setPixmap( 0,pm);
378 } 378 }
379 } 379 }
380 380
381 closedir(dir); 381 closedir(dir);
382 } 382 }
383 383
384 Local_View->setSorting( 3,FALSE); 384 Local_View->setSorting( 3,FALSE);
385 fillCombo( (const QString &) currentDir.canonicalPath()); 385 fillCombo( (const QString &) currentDir.canonicalPath());
386} 386}
387 387
388 388
389void AdvancedFm::populateRemoteView() 389void AdvancedFm::populateRemoteView()
390{ 390{
391// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 391// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
392// QListViewItemIterator it( Remote_View ); 392// QListViewItemIterator it( Remote_View );
393// for ( ; it.current(); ++it ) { 393// for ( ; it.current(); ++it ) {
394// if ( it.current()->isSelected() ) { 394// if ( it.current()->isSelected() ) {
395// QString strItem = it.current()->text(0); 395// QString strItem = it.current()->text(0);
396// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 396// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
397// QFileInfo fi(localFile); 397// QFileInfo fi(localFile);
398// } 398// }
399// } 399// }
400 QPixmap pm; 400 QPixmap pm;
401 Remote_View->clear(); 401 Remote_View->clear();
402 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 402 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
403 currentRemoteDir.setMatchAllDirs(TRUE); 403 currentRemoteDir.setMatchAllDirs(TRUE);
404 currentRemoteDir.setNameFilter(filterStr); 404 currentRemoteDir.setNameFilter(filterStr);
405 QString fileL, fileS, fileDate; 405 QString fileL, fileS, fileDate;
406 406
407 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 407 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
408 setCaption("AdvancedFm :: "+fs); 408 setCaption("AdvancedFm :: "+fs);
409 bool isDir=FALSE; 409 bool isDir=FALSE;
410 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 410 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
411 QFileInfoListIterator it(*list); 411 QFileInfoListIterator it(*list);
412 QFileInfo *fi; 412 QFileInfo *fi;
413 while ( (fi=it.current()) ) { 413 while ( (fi=it.current()) ) {
414 if (fi->isSymLink() ){ 414 if (fi->isSymLink() ){
415 QString symLink=fi->readLink(); 415 QString symLink=fi->readLink();
416// qDebug("Symlink detected "+symLink); 416// qDebug("Symlink detected "+symLink);
417 QFileInfo sym( symLink); 417 QFileInfo sym( symLink);
418 fileS.sprintf( "%10li", sym.size() ); 418 fileS.sprintf( "%10li", sym.size() );
419 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 419 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
420 fileDate = sym.lastModified().toString(); 420 fileDate = sym.lastModified().toString();
421 } else { 421 } else {
422// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 422// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
423 fileS.sprintf( "%10li", fi->size() ); 423 fileS.sprintf( "%10li", fi->size() );
424 fileL.sprintf( "%s",fi->fileName().data() ); 424 fileL.sprintf( "%s",fi->fileName().data() );
425 fileDate= fi->lastModified().toString(); 425 fileDate= fi->lastModified().toString();
426 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 426 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
427 fileL+="/"; 427 fileL+="/";
428 isDir=TRUE; 428 isDir=TRUE;
429// qDebug( fileL); 429// qDebug( fileL);
430 } 430 }
431 } 431 }
432 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 432 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
433 if(fileL !="./" && fi->exists()) { 433 if(fileL !="./" && fi->exists()) {
434 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 434 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
435 QPixmap pm; 435 QPixmap pm;
436 436
437 if(isDir || fileL.find("/",0,TRUE) != -1) { 437 if(isDir || fileL.find("/",0,TRUE) != -1) {
438 if( !QDir( fi->filePath() ).isReadable()) 438 if( !QDir( fi->filePath() ).isReadable())
439 pm = Resource::loadPixmap( "lockedfolder" ); 439 pm = Resource::loadPixmap( "lockedfolder" );
440 else 440 else
441 pm= Resource::loadPixmap( "folder" ); 441 pm= Resource::loadPixmap( "folder" );
442// item->setPixmap( 0,pm ); 442// item->setPixmap( 0,pm );
443 } else if( (fileInfo.permission( QFileInfo::ExeUser) 443 } else if( (fileInfo.permission( QFileInfo::ExeUser)
444 | fileInfo.permission( QFileInfo::ExeGroup) 444 | fileInfo.permission( QFileInfo::ExeGroup)
445 | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { 445 | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) {
446 pm = Resource::loadPixmap( "exec");
447///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! 446///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!!
448 pm = Resource::loadPixmap( "exec"); 447 pm = Resource::loadPixmap( "exec");
449// item->setPixmap( 0,pm); 448// item->setPixmap( 0,pm);
450 } else if( !fi->isReadable() ) { 449 } else if( !fi->isReadable() ) {
451 pm = Resource::loadPixmap( "locked" ); 450 pm = Resource::loadPixmap( "locked" );
452// item->setPixmap( 0,pm); 451// item->setPixmap( 0,pm);
453 } else { 452 } else {
454 MimeType mt(fi->filePath()); 453 MimeType mt(fi->filePath());
455 pm=mt.pixmap(); //sets the correct pixmap for mimetype 454 pm=mt.pixmap(); //sets the correct pixmap for mimetype
456 if(pm.isNull()) 455 if(pm.isNull())
457 pm = Resource::loadPixmap( "UnknownDocument-14" ); 456 pm = Resource::loadPixmap( "UnknownDocument-14" );
458// item->setPixmap( 0,pm); 457// item->setPixmap( 0,pm);
459 } 458 }
460 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 459 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
461 // overlay link image 460 // overlay link image
462 pm= Resource::loadPixmap( "folder" ); 461 pm= Resource::loadPixmap( "folder" );
463 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 462 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
464 QPainter painter( &pm ); 463 QPainter painter( &pm );
465 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 464 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
466 pm.setMask( pm.createHeuristicMask( FALSE ) ); 465 pm.setMask( pm.createHeuristicMask( FALSE ) );
467// item->setPixmap( 0, pm); 466// item->setPixmap( 0, pm);
468 } 467 }
469 item->setPixmap( 0, pm); 468 item->setPixmap( 0, pm);
470 } 469 }
471 isDir=FALSE; 470 isDir=FALSE;
472 ++it; 471 ++it;
473 } 472 }
474 473
475 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 474 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
476 struct stat buf; 475 struct stat buf;
477// struct stat st; 476// struct stat st;
478// mode_t mode; 477// mode_t mode;
479 DIR *dir; 478 DIR *dir;
480// int fd = 0; 479// int fd = 0;
481 struct dirent *mydirent; 480 struct dirent *mydirent;
482// int i = 1; 481// int i = 1;
483 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 482 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
484 while ((mydirent = readdir(dir)) != NULL) { 483 while ((mydirent = readdir(dir)) != NULL) {
485 lstat( mydirent->d_name, &buf); 484 lstat( mydirent->d_name, &buf);
486 qDebug(mydirent->d_name); 485 qDebug(mydirent->d_name);
487// mode = buf.st_mode; 486// mode = buf.st_mode;
488 fileL.sprintf("%s", mydirent->d_name); 487 fileL.sprintf("%s", mydirent->d_name);
489// fileS.sprintf("%d, %d", ); //this isn't correct 488// fileS.sprintf("%d, %d", ); //this isn't correct
490 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 489 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
491 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 490 fileDate.sprintf("%s", ctime( &buf.st_mtime));
492 if( fileL.find(".") == -1 ){ 491 if( fileL.find(".") == -1 ){
493 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 492 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
494 pm = Resource::loadPixmap( "UnknownDocument-14" ); 493 pm = Resource::loadPixmap( "UnknownDocument-14" );
495 item->setPixmap( 0,pm); 494 item->setPixmap( 0,pm);
496 } 495 }
497 } 496 }
498 497
499 closedir(dir); 498 closedir(dir);
500 } 499 }
501 500
502 Remote_View->setSorting( 3,FALSE); 501 Remote_View->setSorting( 3,FALSE);
503 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 502 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
504} 503}
505 504
506void AdvancedFm::localListClicked(QListViewItem *selectedItem) 505void AdvancedFm::localListClicked(QListViewItem *selectedItem)
507{ 506{
508 if(selectedItem) { 507 if(selectedItem) {
509 QString strItem=selectedItem->text(0); 508 QString strItem=selectedItem->text(0);
510 QString strSize=selectedItem->text(1); 509 QString strSize=selectedItem->text(1);
511 strSize=strSize.stripWhiteSpace(); 510 strSize=strSize.stripWhiteSpace();
512 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 511 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
513 // is symlink 512 // is symlink
514 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 513 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
515 if(QDir(strItem2).exists() ) { 514 if(QDir(strItem2).exists() ) {
516 currentDir.cd(strItem2, TRUE); 515 currentDir.cd(strItem2, TRUE);
517 populateLocalView(); 516 populateLocalView();
518 } 517 }
519 } else { // not a symlink 518 } else { // not a symlink
520 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 519 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
521 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 520 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
522 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 521 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
523 currentDir.cd(strItem,FALSE); 522 currentDir.cd(strItem,FALSE);
524 populateLocalView(); 523 populateLocalView();
525 } else { 524 } else {
526 currentDir.cdUp(); 525 currentDir.cdUp();
527 populateLocalView(); 526 populateLocalView();
528 } 527 }
529 if(QDir(strItem).exists()){ 528 if(QDir(strItem).exists()){
530 currentDir.cd(strItem, TRUE); 529 currentDir.cd(strItem, TRUE);
531 populateLocalView(); 530 populateLocalView();
532 } 531 }
533 } else { 532 } else {
534 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 533 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
535 if( QFile::exists(strItem ) ) { 534 if( QFile::exists(strItem ) ) {
536// qDebug("upload "+strItem); 535// qDebug("upload "+strItem);
537 } 536 }
538 } //end not symlink 537 } //end not symlink
539 chdir(strItem.latin1()); 538 chdir(strItem.latin1());
540 } 539 }
541 } 540 }
542} 541}
543 542
544void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 543void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
545{ 544{
546 if(selectedItem) { 545 if(selectedItem) {
547 QString strItem=selectedItem->text(0); 546 QString strItem=selectedItem->text(0);
548 QString strSize=selectedItem->text(1); 547 QString strSize=selectedItem->text(1);
549 strSize=strSize.stripWhiteSpace(); 548 strSize=strSize.stripWhiteSpace();
550 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 549 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
551 // is symlink 550 // is symlink
552 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 551 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
553 if(QDir(strItem2).exists() ) { 552 if(QDir(strItem2).exists() ) {
554 currentRemoteDir.cd(strItem2, TRUE); 553 currentRemoteDir.cd(strItem2, TRUE);
555 populateRemoteView(); 554 populateRemoteView();
556 } 555 }
557 } else { // not a symlink 556 } else { // not a symlink
558 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 557 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
559 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 558 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
560 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 559 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
561 currentRemoteDir.cd(strItem,FALSE); 560 currentRemoteDir.cd(strItem,FALSE);
562 populateRemoteView(); 561 populateRemoteView();
563 } else { 562 } else {
564 currentRemoteDir.cdUp(); 563 currentRemoteDir.cdUp();
565 populateRemoteView(); 564 populateRemoteView();
566 } 565 }
567 if(QDir(strItem).exists()){ 566 if(QDir(strItem).exists()){
568 currentRemoteDir.cd(strItem, TRUE); 567 currentRemoteDir.cd(strItem, TRUE);
569 populateRemoteView(); 568 populateRemoteView();
570 } 569 }
571 } else { 570 } else {
572 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 571 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
573 if( QFile::exists(strItem ) ) { 572 if( QFile::exists(strItem ) ) {
574// qDebug("upload "+strItem); 573// qDebug("upload "+strItem);
575 } 574 }
576 } //end not symlink 575 } //end not symlink
577 chdir(strItem.latin1()); 576 chdir(strItem.latin1());
578 } 577 }
579 } 578 }
580} 579}
581 580
582void AdvancedFm::doLocalCd() 581void AdvancedFm::doLocalCd()
583{ 582{
584 localListClicked( Local_View->currentItem()); 583 localListClicked( Local_View->currentItem());
585} 584}
586 585
587void AdvancedFm::doRemoteCd() 586void AdvancedFm::doRemoteCd()
588{ 587{
589 localListClicked( Remote_View->currentItem()); 588 localListClicked( Remote_View->currentItem());
590} 589}
591 590
592void AdvancedFm::showHidden() 591void AdvancedFm::showHidden()
593{ 592{
594 if (b) { 593 if (b) {
595 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 594 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
596 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 595 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
597// localMenu->setItemChecked(localMenu->idAt(0),TRUE); 596// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
598// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 597// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
599 b=FALSE; 598 b=FALSE;
600 599
601 } else { 600 } else {
602 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 601 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
603 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 602 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
604// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 603// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
605// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 604// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
606 b=TRUE; 605 b=TRUE;
607 } 606 }
608 populateLocalView(); 607 populateLocalView();
609 608
610} 609}
611 610
612void AdvancedFm::showRemoteHidden() 611void AdvancedFm::showRemoteHidden()
613{ 612{
614 if (b) { 613 if (b) {
615 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 614 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
616// viewMenu->setItemChecked(localMenu->idAt(0),TRUE); 615// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
617// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 616// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
618 b=TRUE; 617 b=TRUE;
619 618
620 } else { 619 } else {
621 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 620 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
622// localMenu->setItemChecked(localMenu->idAt(0),FALSE); 621// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
623// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 622// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
624 b=FALSE; 623 b=FALSE;
625 } 624 }
626 populateRemoteView(); 625 populateRemoteView();
627} 626}
628 627
629void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 628void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
630{ 629{
631 switch (mouse) { 630 switch (mouse) {
632 case 1: 631 case 1:
633 break; 632 break;
634 case 2: 633 case 2:
635 showLocalMenu(item); 634 showLocalMenu(item);
636 Local_View->clearSelection(); 635 Local_View->clearSelection();
637 break; 636 break;
638 }; 637 };
639} 638}
640 639
641void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 640void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
642{ 641{
643 switch (mouse) { 642 switch (mouse) {
644 case 1: 643 case 1:
645 break; 644 break;
646 case 2: 645 case 2:
647 showRemoteMenu(item); 646 showRemoteMenu(item);
648 Remote_View->clearSelection(); 647 Remote_View->clearSelection();
649 break; 648 break;
650 }; 649 };
651} 650}
652 651
653void AdvancedFm::showLocalMenu(QListViewItem * item) 652void AdvancedFm::showLocalMenu(QListViewItem * item)
654{ 653{
655 if(item) { 654 if(item) {
656 QPopupMenu m; 655 QPopupMenu m;
657 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 656 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
658 m.insertSeparator(); 657 m.insertSeparator();
659 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 658 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
660 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 659 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
661 else 660 else
662 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 661 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
663 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 662 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
664 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 663 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
665 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 664 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
666 m.insertSeparator(); 665 m.insertSeparator();
667 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 666 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
668 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 667 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
669 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 668 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
670 m.insertItem( tr( "Move" ), this, SLOT( move() )); 669 m.insertItem( tr( "Move" ), this, SLOT( move() ));
671 m.insertSeparator(); 670 m.insertSeparator();
672 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 671 m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
673 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 672 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
674 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 673 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
675 m.insertSeparator(); 674 m.insertSeparator();
676 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 675 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
677 m.insertSeparator(); 676 m.insertSeparator();
678 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 677 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
679 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 678 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
680 m.setCheckable(TRUE); 679 m.setCheckable(TRUE);
681 if (!b) 680 if (!b)
682 m.setItemChecked(m.idAt(0),TRUE); 681 m.setItemChecked(m.idAt(0),TRUE);
683 else 682 else
684 m.setItemChecked(m.idAt(0),FALSE); 683 m.setItemChecked(m.idAt(0),FALSE);
685 m.exec( QCursor::pos() ); 684 m.exec( QCursor::pos() );
686 } 685 }
687} 686}
688 687
689void AdvancedFm::showRemoteMenu(QListViewItem * item) 688void AdvancedFm::showRemoteMenu(QListViewItem * item)
690{ 689{
691 if(item) { 690 if(item) {
692 QPopupMenu m; 691 QPopupMenu m;
693 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); 692 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() ));
694 m.insertSeparator(); 693 m.insertSeparator();
695 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 694 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
696 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 695 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
697 else 696 else
698 m.insertItem( tr( "Open" ), this, SLOT( runThis() )); 697 m.insertItem( tr( "Open" ), this, SLOT( runThis() ));
699 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); 698 m.insertItem( tr( "Open as Text" ), this, SLOT( runText() ));
700 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 699 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
701 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 700 m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
702 m.insertSeparator(); 701 m.insertSeparator();
703 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 702 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
704 m.insertItem( tr( "Copy" ), this, SLOT( copy() )); 703 m.insertItem( tr( "Copy" ), this, SLOT( copy() ));
705 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 704 m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
706 m.insertItem( tr( "Move" ), this, SLOT( move() )); 705 m.insertItem( tr( "Move" ), this, SLOT( move() ));
707 m.insertSeparator(); 706 m.insertSeparator();
708 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 707 m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
709 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 708 m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
710 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 709 m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
711 m.insertSeparator(); 710 m.insertSeparator();
712 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 711 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
713 m.insertSeparator(); 712 m.insertSeparator();
714 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 713 m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
715 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 714 m.insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
716 m.setCheckable(TRUE); 715 m.setCheckable(TRUE);
717 if (!b) 716 if (!b)
718 m.setItemChecked(m.idAt(0),TRUE); 717 m.setItemChecked(m.idAt(0),TRUE);
719 else 718 else
720 m.setItemChecked(m.idAt(0),FALSE); 719 m.setItemChecked(m.idAt(0),FALSE);
721 m.exec( QCursor::pos() ); 720 m.exec( QCursor::pos() );
722 } 721 }
723} 722}
724 723
725void AdvancedFm::runThis() { 724void AdvancedFm::runThis() {
726// QFileInfo *fi; 725// QFileInfo *fi;
727QString fs; 726QString fs;
728 if (TabWidget->currentPageIndex() == 0) { 727 if (TabWidget->currentPageIndex() == 0) {
729 QString curFile = Local_View->currentItem()->text(0); 728 QString curFile = Local_View->currentItem()->text(0);
730 729
731 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 730 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
732 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 731 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
733 qDebug( fileInfo.owner()); 732 qDebug( fileInfo.owner());
734 if( fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 733 if( fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
735 QCopEnvelope e("QPE/System", "execute(QString)" ); 734 QCopEnvelope e("QPE/System", "execute(QString)" );
736 e << curFile; 735 e << curFile;
737 } else { 736 } else {
738 curFile = currentDir.canonicalPath()+"/"+curFile; 737 curFile = currentDir.canonicalPath()+"/"+curFile;
739 DocLnk nf(curFile); 738 DocLnk nf(curFile);
740 QString execStr = nf.exec(); 739 QString execStr = nf.exec();
741 qDebug( execStr); 740 qDebug( execStr);
742 if( execStr.isEmpty() ) { 741 if( execStr.isEmpty() ) {
743 } else { 742 } else {
744 nf.execute(); 743 nf.execute();
745 } 744 }
746 } 745 }
747// MimeType mt( curFile); 746// MimeType mt( curFile);
748 } else { 747 } else {
749 QString curFile = Remote_View->currentItem()->text(0); 748 QString curFile = Remote_View->currentItem()->text(0);
750 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 749 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
751 qDebug("Filesystemtype is "+fs); 750 qDebug("Filesystemtype is "+fs);
752 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 751 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
753 if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 752 if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
754 QCopEnvelope e("QPE/System", "execute(QString)" ); 753 QCopEnvelope e("QPE/System", "execute(QString)" );
755 e << curFile; 754 e << curFile;
756 } else { 755 } else {
757 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 756 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
758 DocLnk nf(curFile); 757 DocLnk nf(curFile);
759 QString execStr = nf.exec(); 758 QString execStr = nf.exec();
760 qDebug(execStr); 759 qDebug(execStr);
761 if( execStr.isEmpty() ) { 760 if( execStr.isEmpty() ) {
762 } else { 761 } else {
763 nf.execute(); 762 nf.execute();
764 } 763 }
765 } 764 }
766// MimeType mt( curFile); 765// MimeType mt( curFile);
767 } 766 }
768} 767}
769 768
770void AdvancedFm::runText() { 769void AdvancedFm::runText() {
771 if (TabWidget->currentPageIndex() == 0) { 770 if (TabWidget->currentPageIndex() == 0) {
772 QString curFile = Local_View->currentItem()->text(0); 771 QString curFile = Local_View->currentItem()->text(0);
773 curFile = currentDir.canonicalPath()+"/"+curFile; 772 curFile = currentDir.canonicalPath()+"/"+curFile;
774 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 773 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
775 e << curFile; 774 e << curFile;
776 } else { 775 } else {
777 QString curFile = Remote_View->currentItem()->text(0); 776 QString curFile = Remote_View->currentItem()->text(0);
778 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 777 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
779 DocLnk nf(curFile); 778 DocLnk nf(curFile);
780 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 779 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
781 e << curFile; 780 e << curFile;
782 } 781 }
783} 782}
784 783
785void AdvancedFm::localMakDir() 784void AdvancedFm::localMakDir()
786{ 785{
787 InputDialog *fileDlg; 786 InputDialog *fileDlg;
788 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 787 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
789 fileDlg->exec(); 788 fileDlg->exec();
790 if( fileDlg->result() == 1 ) { 789 if( fileDlg->result() == 1 ) {
791 QString filename = fileDlg->LineEdit1->text(); 790 QString filename = fileDlg->LineEdit1->text();
792 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 791 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
793 } 792 }
794 populateLocalView(); 793 populateLocalView();
795} 794}
796 795
797void AdvancedFm::remoteMakDir() 796void AdvancedFm::remoteMakDir()
798{ 797{
799 InputDialog *fileDlg; 798 InputDialog *fileDlg;
800 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 799 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
801 fileDlg->exec(); 800 fileDlg->exec();
802 if( fileDlg->result() == 1 ) { 801 if( fileDlg->result() == 1 ) {
803 QString filename = fileDlg->LineEdit1->text(); 802 QString filename = fileDlg->LineEdit1->text();
804 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 803 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
805 } 804 }
806 populateRemoteView(); 805 populateRemoteView();
807} 806}
808 807
809void AdvancedFm::localDelete() 808void AdvancedFm::localDelete()
810{ 809{
811 QStringList curFileList = getPath(); 810 QStringList curFileList = getPath();
812 QString myFile; 811 QString myFile;
813 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 812 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
814 myFile = (*it); 813 myFile = (*it);
815 if( myFile.find(" -> ",0,TRUE) != -1) 814 if( myFile.find(" -> ",0,TRUE) != -1)
816 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 815 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
817 816
818 QString f = currentDir.canonicalPath(); 817 QString f = currentDir.canonicalPath();
819 if(f.right(1).find("/",0,TRUE) == -1) 818 if(f.right(1).find("/",0,TRUE) == -1)
820 f+="/"; 819 f+="/";
821 f+=myFile; 820 f+=myFile;
822 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 821 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
823 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 822 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
824 "\nand all it's contents ?" 823 "\nand all it's contents ?"
825 ,tr("Yes"),tr("No"),0,0,1) ) { 824 ,tr("Yes"),tr("No"),0,0,1) ) {
826 case 0: { 825 case 0: {
827 f=f.left(f.length()-1); 826 f=f.left(f.length()-1);
828 QString cmd="rm -rf "+f; 827 QString cmd="rm -rf "+f;
829 system( cmd.latin1()); 828 system( cmd.latin1());
830 populateLocalView(); 829 populateLocalView();
@@ -966,672 +965,672 @@ void AdvancedFm::currentPathComboChanged()
966 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 965 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
967 } 966 }
968 } 967 }
969 if (TabWidget->currentPageIndex() == 0) { 968 if (TabWidget->currentPageIndex() == 0) {
970 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 969 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
971 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 970 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
972 populateRemoteView(); 971 populateRemoteView();
973 } else { 972 } else {
974 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 973 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
975 } 974 }
976 } 975 }
977} 976}
978 977
979void AdvancedFm::fillCombo(const QString &currentPath) { 978void AdvancedFm::fillCombo(const QString &currentPath) {
980 979
981 if (TabWidget->currentPageIndex() == 0) { 980 if (TabWidget->currentPageIndex() == 0) {
982 currentPathCombo->lineEdit()->setText( currentPath); 981 currentPathCombo->lineEdit()->setText( currentPath);
983 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 982 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
984 currentPathCombo->clear(); 983 currentPathCombo->clear();
985 localDirPathStringList.prepend( currentPath ); 984 localDirPathStringList.prepend( currentPath );
986 currentPathCombo->insertStringList( localDirPathStringList,-1); 985 currentPathCombo->insertStringList( localDirPathStringList,-1);
987 } 986 }
988 } else { 987 } else {
989 currentPathCombo->lineEdit()->setText( currentPath); 988 currentPathCombo->lineEdit()->setText( currentPath);
990 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 989 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
991 currentPathCombo->clear(); 990 currentPathCombo->clear();
992 remoteDirPathStringList.prepend( currentPath ); 991 remoteDirPathStringList.prepend( currentPath );
993 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 992 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
994 } 993 }
995 } 994 }
996} 995}
997 996
998void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 997void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
999 if (TabWidget->currentPageIndex() == 0) { 998 if (TabWidget->currentPageIndex() == 0) {
1000 chdir( currentPath.latin1() ); 999 chdir( currentPath.latin1() );
1001 currentDir.cd( currentPath, TRUE); 1000 currentDir.cd( currentPath, TRUE);
1002 populateLocalView(); 1001 populateLocalView();
1003 update(); 1002 update();
1004 } else { 1003 } else {
1005 chdir( currentPath.latin1() ); 1004 chdir( currentPath.latin1() );
1006 currentRemoteDir.cd( currentPath, TRUE); 1005 currentRemoteDir.cd( currentPath, TRUE);
1007 populateRemoteView(); 1006 populateRemoteView();
1008 update(); 1007 update();
1009 } 1008 }
1010} 1009}
1011 1010
1012void AdvancedFm::filePerms() { 1011void AdvancedFm::filePerms() {
1013 1012
1014 QStringList curFileList = getPath(); 1013 QStringList curFileList = getPath();
1015 QString filePath; 1014 QString filePath;
1016 1015
1017 if (TabWidget->currentPageIndex() == 0) { 1016 if (TabWidget->currentPageIndex() == 0) {
1018 filePath = currentDir.canonicalPath()+"/"; 1017 filePath = currentDir.canonicalPath()+"/";
1019 } else { 1018 } else {
1020 filePath= currentRemoteDir.canonicalPath()+"/"; 1019 filePath= currentRemoteDir.canonicalPath()+"/";
1021 } 1020 }
1022 1021
1023 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1022 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1024 filePermissions *filePerm; 1023 filePermissions *filePerm;
1025 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 1024 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
1026 filePerm->showMaximized(); 1025 filePerm->showMaximized();
1027 filePerm->exec(); 1026 filePerm->exec();
1028 if( filePerm) 1027 if( filePerm)
1029 delete filePerm; 1028 delete filePerm;
1030 } 1029 }
1031} 1030}
1032 1031
1033void AdvancedFm::doProperties() { 1032void AdvancedFm::doProperties() {
1034 QStringList curFileList = getPath(); 1033 QStringList curFileList = getPath();
1035 QString filePath; 1034 QString filePath;
1036 if (TabWidget->currentPageIndex() == 0) { 1035 if (TabWidget->currentPageIndex() == 0) {
1037 filePath = currentDir.canonicalPath()+"/"; 1036 filePath = currentDir.canonicalPath()+"/";
1038 } else { 1037 } else {
1039 filePath= currentRemoteDir.canonicalPath()+"/"; 1038 filePath= currentRemoteDir.canonicalPath()+"/";
1040 } 1039 }
1041 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1040 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1042 DocLnk lnk( (filePath+*it)); 1041 DocLnk lnk( (filePath+*it));
1043 LnkProperties prop( &lnk ); 1042 LnkProperties prop( &lnk );
1044// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 1043// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
1045 prop.showMaximized(); 1044 prop.showMaximized();
1046 prop.exec(); 1045 prop.exec();
1047 } 1046 }
1048} 1047}
1049 1048
1050QStringList AdvancedFm::getPath() { 1049QStringList AdvancedFm::getPath() {
1051 QStringList strList; 1050 QStringList strList;
1052 if (TabWidget->currentPageIndex() == 0) { 1051 if (TabWidget->currentPageIndex() == 0) {
1053 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1052 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1054 QListViewItemIterator it( Local_View ); 1053 QListViewItemIterator it( Local_View );
1055 for ( ; it.current(); ++it ) { 1054 for ( ; it.current(); ++it ) {
1056 if ( it.current()->isSelected() ) { 1055 if ( it.current()->isSelected() ) {
1057 strList << it.current()->text(0); 1056 strList << it.current()->text(0);
1058 } 1057 }
1059 } 1058 }
1060 return strList; 1059 return strList;
1061 } else { 1060 } else {
1062 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 1061 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
1063 QListViewItemIterator it( Remote_View ); 1062 QListViewItemIterator it( Remote_View );
1064 for ( ; it.current(); ++it ) { 1063 for ( ; it.current(); ++it ) {
1065 if ( it.current()->isSelected() ) { 1064 if ( it.current()->isSelected() ) {
1066 strList << it.current()->text(0); 1065 strList << it.current()->text(0);
1067 } 1066 }
1068 } 1067 }
1069 return strList; 1068 return strList;
1070 } 1069 }
1071 return ""; 1070 return "";
1072} 1071}
1073 1072
1074void AdvancedFm::homeButtonPushed() { 1073void AdvancedFm::homeButtonPushed() {
1075 QString current = QDir::homeDirPath(); 1074 QString current = QDir::homeDirPath();
1076 chdir( current.latin1() ); 1075 chdir( current.latin1() );
1077 if (TabWidget->currentPageIndex() == 0) { 1076 if (TabWidget->currentPageIndex() == 0) {
1078 currentDir.cd( current, TRUE); 1077 currentDir.cd( current, TRUE);
1079 populateLocalView(); 1078 populateLocalView();
1080 } else { 1079 } else {
1081 currentRemoteDir.cd( current, TRUE); 1080 currentRemoteDir.cd( current, TRUE);
1082 populateRemoteView(); 1081 populateRemoteView();
1083 } 1082 }
1084 update(); 1083 update();
1085} 1084}
1086 1085
1087void AdvancedFm::docButtonPushed() { 1086void AdvancedFm::docButtonPushed() {
1088 QString current = QPEApplication::documentDir(); 1087 QString current = QPEApplication::documentDir();
1089 chdir( current.latin1() ); 1088 chdir( current.latin1() );
1090 if (TabWidget->currentPageIndex() == 0) { 1089 if (TabWidget->currentPageIndex() == 0) {
1091 currentDir.cd( current, TRUE); 1090 currentDir.cd( current, TRUE);
1092 populateLocalView(); 1091 populateLocalView();
1093 } else { 1092 } else {
1094 currentRemoteDir.cd( current, TRUE); 1093 currentRemoteDir.cd( current, TRUE);
1095 populateRemoteView(); 1094 populateRemoteView();
1096 } 1095 }
1097 update(); 1096 update();
1098} 1097}
1099 1098
1100void AdvancedFm::SDButtonPushed() { 1099void AdvancedFm::SDButtonPushed() {
1101 QString current = "/mnt/card"; 1100 QString current = "/mnt/card";
1102 chdir( current.latin1() ); 1101 chdir( current.latin1() );
1103 if (TabWidget->currentPageIndex() == 0) { 1102 if (TabWidget->currentPageIndex() == 0) {
1104 currentDir.cd( current, TRUE); 1103 currentDir.cd( current, TRUE);
1105 populateLocalView(); 1104 populateLocalView();
1106 } else { 1105 } else {
1107 currentRemoteDir.cd( current, TRUE); 1106 currentRemoteDir.cd( current, TRUE);
1108 populateRemoteView(); 1107 populateRemoteView();
1109 } 1108 }
1110 update(); 1109 update();
1111 1110
1112} 1111}
1113 1112
1114void AdvancedFm::CFButtonPushed() { 1113void AdvancedFm::CFButtonPushed() {
1115 QString current = "/mnt/cf"; 1114 QString current = "/mnt/cf";
1116 chdir( current.latin1() ); 1115 chdir( current.latin1() );
1117 if (TabWidget->currentPageIndex() == 0) { 1116 if (TabWidget->currentPageIndex() == 0) {
1118 currentDir.cd( current, TRUE); 1117 currentDir.cd( current, TRUE);
1119 populateLocalView(); 1118 populateLocalView();
1120 } else { 1119 } else {
1121 currentRemoteDir.cd( current, TRUE); 1120 currentRemoteDir.cd( current, TRUE);
1122 populateRemoteView(); 1121 populateRemoteView();
1123 } 1122 }
1124 update(); 1123 update();
1125 1124
1126} 1125}
1127 1126
1128 1127
1129void AdvancedFm::upDir() 1128void AdvancedFm::upDir()
1130{ 1129{
1131 if (TabWidget->currentPageIndex() == 0) { 1130 if (TabWidget->currentPageIndex() == 0) {
1132 QString current = currentDir.canonicalPath(); 1131 QString current = currentDir.canonicalPath();
1133 QDir dir(current); 1132 QDir dir(current);
1134 dir.cdUp(); 1133 dir.cdUp();
1135 current = dir.canonicalPath(); 1134 current = dir.canonicalPath();
1136 chdir( current.latin1() ); 1135 chdir( current.latin1() );
1137 currentDir.cd( current, TRUE); 1136 currentDir.cd( current, TRUE);
1138 populateLocalView(); 1137 populateLocalView();
1139 update(); 1138 update();
1140 } else { 1139 } else {
1141 QString current = currentRemoteDir.canonicalPath(); 1140 QString current = currentRemoteDir.canonicalPath();
1142 QDir dir(current); 1141 QDir dir(current);
1143 dir.cdUp(); 1142 dir.cdUp();
1144 current = dir.canonicalPath(); 1143 current = dir.canonicalPath();
1145 chdir( current.latin1() ); 1144 chdir( current.latin1() );
1146 currentRemoteDir.cd( current, TRUE); 1145 currentRemoteDir.cd( current, TRUE);
1147 populateRemoteView(); 1146 populateRemoteView();
1148 update(); 1147 update();
1149 } 1148 }
1150} 1149}
1151 1150
1152void AdvancedFm::copy() 1151void AdvancedFm::copy()
1153{ 1152{
1154 QStringList curFileList = getPath(); 1153 QStringList curFileList = getPath();
1155 QString curFile; 1154 QString curFile;
1156 if (TabWidget->currentPageIndex() == 0) { 1155 if (TabWidget->currentPageIndex() == 0) {
1157 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1156 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1158 1157
1159 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1158 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1160// if(destFile.right(1).find("/",0,TRUE) == -1) 1159// if(destFile.right(1).find("/",0,TRUE) == -1)
1161// destFile+="/"; 1160// destFile+="/";
1162// destFile +=(*it); 1161// destFile +=(*it);
1163 1162
1164 curFile = currentDir.canonicalPath()+"/"+(*it); 1163 curFile = currentDir.canonicalPath()+"/"+(*it);
1165// if(curFile.right(1).find("/",0,TRUE) == -1) 1164// if(curFile.right(1).find("/",0,TRUE) == -1)
1166// curFile +="/"; 1165// curFile +="/";
1167// curFile +=(*it); 1166// curFile +=(*it);
1168 1167
1169 QFile f(destFile); 1168 QFile f(destFile);
1170 if( f.exists()) 1169 if( f.exists())
1171 f.remove(); 1170 f.remove();
1172 if(!copyFile(destFile, curFile) ) { 1171 if(!copyFile(destFile, curFile) ) {
1173 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1172 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1174 qWarning("nothin doing"); 1173 qWarning("nothin doing");
1175 } 1174 }
1176 } 1175 }
1177 populateRemoteView(); 1176 populateRemoteView();
1178 TabWidget->setCurrentPage(1); 1177 TabWidget->setCurrentPage(1);
1179 1178
1180 } else { 1179 } else {
1181 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1180 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1182 1181
1183 QString destFile = currentDir.canonicalPath()+"/"+(*it); 1182 QString destFile = currentDir.canonicalPath()+"/"+(*it);
1184 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1183 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1185 1184
1186 QFile f(destFile); 1185 QFile f(destFile);
1187 if( f.exists()) 1186 if( f.exists())
1188 f.remove(); 1187 f.remove();
1189 if(!copyFile(destFile, curFile) ) { 1188 if(!copyFile(destFile, curFile) ) {
1190 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1189 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1191 1190
1192 qWarning("nothin doing"); 1191 qWarning("nothin doing");
1193 } 1192 }
1194 } 1193 }
1195 populateLocalView(); 1194 populateLocalView();
1196 TabWidget->setCurrentPage(0); 1195 TabWidget->setCurrentPage(0);
1197 } 1196 }
1198} 1197}
1199 1198
1200void AdvancedFm::copyAs() 1199void AdvancedFm::copyAs()
1201{ 1200{
1202 QStringList curFileList = getPath(); 1201 QStringList curFileList = getPath();
1203 QString curFile; 1202 QString curFile;
1204 InputDialog *fileDlg; 1203 InputDialog *fileDlg;
1205 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1204 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1206 1205
1207 if (TabWidget->currentPageIndex() == 0) { 1206 if (TabWidget->currentPageIndex() == 0) {
1208 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1207 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1209 QString destFile; 1208 QString destFile;
1210 curFile = currentDir.canonicalPath()+"/"+(*it); 1209 curFile = currentDir.canonicalPath()+"/"+(*it);
1211// InputDialog *fileDlg; 1210// InputDialog *fileDlg;
1212// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1211// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1213 fileDlg->setInputText((const QString &) destFile ); 1212 fileDlg->setInputText((const QString &) destFile );
1214 fileDlg->exec(); 1213 fileDlg->exec();
1215 if( fileDlg->result() == 1 ) { 1214 if( fileDlg->result() == 1 ) {
1216 QString filename = fileDlg->LineEdit1->text(); 1215 QString filename = fileDlg->LineEdit1->text();
1217 destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1216 destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1218 1217
1219 QFile f(destFile); 1218 QFile f(destFile);
1220 if( f.exists()) 1219 if( f.exists())
1221 f.remove(); 1220 f.remove();
1222 if(!copyFile(destFile, curFile) ) { 1221 if(!copyFile(destFile, curFile) ) {
1223 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1222 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1224 qWarning("nothin doing"); 1223 qWarning("nothin doing");
1225 } 1224 }
1226 } 1225 }
1227 } 1226 }
1228 1227
1229 populateRemoteView(); 1228 populateRemoteView();
1230 TabWidget->setCurrentPage(1); 1229 TabWidget->setCurrentPage(1);
1231 } else { 1230 } else {
1232 if (TabWidget->currentPageIndex() == 0) { 1231 if (TabWidget->currentPageIndex() == 0) {
1233 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1232 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1234 1233
1235 curFile = currentDir.canonicalPath()+"/"+(*it); 1234 curFile = currentDir.canonicalPath()+"/"+(*it);
1236 QString destFile; 1235 QString destFile;
1237 fileDlg->setInputText((const QString &) destFile); 1236 fileDlg->setInputText((const QString &) destFile);
1238 fileDlg->exec(); 1237 fileDlg->exec();
1239 if( fileDlg->result() == 1 ) { 1238 if( fileDlg->result() == 1 ) {
1240 QString filename = fileDlg->LineEdit1->text(); 1239 QString filename = fileDlg->LineEdit1->text();
1241 destFile = currentDir.canonicalPath()+"/"+(*it); 1240 destFile = currentDir.canonicalPath()+"/"+(*it);
1242 1241
1243 QFile f(destFile); 1242 QFile f(destFile);
1244 if( f.exists()) 1243 if( f.exists())
1245 f.remove(); 1244 f.remove();
1246 if(!copyFile(destFile, curFile) ) { 1245 if(!copyFile(destFile, curFile) ) {
1247 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1246 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1248 qWarning("nothin doing"); 1247 qWarning("nothin doing");
1249 } 1248 }
1250 } 1249 }
1251 } 1250 }
1252 populateLocalView(); 1251 populateLocalView();
1253 TabWidget->setCurrentPage(0); 1252 TabWidget->setCurrentPage(0);
1254 } 1253 }
1255 } 1254 }
1256} 1255}
1257 1256
1258void AdvancedFm::move() { 1257void AdvancedFm::move() {
1259 1258
1260 QStringList curFileList = getPath(); 1259 QStringList curFileList = getPath();
1261 QString curFile; 1260 QString curFile;
1262// qDebug(curFile); 1261// qDebug(curFile);
1263 QString destFile; 1262 QString destFile;
1264 1263
1265 if (TabWidget->currentPageIndex() == 0) { 1264 if (TabWidget->currentPageIndex() == 0) {
1266 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1265 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1267 QString destFile = currentRemoteDir.canonicalPath(); 1266 QString destFile = currentRemoteDir.canonicalPath();
1268 if(destFile.right(1).find("/",0,TRUE) == -1) 1267 if(destFile.right(1).find("/",0,TRUE) == -1)
1269 destFile+="/"; 1268 destFile+="/";
1270 destFile +=(*it); 1269 destFile +=(*it);
1271 curFile = currentDir.canonicalPath(); 1270 curFile = currentDir.canonicalPath();
1272 qDebug("Destination file is "+destFile); 1271 qDebug("Destination file is "+destFile);
1273 if(curFile.right(1).find("/",0,TRUE) == -1) 1272 if(curFile.right(1).find("/",0,TRUE) == -1)
1274 curFile +="/"; 1273 curFile +="/";
1275 curFile+=(*it); 1274 curFile+=(*it);
1276 1275
1277 QFile f(destFile); 1276 QFile f(destFile);
1278 if( f.exists()) 1277 if( f.exists())
1279 f.remove(); 1278 f.remove();
1280 if(!copyFile( destFile, curFile) ) { 1279 if(!copyFile( destFile, curFile) ) {
1281 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1280 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1282 return; 1281 return;
1283 } 1282 }
1284 QFile::remove(curFile); 1283 QFile::remove(curFile);
1285 } 1284 }
1286 TabWidget->setCurrentPage(1); 1285 TabWidget->setCurrentPage(1);
1287 } else { 1286 } else {
1288 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1287 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1289 QString destFile = currentRemoteDir.canonicalPath(); 1288 QString destFile = currentRemoteDir.canonicalPath();
1290 if(destFile.right(1).find("/",0,TRUE) == -1) 1289 if(destFile.right(1).find("/",0,TRUE) == -1)
1291 destFile+="/"; 1290 destFile+="/";
1292 destFile +=(*it); 1291 destFile +=(*it);
1293 qDebug("Destination file is "+destFile); 1292 qDebug("Destination file is "+destFile);
1294 curFile = currentDir.canonicalPath(); 1293 curFile = currentDir.canonicalPath();
1295 if(curFile.right(1).find("/",0,TRUE) == -1) 1294 if(curFile.right(1).find("/",0,TRUE) == -1)
1296 curFile +="/"; 1295 curFile +="/";
1297 curFile+=(*it); 1296 curFile+=(*it);
1298 1297
1299 QFile f(destFile); 1298 QFile f(destFile);
1300 if( f.exists()) 1299 if( f.exists())
1301 f.remove(); 1300 f.remove();
1302 if(!copyFile(destFile, curFile) ) { 1301 if(!copyFile(destFile, curFile) ) {
1303 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); 1302 QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
1304 return; 1303 return;
1305 } 1304 }
1306 QFile::remove(curFile); 1305 QFile::remove(curFile);
1307 TabWidget->setCurrentPage(0); 1306 TabWidget->setCurrentPage(0);
1308 } 1307 }
1309 } 1308 }
1310 populateRemoteView(); 1309 populateRemoteView();
1311 populateLocalView(); 1310 populateLocalView();
1312 } 1311 }
1313 1312
1314 bool AdvancedFm::copyFile( const QString & dest, const QString & src ) 1313 bool AdvancedFm::copyFile( const QString & dest, const QString & src )
1315{ 1314{
1316 char bf[ 50000 ]; 1315 char bf[ 50000 ];
1317 int bytesRead; 1316 int bytesRead;
1318 bool success = TRUE; 1317 bool success = TRUE;
1319 struct stat status; 1318 struct stat status;
1320 1319
1321 QFile s( src ); 1320 QFile s( src );
1322 QFile d( dest ); 1321 QFile d( dest );
1323 1322
1324 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { 1323 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) {
1325 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { 1324 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) {
1326 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 1325 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
1327 success = FALSE; 1326 success = FALSE;
1328 break; 1327 break;
1329 } 1328 }
1330 } 1329 }
1331 if( success && (bytesRead > 0) ){ 1330 if( success && (bytesRead > 0) ){
1332 d.writeBlock( bf, bytesRead ); 1331 d.writeBlock( bf, bytesRead );
1333 } 1332 }
1334 } else { 1333 } else {
1335 success = FALSE; 1334 success = FALSE;
1336 } 1335 }
1337 1336
1338 // Set file permissions 1337 // Set file permissions
1339 if( stat( (const char *) src, &status ) == 0 ){ 1338 if( stat( (const char *) src, &status ) == 0 ){
1340 chmod( (const char *) dest, status.st_mode ); 1339 chmod( (const char *) dest, status.st_mode );
1341 } 1340 }
1342 1341
1343 return success; 1342 return success;
1344} 1343}
1345 1344
1346void AdvancedFm::runCommand() { 1345void AdvancedFm::runCommand() {
1347 QString curFile; 1346 QString curFile;
1348 if (TabWidget->currentPageIndex() == 0) { 1347 if (TabWidget->currentPageIndex() == 0) {
1349 if( Local_View->currentItem()) 1348 if( Local_View->currentItem())
1350 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); 1349 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1351 } else { 1350 } else {
1352 if(Remote_View->currentItem()) 1351 if(Remote_View->currentItem())
1353 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); 1352 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
1354 } 1353 }
1355 1354
1356 InputDialog *fileDlg; 1355 InputDialog *fileDlg;
1357 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1356 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1358 fileDlg->setInputText(curFile); 1357 fileDlg->setInputText(curFile);
1359 fileDlg->exec(); 1358 fileDlg->exec();
1360 QString command; 1359 QString command;
1361 if( fileDlg->result() == 1 ) { 1360 if( fileDlg->result() == 1 ) {
1362 command = fileDlg->LineEdit1->text(); 1361 command = fileDlg->LineEdit1->text();
1363 1362
1364// int err=0; 1363// int err=0;
1365 Output *outDlg; 1364 Output *outDlg;
1366 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1365 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1367 outDlg->showMaximized(); 1366 outDlg->showMaximized();
1368 outDlg->show(); 1367 outDlg->show();
1369 qApp->processEvents(); 1368 qApp->processEvents();
1370 FILE *fp; 1369 FILE *fp;
1371 char line[130]; 1370 char line[130];
1372 sleep(1); 1371 sleep(1);
1373// if(command.find("2>",0,TRUE) != -1) 1372// if(command.find("2>",0,TRUE) != -1)
1374 command +=" 2>&1"; 1373 command +=" 2>&1";
1375 fp = popen( (const char *) command, "r"); 1374 fp = popen( (const char *) command, "r");
1376 if ( !fp ) { 1375 if ( !fp ) {
1377 qDebug("Could not execute '" + command + "'! err=%d", fp); 1376 qDebug("Could not execute '" + command + "'! err=%d", fp);
1378 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1377 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1379 pclose(fp); 1378 pclose(fp);
1380 return; 1379 return;
1381 } else { 1380 } else {
1382 while ( fgets( line, sizeof line, fp)) { 1381 while ( fgets( line, sizeof line, fp)) {
1383 QString lineStr = line; 1382 QString lineStr = line;
1384 lineStr=lineStr.left(lineStr.length()-1); 1383 lineStr=lineStr.left(lineStr.length()-1);
1385 outDlg->OutputEdit->append(lineStr); 1384 outDlg->OutputEdit->append(lineStr);
1386 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1385 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1387 } 1386 }
1388 } 1387 }
1389 } 1388 }
1390} 1389}
1391 1390
1392void AdvancedFm::runCommandStd() { 1391void AdvancedFm::runCommandStd() {
1393 QString curFile; 1392 QString curFile;
1394 if (TabWidget->currentPageIndex() == 0) { 1393 if (TabWidget->currentPageIndex() == 0) {
1395 if( Local_View->currentItem()) 1394 if( Local_View->currentItem())
1396 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); 1395 curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0);
1397 } else { 1396 } else {
1398 if(Remote_View->currentItem()) 1397 if(Remote_View->currentItem())
1399 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); 1398 curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0);
1400 } 1399 }
1401 1400
1402 InputDialog *fileDlg; 1401 InputDialog *fileDlg;
1403 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1402 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1404 fileDlg->setInputText(curFile); 1403 fileDlg->setInputText(curFile);
1405 fileDlg->exec(); 1404 fileDlg->exec();
1406 QString command; 1405 QString command;
1407 if( fileDlg->result() == 1 ) { 1406 if( fileDlg->result() == 1 ) {
1408 qApp->processEvents(); 1407 qApp->processEvents();
1409 command = fileDlg->LineEdit1->text() + " &"; 1408 command = fileDlg->LineEdit1->text() + " &";
1410 system(command.latin1()); 1409 system(command.latin1());
1411 } 1410 }
1412} 1411}
1413 1412
1414void AdvancedFm::fileStatus() { 1413void AdvancedFm::fileStatus() {
1415 QString curFile; 1414 QString curFile;
1416 if (TabWidget->currentPageIndex() == 0) { 1415 if (TabWidget->currentPageIndex() == 0) {
1417 curFile = Local_View->currentItem()->text(0); 1416 curFile = Local_View->currentItem()->text(0);
1418 } else { 1417 } else {
1419 curFile = Remote_View->currentItem()->text(0); 1418 curFile = Remote_View->currentItem()->text(0);
1420 } 1419 }
1421 QString command = " stat -l "+ curFile +" 2>&1"; 1420 QString command = " stat -l "+ curFile +" 2>&1";
1422// int err=0; 1421// int err=0;
1423 Output *outDlg; 1422 Output *outDlg;
1424 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1423 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1425 outDlg->showMaximized(); 1424 outDlg->showMaximized();
1426 outDlg->show(); 1425 outDlg->show();
1427 qApp->processEvents(); 1426 qApp->processEvents();
1428 FILE *fp; 1427 FILE *fp;
1429 char line[130]; 1428 char line[130];
1430 sleep(1); 1429 sleep(1);
1431 fp = popen( (const char *) command, "r"); 1430 fp = popen( (const char *) command, "r");
1432 if ( !fp ) { 1431 if ( !fp ) {
1433 qDebug("Could not execute '" + command + "'! err=%d", fp); 1432 qDebug("Could not execute '" + command + "'! err=%d", fp);
1434 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); 1433 QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") );
1435 pclose(fp); 1434 pclose(fp);
1436 return; 1435 return;
1437 } else { 1436 } else {
1438 while ( fgets( line, sizeof line, fp)) { 1437 while ( fgets( line, sizeof line, fp)) {
1439 outDlg->OutputEdit->append(line); 1438 outDlg->OutputEdit->append(line);
1440 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1439 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1441 1440
1442 } 1441 }
1443 1442
1444 } 1443 }
1445} 1444}
1446 1445
1447void AdvancedFm::mkDir() { 1446void AdvancedFm::mkDir() {
1448 if (TabWidget->currentPageIndex() == 0) 1447 if (TabWidget->currentPageIndex() == 0)
1449 localMakDir(); 1448 localMakDir();
1450 else 1449 else
1451 remoteMakDir(); 1450 remoteMakDir();
1452 1451
1453} 1452}
1454 1453
1455void AdvancedFm::rn() { 1454void AdvancedFm::rn() {
1456 if (TabWidget->currentPageIndex() == 0) 1455 if (TabWidget->currentPageIndex() == 0)
1457 localRename(); 1456 localRename();
1458 else 1457 else
1459 remoteRename(); 1458 remoteRename();
1460 1459
1461} 1460}
1462 1461
1463void AdvancedFm::del() { 1462void AdvancedFm::del() {
1464 if (TabWidget->currentPageIndex() == 0) 1463 if (TabWidget->currentPageIndex() == 0)
1465 localDelete(); 1464 localDelete();
1466 else 1465 else
1467 remoteDelete(); 1466 remoteDelete();
1468} 1467}
1469 1468
1470void AdvancedFm::doAbout() { 1469void AdvancedFm::doAbout() {
1471 QMessageBox::message("AdvancedFm","Advanced FileManager\n" 1470 QMessageBox::message("AdvancedFm","Advanced FileManager\n"
1472 "is copyright 2002 by\n" 1471 "is copyright 2002 by\n"
1473 "L.J.Potter<llornkcor@handhelds.org>\n" 1472 "L.J.Potter<llornkcor@handhelds.org>\n"
1474 "and is licensed by the GPL"); 1473 "and is licensed by the GPL");
1475} 1474}
1476 1475
1477void AdvancedFm::keyReleaseEvent( QKeyEvent *e) 1476void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
1478{ 1477{
1479 switch ( e->key() ) { 1478 switch ( e->key() ) {
1480 case Key_Delete: 1479 case Key_Delete:
1481 del(); 1480 del();
1482 break; 1481 break;
1483 case Key_H: 1482 case Key_H:
1484 showHidden(); 1483 showHidden();
1485 break; 1484 break;
1486 case Key_E: 1485 case Key_E:
1487 runThis(); 1486 runThis();
1488 break; 1487 break;
1489 case Key_C: 1488 case Key_C:
1490 copy(); 1489 copy();
1491 break; 1490 break;
1492 case Key_A: 1491 case Key_A:
1493 copyAs(); 1492 copyAs();
1494 break; 1493 break;
1495 case Key_M: 1494 case Key_M:
1496 move(); 1495 move();
1497 break; 1496 break;
1498 case Key_R: 1497 case Key_R:
1499 rn(); 1498 rn();
1500 break; 1499 break;
1501 case Key_I: 1500 case Key_I:
1502 fileStatus(); 1501 fileStatus();
1503 break; 1502 break;
1504 case Key_U: 1503 case Key_U:
1505 upDir(); 1504 upDir();
1506 break; 1505 break;
1507 case Key_P: 1506 case Key_P:
1508 filePerms(); 1507 filePerms();
1509 break; 1508 break;
1510 case Key_N: 1509 case Key_N:
1511 mkDir(); 1510 mkDir();
1512 break; 1511 break;
1513 case Key_1: 1512 case Key_1:
1514 switchToLocalTab(); 1513 switchToLocalTab();
1515 break; 1514 break;
1516 case Key_2: 1515 case Key_2:
1517 switchToRemoteTab(); 1516 switchToRemoteTab();
1518 break; 1517 break;
1519 case Key_3: 1518 case Key_3:
1520 CFButtonPushed(); 1519 CFButtonPushed();
1521 break; 1520 break;
1522 case Key_4: 1521 case Key_4:
1523 SDButtonPushed(); 1522 SDButtonPushed();
1524 break; 1523 break;
1525 case Key_5: 1524 case Key_5:
1526 homeButtonPushed(); 1525 homeButtonPushed();
1527 break; 1526 break;
1528 case Key_6: 1527 case Key_6:
1529 docButtonPushed(); 1528 docButtonPushed();
1530 break; 1529 break;
1531 case Key_7: 1530 case Key_7:
1532 break; 1531 break;
1533 case Key_8: 1532 case Key_8:
1534 break; 1533 break;
1535 case Key_9: 1534 case Key_9:
1536 break; 1535 break;
1537 case Key_0: 1536 case Key_0:
1538 break; 1537 break;
1539 } 1538 }
1540} 1539}
1541 1540
1542void AdvancedFm::mkSym() { 1541void AdvancedFm::mkSym() {
1543 QString cmd; 1542 QString cmd;
1544 QStringList curFileList = getPath(); 1543 QStringList curFileList = getPath();
1545 1544
1546 if (TabWidget->currentPageIndex() == 0) { 1545 if (TabWidget->currentPageIndex() == 0) {
1547 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1546 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1548 1547
1549 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 1548 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
1550 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1549 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1551 cmd = "ln -s "+curFile+" "+destName; 1550 cmd = "ln -s "+curFile+" "+destName;
1552 qDebug(cmd); 1551 qDebug(cmd);
1553 system(cmd.latin1() ); 1552 system(cmd.latin1() );
1554 } 1553 }
1555 populateRemoteView(); 1554 populateRemoteView();
1556 TabWidget->setCurrentPage(1); 1555 TabWidget->setCurrentPage(1);
1557 } else { 1556 } else {
1558 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1557 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1559 1558
1560 QString destName = currentDir.canonicalPath()+"/"+(*it); 1559 QString destName = currentDir.canonicalPath()+"/"+(*it);
1561 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1560 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1562 1561
1563 cmd = "ln -s "+curFile+" "+destName; 1562 cmd = "ln -s "+curFile+" "+destName;
1564 qDebug(cmd); 1563 qDebug(cmd);
1565 system(cmd.latin1() ); 1564 system(cmd.latin1() );
1566 } 1565 }
1567 populateLocalView(); 1566 populateLocalView();
1568 TabWidget->setCurrentPage(0); 1567 TabWidget->setCurrentPage(0);
1569 } 1568 }
1570} 1569}
1571 1570
1572void AdvancedFm::QPEButtonPushed() { 1571void AdvancedFm::QPEButtonPushed() {
1573 QString current = QPEApplication::qpeDir(); 1572 QString current = QPEApplication::qpeDir();
1574 chdir( current.latin1() ); 1573 chdir( current.latin1() );
1575 if (TabWidget->currentPageIndex() == 0) { 1574 if (TabWidget->currentPageIndex() == 0) {
1576 currentDir.cd( current, TRUE); 1575 currentDir.cd( current, TRUE);
1577 populateLocalView(); 1576 populateLocalView();
1578 } else { 1577 } else {
1579 currentRemoteDir.cd( current, TRUE); 1578 currentRemoteDir.cd( current, TRUE);
1580 populateRemoteView(); 1579 populateRemoteView();
1581 } 1580 }
1582 update(); 1581 update();
1583} 1582}
1584 1583
1585void AdvancedFm::parsetab(const QString &fileName) { 1584void AdvancedFm::parsetab(const QString &fileName) {
1586 1585
1587 fileSystemTypeList.clear(); 1586 fileSystemTypeList.clear();
1588 fsList.clear(); 1587 fsList.clear();
1589 struct mntent *me; 1588 struct mntent *me;
1590// if(fileName == "/etc/mtab") { 1589// if(fileName == "/etc/mtab") {
1591 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 1590 FILE *mntfp = setmntent( fileName.latin1(), "r" );
1592 if ( mntfp ) { 1591 if ( mntfp ) {
1593 while ( (me = getmntent( mntfp )) != 0 ) { 1592 while ( (me = getmntent( mntfp )) != 0 ) {
1594 QString deviceName = me->mnt_fsname; 1593 QString deviceName = me->mnt_fsname;
1595 QString filesystemType = me->mnt_type; 1594 QString filesystemType = me->mnt_type;
1596 QString mountDir = me->mnt_dir; 1595 QString mountDir = me->mnt_dir;
1597 if(deviceName != "none") { 1596 if(deviceName != "none") {
1598 if( fsList.contains(filesystemType) == 0 1597 if( fsList.contains(filesystemType) == 0
1599 & filesystemType.find("proc",0,TRUE) == -1 1598 & filesystemType.find("proc",0,TRUE) == -1
1600 & filesystemType.find("cramfs",0,TRUE) == -1 1599 & filesystemType.find("cramfs",0,TRUE) == -1
1601 & filesystemType.find("auto",0,TRUE) == -1) 1600 & filesystemType.find("auto",0,TRUE) == -1)
1602 fsList << filesystemType; 1601 fsList << filesystemType;
1603// deviceList << deviceName; 1602// deviceList << deviceName;
1604// qDebug(mountDir+"::"+filesystemType); 1603// qDebug(mountDir+"::"+filesystemType);
1605 fileSystemTypeList << mountDir+"::"+filesystemType; 1604 fileSystemTypeList << mountDir+"::"+filesystemType;
1606 } 1605 }
1607 } 1606 }
1608 } 1607 }
1609 endmntent( mntfp ); 1608 endmntent( mntfp );
1610} 1609}
1611 1610
1612QString AdvancedFm::getFileSystemType(const QString &currentText) { 1611QString AdvancedFm::getFileSystemType(const QString &currentText) {
1613 parsetab("/etc/mtab"); //why did TT forget filesystem type? 1612 parsetab("/etc/mtab"); //why did TT forget filesystem type?
1614 QString current = currentText;//.right( currentText.length()-1); 1613 QString current = currentText;//.right( currentText.length()-1);
1615 QString baseFs; 1614 QString baseFs;
1616 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 1615 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
1617 QString temp = (*it); 1616 QString temp = (*it);
1618 QString path = temp.left(temp.find("::",0,TRUE) ); 1617 QString path = temp.left(temp.find("::",0,TRUE) );
1619 path = path.right( path.length()-1); 1618 path = path.right( path.length()-1);
1620 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1619 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1621 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 1620 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
1622 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1621 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1623 } 1622 }
1624 } 1623 }
1625 return baseFs; 1624 return baseFs;
1626} 1625}
1627 1626
1628 1627
1629// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 1628// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1630// QListViewItemIterator it( Local_View ); 1629// QListViewItemIterator it( Local_View );
1631// for ( ; it.current(); ++it ) { 1630// for ( ; it.current(); ++it ) {
1632// if ( it.current()->isSelected() ) { 1631// if ( it.current()->isSelected() ) {
1633// QString strItem = it.current()->text(0); 1632// QString strItem = it.current()->text(0);
1634// QString localFile = currentDir.canonicalPath()+"/"+strItem; 1633// QString localFile = currentDir.canonicalPath()+"/"+strItem;
1635// QFileInfo fi(localFile); 1634// QFileInfo fi(localFile);
1636// } 1635// }
1637// } 1636// }