diff options
| -rw-r--r-- | CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/dolphinmainwindow.cpp | 2 | ||||
| -rw-r--r-- | src/dolphintabwidget.cpp | 1 | ||||
| -rw-r--r-- | src/global.cpp | 19 | ||||
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 41 | ||||
| -rw-r--r-- | src/panels/terminal/terminalpanel.cpp | 6 | ||||
| -rw-r--r-- | src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp | 38 | ||||
| -rw-r--r-- | src/views/dolphinview.cpp | 9 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 8 | ||||
| -rw-r--r-- | src/views/dolphinviewactionhandler.cpp | 2 | ||||
| -rw-r--r-- | src/views/tooltips/tooltipmanager.cpp | 11 | ||||
| -rw-r--r-- | src/views/tooltips/tooltipmanager.h | 7 |
12 files changed, 68 insertions, 80 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3237a03a2..8f2a118ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.0) # KDE Application Version, managed by release script set (KDE_APPLICATIONS_VERSION_MAJOR "19") -set (KDE_APPLICATIONS_VERSION_MINOR "08") -set (KDE_APPLICATIONS_VERSION_MICRO "0") +set (KDE_APPLICATIONS_VERSION_MINOR "11") +set (KDE_APPLICATIONS_VERSION_MICRO "70") set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION}) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 19f790662..ad193b051 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -751,7 +751,7 @@ void DolphinMainWindow::togglePanelLockState() void DolphinMainWindow::slotTerminalPanelVisibilityChanged() { - if (m_terminalPanel->isHiddenInVisibleWindow()) { + if (m_terminalPanel->isHiddenInVisibleWindow() && m_activeViewContainer) { m_activeViewContainer->view()->setFocus(); } } diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index defd089c1..afb5462e1 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -161,6 +161,7 @@ void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryU QWidget* focusWidget = QApplication::focusWidget(); DolphinTabPage* tabPage = new DolphinTabPage(primaryUrl, secondaryUrl, this); + tabPage->setActive(false); tabPage->setPlacesSelectorVisible(m_placesSelectorVisible); connect(tabPage, &DolphinTabPage::activeViewChanged, this, &DolphinTabWidget::activeViewChanged); diff --git a/src/global.cpp b/src/global.cpp index 21660a828..64282e711 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -77,12 +77,6 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi return false; } - const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); - - // Don't match the service without trailing "-" (unique instance) - const QString pattern = QStringLiteral("org.kde.dolphin-"); - // Don't match the pid without leading "-" - const QString myPid = QStringLiteral("-") + QString::number(QCoreApplication::applicationPid()); QVector<QPair<QSharedPointer<QDBusInterface>, QStringList>> dolphinServices; if (!preferredService.isEmpty()) { QSharedPointer<QDBusInterface> preferred( @@ -91,11 +85,16 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi QStringLiteral("org.kde.dolphin.MainWindow")) ); if (preferred->isValid() && !preferred->lastError().isValid()) { - dolphinServices.append(qMakePair(preferred, QStringList() )); + dolphinServices.append(qMakePair(preferred, QStringList())); } } // find all dolphin instances + const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value(); + // Don't match the service without trailing "-" (unique instance) + const QString pattern = QStringLiteral("org.kde.dolphin-"); + // Don't match the pid without leading "-" + const QString myPid = QStringLiteral("-") + QString::number(QCoreApplication::applicationPid()); for (const QString& service : services) { if (service.startsWith(pattern) && !service.endsWith(myPid)) { // Check if instance can handle our URLs @@ -124,9 +123,9 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi for (auto& service: dolphinServices) { QDBusReply<bool> isUrlOpen = service.first->call(QStringLiteral("isUrlOpen"), url); if (isUrlOpen.isValid() && isUrlOpen.value()) { - service.second.append(url); - urlFound = true; - break; + service.second.append(url); + urlFound = true; + break; } } if (!urlFound) { diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 8145a00f1..de974e7e9 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1905,28 +1905,35 @@ QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const if (firstChar != newFirstChar) { QString newGroupValue; if (newFirstChar.isLetter()) { - // Try to find a matching group in the range 'A' to 'Z'. - static std::vector<QChar> lettersAtoZ; - lettersAtoZ.reserve('Z' - 'A' + 1); - if (lettersAtoZ.empty()) { - for (char c = 'A'; c <= 'Z'; ++c) { - lettersAtoZ.push_back(QLatin1Char(c)); + + if (m_collator.compare(newFirstChar, QChar(QLatin1Char('A'))) >= 0 && m_collator.compare(newFirstChar, QChar(QLatin1Char('Z'))) <= 0) { + // WARNING! Symbols based on latin 'Z' like 'Z' with acute are treated wrong as non Latin and put in a new group. + + // Try to find a matching group in the range 'A' to 'Z'. + static std::vector<QChar> lettersAtoZ; + lettersAtoZ.reserve('Z' - 'A' + 1); + if (lettersAtoZ.empty()) { + for (char c = 'A'; c <= 'Z'; ++c) { + lettersAtoZ.push_back(QLatin1Char(c)); + } } - } - auto localeAwareLessThan = [this](QChar c1, QChar c2) -> bool { - return m_collator.compare(c1, c2) < 0; - }; + auto localeAwareLessThan = [this](QChar c1, QChar c2) -> bool { + return m_collator.compare(c1, c2) < 0; + }; - std::vector<QChar>::iterator it = std::lower_bound(lettersAtoZ.begin(), lettersAtoZ.end(), newFirstChar, localeAwareLessThan); - if (it != lettersAtoZ.end()) { - if (localeAwareLessThan(newFirstChar, *it) && it != lettersAtoZ.begin()) { - // newFirstChar belongs to the group preceding *it. - // Example: for an umlaut 'A' in the German locale, *it would be 'B' now. - --it; + std::vector<QChar>::iterator it = std::lower_bound(lettersAtoZ.begin(), lettersAtoZ.end(), newFirstChar, localeAwareLessThan); + if (it != lettersAtoZ.end()) { + if (localeAwareLessThan(newFirstChar, *it)) { + // newFirstChar belongs to the group preceding *it. + // Example: for an umlaut 'A' in the German locale, *it would be 'B' now. + --it; + } + newGroupValue = *it; } - newGroupValue = *it; + } else { + // Symbols from non Latin-based scripts newGroupValue = newFirstChar; } } else if (newFirstChar >= QLatin1Char('0') && newFirstChar <= QLatin1Char('9')) { diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 52d2a77df..86974d200 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -82,16 +82,14 @@ void TerminalPanel::terminalExited() bool TerminalPanel::isHiddenInVisibleWindow() const { return parentWidget() - && parentWidget()->isHidden() - && m_terminal - && !hasProgramRunning(); + && parentWidget()->isHidden(); } void TerminalPanel::dockVisibilityChanged() { // Only react when the DockWidget itself (not some parent) is hidden. This way we don't // respond when e.g. Dolphin is minimized. - if (isHiddenInVisibleWindow()) { + if (isHiddenInVisibleWindow() && m_terminal && !hasProgramRunning()) { // Make sure that the following "cd /" command will not affect the view. disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)), this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString))); diff --git a/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp b/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp index 037874539..1144a50b8 100644 --- a/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp +++ b/src/settings/services/servicemenuinstaller/servicemenuinstaller.cpp @@ -24,6 +24,7 @@ #include <QDir> #include <QDirIterator> #include <QCommandLineParser> +#include <QMimeDatabase> #include <KLocalizedString> @@ -42,41 +43,6 @@ Q_NORETURN void fail(const QString &str) exit(1); } -bool evaluateShell(const QString &program, const QStringList &arguments, QString &output, QString &errorText) -{ - QProcess process; - process.start(program, arguments, QIODevice::ReadOnly); - if (!process.waitForStarted()) { - fail(i18n("Failed to run process: %1 %2", program, arguments.join(" "))); - } - - if (!process.waitForFinished()) { - fail(i18n("Process did not finish in reasonable time: %1 %2", program, arguments.join(" "))); - } - - const auto stdoutResult = QString::fromUtf8(process.readAllStandardOutput()).trimmed(); - const auto stderrResult = QString::fromUtf8(process.readAllStandardError()).trimmed(); - - if (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0) { - output = stdoutResult; - return true; - } else { - errorText = stderrResult + stdoutResult; - return false; - } -} - -QString mimeType(const QString &path) -{ - QString result; - QString errorText; - if (evaluateShell("xdg-mime", QStringList{"query", "filetype", path}, result, errorText)) { - return result; - } else { - fail(i18n("Failed to run xdg-mime %1: %2", path, errorText)); - } -} - QString getServiceMenusDir() { const QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); @@ -114,7 +80,7 @@ void runUncompress(const QString &inputPath, const QString &outputPath) { "multipart/x-zip"}, UncompressCommand{"unzip", QStringList{}, QStringList{"-d"}}}); - const auto mime = mimeType(inputPath); + const auto mime = QMimeDatabase().mimeTypeForFile(inputPath).name(); UncompressCommand command{}; for (const auto &pair : mimeTypeToCommand) { diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 5b00fa36d..e6b232dcc 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -128,8 +128,8 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) : m_container = new KItemListContainer(controller, this); m_container->installEventFilter(this); setFocusProxy(m_container); - connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); - connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip); + connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); }); + connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); }); controller->setSelectionBehavior(KItemListController::MultiSelection); connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated); @@ -744,6 +744,7 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event) break; case QEvent::KeyPress: + hideToolTip(ToolTipManager::HideBehavior::Instantly); if (GeneralSettings::useTabForSwitchingSplitView()) { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) { @@ -1414,11 +1415,11 @@ void DolphinView::updateViewState() } } -void DolphinView::hideToolTip() +void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior) { #ifdef HAVE_BALOO if (GeneralSettings::showToolTips()) { - m_toolTipManager->hideToolTip(); + m_toolTipManager->hideToolTip(behavior); } #endif } diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 7be2eed2d..a4da92f2d 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -23,6 +23,7 @@ #include "dolphintabwidget.h" #include "dolphin_export.h" +#include "tooltips/tooltipmanager.h" #include <KFileItem> #include <KIO/Job> @@ -697,8 +698,6 @@ private slots: */ void updateViewState(); - void hideToolTip(); - /** * Calculates the number of currently shown files into * \a fileCount and the number of folders into \a folderCount. @@ -734,6 +733,11 @@ private: void applyModeToView(); /** + * Hides tooltip displayed over element. + */ + void hideToolTip(const ToolTipManager::HideBehavior behavior = ToolTipManager::HideBehavior::Later); + + /** * Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder(). * Pastes the clipboard data into the URL \a url. */ diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 41752e4f1..18b1c2d97 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -163,7 +163,7 @@ void DolphinViewActionHandler::createActions() "</interface> option is enabled.</para>")); compactAction->setWhatsThis(xi18nc("@info:whatsthis Compact view mode", "<para>This switches to a compact view mode that lists the folders " - "and files in columns with the names beside the icons. <para></para>" + "and files in columns with the names beside the icons.</para><para>" "This helps to keep the overview in folders with many items.</para>")); detailsAction->setWhatsThis(xi18nc("@info:whatsthis Details view mode", "<para>This switches to a list view mode that focuses on folder " diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index aae97458c..eaa785987 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -104,7 +104,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 +116,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; + } } } diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h index 10f88ad76..c09a40d31 100644 --- a/src/views/tooltips/tooltipmanager.h +++ b/src/views/tooltips/tooltipmanager.h @@ -42,6 +42,11 @@ class ToolTipManager : public QObject Q_OBJECT public: + enum class HideBehavior { + Instantly, + Later + }; + explicit ToolTipManager(QWidget* parent); ~ToolTipManager() override; @@ -56,7 +61,7 @@ public: /** * Hides the currently shown tooltip. */ - void hideToolTip(); + void hideToolTip(const HideBehavior behavior = HideBehavior::Later); signals: /** |
