X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/508dc815c75c9db8abaec26ae664ae41bf7f89b5..99cc976a8564cbdae63e4261fcb2292a33148dbc:/src/views/tooltips/tooltipmanager.cpp diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index 2990f4249..4786445f1 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -1,21 +1,8 @@ -/******************************************************************************* - * Copyright (C) 2008 by Konstantin Heil * - * * - * 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: 2008 Konstantin Heil + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "tooltipmanager.h" @@ -23,7 +10,9 @@ #include #include +#include #include +#include #include #include @@ -64,7 +53,7 @@ ToolTipManager::ToolTipManager(QWidget* parent) : m_showToolTipTimer = new QTimer(this); m_showToolTipTimer->setSingleShot(true); m_showToolTipTimer->setInterval(500); - connect(m_showToolTipTimer, &QTimer::timeout, this, static_cast(&ToolTipManager::showToolTip)); + connect(m_showToolTipTimer, &QTimer::timeout, this, QOverload<>::of(&ToolTipManager::showToolTip)); m_contentRetrievalTimer = new QTimer(this); m_contentRetrievalTimer->setSingleShot(true); @@ -104,7 +93,7 @@ void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect, Q_ASSERT(!m_metaDataRequested); } -void ToolTipManager::hideToolTip() +void ToolTipManager::hideToolTip(const HideBehavior behavior) { if (m_appliedWaitCursor) { QApplication::restoreOverrideCursor(); @@ -116,7 +105,14 @@ void ToolTipManager::hideToolTip() m_showToolTipTimer->stop(); m_contentRetrievalTimer->stop(); if (m_tooltipWidget) { - m_tooltipWidget->hideLater(); + switch (behavior) { + case HideBehavior::Instantly: + m_tooltipWidget->hide(); + break; + case HideBehavior::Later: + m_tooltipWidget->hideLater(); + break; + } } } @@ -138,7 +134,8 @@ void ToolTipManager::startContentRetrieval() // Request a preview of the item m_fileMetaDataWidget->setPreview(QPixmap()); - QStringList plugins = KIO::PreviewJob::availablePlugins(); + const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings"); + const QStringList plugins = globalConfig.readEntry("Plugins", KIO::PreviewJob::defaultPlugins()); KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << m_item, QSize(256, 256), &plugins);