From c69a0d8f6b676c6e10ad100a519ed935363074e3 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 1 Oct 2016 15:31:32 +0900 Subject: [PATCH] Fixed bugs related to archive unpacking. This resolves bug 2655. Signed-off-by: Michele Calgaro --- krusader/Dialogs/krdialogs.cpp | 1 + krusader/Panel/panelfunc.cpp | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/krusader/Dialogs/krdialogs.cpp b/krusader/Dialogs/krdialogs.cpp index 88a41d4..2427f40 100644 --- a/krusader/Dialogs/krdialogs.cpp +++ b/krusader/Dialogs/krdialogs.cpp @@ -59,6 +59,7 @@ KURL KChooseDir::getDir(TQString text,const KURL& url, const KURL& cwd) { KURLRequesterDlg *dlg = new KURLRequesterDlg( vfs::pathOrURL( url, 1 ),text,krApp,""); dlg->urlRequester()->completionObject()->setDir(cwd.url()); + dlg->urlRequester()->setMode(KFile::LocalOnly | KFile::Directory); KURL u; if (dlg->exec() == TQDialog::Accepted) { u = vfs::fromPathOrURL(dlg->urlRequester()->completionObject()->replacedPath( diff --git a/krusader/Panel/panelfunc.cpp b/krusader/Panel/panelfunc.cpp index e5053fe..3cd1729 100755 --- a/krusader/Panel/panelfunc.cpp +++ b/krusader/Panel/panelfunc.cpp @@ -903,7 +903,6 @@ void ListPanelFunc::testArchive() { } void ListPanelFunc::unpack() { - TQStringList fileNames; panel->getSelectedNames( &fileNames ); if ( fileNames.isEmpty() ) @@ -917,7 +916,9 @@ void ListPanelFunc::unpack() { // ask the user for the copy dest KURL dest = KChooseDir::getDir(s, panel->otherPanel->virtualPath(), panel->virtualPath()); - if ( dest.isEmpty() ) return ; // the user canceled + if ( dest.isEmpty() ) { + return ; // the user canceled + } bool packToOtherPanel = ( dest.equals( panel->otherPanel->virtualPath(), true ) ); @@ -940,6 +941,24 @@ void ListPanelFunc::unpack() { } else url = arcURL.path( -1 ); + // for local destionation, check whether it exists or not + if ( dest.isLocalFile() ) { + TQDir destdir = TQDir(dest.path(1)); + if (!destdir.exists()) { + // Destination folder does not exists + int res = KMessageBox::warningContinueCancel( NULL, + i18n("The destination folder does not exist.\nDo you want to create it?"), + i18n("Create folder")); + if ( res != KMessageBox::Continue ) { + return; + } + // Create destination folder. If failed, return + if (!destdir.mkdir(destdir.absPath())) { + KMessageBox::error(NULL, i18n("Unable to create the destionation folder. Aborting operation."), i18n("Error!")); + } + } + } + // if the destination is in remote directory use temporary one instead dest.adjustPath(1); KURL originalDestURL;