Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kurlnavigatorbutton.cpp
Show All 23 Lines | |||||
24 | #include "kurlnavigatormenu_p.h" | 24 | #include "kurlnavigatormenu_p.h" | ||
25 | #include "kdirsortfilterproxymodel.h" | 25 | #include "kdirsortfilterproxymodel.h" | ||
26 | #include "../pathhelpers_p.h" | 26 | #include "../pathhelpers_p.h" | ||
27 | 27 | | |||
28 | #include <kio/job.h> | 28 | #include <kio/job.h> | ||
29 | #include <klocalizedstring.h> | 29 | #include <klocalizedstring.h> | ||
30 | #include <kstringhandler.h> | 30 | #include <kstringhandler.h> | ||
31 | 31 | | |||
32 | #include <QDir> | ||||
32 | #include <QTimer> | 33 | #include <QTimer> | ||
33 | #include <QPainter> | 34 | #include <QPainter> | ||
34 | #include <QKeyEvent> | 35 | #include <QKeyEvent> | ||
35 | #include <QStyleOption> | 36 | #include <QStyleOption> | ||
36 | #include <QMimeData> | 37 | #include <QMimeData> | ||
37 | #include <QCollator> | 38 | #include <QCollator> | ||
38 | 39 | | |||
39 | namespace KDEPrivate | 40 | namespace KDEPrivate | ||
▲ Show 20 Lines • Show All 362 Lines • ▼ Show 20 Line(s) | |||||
402 | } | 403 | } | ||
403 | 404 | | |||
404 | void KUrlNavigatorButton::startSubDirsJob() | 405 | void KUrlNavigatorButton::startSubDirsJob() | ||
405 | { | 406 | { | ||
406 | if (m_subDirsJob != nullptr) { | 407 | if (m_subDirsJob != nullptr) { | ||
407 | return; | 408 | return; | ||
408 | } | 409 | } | ||
409 | 410 | | |||
410 | const QUrl url = m_replaceButton ? KIO::upUrl(m_url) : m_url; | 411 | QUrl url = m_url; | ||
412 | if (m_replaceButton) { | ||||
413 | url = KIO::upUrl(m_url); | ||||
414 | } else { | ||||
gregormi: When I click a zip file I get this in the URL bar:
```
krarc:/home/gregor/Downloads/kfk_10p. | |||||
Or we could use mimetype detection like we do in KUrlNavigator::Private::isCompressedPath(). elvisangelaccio: Or we could use mimetype detection like we do in `KUrlNavigator::Private::isCompressedPath()`. | |||||
What would be the clean way to expose this function ? I wouldn't like to duplicate the code. thsurrel: What would be the clean way to expose this function ? I wouldn't like to duplicate the code. | |||||
Sorry for the late reply. One way could be a public static function, either in KUrlNavigator or KUrlNavigatorButton. elvisangelaccio: > What would be the clean way to expose this function ? I wouldn't like to duplicate the code. | |||||
415 | auto kurlnavigator = qobject_cast<KUrlNavigator*>(parent()); | ||||
416 | if (kurlnavigator->isInsideCompressedPath(kurlnavigator->locationUrl())) { | ||||
elvisangelaccio: What if the parent is not a `KUrlNavigator`? | |||||
417 | // We are in an archive, check whether the subdir we have to list is part of the archive | ||||
elvisangelaccio: Coding sytle: variable names need to be camelCase. | |||||
418 | // or is a parent directory. | ||||
419 | QDir testDir(url.path()); | ||||
420 | if (testDir.exists()) { | ||||
421 | url.setScheme(QStringLiteral("file")); | ||||
422 | } | ||||
423 | } | ||||
424 | } | ||||
411 | m_subDirsJob = KIO::listDir(url, KIO::HideProgressInfo, false /*no hidden files*/); | 425 | m_subDirsJob = KIO::listDir(url, KIO::HideProgressInfo, false /*no hidden files*/); | ||
412 | m_subDirs.clear(); // just to be ++safe | 426 | m_subDirs.clear(); // just to be ++safe | ||
413 | 427 | | |||
414 | connect(m_subDirsJob, &KIO::ListJob::entries, | 428 | connect(m_subDirsJob, &KIO::ListJob::entries, | ||
415 | this, &KUrlNavigatorButton::addEntriesToSubDirs); | 429 | this, &KUrlNavigatorButton::addEntriesToSubDirs); | ||
416 | 430 | | |||
417 | if (m_replaceButton) { | 431 | if (m_replaceButton) { | ||
418 | connect(m_subDirsJob, &KJob::result, this, &KUrlNavigatorButton::replaceButton); | 432 | connect(m_subDirsJob, &KJob::result, this, &KUrlNavigatorButton::replaceButton); | ||
▲ Show 20 Lines • Show All 284 Lines • Show Last 20 Lines |
When I click a zip file I get this in the URL bar:
This could mean that "krarc" should be added to this if statement.