summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-16 15:17:00 (UTC)
committer llornkcor <llornkcor>2002-10-16 15:17:00 (UTC)
commit61f2f6ef32685002710f197dc8990fd9e99d83a5 (patch) (unidiff)
tree5fa57efbff0e83a326f6e055c3c59be71d4328bd
parentee8da0d0b70318c24ee2417bbccd9b7cd6e1404e (diff)
downloadopie-61f2f6ef32685002710f197dc8990fd9e99d83a5.zip
opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.tar.gz
opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.tar.bz2
fix for popup menu crash.. didnt like loading executable pixmap
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp59
1 files changed, 31 insertions, 28 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index d7bad51..b6e7a30 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -715,54 +715,57 @@ QString AdvancedFm::getDiskSpace( const QString &path) {
715 715
716void AdvancedFm::showFileMenu() { 716void AdvancedFm::showFileMenu() {
717 717
718 QString curApp; 718 QString curApp;
719 bool isLocalView = false; 719 bool isLocalView = false;
720 if (TabWidget->currentPageIndex() == 0) { 720 if (TabWidget->currentPageIndex() == 0) {
721 isLocalView = TRUE; 721 isLocalView = TRUE;
722 curApp = Local_View->currentItem()->text(0); 722 curApp = Local_View->currentItem()->text(0);
723 } else { 723 } else {
724 curApp = Remote_View->currentItem()->text(0); 724 curApp = Remote_View->currentItem()->text(0);
725 } 725 }
726 726
727 MimeType mt( curApp ); 727 MimeType mt( curApp );
728 const AppLnk* app = mt.application();
729 QFile fi(curApp);
730
731 QPopupMenu *m = new QPopupMenu(0);
732 QPopupMenu *n = new QPopupMenu(0);
733// QPopupMenu *o = new QPopupMenu(0);
734
735 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
736 if ( !QFileInfo(fi).isDir() ) {
737// m->insertSeparator();
738// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
739// } else {
740
741 if ( app )
742 m->insertItem( app->pixmap(), tr( "Open in "
743 + app->name() ), this, SLOT( runThis() ) );
744 else if( QFileInfo(fi).isExecutable() )
745 m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) );
746
747 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
748 }
749 728
750 m->insertItem(tr("Actions"),n); 729 const AppLnk* app = mt.application();
751 if(isLocalView)
752 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
753 else
754 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
755 730
756 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); 731 QFile fi(curApp);
732
733 QPopupMenu *m = new QPopupMenu(0);
734 QPopupMenu *n = new QPopupMenu(0);
735 // QPopupMenu *o = new QPopupMenu(0);
736
737 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
738
739 if ( QFileInfo(fi).isDir() ) {
740 m->insertSeparator();
741 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
742 } else {
743
744 if ( app )
745 m->insertItem( app->pixmap(), tr( "Open in "
746 + app->name() ), this, SLOT( runThis() ) );
747 else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this
748 m->insertItem( /*Resource::loadPixmap( app->name()),*/ tr( "Execute" ), this, SLOT( runThis() ) );
749
750 m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) );
751 }
752
753 m->insertItem(tr("Actions"),n);
754 if(isLocalView)
755 n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
756 else
757 n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
758
759 n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ));
757 760
758 n->insertSeparator(); 761 n->insertSeparator();
759 762
760 763
761 if(isLocalView) 764 if(isLocalView)
762 n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 765 n->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
763 else 766 else
764 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 767 n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
765 768
766 n->insertItem( tr( "Copy" ), this, SLOT( copy() )); 769 n->insertItem( tr( "Copy" ), this, SLOT( copy() ));
767 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); 770 n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
768 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); 771 n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));