Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Ark
Commits
fa467314
Commit
fa467314
authored
Dec 03, 2015
by
Eike Hein
Browse files
Try to handle URLs and resolve to local path in D-Bus extraction service.
REVIEW:126233
BUG:294904
parent
469feea8
Changes
1
Hide whitespace changes
Inline
Side-by-side
part/part.cpp
View file @
fa467314
...
...
@@ -197,22 +197,37 @@ void Part::registerJob(KJob* job)
connect
(
job
,
&
KJob
::
result
,
this
,
&
Part
::
ready
);
}
// TODO:
One should construct a KUrl out of localPath in ord
er to
be able to handle
//
non-local destination
s (
i
e.
trash:/ or a remote loca
tion
)
//
See bugs #189322 and #204323.
// TODO:
KIO::mostLocalHere is used h
er
e
to
resolve some KIO URLs to local
//
path
s (e.
g. desktop:/), but more work is needed to support extrac
tion
//
to non-local destinations.
See bugs #189322 and #204323.
void
Part
::
extractSelectedFilesTo
(
const
QString
&
localPath
)
{
qCDebug
(
ARK
)
<<
"Extract to"
<<
localPath
;
if
(
!
m_model
)
{
return
;
}
const
QUrl
url
(
localPath
);
KIO
::
StatJob
*
statJob
=
nullptr
;
if
(
!
url
.
scheme
().
isEmpty
())
{
statJob
=
KIO
::
mostLocalUrl
(
url
);
if
(
!
statJob
->
exec
()
||
statJob
->
error
()
!=
0
)
{
return
;
}
}
const
QString
destination
=
statJob
?
statJob
->
statResult
().
stringValue
(
KIO
::
UDSEntry
::
UDS_LOCAL_PATH
)
:
localPath
;
delete
statJob
;
qCDebug
(
ARK
)
<<
"Extract to"
<<
destination
;
Kerfuffle
::
ExtractionOptions
options
;
options
[
QStringLiteral
(
"PreservePaths"
)]
=
true
;
options
[
QStringLiteral
(
"RemoveRootNode"
)]
=
true
;
// Create and start the ExtractJob.
ExtractJob
*
job
=
m_model
->
extractFiles
(
filesAndRootNodesForIndexes
(
addChildren
(
m_view
->
selectionModel
()
->
selectedRows
())),
localPath
,
options
);
ExtractJob
*
job
=
m_model
->
extractFiles
(
filesAndRootNodesForIndexes
(
addChildren
(
m_view
->
selectionModel
()
->
selectedRows
())),
destination
,
options
);
registerJob
(
job
);
job
->
start
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment