Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KIO Extras
Commits
91951dd0
Commit
91951dd0
authored
May 31, 2022
by
Méven Car
Browse files
recentlyused: allow to expand folders
parent
3cccab5f
Pipeline
#208336
passed with stage
in 1 minute and 57 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
recentlyused/recentlyused.cpp
View file @
91951dd0
...
...
@@ -76,7 +76,7 @@ ResultModel *runQuery(const QUrl &url)
const
auto
urlQuery
=
QUrlQuery
(
url
);
const
auto
path
=
url
.
path
();
if
(
path
==
QStringLiteral
(
"/locations"
))
{
if
(
path
.
startsWith
(
QStringLiteral
(
"/locations"
))
)
{
query
.
setTypes
(
Type
::
directories
());
}
else
{
if
(
urlQuery
.
hasQueryItem
(
QStringLiteral
(
"type"
)))
{
...
...
@@ -194,8 +194,32 @@ KIO::WorkerResult RecentlyUsed::listDir(const QUrl &url)
{
if
(
!
isRootUrl
(
url
))
{
const
auto
path
=
url
.
path
();
if
(
path
!=
QStringLiteral
(
"/files"
)
&&
path
!=
QStringLiteral
(
"/locations"
)
)
{
return
KIO
::
WorkerResult
::
fail
(
KIO
::
ERR_DOES_NOT_EXIST
,
url
.
toDisplayString
());
if
(
!
path
.
endsWith
(
QStringLiteral
(
"/"
))
&&
path
!=
QStringLiteral
(
"/"
)
&&
path
!=
QStringLiteral
(
"/files"
)
&&
path
!=
QStringLiteral
(
"/locations"
)
)
{
const
auto
splitted
=
url
.
fileName
().
splitRef
(
QStringLiteral
(
"-"
));
if
(
splitted
.
count
()
<
2
)
{
return
KIO
::
WorkerResult
::
fail
(
KIO
::
ERR_DOES_NOT_EXIST
,
url
.
toDisplayString
());
}
bool
ok
;
int
id
=
splitted
.
last
().
toInt
(
&
ok
);
if
(
!
ok
)
{
return
KIO
::
WorkerResult
::
fail
(
KIO
::
ERR_DOES_NOT_EXIST
,
url
.
toDisplayString
());
}
const
auto
model
=
runQuery
(
url
);
const
auto
index
=
model
->
index
(
id
,
0
);
if
(
!
index
.
isValid
())
{
return
KIO
::
WorkerResult
::
fail
(
KIO
::
ERR_DOES_NOT_EXIST
,
url
.
toDisplayString
());
}
const
QString
resource
=
model
->
data
(
index
,
ResultModel
::
ResourceRole
).
toString
();
qDebug
()
<<
"redirection to "
<<
resource
<<
url
;
redirection
(
QUrl
::
fromUserInput
(
resource
));
return
KIO
::
WorkerResult
::
pass
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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