kfile: add the leading directory to recent directories for files and URLs from KFileWidgetPrivate::addToRecent()

continuation from:
978cf7f0dd

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-27 01:55:16 +03:00
parent eef26737e5
commit 3e01296579

View file

@ -2399,6 +2399,12 @@ void KFileWidgetPrivate::addToRecent()
QStringList::ConstIterator it = files.begin();
for ( ; it != files.end() && atmost > 0; ++it ) {
KRecentDocument::add( *it );
if (!fileClass.isEmpty()) {
const QString itdir = KUrl(*it).directory();
if (!itdir.isEmpty()) {
KRecentDirs::add(fileClass, itdir);
}
}
atmost--;
}
} else {
@ -2408,6 +2414,12 @@ void KFileWidgetPrivate::addToRecent()
for ( ; it != urls.end() && atmost > 0; ++it ) {
if ( (*it).isValid() ) {
KRecentDocument::add( *it );
if (!fileClass.isEmpty()) {
const QString itdir = it->directory();
if (!itdir.isEmpty()) {
KRecentDirs::add(fileClass, itdir);
}
}
atmost--;
}
}