summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index c653b90..9edf7c1 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -46,48 +46,50 @@
46#include <qlayout.h> 46#include <qlayout.h>
47#include <qimage.h> 47#include <qimage.h>
48#include <qpixmap.h> 48#include <qpixmap.h>
49#include <qmessagebox.h> 49#include <qmessagebox.h>
50#include <qlineedit.h> 50#include <qlineedit.h>
51#include <qregexp.h> 51#include <qregexp.h>
52 52
53#include <unistd.h> 53#include <unistd.h>
54#include <stdlib.h> 54#include <stdlib.h>
55#include <sys/stat.h> 55#include <sys/stat.h>
56#include <dirent.h> 56#include <dirent.h>
57#include <stdio.h> 57#include <stdio.h>
58#include <time.h> 58#include <time.h>
59#include <fcntl.h> 59#include <fcntl.h>
60#include <mntent.h> 60#include <mntent.h>
61#include <string.h> 61#include <string.h>
62#include <errno.h> 62#include <errno.h>
63#include <sys/vfs.h> 63#include <sys/vfs.h>
64#include <mntent.h> 64#include <mntent.h>
65#include <sys/utsname.h> 65#include <sys/utsname.h>
66 66
67AdvancedFm::AdvancedFm( ) 67AdvancedFm::AdvancedFm( )
68 : QMainWindow( ) { 68 : QMainWindow( ) {
69 init(); 69 init();
70 renameBox = 0;
71
70 initConnections(); 72 initConnections();
71 populateLocalView(); 73 populateLocalView();
72 populateRemoteView(); 74 populateRemoteView();
73 currentPathCombo->setFocus(); 75 currentPathCombo->setFocus();
74} 76}
75 77
76AdvancedFm::~AdvancedFm() { 78AdvancedFm::~AdvancedFm() {
77} 79}
78 80
79void AdvancedFm::cleanUp() { 81void AdvancedFm::cleanUp() {
80 QString sfile=QDir::homeDirPath(); 82 QString sfile=QDir::homeDirPath();
81 if(sfile.right(1) != "/") 83 if(sfile.right(1) != "/")
82 sfile+="/._temp"; 84 sfile+="/._temp";
83 else 85 else
84 sfile+="._temp"; 86 sfile+="._temp";
85 QFile file( sfile); 87 QFile file( sfile);
86 if(file.exists()) 88 if(file.exists())
87 file.remove(); 89 file.remove();
88} 90}
89 91
90void AdvancedFm::tabChanged(QWidget *w) { 92void AdvancedFm::tabChanged(QWidget *w) {
91 qDebug("tab changed %d",TabWidget->getCurrentTab()); 93 qDebug("tab changed %d",TabWidget->getCurrentTab());
92 94
93 if ( w == tab) { 95 if ( w == tab) {
@@ -381,66 +383,81 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) {
381 if(QDir(strItem).exists()){ 383 if(QDir(strItem).exists()){
382 currentRemoteDir.cd(strItem, TRUE); 384 currentRemoteDir.cd(strItem, TRUE);
383 populateRemoteView(); 385 populateRemoteView();
384 Remote_View->ensureItemVisible(Remote_View->firstChild()); 386 Remote_View->ensureItemVisible(Remote_View->firstChild());
385 } 387 }
386 } else { 388 } else {
387 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); 389 strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem);
388 if( QFile::exists(strItem ) ) { 390 if( QFile::exists(strItem ) ) {
389 // qDebug("clicked item "+strItem); 391 // qDebug("clicked item "+strItem);
390 // DocLnk doc( strItem, FALSE ); 392 // DocLnk doc( strItem, FALSE );
391 // doc.execute(); 393 // doc.execute();
392 // Remote_View->clearSelection(); 394 // Remote_View->clearSelection();
393 } 395 }
394 } //end not symlink 396 } //end not symlink
395 chdir(strItem.latin1()); 397 chdir(strItem.latin1());
396 } 398 }
397 } 399 }
398} 400}
399 401
400 402
401void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { 403void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) {
402// qDebug("list pressed"); 404// qDebug("list pressed");
403 switch (mouse) { 405 switch (mouse) {
404 case 1: 406 case 1:
407 {
408 if(renameBox != 0 )
409 {
410 qDebug("cancel rename");
411 cancelRename();
412 }
413
414 }
405 break; 415 break;
406 case 2: 416 case 2:
407 menuTimer.start( 500, TRUE ); 417 menuTimer.start( 500, TRUE );
408 qDebug("Start menu timer\n"); 418 qDebug("Start menu timer\n");
409 break; 419 break;
410 }; 420 };
411} 421}
412 422
413void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { 423void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) {
414 424
415 switch (mouse) { 425 switch (mouse) {
416 case 1: 426 case 1:
417 break; 427 {
418 case 2: 428 if(renameBox != 0 )
419 menuTimer.start( 500, TRUE ); 429 {
420 qDebug("Start menu timer"); 430 qDebug("cancel rename");
421 break; 431 cancelRename();
422 }; 432 }
433 }
434 break;
435 case 2:
436 menuTimer.start( 500, TRUE );
437 qDebug("Start menu timer");
438 break;
439 };
423} 440}
424 441
425 442
426void AdvancedFm::switchToLocalTab() { 443void AdvancedFm::switchToLocalTab() {
427 TabWidget->setCurrentTab(0); 444 TabWidget->setCurrentTab(0);
428 Local_View->setFocus(); 445 Local_View->setFocus();
429} 446}
430 447
431void AdvancedFm::switchToRemoteTab() { 448void AdvancedFm::switchToRemoteTab() {
432 TabWidget->setCurrentTab(1); 449 TabWidget->setCurrentTab(1);
433 Remote_View->setFocus(); 450 Remote_View->setFocus();
434} 451}
435 452
436void AdvancedFm::readConfig() { 453void AdvancedFm::readConfig() {
437 Config cfg("AdvancedFm"); 454 Config cfg("AdvancedFm");
438} 455}
439 456
440void AdvancedFm::writeConfig() { 457void AdvancedFm::writeConfig() {
441 Config cfg("AdvancedFm"); 458 Config cfg("AdvancedFm");
442} 459}
443 460
444void AdvancedFm::currentPathComboChanged() { 461void AdvancedFm::currentPathComboChanged() {
445 if (TabWidget->getCurrentTab() == 0) { 462 if (TabWidget->getCurrentTab() == 0) {
446// if (TabWidget->currentPageIndex() == 0) { 463// if (TabWidget->currentPageIndex() == 0) {
@@ -858,24 +875,25 @@ void AdvancedFm::addToDocs() {
858// if (TabWidget->currentPageIndex() == 0) { 875// if (TabWidget->currentPageIndex() == 0) {
859 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 876 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
860 curFile = currentDir.canonicalPath()+"/"+(*it); 877 curFile = currentDir.canonicalPath()+"/"+(*it);
861 qDebug(curFile); 878 qDebug(curFile);
862 DocLnk f; 879 DocLnk f;
863// curFile.replace(QRegExp("\\..*"),""); 880// curFile.replace(QRegExp("\\..*"),"");
864 f.setName((*it)); 881 f.setName((*it));
865 f.setFile( curFile); 882 f.setFile( curFile);
866 f.writeLink(); 883 f.writeLink();
867 } 884 }
868 } else { 885 } else {
869 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 886 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
870 curFile = currentRemoteDir.canonicalPath()+"/"+(*it); 887 curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
871 qDebug(curFile); 888 qDebug(curFile);
872 889
873 DocLnk f; 890 DocLnk f;
874// curFile.replace(QRegExp("\\..*"),""); 891// curFile.replace(QRegExp("\\..*"),"");
875 f.setName((*it)); 892 f.setName((*it));
876 f.setFile( curFile); 893 f.setFile( curFile);
877 f.writeLink(); 894 f.writeLink();
878 } 895 }
879 } 896 }
880 } 897 }
881} 898}
899