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