summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp106
-rw-r--r--noncore/apps/advancedfm/advancedfm.h3
2 files changed, 3 insertions, 106 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index d0ccc3f..96a2d0a 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -66,92 +66,75 @@
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 );
79 78
80 QGridLayout *layout = new QGridLayout( this ); 79 QGridLayout *layout = new QGridLayout( this );
81 layout->setSpacing( 2); 80 layout->setSpacing( 2);
82 layout->setMargin( 2); 81 layout->setMargin( 2);
83 82
84 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 83 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
85 84
86 QPEMenuBar *menuBar = new QPEMenuBar(this); 85 QPEMenuBar *menuBar = new QPEMenuBar(this);
87// fileMenu = new QPopupMenu( this );
88 fileMenu = new QPopupMenu( this ); 86 fileMenu = new QPopupMenu( this );
89 viewMenu = new QPopupMenu( this ); 87 viewMenu = new QPopupMenu( this );
90 88
91 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 ); 89 layout->addMultiCellWidget( menuBar, 0, 0, 0, 1 );
92 90
93 menuBar->insertItem( tr( "File" ), fileMenu); 91 menuBar->insertItem( tr( "File" ), fileMenu);
94 menuBar->insertItem( tr( "View" ), viewMenu); 92 menuBar->insertItem( tr( "View" ), viewMenu);
95 93
96 qpeDirButton= new QToolButton(this,"QPEButton"); 94 qpeDirButton= new QToolButton(this,"QPEButton");
97 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton"); 95 qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
98// qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton");
99 qpeDirButton ->setFixedSize( QSize( 20, 20 ) ); 96 qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
100 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) ); 97 connect( qpeDirButton ,SIGNAL(released()),this,SLOT( QPEButtonPushed()) );
101 //qpeDirButton->setFlat(TRUE);
102 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2); 98 layout->addMultiCellWidget( qpeDirButton , 0, 0, 2, 2);
103 99
104 cfButton = new QToolButton( this,"CFButton"); 100 cfButton = new QToolButton( this,"CFButton");
105 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia")); 101 cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
106// cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
107 cfButton ->setFixedSize( QSize( 20, 20 ) ); 102 cfButton ->setFixedSize( QSize( 20, 20 ) );
108 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) ); 103 connect( cfButton ,SIGNAL(released()),this,SLOT( CFButtonPushed()) );
109 //cfButton->setFlat(TRUE);
110 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3); 104 layout->addMultiCellWidget( cfButton , 0, 0, 3, 3);
111 105
112 sdButton = new QToolButton( this,"SDButton"); 106 sdButton = new QToolButton( this,"SDButton");
113 sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard")); 107 sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard"));
114// sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
115 sdButton->setFixedSize( QSize( 20, 20 ) ); 108 sdButton->setFixedSize( QSize( 20, 20 ) );
116 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) ); 109 connect( sdButton ,SIGNAL(released()),this,SLOT( SDButtonPushed()) );
117// sdButton->setFlat(TRUE);
118 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4); 110 layout->addMultiCellWidget( sdButton , 0, 0, 4, 4);
119 111
120 cdUpButton = new QToolButton( this,"cdUpButton"); 112 cdUpButton = new QToolButton( this,"cdUpButton");
121 cdUpButton->setPixmap(Resource::loadPixmap("up")); 113 cdUpButton->setPixmap(Resource::loadPixmap("up"));
122// cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
123 cdUpButton ->setFixedSize( QSize( 20, 20 ) ); 114 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
124 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) ); 115 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
125 //cdUpButton ->setFlat(TRUE);
126 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5); 116 layout->addMultiCellWidget( cdUpButton , 0, 0, 5, 5);
127 117
128 docButton = new QToolButton( this,"docsButton"); 118 docButton = new QToolButton( this,"docsButton");
129 docButton->setPixmap(Resource::loadPixmap("DocsIcon")); 119 docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
130// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
131 docButton->setFixedSize( QSize( 20, 20 ) ); 120 docButton->setFixedSize( QSize( 20, 20 ) );
132 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); 121 connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
133// docButton->setFlat(TRUE);
134 layout->addMultiCellWidget( docButton, 0, 0, 6, 6); 122 layout->addMultiCellWidget( docButton, 0, 0, 6, 6);
135 123
136 homeButton = new QToolButton( this,"homeButton"); 124 homeButton = new QToolButton( this,"homeButton");
137 homeButton->setPixmap(Resource::loadPixmap("home")); 125 homeButton->setPixmap(Resource::loadPixmap("home"));
138// homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
139 homeButton->setFixedSize( QSize( 20, 20 ) ); 126 homeButton->setFixedSize( QSize( 20, 20 ) );
140 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) ); 127 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
141// homeButton->setFlat(TRUE);
142 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7); 128 layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
143// fileMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
144// fileMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
145// fileMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
146 129
147 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 130 fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
148 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 131 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
149 fileMenu->insertSeparator(); 132 fileMenu->insertSeparator();
150 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); 133 fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
151 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); 134 fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ));
152 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); 135 fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ));
153 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); 136 fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ));
154 fileMenu->insertSeparator(); 137 fileMenu->insertSeparator();
155 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); 138 fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ));
156 fileMenu->setCheckable(TRUE); 139 fileMenu->setCheckable(TRUE);
157 140
@@ -178,38 +161,35 @@ AdvancedFm::AdvancedFm( )
178 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); 161 layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7);
179 162
180 163
181 TabWidget = new QTabWidget( this, "TabWidget" ); 164 TabWidget = new QTabWidget( this, "TabWidget" );
182 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); 165 layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7);
183 166
184 tab = new QWidget( TabWidget, "tab" ); 167 tab = new QWidget( TabWidget, "tab" );
185 tabLayout = new QGridLayout( tab ); 168 tabLayout = new QGridLayout( tab );
186 tabLayout->setSpacing( 2); 169 tabLayout->setSpacing( 2);
187 tabLayout->setMargin( 2); 170 tabLayout->setMargin( 2);
188 171
189 Local_View = new QListView( tab, "Local_View" ); 172 Local_View = new QListView( tab, "Local_View" );
190// Local_View->setResizePolicy( QListView::AutoOneFit );
191 Local_View->addColumn( tr("File"),130); 173 Local_View->addColumn( tr("File"),130);
192 Local_View->addColumn( tr("Size"),-1); 174 Local_View->addColumn( tr("Size"),-1);
193 Local_View->setColumnAlignment(1,QListView::AlignRight); 175 Local_View->setColumnAlignment(1,QListView::AlignRight);
194 Local_View->addColumn( tr("Date"),-1); 176 Local_View->addColumn( tr("Date"),-1);
195 Local_View->setColumnAlignment(2,QListView::AlignRight); 177 Local_View->setColumnAlignment(2,QListView::AlignRight);
196 Local_View->setAllColumnsShowFocus(TRUE); 178 Local_View->setAllColumnsShowFocus(TRUE);
197 Local_View->setMultiSelection( TRUE ); 179 Local_View->setMultiSelection( TRUE );
198 Local_View->setSelectionMode(QListView::Extended); 180 Local_View->setSelectionMode(QListView::Extended);
199 181
200 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); 182 QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
201 183
202
203
204 tabLayout->addWidget( Local_View, 0, 0 ); 184 tabLayout->addWidget( Local_View, 0, 0 );
205 185
206 connect( Local_View, SIGNAL( clicked( QListViewItem*)), 186 connect( Local_View, SIGNAL( clicked( QListViewItem*)),
207 this,SLOT( localListClicked(QListViewItem *)) ); 187 this,SLOT( localListClicked(QListViewItem *)) );
208 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 188 connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
209 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); 189 this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) );
210 190
211 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); 191 connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
212 192
213 TabWidget->insertTab( tab, tr("1")); 193 TabWidget->insertTab( tab, tr("1"));
214 194
215 tab_2 = new QWidget( TabWidget, "tab_2" ); 195 tab_2 = new QWidget( TabWidget, "tab_2" );
@@ -225,25 +205,24 @@ AdvancedFm::AdvancedFm( )
225 Remote_View->setColumnAlignment(2,QListView::AlignRight); 205 Remote_View->setColumnAlignment(2,QListView::AlignRight);
226 Remote_View->setAllColumnsShowFocus(TRUE); 206 Remote_View->setAllColumnsShowFocus(TRUE);
227 Remote_View->setMultiSelection( TRUE ); 207 Remote_View->setMultiSelection( TRUE );
228 Remote_View->setSelectionMode(QListView::Extended); 208 Remote_View->setSelectionMode(QListView::Extended);
229 209
230 210
231 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); 211 QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
232 212
233 connect( Remote_View, SIGNAL( clicked( QListViewItem*)), 213 connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
234 this,SLOT( remoteListClicked(QListViewItem *)) ); 214 this,SLOT( remoteListClicked(QListViewItem *)) );
235 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 215 connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
236 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); 216 this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) );
237// connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) );
238 217
239 tabLayout_2->addWidget( Remote_View, 0, 0 ); 218 tabLayout_2->addWidget( Remote_View, 0, 0 );
240 219
241 220
242 TabWidget->insertTab( tab_2, tr( "2")); 221 TabWidget->insertTab( tab_2, tr( "2"));
243 222
244 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 223 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
245 this,SLOT(tabChanged(QWidget*))); 224 this,SLOT(tabChanged(QWidget*)));
246 225
247 /* tab_3 = new QWidget( TabWidget, "tab_3" ); 226 /* tab_3 = new QWidget( TabWidget, "tab_3" );
248 tabLayout_3 = new QGridLayout( tab_3 ); 227 tabLayout_3 = new QGridLayout( tab_3 );
249 tabLayout_3->setSpacing( 2); 228 tabLayout_3->setSpacing( 2);
@@ -258,27 +237,24 @@ AdvancedFm::AdvancedFm( )
258 237
259QListView *fileTree; 238QListView *fileTree;
260 fileTree = new QListView( tab_3, "tree" ); 239 fileTree = new QListView( tab_3, "tree" );
261 240
262 241
263 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 ); 242 tabLayout_3->addMultiCellWidget( fileTree, 0, 0, 0, 3 );
264 243
265 TabWidget->insertTab( tab_3, tr( "Remote" ) ); 244 TabWidget->insertTab( tab_3, tr( "Remote" ) );
266 */ 245 */
267 246
268/////////////// 247///////////////
269 248
270////////////////////
271
272
273 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 249 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
274 currentDir.setPath( QDir::currentDirPath()); 250 currentDir.setPath( QDir::currentDirPath());
275 251
276 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 252 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
277 currentRemoteDir.setPath( QDir::currentDirPath()); 253 currentRemoteDir.setPath( QDir::currentDirPath());
278 254
279 b = TRUE; 255 b = TRUE;
280 256
281 filterStr="*"; 257 filterStr="*";
282 b=FALSE; 258 b=FALSE;
283 259
284 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); 260 connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) );
@@ -318,143 +294,115 @@ void AdvancedFm::tabChanged(QWidget *w)
318 } 294 }
319} 295}
320 296
321 297
322void AdvancedFm::populateLocalView() 298void AdvancedFm::populateLocalView()
323{ 299{
324 QPixmap pm; 300 QPixmap pm;
325 Local_View->clear(); 301 Local_View->clear();
326 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 302 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
327 currentDir.setMatchAllDirs(TRUE); 303 currentDir.setMatchAllDirs(TRUE);
328 currentDir.setNameFilter(filterStr); 304 currentDir.setNameFilter(filterStr);
329 QString fileL, fileS, fileDate; 305 QString fileL, fileS, fileDate;
330// qDebug(currentDir.canonicalPath());
331// struct stat buf;
332// mode_t mode;
333 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 306 QString fs= getFileSystemType((const QString &) currentDir.canonicalPath());
334 setCaption("AdvancedFm :: "+fs); 307 setCaption("AdvancedFm :: "+fs);
335 bool isDir=FALSE; 308 bool isDir=FALSE;
336 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 309 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
337 QFileInfoListIterator it(*list); 310 QFileInfoListIterator it(*list);
338 QFileInfo *fi; 311 QFileInfo *fi;
339 while ( (fi=it.current()) ) { 312 while ( (fi=it.current()) ) {
340 if (fi->isSymLink() ) { 313 if (fi->isSymLink() ) {
341 QString symLink=fi->readLink(); 314 QString symLink=fi->readLink();
342// qDebug("Symlink detected "+symLink);
343 QFileInfo sym( symLink); 315 QFileInfo sym( symLink);
344 fileS.sprintf( "%10li", sym.size() ); 316 fileS.sprintf( "%10li", sym.size() );
345 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 317 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
346 fileDate = sym.lastModified().toString(); 318 fileDate = sym.lastModified().toString();
347 } else { 319 } else {
348 fileS.sprintf( "%10li", fi->size() ); 320 fileS.sprintf( "%10li", fi->size() );
349 fileL.sprintf( "%s",fi->fileName().data() ); 321 fileL.sprintf( "%s",fi->fileName().data() );
350 fileDate= fi->lastModified().toString(); 322 fileDate= fi->lastModified().toString();
351 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { 323 if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) {
352 fileL+="/"; 324 fileL+="/";
353 isDir=TRUE; 325 isDir=TRUE;
354// qDebug( fileL);
355 } 326 }
356 } 327 }
357 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 328 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL);
358 if(fileL !="./" && fi->exists()) { 329 if(fileL !="./" && fi->exists()) {
359 item= new QListViewItem( Local_View, fileL, fileS , fileDate); 330 item= new QListViewItem( Local_View, fileL, fileS , fileDate);
360 331
361 if(isDir || fileL.find("/",0,TRUE) != -1) { 332 if(isDir || fileL.find("/",0,TRUE) != -1) {
362 333
363 if( !QDir( fi->filePath() ).isReadable()) //is directory 334 if( !QDir( fi->filePath() ).isReadable()) //is directory
364 pm = Resource::loadPixmap( "lockedfolder" ); 335 pm = Resource::loadPixmap( "lockedfolder" );
365 else 336 else
366 pm= Resource::loadPixmap( "folder" ); 337 pm= Resource::loadPixmap( "folder" );
367// item->setPixmap( 0,pm );
368 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 338 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
369 pm = Resource::loadPixmap( "exec"); 339 pm = Resource::loadPixmap( "exec");
370 } else if( (fileInfo.permission( QFileInfo::ExeUser) 340 } else if( (fileInfo.permission( QFileInfo::ExeUser)
371 | fileInfo.permission( QFileInfo::ExeGroup) 341 | fileInfo.permission( QFileInfo::ExeGroup)
372 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 342 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
373 pm = Resource::loadPixmap( "exec"); 343 pm = Resource::loadPixmap( "exec");
374// else { //is exec
375// pm = Resource::loadPixmap( "exec");
376// }
377// // item->setPixmap( 0,pm);
378 } else if( !fi->isReadable() ) { 344 } else if( !fi->isReadable() ) {
379 pm = Resource::loadPixmap( "locked" ); 345 pm = Resource::loadPixmap( "locked" );
380// item->setPixmap( 0,pm);
381 } else { //everything else goes by mimetype 346 } else { //everything else goes by mimetype
382 MimeType mt(fi->filePath()); 347 MimeType mt(fi->filePath());
383 pm=mt.pixmap(); //sets the correct pixmap for mimetype 348 pm=mt.pixmap(); //sets the correct pixmap for mimetype
384 if(pm.isNull()) 349 if(pm.isNull())
385 pm = Resource::loadPixmap( "UnknownDocument-14" ); 350 pm = Resource::loadPixmap( "UnknownDocument-14" );
386// item->setPixmap( 0,pm);
387 } 351 }
388 item->setPixmap( 0,pm); 352 item->setPixmap( 0,pm);
389 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 353 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
390 // overlay link image 354 // overlay link image
391 pm= Resource::loadPixmap( "folder" ); 355 pm= Resource::loadPixmap( "folder" );
392 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 356 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
393 QPainter painter( &pm ); 357 QPainter painter( &pm );
394 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 358 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
395 pm.setMask( pm.createHeuristicMask( FALSE ) ); 359 pm.setMask( pm.createHeuristicMask( FALSE ) );
396 item->setPixmap( 0, pm); 360 item->setPixmap( 0, pm);
397 } 361 }
398 } 362 }
399 isDir=FALSE; 363 isDir=FALSE;
400 ++it; 364 ++it;
401 } 365 }
402 366
403 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 367 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
404 struct stat buf; 368 struct stat buf;
405// struct stat st;
406 dev_t devT; 369 dev_t devT;
407// mode_t mode;
408 DIR *dir; 370 DIR *dir;
409// int fd = 0;
410 struct dirent *mydirent; 371 struct dirent *mydirent;
411// int i = 1;
412 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 372 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
413 while ((mydirent = readdir(dir)) != NULL) { 373 while ((mydirent = readdir(dir)) != NULL) {
414 lstat( mydirent->d_name, &buf); 374 lstat( mydirent->d_name, &buf);
415 qDebug(mydirent->d_name); 375 qDebug(mydirent->d_name);
416// mode = buf.st_mode;
417 fileL.sprintf("%s", mydirent->d_name); 376 fileL.sprintf("%s", mydirent->d_name);
418// fileS.sprintf("%d, %d", ); //this isn't correct
419 devT = buf.st_dev; 377 devT = buf.st_dev;
420 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 378 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
421// fileS.sprintf("%d,%d", devT, devT);
422 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 379 fileDate.sprintf("%s", ctime( &buf.st_mtime));
423 if( fileL.find(".") == -1 ){ 380 if( fileL.find(".") == -1 ){
424 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 381 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
425 pm = Resource::loadPixmap( "UnknownDocument-14" ); 382 pm = Resource::loadPixmap( "UnknownDocument-14" );
426 item->setPixmap( 0,pm); 383 item->setPixmap( 0,pm);
427 } 384 }
428 } 385 }
429 386
430 closedir(dir); 387 closedir(dir);
431 } 388 }
432 389
433 Local_View->setSorting( 3,FALSE); 390 Local_View->setSorting( 3,FALSE);
434 fillCombo( (const QString &) currentDir.canonicalPath()); 391 fillCombo( (const QString &) currentDir.canonicalPath());
435} 392}
436 393
437 394
438void AdvancedFm::populateRemoteView() 395void AdvancedFm::populateRemoteView()
439{ 396{
440// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
441// QListViewItemIterator it( Remote_View );
442// for ( ; it.current(); ++it ) {
443// if ( it.current()->isSelected() ) {
444// QString strItem = it.current()->text(0);
445// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
446// QFileInfo fi(localFile);
447// }
448// }
449 QPixmap pm; 397 QPixmap pm;
450 Remote_View->clear(); 398 Remote_View->clear();
451 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 399 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
452 currentRemoteDir.setMatchAllDirs(TRUE); 400 currentRemoteDir.setMatchAllDirs(TRUE);
453 currentRemoteDir.setNameFilter(filterStr); 401 currentRemoteDir.setNameFilter(filterStr);
454 QString fileL, fileS, fileDate; 402 QString fileL, fileS, fileDate;
455 403
456 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 404 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
457 setCaption("AdvancedFm :: "+fs); 405 setCaption("AdvancedFm :: "+fs);
458 bool isDir=FALSE; 406 bool isDir=FALSE;
459 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 407 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
460 QFileInfoListIterator it(*list); 408 QFileInfoListIterator it(*list);
@@ -479,72 +427,61 @@ void AdvancedFm::populateRemoteView()
479 } 427 }
480 } 428 }
481 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); 429 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL);
482 if(fileL !="./" && fi->exists()) { 430 if(fileL !="./" && fi->exists()) {
483 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 431 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
484 QPixmap pm; 432 QPixmap pm;
485 433
486 if(isDir || fileL.find("/",0,TRUE) != -1) { 434 if(isDir || fileL.find("/",0,TRUE) != -1) {
487 if( !QDir( fi->filePath() ).isReadable()) 435 if( !QDir( fi->filePath() ).isReadable())
488 pm = Resource::loadPixmap( "lockedfolder" ); 436 pm = Resource::loadPixmap( "lockedfolder" );
489 else 437 else
490 pm= Resource::loadPixmap( "folder" ); 438 pm= Resource::loadPixmap( "folder" );
491// item->setPixmap( 0,pm );
492 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 439 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
493 pm = Resource::loadPixmap( "exec"); 440 pm = Resource::loadPixmap( "exec");
494 } else if( (fileInfo.permission( QFileInfo::ExeUser) 441 } else if( (fileInfo.permission( QFileInfo::ExeUser)
495 | fileInfo.permission( QFileInfo::ExeGroup) 442 | fileInfo.permission( QFileInfo::ExeGroup)
496 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 443 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
497 pm = Resource::loadPixmap( "exec"); 444 pm = Resource::loadPixmap( "exec");
498// item->setPixmap( 0,pm);
499 } else if( !fi->isReadable() ) { 445 } else if( !fi->isReadable() ) {
500 pm = Resource::loadPixmap( "locked" ); 446 pm = Resource::loadPixmap( "locked" );
501// item->setPixmap( 0,pm);
502 } else { 447 } else {
503 MimeType mt(fi->filePath()); 448 MimeType mt(fi->filePath());
504 pm=mt.pixmap(); //sets the correct pixmap for mimetype 449 pm=mt.pixmap(); //sets the correct pixmap for mimetype
505 if(pm.isNull()) 450 if(pm.isNull())
506 pm = Resource::loadPixmap( "UnknownDocument-14" ); 451 pm = Resource::loadPixmap( "UnknownDocument-14" );
507// item->setPixmap( 0,pm);
508 } 452 }
509 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 453 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
510 // overlay link image 454 // overlay link image
511 pm= Resource::loadPixmap( "folder" ); 455 pm= Resource::loadPixmap( "folder" );
512 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 456 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
513 QPainter painter( &pm ); 457 QPainter painter( &pm );
514 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 458 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
515 pm.setMask( pm.createHeuristicMask( FALSE ) ); 459 pm.setMask( pm.createHeuristicMask( FALSE ) );
516// item->setPixmap( 0, pm);
517 } 460 }
518 item->setPixmap( 0, pm); 461 item->setPixmap( 0, pm);
519 } 462 }
520 isDir=FALSE; 463 isDir=FALSE;
521 ++it; 464 ++it;
522 } 465 }
523 466
524 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 467 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
525 struct stat buf; 468 struct stat buf;
526// struct stat st;
527// mode_t mode;
528 DIR *dir; 469 DIR *dir;
529// int fd = 0;
530 struct dirent *mydirent; 470 struct dirent *mydirent;
531// int i = 1;
532 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 471 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
533 while ((mydirent = readdir(dir)) != NULL) { 472 while ((mydirent = readdir(dir)) != NULL) {
534 lstat( mydirent->d_name, &buf); 473 lstat( mydirent->d_name, &buf);
535 qDebug(mydirent->d_name); 474 qDebug(mydirent->d_name);
536// mode = buf.st_mode;
537 fileL.sprintf("%s", mydirent->d_name); 475 fileL.sprintf("%s", mydirent->d_name);
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); 476 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
540 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 477 fileDate.sprintf("%s", ctime( &buf.st_mtime));
541 if( fileL.find(".") == -1 ){ 478 if( fileL.find(".") == -1 ){
542 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 479 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
543 pm = Resource::loadPixmap( "UnknownDocument-14" ); 480 pm = Resource::loadPixmap( "UnknownDocument-14" );
544 item->setPixmap( 0,pm); 481 item->setPixmap( 0,pm);
545 } 482 }
546 } 483 }
547 484
548 closedir(dir); 485 closedir(dir);
549 } 486 }
550 487
@@ -640,51 +577,43 @@ void AdvancedFm::doLocalCd()
640} 577}
641 578
642void AdvancedFm::doRemoteCd() 579void AdvancedFm::doRemoteCd()
643{ 580{
644 localListClicked( Remote_View->currentItem()); 581 localListClicked( Remote_View->currentItem());
645} 582}
646 583
647void AdvancedFm::showHidden() 584void AdvancedFm::showHidden()
648{ 585{
649 if (b) { 586 if (b) {
650 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 587 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
651 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 588 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
652// localMenu->setItemChecked(localMenu->idAt(0),TRUE);
653// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
654 b=FALSE; 589 b=FALSE;
655 590
656 } else { 591 } else {
657 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 592 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
658 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 593 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
659// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
660// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
661 b=TRUE; 594 b=TRUE;
662 } 595 }
663 populateLocalView(); 596 populateLocalView();
664 597
665} 598}
666 599
667void AdvancedFm::showRemoteHidden() 600void AdvancedFm::showRemoteHidden()
668{ 601{
669 if (b) { 602 if (b) {
670 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 603 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
671// viewMenu->setItemChecked(localMenu->idAt(0),TRUE);
672// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
673 b=TRUE; 604 b=TRUE;
674 605
675 } else { 606 } else {
676 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 607 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
677// localMenu->setItemChecked(localMenu->idAt(0),FALSE);
678// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
679 b=FALSE; 608 b=FALSE;
680 } 609 }
681 populateRemoteView(); 610 populateRemoteView();
682} 611}
683 612
684void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 613void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
685{ 614{
686qDebug("list pressed"); 615qDebug("list pressed");
687 switch (mouse) { 616 switch (mouse) {
688 case 1: 617 case 1:
689 break; 618 break;
690 case 2: 619 case 2:
@@ -699,77 +628,73 @@ void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint
699 628
700 switch (mouse) { 629 switch (mouse) {
701 case 1: 630 case 1:
702 break; 631 break;
703 case 2: 632 case 2:
704 menuTimer.start( 750, TRUE ); 633 menuTimer.start( 750, TRUE );
705 qDebug("Start menu timer"); 634 qDebug("Start menu timer");
706 break; 635 break;
707 }; 636 };
708} 637}
709 638
710void AdvancedFm::runThis() { 639void AdvancedFm::runThis() {
711// QFileInfo *fi;
712 QString fs; 640 QString fs;
713 if (TabWidget->currentPageIndex() == 0) { 641 if (TabWidget->currentPageIndex() == 0) {
714 QString curFile = Local_View->currentItem()->text(0); 642 QString curFile = Local_View->currentItem()->text(0);
715 if(curFile != "../") { 643 if(curFile != "../") {
716 644
717 fs= getFileSystemType((const QString &) currentDir.canonicalPath()); 645 fs= getFileSystemType((const QString &) currentDir.canonicalPath());
718 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); 646 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile);
719 qDebug( fileInfo.owner()); 647 qDebug( fileInfo.owner());
720 if( (fileInfo.permission( QFileInfo::ExeUser) 648 if( (fileInfo.permission( QFileInfo::ExeUser)
721 | fileInfo.permission( QFileInfo::ExeGroup) 649 | fileInfo.permission( QFileInfo::ExeGroup)
722 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 650 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
723 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 651 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
724// if( fileInfo.isExecutable() |
725 QCopEnvelope e("QPE/System", "execute(QString)" ); 652 QCopEnvelope e("QPE/System", "execute(QString)" );
726 e << curFile; 653 e << curFile;
727 } else { 654 } else {
728 curFile = currentDir.canonicalPath()+"/"+curFile; 655 curFile = currentDir.canonicalPath()+"/"+curFile;
729 DocLnk nf(curFile); 656 DocLnk nf(curFile);
730 QString execStr = nf.exec(); 657 QString execStr = nf.exec();
731 qDebug( execStr); 658 qDebug( execStr);
732 if( execStr.isEmpty() ) { 659 if( execStr.isEmpty() ) {
733 } else { 660 } else {
734 nf.execute(); 661 nf.execute();
735 } 662 }
736 } 663 }
737 } 664 }
738// MimeType mt( curFile);
739 } else { 665 } else {
740 QString curFile = Remote_View->currentItem()->text(0); 666 QString curFile = Remote_View->currentItem()->text(0);
741 if(curFile != "../") { 667 if(curFile != "../") {
742 668
743 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 669 fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
744 qDebug("Filesystemtype is "+fs); 670 qDebug("Filesystemtype is "+fs);
745 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); 671 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile);
746 if( (fileInfo.permission( QFileInfo::ExeUser) 672 if( (fileInfo.permission( QFileInfo::ExeUser)
747 | fileInfo.permission( QFileInfo::ExeGroup) 673 | fileInfo.permission( QFileInfo::ExeGroup)
748 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 674 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
749 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 675 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
750 QCopEnvelope e("QPE/System", "execute(QString)" ); 676 QCopEnvelope e("QPE/System", "execute(QString)" );
751 e << curFile; 677 e << curFile;
752 } else { 678 } else {
753 curFile = currentRemoteDir.canonicalPath()+"/"+curFile; 679 curFile = currentRemoteDir.canonicalPath()+"/"+curFile;
754 DocLnk nf(curFile); 680 DocLnk nf(curFile);
755 QString execStr = nf.exec(); 681 QString execStr = nf.exec();
756 qDebug(execStr); 682 qDebug(execStr);
757 if( execStr.isEmpty() ) { 683 if( execStr.isEmpty() ) {
758 } else { 684 } else {
759 nf.execute(); 685 nf.execute();
760 } 686 }
761 } 687 }
762 } 688 }
763// MimeType mt( curFile);
764 } 689 }
765} 690}
766 691
767void AdvancedFm::runText() { 692void AdvancedFm::runText() {
768 if (TabWidget->currentPageIndex() == 0) { 693 if (TabWidget->currentPageIndex() == 0) {
769 QString curFile = Local_View->currentItem()->text(0); 694 QString curFile = Local_View->currentItem()->text(0);
770 if(curFile != "../") { 695 if(curFile != "../") {
771 curFile = currentDir.canonicalPath()+"/"+curFile; 696 curFile = currentDir.canonicalPath()+"/"+curFile;
772 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); 697 QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" );
773 e << curFile; 698 e << curFile;
774 } 699 }
775 } else { 700 } else {
@@ -1049,25 +974,24 @@ void AdvancedFm::doProperties() {
1049 QStringList curFileList = getPath(); 974 QStringList curFileList = getPath();
1050 QString filePath; 975 QString filePath;
1051 if (TabWidget->currentPageIndex() == 0) { 976 if (TabWidget->currentPageIndex() == 0) {
1052 filePath = currentDir.canonicalPath()+"/"; 977 filePath = currentDir.canonicalPath()+"/";
1053 } else { 978 } else {
1054 filePath= currentRemoteDir.canonicalPath()+"/"; 979 filePath= currentRemoteDir.canonicalPath()+"/";
1055 } 980 }
1056 // qDebug("%d",curFileList.count()); 981 // qDebug("%d",curFileList.count());
1057 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 982 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1058 qDebug((filePath+*it)); 983 qDebug((filePath+*it));
1059 DocLnk lnk( (filePath+*it)); 984 DocLnk lnk( (filePath+*it));
1060 LnkProperties prop( &lnk ); 985 LnkProperties prop( &lnk );
1061// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
1062 prop.showMaximized(); 986 prop.showMaximized();
1063 prop.exec(); 987 prop.exec();
1064 } 988 }
1065} 989}
1066 990
1067QStringList AdvancedFm::getPath() { 991QStringList AdvancedFm::getPath() {
1068 QStringList strList; 992 QStringList strList;
1069 if (TabWidget->currentPageIndex() == 0) { 993 if (TabWidget->currentPageIndex() == 0) {
1070 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 994 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1071 QListViewItemIterator it( Local_View ); 995 QListViewItemIterator it( Local_View );
1072 for ( ; it.current(); ++it ) { 996 for ( ; it.current(); ++it ) {
1073 if ( it.current()->isSelected() ) { 997 if ( it.current()->isSelected() ) {
@@ -1166,33 +1090,25 @@ void AdvancedFm::upDir()
1166 } 1090 }
1167} 1091}
1168 1092
1169void AdvancedFm::copy() 1093void AdvancedFm::copy()
1170{ 1094{
1171 QStringList curFileList = getPath(); 1095 QStringList curFileList = getPath();
1172 if( curFileList.count() > 0) { 1096 if( curFileList.count() > 0) {
1173 QString curFile; 1097 QString curFile;
1174 if (TabWidget->currentPageIndex() == 0) { 1098 if (TabWidget->currentPageIndex() == 0) {
1175 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1099 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1176 1100
1177 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1101 QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1178// if(destFile.right(1).find("/",0,TRUE) == -1)
1179// destFile+="/";
1180// destFile +=(*it);
1181
1182 curFile = currentDir.canonicalPath()+"/"+(*it); 1102 curFile = currentDir.canonicalPath()+"/"+(*it);
1183// if(curFile.right(1).find("/",0,TRUE) == -1)
1184// curFile +="/";
1185// curFile +=(*it);
1186
1187 QFile f(destFile); 1103 QFile f(destFile);
1188 if( f.exists()) { 1104 if( f.exists()) {
1189 switch ( QMessageBox::warning(this,tr("Delete"), 1105 switch ( QMessageBox::warning(this,tr("Delete"),
1190 destFile+tr(" already exists\nDo you really want to delete it?"), 1106 destFile+tr(" already exists\nDo you really want to delete it?"),
1191 tr("Yes"),tr("No"),0,0,1) ) { 1107 tr("Yes"),tr("No"),0,0,1) ) {
1192 case 0: 1108 case 0:
1193 f.remove(); 1109 f.remove();
1194 break; 1110 break;
1195 case 1: 1111 case 1:
1196 return; 1112 return;
1197 break; 1113 break;
1198 }; 1114 };
@@ -1239,26 +1155,24 @@ void AdvancedFm::copy()
1239void AdvancedFm::copyAs() 1155void AdvancedFm::copyAs()
1240{ 1156{
1241 QStringList curFileList = getPath(); 1157 QStringList curFileList = getPath();
1242 if( curFileList.count() > 0) { 1158 if( curFileList.count() > 0) {
1243 QString curFile; 1159 QString curFile;
1244 InputDialog *fileDlg; 1160 InputDialog *fileDlg;
1245 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); 1161 fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1246 1162
1247 if (TabWidget->currentPageIndex() == 0) { 1163 if (TabWidget->currentPageIndex() == 0) {
1248 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1164 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1249 QString destFile; 1165 QString destFile;
1250 curFile = currentDir.canonicalPath()+"/"+(*it); 1166 curFile = currentDir.canonicalPath()+"/"+(*it);
1251// InputDialog *fileDlg;
1252// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1253 fileDlg->setInputText((const QString &) destFile ); 1167 fileDlg->setInputText((const QString &) destFile );
1254 fileDlg->exec(); 1168 fileDlg->exec();
1255 if( fileDlg->result() == 1 ) { 1169 if( fileDlg->result() == 1 ) {
1256 QString filename = fileDlg->LineEdit1->text(); 1170 QString filename = fileDlg->LineEdit1->text();
1257 destFile = currentRemoteDir.canonicalPath()+"/"+(*it); 1171 destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
1258 1172
1259 QFile f(destFile); 1173 QFile f(destFile);
1260 if( f.exists()) { 1174 if( f.exists()) {
1261 switch (QMessageBox::warning(this,tr("Delete"), 1175 switch (QMessageBox::warning(this,tr("Delete"),
1262 destFile+tr(" already exists\nDo you really want to delete it?"), 1176 destFile+tr(" already exists\nDo you really want to delete it?"),
1263 tr("Yes"),tr("No"),0,0,1) ) { 1177 tr("Yes"),tr("No"),0,0,1) ) {
1264 case 0: 1178 case 0:
@@ -1319,26 +1233,24 @@ void AdvancedFm::copyAs()
1319 1233
1320void AdvancedFm::copySameDir() { 1234void AdvancedFm::copySameDir() {
1321 QStringList curFileList = getPath(); 1235 QStringList curFileList = getPath();
1322 if( curFileList.count() > 0) { 1236 if( curFileList.count() > 0) {
1323 QString curFile; 1237 QString curFile;
1324 InputDialog *fileDlg; 1238 InputDialog *fileDlg;
1325 1239
1326 if (TabWidget->currentPageIndex() == 0) { 1240 if (TabWidget->currentPageIndex() == 0) {
1327 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 1241 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
1328 QString destFile; 1242 QString destFile;
1329 curFile = currentDir.canonicalPath()+"/"+(*it); 1243 curFile = currentDir.canonicalPath()+"/"+(*it);
1330 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 1244 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
1331// InputDialog *fileDlg;
1332// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
1333 fileDlg->setInputText((const QString &) destFile ); 1245 fileDlg->setInputText((const QString &) destFile );
1334 fileDlg->exec(); 1246 fileDlg->exec();
1335 if( fileDlg->result() == 1 ) { 1247 if( fileDlg->result() == 1 ) {
1336 QString filename = fileDlg->LineEdit1->text(); 1248 QString filename = fileDlg->LineEdit1->text();
1337 destFile = currentDir.canonicalPath()+"/"+filename; 1249 destFile = currentDir.canonicalPath()+"/"+filename;
1338 1250
1339 QFile f(destFile); 1251 QFile f(destFile);
1340 if( f.exists()) { 1252 if( f.exists()) {
1341 switch (QMessageBox::warning(this,tr("Delete"), 1253 switch (QMessageBox::warning(this,tr("Delete"),
1342 destFile+tr(" already exists\nDo you really want to delete it?"), 1254 destFile+tr(" already exists\nDo you really want to delete it?"),
1343 tr("Yes"),tr("No"),0,0,1) ) { 1255 tr("Yes"),tr("No"),0,0,1) ) {
1344 case 0: 1256 case 0:
@@ -1522,34 +1434,32 @@ void AdvancedFm::runCommand() {
1522 if(Remote_View->currentItem()) 1434 if(Remote_View->currentItem())
1523 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); 1435 curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0);
1524 } 1436 }
1525 1437
1526 InputDialog *fileDlg; 1438 InputDialog *fileDlg;
1527 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 1439 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
1528 fileDlg->setInputText(curFile); 1440 fileDlg->setInputText(curFile);
1529 fileDlg->exec(); 1441 fileDlg->exec();
1530 QString command; 1442 QString command;
1531 if( fileDlg->result() == 1 ) { 1443 if( fileDlg->result() == 1 ) {
1532 command = fileDlg->LineEdit1->text(); 1444 command = fileDlg->LineEdit1->text();
1533 1445
1534// int err=0;
1535 Output *outDlg; 1446 Output *outDlg;
1536 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1447 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1537 outDlg->showMaximized(); 1448 outDlg->showMaximized();
1538 outDlg->show(); 1449 outDlg->show();
1539 qApp->processEvents(); 1450 qApp->processEvents();
1540 FILE *fp; 1451 FILE *fp;
1541 char line[130]; 1452 char line[130];
1542 sleep(1); 1453 sleep(1);
1543// if(command.find("2>",0,TRUE) != -1)
1544 command +=" 2>&1"; 1454 command +=" 2>&1";
1545 fp = popen( (const char *) command, "r"); 1455 fp = popen( (const char *) command, "r");
1546 if ( !fp ) { 1456 if ( !fp ) {
1547 qDebug("Could not execute '" + command + "'! err=%d", fp); 1457 qDebug("Could not execute '" + command + "'! err=%d", fp);
1548 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); 1458 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") );
1549 pclose(fp); 1459 pclose(fp);
1550 return; 1460 return;
1551 } else { 1461 } else {
1552 while ( fgets( line, sizeof line, fp)) { 1462 while ( fgets( line, sizeof line, fp)) {
1553 QString lineStr = line; 1463 QString lineStr = line;
1554 lineStr=lineStr.left(lineStr.length()-1); 1464 lineStr=lineStr.left(lineStr.length()-1);
1555 outDlg->OutputEdit->append(lineStr); 1465 outDlg->OutputEdit->append(lineStr);
@@ -1580,25 +1490,24 @@ void AdvancedFm::runCommandStd() {
1580 system(command.latin1()); 1490 system(command.latin1());
1581 } 1491 }
1582} 1492}
1583 1493
1584void AdvancedFm::fileStatus() { 1494void AdvancedFm::fileStatus() {
1585 QString curFile; 1495 QString curFile;
1586 if (TabWidget->currentPageIndex() == 0) { 1496 if (TabWidget->currentPageIndex() == 0) {
1587 curFile = Local_View->currentItem()->text(0); 1497 curFile = Local_View->currentItem()->text(0);
1588 } else { 1498 } else {
1589 curFile = Remote_View->currentItem()->text(0); 1499 curFile = Remote_View->currentItem()->text(0);
1590 } 1500 }
1591 QString command = " stat -l "+ curFile +" 2>&1"; 1501 QString command = " stat -l "+ curFile +" 2>&1";
1592// int err=0;
1593 Output *outDlg; 1502 Output *outDlg;
1594 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); 1503 outDlg = new Output(this, tr("AdvancedFm Output"),FALSE);
1595 outDlg->showMaximized(); 1504 outDlg->showMaximized();
1596 outDlg->show(); 1505 outDlg->show();
1597 qApp->processEvents(); 1506 qApp->processEvents();
1598 FILE *fp; 1507 FILE *fp;
1599 char line[130]; 1508 char line[130];
1600 sleep(1); 1509 sleep(1);
1601 fp = popen( (const char *) command, "r"); 1510 fp = popen( (const char *) command, "r");
1602 if ( !fp ) { 1511 if ( !fp ) {
1603 qDebug("Could not execute '" + command + "'! err=%d", fp); 1512 qDebug("Could not execute '" + command + "'! err=%d", fp);
1604 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); 1513 QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") );
@@ -1755,39 +1664,36 @@ void AdvancedFm::QPEButtonPushed() {
1755 } else { 1664 } else {
1756 currentRemoteDir.cd( current, TRUE); 1665 currentRemoteDir.cd( current, TRUE);
1757 populateRemoteView(); 1666 populateRemoteView();
1758 } 1667 }
1759 update(); 1668 update();
1760} 1669}
1761 1670
1762void AdvancedFm::parsetab(const QString &fileName) { 1671void AdvancedFm::parsetab(const QString &fileName) {
1763 1672
1764 fileSystemTypeList.clear(); 1673 fileSystemTypeList.clear();
1765 fsList.clear(); 1674 fsList.clear();
1766 struct mntent *me; 1675 struct mntent *me;
1767// if(fileName == "/etc/mtab") {
1768 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 1676 FILE *mntfp = setmntent( fileName.latin1(), "r" );
1769 if ( mntfp ) { 1677 if ( mntfp ) {
1770 while ( (me = getmntent( mntfp )) != 0 ) { 1678 while ( (me = getmntent( mntfp )) != 0 ) {
1771 QString deviceName = me->mnt_fsname; 1679 QString deviceName = me->mnt_fsname;
1772 QString filesystemType = me->mnt_type; 1680 QString filesystemType = me->mnt_type;
1773 QString mountDir = me->mnt_dir; 1681 QString mountDir = me->mnt_dir;
1774 if(deviceName != "none") { 1682 if(deviceName != "none") {
1775 if( fsList.contains(filesystemType) == 0 1683 if( fsList.contains(filesystemType) == 0
1776 & filesystemType.find("proc",0,TRUE) == -1 1684 & filesystemType.find("proc",0,TRUE) == -1
1777 & filesystemType.find("cramfs",0,TRUE) == -1 1685 & filesystemType.find("cramfs",0,TRUE) == -1
1778 & filesystemType.find("auto",0,TRUE) == -1) 1686 & filesystemType.find("auto",0,TRUE) == -1)
1779 fsList << filesystemType; 1687 fsList << filesystemType;
1780// deviceList << deviceName;
1781// qDebug(mountDir+"::"+filesystemType);
1782 fileSystemTypeList << mountDir+"::"+filesystemType; 1688 fileSystemTypeList << mountDir+"::"+filesystemType;
1783 } 1689 }
1784 } 1690 }
1785 } 1691 }
1786 endmntent( mntfp ); 1692 endmntent( mntfp );
1787} 1693}
1788 1694
1789QString AdvancedFm::getFileSystemType(const QString &currentText) { 1695QString AdvancedFm::getFileSystemType(const QString &currentText) {
1790 parsetab("/etc/mtab"); //why did TT forget filesystem type? 1696 parsetab("/etc/mtab"); //why did TT forget filesystem type?
1791 QString current = currentText;//.right( currentText.length()-1); 1697 QString current = currentText;//.right( currentText.length()-1);
1792 QString baseFs; 1698 QString baseFs;
1793 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 1699 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
@@ -1836,51 +1742,39 @@ void AdvancedFm::doBeam() {
1836 } 1742 }
1837 } 1743 }
1838 } 1744 }
1839} 1745}
1840 1746
1841} 1747}
1842 1748
1843void AdvancedFm::fileBeamFinished( Ir *ir) { 1749void AdvancedFm::fileBeamFinished( Ir *ir) {
1844 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 1750 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
1845 1751
1846} 1752}
1847 1753
1848
1849// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
1850// QListViewItemIterator it( Local_View );
1851// for ( ; it.current(); ++it ) {
1852// if ( it.current()->isSelected() ) {
1853// QString strItem = it.current()->text(0);
1854// QString localFile = currentDir.canonicalPath()+"/"+strItem;
1855// QFileInfo fi(localFile);
1856// }
1857// }
1858
1859void AdvancedFm::showFileMenu() { 1754void AdvancedFm::showFileMenu() {
1860 1755
1861 QString curApp; 1756 QString curApp;
1862 bool isLocalView = false; 1757 bool isLocalView = false;
1863 if (TabWidget->currentPageIndex() == 0) { 1758 if (TabWidget->currentPageIndex() == 0) {
1864 isLocalView = TRUE; 1759 isLocalView = TRUE;
1865 curApp = Local_View->currentItem()->text(0); 1760 curApp = Local_View->currentItem()->text(0);
1866 } else { 1761 } else {
1867 curApp = Remote_View->currentItem()->text(0); 1762 curApp = Remote_View->currentItem()->text(0);
1868 } 1763 }
1869 1764
1870 MimeType mt( curApp ); 1765 MimeType mt( curApp );
1871 const AppLnk* app = mt.application(); 1766 const AppLnk* app = mt.application();
1872 QFile fi(curApp); 1767 QFile fi(curApp);
1873 1768
1874 // QPopupMenu m;
1875 QPopupMenu *m = new QPopupMenu(0); 1769 QPopupMenu *m = new QPopupMenu(0);
1876 1770
1877 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 1771 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
1878 m->insertSeparator(); 1772 m->insertSeparator();
1879 if ( QFileInfo(fi).isDir() ) { 1773 if ( QFileInfo(fi).isDir() ) {
1880 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 1774 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
1881 } else { 1775 } else {
1882 1776
1883 if ( app ) 1777 if ( app )
1884 m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) ); 1778 m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( runThis() ) );
1885 else if( QFileInfo(fi).isExecutable() ) 1779 else if( QFileInfo(fi).isExecutable() )
1886 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); 1780 m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) );
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 7665fe9..45f00ad 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -101,40 +101,43 @@ protected slots:
101 void runCommandStd(); 101 void runCommandStd();
102 QStringList getPath(); 102 QStringList getPath();
103 void mkSym(); 103 void mkSym();
104 void switchToLocalTab(); 104 void switchToLocalTab();
105 void switchToRemoteTab(); 105 void switchToRemoteTab();
106 106
107protected: 107protected:
108 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 108 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
109 QStringList remoteDirPathStringList, localDirPathStringList; 109 QStringList remoteDirPathStringList, localDirPathStringList;
110 110
111 void keyReleaseEvent( QKeyEvent *); 111 void keyReleaseEvent( QKeyEvent *);
112 QString getFileSystemType(const QString &); 112 QString getFileSystemType(const QString &);
113 QString getDiskSpace(const QString &);
114
113 void parsetab(const QString &fileName); 115 void parsetab(const QString &fileName);
114 116
115protected slots: 117protected slots:
116 void showFileMenu(); 118 void showFileMenu();
117 void cancelMenuTimer(); 119 void cancelMenuTimer();
118 void homeButtonPushed(); 120 void homeButtonPushed();
119 void docButtonPushed(); 121 void docButtonPushed();
120 void SDButtonPushed(); 122 void SDButtonPushed();
121 void CFButtonPushed(); 123 void CFButtonPushed();
122 void QPEButtonPushed(); 124 void QPEButtonPushed();
123 void upDir(); 125 void upDir();
124 void currentPathComboChanged(); 126 void currentPathComboChanged();
125 void copy(); 127 void copy();
126 void copyAs(); 128 void copyAs();
127 void copySameDir(); 129 void copySameDir();
128 void currentPathComboActivated(const QString &); 130 void currentPathComboActivated(const QString &);
129 void fillCombo(const QString &); 131 void fillCombo(const QString &);
130 bool copyFile( const QString & , const QString & ); 132 bool copyFile( const QString & , const QString & );
131 void move(); 133 void move();
132 void fileStatus(); 134 void fileStatus();
133 void doAbout(); 135 void doAbout();
134 void doBeam(); 136 void doBeam();
135 void fileBeamFinished( Ir *); 137 void fileBeamFinished( Ir *);
138
136private: 139private:
137 QTimer menuTimer; 140 QTimer menuTimer;
138}; 141};
139 142
140#endif // ADVANCEDFM_H 143#endif // ADVANCEDFM_H