X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/17e1a48c68000f92033196b6d19d876143a13608..daa0fc341d8873f8b88400684642f59e6e3ef956:/src/dolphinviewcontainer.cpp diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index bd3c8ed20..87c976923 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2007 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2007 Peter Penz + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "dolphinviewcontainer.h" @@ -29,6 +16,8 @@ #include "trash/dolphintrash.h" #include "views/viewmodecontroller.h" #include "views/viewproperties.h" +#include "dolphin_detailsmodesettings.h" +#include "views/dolphinview.h" #ifdef HAVE_KACTIVITIES #include @@ -36,10 +25,11 @@ #include #include #include +#include +#include #include #include #include -#include #include #include #include @@ -119,7 +109,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) : connect(m_searchBox, &DolphinSearchBox::activated, this, &DolphinViewContainer::activate); connect(m_searchBox, &DolphinSearchBox::closeRequest, this, &DolphinViewContainer::closeSearchBox); connect(m_searchBox, &DolphinSearchBox::searchRequest, this, &DolphinViewContainer::startSearching); - connect(m_searchBox, &DolphinSearchBox::returnPressed, this, &DolphinViewContainer::requestFocus); + connect(m_searchBox, &DolphinSearchBox::focusViewRequest, this, &DolphinViewContainer::requestFocus); m_searchBox->setWhatsThis(xi18nc("@info:whatsthis findbar", "This helps you find files and folders. Enter a " "search term and specify search settings with the " @@ -249,6 +239,12 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) : setSearchModeEnabled(isSearchUrl(url)); + connect(DetailsModeSettings::self(), &KCoreConfigSkeleton::configChanged, this, [=]() { + if (view()->mode() == DolphinView::Mode::DetailsView) { + view()->reload(); + } + }); + // Initialize kactivities resource instance #ifdef HAVE_KACTIVITIES @@ -449,22 +445,20 @@ void DolphinViewContainer::reload() m_messageWidget->hide(); } -QString DolphinViewContainer::caption() const +QString DolphinViewContainer::captionWindowTitle() const { - if (GeneralSettings::showFullPathInTitlebar()) { + if (GeneralSettings::showFullPathInTitlebar() && !isSearchModeEnabled()) { if (!url().isLocalFile()) { return url().adjusted(QUrl::StripTrailingSlash).toString(); } return url().adjusted(QUrl::StripTrailingSlash).path(); + } else { + return DolphinViewContainer::caption(); } +} - 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); - - if (!matchedPlaces.isEmpty()) { - return placesModel->text(matchedPlaces.first()); - } - +QString DolphinViewContainer::caption() const +{ if (isSearchModeEnabled()) { if (currentSearchText().isEmpty()){ return i18n("Search"); @@ -473,6 +467,14 @@ QString DolphinViewContainer::caption() const } } + 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); + + if (!matchedPlaces.isEmpty()) { + return placesModel->text(matchedPlaces.first()); + } + + if (!url().isLocalFile()) { QUrl adjustedUrl = url().adjusted(QUrl::StripTrailingSlash); QString caption; @@ -631,8 +633,10 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item) return; } - KRun *run = new KRun(item.targetUrl(), this); - run->setShowScriptExecutionPrompt(true); + KIO::OpenUrlJob *job = new KIO::OpenUrlJob(item.targetUrl()); + job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); + job->setShowOpenOrExecuteDialog(true); + job->start(); } void DolphinViewContainer::slotItemsActivated(const KFileItemList& items) @@ -706,6 +710,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url) redirect(QUrl(), m_urlNavigator->locationUrl(1)); } else { showMessage(i18nc("@info:status", "Invalid protocol"), Error); + m_urlNavigator->goBack(); } }