author | llornkcor <llornkcor> | 2002-06-01 18:38:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-01 18:38:27 (UTC) |
commit | bc167b7ef02ccd5f6127d9f9640f4b7af6c5a496 (patch) (unidiff) | |
tree | d885205c7c2b6c690db1a9e9ff993fd09b2e78bd | |
parent | 2815c0b50bd52d58022eb1d5f4364079a0e99e0a (diff) | |
download | opie-bc167b7ef02ccd5f6127d9f9640f4b7af6c5a496.zip opie-bc167b7ef02ccd5f6127d9f9640f4b7af6c5a496.tar.gz opie-bc167b7ef02ccd5f6127d9f9640f4b7af6c5a496.tar.bz2 |
fixed bug woth my eyes no seeing the path combo very well, also fixed bug with popupmenu
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 609 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 16 |
2 files changed, 337 insertions, 288 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index f32031b..869a433 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -68,12 +68,13 @@ | |||
68 | #include <errno.h> | 68 | #include <errno.h> |
69 | 69 | ||
70 | AdvancedFm::AdvancedFm( ) | 70 | AdvancedFm::AdvancedFm( ) |
71 | : QMainWindow( ) | 71 | : QMainWindow( ) |
72 | { | 72 | { |
73 | setCaption( tr( "AdvancedFm" ) ); | 73 | setCaption( tr( "AdvancedFm" ) ); |
74 | // menuTimer( this ); | ||
74 | 75 | ||
75 | QGridLayout *layout = new QGridLayout( this ); | 76 | QGridLayout *layout = new QGridLayout( this ); |
76 | layout->setSpacing( 2); | 77 | layout->setSpacing( 2); |
77 | layout->setMargin( 2); | 78 | layout->setMargin( 2); |
78 | 79 | ||
79 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 80 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
@@ -141,14 +142,31 @@ AdvancedFm::AdvancedFm( ) | |||
141 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 142 | viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
142 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 143 | viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
143 | viewMenu->insertSeparator(); | 144 | viewMenu->insertSeparator(); |
144 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 145 | viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
145 | viewMenu->setCheckable(TRUE); | 146 | viewMenu->setCheckable(TRUE); |
146 | 147 | ||
148 | |||
149 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | ||
150 | currentPathCombo->setEditable(TRUE); | ||
151 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | ||
152 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
153 | |||
154 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | ||
155 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | ||
156 | |||
157 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | ||
158 | this,SLOT(currentPathComboChanged())); | ||
159 | |||
160 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
161 | |||
162 | layout->addMultiCellWidget( currentPathCombo, 1, 1, 0, 7); | ||
163 | |||
164 | |||
147 | TabWidget = new QTabWidget( this, "TabWidget" ); | 165 | TabWidget = new QTabWidget( this, "TabWidget" ); |
148 | layout->addMultiCellWidget( TabWidget, 1, 1, 0, 7); | 166 | layout->addMultiCellWidget( TabWidget, 2, 2, 0, 7); |
149 | 167 | ||
150 | tab = new QWidget( TabWidget, "tab" ); | 168 | tab = new QWidget( TabWidget, "tab" ); |
151 | tabLayout = new QGridLayout( tab ); | 169 | tabLayout = new QGridLayout( tab ); |
152 | tabLayout->setSpacing( 2); | 170 | tabLayout->setSpacing( 2); |
153 | tabLayout->setMargin( 2); | 171 | tabLayout->setMargin( 2); |
154 | 172 | ||
@@ -162,18 +180,21 @@ AdvancedFm::AdvancedFm( ) | |||
162 | Local_View->setAllColumnsShowFocus(TRUE); | 180 | Local_View->setAllColumnsShowFocus(TRUE); |
163 | Local_View->setMultiSelection( TRUE ); | 181 | Local_View->setMultiSelection( TRUE ); |
164 | Local_View->setSelectionMode(QListView::Extended); | 182 | Local_View->setSelectionMode(QListView::Extended); |
165 | 183 | ||
166 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 184 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
167 | 185 | ||
186 | |||
187 | |||
168 | tabLayout->addWidget( Local_View, 0, 0 ); | 188 | tabLayout->addWidget( Local_View, 0, 0 ); |
169 | 189 | ||
170 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 190 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
171 | this,SLOT( localListClicked(QListViewItem *)) ); | 191 | this,SLOT( localListClicked(QListViewItem *)) ); |
172 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 192 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
173 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); | 193 | this,SLOT( localListPressed(int, QListViewItem *, const QPoint&, int)) ); |
194 | connect( Local_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | ||
174 | 195 | ||
175 | TabWidget->insertTab( tab, tr("1")); | 196 | TabWidget->insertTab( tab, tr("1")); |
176 | 197 | ||
177 | tab_2 = new QWidget( TabWidget, "tab_2" ); | 198 | tab_2 = new QWidget( TabWidget, "tab_2" ); |
178 | tabLayout_2 = new QGridLayout( tab_2 ); | 199 | tabLayout_2 = new QGridLayout( tab_2 ); |
179 | tabLayout_2->setSpacing( 2); | 200 | tabLayout_2->setSpacing( 2); |
@@ -192,12 +213,13 @@ AdvancedFm::AdvancedFm( ) | |||
192 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 213 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
193 | 214 | ||
194 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 215 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
195 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 216 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
196 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 217 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
197 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 218 | this,SLOT( remoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
219 | connect( Remote_View, SIGNAL( selectionChanged() ), SLOT( cancelMenuTimer() ) ); | ||
198 | 220 | ||
199 | tabLayout_2->addWidget( Remote_View, 0, 0 ); | 221 | tabLayout_2->addWidget( Remote_View, 0, 0 ); |
200 | 222 | ||
201 | TabWidget->insertTab( tab_2, tr( "2")); | 223 | TabWidget->insertTab( tab_2, tr( "2")); |
202 | 224 | ||
203 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 225 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
@@ -218,29 +240,18 @@ AdvancedFm::AdvancedFm( ) | |||
218 | currentDir.setPath( QDir::currentDirPath()); | 240 | currentDir.setPath( QDir::currentDirPath()); |
219 | 241 | ||
220 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 242 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
221 | currentRemoteDir.setPath( QDir::currentDirPath()); | 243 | currentRemoteDir.setPath( QDir::currentDirPath()); |
222 | 244 | ||
223 | b = TRUE; | 245 | b = TRUE; |
224 | currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); | ||
225 | currentPathCombo->setEditable(TRUE); | ||
226 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); | ||
227 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
228 | |||
229 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | ||
230 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | ||
231 | |||
232 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | ||
233 | this,SLOT(currentPathComboChanged())); | ||
234 | |||
235 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | ||
236 | |||
237 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); | ||
238 | 246 | ||
239 | filterStr="*"; | 247 | filterStr="*"; |
240 | b=FALSE; | 248 | b=FALSE; |
249 | |||
250 | connect( &menuTimer, SIGNAL( timeout() ), SLOT( showFileMenu() ) ); | ||
251 | |||
241 | populateLocalView(); | 252 | populateLocalView(); |
242 | populateRemoteView(); | 253 | populateRemoteView(); |
243 | } | 254 | } |
244 | 255 | ||
245 | AdvancedFm::~AdvancedFm() | 256 | AdvancedFm::~AdvancedFm() |
246 | { | 257 | { |
@@ -533,16 +544,16 @@ void AdvancedFm::localListClicked(QListViewItem *selectedItem) | |||
533 | currentDir.cd(strItem, TRUE); | 544 | currentDir.cd(strItem, TRUE); |
534 | populateLocalView(); | 545 | populateLocalView(); |
535 | } | 546 | } |
536 | } else { | 547 | } else { |
537 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 548 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
538 | if( QFile::exists(strItem ) ) { | 549 | if( QFile::exists(strItem ) ) { |
539 | qDebug("clicked item "+strItem); | 550 | qDebug("clicked item "+strItem); |
540 | DocLnk doc( strItem, FALSE ); | 551 | DocLnk doc( strItem, FALSE ); |
541 | doc.execute(); | 552 | doc.execute(); |
542 | // Local_View->clearSelection(); | 553 | // Local_View->clearSelection(); |
543 | } | 554 | } |
544 | } //end not symlink | 555 | } //end not symlink |
545 | chdir(strItem.latin1()); | 556 | chdir(strItem.latin1()); |
546 | } | 557 | } |
547 | } | 558 | } |
548 | } | 559 | } |
@@ -574,16 +585,16 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) | |||
574 | currentRemoteDir.cd(strItem, TRUE); | 585 | currentRemoteDir.cd(strItem, TRUE); |
575 | populateRemoteView(); | 586 | populateRemoteView(); |
576 | } | 587 | } |
577 | } else { | 588 | } else { |
578 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); | 589 | strItem=QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+strItem); |
579 | if( QFile::exists(strItem ) ) { | 590 | if( QFile::exists(strItem ) ) { |
580 | qDebug("clicked item "+strItem); | 591 | qDebug("clicked item "+strItem); |
581 | DocLnk doc( strItem, FALSE ); | 592 | DocLnk doc( strItem, FALSE ); |
582 | doc.execute(); | 593 | doc.execute(); |
583 | // Remote_View->clearSelection(); | 594 | // Remote_View->clearSelection(); |
584 | } | 595 | } |
585 | } //end not symlink | 596 | } //end not symlink |
586 | chdir(strItem.latin1()); | 597 | chdir(strItem.latin1()); |
587 | } | 598 | } |
588 | } | 599 | } |
589 | } | 600 | } |
@@ -634,176 +645,106 @@ void AdvancedFm::showRemoteHidden() | |||
634 | } | 645 | } |
635 | populateRemoteView(); | 646 | populateRemoteView(); |
636 | } | 647 | } |
637 | 648 | ||
638 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 649 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
639 | { | 650 | { |
640 | switch (mouse) { | 651 | switch (mouse) { |
641 | case 1: | 652 | case 1: |
642 | break; | 653 | break; |
643 | case 2: | 654 | case 2: |
644 | showLocalMenu(item); | 655 | menuTimer.start( 500, TRUE ); |
645 | Local_View->clearSelection(); | 656 | break; |
646 | break; | 657 | }; |
647 | }; | ||
648 | } | 658 | } |
649 | 659 | ||
650 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 660 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
651 | { | 661 | { |
652 | switch (mouse) { | ||
653 | case 1: | ||
654 | break; | ||
655 | case 2: | ||
656 | showRemoteMenu(item); | ||
657 | Remote_View->clearSelection(); | ||
658 | break; | ||
659 | }; | ||
660 | } | ||
661 | |||
662 | void AdvancedFm::showLocalMenu(QListViewItem * item) | ||
663 | { | ||
664 | if(item) { | ||
665 | QPopupMenu m; | ||
666 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | ||
667 | m.insertSeparator(); | ||
668 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | ||
669 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | ||
670 | else | ||
671 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); | ||
672 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | ||
673 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | ||
674 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | ||
675 | m.insertSeparator(); | ||
676 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | ||
677 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | ||
678 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | ||
679 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | ||
680 | m.insertSeparator(); | ||
681 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | ||
682 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | ||
683 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | ||
684 | m.insertSeparator(); | ||
685 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | ||
686 | m.insertSeparator(); | ||
687 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | ||
688 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | ||
689 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | ||
690 | m.setCheckable(TRUE); | ||
691 | if (!b) | ||
692 | m.setItemChecked(m.idAt(0),TRUE); | ||
693 | else | ||
694 | m.setItemChecked(m.idAt(0),FALSE); | ||
695 | if(Ir::supported()) | ||
696 | m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | ||
697 | m.exec( QCursor::pos() ); | ||
698 | } | ||
699 | } | ||
700 | 662 | ||
701 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 663 | switch (mouse) { |
702 | { | 664 | case 1: |
703 | if(item) { | 665 | break; |
704 | QPopupMenu m; | 666 | case 2: |
705 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 667 | menuTimer.start( 500, TRUE ); |
706 | m.insertSeparator(); | 668 | break; |
707 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 669 | }; |
708 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | ||
709 | else | ||
710 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); | ||
711 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | ||
712 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | ||
713 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | ||
714 | m.insertSeparator(); | ||
715 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | ||
716 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | ||
717 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | ||
718 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | ||
719 | m.insertSeparator(); | ||
720 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | ||
721 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | ||
722 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | ||
723 | m.insertSeparator(); | ||
724 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | ||
725 | m.insertSeparator(); | ||
726 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | ||
727 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | ||
728 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | ||
729 | m.setCheckable(TRUE); | ||
730 | if (!b) | ||
731 | m.setItemChecked(m.idAt(0),TRUE); | ||
732 | else | ||
733 | m.setItemChecked(m.idAt(0),FALSE); | ||
734 | if(Ir::supported()) | ||
735 | m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | ||
736 | m.exec( QCursor::pos() ); | ||
737 | } | ||
738 | } | 670 | } |
739 | 671 | ||
740 | void AdvancedFm::runThis() { | 672 | void AdvancedFm::runThis() { |
741 | // QFileInfo *fi; | 673 | // QFileInfo *fi; |
742 | QString fs; | 674 | QString fs; |
743 | if (TabWidget->currentPageIndex() == 0) { | 675 | if (TabWidget->currentPageIndex() == 0) { |
744 | QString curFile = Local_View->currentItem()->text(0); | 676 | QString curFile = Local_View->currentItem()->text(0); |
745 | 677 | if(curFile != "../") { | |
746 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 678 | |
747 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 679 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
748 | qDebug( fileInfo.owner()); | 680 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
749 | if( (fileInfo.permission( QFileInfo::ExeUser) | 681 | qDebug( fileInfo.owner()); |
750 | | fileInfo.permission( QFileInfo::ExeGroup) | 682 | if( (fileInfo.permission( QFileInfo::ExeUser) |
751 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 683 | | fileInfo.permission( QFileInfo::ExeGroup) |
752 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 684 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
685 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | ||
753 | // if( fileInfo.isExecutable() | | 686 | // if( fileInfo.isExecutable() | |
754 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 687 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
755 | e << curFile; | 688 | e << curFile; |
756 | } else { | ||
757 | curFile = currentDir.canonicalPath()+"/"+curFile; | ||
758 | DocLnk nf(curFile); | ||
759 | QString execStr = nf.exec(); | ||
760 | qDebug( execStr); | ||
761 | if( execStr.isEmpty() ) { | ||
762 | } else { | 689 | } else { |
763 | nf.execute(); | 690 | curFile = currentDir.canonicalPath()+"/"+curFile; |
691 | DocLnk nf(curFile); | ||
692 | QString execStr = nf.exec(); | ||
693 | qDebug( execStr); | ||
694 | if( execStr.isEmpty() ) { | ||
695 | } else { | ||
696 | nf.execute(); | ||
697 | } | ||
764 | } | 698 | } |
765 | } | 699 | } |
766 | // MimeType mt( curFile); | 700 | // MimeType mt( curFile); |
767 | } else { | 701 | } else { |
768 | QString curFile = Remote_View->currentItem()->text(0); | 702 | QString curFile = Remote_View->currentItem()->text(0); |
769 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 703 | if(curFile != "../") { |
770 | qDebug("Filesystemtype is "+fs); | 704 | |
771 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 705 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
772 | if( (fileInfo.permission( QFileInfo::ExeUser) | 706 | qDebug("Filesystemtype is "+fs); |
773 | | fileInfo.permission( QFileInfo::ExeGroup) | 707 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
774 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 708 | if( (fileInfo.permission( QFileInfo::ExeUser) |
775 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 709 | | fileInfo.permission( QFileInfo::ExeGroup) |
776 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 710 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
777 | e << curFile; | 711 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
778 | } else { | 712 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
779 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 713 | e << curFile; |
780 | DocLnk nf(curFile); | ||
781 | QString execStr = nf.exec(); | ||
782 | qDebug(execStr); | ||
783 | if( execStr.isEmpty() ) { | ||
784 | } else { | 714 | } else { |
785 | nf.execute(); | 715 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
716 | DocLnk nf(curFile); | ||
717 | QString execStr = nf.exec(); | ||
718 | qDebug(execStr); | ||
719 | if( execStr.isEmpty() ) { | ||
720 | } else { | ||
721 | nf.execute(); | ||
722 | } | ||
786 | } | 723 | } |
787 | } | 724 | } |
788 | // MimeType mt( curFile); | 725 | // MimeType mt( curFile); |
789 | } | 726 | } |
790 | } | 727 | } |
791 | 728 | ||
792 | void AdvancedFm::runText() { | 729 | void AdvancedFm::runText() { |
793 | if (TabWidget->currentPageIndex() == 0) { | 730 | if (TabWidget->currentPageIndex() == 0) { |
794 | QString curFile = Local_View->currentItem()->text(0); | 731 | QString curFile = Local_View->currentItem()->text(0); |
732 | if(curFile != "../") { | ||
795 | curFile = currentDir.canonicalPath()+"/"+curFile; | 733 | curFile = currentDir.canonicalPath()+"/"+curFile; |
796 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 734 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
797 | e << curFile; | 735 | e << curFile; |
736 | } | ||
798 | } else { | 737 | } else { |
799 | QString curFile = Remote_View->currentItem()->text(0); | 738 | QString curFile = Remote_View->currentItem()->text(0); |
739 | if(curFile != "../") { | ||
800 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
801 | DocLnk nf(curFile); | 741 | DocLnk nf(curFile); |
802 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 742 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
803 | e << curFile; | 743 | e << curFile; |
744 | } | ||
804 | } | 745 | } |
805 | } | 746 | } |
806 | 747 | ||
807 | void AdvancedFm::localMakDir() | 748 | void AdvancedFm::localMakDir() |
808 | { | 749 | { |
809 | InputDialog *fileDlg; | 750 | InputDialog *fileDlg; |
@@ -828,135 +769,144 @@ void AdvancedFm::remoteMakDir() | |||
828 | populateRemoteView(); | 769 | populateRemoteView(); |
829 | } | 770 | } |
830 | 771 | ||
831 | void AdvancedFm::localDelete() | 772 | void AdvancedFm::localDelete() |
832 | { | 773 | { |
833 | QStringList curFileList = getPath(); | 774 | QStringList curFileList = getPath(); |
834 | QString myFile; | 775 | if(curFileList.count() > 0) { |
835 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 776 | QString myFile; |
836 | myFile = (*it); | 777 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
837 | if( myFile.find(" -> ",0,TRUE) != -1) | 778 | myFile = (*it); |
838 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 779 | if( myFile.find(" -> ",0,TRUE) != -1) |
839 | 780 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | |
840 | QString f = currentDir.canonicalPath(); | 781 | |
841 | if(f.right(1).find("/",0,TRUE) == -1) | 782 | QString f = currentDir.canonicalPath(); |
842 | f+="/"; | 783 | if(f.right(1).find("/",0,TRUE) == -1) |
843 | f+=myFile; | 784 | f+="/"; |
844 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 785 | f+=myFile; |
845 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 786 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
846 | "\nand all it's contents ?" | 787 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
847 | ,tr("Yes"),tr("No"),0,0,1) ) { | 788 | "\nand all it's contents ?" |
848 | case 0: { | 789 | ,tr("Yes"),tr("No"),0,0,1) ) { |
849 | f=f.left(f.length()-1); | 790 | case 0: { |
850 | QString cmd="rm -rf "+f; | 791 | f=f.left(f.length()-1); |
851 | system( cmd.latin1()); | 792 | QString cmd="rm -rf "+f; |
852 | populateLocalView(); | 793 | system( cmd.latin1()); |
853 | } | 794 | populateLocalView(); |
854 | break; | 795 | } |
855 | case 1: | 796 | break; |
856 | // exit | 797 | case 1: |
857 | break; | 798 | // exit |
858 | }; | 799 | break; |
800 | }; | ||
859 | 801 | ||
860 | } else { | 802 | } else { |
861 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 803 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
862 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 804 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
863 | case 0: { | 805 | case 0: { |
864 | QString cmd="rm "+f; | 806 | QString cmd="rm "+f; |
865 | QFile file(f); | 807 | QFile file(f); |
866 | file.remove(); | 808 | file.remove(); |
867 | // system( cmd.latin1()); | 809 | // system( cmd.latin1()); |
868 | populateLocalView(); | 810 | populateLocalView(); |
869 | } | 811 | } |
870 | break; | 812 | break; |
871 | case 1: | 813 | case 1: |
872 | // exit | 814 | // exit |
873 | break; | 815 | break; |
874 | }; | 816 | }; |
817 | } | ||
875 | } | 818 | } |
876 | } | 819 | } |
877 | } | 820 | } |
878 | 821 | ||
879 | void AdvancedFm::remoteDelete() | 822 | void AdvancedFm::remoteDelete() |
880 | { | 823 | { |
881 | QStringList curFileList = getPath(); | 824 | QStringList curFileList = getPath(); |
882 | QString myFile; | 825 | if( curFileList.count() > 0) { |
826 | QString myFile; | ||
883 | 827 | ||
884 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 828 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
885 | myFile = (*it); | 829 | myFile = (*it); |
886 | if(myFile.find(" -> ",0,TRUE) != -1) | 830 | if(myFile.find(" -> ",0,TRUE) != -1) |
887 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 831 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
888 | QString f = currentRemoteDir.canonicalPath(); | 832 | QString f = currentRemoteDir.canonicalPath(); |
889 | if(f.right(1).find("/",0,TRUE) == -1) | 833 | if(f.right(1).find("/",0,TRUE) == -1) |
890 | f+="/"; | 834 | f+="/"; |
891 | f+=myFile; | 835 | f+=myFile; |
892 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 836 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
893 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 837 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
894 | "\nand all it's contents ?", | 838 | "\nand all it's contents ?", |
895 | tr("Yes"),tr("No"),0,0,1) ) { | 839 | tr("Yes"),tr("No"),0,0,1) ) { |
896 | case 0: { | 840 | case 0: { |
897 | f=f.left(f.length()-1); | 841 | f=f.left(f.length()-1); |
898 | QString cmd="rm -rf "+f; | 842 | QString cmd="rm -rf "+f; |
899 | system( cmd.latin1()); | 843 | system( cmd.latin1()); |
900 | populateRemoteView(); | 844 | populateRemoteView(); |
901 | } | 845 | } |
902 | break; | 846 | break; |
903 | case 1: | 847 | case 1: |
904 | // exit | 848 | // exit |
905 | break; | 849 | break; |
906 | }; | 850 | }; |
907 | 851 | ||
908 | } else { | 852 | } else { |
909 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 853 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
910 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 854 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
911 | case 0: { | 855 | case 0: { |
912 | QString cmd="rm "+f; | 856 | QString cmd="rm "+f; |
913 | QFile file(f); | 857 | QFile file(f); |
914 | file.remove(); | 858 | file.remove(); |
915 | // system( cmd.latin1()); | 859 | // system( cmd.latin1()); |
916 | populateRemoteView(); | 860 | populateRemoteView(); |
917 | } | 861 | } |
918 | break; | 862 | break; |
919 | case 1: | 863 | case 1: |
920 | // exit | 864 | // exit |
921 | break; | 865 | break; |
922 | }; | 866 | }; |
867 | } | ||
923 | } | 868 | } |
924 | } | 869 | } |
925 | } | 870 | } |
926 | 871 | ||
927 | void AdvancedFm::localRename() | 872 | void AdvancedFm::localRename() |
928 | { | 873 | { |
929 | QString curFile = Local_View->currentItem()->text(0); | 874 | QString curFile = Local_View->currentItem()->text(0); |
930 | InputDialog *fileDlg; | 875 | qDebug("currentItem "+curFile); |
931 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 876 | if( curFile !="../") { |
932 | fileDlg->setInputText((const QString &)curFile); | 877 | InputDialog *fileDlg; |
933 | fileDlg->exec(); | 878 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
934 | if( fileDlg->result() == 1 ) { | 879 | fileDlg->setInputText((const QString &)curFile); |
935 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 880 | fileDlg->exec(); |
936 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 881 | if( fileDlg->result() == 1 ) { |
937 | if( rename(oldname.latin1(), newName.latin1())== -1) | 882 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
938 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 883 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
939 | } | 884 | if( rename(oldname.latin1(), newName.latin1())== -1) |
940 | populateLocalView(); | 885 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
886 | } | ||
887 | populateLocalView(); | ||
888 | } | ||
941 | } | 889 | } |
942 | 890 | ||
943 | void AdvancedFm::remoteRename() | 891 | void AdvancedFm::remoteRename() |
944 | { | 892 | { |
945 | QString curFile = Local_View->currentItem()->text(0); | 893 | QString curFile = Remote_View->currentItem()->text(0); |
946 | InputDialog *fileDlg; | 894 | if( curFile !="../") { |
947 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 895 | InputDialog *fileDlg; |
948 | fileDlg->setInputText((const QString &)curFile); | 896 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
949 | fileDlg->exec(); | 897 | fileDlg->setInputText((const QString &)curFile); |
950 | if( fileDlg->result() == 1 ) { | 898 | fileDlg->exec(); |
951 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 899 | if( fileDlg->result() == 1 ) { |
952 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 900 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
953 | if( rename(oldname.latin1(), newName.latin1())== -1) | 901 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
954 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 902 | if( rename(oldname.latin1(), newName.latin1())== -1) |
955 | } | 903 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
956 | populateRemoteView(); | 904 | } |
905 | populateRemoteView(); | ||
906 | } | ||
957 | } | 907 | } |
958 | 908 | ||
959 | void AdvancedFm::switchToLocalTab() | 909 | void AdvancedFm::switchToLocalTab() |
960 | { | 910 | { |
961 | TabWidget->setCurrentPage(0); | 911 | TabWidget->setCurrentPage(0); |
962 | Local_View->setFocus(); | 912 | Local_View->setFocus(); |
@@ -1052,21 +1002,18 @@ void AdvancedFm::filePerms() { | |||
1052 | } | 1002 | } |
1053 | if (TabWidget->currentPageIndex() == 0) { | 1003 | if (TabWidget->currentPageIndex() == 0) { |
1054 | populateLocalView(); | 1004 | populateLocalView(); |
1055 | } else { | 1005 | } else { |
1056 | populateRemoteView(); | 1006 | populateRemoteView(); |
1057 | } | 1007 | } |
1058 | |||
1059 | |||
1060 | } | 1008 | } |
1061 | 1009 | ||
1062 | void AdvancedFm::doProperties() { | 1010 | void AdvancedFm::doProperties() { |
1063 | QStringList curFileList = getPath(); | 1011 | QStringList curFileList = getPath(); |
1064 | QString filePath; | 1012 | QString filePath; |
1065 | if (TabWidget->currentPageIndex() == 0) { | 1013 | if (TabWidget->currentPageIndex() == 0) { |
1066 | |||
1067 | filePath = currentDir.canonicalPath()+"/"; | 1014 | filePath = currentDir.canonicalPath()+"/"; |
1068 | } else { | 1015 | } else { |
1069 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1016 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1070 | } | 1017 | } |
1071 | // qDebug("%d",curFileList.count()); | 1018 | // qDebug("%d",curFileList.count()); |
1072 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1019 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
@@ -1181,12 +1128,13 @@ void AdvancedFm::upDir() | |||
1181 | } | 1128 | } |
1182 | } | 1129 | } |
1183 | 1130 | ||
1184 | void AdvancedFm::copy() | 1131 | void AdvancedFm::copy() |
1185 | { | 1132 | { |
1186 | QStringList curFileList = getPath(); | 1133 | QStringList curFileList = getPath(); |
1134 | if( curFileList.count() > 0) { | ||
1187 | QString curFile; | 1135 | QString curFile; |
1188 | if (TabWidget->currentPageIndex() == 0) { | 1136 | if (TabWidget->currentPageIndex() == 0) { |
1189 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1137 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1190 | 1138 | ||
1191 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1139 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1192 | // if(destFile.right(1).find("/",0,TRUE) == -1) | 1140 | // if(destFile.right(1).find("/",0,TRUE) == -1) |
@@ -1225,16 +1173,18 @@ void AdvancedFm::copy() | |||
1225 | } | 1173 | } |
1226 | } | 1174 | } |
1227 | populateLocalView(); | 1175 | populateLocalView(); |
1228 | TabWidget->setCurrentPage(0); | 1176 | TabWidget->setCurrentPage(0); |
1229 | } | 1177 | } |
1230 | } | 1178 | } |
1179 | } | ||
1231 | 1180 | ||
1232 | void AdvancedFm::copyAs() | 1181 | void AdvancedFm::copyAs() |
1233 | { | 1182 | { |
1234 | QStringList curFileList = getPath(); | 1183 | QStringList curFileList = getPath(); |
1184 | if( curFileList.count() > 0) { | ||
1235 | QString curFile; | 1185 | QString curFile; |
1236 | InputDialog *fileDlg; | 1186 | InputDialog *fileDlg; |
1237 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1187 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1238 | 1188 | ||
1239 | if (TabWidget->currentPageIndex() == 0) { | 1189 | if (TabWidget->currentPageIndex() == 0) { |
1240 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1190 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
@@ -1281,18 +1231,20 @@ void AdvancedFm::copyAs() | |||
1281 | } | 1231 | } |
1282 | } | 1232 | } |
1283 | } | 1233 | } |
1284 | populateLocalView(); | 1234 | populateLocalView(); |
1285 | TabWidget->setCurrentPage(0); | 1235 | TabWidget->setCurrentPage(0); |
1286 | } | 1236 | } |
1287 | } | 1237 | } |
1238 | } | ||
1288 | } | 1239 | } |
1289 | 1240 | ||
1290 | void AdvancedFm::move() { | 1241 | void AdvancedFm::move() { |
1291 | 1242 | ||
1292 | QStringList curFileList = getPath(); | 1243 | QStringList curFileList = getPath(); |
1244 | if( curFileList.count() > 0) { | ||
1293 | QString curFile; | 1245 | QString curFile; |
1294 | // qDebug(curFile); | 1246 | // qDebug(curFile); |
1295 | QString destFile; | 1247 | QString destFile; |
1296 | 1248 | ||
1297 | if (TabWidget->currentPageIndex() == 0) { | 1249 | if (TabWidget->currentPageIndex() == 0) { |
1298 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1250 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
@@ -1338,12 +1290,13 @@ void AdvancedFm::move() { | |||
1338 | QFile::remove(curFile); | 1290 | QFile::remove(curFile); |
1339 | TabWidget->setCurrentPage(0); | 1291 | TabWidget->setCurrentPage(0); |
1340 | } | 1292 | } |
1341 | } | 1293 | } |
1342 | populateRemoteView(); | 1294 | populateRemoteView(); |
1343 | populateLocalView(); | 1295 | populateLocalView(); |
1296 | } | ||
1344 | } | 1297 | } |
1345 | 1298 | ||
1346 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1299 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1347 | { | 1300 | { |
1348 | char bf[ 50000 ]; | 1301 | char bf[ 50000 ]; |
1349 | int bytesRead; | 1302 | int bytesRead; |
@@ -1571,42 +1524,44 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
1571 | } | 1524 | } |
1572 | } | 1525 | } |
1573 | 1526 | ||
1574 | void AdvancedFm::mkSym() { | 1527 | void AdvancedFm::mkSym() { |
1575 | QString cmd; | 1528 | QString cmd; |
1576 | QStringList curFileList = getPath(); | 1529 | QStringList curFileList = getPath(); |
1530 | if( curFileList.count() > 0) { | ||
1577 | 1531 | ||
1578 | if (TabWidget->currentPageIndex() == 0) { | 1532 | if (TabWidget->currentPageIndex() == 0) { |
1579 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1533 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1580 | 1534 | ||
1581 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); | 1535 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
1582 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1536 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1583 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1537 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1584 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1538 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1585 | cmd = "ln -s "+curFile+" "+destName; | 1539 | cmd = "ln -s "+curFile+" "+destName; |
1586 | qDebug(cmd); | 1540 | qDebug(cmd); |
1587 | system(cmd.latin1() ); | 1541 | system(cmd.latin1() ); |
1588 | } | 1542 | } |
1589 | populateRemoteView(); | 1543 | populateRemoteView(); |
1590 | TabWidget->setCurrentPage(1); | 1544 | TabWidget->setCurrentPage(1); |
1591 | } else { | 1545 | } else { |
1592 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1546 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1593 | 1547 | ||
1594 | QString destName = currentDir.canonicalPath()+"/"+(*it); | 1548 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
1595 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); | 1549 | if(destName.right(1) == "/") destName = destName.left( destName.length() -1); |
1596 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1550 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1597 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1551 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1598 | 1552 | ||
1599 | cmd = "ln -s "+curFile+" "+destName; | 1553 | cmd = "ln -s "+curFile+" "+destName; |
1600 | qDebug(cmd); | 1554 | qDebug(cmd); |
1601 | system(cmd.latin1() ); | 1555 | system(cmd.latin1() ); |
1602 | } | 1556 | } |
1603 | populateLocalView(); | 1557 | populateLocalView(); |
1604 | TabWidget->setCurrentPage(0); | 1558 | TabWidget->setCurrentPage(0); |
1605 | } | 1559 | } |
1606 | } | 1560 | } |
1561 | } | ||
1607 | 1562 | ||
1608 | void AdvancedFm::QPEButtonPushed() { | 1563 | void AdvancedFm::QPEButtonPushed() { |
1609 | QString current = QPEApplication::qpeDir(); | 1564 | QString current = QPEApplication::qpeDir(); |
1610 | chdir( current.latin1() ); | 1565 | chdir( current.latin1() ); |
1611 | if (TabWidget->currentPageIndex() == 0) { | 1566 | if (TabWidget->currentPageIndex() == 0) { |
1612 | currentDir.cd( current, TRUE); | 1567 | currentDir.cd( current, TRUE); |
@@ -1660,40 +1615,43 @@ QString AdvancedFm::getFileSystemType(const QString ¤tText) { | |||
1660 | } | 1615 | } |
1661 | return baseFs; | 1616 | return baseFs; |
1662 | } | 1617 | } |
1663 | 1618 | ||
1664 | 1619 | ||
1665 | void AdvancedFm::doBeam() { | 1620 | void AdvancedFm::doBeam() { |
1666 | Ir ir; | 1621 | Ir ir; |
1667 | if(!ir.supported()){ | 1622 | if(!ir.supported()){ |
1668 | } else { | 1623 | } else { |
1669 | 1624 | ||
1670 | QStringList curFileList = getPath(); | 1625 | QStringList curFileList = getPath(); |
1626 | if( curFileList.count() > 0) { | ||
1671 | 1627 | ||
1672 | if (TabWidget->currentPageIndex() == 0) { | 1628 | if (TabWidget->currentPageIndex() == 0) { |
1673 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1629 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1630 | |||
1631 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | ||
1632 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | ||
1633 | Ir *file = new Ir(this, "IR"); | ||
1634 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | ||
1635 | file->send( curFile, curFile ); | ||
1636 | } | ||
1674 | 1637 | ||
1675 | QString curFile = currentDir.canonicalPath()+"/"+(*it); | 1638 | } else { |
1676 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1639 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1677 | Ir *file = new Ir(this, "IR"); | ||
1678 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | ||
1679 | file->send( curFile, curFile ); | ||
1680 | } | ||
1681 | 1640 | ||
1682 | } else { | 1641 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1683 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1642 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); |
1643 | Ir *file = new Ir(this, "IR"); | ||
1644 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | ||
1645 | file->send( curFile, curFile ); | ||
1684 | 1646 | ||
1685 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1647 | } |
1686 | if( curFile.right(1) == "/") curFile = curFile.left( curFile.length() -1); | 1648 | } |
1687 | Ir *file = new Ir(this, "IR"); | 1649 | } |
1688 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); | 1650 | } |
1689 | file->send( curFile, curFile ); | ||
1690 | 1651 | ||
1691 | } | ||
1692 | } | ||
1693 | } | ||
1694 | } | 1652 | } |
1695 | 1653 | ||
1696 | void AdvancedFm::fileBeamFinished( Ir *ir) { | 1654 | void AdvancedFm::fileBeamFinished( Ir *ir) { |
1697 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 1655 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
1698 | 1656 | ||
1699 | } | 1657 | } |
@@ -1705,6 +1663,91 @@ void AdvancedFm::fileBeamFinished( Ir *ir) { | |||
1705 | // if ( it.current()->isSelected() ) { | 1663 | // if ( it.current()->isSelected() ) { |
1706 | // QString strItem = it.current()->text(0); | 1664 | // QString strItem = it.current()->text(0); |
1707 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 1665 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
1708 | // QFileInfo fi(localFile); | 1666 | // QFileInfo fi(localFile); |
1709 | // } | 1667 | // } |
1710 | // } | 1668 | // } |
1669 | |||
1670 | void AdvancedFm::showFileMenu() { | ||
1671 | QString curApp; | ||
1672 | bool isLocalView = false; | ||
1673 | if (TabWidget->currentPageIndex() == 0) { | ||
1674 | isLocalView = TRUE; | ||
1675 | curApp = Local_View->currentItem()->text(0); | ||
1676 | } else { | ||
1677 | curApp = Remote_View->currentItem()->text(0); | ||
1678 | } | ||
1679 | |||
1680 | MimeType mt( curApp ); | ||
1681 | const AppLnk* app = mt.application(); | ||
1682 | QFile fi(curApp); | ||
1683 | |||
1684 | QPopupMenu m; | ||
1685 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | ||
1686 | m.insertSeparator(); | ||
1687 | if ( QFileInfo(fi).isDir() ) { | ||
1688 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | ||
1689 | } else { | ||
1690 | |||
1691 | if ( app ) | ||
1692 | m.insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( run() ) ); | ||
1693 | else if( QFileInfo(fi).isExecutable() ) | ||
1694 | m.insertItem( tr( "Execute" ), this, SLOT( run() ) ); | ||
1695 | |||
1696 | m.insertItem( /*Resource::loadPixmap( "txt" ),*/ tr( "Open as text" ),this, SLOT( runText() ) ); | ||
1697 | } | ||
1698 | m.insertSeparator(); | ||
1699 | |||
1700 | |||
1701 | if(isLocalView) | ||
1702 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | ||
1703 | else | ||
1704 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | ||
1705 | |||
1706 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | ||
1707 | m.insertSeparator(); | ||
1708 | |||
1709 | if(isLocalView) | ||
1710 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | ||
1711 | else | ||
1712 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | ||
1713 | |||
1714 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | ||
1715 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | ||
1716 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | ||
1717 | m.insertSeparator(); | ||
1718 | |||
1719 | if(isLocalView) | ||
1720 | m.insertItem( tr( "Rescan" ), this, SLOT( populateLocalView() )); | ||
1721 | else | ||
1722 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | ||
1723 | |||
1724 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | ||
1725 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | ||
1726 | m.insertSeparator(); | ||
1727 | |||
1728 | if(isLocalView) | ||
1729 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | ||
1730 | else | ||
1731 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | ||
1732 | |||
1733 | m.insertSeparator(); | ||
1734 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | ||
1735 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | ||
1736 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | ||
1737 | m.setCheckable(TRUE); | ||
1738 | if (!b) | ||
1739 | m.setItemChecked(m.idAt(0),TRUE); | ||
1740 | else | ||
1741 | m.setItemChecked(m.idAt(0),FALSE); | ||
1742 | if(Ir::supported()) | ||
1743 | m.insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); | ||
1744 | m.exec( QCursor::pos() ); | ||
1745 | } | ||
1746 | |||
1747 | |||
1748 | void AdvancedFm::cancelMenuTimer() | ||
1749 | { | ||
1750 | qDebug("cancel menu timer"); | ||
1751 | if( menuTimer.isActive() ) | ||
1752 | menuTimer.stop(); | ||
1753 | } | ||
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 5817fca..0cf94c6 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -9,20 +9,22 @@ | |||
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #ifndef ADVANCEDFM_H | 12 | #ifndef ADVANCEDFM_H |
13 | #define ADVANCEDFM_H | 13 | #define ADVANCEDFM_H |
14 | 14 | ||
15 | #include <qpe/ir.h> | ||
16 | |||
15 | #include <qvariant.h> | 17 | #include <qvariant.h> |
16 | #include <qdialog.h> | 18 | #include <qdialog.h> |
17 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | #include <qstringlist.h> | ||
18 | #include <qdir.h> | 21 | #include <qdir.h> |
19 | #include <qstring.h> | 22 | #include <qstring.h> |
20 | #include <qpoint.h> | 23 | #include <qpoint.h> |
21 | #include <qstringlist.h> | 24 | #include <qtimer.h> |
22 | #include <qpe/ir.h> | ||
23 | 25 | ||
24 | class QVBoxLayout; | 26 | class QVBoxLayout; |
25 | class QHBoxLayout; | 27 | class QHBoxLayout; |
26 | class QGridLayout; | 28 | class QGridLayout; |
27 | class QComboBox; | 29 | class QComboBox; |
28 | class QListView; | 30 | class QListView; |
@@ -36,12 +38,13 @@ class QPEToolBar; | |||
36 | class QPEMenuBar; | 38 | class QPEMenuBar; |
37 | class QPopupMenu; | 39 | class QPopupMenu; |
38 | class QFile; | 40 | class QFile; |
39 | class QListViewItem; | 41 | class QListViewItem; |
40 | class QLineEdit; | 42 | class QLineEdit; |
41 | class QPushButton; | 43 | class QPushButton; |
44 | class Ir; | ||
42 | 45 | ||
43 | class AdvancedFm : public QMainWindow | 46 | class AdvancedFm : public QMainWindow |
44 | { | 47 | { |
45 | Q_OBJECT | 48 | Q_OBJECT |
46 | public: | 49 | public: |
47 | AdvancedFm(); | 50 | AdvancedFm(); |
@@ -59,14 +62,12 @@ public: | |||
59 | QString filterStr; | 62 | QString filterStr; |
60 | QListViewItem * item; | 63 | QListViewItem * item; |
61 | bool b; | 64 | bool b; |
62 | QStringList fileSystemTypeList, fsList; | 65 | QStringList fileSystemTypeList, fsList; |
63 | int currentServerConfig; | 66 | int currentServerConfig; |
64 | protected slots: | 67 | protected slots: |
65 | void showLocalMenu( QListViewItem *); | ||
66 | void showRemoteMenu( QListViewItem *); | ||
67 | void doLocalCd(); | 68 | void doLocalCd(); |
68 | void doRemoteCd(); | 69 | void doRemoteCd(); |
69 | // void copy(); | 70 | // void copy(); |
70 | void mkDir(); | 71 | void mkDir(); |
71 | void del(); | 72 | void del(); |
72 | void rn(); | 73 | void rn(); |
@@ -101,17 +102,20 @@ protected slots: | |||
101 | void switchToLocalTab(); | 102 | void switchToLocalTab(); |
102 | void switchToRemoteTab(); | 103 | void switchToRemoteTab(); |
103 | 104 | ||
104 | protected: | 105 | protected: |
105 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; | 106 | QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; |
106 | QStringList remoteDirPathStringList, localDirPathStringList; | 107 | QStringList remoteDirPathStringList, localDirPathStringList; |
108 | |||
107 | void keyReleaseEvent( QKeyEvent *); | 109 | void keyReleaseEvent( QKeyEvent *); |
108 | QString getFileSystemType(const QString &); | 110 | QString getFileSystemType(const QString &); |
109 | void parsetab(const QString &fileName); | 111 | void parsetab(const QString &fileName); |
110 | 112 | ||
111 | protected slots: | 113 | protected slots: |
114 | void showFileMenu(); | ||
115 | void cancelMenuTimer(); | ||
112 | void homeButtonPushed(); | 116 | void homeButtonPushed(); |
113 | void docButtonPushed(); | 117 | void docButtonPushed(); |
114 | void SDButtonPushed(); | 118 | void SDButtonPushed(); |
115 | void CFButtonPushed(); | 119 | void CFButtonPushed(); |
116 | void QPEButtonPushed(); | 120 | void QPEButtonPushed(); |
117 | void upDir(); | 121 | void upDir(); |
@@ -122,10 +126,12 @@ protected slots: | |||
122 | void fillCombo(const QString &); | 126 | void fillCombo(const QString &); |
123 | bool copyFile( const QString & , const QString & ); | 127 | bool copyFile( const QString & , const QString & ); |
124 | void move(); | 128 | void move(); |
125 | void fileStatus(); | 129 | void fileStatus(); |
126 | void doAbout(); | 130 | void doAbout(); |
127 | void doBeam(); | 131 | void doBeam(); |
128 | void fileBeamFinished( Ir *ir); | 132 | void fileBeamFinished( Ir *); |
133 | private: | ||
134 | QTimer menuTimer; | ||
129 | }; | 135 | }; |
130 | 136 | ||
131 | #endif // ADVANCEDFM_H | 137 | #endif // ADVANCEDFM_H |