summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-28 19:13:02 (UTC)
committer llornkcor <llornkcor>2002-07-28 19:13:02 (UTC)
commit46e20578c1cf19a964d7f4591eaebb879c6f20f5 (patch) (unidiff)
treeb1a24972314e9719fbe21a1f351cfb9c3947da6e
parentb251444c6eb50d8b80f7a79cef8930f401a2ff4d (diff)
downloadopie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.zip
opie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.tar.gz
opie-46e20578c1cf19a964d7f4591eaebb879c6f20f5.tar.bz2
added freespace for current disk in caption
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp32
-rw-r--r--noncore/apps/advancedfm/advancedfm.h2
2 files changed, 29 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 96a2d0a..16dc7da 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1,917 +1,919 @@
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 <opie/ofileselector.h> 20#include <opie/ofileselector.h>
21#include <opie/ofiledialog.h> 21#include <opie/ofiledialog.h>
22 22
23 23
24#include <qpe/lnkproperties.h> 24#include <qpe/lnkproperties.h>
25#include <qpe/filemanager.h> 25#include <qpe/filemanager.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27#include <qpe/qpemenubar.h> 27#include <qpe/qpemenubar.h>
28#include <qpe/qpetoolbar.h> 28#include <qpe/qpetoolbar.h>
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <qpe/mimetype.h> 33#include <qpe/mimetype.h>
34#include <qpe/applnk.h> 34#include <qpe/applnk.h>
35#include <qpe/ir.h> 35#include <qpe/ir.h>
36 36
37//#include <opie/ofileselector.h> 37//#include <opie/ofileselector.h>
38#include <qmultilineedit.h> 38#include <qmultilineedit.h>
39 39
40#include <qtextstream.h> 40#include <qtextstream.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qtoolbutton.h> 42#include <qtoolbutton.h>
43#include <qdatetime.h> 43#include <qdatetime.h>
44#include <qdir.h> 44#include <qdir.h>
45#include <qfile.h> 45#include <qfile.h>
46#include <qstring.h> 46#include <qstring.h>
47#include <qcombobox.h> 47#include <qcombobox.h>
48#include <qpopupmenu.h> 48#include <qpopupmenu.h>
49#include <qlistview.h> 49#include <qlistview.h>
50#include <qmainwindow.h> 50#include <qmainwindow.h>
51#include <qlabel.h> 51#include <qlabel.h>
52#include <qprogressbar.h> 52#include <qprogressbar.h>
53#include <qspinbox.h> 53#include <qspinbox.h>
54#include <qtabwidget.h> 54#include <qtabwidget.h>
55#include <qwidget.h> 55#include <qwidget.h>
56#include <qlayout.h> 56#include <qlayout.h>
57#include <qimage.h> 57#include <qimage.h>
58#include <qpixmap.h> 58#include <qpixmap.h>
59#include <qmessagebox.h> 59#include <qmessagebox.h>
60#include <qlineedit.h> 60#include <qlineedit.h>
61#include <qregexp.h> 61#include <qregexp.h>
62 62
63#include <unistd.h> 63#include <unistd.h>
64#include <stdlib.h> 64#include <stdlib.h>
65#include <sys/stat.h> 65#include <sys/stat.h>
66#include <dirent.h> 66#include <dirent.h>
67#include <stdio.h> 67#include <stdio.h>
68#include <time.h> 68#include <time.h>
69#include <fcntl.h> 69#include <fcntl.h>
70#include <mntent.h> 70#include <mntent.h>
71#include <string.h> 71#include <string.h>
72#include <errno.h> 72#include <errno.h>
73#include <sys/vfs.h>
74#include <mntent.h>
73 75
74AdvancedFm::AdvancedFm( ) 76AdvancedFm::AdvancedFm( )
75 : QMainWindow( ) 77 : QMainWindow( )
76{ 78{
77 setCaption( tr( "AdvancedFm" ) ); 79 setCaption( tr( "AdvancedFm" ) );
78 80
79 QGridLayout *layout = new QGridLayout( this ); 81 QGridLayout *layout = new QGridLayout( this );
80 layout->setSpacing( 2); 82 layout->setSpacing( 2);
81 layout->setMargin( 2); 83 layout->setMargin( 2);
82 84
83 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 85 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
84 86
85 QPEMenuBar *menuBar = new QPEMenuBar(this); 87 QPEMenuBar *menuBar = new QPEMenuBar(this);
86 fileMenu = new QPopupMenu( this ); 88 fileMenu = new QPopupMenu( this );
87 viewMenu = new QPopupMenu( this ); 89 viewMenu = new QPopupMenu( this );
88 90
89 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 91 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
90 92
91 menuBar->insertItem( tr( "File" ), fileMenu); 93 menuBar->insertItem( tr( "File" ), fileMenu);
92 menuBar->insertItem( tr( "View" ), viewMenu); 94 menuBar->insertItem( tr( "View" ), viewMenu);
93 95
94 qpeDirButton= new QToolButton(this,"QPEButton"); 96 qpeDirButton= new QToolButton(this,"QPEButton");
95 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 97 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
96 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 98 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
97 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 99 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
98 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); 100 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
99 101
100 cfButton = new QToolButton( this,"CFButton"); 102 cfButton = new QToolButton( this,"CFButton");
101 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 103 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
102 cfButton ->setFixedSize( QSize( 20, 20 ) ); 104 cfButton ->setFixedSize( QSize( 20, 20 ) );
103 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 105 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
104 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); 106 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
105 107
106 sdButton = new QToolButton( this,"SDButton"); 108 sdButton = new QToolButton( this,"SDButton");
107 sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); 109 sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard"));
108 sdButton->setFixedSize( QSize( 20, 20 ) ); 110 sdButton->setFixedSize( QSize( 20, 20 ) );
109 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 111 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
110 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); 112 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
111 113
112 cdUpButton = new QToolButton( this,"cdUpButton"); 114 cdUpButton = new QToolButton( this,"cdUpButton");
113 cdUpButton->setPixmap(Resource::loadPixmap("up")); 115 cdUpButton->setPixmap(Resource::loadPixmap("up"));
114 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 116 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
115 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 117 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
116 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); 118 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
117 119
118 docButton = new QToolButton( this,"docsButton"); 120 docButton = new QToolButton( this,"docsButton");
119 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 121 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
120 docButton->setFixedSize( QSize( 20, 20 ) ); 122 docButton->setFixedSize( QSize( 20, 20 ) );
121 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 123 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
122 layout->addMultiCellWidget( docButton, 0, 0, 6, 6); 124 layout->addMultiCellWidget( docButton, 0, 0, 6, 6);
123 125
124 homeButton = new QToolButton( this,"homeButton"); 126 homeButton = new QToolButton( this,"homeButton");
125 homeButton->setPixmap(Resource::loadPixmap("home")); 127 homeButton->setPixmap(Resource::loadPixmap("home"));
126 homeButton->setFixedSize( QSize( 20, 20 ) ); 128 homeButton->setFixedSize( QSize( 20, 20 ) );
127 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 129 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
128 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); 130 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
129 131
130 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 132 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
131 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 133 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
132 fileMenu->insertSeparator(); 134 fileMenu->insertSeparator();
133 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 135 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
134 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 136 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
135 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 137 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
136 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 138 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
137 fileMenu->insertSeparator(); 139 fileMenu->insertSeparator();
138 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 140 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
139 fileMenu->setCheckable(TRUE); 141 fileMenu->setCheckable(TRUE);
140 142
141 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); 143 viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
142 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); 144 viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
143 viewMenu->insertSeparator(); 145 viewMenu->insertSeparator();
144 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); 146 viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
145 viewMenu->setCheckable(TRUE); 147 viewMenu->setCheckable(TRUE);
146 148
147 149
148 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 150 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
149 currentPathCombo->setEditable(TRUE); 151 currentPathCombo->setEditable(TRUE);
150 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 152 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
151 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 153 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
152 154
153 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 155 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
154 this, SLOT( currentPathComboActivated( const QString & ) ) ); 156 this, SLOT( currentPathComboActivated( const QString & ) ) );
155 157
156 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 158 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
157 this,SLOT(currentPathComboChanged())); 159 this,SLOT(currentPathComboChanged()));
158 160
159 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 161 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
160 162
161 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 163 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
162 164
163 165
164 TabWidget = new QTabWidget( this, "TabWidget" ); 166 TabWidget = new QTabWidget( this, "TabWidget" );
165 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); 167 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
166 168
167 tab = new QWidget( TabWidget, "tab" ); 169 tab = new QWidget( TabWidget, "tab" );
168 tabLayout = new QGridLayout( tab ); 170 tabLayout = new QGridLayout( tab );
169 tabLayout->setSpacing( 2); 171 tabLayout->setSpacing( 2);
170 tabLayout->setMargin( 2); 172 tabLayout->setMargin( 2);
171 173
172 Local_View = new QListView( tab, "Local_View" ); 174 Local_View = new QListView( tab, "Local_View" );
173 Local_View->addColumn( tr("File"),130); 175 Local_View->addColumn( tr("File"),130);
174 Local_View->addColumn( tr("Size"),-1); 176 Local_View->addColumn( tr("Size"),-1);
175 Local_View->setColumnAlignment(1,QListView::AlignRight); 177 Local_View->setColumnAlignment(1,QListView::AlignRight);
176 Local_View->addColumn( tr("Date"),-1); 178 Local_View->addColumn( tr("Date"),-1);
177 Local_View->setColumnAlignment(2,QListView::AlignRight); 179 Local_View->setColumnAlignment(2,QListView::AlignRight);
178 Local_View->setAllColumnsShowFocus(TRUE); 180 Local_View->setAllColumnsShowFocus(TRUE);
179 Local_View->setMultiSelection( TRUE ); 181 Local_View->setMultiSelection( TRUE );
180 Local_View->setSelectionMode(QListView::Extended); 182 Local_View->setSelectionMode(QListView::Extended);
181 183
182 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 184 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
183 185
184 tabLayout->addWidget( Local_View, 0, 0 ); 186 tabLayout->addWidget( Local_View, 0, 0 );
185 187
186 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 188 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
187 this,SLOT( localListClicked(QListViewItem *)) ); 189 this,SLOT( localListClicked(QListViewItem *)) );
188 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 190 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
189 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 191 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
190 192
191 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 193 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
192 194
193 TabWidget->insertTab( tab, tr("1")); 195 TabWidget->insertTab( tab, tr("1"));
194 196
195 tab_2 = new QWidget( TabWidget, "tab_2" ); 197 tab_2 = new QWidget( TabWidget, "tab_2" );
196 tabLayout_2 = new QGridLayout( tab_2 ); 198 tabLayout_2 = new QGridLayout( tab_2 );
197 tabLayout_2->setSpacing( 2); 199 tabLayout_2->setSpacing( 2);
198 tabLayout_2->setMargin( 2); 200 tabLayout_2->setMargin( 2);
199 201
200 Remote_View = new QListView( tab_2, "Remote_View" ); 202 Remote_View = new QListView( tab_2, "Remote_View" );
201 Remote_View->addColumn( tr("File"),130); 203 Remote_View->addColumn( tr("File"),130);
202 Remote_View->addColumn( tr("Size"),-1); 204 Remote_View->addColumn( tr("Size"),-1);
203 Remote_View->setColumnAlignment(1,QListView::AlignRight); 205 Remote_View->setColumnAlignment(1,QListView::AlignRight);
204 Remote_View->addColumn( tr("Date"),-1); 206 Remote_View->addColumn( tr("Date"),-1);
205 Remote_View->setColumnAlignment(2,QListView::AlignRight); 207 Remote_View->setColumnAlignment(2,QListView::AlignRight);
206 Remote_View->setAllColumnsShowFocus(TRUE); 208 Remote_View->setAllColumnsShowFocus(TRUE);
207 Remote_View->setMultiSelection( TRUE ); 209 Remote_View->setMultiSelection( TRUE );
208 Remote_View->setSelectionMode(QListView::Extended); 210 Remote_View->setSelectionMode(QListView::Extended);
209 211
210 212
211 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 213 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
212 214
213 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 215 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
214 this,SLOT( remoteListClicked(QListViewItem *)) ); 216 this,SLOT( remoteListClicked(QListViewItem *)) );
215 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 217 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
216 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 218 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
217 219
218 tabLayout_2->addWidget( Remote_View, 0, 0 ); 220 tabLayout_2->addWidget( Remote_View, 0, 0 );
219 221
220 222
221 TabWidget->insertTab( tab_2, tr( "2")); 223 TabWidget->insertTab( tab_2, tr( "2"));
222 224
223 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 225 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
224 this,SLOT(tabChanged(QWidget*))); 226 this,SLOT(tabChanged(QWidget*)));
225 227
226 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 228 /* tab_3 = new QWidget( TabWidget, "tab_3" );
227 tabLayout_3 = new QGridLayout( tab_3 ); 229 tabLayout_3 = new QGridLayout( tab_3 );
228 tabLayout_3->setSpacing( 2); 230 tabLayout_3->setSpacing( 2);
229 tabLayout_3->setMargin( 2); 231 tabLayout_3->setMargin( 2);
230 232
231 233
232 // OFileDialog fileDialog; 234 // OFileDialog fileDialog;
233 // fileDialog; 235 // fileDialog;
234 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy 236 // fileSelector = new FileSelector( "*",tab_3, "fileselector" , FALSE, FALSE); //buggy
235 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow"); 237 // fileDialog = new OFileDialog("bangalow", tab_3, 4, 2, "Bungalow");
236 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/"); 238 // OFileSelector fileDialog = new OFileSelector( tab_3, 4, 2,"/");
237 239
238 QListView *fileTree; 240 QListView *fileTree;
239 fileTree = new QListView( tab_3, "tree" ); 241 fileTree = new QListView( tab_3, "tree" );
240 242
241 243
242 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 244 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
243 245
244 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 246 TabWidget->insertTab( tab_3, tr( "Remote" ) );
245 */ 247 */
246 248
247 /////////////// 249 ///////////////
248 250
249 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 251 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
250 currentDir.setPath( QDir::currentDirPath()); 252 currentDir.setPath( QDir::currentDirPath());
251 253
252 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 254 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
253 currentRemoteDir.setPath( QDir::currentDirPath()); 255 currentRemoteDir.setPath( QDir::currentDirPath());
254 256
255 b = TRUE; 257 b = TRUE;
256 258
257 filterStr="*"; 259 filterStr="*";
258 b=FALSE; 260 b=FALSE;
259 261
260 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 262 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
261 263
262 populateLocalView(); 264 populateLocalView();
263 populateRemoteView(); 265 populateRemoteView();
264 currentPathCombo->setFocus(); 266 currentPathCombo->setFocus();
265} 267}
266 268
267AdvancedFm::~AdvancedFm() 269AdvancedFm::~AdvancedFm()
268{ 270{
269} 271}
270 272
271void AdvancedFm::cleanUp() 273void AdvancedFm::cleanUp()
272{ 274{
273 QString sfile=QDir::homeDirPath(); 275 QString sfile=QDir::homeDirPath();
274 if(sfile.right(1) != "/") 276 if(sfile.right(1) != "/")
275 sfile+="/._temp"; 277 sfile+="/._temp";
276 else 278 else
277 sfile+="._temp"; 279 sfile+="._temp";
278 QFile file( sfile); 280 QFile file( sfile);
279 if(file.exists()) 281 if(file.exists())
280 file.remove(); 282 file.remove();
281} 283}
282 284
283void AdvancedFm::tabChanged(QWidget *w) 285void AdvancedFm::tabChanged(QWidget *w)
284{ 286{
285 if (TabWidget->currentPageIndex() == 0) { 287 if (TabWidget->currentPageIndex() == 0) {
286 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 288 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
287 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 289 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
288 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 290 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
289 } 291 }
290 if (TabWidget->currentPageIndex() == 1) { 292 if (TabWidget->currentPageIndex() == 1) {
291 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 293 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
292 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 294 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
293 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 295 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
294 } 296 }
295} 297}
296 298
297 299
298void AdvancedFm::populateLocalView() 300void AdvancedFm::populateLocalView()
299{ 301{
300 QPixmap pm; 302 QPixmap pm;
301 Local_View->clear(); 303 Local_View->clear();
302 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 304 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
303 currentDir.setMatchAllDirs(TRUE); 305 currentDir.setMatchAllDirs(TRUE);
304 currentDir.setNameFilter(filterStr); 306 currentDir.setNameFilter(filterStr);
305 QString fileL, fileS, fileDate; 307 QString fileL, fileS, fileDate;
306 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 308 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
307 setCaption("AdvancedFm :: "+fs); 309 setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" );
308 bool isDir=FALSE; 310 bool isDir=FALSE;
309 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 311 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
310 QFileInfoListIterator it(*list); 312 QFileInfoListIterator it(*list);
311 QFileInfo *fi; 313 QFileInfo *fi;
312 while ( (fi=it.current()) ) { 314 while ( (fi=it.current()) ) {
313 if (fi->isSymLink() ) { 315 if (fi->isSymLink() ) {
314 QString symLink=fi->readLink(); 316 QString symLink=fi->readLink();
315 QFileInfo sym( symLink); 317 QFileInfo sym( symLink);
316 fileS.sprintf( "%10li", sym.size() ); 318 fileS.sprintf( "%10li", sym.size() );
317 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 319 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
318 fileDate = sym.lastModified().toString(); 320 fileDate = sym.lastModified().toString();
319 } else { 321 } else {
320 fileS.sprintf( "%10li", fi->size() ); 322 fileS.sprintf( "%10li", fi->size() );
321 fileL.sprintf( "%s",fi->fileName().data() ); 323 fileL.sprintf( "%s",fi->fileName().data() );
322 fileDate= fi->lastModified().toString(); 324 fileDate= fi->lastModified().toString();
323 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 325 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
324 fileL+="/"; 326 fileL+="/";
325 isDir=TRUE; 327 isDir=TRUE;
326 } 328 }
327 } 329 }
328 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 330 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
329 if(fileL !="./" && fi->exists()) { 331 if(fileL !="./" && fi->exists()) {
330 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 332 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
331 333
332 if(isDir || fileL.find("/",0,TRUE) != -1) { 334 if(isDir || fileL.find("/",0,TRUE) != -1) {
333 335
334 if( !QDir( fi->filePath() ).isReadable()) //is directory 336 if( !QDir( fi->filePath() ).isReadable()) //is directory
335 pm = Resource::loadPixmap( "lockedfolder" ); 337 pm = Resource::loadPixmap( "lockedfolder" );
336 else 338 else
337 pm= Resource::loadPixmap( "folder" ); 339 pm= Resource::loadPixmap( "folder" );
338 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 340 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
339 pm = Resource::loadPixmap( "exec"); 341 pm = Resource::loadPixmap( "exec");
340 } else if( (fileInfo.permission( QFileInfo::ExeUser) 342 } else if( (fileInfo.permission( QFileInfo::ExeUser)
341 | fileInfo.permission( QFileInfo::ExeGroup) 343 | fileInfo.permission( QFileInfo::ExeGroup)
342 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 344 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
343 pm = Resource::loadPixmap( "exec"); 345 pm = Resource::loadPixmap( "exec");
344 } else if( !fi->isReadable() ) { 346 } else if( !fi->isReadable() ) {
345 pm = Resource::loadPixmap( "locked" ); 347 pm = Resource::loadPixmap( "locked" );
346 } else { //everything else goes by mimetype 348 } else { //everything else goes by mimetype
347 MimeType mt(fi->filePath()); 349 MimeType mt(fi->filePath());
348 pm=mt.pixmap(); //sets the correct pixmap for mimetype 350 pm=mt.pixmap(); //sets the correct pixmap for mimetype
349 if(pm.isNull()) 351 if(pm.isNull())
350 pm = Resource::loadPixmap( "UnknownDocument-14" ); 352 pm = Resource::loadPixmap( "UnknownDocument-14" );
351 } 353 }
352 item->setPixmap( 0,pm); 354 item->setPixmap( 0,pm);
353 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 355 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
354 // overlay link image 356 // overlay link image
355 pm= Resource::loadPixmap( "folder" ); 357 pm= Resource::loadPixmap( "folder" );
356 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 358 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
357 QPainter painter( &pm ); 359 QPainter painter( &pm );
358 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 360 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
359 pm.setMask( pm.createHeuristicMask( FALSE ) ); 361 pm.setMask( pm.createHeuristicMask( FALSE ) );
360 item->setPixmap( 0, pm); 362 item->setPixmap( 0, pm);
361 } 363 }
362 } 364 }
363 isDir=FALSE; 365 isDir=FALSE;
364 ++it; 366 ++it;
365 } 367 }
366 368
367 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 369 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
368 struct stat buf; 370 struct stat buf;
369 dev_t devT; 371 dev_t devT;
370 DIR *dir; 372 DIR *dir;
371 struct dirent *mydirent; 373 struct dirent *mydirent;
372 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 374 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
373 while ((mydirent = readdir(dir)) != NULL) { 375 while ((mydirent = readdir(dir)) != NULL) {
374 lstat( mydirent->d_name, &buf); 376 lstat( mydirent->d_name, &buf);
375 qDebug(mydirent->d_name); 377 qDebug(mydirent->d_name);
376 fileL.sprintf("%s", mydirent->d_name); 378 fileL.sprintf("%s", mydirent->d_name);
377 devT = buf.st_dev; 379 devT = buf.st_dev;
378 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 380 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
379 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 381 fileDate.sprintf("%s", ctime( &buf.st_mtime));
380 if( fileL.find(".") == -1 ){ 382 if( fileL.find(".") == -1 ){
381 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 383 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
382 pm = Resource::loadPixmap( "UnknownDocument-14" ); 384 pm = Resource::loadPixmap( "UnknownDocument-14" );
383 item->setPixmap( 0,pm); 385 item->setPixmap( 0,pm);
384 } 386 }
385 } 387 }
386 388
387 closedir(dir); 389 closedir(dir);
388 } 390 }
389 391
390 Local_View->setSorting( 3,FALSE); 392 Local_View->setSorting( 3,FALSE);
391 fillCombo( (const QString &) currentDir.canonicalPath()); 393 fillCombo( (const QString &) currentDir.canonicalPath());
392} 394}
393 395
394 396
395void AdvancedFm::populateRemoteView() 397void AdvancedFm::populateRemoteView()
396{ 398{
397 QPixmap pm; 399 QPixmap pm;
398 Remote_View->clear(); 400 Remote_View->clear();
399 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 401 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
400 currentRemoteDir.setMatchAllDirs(TRUE); 402 currentRemoteDir.setMatchAllDirs(TRUE);
401 currentRemoteDir.setNameFilter(filterStr); 403 currentRemoteDir.setNameFilter(filterStr);
402 QString fileL, fileS, fileDate; 404 QString fileL, fileS, fileDate;
403 405
404 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 406 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
405 setCaption("AdvancedFm :: "+fs); 407 setCaption("AdvancedFm :: "+fs+" :: "+checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" );
406 bool isDir=FALSE; 408 bool isDir=FALSE;
407 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 409 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
408 QFileInfoListIterator it(*list); 410 QFileInfoListIterator it(*list);
409 QFileInfo *fi; 411 QFileInfo *fi;
410 while ( (fi=it.current()) ) { 412 while ( (fi=it.current()) ) {
411 if (fi->isSymLink() ){ 413 if (fi->isSymLink() ){
412 QString symLink=fi->readLink(); 414 QString symLink=fi->readLink();
413 // qDebug("Symlink detected "+symLink); 415 // qDebug("Symlink detected "+symLink);
414 QFileInfo sym( symLink); 416 QFileInfo sym( symLink);
415 fileS.sprintf( "%10li", sym.size() ); 417 fileS.sprintf( "%10li", sym.size() );
416 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 418 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
417 fileDate = sym.lastModified().toString(); 419 fileDate = sym.lastModified().toString();
418 } else { 420 } else {
419 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 421 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
420 fileS.sprintf( "%10li", fi->size() ); 422 fileS.sprintf( "%10li", fi->size() );
421 fileL.sprintf( "%s",fi->fileName().data() ); 423 fileL.sprintf( "%s",fi->fileName().data() );
422 fileDate= fi->lastModified().toString(); 424 fileDate= fi->lastModified().toString();
423 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 425 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
424 fileL+="/"; 426 fileL+="/";
425 isDir=TRUE; 427 isDir=TRUE;
426 // qDebug( fileL); 428 // qDebug( fileL);
427 } 429 }
428 } 430 }
429 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); 431 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL);
430 if(fileL !="./" && fi->exists()) { 432 if(fileL !="./" && fi->exists()) {
431 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 433 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
432 QPixmap pm; 434 QPixmap pm;
433 435
434 if(isDir || fileL.find("/",0,TRUE) != -1) { 436 if(isDir || fileL.find("/",0,TRUE) != -1) {
435 if( !QDir( fi->filePath() ).isReadable()) 437 if( !QDir( fi->filePath() ).isReadable())
436 pm = Resource::loadPixmap( "lockedfolder" ); 438 pm = Resource::loadPixmap( "lockedfolder" );
437 else 439 else
438 pm= Resource::loadPixmap( "folder" ); 440 pm= Resource::loadPixmap( "folder" );
439 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 441 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
440 pm = Resource::loadPixmap( "exec"); 442 pm = Resource::loadPixmap( "exec");
441 } else if( (fileInfo.permission( QFileInfo::ExeUser) 443 } else if( (fileInfo.permission( QFileInfo::ExeUser)
442 | fileInfo.permission( QFileInfo::ExeGroup) 444 | fileInfo.permission( QFileInfo::ExeGroup)
443 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 445 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
444 pm = Resource::loadPixmap( "exec"); 446 pm = Resource::loadPixmap( "exec");
445 } else if( !fi->isReadable() ) { 447 } else if( !fi->isReadable() ) {
446 pm = Resource::loadPixmap( "locked" ); 448 pm = Resource::loadPixmap( "locked" );
447 } else { 449 } else {
448 MimeType mt(fi->filePath()); 450 MimeType mt(fi->filePath());
449 pm=mt.pixmap(); //sets the correct pixmap for mimetype 451 pm=mt.pixmap(); //sets the correct pixmap for mimetype
450 if(pm.isNull()) 452 if(pm.isNull())
451 pm = Resource::loadPixmap( "UnknownDocument-14" ); 453 pm = Resource::loadPixmap( "UnknownDocument-14" );
452 } 454 }
453 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 455 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
454 // overlay link image 456 // overlay link image
455 pm= Resource::loadPixmap( "folder" ); 457 pm= Resource::loadPixmap( "folder" );
456 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 458 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
457 QPainter painter( &pm ); 459 QPainter painter( &pm );
458 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 460 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
459 pm.setMask( pm.createHeuristicMask( FALSE ) ); 461 pm.setMask( pm.createHeuristicMask( FALSE ) );
460 } 462 }
461 item->setPixmap( 0, pm); 463 item->setPixmap( 0, pm);
462 } 464 }
463 isDir=FALSE; 465 isDir=FALSE;
464 ++it; 466 ++it;
465 } 467 }
466 468
467 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 469 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
468 struct stat buf; 470 struct stat buf;
469 DIR *dir; 471 DIR *dir;
470 struct dirent *mydirent; 472 struct dirent *mydirent;
471 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 473 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
472 while ((mydirent = readdir(dir)) != NULL) { 474 while ((mydirent = readdir(dir)) != NULL) {
473 lstat( mydirent->d_name, &buf); 475 lstat( mydirent->d_name, &buf);
474 qDebug(mydirent->d_name); 476 qDebug(mydirent->d_name);
475 fileL.sprintf("%s", mydirent->d_name); 477 fileL.sprintf("%s", mydirent->d_name);
476 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 478 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
477 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 479 fileDate.sprintf("%s", ctime( &buf.st_mtime));
478 if( fileL.find(".") == -1 ){ 480 if( fileL.find(".") == -1 ){
479 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 481 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
480 pm = Resource::loadPixmap( "UnknownDocument-14" ); 482 pm = Resource::loadPixmap( "UnknownDocument-14" );
481 item->setPixmap( 0,pm); 483 item->setPixmap( 0,pm);
482 } 484 }
483 } 485 }
484 486
485 closedir(dir); 487 closedir(dir);
486 } 488 }
487 489
488 Remote_View->setSorting( 3,FALSE); 490 Remote_View->setSorting( 3,FALSE);
489 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 491 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
490} 492}
491 493
492void AdvancedFm::localListClicked(QListViewItem *selectedItem) 494void AdvancedFm::localListClicked(QListViewItem *selectedItem)
493{ 495{
494 if(selectedItem) { 496 if(selectedItem) {
495 QString strItem=selectedItem->text(0); 497 QString strItem=selectedItem->text(0);
496 QString strSize=selectedItem->text(1); 498 QString strSize=selectedItem->text(1);
497 strSize=strSize.stripWhiteSpace(); 499 strSize=strSize.stripWhiteSpace();
498 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 500 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
499 // is symlink 501 // is symlink
500 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 502 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
501 if(QDir(strItem2).exists() ) { 503 if(QDir(strItem2).exists() ) {
502 currentDir.cd(strItem2, TRUE); 504 currentDir.cd(strItem2, TRUE);
503 populateLocalView(); 505 populateLocalView();
504 } 506 }
505 } else { // not a symlink 507 } else { // not a symlink
506 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 508 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
507 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 509 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
508 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 510 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
509 currentDir.cd(strItem,FALSE); 511 currentDir.cd(strItem,FALSE);
510 populateLocalView(); 512 populateLocalView();
511 } else { 513 } else {
512 currentDir.cdUp(); 514 currentDir.cdUp();
513 populateLocalView(); 515 populateLocalView();
514 } 516 }
515 if(QDir(strItem).exists()){ 517 if(QDir(strItem).exists()){
516 currentDir.cd(strItem, TRUE); 518 currentDir.cd(strItem, TRUE);
517 populateLocalView(); 519 populateLocalView();
518 } 520 }
519 } else { 521 } else {
520 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 522 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
521 if( QFile::exists(strItem ) ) { 523 if( QFile::exists(strItem ) ) {
522 // qDebug("clicked item "+strItem); 524 // qDebug("clicked item "+strItem);
523 // DocLnk doc( strItem, FALSE ); 525 // DocLnk doc( strItem, FALSE );
524 // doc.execute(); 526 // doc.execute();
525 // Local_View->clearSelection(); 527 // Local_View->clearSelection();
526 } 528 }
527 } //end not symlink 529 } //end not symlink
528 chdir(strItem.latin1()); 530 chdir(strItem.latin1());
529 } 531 }
530 } 532 }
531} 533}
532 534
533void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 535void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)
534{ 536{
535 if(selectedItem) { 537 if(selectedItem) {
536 QString strItem=selectedItem->text(0); 538 QString strItem=selectedItem->text(0);
537 QString strSize=selectedItem->text(1); 539 QString strSize=selectedItem->text(1);
538 strSize=strSize.stripWhiteSpace(); 540 strSize=strSize.stripWhiteSpace();
539 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 541 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
540 // is symlink 542 // is symlink
541 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 543 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
542 if(QDir(strItem2).exists() ) { 544 if(QDir(strItem2).exists() ) {
543 currentRemoteDir.cd(strItem2, TRUE); 545 currentRemoteDir.cd(strItem2, TRUE);
544 populateRemoteView(); 546 populateRemoteView();
545 } 547 }
546 } else { // not a symlink 548 } else { // not a symlink
547 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 549 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
548 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 550 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
549 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 551 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
550 currentRemoteDir.cd(strItem,FALSE); 552 currentRemoteDir.cd(strItem,FALSE);
551 populateRemoteView(); 553 populateRemoteView();
552 } else { 554 } else {
553 currentRemoteDir.cdUp(); 555 currentRemoteDir.cdUp();
554 populateRemoteView(); 556 populateRemoteView();
555 } 557 }
556 if(QDir(strItem).exists()){ 558 if(QDir(strItem).exists()){
557 currentRemoteDir.cd(strItem, TRUE); 559 currentRemoteDir.cd(strItem, TRUE);
558 populateRemoteView(); 560 populateRemoteView();
559 } 561 }
560 } else { 562 } else {
561 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 563 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
562 if( QFile::exists(strItem ) ) { 564 if( QFile::exists(strItem ) ) {
563 // qDebug("clicked item "+strItem); 565 // qDebug("clicked item "+strItem);
564 // DocLnk doc( strItem, FALSE ); 566 // DocLnk doc( strItem, FALSE );
565 // doc.execute(); 567 // doc.execute();
566 // Remote_View->clearSelection(); 568 // Remote_View->clearSelection();
567 } 569 }
568 } //end not symlink 570 } //end not symlink
569 chdir(strItem.latin1()); 571 chdir(strItem.latin1());
570 } 572 }
571 } 573 }
572} 574}
573 575
574void AdvancedFm::doLocalCd() 576void AdvancedFm::doLocalCd()
575{ 577{
576 localListClicked( Local_View->currentItem()); 578 localListClicked( Local_View->currentItem());
577} 579}
578 580
579void AdvancedFm::doRemoteCd() 581void AdvancedFm::doRemoteCd()
580{ 582{
581 localListClicked( Remote_View->currentItem()); 583 localListClicked( Remote_View->currentItem());
582} 584}
583 585
584void AdvancedFm::showHidden() 586void AdvancedFm::showHidden()
585{ 587{
586 if (b) { 588 if (b) {
587 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 589 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
588 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 590 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
589 b=FALSE; 591 b=FALSE;
590 592
591 } else { 593 } else {
592 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 594 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
593 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 595 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
594 b=TRUE; 596 b=TRUE;
595 } 597 }
596 populateLocalView(); 598 populateLocalView();
597 599
598} 600}
599 601
600void AdvancedFm::showRemoteHidden() 602void AdvancedFm::showRemoteHidden()
601{ 603{
602 if (b) { 604 if (b) {
603 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 605 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
604 b=TRUE; 606 b=TRUE;
605 607
606 } else { 608 } else {
607 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 609 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
608 b=FALSE; 610 b=FALSE;
609 } 611 }
610 populateRemoteView(); 612 populateRemoteView();
611} 613}
612 614
613void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 615void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
614{ 616{
615 qDebug("list pressed"); 617 qDebug("list pressed");
616 switch (mouse) { 618 switch (mouse) {
617 case 1: 619 case 1:
618 break; 620 break;
619 case 2: 621 case 2:
620 menuTimer.start( 750, TRUE ); 622 menuTimer.start( 750, TRUE );
621 qDebug("Start menu timer\n"); 623 qDebug("Start menu timer\n");
622 break; 624 break;
623 }; 625 };
624} 626}
625 627
626void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 628void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
627{ 629{
628 630
629 switch (mouse) { 631 switch (mouse) {
630 case 1: 632 case 1:
631 break; 633 break;
632 case 2: 634 case 2:
633 menuTimer.start( 750, TRUE ); 635 menuTimer.start( 750, TRUE );
634 qDebug("Start menu timer"); 636 qDebug("Start menu timer");
635 break; 637 break;
636 }; 638 };
637} 639}
638 640
639void AdvancedFm::runThis() { 641void AdvancedFm::runThis() {
640 QString fs; 642 QString fs;
641 if (TabWidget->currentPageIndex() == 0) { 643 if (TabWidget->currentPageIndex() == 0) {
642 QString curFile = Local_View->currentItem()->text(0); 644 QString curFile = Local_View->currentItem()->text(0);
643 if(curFile != "../") { 645 if(curFile != "../") {
644 646
645 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 647 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
646 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 648 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
647 qDebug( fileInfo.owner()); 649 qDebug( fileInfo.owner());
648 if( (fileInfo.permission( QFileInfo::ExeUser) 650 if( (fileInfo.permission( QFileInfo::ExeUser)
649 | fileInfo.permission( QFileInfo::ExeGroup) 651 | fileInfo.permission( QFileInfo::ExeGroup)
650 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 652 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
651 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 653 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
652 QCopEnvelope e("QPE/System", "execute(QString)" ); 654 QCopEnvelope e("QPE/System", "execute(QString)" );
653 e << curFile; 655 e << curFile;
654 } else { 656 } else {
655 curFile = currentDir.canonicalPath()+"/"+curFile; 657 curFile = currentDir.canonicalPath()+"/"+curFile;
656 DocLnk nf(curFile); 658 DocLnk nf(curFile);
657 QString execStr = nf.exec(); 659 QString execStr = nf.exec();
658 qDebug( execStr); 660 qDebug( execStr);
659 if( execStr.isEmpty() ) { 661 if( execStr.isEmpty() ) {
660 } else { 662 } else {
661 nf.execute(); 663 nf.execute();
662 } 664 }
663 } 665 }
664 } 666 }
665 } else { 667 } else {
666 QString curFile = Remote_View->currentItem()->text(0); 668 QString curFile = Remote_View->currentItem()->text(0);
667 if(curFile != "../") { 669 if(curFile != "../") {
668 670
669 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 671 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
670 qDebug("Filesystemtype is "+fs); 672 qDebug("Filesystemtype is "+fs);
671 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 673 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
672 if( (fileInfo.permission( QFileInfo::ExeUser) 674 if( (fileInfo.permission( QFileInfo::ExeUser)
673 | fileInfo.permission( QFileInfo::ExeGroup) 675 | fileInfo.permission( QFileInfo::ExeGroup)
674 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 676 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
675 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 677 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
676 QCopEnvelope e("QPE/System", "execute(QString)" ); 678 QCopEnvelope e("QPE/System", "execute(QString)" );
677 e << curFile; 679 e << curFile;
678 } else { 680 } else {
679 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 681 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
680 DocLnk nf(curFile); 682 DocLnk nf(curFile);
681 QString execStr = nf.exec(); 683 QString execStr = nf.exec();
682 qDebug(execStr); 684 qDebug(execStr);
683 if( execStr.isEmpty() ) { 685 if( execStr.isEmpty() ) {
684 } else { 686 } else {
685 nf.execute(); 687 nf.execute();
686 } 688 }
687 } 689 }
688 } 690 }
689 } 691 }
690} 692}
691 693
692void AdvancedFm::runText() { 694void AdvancedFm::runText() {
693 if (TabWidget->currentPageIndex() == 0) { 695 if (TabWidget->currentPageIndex() == 0) {
694 QString curFile = Local_View->currentItem()->text(0); 696 QString curFile = Local_View->currentItem()->text(0);
695 if(curFile != "../") { 697 if(curFile != "../") {
696 curFile = currentDir.canonicalPath()+"/"+curFile; 698 curFile = currentDir.canonicalPath()+"/"+curFile;
697 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 699 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
698 e << curFile; 700 e << curFile;
699 } 701 }
700 } else { 702 } else {
701 QString curFile = Remote_View->currentItem()->text(0); 703 QString curFile = Remote_View->currentItem()->text(0);
702 if(curFile != "../") { 704 if(curFile != "../") {
703 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 705 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
704 DocLnk nf(curFile); 706 DocLnk nf(curFile);
705 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 707 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
706 e << curFile; 708 e << curFile;
707 } 709 }
708 } 710 }
709} 711}
710 712
711void AdvancedFm::localMakDir() 713void AdvancedFm::localMakDir()
712{ 714{
713 InputDialog *fileDlg; 715 InputDialog *fileDlg;
714 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 716 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
715 fileDlg->exec(); 717 fileDlg->exec();
716 if( fileDlg->result() == 1 ) { 718 if( fileDlg->result() == 1 ) {
717 QString filename = fileDlg->LineEdit1->text(); 719 QString filename = fileDlg->LineEdit1->text();
718 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 720 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
719 } 721 }
720 populateLocalView(); 722 populateLocalView();
721} 723}
722 724
723void AdvancedFm::remoteMakDir() 725void AdvancedFm::remoteMakDir()
724{ 726{
725 InputDialog *fileDlg; 727 InputDialog *fileDlg;
726 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 728 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
727 fileDlg->exec(); 729 fileDlg->exec();
728 if( fileDlg->result() == 1 ) { 730 if( fileDlg->result() == 1 ) {
729 QString filename = fileDlg->LineEdit1->text(); 731 QString filename = fileDlg->LineEdit1->text();
730 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); 732 currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
731 } 733 }
732 populateRemoteView(); 734 populateRemoteView();
733} 735}
734 736
735void AdvancedFm::localDelete() 737void AdvancedFm::localDelete()
736{ 738{
737 QStringList curFileList = getPath(); 739 QStringList curFileList = getPath();
738 if(curFileList.count() > 0) { 740 if(curFileList.count() > 0) {
739 QString myFile; 741 QString myFile;
740 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 742 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
741 myFile = (*it); 743 myFile = (*it);
742 if( myFile.find(" -> ",0,TRUE) != -1) 744 if( myFile.find(" -> ",0,TRUE) != -1)
743 myFile = myFile.left( myFile.find(" -> ",0,TRUE)); 745 myFile = myFile.left( myFile.find(" -> ",0,TRUE));
744 746
745 QString f = currentDir.canonicalPath(); 747 QString f = currentDir.canonicalPath();
746 if(f.right(1).find("/",0,TRUE) == -1) 748 if(f.right(1).find("/",0,TRUE) == -1)
747 f+="/"; 749 f+="/";
748 f+=myFile; 750 f+=myFile;
749 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 751 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
750 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 752 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
751 "\nand all it's contents ?" 753 "\nand all it's contents ?"
752 ,tr("Yes"),tr("No"),0,0,1) ) { 754 ,tr("Yes"),tr("No"),0,0,1) ) {
753 case 0: { 755 case 0: {
754 f=f.left(f.length()-1); 756 f=f.left(f.length()-1);
755 QString cmd="rm -rf "+f; 757 QString cmd="rm -rf "+f;
756 system( cmd.latin1()); 758 system( cmd.latin1());
757 populateLocalView(); 759 populateLocalView();
758 } 760 }
759 break; 761 break;
760 case 1: 762 case 1:
761 // exit 763 // exit
762 break; 764 break;
763 }; 765 };
764 766
765 } else { 767 } else {
766 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 768 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
767 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 769 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
768 case 0: { 770 case 0: {
769 QString cmd="rm "+f; 771 QString cmd="rm "+f;
770 QFile file(f); 772 QFile file(f);
771 file.remove(); 773 file.remove();
772 // system( cmd.latin1()); 774 // system( cmd.latin1());
773 populateLocalView(); 775 populateLocalView();
774 } 776 }
775 break; 777 break;
776 case 1: 778 case 1:
777 // exit 779 // exit
778 break; 780 break;
779 }; 781 };
780 } 782 }
781 } 783 }
782 } 784 }
783} 785}
784 786
785void AdvancedFm::remoteDelete() 787void AdvancedFm::remoteDelete()
786{ 788{
787 QStringList curFileList = getPath(); 789 QStringList curFileList = getPath();
788 if( curFileList.count() > 0) { 790 if( curFileList.count() > 0) {
789 QString myFile; 791 QString myFile;
790 792
791 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 793 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
792 myFile = (*it); 794 myFile = (*it);
793 if(myFile.find(" -> ",0,TRUE) != -1) 795 if(myFile.find(" -> ",0,TRUE) != -1)
794 myFile = myFile.left(myFile.find(" -> ",0,TRUE)); 796 myFile = myFile.left(myFile.find(" -> ",0,TRUE));
795 QString f = currentRemoteDir.canonicalPath(); 797 QString f = currentRemoteDir.canonicalPath();
796 if(f.right(1).find("/",0,TRUE) == -1) 798 if(f.right(1).find("/",0,TRUE) == -1)
797 f+="/"; 799 f+="/";
798 f+=myFile; 800 f+=myFile;
799 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { 801 if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
800 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 802 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
801 "\nand all it's contents ?", 803 "\nand all it's contents ?",
802 tr("Yes"),tr("No"),0,0,1) ) { 804 tr("Yes"),tr("No"),0,0,1) ) {
803 case 0: { 805 case 0: {
804 f=f.left(f.length()-1); 806 f=f.left(f.length()-1);
805 QString cmd="rm -rf "+f; 807 QString cmd="rm -rf "+f;
806 system( cmd.latin1()); 808 system( cmd.latin1());
807 populateRemoteView(); 809 populateRemoteView();
808 } 810 }
809 break; 811 break;
810 case 1: 812 case 1:
811 // exit 813 // exit
812 break; 814 break;
813 }; 815 };
814 816
815 } else { 817 } else {
816 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 818 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
817 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 819 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
818 case 0: { 820 case 0: {
819 QString cmd="rm "+f; 821 QString cmd="rm "+f;
820 QFile file(f); 822 QFile file(f);
821 file.remove(); 823 file.remove();
822 // system( cmd.latin1()); 824 // system( cmd.latin1());
823 populateRemoteView(); 825 populateRemoteView();
824 } 826 }
825 break; 827 break;
826 case 1: 828 case 1:
827 // exit 829 // exit
828 break; 830 break;
829 }; 831 };
830 } 832 }
831 } 833 }
832 } 834 }
833} 835}
834 836
835void AdvancedFm::localRename() 837void AdvancedFm::localRename()
836{ 838{
837 QString curFile = Local_View->currentItem()->text(0); 839 QString curFile = Local_View->currentItem()->text(0);
838 qDebug("currentItem "+curFile); 840 qDebug("currentItem "+curFile);
839 if( curFile !="../") { 841 if( curFile !="../") {
840 InputDialog *fileDlg; 842 InputDialog *fileDlg;
841 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 843 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
842 fileDlg->setInputText((const QString &)curFile); 844 fileDlg->setInputText((const QString &)curFile);
843 fileDlg->exec(); 845 fileDlg->exec();
844 if( fileDlg->result() == 1 ) { 846 if( fileDlg->result() == 1 ) {
845 QString oldname = currentDir.canonicalPath() + "/" + curFile; 847 QString oldname = currentDir.canonicalPath() + "/" + curFile;
846 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 848 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
847 if( rename(oldname.latin1(), newName.latin1())== -1) 849 if( rename(oldname.latin1(), newName.latin1())== -1)
848 QMessageBox::message(tr("Note"),tr("Could not rename")); 850 QMessageBox::message(tr("Note"),tr("Could not rename"));
849 } 851 }
850 populateLocalView(); 852 populateLocalView();
851 } 853 }
852} 854}
853 855
854void AdvancedFm::remoteRename() 856void AdvancedFm::remoteRename()
855{ 857{
856 QString curFile = Remote_View->currentItem()->text(0); 858 QString curFile = Remote_View->currentItem()->text(0);
857 if( curFile !="../") { 859 if( curFile !="../") {
858 InputDialog *fileDlg; 860 InputDialog *fileDlg;
859 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 861 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
860 fileDlg->setInputText((const QString &)curFile); 862 fileDlg->setInputText((const QString &)curFile);
861 fileDlg->exec(); 863 fileDlg->exec();
862 if( fileDlg->result() == 1 ) { 864 if( fileDlg->result() == 1 ) {
863 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 865 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
864 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 866 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
865 if( rename(oldname.latin1(), newName.latin1())== -1) 867 if( rename(oldname.latin1(), newName.latin1())== -1)
866 QMessageBox::message(tr("Note"),tr("Could not rename")); 868 QMessageBox::message(tr("Note"),tr("Could not rename"));
867 } 869 }
868 populateRemoteView(); 870 populateRemoteView();
869 } 871 }
870} 872}
871 873
872void AdvancedFm::switchToLocalTab() 874void AdvancedFm::switchToLocalTab()
873{ 875{
874 TabWidget->setCurrentPage(0); 876 TabWidget->setCurrentPage(0);
875 Local_View->setFocus(); 877 Local_View->setFocus();
876} 878}
877 879
878void AdvancedFm::switchToRemoteTab() 880void AdvancedFm::switchToRemoteTab()
879{ 881{
880 TabWidget->setCurrentPage(1); 882 TabWidget->setCurrentPage(1);
881 Remote_View->setFocus(); 883 Remote_View->setFocus();
882} 884}
883 885
884void AdvancedFm::readConfig() 886void AdvancedFm::readConfig()
885{ 887{
886 Config cfg("AdvancedFm"); 888 Config cfg("AdvancedFm");
887} 889}
888 890
889void AdvancedFm::writeConfig() 891void AdvancedFm::writeConfig()
890{ 892{
891 Config cfg("AdvancedFm"); 893 Config cfg("AdvancedFm");
892} 894}
893 895
894void AdvancedFm::currentPathComboChanged() 896void AdvancedFm::currentPathComboChanged()
895{ 897{
896 if (TabWidget->currentPageIndex() == 0) { 898 if (TabWidget->currentPageIndex() == 0) {
897 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 899 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
898 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 900 currentDir.setPath( currentPathCombo->lineEdit()->text() );
899 populateLocalView(); 901 populateLocalView();
900 } else { 902 } else {
901 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 903 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
902 } 904 }
903 } 905 }
904 if (TabWidget->currentPageIndex() == 0) { 906 if (TabWidget->currentPageIndex() == 0) {
905 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 907 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
906 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 908 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
907 populateRemoteView(); 909 populateRemoteView();
908 } else { 910 } else {
909 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 911 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
910 } 912 }
911 } 913 }
912} 914}
913 915
914void AdvancedFm::fillCombo(const QString &currentPath) { 916void AdvancedFm::fillCombo(const QString &currentPath) {
915 917
916 if (TabWidget->currentPageIndex() == 0) { 918 if (TabWidget->currentPageIndex() == 0) {
917 currentPathCombo->lineEdit()->setText( currentPath); 919 currentPathCombo->lineEdit()->setText( currentPath);
@@ -957,889 +959,911 @@ void AdvancedFm::filePerms() {
957 959
958 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 960 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
959 filePermissions *filePerm; 961 filePermissions *filePerm;
960 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 962 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
961 filePerm->showMaximized(); 963 filePerm->showMaximized();
962 filePerm->exec(); 964 filePerm->exec();
963 if( filePerm) 965 if( filePerm)
964 delete filePerm; 966 delete filePerm;
965 } 967 }
966 if (TabWidget->currentPageIndex() == 0) { 968 if (TabWidget->currentPageIndex() == 0) {
967 populateLocalView(); 969 populateLocalView();
968 } else { 970 } else {
969 populateRemoteView(); 971 populateRemoteView();
970 } 972 }
971} 973}
972 974
973void AdvancedFm::doProperties() { 975void AdvancedFm::doProperties() {
974 QStringList curFileList = getPath(); 976 QStringList curFileList = getPath();
975 QString filePath; 977 QString filePath;
976 if (TabWidget->currentPageIndex() == 0) { 978 if (TabWidget->currentPageIndex() == 0) {
977 filePath = currentDir.canonicalPath()+"/"; 979 filePath = currentDir.canonicalPath()+"/";
978 } else { 980 } else {
979 filePath= currentRemoteDir.canonicalPath()+"/"; 981 filePath= currentRemoteDir.canonicalPath()+"/";
980 } 982 }
981 // qDebug("%d",curFileList.count()); 983 // qDebug("%d",curFileList.count());
982 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 984 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
983 qDebug((filePath+*it)); 985 qDebug((filePath+*it));
984 DocLnk lnk( (filePath+*it)); 986 DocLnk lnk( (filePath+*it));
985 LnkProperties prop( &lnk ); 987 LnkProperties prop( &lnk );
986 prop.showMaximized(); 988 prop.showMaximized();
987 prop.exec(); 989 prop.exec();
988 } 990 }
989} 991}
990 992
991QStringList AdvancedFm::getPath() { 993QStringList AdvancedFm::getPath() {
992 QStringList strList; 994 QStringList strList;
993 if (TabWidget->currentPageIndex() == 0) { 995 if (TabWidget->currentPageIndex() == 0) {
994 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 996 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
995 QListViewItemIterator it( Local_View ); 997 QListViewItemIterator it( Local_View );
996 for ( ; it.current(); ++it ) { 998 for ( ; it.current(); ++it ) {
997 if ( it.current()->isSelected() ) { 999 if ( it.current()->isSelected() ) {
998 strList << it.current()->text(0); 1000 strList << it.current()->text(0);
999 } 1001 }
1000 } 1002 }
1001 return strList; 1003 return strList;
1002 } else { 1004 } else {
1003 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 1005 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
1004 QListViewItemIterator it( Remote_View ); 1006 QListViewItemIterator it( Remote_View );
1005 for ( ; it.current(); ++it ) { 1007 for ( ; it.current(); ++it ) {
1006 if ( it.current()->isSelected() ) { 1008 if ( it.current()->isSelected() ) {
1007 strList << it.current()->text(0); 1009 strList << it.current()->text(0);
1008 } 1010 }
1009 } 1011 }
1010 return strList; 1012 return strList;
1011 } 1013 }
1012 return ""; 1014 return "";
1013} 1015}
1014 1016
1015void AdvancedFm::homeButtonPushed() { 1017void AdvancedFm::homeButtonPushed() {
1016 QString current = QDir::homeDirPath(); 1018 QString current = QDir::homeDirPath();
1017 chdir( current.latin1() ); 1019 chdir( current.latin1() );
1018 if (TabWidget->currentPageIndex() == 0) { 1020 if (TabWidget->currentPageIndex() == 0) {
1019 currentDir.cd( current, TRUE); 1021 currentDir.cd( current, TRUE);
1020 populateLocalView(); 1022 populateLocalView();
1021 } else { 1023 } else {
1022 currentRemoteDir.cd( current, TRUE); 1024 currentRemoteDir.cd( current, TRUE);
1023 populateRemoteView(); 1025 populateRemoteView();
1024 } 1026 }
1025 update(); 1027 update();
1026} 1028}
1027 1029
1028void AdvancedFm::docButtonPushed() { 1030void AdvancedFm::docButtonPushed() {
1029 QString current = QPEApplication::documentDir(); 1031 QString current = QPEApplication::documentDir();
1030 chdir( current.latin1() ); 1032 chdir( current.latin1() );
1031 if (TabWidget->currentPageIndex() == 0) { 1033 if (TabWidget->currentPageIndex() == 0) {
1032 currentDir.cd( current, TRUE); 1034 currentDir.cd( current, TRUE);
1033 populateLocalView(); 1035 populateLocalView();
1034 } else { 1036 } else {
1035 currentRemoteDir.cd( current, TRUE); 1037 currentRemoteDir.cd( current, TRUE);
1036 populateRemoteView(); 1038 populateRemoteView();
1037 } 1039 }
1038 update(); 1040 update();
1039} 1041}
1040 1042
1041void AdvancedFm::SDButtonPushed() { 1043void AdvancedFm::SDButtonPushed() {
1042 QString current = "/mnt/card"; 1044 QString current = "/mnt/card";
1043 chdir( current.latin1() ); 1045 chdir( current.latin1() );
1044 if (TabWidget->currentPageIndex() == 0) { 1046 if (TabWidget->currentPageIndex() == 0) {
1045 currentDir.cd( current, TRUE); 1047 currentDir.cd( current, TRUE);
1046 populateLocalView(); 1048 populateLocalView();
1047 } else { 1049 } else {
1048 currentRemoteDir.cd( current, TRUE); 1050 currentRemoteDir.cd( current, TRUE);
1049 populateRemoteView(); 1051 populateRemoteView();
1050 } 1052 }
1051 update(); 1053 update();
1052 1054
1053} 1055}
1054 1056
1055void AdvancedFm::CFButtonPushed() { 1057void AdvancedFm::CFButtonPushed() {
1056 QString current = "/mnt/cf"; 1058 QString current = "/mnt/cf";
1057 chdir( current.latin1() ); 1059 chdir( current.latin1() );
1058 if (TabWidget->currentPageIndex() == 0) { 1060 if (TabWidget->currentPageIndex() == 0) {
1059 currentDir.cd( current, TRUE); 1061 currentDir.cd( current, TRUE);
1060 populateLocalView(); 1062 populateLocalView();
1061 } else { 1063 } else {
1062 currentRemoteDir.cd( current, TRUE); 1064 currentRemoteDir.cd( current, TRUE);
1063 populateRemoteView(); 1065 populateRemoteView();
1064 } 1066 }
1065 update(); 1067 update();
1066 1068
1067} 1069}
1068 1070
1069 1071
1070void AdvancedFm::upDir() 1072void AdvancedFm::upDir()
1071{ 1073{
1072 if (TabWidget->currentPageIndex() == 0) { 1074 if (TabWidget->currentPageIndex() == 0) {
1073 QString current = currentDir.canonicalPath(); 1075 QString current = currentDir.canonicalPath();
1074 QDir dir(current); 1076 QDir dir(current);
1075 dir.cdUp(); 1077 dir.cdUp();
1076 current = dir.canonicalPath(); 1078 current = dir.canonicalPath();
1077 chdir( current.latin1() ); 1079 chdir( current.latin1() );
1078 currentDir.cd( current, TRUE); 1080 currentDir.cd( current, TRUE);
1079 populateLocalView(); 1081 populateLocalView();
1080 update(); 1082 update();
1081 } else { 1083 } else {
1082 QString current = currentRemoteDir.canonicalPath(); 1084 QString current = currentRemoteDir.canonicalPath();
1083 QDir dir(current); 1085 QDir dir(current);
1084 dir.cdUp(); 1086 dir.cdUp();
1085 current = dir.canonicalPath(); 1087 current = dir.canonicalPath();
1086 chdir( current.latin1() ); 1088 chdir( current.latin1() );
1087 currentRemoteDir.cd( current, TRUE); 1089 currentRemoteDir.cd( current, TRUE);
1088 populateRemoteView(); 1090 populateRemoteView();
1089 update(); 1091 update();
1090 } 1092 }
1091} 1093}
1092 1094
1093void AdvancedFm::copy() 1095void AdvancedFm::copy()
1094{ 1096{
1095 QStringList curFileList = getPath(); 1097 QStringList curFileList = getPath();
1096 if( curFileList.count() > 0) { 1098 if( curFileList.count() > 0) {
1097 QString curFile; 1099 QString curFile;
1098 if (TabWidget->currentPageIndex() == 0) { 1100 if (TabWidget->currentPageIndex() == 0) {
1099 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1101 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1100 1102
1101 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1103 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1102 curFile = currentDir.canonicalPath()+"/"+(*it); 1104 curFile = currentDir.canonicalPath()+"/"+(*it);
1103 QFile f(destFile); 1105 QFile f(destFile);
1104 if( f.exists()) { 1106 if( f.exists()) {
1105 switch ( QMessageBox::warning(this,tr("Delete"), 1107 switch ( QMessageBox::warning(this,tr("Delete"),
1106 destFile+tr(" already exists\nDo you really want to delete it?"), 1108 destFile+tr(" already exists\nDo you really want to delete it?"),
1107 tr("Yes"),tr("No"),0,0,1) ) { 1109 tr("Yes"),tr("No"),0,0,1) ) {
1108 case 0: 1110 case 0:
1109 f.remove(); 1111 f.remove();
1110 break; 1112 break;
1111 case 1: 1113 case 1:
1112 return; 1114 return;
1113 break; 1115 break;
1114 }; 1116 };
1115 } 1117 }
1116 if(!copyFile(destFile, curFile) ) { 1118 if(!copyFile(destFile, curFile) ) {
1117 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); 1119 QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
1118 qWarning("nothin doing"); 1120 qWarning("nothin doing");
1119 } 1121 }
1120 } 1122 }
1121 populateRemoteView(); 1123 populateRemoteView();
1122 TabWidget->setCurrentPage(1); 1124 TabWidget->setCurrentPage(1);
1123 1125
1124 } else { 1126 } else {
1125 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1127 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1126 1128
1127 QString destFile = currentDir.canonicalPath()+"/"+(*it); 1129 QString destFile = currentDir.canonicalPath()+"/"+(*it);
1128 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1130 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1129 1131
1130 QFile f(destFile); 1132 QFile f(destFile);
1131 if( f.exists()) { 1133 if( f.exists()) {
1132 switch ( QMessageBox::warning(this,tr("Delete"), 1134 switch ( QMessageBox::warning(this,tr("Delete"),
1133 destFile+tr(" already exists\nDo you really want to delete it?"), 1135 destFile+tr(" already exists\nDo you really want to delete it?"),
1134 tr("Yes"),tr("No"),0,0,1) ) { 1136 tr("Yes"),tr("No"),0,0,1) ) {
1135 case 0: 1137 case 0:
1136 f.remove(); 1138 f.remove();
1137 break; 1139 break;
1138 case 1: 1140 case 1:
1139 return; 1141 return;
1140 break; 1142 break;
1141 }; 1143 };
1142 } 1144 }
1143 if(!copyFile(destFile, curFile) ) { 1145 if(!copyFile(destFile, curFile) ) {
1144 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); 1146 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile);
1145 1147
1146 qWarning("nothin doing"); 1148 qWarning("nothin doing");
1147 } 1149 }
1148 } 1150 }
1149 populateLocalView(); 1151 populateLocalView();
1150 TabWidget->setCurrentPage(0); 1152 TabWidget->setCurrentPage(0);
1151 } 1153 }
1152 } 1154 }
1153} 1155}
1154 1156
1155void AdvancedFm::copyAs() 1157void AdvancedFm::copyAs()
1156{ 1158{
1157 QStringList curFileList = getPath(); 1159 QStringList curFileList = getPath();
1158 if( curFileList.count() > 0) { 1160 if( curFileList.count() > 0) {
1159 QString curFile; 1161 QString curFile;
1160 InputDialog *fileDlg; 1162 InputDialog *fileDlg;
1161 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1163 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1162 1164
1163 if (TabWidget->currentPageIndex() == 0) { 1165 if (TabWidget->currentPageIndex() == 0) {
1164 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1166 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1165 QString destFile; 1167 QString destFile;
1166 curFile = currentDir.canonicalPath()+"/"+(*it); 1168 curFile = currentDir.canonicalPath()+"/"+(*it);
1167 fileDlg->setInputText((const QString &) destFile ); 1169 fileDlg->setInputText((const QString &) destFile );
1168 fileDlg->exec(); 1170 fileDlg->exec();
1169 if( fileDlg->result() == 1 ) { 1171 if( fileDlg->result() == 1 ) {
1170 QString filename = fileDlg->LineEdit1->text(); 1172 QString filename = fileDlg->LineEdit1->text();
1171 destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1173 destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1172 1174
1173 QFile f(destFile); 1175 QFile f(destFile);
1174 if( f.exists()) { 1176 if( f.exists()) {
1175 switch (QMessageBox::warning(this,tr("Delete"), 1177 switch (QMessageBox::warning(this,tr("Delete"),
1176 destFile+tr(" already exists\nDo you really want to delete it?"), 1178 destFile+tr(" already exists\nDo you really want to delete it?"),
1177 tr("Yes"),tr("No"),0,0,1) ) { 1179 tr("Yes"),tr("No"),0,0,1) ) {
1178 case 0: 1180 case 0:
1179 f.remove(); 1181 f.remove();
1180 break; 1182 break;
1181 case 1: 1183 case 1:
1182 return; 1184 return;
1183 break; 1185 break;
1184 }; 1186 };
1185 } 1187 }
1186 if(!copyFile(destFile, curFile) ) { 1188 if(!copyFile(destFile, curFile) ) {
1187 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); 1189 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile);
1188 qWarning("nothin doing"); 1190 qWarning("nothin doing");
1189 } 1191 }
1190 } 1192 }
1191 } 1193 }
1192 populateRemoteView(); 1194 populateRemoteView();
1193 TabWidget->setCurrentPage(1); 1195 TabWidget->setCurrentPage(1);
1194 } else { 1196 } else {
1195 if (TabWidget->currentPageIndex() == 0) { 1197 if (TabWidget->currentPageIndex() == 0) {
1196 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1198 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1197 1199
1198 curFile = currentDir.canonicalPath()+"/"+(*it); 1200 curFile = currentDir.canonicalPath()+"/"+(*it);
1199 QString destFile; 1201 QString destFile;
1200 fileDlg->setInputText((const QString &) destFile); 1202 fileDlg->setInputText((const QString &) destFile);
1201 fileDlg->exec(); 1203 fileDlg->exec();
1202 if( fileDlg->result() == 1 ) { 1204 if( fileDlg->result() == 1 ) {
1203 QString filename = fileDlg->LineEdit1->text(); 1205 QString filename = fileDlg->LineEdit1->text();
1204 destFile = currentDir.canonicalPath()+"/"+(*it); 1206 destFile = currentDir.canonicalPath()+"/"+(*it);
1205 1207
1206 QFile f(destFile); 1208 QFile f(destFile);
1207 if( f.exists()) { 1209 if( f.exists()) {
1208 switch ( QMessageBox::warning(this,tr("Delete"), 1210 switch ( QMessageBox::warning(this,tr("Delete"),
1209 destFile+tr(" already exists\nDo you really want to delete it?"), 1211 destFile+tr(" already exists\nDo you really want to delete it?"),
1210 tr("Yes"),tr("No"),0,0,1) ) { 1212 tr("Yes"),tr("No"),0,0,1) ) {
1211 case 0: 1213 case 0:
1212 f.remove(); 1214 f.remove();
1213 break; 1215 break;
1214 case 1: 1216 case 1:
1215 return; 1217 return;
1216 break; 1218 break;
1217 }; 1219 };
1218 } 1220 }
1219 if(!copyFile(destFile, curFile) ) { 1221 if(!copyFile(destFile, curFile) ) {
1220 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); 1222 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile);
1221 qWarning("nothin doing"); 1223 qWarning("nothin doing");
1222 } 1224 }
1223 1225
1224 } 1226 }
1225 } 1227 }
1226 populateLocalView(); 1228 populateLocalView();
1227 TabWidget->setCurrentPage(0); 1229 TabWidget->setCurrentPage(0);
1228 } 1230 }
1229 } 1231 }
1230 } 1232 }
1231 1233
1232} 1234}
1233 1235
1234void AdvancedFm::copySameDir() { 1236void AdvancedFm::copySameDir() {
1235 QStringList curFileList = getPath(); 1237 QStringList curFileList = getPath();
1236 if( curFileList.count() > 0) { 1238 if( curFileList.count() > 0) {
1237 QString curFile; 1239 QString curFile;
1238 InputDialog *fileDlg; 1240 InputDialog *fileDlg;
1239 1241
1240 if (TabWidget->currentPageIndex() == 0) { 1242 if (TabWidget->currentPageIndex() == 0) {
1241 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1243 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1242 QString destFile; 1244 QString destFile;
1243 curFile = currentDir.canonicalPath()+"/"+(*it); 1245 curFile = currentDir.canonicalPath()+"/"+(*it);
1244 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 1246 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
1245 fileDlg->setInputText((const QString &) destFile ); 1247 fileDlg->setInputText((const QString &) destFile );
1246 fileDlg->exec(); 1248 fileDlg->exec();
1247 if( fileDlg->result() == 1 ) { 1249 if( fileDlg->result() == 1 ) {
1248 QString filename = fileDlg->LineEdit1->text(); 1250 QString filename = fileDlg->LineEdit1->text();
1249 destFile = currentDir.canonicalPath()+"/"+filename; 1251 destFile = currentDir.canonicalPath()+"/"+filename;
1250 1252
1251 QFile f(destFile); 1253 QFile f(destFile);
1252 if( f.exists()) { 1254 if( f.exists()) {
1253 switch (QMessageBox::warning(this,tr("Delete"), 1255 switch (QMessageBox::warning(this,tr("Delete"),
1254 destFile+tr(" already exists\nDo you really want to delete it?"), 1256 destFile+tr(" already exists\nDo you really want to delete it?"),
1255 tr("Yes"),tr("No"),0,0,1) ) { 1257 tr("Yes"),tr("No"),0,0,1) ) {
1256 case 0: 1258 case 0:
1257 qDebug(""); 1259 qDebug("");
1258 f.remove(); 1260 f.remove();
1259 break; 1261 break;
1260 case 1: 1262 case 1:
1261 return; 1263 return;
1262 break; 1264 break;
1263 }; 1265 };
1264 } 1266 }
1265 if(!copyFile(destFile, curFile) ) { 1267 if(!copyFile(destFile, curFile) ) {
1266 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); 1268 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile);
1267 qWarning("nothin doing"); 1269 qWarning("nothin doing");
1268 } 1270 }
1269 1271
1270 qDebug("copy "+curFile+" as "+destFile); 1272 qDebug("copy "+curFile+" as "+destFile);
1271 } 1273 }
1272 delete fileDlg; 1274 delete fileDlg;
1273 } 1275 }
1274 populateRemoteView(); 1276 populateRemoteView();
1275 TabWidget->setCurrentPage(1); 1277 TabWidget->setCurrentPage(1);
1276 } else { 1278 } else {
1277 if (TabWidget->currentPageIndex() == 0) { 1279 if (TabWidget->currentPageIndex() == 0) {
1278 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1280 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1279 1281
1280 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1282 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1281 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 1283 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
1282 QString destFile; 1284 QString destFile;
1283 fileDlg->setInputText((const QString &) destFile); 1285 fileDlg->setInputText((const QString &) destFile);
1284 fileDlg->exec(); 1286 fileDlg->exec();
1285 if( fileDlg->result() == 1 ) { 1287 if( fileDlg->result() == 1 ) {
1286 QString filename = fileDlg->LineEdit1->text(); 1288 QString filename = fileDlg->LineEdit1->text();
1287 destFile = currentDir.canonicalPath()+"/"+filename; 1289 destFile = currentDir.canonicalPath()+"/"+filename;
1288 1290
1289 QFile f(destFile); 1291 QFile f(destFile);
1290 if( f.exists()) { 1292 if( f.exists()) {
1291 switch ( QMessageBox::warning(this,tr("Delete"), 1293 switch ( QMessageBox::warning(this,tr("Delete"),
1292 destFile+tr(" already exists\nDo you really want to delete it?"), 1294 destFile+tr(" already exists\nDo you really want to delete it?"),
1293 tr("Yes"),tr("No"),0,0,1) ) { 1295 tr("Yes"),tr("No"),0,0,1) ) {
1294 case 0: 1296 case 0:
1295 f.remove(); 1297 f.remove();
1296 break; 1298 break;
1297 case 1: 1299 case 1:
1298 return; 1300 return;
1299 break; 1301 break;
1300 }; 1302 };
1301 } 1303 }
1302 if(!copyFile(destFile, curFile) ) { 1304 if(!copyFile(destFile, curFile) ) {
1303 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile); 1305 QMessageBox::message("AdvancedFm",tr("Could not copy\n")+curFile +tr("to\n")+destFile);
1304 qWarning("nothin doing"); 1306 qWarning("nothin doing");
1305 } 1307 }
1306 qDebug("copy "+curFile+" as "+destFile); 1308 qDebug("copy "+curFile+" as "+destFile);
1307 } 1309 }
1308 delete fileDlg; 1310 delete fileDlg;
1309 } 1311 }
1310 populateLocalView(); 1312 populateLocalView();
1311 TabWidget->setCurrentPage(0); 1313 TabWidget->setCurrentPage(0);
1312 } 1314 }
1313 } 1315 }
1314 } 1316 }
1315 1317
1316} 1318}
1317 1319
1318void AdvancedFm::move() { 1320void AdvancedFm::move() {
1319 1321
1320 QStringList curFileList = getPath(); 1322 QStringList curFileList = getPath();
1321 if( curFileList.count() > 0) { 1323 if( curFileList.count() > 0) {
1322 QString curFile; 1324 QString curFile;
1323 // qDebug(curFile); 1325 // qDebug(curFile);
1324 QString destFile; 1326 QString destFile;
1325 1327
1326 if (TabWidget->currentPageIndex() == 0) { 1328 if (TabWidget->currentPageIndex() == 0) {
1327 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1329 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1328 QString destFile = currentRemoteDir.canonicalPath(); 1330 QString destFile = currentRemoteDir.canonicalPath();
1329 if(destFile.right(1).find("/",0,TRUE) == -1) 1331 if(destFile.right(1).find("/",0,TRUE) == -1)
1330 destFile+="/"; 1332 destFile+="/";
1331 destFile +=(*it); 1333 destFile +=(*it);
1332 curFile = currentDir.canonicalPath(); 1334 curFile = currentDir.canonicalPath();
1333 qDebug("Destination file is "+destFile); 1335 qDebug("Destination file is "+destFile);
1334 if(curFile.right(1).find("/",0,TRUE) == -1) 1336 if(curFile.right(1).find("/",0,TRUE) == -1)
1335 curFile +="/"; 1337 curFile +="/";
1336 curFile+=(*it); 1338 curFile+=(*it);
1337 1339
1338 QFile f(destFile); 1340 QFile f(destFile);
1339 if( f.exists()) { 1341 if( f.exists()) {
1340 switch (QMessageBox::warning(this,tr("Delete"), 1342 switch (QMessageBox::warning(this,tr("Delete"),
1341 destFile+tr(" already exists\nDo you really want to delete it?"), 1343 destFile+tr(" already exists\nDo you really want to delete it?"),
1342 tr("Yes"),tr("No"),0,0,1) ) { 1344 tr("Yes"),tr("No"),0,0,1) ) {
1343 case 0: 1345 case 0:
1344 f.remove(); 1346 f.remove();
1345 break; 1347 break;
1346 case 1: 1348 case 1:
1347 return; 1349 return;
1348 break; 1350 break;
1349 }; 1351 };
1350 if(!copyFile( destFile, curFile) ) { 1352 if(!copyFile( destFile, curFile) ) {
1351 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 1353 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
1352 return; 1354 return;
1353 } 1355 }
1354 QFile::remove(curFile); 1356 QFile::remove(curFile);
1355 } 1357 }
1356 } 1358 }
1357 TabWidget->setCurrentPage(1); 1359 TabWidget->setCurrentPage(1);
1358 } else { 1360 } else {
1359 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1361 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1360 QString destFile = currentRemoteDir.canonicalPath(); 1362 QString destFile = currentRemoteDir.canonicalPath();
1361 if(destFile.right(1).find("/",0,TRUE) == -1) 1363 if(destFile.right(1).find("/",0,TRUE) == -1)
1362 destFile+="/"; 1364 destFile+="/";
1363 destFile +=(*it); 1365 destFile +=(*it);
1364 qDebug("Destination file is "+destFile); 1366 qDebug("Destination file is "+destFile);
1365 curFile = currentDir.canonicalPath(); 1367 curFile = currentDir.canonicalPath();
1366 if(curFile.right(1).find("/",0,TRUE) == -1) 1368 if(curFile.right(1).find("/",0,TRUE) == -1)
1367 curFile +="/"; 1369 curFile +="/";
1368 curFile+=(*it); 1370 curFile+=(*it);
1369 1371
1370 QFile f(destFile); 1372 QFile f(destFile);
1371 if( f.exists()) { 1373 if( f.exists()) {
1372 switch (QMessageBox::warning(this,tr("Delete"), 1374 switch (QMessageBox::warning(this,tr("Delete"),
1373 destFile+tr(" already exists\nDo you really want to delete it?"), 1375 destFile+tr(" already exists\nDo you really want to delete it?"),
1374 tr("Yes"),tr("No"),0,0,1) ) { 1376 tr("Yes"),tr("No"),0,0,1) ) {
1375 case 0: 1377 case 0:
1376 f.remove(); 1378 f.remove();
1377 break; 1379 break;
1378 case 1: 1380 case 1:
1379 return; 1381 return;
1380 break; 1382 break;
1381 }; 1383 };
1382 if(!copyFile(destFile, curFile) ) { 1384 if(!copyFile(destFile, curFile) ) {
1383 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); 1385 QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile);
1384 return; 1386 return;
1385 } 1387 }
1386 } 1388 }
1387 QFile::remove(curFile); 1389 QFile::remove(curFile);
1388 TabWidget->setCurrentPage(0); 1390 TabWidget->setCurrentPage(0);
1389 } 1391 }
1390 } 1392 }
1391 populateRemoteView(); 1393 populateRemoteView();
1392 populateLocalView(); 1394 populateLocalView();
1393 } 1395 }
1394} 1396}
1395 1397
1396bool AdvancedFm::copyFile( const QString & dest, const QString & src ) 1398bool AdvancedFm::copyFile( const QString & dest, const QString & src )
1397{ 1399{
1398 char bf[ 50000 ]; 1400 char bf[ 50000 ];
1399 int bytesRead; 1401 int bytesRead;
1400 bool success = TRUE; 1402 bool success = TRUE;
1401 struct stat status; 1403 struct stat status;
1402 1404
1403 QFile s( src ); 1405 QFile s( src );
1404 QFile d( dest ); 1406 QFile d( dest );
1405 1407
1406 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { 1408 if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) {
1407 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { 1409 while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) {
1408 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ 1410 if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){
1409 success = FALSE; 1411 success = FALSE;
1410 break; 1412 break;
1411 } 1413 }
1412 } 1414 }
1413 if( success && (bytesRead > 0) ){ 1415 if( success && (bytesRead > 0) ){
1414 d.writeBlock( bf, bytesRead ); 1416 d.writeBlock( bf, bytesRead );
1415 } 1417 }
1416 } else { 1418 } else {
1417 success = FALSE; 1419 success = FALSE;
1418 } 1420 }
1419 1421
1420 // Set file permissions 1422 // Set file permissions
1421 if( stat( (const char *) src, &status ) == 0 ){ 1423 if( stat( (const char *) src, &status ) == 0 ){
1422 chmod( (const char *) dest, status.st_mode ); 1424 chmod( (const char *) dest, status.st_mode );
1423 } 1425 }
1424 1426
1425 return success; 1427 return success;
1426} 1428}
1427 1429
1428void AdvancedFm::runCommand() { 1430void AdvancedFm::runCommand() {
1429 QString curFile; 1431 QString curFile;
1430 if (TabWidget->currentPageIndex() == 0) { 1432 if (TabWidget->currentPageIndex() == 0) {
1431 if( Local_View->currentItem()) 1433 if( Local_View->currentItem())
1432 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 1434 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1433 } else { 1435 } else {
1434 if(Remote_View->currentItem()) 1436 if(Remote_View->currentItem())
1435 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); 1437 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
1436 } 1438 }
1437 1439
1438 InputDialog *fileDlg; 1440 InputDialog *fileDlg;
1439 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1441 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1440 fileDlg->setInputText(curFile); 1442 fileDlg->setInputText(curFile);
1441 fileDlg->exec(); 1443 fileDlg->exec();
1442 QString command; 1444 QString command;
1443 if( fileDlg->result() == 1 ) { 1445 if( fileDlg->result() == 1 ) {
1444 command = fileDlg->LineEdit1->text(); 1446 command = fileDlg->LineEdit1->text();
1445 1447
1446 Output *outDlg; 1448 Output *outDlg;
1447 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1449 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1448 outDlg->showMaximized(); 1450 outDlg->showMaximized();
1449 outDlg->show(); 1451 outDlg->show();
1450 qApp->processEvents(); 1452 qApp->processEvents();
1451 FILE *fp; 1453 FILE *fp;
1452 char line[130]; 1454 char line[130];
1453 sleep(1); 1455 sleep(1);
1454 command +=" 2>&1"; 1456 command +=" 2>&1";
1455 fp = popen( (const char *) command, "r"); 1457 fp = popen( (const char *) command, "r");
1456 if ( !fp ) { 1458 if ( !fp ) {
1457 qDebug("Could not execute '" + command + "'! err=%d", fp); 1459 qDebug("Could not execute '" + command + "'! err=%d", fp);
1458 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); 1460 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") );
1459 pclose(fp); 1461 pclose(fp);
1460 return; 1462 return;
1461 } else { 1463 } else {
1462 while ( fgets( line, sizeof line, fp)) { 1464 while ( fgets( line, sizeof line, fp)) {
1463 QString lineStr = line; 1465 QString lineStr = line;
1464 lineStr=lineStr.left(lineStr.length()-1); 1466 lineStr=lineStr.left(lineStr.length()-1);
1465 outDlg->OutputEdit->append(lineStr); 1467 outDlg->OutputEdit->append(lineStr);
1466 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1468 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1467 } 1469 }
1468 } 1470 }
1471 pclose(fp);
1472
1469 } 1473 }
1470} 1474}
1471 1475
1472void AdvancedFm::runCommandStd() { 1476void AdvancedFm::runCommandStd() {
1473 QString curFile; 1477 QString curFile;
1474 if (TabWidget->currentPageIndex() == 0) { 1478 if (TabWidget->currentPageIndex() == 0) {
1475 if( Local_View->currentItem()) 1479 if( Local_View->currentItem())
1476 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); 1480 curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0);
1477 } else { 1481 } else {
1478 if(Remote_View->currentItem()) 1482 if(Remote_View->currentItem())
1479 curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0); 1483 curFile = currentRemoteDir.canonicalPath() +"/"+ Remote_View->currentItem()->text(0);
1480 } 1484 }
1481 1485
1482 InputDialog *fileDlg; 1486 InputDialog *fileDlg;
1483 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1487 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1484 fileDlg->setInputText(curFile); 1488 fileDlg->setInputText(curFile);
1485 fileDlg->exec(); 1489 fileDlg->exec();
1486 QString command; 1490 QString command;
1487 if( fileDlg->result() == 1 ) { 1491 if( fileDlg->result() == 1 ) {
1488 qApp->processEvents(); 1492 qApp->processEvents();
1489 command = fileDlg->LineEdit1->text() + " &"; 1493 command = fileDlg->LineEdit1->text() + " &";
1490 system(command.latin1()); 1494 system(command.latin1());
1491 } 1495 }
1492} 1496}
1493 1497
1494void AdvancedFm::fileStatus() { 1498void AdvancedFm::fileStatus() {
1495 QString curFile; 1499 QString curFile;
1496 if (TabWidget->currentPageIndex() == 0) { 1500 if (TabWidget->currentPageIndex() == 0) {
1497 curFile = Local_View->currentItem()->text(0); 1501 curFile = Local_View->currentItem()->text(0);
1498 } else { 1502 } else {
1499 curFile = Remote_View->currentItem()->text(0); 1503 curFile = Remote_View->currentItem()->text(0);
1500 } 1504 }
1501 QString command = " stat -l "+ curFile +" 2>&1"; 1505 QString command = " stat -l "+ curFile +" 2>&1";
1502 Output *outDlg; 1506 Output *outDlg;
1503 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1507 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1504 outDlg->showMaximized(); 1508 outDlg->showMaximized();
1505 outDlg->show(); 1509 outDlg->show();
1506 qApp->processEvents(); 1510 qApp->processEvents();
1507 FILE *fp; 1511 FILE *fp;
1508 char line[130]; 1512 char line[130];
1509 sleep(1); 1513 sleep(1);
1510 fp = popen( (const char *) command, "r"); 1514 fp = popen( (const char *) command, "r");
1511 if ( !fp ) { 1515 if ( !fp ) {
1512 qDebug("Could not execute '" + command + "'! err=%d", fp); 1516 qDebug("Could not execute '" + command + "'! err=%d", fp);
1513 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); 1517 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") );
1514 pclose(fp); 1518 pclose(fp);
1515 return; 1519 return;
1516 } else { 1520 } else {
1517 while ( fgets( line, sizeof line, fp)) { 1521 while ( fgets( line, sizeof line, fp)) {
1518 outDlg->OutputEdit->append(line); 1522 outDlg->OutputEdit->append(line);
1519 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 1523 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
1520 1524
1521 } 1525 }
1522 1526
1523 } 1527 }
1528 pclose(fp);
1524} 1529}
1525 1530
1526void AdvancedFm::mkDir() { 1531void AdvancedFm::mkDir() {
1527 if (TabWidget->currentPageIndex() == 0) 1532 if (TabWidget->currentPageIndex() == 0)
1528 localMakDir(); 1533 localMakDir();
1529 else 1534 else
1530 remoteMakDir(); 1535 remoteMakDir();
1531 1536
1532} 1537}
1533 1538
1534void AdvancedFm::rn() { 1539void AdvancedFm::rn() {
1535 if (TabWidget->currentPageIndex() == 0) 1540 if (TabWidget->currentPageIndex() == 0)
1536 localRename(); 1541 localRename();
1537 else 1542 else
1538 remoteRename(); 1543 remoteRename();
1539 1544
1540} 1545}
1541 1546
1542void AdvancedFm::del() { 1547void AdvancedFm::del() {
1543 if (TabWidget->currentPageIndex() == 0) 1548 if (TabWidget->currentPageIndex() == 0)
1544 localDelete(); 1549 localDelete();
1545 else 1550 else
1546 remoteDelete(); 1551 remoteDelete();
1547} 1552}
1548 1553
1549void AdvancedFm::doAbout() { 1554void AdvancedFm::doAbout() {
1550 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" 1555 QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n"
1551 "is copyright 2002 by\n" 1556 "is copyright 2002 by\n"
1552 "L.J.Potter<llornkcor@handhelds.org>\n" 1557 "L.J.Potter<llornkcor@handhelds.org>\n"
1553 "and is licensed by the GPL")); 1558 "and is licensed by the GPL"));
1554} 1559}
1555 1560
1556void AdvancedFm::keyReleaseEvent( QKeyEvent *e) 1561void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
1557{ 1562{
1558 if( TabWidget->hasFocus()) 1563 if( TabWidget->hasFocus())
1559 switch ( e->key() ) { 1564 switch ( e->key() ) {
1560 case Key_Delete: 1565 case Key_Delete:
1561 del(); 1566 del();
1562 break; 1567 break;
1563 case Key_H: 1568 case Key_H:
1564 showHidden(); 1569 showHidden();
1565 break; 1570 break;
1566 case Key_E: 1571 case Key_E:
1567 runThis(); 1572 runThis();
1568 break; 1573 break;
1569 case Key_C: 1574 case Key_C:
1570 copy(); 1575 copy();
1571 break; 1576 break;
1572 case Key_A: 1577 case Key_A:
1573 copyAs(); 1578 copyAs();
1574 break; 1579 break;
1575 case Key_M: 1580 case Key_M:
1576 move(); 1581 move();
1577 break; 1582 break;
1578 case Key_R: 1583 case Key_R:
1579 rn(); 1584 rn();
1580 break; 1585 break;
1581 case Key_I: 1586 case Key_I:
1582 fileStatus(); 1587 fileStatus();
1583 break; 1588 break;
1584 case Key_U: 1589 case Key_U:
1585 upDir(); 1590 upDir();
1586 break; 1591 break;
1587 case Key_P: 1592 case Key_P:
1588 filePerms(); 1593 filePerms();
1589 break; 1594 break;
1590 case Key_N: 1595 case Key_N:
1591 mkDir(); 1596 mkDir();
1592 break; 1597 break;
1593 case Key_1: 1598 case Key_1:
1594 switchToLocalTab(); 1599 switchToLocalTab();
1595 break; 1600 break;
1596 case Key_2: 1601 case Key_2:
1597 switchToRemoteTab(); 1602 switchToRemoteTab();
1598 break; 1603 break;
1599 case Key_3: 1604 case Key_3:
1600 CFButtonPushed(); 1605 CFButtonPushed();
1601 break; 1606 break;
1602 case Key_4: 1607 case Key_4:
1603 SDButtonPushed(); 1608 SDButtonPushed();
1604 break; 1609 break;
1605 case Key_5: 1610 case Key_5:
1606 homeButtonPushed(); 1611 homeButtonPushed();
1607 break; 1612 break;
1608 case Key_6: 1613 case Key_6:
1609 docButtonPushed(); 1614 docButtonPushed();
1610 break; 1615 break;
1611 case Key_7: 1616 case Key_7:
1612 break; 1617 break;
1613 case Key_8: 1618 case Key_8:
1614 break; 1619 break;
1615 case Key_9: 1620 case Key_9:
1616 break; 1621 break;
1617 case Key_0: 1622 case Key_0:
1618 break; 1623 break;
1619 } 1624 }
1620} 1625}
1621 1626
1622void AdvancedFm::mkSym() { 1627void AdvancedFm::mkSym() {
1623 QString cmd; 1628 QString cmd;
1624 QStringList curFileList = getPath(); 1629 QStringList curFileList = getPath();
1625 if( curFileList.count() > 0) { 1630 if( curFileList.count() > 0) {
1626 1631
1627 if (TabWidget->currentPageIndex() == 0) { 1632 if (TabWidget->currentPageIndex() == 0) {
1628 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1633 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1629 1634
1630 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 1635 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
1631 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 1636 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1632 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1637 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1633 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1638 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1634 cmd = "ln -s "+curFile+" "+destName; 1639 cmd = "ln -s "+curFile+" "+destName;
1635 qDebug(cmd); 1640 qDebug(cmd);
1636 system(cmd.latin1() ); 1641 system(cmd.latin1() );
1637 } 1642 }
1638 populateRemoteView(); 1643 populateRemoteView();
1639 TabWidget->setCurrentPage(1); 1644 TabWidget->setCurrentPage(1);
1640 } else { 1645 } else {
1641 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1646 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1642 1647
1643 QString destName = currentDir.canonicalPath()+"/"+(*it); 1648 QString destName = currentDir.canonicalPath()+"/"+(*it);
1644 if(destName.right(1) == "/") destName = destName.left( destName.length() -1); 1649 if(destName.right(1) == "/") destName = destName.left( destName.length() -1);
1645 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1650 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1646 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1651 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1647 1652
1648 cmd = "ln -s "+curFile+" "+destName; 1653 cmd = "ln -s "+curFile+" "+destName;
1649 qDebug(cmd); 1654 qDebug(cmd);
1650 system(cmd.latin1() ); 1655 system(cmd.latin1() );
1651 } 1656 }
1652 populateLocalView(); 1657 populateLocalView();
1653 TabWidget->setCurrentPage(0); 1658 TabWidget->setCurrentPage(0);
1654 } 1659 }
1655 } 1660 }
1656} 1661}
1657 1662
1658void AdvancedFm::QPEButtonPushed() { 1663void AdvancedFm::QPEButtonPushed() {
1659 QString current = QPEApplication::qpeDir(); 1664 QString current = QPEApplication::qpeDir();
1660 chdir( current.latin1() ); 1665 chdir( current.latin1() );
1661 if (TabWidget->currentPageIndex() == 0) { 1666 if (TabWidget->currentPageIndex() == 0) {
1662 currentDir.cd( current, TRUE); 1667 currentDir.cd( current, TRUE);
1663 populateLocalView(); 1668 populateLocalView();
1664 } else { 1669 } else {
1665 currentRemoteDir.cd( current, TRUE); 1670 currentRemoteDir.cd( current, TRUE);
1666 populateRemoteView(); 1671 populateRemoteView();
1667 } 1672 }
1668 update(); 1673 update();
1669} 1674}
1670 1675
1671void AdvancedFm::parsetab(const QString &fileName) { 1676void AdvancedFm::parsetab(const QString &fileName) {
1672 1677
1673 fileSystemTypeList.clear(); 1678 fileSystemTypeList.clear();
1674 fsList.clear(); 1679 fsList.clear();
1675 struct mntent *me; 1680 struct mntent *me;
1676 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 1681 FILE *mntfp = setmntent( fileName.latin1(), "r" );
1677 if ( mntfp ) { 1682 if ( mntfp ) {
1678 while ( (me = getmntent( mntfp )) != 0 ) { 1683 while ( (me = getmntent( mntfp )) != 0 ) {
1679 QString deviceName = me->mnt_fsname; 1684 QString deviceName = me->mnt_fsname;
1680 QString filesystemType = me->mnt_type; 1685 QString filesystemType = me->mnt_type;
1681 QString mountDir = me->mnt_dir; 1686 QString mountDir = me->mnt_dir;
1682 if(deviceName != "none") { 1687 if(deviceName != "none") {
1683 if( fsList.contains(filesystemType) == 0 1688 if( fsList.contains(filesystemType) == 0
1684 & filesystemType.find("proc",0,TRUE) == -1 1689 & filesystemType.find("proc",0,TRUE) == -1
1685 & filesystemType.find("cramfs",0,TRUE) == -1 1690 & filesystemType.find("cramfs",0,TRUE) == -1
1686 & filesystemType.find("auto",0,TRUE) == -1) 1691 & filesystemType.find("auto",0,TRUE) == -1)
1687 fsList << filesystemType; 1692 fsList << filesystemType;
1688 fileSystemTypeList << mountDir+"::"+filesystemType; 1693 fileSystemTypeList << mountDir+"::"+filesystemType;
1689 } 1694 }
1690 } 1695 }
1691 } 1696 }
1692 endmntent( mntfp ); 1697 endmntent( mntfp );
1693} 1698}
1694 1699
1695QString AdvancedFm::getFileSystemType(const QString &currentText) { 1700QString AdvancedFm::getFileSystemType(const QString &currentText) {
1696 parsetab("/etc/mtab"); //why did TT forget filesystem type? 1701 parsetab("/etc/mtab"); //why did TT forget filesystem type?
1697 QString current = currentText;//.right( currentText.length()-1); 1702 QString current = currentText;//.right( currentText.length()-1);
1698 QString baseFs; 1703 QString baseFs;
1699 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 1704 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
1700 QString temp = (*it); 1705 QString temp = (*it);
1701 QString path = temp.left(temp.find("::",0,TRUE) ); 1706 QString path = temp.left(temp.find("::",0,TRUE) );
1702 path = path.right( path.length()-1); 1707 path = path.right( path.length()-1);
1703 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1708 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1704 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 1709 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
1705 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 1710 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
1706 } 1711 }
1707 } 1712 }
1708 return baseFs; 1713 return baseFs;
1709} 1714}
1710 1715
1711QString AdvancedFm::getDiskSpace( const QString &) { 1716QString AdvancedFm::getDiskSpace( const QString &) {
1712 1717
1713} 1718}
1714 1719
1715void AdvancedFm::doBeam() { 1720void AdvancedFm::doBeam() {
1716 Ir ir; 1721 Ir ir;
1717 if(!ir.supported()){ 1722 if(!ir.supported()){
1718 } else { 1723 } else {
1719 1724
1720 QStringList curFileList = getPath(); 1725 QStringList curFileList = getPath();
1721 if( curFileList.count() > 0) { 1726 if( curFileList.count() > 0) {
1722 1727
1723 if (TabWidget->currentPageIndex() == 0) { 1728 if (TabWidget->currentPageIndex() == 0) {
1724 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1729 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1725 1730
1726 QString curFile = currentDir.canonicalPath()+"/"+(*it); 1731 QString curFile = currentDir.canonicalPath()+"/"+(*it);
1727 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1732 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1728 Ir *file = new Ir(this, "IR"); 1733 Ir *file = new Ir(this, "IR");
1729 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 1734 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1730 file->send( curFile, curFile ); 1735 file->send( curFile, curFile );
1731 } 1736 }
1732 1737
1733 } else { 1738 } else {
1734 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1739 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1735 1740
1736 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1741 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1737 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); 1742 if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1);
1738 Ir *file = new Ir(this, "IR"); 1743 Ir *file = new Ir(this, "IR");
1739 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 1744 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * )));
1740 file->send( curFile, curFile ); 1745 file->send( curFile, curFile );
1741 1746
1742 } 1747 }
1743 } 1748 }
1744 } 1749 }
1745 } 1750 }
1746 1751
1747} 1752}
1748 1753
1749void AdvancedFm::fileBeamFinished( Ir *ir) { 1754void AdvancedFm::fileBeamFinished( Ir *ir) {
1750 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 1755 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
1751 1756
1752} 1757}
1753 1758
1754void AdvancedFm::showFileMenu() { 1759void AdvancedFm::showFileMenu() {
1755 1760
1756 QString curApp; 1761 QString curApp;
1757 bool isLocalView = false; 1762 bool isLocalView = false;
1758 if (TabWidget->currentPageIndex() == 0) { 1763 if (TabWidget->currentPageIndex() == 0) {
1759 isLocalView = TRUE; 1764 isLocalView = TRUE;
1760 curApp = Local_View->currentItem()->text(0); 1765 curApp = Local_View->currentItem()->text(0);
1761 } else { 1766 } else {
1762 curApp = Remote_View->currentItem()->text(0); 1767 curApp = Remote_View->currentItem()->text(0);
1763 } 1768 }
1764 1769
1765 MimeType mt( curApp ); 1770 MimeType mt( curApp );
1766 const AppLnk* app = mt.application(); 1771 const AppLnk* app = mt.application();
1767 QFile fi(curApp); 1772 QFile fi(curApp);
1768 1773
1769 QPopupMenu *m = new QPopupMenu(0); 1774 QPopupMenu *m = new QPopupMenu(0);
1770 1775
1771 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 1776 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
1772 m->insertSeparator(); 1777 m->insertSeparator();
1773 if ( QFileInfo(fi).isDir() ) { 1778 if ( QFileInfo(fi).isDir() ) {
1774 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 1779 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
1775 } else { 1780 } else {
1776 1781
1777 if ( app ) 1782 if ( app )
1778 m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); 1783 m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) );
1779 else if( QFileInfo(fi).isExecutable() ) 1784 else if( QFileInfo(fi).isExecutable() )
1780 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); 1785 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
1781 1786
1782 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 1787 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
1783 } 1788 }
1784 m->insertSeparator(); 1789 m->insertSeparator();
1785 1790
1786 1791
1787 if(isLocalView) 1792 if(isLocalView)
1788 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 1793 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
1789 else 1794 else
1790 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 1795 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
1791 1796
1792 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 1797 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
1793 m->insertSeparator(); 1798 m->insertSeparator();
1794 1799
1795 if(isLocalView) 1800 if(isLocalView)
1796 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 1801 m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
1797 else 1802 else
1798 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 1803 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
1799 1804
1800 m->insertItem( tr( "Copy" ), this, SLOT( copy() )); 1805 m->insertItem( tr( "Copy" ), this, SLOT( copy() ));
1801 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 1806 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
1802 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); 1807 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
1803 m->insertItem( tr( "Move" ), this, SLOT( move() )); 1808 m->insertItem( tr( "Move" ), this, SLOT( move() ));
1804 m->insertSeparator(); 1809 m->insertSeparator();
1805 1810
1806 if(isLocalView) 1811 if(isLocalView)
1807 m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 1812 m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
1808 else 1813 else
1809 m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 1814 m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
1810 1815
1811 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 1816 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
1812 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 1817 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
1813 m->insertSeparator(); 1818 m->insertSeparator();
1814 1819
1815 if(isLocalView) 1820 if(isLocalView)
1816 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 1821 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
1817 else 1822 else
1818 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 1823 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
1819 1824
1820 m->insertSeparator(); 1825 m->insertSeparator();
1821 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 1826 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
1822 1827
1823 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings 1828 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings
1824 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 1829 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
1825 m->setCheckable(TRUE); 1830 m->setCheckable(TRUE);
1826 if (!b) 1831 if (!b)
1827 m->setItemChecked(m->idAt(0),TRUE); 1832 m->setItemChecked(m->idAt(0),TRUE);
1828 else 1833 else
1829 m->setItemChecked(m->idAt(0),FALSE); 1834 m->setItemChecked(m->idAt(0),FALSE);
1830 if(Ir::supported()) 1835 if(Ir::supported())
1831 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 1836 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
1832 m->setFocus(); 1837 m->setFocus();
1833 m->exec( QCursor::pos() ); 1838 m->exec( QCursor::pos() );
1834 sleep(1); 1839 sleep(1);
1835 if(m) delete m; 1840 if(m) delete m;
1836} 1841}
1837 1842
1838 1843
1839void AdvancedFm::cancelMenuTimer() 1844void AdvancedFm::cancelMenuTimer() {
1840{
1841 1845
1842 qDebug("selectionChanged: cancel menu timer"); 1846 qDebug("selectionChanged: cancel menu timer");
1843 if( menuTimer.isActive() ) 1847 if( menuTimer.isActive() )
1844 menuTimer.stop(); 1848 menuTimer.stop();
1845} 1849}
1850
1851QString AdvancedFm::checkDiskSpace(const QString &path) {
1852
1853 struct statfs fss;
1854 if ( !statfs( path.latin1(), &fss ) ) {
1855 int blkSize = fss.f_bsize;
1856// int totalBlks = fs.f_blocks;
1857 int availBlks = fss.f_bavail;
1858
1859 long mult = blkSize / 1024;
1860 long div = 1024 / blkSize;
1861 if ( !mult ) mult = 1;
1862 if ( !div ) div = 1;
1863
1864
1865 return QString::number(availBlks * mult / div);
1866 }
1867 return "";
1868}
1869
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 45f00ad..78f0bad 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -1,143 +1,143 @@
1/*************************************************************************** 1/***************************************************************************
2 opieftp.h 2 opieftp.h
3 ------------------- 3 -------------------
4** Created: Sat Mar 9 23:33:09 2002 4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#ifndef ADVANCEDFM_H 12#ifndef ADVANCEDFM_H
13#define ADVANCEDFM_H 13#define ADVANCEDFM_H
14 14
15#include <qpe/ir.h> 15#include <qpe/ir.h>
16 16
17#include <qvariant.h> 17#include <qvariant.h>
18#include <qdialog.h> 18#include <qdialog.h>
19#include <qmainwindow.h> 19#include <qmainwindow.h>
20#include <qstringlist.h> 20#include <qstringlist.h>
21#include <qdir.h> 21#include <qdir.h>
22#include <qstring.h> 22#include <qstring.h>
23#include <qpoint.h> 23#include <qpoint.h>
24#include <qtimer.h> 24#include <qtimer.h>
25 25
26class QVBoxLayout; 26class QVBoxLayout;
27class QHBoxLayout; 27class QHBoxLayout;
28class QGridLayout; 28class QGridLayout;
29class QComboBox; 29class QComboBox;
30class QListView; 30class QListView;
31class QListviewItem; 31class QListviewItem;
32class QLabel; 32class QLabel;
33class QProgressBar; 33class QProgressBar;
34class QSpinBox; 34class QSpinBox;
35class QTabWidget; 35class QTabWidget;
36class QWidget; 36class QWidget;
37class QPEToolBar; 37class QPEToolBar;
38class QPEMenuBar; 38class QPEMenuBar;
39class QPopupMenu; 39class QPopupMenu;
40class QFile; 40class QFile;
41class QListViewItem; 41class QListViewItem;
42class QLineEdit; 42class QLineEdit;
43//class QPushButton; 43//class QPushButton;
44class QToolButton; 44class QToolButton;
45class Ir; 45class Ir;
46 46
47class AdvancedFm : public QMainWindow 47class AdvancedFm : public QMainWindow
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50public: 50public:
51 AdvancedFm(); 51 AdvancedFm();
52 ~AdvancedFm(); 52 ~AdvancedFm();
53 53
54 QTabWidget *TabWidget; 54 QTabWidget *TabWidget;
55 QWidget *tab, *tab_2, *tab_3; 55 QWidget *tab, *tab_2, *tab_3;
56 QListView *Local_View, *Remote_View; 56 QListView *Local_View, *Remote_View;
57 57
58 QLineEdit *currentPathEdit; 58 QLineEdit *currentPathEdit;
59 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu; 59 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
60 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 60 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
61// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 61// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
62 QDir currentDir, currentRemoteDir; 62 QDir currentDir, currentRemoteDir;
63 QComboBox *currentPathCombo; 63 QComboBox *currentPathCombo;
64 QString filterStr; 64 QString filterStr;
65 QListViewItem * item; 65 QListViewItem * item;
66 bool b; 66 bool b;
67 QStringList fileSystemTypeList, fsList; 67 QStringList fileSystemTypeList, fsList;
68 int currentServerConfig; 68 int currentServerConfig;
69protected slots: 69protected slots:
70 void doLocalCd(); 70 void doLocalCd();
71 void doRemoteCd(); 71 void doRemoteCd();
72// void copy(); 72// void copy();
73 void mkDir(); 73 void mkDir();
74 void del(); 74 void del();
75 void rn(); 75 void rn();
76 void populateLocalView(); 76 void populateLocalView();
77 void populateRemoteView(); 77 void populateRemoteView();
78 void showHidden(); 78 void showHidden();
79 void showRemoteHidden(); 79 void showRemoteHidden();
80 void writeConfig(); 80 void writeConfig();
81 void readConfig(); 81 void readConfig();
82 void localListClicked(QListViewItem *); 82 void localListClicked(QListViewItem *);
83 void remoteListClicked(QListViewItem *); 83 void remoteListClicked(QListViewItem *);
84 void localListPressed( int, QListViewItem *, const QPoint&, int); 84 void localListPressed( int, QListViewItem *, const QPoint&, int);
85 void remoteListPressed( int, QListViewItem *, const QPoint&, int); 85 void remoteListPressed( int, QListViewItem *, const QPoint&, int);
86 void localMakDir(); 86 void localMakDir();
87 void localDelete(); 87 void localDelete();
88 void remoteMakDir(); 88 void remoteMakDir();
89 void remoteDelete(); 89 void remoteDelete();
90/* bool remoteDirList(const QString &); */ 90/* bool remoteDirList(const QString &); */
91/* bool remoteChDir(const QString &); */ 91/* bool remoteChDir(const QString &); */
92 void tabChanged(QWidget*); 92 void tabChanged(QWidget*);
93 void cleanUp(); 93 void cleanUp();
94 void remoteRename(); 94 void remoteRename();
95 void localRename(); 95 void localRename();
96 void runThis(); 96 void runThis();
97 void runText(); 97 void runText();
98 void filePerms(); 98 void filePerms();
99 void doProperties(); 99 void doProperties();
100 void runCommand(); 100 void runCommand();
101 void runCommandStd(); 101 void runCommandStd();
102 QStringList getPath(); 102 QStringList getPath();
103 void mkSym(); 103 void mkSym();
104 void switchToLocalTab(); 104 void switchToLocalTab();
105 void switchToRemoteTab(); 105 void switchToRemoteTab();
106 106
107protected: 107protected:
108 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 108 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
109 QStringList remoteDirPathStringList, localDirPathStringList; 109 QStringList remoteDirPathStringList, localDirPathStringList;
110 110
111 void keyReleaseEvent( QKeyEvent *); 111 void keyReleaseEvent( QKeyEvent *);
112 QString getFileSystemType(const QString &); 112 QString getFileSystemType(const QString &);
113 QString getDiskSpace(const QString &); 113 QString getDiskSpace(const QString &);
114 114
115 void parsetab(const QString &fileName); 115 void parsetab(const QString &fileName);
116 116QString checkDiskSpace(const QString &);
117protected slots: 117protected slots:
118 void showFileMenu(); 118 void showFileMenu();
119 void cancelMenuTimer(); 119 void cancelMenuTimer();
120 void homeButtonPushed(); 120 void homeButtonPushed();
121 void docButtonPushed(); 121 void docButtonPushed();
122 void SDButtonPushed(); 122 void SDButtonPushed();
123 void CFButtonPushed(); 123 void CFButtonPushed();
124 void QPEButtonPushed(); 124 void QPEButtonPushed();
125 void upDir(); 125 void upDir();
126 void currentPathComboChanged(); 126 void currentPathComboChanged();
127 void copy(); 127 void copy();
128 void copyAs(); 128 void copyAs();
129 void copySameDir(); 129 void copySameDir();
130 void currentPathComboActivated(const QString &); 130 void currentPathComboActivated(const QString &);
131 void fillCombo(const QString &); 131 void fillCombo(const QString &);
132 bool copyFile( const QString & , const QString & ); 132 bool copyFile( const QString & , const QString & );
133 void move(); 133 void move();
134 void fileStatus(); 134 void fileStatus();
135 void doAbout(); 135 void doAbout();
136 void doBeam(); 136 void doBeam();
137 void fileBeamFinished( Ir *); 137 void fileBeamFinished( Ir *);
138 138
139private: 139private:
140 QTimer menuTimer; 140 QTimer menuTimer;
141}; 141};
142 142
143#endif // ADVANCEDFM_H 143#endif // ADVANCEDFM_H