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