summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 3aa516c..ec475a4 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -227,252 +227,257 @@ void AdvancedFm::populateRemoteView() {
227 QFileInfo sym( symLink); 227 QFileInfo sym( symLink);
228 fileS.sprintf( "%10i", sym.size() ); 228 fileS.sprintf( "%10i", sym.size() );
229 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); 229 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() );
230 fileDate = sym.lastModified().toString(); 230 fileDate = sym.lastModified().toString();
231 } else { 231 } else {
232 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 232 // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
233 fileS.sprintf( "%10i", fi->size() ); 233 fileS.sprintf( "%10i", fi->size() );
234 fileL.sprintf( "%s",fi->fileName().data() ); 234 fileL.sprintf( "%s",fi->fileName().data() );
235 fileDate= fi->lastModified().toString(); 235 fileDate= fi->lastModified().toString();
236 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 236 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
237 fileL+="/"; 237 fileL+="/";
238 isDir=TRUE; 238 isDir=TRUE;
239 // qDebug( fileL); 239 // qDebug( fileL);
240 } 240 }
241 } 241 }
242 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); 242 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL);
243 if(fileL !="./" && fi->exists()) { 243 if(fileL !="./" && fi->exists()) {
244 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 244 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
245 QPixmap pm; 245 QPixmap pm;
246 246
247 if(isDir || fileL.find("/",0,TRUE) != -1) { 247 if(isDir || fileL.find("/",0,TRUE) != -1) {
248 if( !QDir( fi->filePath() ).isReadable()) 248 if( !QDir( fi->filePath() ).isReadable())
249 pm = Resource::loadPixmap( "lockedfolder" ); 249 pm = Resource::loadPixmap( "lockedfolder" );
250 else 250 else
251 pm= Resource::loadPixmap( "folder" ); 251 pm= Resource::loadPixmap( "folder" );
252 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 252 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
253 pm = Resource::loadPixmap( "exec"); 253 pm = Resource::loadPixmap( "exec");
254 } else if( (fileInfo.permission( QFileInfo::ExeUser) 254 } else if( (fileInfo.permission( QFileInfo::ExeUser)
255 | fileInfo.permission( QFileInfo::ExeGroup) 255 | fileInfo.permission( QFileInfo::ExeGroup)
256 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 256 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
257 pm = Resource::loadPixmap( "exec"); 257 pm = Resource::loadPixmap( "exec");
258 } else if( !fi->isReadable() ) { 258 } else if( !fi->isReadable() ) {
259 pm = Resource::loadPixmap( "locked" ); 259 pm = Resource::loadPixmap( "locked" );
260 } else { 260 } else {
261 MimeType mt(fi->filePath()); 261 MimeType mt(fi->filePath());
262 pm=mt.pixmap(); //sets the correct pixmap for mimetype 262 pm=mt.pixmap(); //sets the correct pixmap for mimetype
263 if(pm.isNull()) 263 if(pm.isNull())
264 pm = Resource::loadPixmap( "UnknownDocument-14" ); 264 pm = Resource::loadPixmap( "UnknownDocument-14" );
265 } 265 }
266 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 266 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
267 // overlay link image 267 // overlay link image
268 pm= Resource::loadPixmap( "folder" ); 268 pm= Resource::loadPixmap( "folder" );
269 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 269 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
270 QPainter painter( &pm ); 270 QPainter painter( &pm );
271 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 271 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
272 pm.setMask( pm.createHeuristicMask( FALSE ) ); 272 pm.setMask( pm.createHeuristicMask( FALSE ) );
273 } 273 }
274 item->setPixmap( 0, pm); 274 item->setPixmap( 0, pm);
275 } 275 }
276 isDir=FALSE; 276 isDir=FALSE;
277 ++it; 277 ++it;
278 } 278 }
279 279
280 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 280 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
281 struct stat buf; 281 struct stat buf;
282 DIR *dir; 282 DIR *dir;
283 struct dirent *mydirent; 283 struct dirent *mydirent;
284 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 284 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
285 while ((mydirent = readdir(dir)) != NULL) { 285 while ((mydirent = readdir(dir)) != NULL) {
286 lstat( mydirent->d_name, &buf); 286 lstat( mydirent->d_name, &buf);
287 qDebug(mydirent->d_name); 287 qDebug(mydirent->d_name);
288 fileL.sprintf("%s", mydirent->d_name); 288 fileL.sprintf("%s", mydirent->d_name);
289 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 289 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
290 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 290 fileDate.sprintf("%s", ctime( &buf.st_mtime));
291 if( fileL.find(".") == -1 ){ 291 if( fileL.find(".") == -1 ){
292 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 292 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
293 pm = Resource::loadPixmap( "UnknownDocument-14" ); 293 pm = Resource::loadPixmap( "UnknownDocument-14" );
294 item->setPixmap( 0,pm); 294 item->setPixmap( 0,pm);
295 } 295 }
296 } 296 }
297 297
298 closedir(dir); 298 closedir(dir);
299 } 299 }
300 300
301 Remote_View->setSorting( 3,FALSE); 301 Remote_View->setSorting( 3,FALSE);
302 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 302 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
303} 303}
304 304
305void AdvancedFm::localListClicked(QListViewItem *selectedItem) { 305void AdvancedFm::localListClicked(QListViewItem *selectedItem) {
306 if(selectedItem) { 306 if(selectedItem) {
307 QString strItem=selectedItem->text(0); 307 QString strItem=selectedItem->text(0);
308 QString strSize=selectedItem->text(1); 308 QString strSize=selectedItem->text(1);
309 strSize=strSize.stripWhiteSpace(); 309 strSize=strSize.stripWhiteSpace();
310 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 310 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
311 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 311 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
312 if(QDir(strItem2).exists() ) { 312 if(QDir(strItem2).exists() ) {
313 currentDir.cd(strItem2, TRUE); 313 currentDir.cd(strItem2, TRUE);
314 populateLocalView(); 314 populateLocalView();
315 315
316 } 316 }
317 } else { // not a symlink 317 } else { // not a symlink
318 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 318 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
319 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 319 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
320 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 320 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
321 currentDir.cd(strItem,FALSE); 321 currentDir.cd(strItem,FALSE);
322 populateLocalView(); 322 populateLocalView();
323 Local_View->ensureItemVisible(Local_View->firstChild());
324
323 } else { 325 } else {
324 currentDir.cdUp(); 326 currentDir.cdUp();
325 populateLocalView(); 327 populateLocalView();
328 Local_View->ensureItemVisible(Local_View->firstChild());
326 } 329 }
327 if(QDir(strItem).exists()){ 330 if(QDir(strItem).exists()){
328 currentDir.cd(strItem, TRUE); 331 currentDir.cd(strItem, TRUE);
332 Local_View->ensureItemVisible(Local_View->firstChild());
329 populateLocalView(); 333 populateLocalView();
330 } 334 }
331 } else { 335 } else {
332 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 336 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
333 if( QFile::exists(strItem ) ) { 337 if( QFile::exists(strItem ) ) {
334 // qDebug("clicked item "+strItem); 338 // qDebug("clicked item "+strItem);
335 // DocLnk doc( strItem, FALSE ); 339 // DocLnk doc( strItem, FALSE );
336 // doc.execute(); 340 // doc.execute();
337 // Local_View->clearSelection(); 341 // Local_View->clearSelection();
338 } 342 }
339 } //end not symlink 343 } //end not symlink
340 chdir(strItem.latin1()); 344 chdir(strItem.latin1());
341 } 345 }
342 Local_View->ensureItemVisible(Local_View->firstChild());
343 346
344 } 347 }
345} 348}
346 349
347void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { 350void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) {
348 351
349 if(selectedItem) { 352 if(selectedItem) {
350 QString strItem=selectedItem->text(0); 353 QString strItem=selectedItem->text(0);
351 QString strSize=selectedItem->text(1); 354 QString strSize=selectedItem->text(1);
352 strSize=strSize.stripWhiteSpace(); 355 strSize=strSize.stripWhiteSpace();
353 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 356 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
354 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 357 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
355 currentRemoteDir.cd(strItem2, TRUE); 358 currentRemoteDir.cd(strItem2, TRUE);
356 populateRemoteView(); 359 populateRemoteView();
357 } else { // not a symlink 360 } else { // not a symlink
358 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 361 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
359 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) { 362 if(QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem)).exists() ) {
360 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 363 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
361 currentRemoteDir.cd(strItem,FALSE); 364 currentRemoteDir.cd(strItem,FALSE);
362 populateRemoteView(); 365 populateRemoteView();
366 Remote_View->ensureItemVisible(Remote_View->firstChild());
363 } else { 367 } else {
364 currentRemoteDir.cdUp(); 368 currentRemoteDir.cdUp();
365 populateRemoteView(); 369 populateRemoteView();
370 Remote_View->ensureItemVisible(Remote_View->firstChild());
366 } 371 }
367 if(QDir(strItem).exists()){ 372 if(QDir(strItem).exists()){
368 currentRemoteDir.cd(strItem, TRUE); 373 currentRemoteDir.cd(strItem, TRUE);
369 populateRemoteView(); 374 populateRemoteView();
375 Remote_View->ensureItemVisible(Remote_View->firstChild());
370 } 376 }
371 } else { 377 } else {
372 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 378 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
373 if( QFile::exists(strItem ) ) { 379 if( QFile::exists(strItem ) ) {
374 // qDebug("clicked item "+strItem); 380 // qDebug("clicked item "+strItem);
375 // DocLnk doc( strItem, FALSE ); 381 // DocLnk doc( strItem, FALSE );
376 // doc.execute(); 382 // doc.execute();
377 // Remote_View->clearSelection(); 383 // Remote_View->clearSelection();
378 } 384 }
379 } //end not symlink 385 } //end not symlink
380 chdir(strItem.latin1()); 386 chdir(strItem.latin1());
381 } 387 }
382 Remote_View->ensureItemVisible(Remote_View->firstChild());
383 } 388 }
384} 389}
385 390
386 391
387void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { 392void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) {
388// qDebug("list pressed"); 393// qDebug("list pressed");
389 switch (mouse) { 394 switch (mouse) {
390 case 1: 395 case 1:
391 break; 396 break;
392 case 2: 397 case 2:
393 menuTimer.start( 750, TRUE ); 398 menuTimer.start( 750, TRUE );
394 qDebug("Start menu timer\n"); 399 qDebug("Start menu timer\n");
395 break; 400 break;
396 }; 401 };
397} 402}
398 403
399void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { 404void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) {
400 405
401 switch (mouse) { 406 switch (mouse) {
402 case 1: 407 case 1:
403 break; 408 break;
404 case 2: 409 case 2:
405 menuTimer.start( 750, TRUE ); 410 menuTimer.start( 750, TRUE );
406 qDebug("Start menu timer"); 411 qDebug("Start menu timer");
407 break; 412 break;
408 }; 413 };
409} 414}
410 415
411 416
412void AdvancedFm::switchToLocalTab() { 417void AdvancedFm::switchToLocalTab() {
413 TabWidget->setCurrentPage(0); 418 TabWidget->setCurrentPage(0);
414 Local_View->setFocus(); 419 Local_View->setFocus();
415} 420}
416 421
417void AdvancedFm::switchToRemoteTab() { 422void AdvancedFm::switchToRemoteTab() {
418 TabWidget->setCurrentPage(1); 423 TabWidget->setCurrentPage(1);
419 Remote_View->setFocus(); 424 Remote_View->setFocus();
420} 425}
421 426
422void AdvancedFm::readConfig() { 427void AdvancedFm::readConfig() {
423 Config cfg("AdvancedFm"); 428 Config cfg("AdvancedFm");
424} 429}
425 430
426void AdvancedFm::writeConfig() { 431void AdvancedFm::writeConfig() {
427 Config cfg("AdvancedFm"); 432 Config cfg("AdvancedFm");
428} 433}
429 434
430void AdvancedFm::currentPathComboChanged() { 435void AdvancedFm::currentPathComboChanged() {
431 if (TabWidget->currentPageIndex() == 0) { 436 if (TabWidget->currentPageIndex() == 0) {
432 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 437 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
433 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 438 currentDir.setPath( currentPathCombo->lineEdit()->text() );
434 populateLocalView(); 439 populateLocalView();
435 } else { 440 } else {
436 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 441 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
437 } 442 }
438 } 443 }
439 if (TabWidget->currentPageIndex() == 0) { 444 if (TabWidget->currentPageIndex() == 0) {
440 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 445 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
441 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); 446 currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() );
442 populateRemoteView(); 447 populateRemoteView();
443 } else { 448 } else {
444 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 449 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
445 } 450 }
446 } 451 }
447} 452}
448 453
449void AdvancedFm::fillCombo(const QString &currentPath) { 454void AdvancedFm::fillCombo(const QString &currentPath) {
450 455
451 if (TabWidget->currentPageIndex() == 0) { 456 if (TabWidget->currentPageIndex() == 0) {
452 currentPathCombo->lineEdit()->setText( currentPath); 457 currentPathCombo->lineEdit()->setText( currentPath);
453 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 458 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
454 currentPathCombo->clear(); 459 currentPathCombo->clear();
455 localDirPathStringList.prepend( currentPath ); 460 localDirPathStringList.prepend( currentPath );
456 currentPathCombo->insertStringList( localDirPathStringList,-1); 461 currentPathCombo->insertStringList( localDirPathStringList,-1);
457 } 462 }
458 } else { 463 } else {
459 currentPathCombo->lineEdit()->setText( currentPath); 464 currentPathCombo->lineEdit()->setText( currentPath);
460 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 465 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
461 currentPathCombo->clear(); 466 currentPathCombo->clear();
462 remoteDirPathStringList.prepend( currentPath ); 467 remoteDirPathStringList.prepend( currentPath );
463 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 468 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
464 } 469 }
465 } 470 }
466} 471}
467 472
468void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 473void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
469 if (TabWidget->currentPageIndex() == 0) { 474 if (TabWidget->currentPageIndex() == 0) {
470 chdir( currentPath.latin1() ); 475 chdir( currentPath.latin1() );
471 currentDir.cd( currentPath, TRUE); 476 currentDir.cd( currentPath, TRUE);
472 populateLocalView(); 477 populateLocalView();
473 update(); 478 update();
474 } else { 479 } else {
475 chdir( currentPath.latin1() ); 480 chdir( currentPath.latin1() );
476 currentRemoteDir.cd( currentPath, TRUE); 481 currentRemoteDir.cd( currentPath, TRUE);
477 populateRemoteView(); 482 populateRemoteView();
478 update(); 483 update();
@@ -687,165 +692,167 @@ QString AdvancedFm::getFileSystemType(const QString &currentText) {
687 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 692 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
688 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 693 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
689 } 694 }
690 } 695 }
691 return baseFs; 696 return baseFs;
692} 697}
693 698
694QString AdvancedFm::getDiskSpace( const QString &path) { 699QString AdvancedFm::getDiskSpace( const QString &path) {
695 struct statfs fss; 700 struct statfs fss;
696 if ( !statfs( path.latin1(), &fss ) ) { 701 if ( !statfs( path.latin1(), &fss ) ) {
697 int blkSize = fss.f_bsize; 702 int blkSize = fss.f_bsize;
698 // int totalBlks = fs.f_blocks; 703 // int totalBlks = fs.f_blocks;
699 int availBlks = fss.f_bavail; 704 int availBlks = fss.f_bavail;
700 705
701 long mult = blkSize / 1024; 706 long mult = blkSize / 1024;
702 long div = 1024 / blkSize; 707 long div = 1024 / blkSize;
703 if ( !mult ) mult = 1; 708 if ( !mult ) mult = 1;
704 if ( !div ) div = 1; 709 if ( !div ) div = 1;
705 710
706 return QString::number(availBlks * mult / div); 711 return QString::number(availBlks * mult / div);
707 } 712 }
708 return ""; 713 return "";
709} 714}
710 715
711 716
712void AdvancedFm::showFileMenu() { 717void AdvancedFm::showFileMenu() {
713 718
714 QString curApp; 719 QString curApp;
715 bool isLocalView = false; 720 bool isLocalView = false;
716 if (TabWidget->currentPageIndex() == 0) { 721 if (TabWidget->currentPageIndex() == 0) {
717 isLocalView = TRUE; 722 isLocalView = TRUE;
718 curApp = Local_View->currentItem()->text(0); 723 curApp = Local_View->currentItem()->text(0);
719 } else { 724 } else {
720 curApp = Remote_View->currentItem()->text(0); 725 curApp = Remote_View->currentItem()->text(0);
721 } 726 }
722 727
723 MimeType mt( curApp ); 728 MimeType mt( curApp );
724 const AppLnk* app = mt.application(); 729 const AppLnk* app = mt.application();
725 QFile fi(curApp); 730 QFile fi(curApp);
726 731
727 QPopupMenu *m = new QPopupMenu(0); 732 QPopupMenu *m = new QPopupMenu(0);
728 733
729 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 734 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
730 if ( !QFileInfo(fi).isDir() ) { 735 if ( !QFileInfo(fi).isDir() ) {
731 m->insertSeparator(); 736 m->insertSeparator();
732// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 737// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
733// } else { 738// } else {
734 739
735 if ( app ) 740 if ( app )
736 m->insertItem( app->pixmap(), tr( "Open in " 741 m->insertItem( app->pixmap(), tr( "Open in "
737 + app->name() ), this, SLOT( runThis() ) ); 742 + app->name() ), this, SLOT( runThis() ) );
738 else if( QFileInfo(fi).isExecutable() ) 743 else if( QFileInfo(fi).isExecutable() )
739 m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) ); 744 m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) );
740 745
741 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); 746 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
742 } 747 }
743 m->insertSeparator(); 748 m->insertSeparator();
744 749
745 750
746 if(isLocalView) 751 if(isLocalView)
747 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 752 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
748 else 753 else
749 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 754 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
750 755
751 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 756 m->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
752 m->insertSeparator(); 757 m->insertSeparator();
753 758
754 if(isLocalView) 759 if(isLocalView)
755 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 760 m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
756 else 761 else
757 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 762 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
758 763
759 m->insertItem( tr( "Copy" ), this, SLOT( copy() )); 764 m->insertItem( tr( "Copy" ), this, SLOT( copy() ));
760 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 765 m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
761 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); 766 m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
762 m->insertItem( tr( "Move" ), this, SLOT( move() )); 767 m->insertItem( tr( "Move" ), this, SLOT( move() ));
763 m->insertSeparator(); 768 m->insertSeparator();
764 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); 769 m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
765 770
766// if(isLocalView) 771// if(isLocalView)
767// m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); 772// m->insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() ));
768// else 773// else
769// m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); 774// m->insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() ));
770 775
771 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); 776 m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() ));
772 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); 777 m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() ));
773 m->insertSeparator(); 778 m->insertSeparator();
774 779
775 if(isLocalView) 780 if(isLocalView)
776 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 781 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
777 else 782 else
778 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 783 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
779 784
780 m->insertSeparator(); 785 m->insertSeparator();
781 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); 786 m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() ));
782 787
788#if defined(QT_QWS_OPIE)
783 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); 789 m->insertItem( tr( "Properties" ), this, SLOT( doProperties() ));
790#endif
784 m->setCheckable(TRUE); 791 m->setCheckable(TRUE);
785 if (!b) 792 if (!b)
786 m->setItemChecked(m->idAt(0),TRUE); 793 m->setItemChecked(m->idAt(0),TRUE);
787 else 794 else
788 m->setItemChecked(m->idAt(0),FALSE); 795 m->setItemChecked(m->idAt(0),FALSE);
789 796
790 if(Ir::supported()) 797 if(Ir::supported())
791 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); 798 m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() ));
792 m->setFocus(); 799 m->setFocus();
793 m->exec( QCursor::pos() ); 800 m->exec( QCursor::pos() );
794 sleep(1); 801 sleep(1);
795 if(m) delete m; 802 if(m) delete m;
796} 803}
797 804
798 805
799void AdvancedFm::cancelMenuTimer() { 806void AdvancedFm::cancelMenuTimer() {
800 807
801// qDebug("selectionChanged: cancel menu timer"); 808// qDebug("selectionChanged: cancel menu timer");
802 if( menuTimer.isActive() ) 809 if( menuTimer.isActive() )
803 menuTimer.stop(); 810 menuTimer.stop();
804} 811}
805 812
806QString AdvancedFm::checkDiskSpace(const QString &path) { 813QString AdvancedFm::checkDiskSpace(const QString &path) {
807 struct statfs fss; 814 struct statfs fss;
808 if ( !statfs( path.latin1(), &fss ) ) { 815 if ( !statfs( path.latin1(), &fss ) ) {
809 int blkSize = fss.f_bsize; 816 int blkSize = fss.f_bsize;
810// int totalBlks = fs.f_blocks; 817// int totalBlks = fs.f_blocks;
811 int availBlks = fss.f_bavail; 818 int availBlks = fss.f_bavail;
812 819
813 long mult = blkSize / 1024; 820 long mult = blkSize / 1024;
814 long div = 1024 / blkSize; 821 long div = 1024 / blkSize;
815 if ( !mult ) mult = 1; 822 if ( !mult ) mult = 1;
816 if ( !div ) div = 1; 823 if ( !div ) div = 1;
817 824
818 825
819 return QString::number(availBlks * mult / div); 826 return QString::number(availBlks * mult / div);
820 } 827 }
821 return ""; 828 return "";
822} 829}
823 830
824void AdvancedFm::addToDocs() { 831void AdvancedFm::addToDocs() {
825 QStringList strListPaths = getPath(); 832 QStringList strListPaths = getPath();
826 if( strListPaths.count() > 0) { 833 if( strListPaths.count() > 0) {
827 QString curFile; 834 QString curFile;
828 if (TabWidget->currentPageIndex() == 0) { 835 if (TabWidget->currentPageIndex() == 0) {
829 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 836 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
830 curFile = currentDir.canonicalPath()+"/"+(*it); 837 curFile = currentDir.canonicalPath()+"/"+(*it);
831 qDebug(curFile); 838 qDebug(curFile);
832 DocLnk f; 839 DocLnk f;
833// curFile.replace(QRegExp("\\..*"),""); 840// curFile.replace(QRegExp("\\..*"),"");
834 f.setName((*it)); 841 f.setName((*it));
835 f.setFile( curFile); 842 f.setFile( curFile);
836 f.writeLink(); 843 f.writeLink();
837 } 844 }
838 } else { 845 } else {
839 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 846 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
840 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 847 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
841 qDebug(curFile); 848 qDebug(curFile);
842 849
843 DocLnk f; 850 DocLnk f;
844// curFile.replace(QRegExp("\\..*"),""); 851// curFile.replace(QRegExp("\\..*"),"");
845 f.setName((*it)); 852 f.setName((*it));
846 f.setFile( curFile); 853 f.setFile( curFile);
847 f.writeLink(); 854 f.writeLink();
848 } 855 }
849 } 856 }
850 } 857 }
851} 858}