summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2016-10-01 15:31:32 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2016-10-01 15:31:32 +0900
commitc69a0d8f6b676c6e10ad100a519ed935363074e3 (patch)
tree7e026845fc5b71d254b6ca6c774dcb494f5005cb
parentb5e19dc055e0be046a3613d0839fee254a868b48 (diff)
downloadkrusader-c69a0d8f6b676c6e10ad100a519ed935363074e3.tar.gz
krusader-c69a0d8f6b676c6e10ad100a519ed935363074e3.zip
Fixed bugs related to archive unpacking. This resolves bug 2655.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--krusader/Dialogs/krdialogs.cpp1
-rwxr-xr-xkrusader/Panel/panelfunc.cpp23
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;