author | llornkcor <llornkcor> | 2002-10-16 15:17:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-16 15:17:00 (UTC) |
commit | 61f2f6ef32685002710f197dc8990fd9e99d83a5 (patch) (side-by-side diff) | |
tree | 5fa57efbff0e83a326f6e055c3c59be71d4328bd | |
parent | ee8da0d0b70318c24ee2417bbccd9b7cd6e1404e (diff) | |
download | opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.zip opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.tar.gz opie-61f2f6ef32685002710f197dc8990fd9e99d83a5.tar.bz2 |
fix for popup menu crash.. didnt like loading executable pixmap
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 59 |
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 @@ -703,78 +703,81 @@ QString AdvancedFm::getDiskSpace( const QString &path) { int availBlks = fss.f_bavail; long mult = blkSize / 1024; long div = 1024 / blkSize; if ( !mult ) mult = 1; if ( !div ) div = 1; return QString::number(availBlks * mult / div); } return ""; } void AdvancedFm::showFileMenu() { QString curApp; bool isLocalView = false; if (TabWidget->currentPageIndex() == 0) { isLocalView = TRUE; curApp = Local_View->currentItem()->text(0); } else { curApp = Remote_View->currentItem()->text(0); } - MimeType mt( curApp ); - const AppLnk* app = mt.application(); - QFile fi(curApp); - - QPopupMenu *m = new QPopupMenu(0); - QPopupMenu *n = new QPopupMenu(0); -// QPopupMenu *o = new QPopupMenu(0); - - m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); - if ( !QFileInfo(fi).isDir() ) { -// m->insertSeparator(); -// m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); -// } else { - - if ( app ) - m->insertItem( app->pixmap(), tr( "Open in " - + app->name() ), this, SLOT( runThis() ) ); - else if( QFileInfo(fi).isExecutable() ) - m->insertItem( Resource::loadPixmap( app->name()), tr( "Execute" ), this, SLOT( runThis() ) ); - - m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); - } + MimeType mt( curApp ); - m->insertItem(tr("Actions"),n); - if(isLocalView) - n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); - else - n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); + const AppLnk* app = mt.application(); - n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); + QFile fi(curApp); + + QPopupMenu *m = new QPopupMenu(0); + QPopupMenu *n = new QPopupMenu(0); + // QPopupMenu *o = new QPopupMenu(0); + + m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); + + if ( QFileInfo(fi).isDir() ) { + m->insertSeparator(); + m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); + } else { + + if ( app ) + m->insertItem( app->pixmap(), tr( "Open in " + + app->name() ), this, SLOT( runThis() ) ); + else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this + m->insertItem( /*Resource::loadPixmap( app->name()),*/ tr( "Execute" ), this, SLOT( runThis() ) ); + + m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); + } + + m->insertItem(tr("Actions"),n); + if(isLocalView) + n->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); + else + n->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); + + n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); n->insertSeparator(); if(isLocalView) n->insertItem( tr( "Rename" ), this, SLOT( localRename() )); else n->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); n->insertItem( tr( "Copy" ), this, SLOT( copy() )); n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); n->insertItem( tr( "Move" ), this, SLOT( move() )); n->insertSeparator(); if(isLocalView) n->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); else n->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |