diff options
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinview.cpp | 24 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 13 | ||||
| -rw-r--r-- | src/views/dolphinviewactionhandler.cpp | 35 | ||||
| -rw-r--r-- | src/views/dolphinviewactionhandler.h | 3 | ||||
| -rw-r--r-- | src/views/renamedialog.cpp | 2 | ||||
| -rw-r--r-- | src/views/tooltips/tooltipmanager.cpp | 11 | ||||
| -rw-r--r-- | src/views/tooltips/tooltipmanager.h | 7 | ||||
| -rw-r--r-- | src/views/versioncontrol/fileviewversioncontrolplugin.desktop | 2 | ||||
| -rw-r--r-- | src/views/viewproperties.cpp | 9 |
9 files changed, 84 insertions, 22 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 5b00fa36d..3597a2aa4 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -66,6 +66,7 @@ #include <QPixmapCache> #include <QPointer> #include <QScrollBar> +#include <QSize> #include <QTimer> #include <QVBoxLayout> @@ -128,8 +129,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 +745,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) { @@ -1337,6 +1339,20 @@ QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh return QUrl(); } +void DolphinView::resetZoomLevel() +{ + ViewModeSettings::ViewMode mode; + + switch (m_mode) { + case IconsView: mode = ViewModeSettings::IconsMode; break; + case CompactView: mode = ViewModeSettings::CompactMode; break; + case DetailsView: mode = ViewModeSettings::DetailsMode; break; + } + const ViewModeSettings settings(mode); + const QSize iconSize = QSize(settings.iconSize(), settings.iconSize()); + setZoomLevel(ZoomLevelInfo::zoomLevelForIconSize(iconSize)); +} + void DolphinView::observeCreatedItem(const QUrl& url) { if (m_active) { @@ -1414,11 +1430,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..ba38d3234 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> @@ -195,6 +196,11 @@ public: void setZoomLevel(int level); int zoomLevel() const; + /** + * Resets the view's icon size to the default value + */ + void resetZoomLevel(); + void setSortRole(const QByteArray& role); QByteArray sortRole() const; @@ -697,8 +703,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 +738,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 a79dacb1f..25b7f82cb 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 " @@ -188,13 +188,21 @@ void DolphinViewActionHandler::createActions() m_actionCollection); zoomInAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This increases the icon size.")); + QAction* zoomResetAction = m_actionCollection->addAction(QStringLiteral("view_zoom_reset")); + zoomResetAction->setText(i18nc("@action:inmenu View", "Reset Zoom Level")); + zoomResetAction->setToolTip(i18n("Zoom To Default")); + zoomResetAction->setWhatsThis(i18nc("@info:whatsthis zoom reset", "This resets the icon size to default.")); + zoomResetAction->setIcon(QIcon::fromTheme(QStringLiteral("zoom-original"))); + m_actionCollection->setDefaultShortcuts(zoomResetAction, {Qt::CTRL + Qt::Key_0}); + connect(zoomResetAction, &QAction::triggered, this, &DolphinViewActionHandler::zoomReset); + QAction* zoomOutAction = KStandardAction::zoomOut(this, &DolphinViewActionHandler::zoomOut, m_actionCollection); - zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This reduces the icon size.")); + zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom out", "This reduces the icon size.")); KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview")); - showPreview->setText(i18nc("@action:intoolbar", "Preview")); + showPreview->setText(i18nc("@action:intoolbar", "Show Previews")); showPreview->setToolTip(i18nc("@info", "Show preview of files and folders")); showPreview->setWhatsThis(xi18nc("@info:whatsthis", "When this is " "enabled, the icons are based on the actual file or folder " @@ -245,7 +253,8 @@ void DolphinViewActionHandler::createActions() QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_")); KActionMenu* visibleRolesMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("additional_info")); - visibleRolesMenu->setText(i18nc("@action:inmenu View", "Additional Information")); + visibleRolesMenu->setText(i18nc("@action:inmenu View", "Show Additional Information")); + visibleRolesMenu->setIcon(QIcon::fromTheme(QStringLiteral("documentinfo"))); visibleRolesMenu->setDelayed(false); foreach (QAction* action, visibleRolesGroup->actions()) { @@ -259,7 +268,7 @@ void DolphinViewActionHandler::createActions() connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting); KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files")); - showHiddenFiles->setText(i18nc("@action:inmenu View", "Hidden Files")); + showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files")); showHiddenFiles->setToolTip(i18nc("@info", "Visibility of hidden files and folders")); showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis", "<para>When " "this is enabled <emphasis>hidden</emphasis> files and folders " @@ -272,6 +281,7 @@ void DolphinViewActionHandler::createActions() QAction* adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties")); adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties...")); + adjustViewProps->setIcon(QIcon::fromTheme(QStringLiteral("view-choose"))); adjustViewProps->setWhatsThis(i18nc("@info:whatsthis", "This opens a window " "in which all folder view properties can be adjusted.")); connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties); @@ -280,7 +290,7 @@ void DolphinViewActionHandler::createActions() QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix) { const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_")); - Q_ASSERT(isSortGroup || (!isSortGroup && groupPrefix == QLatin1String("show_"))); + Q_ASSERT(isSortGroup || groupPrefix == QLatin1String("show_")); QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection); rolesActionGroup->setExclusive(isSortGroup); @@ -391,7 +401,7 @@ void DolphinViewActionHandler::slotPreviewsShownChanged(bool shown) { Q_UNUSED(shown); // It is not enough to update the 'Show Preview' action, also - // the 'Zoom In' and 'Zoom Out' actions must be adapted. + // the 'Zoom In', 'Zoom Out' and 'Zoom Reset' actions must be adapted. updateViewActions(); } @@ -454,6 +464,12 @@ void DolphinViewActionHandler::zoomOut() updateViewActions(); } +void DolphinViewActionHandler::zoomReset() +{ + m_currentView->resetZoomLevel(); + updateViewActions(); +} + void DolphinViewActionHandler::toggleSortFoldersFirst() { const bool sortFirst = m_currentView->sortFoldersFirst(); @@ -535,11 +551,11 @@ void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown) // #374508: don't overwrite custom icons. const QString iconName = showHiddenFilesAction->icon().name(); - if (!iconName.isEmpty() && iconName != QLatin1String("visibility") && iconName != QLatin1String("hint")) { + if (!iconName.isEmpty() && iconName != QLatin1String("view-visible") && iconName != QLatin1String("view-hidden")) { return; } - showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("visibility") : QStringLiteral("hint"))); + showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("view-visible") : QStringLiteral("view-hidden"))); } void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable) @@ -639,7 +655,6 @@ void DolphinViewActionHandler::slotSortTriggered(QAction* action) // actions and the sub-menu-actions. If an action gets checked, it must // be assured that all other actions get unchecked, except the ascending/ // descending actions - QAction* sortByMenu = m_actionCollection->action(QStringLiteral("sort")); for (QAction *groupAction : qAsConst(m_sortByActions)) { KActionMenu* actionMenu = qobject_cast<KActionMenu*>(groupAction); if (actionMenu) { diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h index 7d675b7d4..f931b3b9c 100644 --- a/src/views/dolphinviewactionhandler.h +++ b/src/views/dolphinviewactionhandler.h @@ -131,6 +131,9 @@ private Q_SLOTS: /** Decreases the size of the current set view mode. */ void zoomOut(); + + /** Resets the size of the current set view mode to default. */ + void zoomReset(); /** Switches between a separate sorting and a mixed sorting of files and folders. */ void toggleSortFoldersFirst(); diff --git a/src/views/renamedialog.cpp b/src/views/renamedialog.cpp index 5d329c3ce..96068564d 100644 --- a/src/views/renamedialog.cpp +++ b/src/views/renamedialog.cpp @@ -188,7 +188,7 @@ void RenameDialog::slotAccepted() void RenameDialog::slotTextChanged(const QString& newName) { - bool enable = !newName.isEmpty() && (newName != QLatin1String("..")) && (newName != QLatin1String(".")); + bool enable = !newName.isEmpty() && (newName != QLatin1String("..")) && (newName != QLatin1Char('.')); if (enable && !m_renameOneItem) { const int count = newName.count(QLatin1Char('#')); if (count == 0) { 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: /** diff --git a/src/views/versioncontrol/fileviewversioncontrolplugin.desktop b/src/views/versioncontrol/fileviewversioncontrolplugin.desktop index 72c02b735..a3b45fc42 100644 --- a/src/views/versioncontrol/fileviewversioncontrolplugin.desktop +++ b/src/views/versioncontrol/fileviewversioncontrolplugin.desktop @@ -23,7 +23,7 @@ Comment[id]=Plugin Kendali Versi untuk Tampilan File Comment[it]=Estensione di controllo delle versioni per le viste dei file Comment[ja]=ファイルビューのためのバージョン管理プラグイン Comment[ko]=파일 보기를 위한 버전 관리 플러그인 -Comment[lt]=Versijų kontrolės papildinys failų tvarkyklėms +Comment[lt]=Failo rodinių versijų tvarkymo papildinys Comment[ml]=ഫയല് അവതരണദിശകൾക്കുള്ള പതിപ്പ് നിയന്ത്രണ സംയോജകം Comment[nb]=Versjonskontrollmodul for filvisninger Comment[nl]=Plugin voor versiecontrole op bestandoverzichten diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index eddc7225d..e5f3a82c4 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -26,6 +26,8 @@ #include <QCryptographicHash> +#include <KFileItem> + namespace { const int AdditionalInfoViewPropertiesVersion = 1; const int NameRolePropertiesVersion = 2; @@ -57,7 +59,7 @@ ViewProperties::ViewProperties(const QUrl& url) : // we store the properties information in a local file. if (useGlobalViewProps) { m_filePath = destinationDir(QStringLiteral("global")); - } else if (url.scheme().contains(QStringLiteral("search"))) { + } else if (url.scheme().contains(QLatin1String("search"))) { m_filePath = destinationDir(QStringLiteral("search/")) + directoryHashForUrl(url); useDetailsViewWithPath = true; } else if (url.scheme() == QLatin1String("trash")) { @@ -71,6 +73,11 @@ ViewProperties::ViewProperties(const QUrl& url) : bool useDestinationDir = !isPartOfHome(m_filePath); if (!useDestinationDir) { + const KFileItem fileItem(url); + useDestinationDir = fileItem.isSlow(); + } + + if (!useDestinationDir) { const QFileInfo dirInfo(m_filePath); const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName); useDestinationDir = !dirInfo.isWritable() || (dirInfo.size() > 0 && fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable())); |
