summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2016-10-01 15:31:32 +0900
committerMichele Calgaro <[email protected]>2016-10-01 15:32:45 +0900
commit077243cc1a6f709ac22eaf33e8f21aae756b9b8e (patch)
tree6b4ad3407c930698b4162db9dc02aa5b5ab6b7d2
parent92907f0ecf4b2ff3b166757d4e04f48e1018bfbe (diff)
downloadkrusader-077243cc1a6f709ac22eaf33e8f21aae756b9b8e.tar.gz
krusader-077243cc1a6f709ac22eaf33e8f21aae756b9b8e.zip
Fixed bugs related to archive unpacking. This resolves bug 2655.
Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit c69a0d8f6b676c6e10ad100a519ed935363074e3)
-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 3448b56..8f03870 100755
--- a/krusader/Panel/panelfunc.cpp
+++ b/krusader/Panel/panelfunc.cpp
@@ -905,7 +905,6 @@ void ListPanelFunc::testArchive() {
}
void ListPanelFunc::unpack() {
-
TQStringList fileNames;
panel->getSelectedNames( &fileNames );
if ( fileNames.isEmpty() )
@@ -919,7 +918,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 ) );
@@ -942,6 +943,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;