#include <KProtocolManager>
#include <KShell>
#include <KUrlComboBox>
-#include <KUrlNavigator>
#include <QDropEvent>
#include <QLoggingCategory>
this, &DolphinViewContainer::slotUrlIsFileError);
connect(m_view, &DolphinView::activated,
this, &DolphinViewContainer::activate);
+ connect(m_view, &DolphinView::hiddenFilesShownChanged,
+ this, &DolphinViewContainer::slotHiddenFilesShownChanged);
+ connect(m_view, &DolphinView::sortHiddenLastChanged,
+ this, &DolphinViewContainer::slotSortHiddenLastChanged);
// Initialize status bar
m_statusBar = new DolphinStatusBar(this);
}
});
+ KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
+ connect(placesModel, &KFilePlacesModel::dataChanged,
+ this, &DolphinViewContainer::slotPlacesModelChanged);
+ connect(placesModel, &KFilePlacesModel::rowsInserted,
+ this, &DolphinViewContainer::slotPlacesModelChanged);
+ connect(placesModel, &KFilePlacesModel::rowsRemoved,
+ this, &DolphinViewContainer::slotPlacesModelChanged);
+
+ connect(this, &DolphinViewContainer::searchModeEnabledChanged,
+ this, &DolphinViewContainer::captionChanged);
+
// Initialize kactivities resource instance
#ifdef HAVE_KACTIVITIES
Q_CHECK_PTR(m_view);
urlNavigator->setLocationUrl(m_view->url());
+ urlNavigator->setShowHiddenFolders(m_view->hiddenFilesShown());
+ urlNavigator->setSortHiddenFoldersLast(m_view->sortHiddenLast());
if (m_urlNavigatorVisualState) {
urlNavigator->setVisualState(*m_urlNavigatorVisualState.get());
m_urlNavigatorVisualState.reset();
}
KFilePlacesModel *placesModel = DolphinPlacesModelSingleton::instance().placesModel();
- const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QUrl(url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?")), 1, Qt::MatchRegExp);
+ const QString pattern = url().adjusted(QUrl::StripTrailingSlash).toString(QUrl::FullyEncoded).append("/?");
+ const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, QRegularExpression::anchoredPattern(pattern), 1, Qt::MatchRegularExpression);
if (!matchedPlaces.isEmpty()) {
return placesModel->text(matchedPlaces.first());
}
KIO::OpenUrlJob *job = new KIO::OpenUrlJob(item.targetUrl());
- job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
+ job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoWarningHandlingEnabled, this));
job->setShowOpenOrExecuteDialog(true);
+ connect(job, &KIO::OpenUrlJob::finished, this, &DolphinViewContainer::slotOpenUrlFinished);
job->start();
}
Q_ASSERT(items.count() >= 2);
KFileItemActions fileItemActions(this);
- fileItemActions.runPreferredApplications(items, QString());
+ fileItemActions.runPreferredApplications(items);
}
void DolphinViewContainer::showItemInfo(const KFileItem& item)
showMessage(msg, Error);
}
+void DolphinViewContainer::slotPlacesModelChanged()
+{
+ if (!GeneralSettings::showFullPathInTitlebar() && !isSearchModeEnabled()) {
+ Q_EMIT captionChanged();
+ }
+}
+
+void DolphinViewContainer::slotHiddenFilesShownChanged(bool showHiddenFiles)
+{
+ if (m_urlNavigatorConnected) {
+ m_urlNavigatorConnected->setShowHiddenFolders(showHiddenFiles);
+ }
+}
+
+void DolphinViewContainer::slotSortHiddenLastChanged(bool hiddenLast)
+{
+ if (m_urlNavigatorConnected) {
+ m_urlNavigatorConnected->setSortHiddenFoldersLast(hiddenLast);
+ }
+}
+
+void DolphinViewContainer::slotOpenUrlFinished(KJob *job)
+{
+ if (job->error() && job->error() != KIO::ERR_USER_CANCELED) {
+ showErrorMessage(job->errorString());
+ }
+}
+
bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
{
return url.scheme().contains(QLatin1String("search"));