┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorSerg Podtynnyi <[email protected]>2023-02-04 00:14:53 +0700
committerSerg Podtynnyi <[email protected]>2023-02-05 12:45:38 +0700
commit38c34eeca315c7be58e65d4d3fb72aaf7b866719 (patch)
tree886e53f20c9c43edc3eb7fe04789716a9bc98ebe /src/views
parentffff8af851e3a386c44438337779d0ce7ca98a61 (diff)
Add clang-format and format code as in Frameworks
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphinfileitemlistwidget.cpp42
-rw-r--r--src/views/dolphinfileitemlistwidget.h5
-rw-r--r--src/views/dolphinitemlistview.cpp13
-rw-r--r--src/views/dolphinitemlistview.h13
-rw-r--r--src/views/dolphinnewfilemenuobserver.cpp29
-rw-r--r--src/views/dolphinnewfilemenuobserver.h10
-rw-r--r--src/views/dolphinremoteencoding.cpp39
-rw-r--r--src/views/dolphinremoteencoding.h38
-rw-r--r--src/views/dolphinview.cpp447
-rw-r--r--src/views/dolphinview.h151
-rw-r--r--src/views/dolphinviewactionhandler.cpp331
-rw-r--r--src/views/dolphinviewactionhandler.h45
-rw-r--r--src/views/draganddrophelper.cpp25
-rw-r--r--src/views/draganddrophelper.h22
-rw-r--r--src/views/tooltips/dolphinfilemetadatawidget.cpp29
-rw-r--r--src/views/tooltips/dolphinfilemetadatawidget.h23
-rw-r--r--src/views/tooltips/tooltipmanager.cpp48
-rw-r--r--src/views/tooltips/tooltipmanager.h19
-rw-r--r--src/views/versioncontrol/kversioncontrolplugin.cpp6
-rw-r--r--src/views/versioncontrol/kversioncontrolplugin.h22
-rw-r--r--src/views/versioncontrol/updateitemstatesthread.cpp21
-rw-r--r--src/views/versioncontrol/updateitemstatesthread.h11
-rw-r--r--src/views/versioncontrol/versioncontrolobserver.cpp101
-rw-r--r--src/views/versioncontrol/versioncontrolobserver.h36
-rw-r--r--src/views/viewmodecontroller.cpp17
-rw-r--r--src/views/viewmodecontroller.h12
-rw-r--r--src/views/viewproperties.cpp87
-rw-r--r--src/views/viewproperties.h16
-rw-r--r--src/views/zoomlevelinfo.cpp48
-rw-r--r--src/views/zoomlevelinfo.h5
30 files changed, 826 insertions, 885 deletions
diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp
index c3a15ea6f..429060221 100644
--- a/src/views/dolphinfileitemlistwidget.cpp
+++ b/src/views/dolphinfileitemlistwidget.cpp
@@ -10,9 +10,8 @@
#include <KIconLoader>
-DolphinFileItemListWidget::DolphinFileItemListWidget(KItemListWidgetInformant* informant,
- QGraphicsItem* parent) :
- KFileItemListWidget(informant, parent)
+DolphinFileItemListWidget::DolphinFileItemListWidget(KItemListWidgetInformant *informant, QGraphicsItem *parent)
+ : KFileItemListWidget(informant, parent)
{
}
@@ -35,23 +34,39 @@ void DolphinFileItemListWidget::refreshCache()
// as tint colors and are mixed with the current set text color. The tint colors
// have been optimized for the base colors of the corresponding Oxygen emblems.
switch (version) {
- case KVersionControlPlugin::UpdateRequiredVersion: tintColor = Qt::yellow; break;
- case KVersionControlPlugin::LocallyModifiedUnstagedVersion: tintColor = Qt::green; break;
- case KVersionControlPlugin::LocallyModifiedVersion: tintColor = Qt::green; break;
- case KVersionControlPlugin::AddedVersion: tintColor = Qt::green; break;
- case KVersionControlPlugin::RemovedVersion: tintColor = Qt::darkRed; break;
- case KVersionControlPlugin::ConflictingVersion: tintColor = Qt::red; break;
- case KVersionControlPlugin::IgnoredVersion: tintColor = Qt::white; break;
- case KVersionControlPlugin::MissingVersion: tintColor = Qt::red; break;
+ case KVersionControlPlugin::UpdateRequiredVersion:
+ tintColor = Qt::yellow;
+ break;
+ case KVersionControlPlugin::LocallyModifiedUnstagedVersion:
+ tintColor = Qt::green;
+ break;
+ case KVersionControlPlugin::LocallyModifiedVersion:
+ tintColor = Qt::green;
+ break;
+ case KVersionControlPlugin::AddedVersion:
+ tintColor = Qt::green;
+ break;
+ case KVersionControlPlugin::RemovedVersion:
+ tintColor = Qt::darkRed;
+ break;
+ case KVersionControlPlugin::ConflictingVersion:
+ tintColor = Qt::red;
+ break;
+ case KVersionControlPlugin::IgnoredVersion:
+ tintColor = Qt::white;
+ break;
+ case KVersionControlPlugin::MissingVersion:
+ tintColor = Qt::red;
+ break;
case KVersionControlPlugin::NormalVersion:
case KVersionControlPlugin::UnversionedVersion:
default:
break;
}
- color = QColor((tintColor.red() + textColor.red()) / 2,
+ color = QColor((tintColor.red() + textColor.red()) / 2,
(tintColor.green() + textColor.green()) / 2,
- (tintColor.blue() + textColor.blue()) / 2,
+ (tintColor.blue() + textColor.blue()) / 2,
(tintColor.alpha() + textColor.alpha()) / 2);
setOverlay(overlayForState(version, styleOption().iconSize));
@@ -109,4 +124,3 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin::ItemVe
return QIcon::fromTheme(iconName).pixmap(QSize(overlayHeight, overlayHeight));
}
-
diff --git a/src/views/dolphinfileitemlistwidget.h b/src/views/dolphinfileitemlistwidget.h
index dc9e27585..ac98666c8 100644
--- a/src/views/dolphinfileitemlistwidget.h
+++ b/src/views/dolphinfileitemlistwidget.h
@@ -22,7 +22,7 @@ class DOLPHIN_EXPORT DolphinFileItemListWidget : public KFileItemListWidget
Q_OBJECT
public:
- DolphinFileItemListWidget(KItemListWidgetInformant* informant, QGraphicsItem* parent);
+ DolphinFileItemListWidget(KItemListWidgetInformant *informant, QGraphicsItem *parent);
~DolphinFileItemListWidget() override;
protected:
@@ -30,9 +30,6 @@ protected:
private:
static QPixmap overlayForState(KVersionControlPlugin::ItemVersion version, int size);
-
};
#endif
-
-
diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp
index 5dec2b1f8..a24e31347 100644
--- a/src/views/dolphinitemlistview.cpp
+++ b/src/views/dolphinitemlistview.cpp
@@ -17,10 +17,9 @@
#include <KIO/PreviewJob>
#include <QtMath>
-
-DolphinItemListView::DolphinItemListView(QGraphicsWidget* parent) :
- KFileItemListView(parent),
- m_zoomLevel(0)
+DolphinItemListView::DolphinItemListView(QGraphicsWidget *parent)
+ : KFileItemListView(parent)
+ , m_zoomLevel(0)
{
updateFont();
updateGridSize();
@@ -104,7 +103,7 @@ void DolphinItemListView::writeSettings()
DetailsModeSettings::self()->save();
}
-KItemListWidgetCreatorBase* DolphinItemListView::defaultWidgetCreator() const
+KItemListWidgetCreatorBase *DolphinItemListView::defaultWidgetCreator() const
{
return new KItemListWidgetCreator<DolphinFileItemListWidget>();
}
@@ -135,8 +134,7 @@ void DolphinItemListView::onPreviewsShownChanged(bool shown)
updateGridSize();
}
-void DolphinItemListView::onVisibleRolesChanged(const QList<QByteArray>& current,
- const QList<QByteArray>& previous)
+void DolphinItemListView::onVisibleRolesChanged(const QList<QByteArray> &current, const QList<QByteArray> &previous)
{
KFileItemListView::onVisibleRolesChanged(current, previous);
updateGridSize();
@@ -180,7 +178,6 @@ void DolphinItemListView::updateGridSize()
switch (itemLayout()) {
case KFileItemListView::IconsLayout: {
-
// an exponential factor based on zoom, 0 -> 1, 4 -> 1.36 8 -> ~1.85, 16 -> 3.4
auto zoomFactor = qExp(m_zoomLevel / 13.0);
// 9 is the average char width for 10pt Noto Sans, making fontFactor =1
diff --git a/src/views/dolphinitemlistview.h b/src/views/dolphinitemlistview.h
index 25476290f..0483c0644 100644
--- a/src/views/dolphinitemlistview.h
+++ b/src/views/dolphinitemlistview.h
@@ -24,17 +24,13 @@ class DOLPHIN_EXPORT DolphinItemListView : public KFileItemListView
Q_OBJECT
public:
- explicit DolphinItemListView(QGraphicsWidget* parent = nullptr);
+ explicit DolphinItemListView(QGraphicsWidget *parent = nullptr);
~DolphinItemListView() override;
void setZoomLevel(int level);
int zoomLevel() const;
- enum SelectionTogglesEnabled {
- True,
- False,
- FollowSetting
- };
+ enum SelectionTogglesEnabled { True, False, FollowSetting };
/**
* Sets whether the items in this view should show a small selection toggle area on mouse hover.
* The default for this view is to follow the "showSelectionToggle" setting but this method can
@@ -46,15 +42,14 @@ public:
void writeSettings();
protected:
- KItemListWidgetCreatorBase* defaultWidgetCreator() const override;
+ KItemListWidgetCreatorBase *defaultWidgetCreator() const override;
/** Overwriting in the Dolphin-specific class because we want this to be user-configurable.
* @see KStandardItemListView::itemLayoutHighlightEntireRow */
bool itemLayoutHighlightEntireRow(ItemLayout layout) const override;
bool itemLayoutSupportsItemExpanding(ItemLayout layout) const override;
void onItemLayoutChanged(ItemLayout current, ItemLayout previous) override;
void onPreviewsShownChanged(bool shown) override;
- void onVisibleRolesChanged(const QList<QByteArray>& current,
- const QList<QByteArray>& previous) override;
+ void onVisibleRolesChanged(const QList<QByteArray> &current, const QList<QByteArray> &previous) override;
void updateFont() override;
diff --git a/src/views/dolphinnewfilemenuobserver.cpp b/src/views/dolphinnewfilemenuobserver.cpp
index 1c91282df..a1e2fe1d0 100644
--- a/src/views/dolphinnewfilemenuobserver.cpp
+++ b/src/views/dolphinnewfilemenuobserver.cpp
@@ -15,37 +15,30 @@ public:
};
Q_GLOBAL_STATIC(DolphinNewFileMenuObserverSingleton, s_DolphinNewFileMenuObserver)
-DolphinNewFileMenuObserver& DolphinNewFileMenuObserver::instance()
+DolphinNewFileMenuObserver &DolphinNewFileMenuObserver::instance()
{
return s_DolphinNewFileMenuObserver->instance;
}
-void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu* menu)
+void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu *menu)
{
- connect(menu, &DolphinNewFileMenu::fileCreated,
- this, &DolphinNewFileMenuObserver::itemCreated);
- connect(menu, &DolphinNewFileMenu::directoryCreated,
- this, &DolphinNewFileMenuObserver::itemCreated);
- connect(menu, &DolphinNewFileMenu::errorMessage,
- this, &DolphinNewFileMenuObserver::errorMessage);
+ connect(menu, &DolphinNewFileMenu::fileCreated, this, &DolphinNewFileMenuObserver::itemCreated);
+ connect(menu, &DolphinNewFileMenu::directoryCreated, this, &DolphinNewFileMenuObserver::itemCreated);
+ connect(menu, &DolphinNewFileMenu::errorMessage, this, &DolphinNewFileMenuObserver::errorMessage);
}
-void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu* menu)
+void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu *menu)
{
- disconnect(menu, &DolphinNewFileMenu::fileCreated,
- this, &DolphinNewFileMenuObserver::itemCreated);
- disconnect(menu, &DolphinNewFileMenu::directoryCreated,
- this, &DolphinNewFileMenuObserver::itemCreated);
- disconnect(menu, &DolphinNewFileMenu::errorMessage,
- this, &DolphinNewFileMenuObserver::errorMessage);
+ disconnect(menu, &DolphinNewFileMenu::fileCreated, this, &DolphinNewFileMenuObserver::itemCreated);
+ disconnect(menu, &DolphinNewFileMenu::directoryCreated, this, &DolphinNewFileMenuObserver::itemCreated);
+ disconnect(menu, &DolphinNewFileMenu::errorMessage, this, &DolphinNewFileMenuObserver::errorMessage);
}
-DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() :
- QObject(nullptr)
+DolphinNewFileMenuObserver::DolphinNewFileMenuObserver()
+ : QObject(nullptr)
{
}
DolphinNewFileMenuObserver::~DolphinNewFileMenuObserver()
{
}
-
diff --git a/src/views/dolphinnewfilemenuobserver.h b/src/views/dolphinnewfilemenuobserver.h
index 82f09daa2..23bd6a836 100644
--- a/src/views/dolphinnewfilemenuobserver.h
+++ b/src/views/dolphinnewfilemenuobserver.h
@@ -25,13 +25,13 @@ class DOLPHIN_EXPORT DolphinNewFileMenuObserver : public QObject
Q_OBJECT
public:
- static DolphinNewFileMenuObserver& instance();
- void attach(const DolphinNewFileMenu* menu);
- void detach(const DolphinNewFileMenu* menu);
+ static DolphinNewFileMenuObserver &instance();
+ void attach(const DolphinNewFileMenu *menu);
+ void detach(const DolphinNewFileMenu *menu);
Q_SIGNALS:
- void itemCreated(const QUrl& url);
- void errorMessage(const QString& error);
+ void itemCreated(const QUrl &url);
+ void errorMessage(const QString &error);
private:
DolphinNewFileMenuObserver();
diff --git a/src/views/dolphinremoteencoding.cpp b/src/views/dolphinremoteencoding.cpp
index c7c8b09d1..04626c1c3 100644
--- a/src/views/dolphinremoteencoding.cpp
+++ b/src/views/dolphinremoteencoding.cpp
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
- /*
+/*
* This code is largely based on the kremoteencodingplugin
* SPDX-FileCopyrightText: 2003 Thiago Macieira <[email protected]>
* Distributed under the same terms.
@@ -12,8 +12,8 @@
#include "dolphinremoteencoding.h"
-#include "dolphinviewactionhandler.h"
#include "dolphindebug.h"
+#include "dolphinviewactionhandler.h"
#include <KActionCollection>
#include <KActionMenu>
@@ -27,18 +27,17 @@
#include <QMenu>
-#define DATA_KEY QStringLiteral("Charset")
+#define DATA_KEY QStringLiteral("Charset")
-DolphinRemoteEncoding::DolphinRemoteEncoding(QObject* parent, DolphinViewActionHandler* actionHandler)
- :QObject(parent),
- m_actionHandler(actionHandler),
- m_loaded(false),
- m_idDefault(0)
+DolphinRemoteEncoding::DolphinRemoteEncoding(QObject *parent, DolphinViewActionHandler *actionHandler)
+ : QObject(parent)
+ , m_actionHandler(actionHandler)
+ , m_loaded(false)
+ , m_idDefault(0)
{
m_menu = new KActionMenu(QIcon::fromTheme(QStringLiteral("character-set")), i18n("Select Remote Charset"), this);
m_actionHandler->actionCollection()->addAction(QStringLiteral("change_remote_encoding"), m_menu);
- connect(m_menu->menu(), &QMenu::aboutToShow,
- this, &DolphinRemoteEncoding::slotAboutToShow);
+ connect(m_menu->menu(), &QMenu::aboutToShow, this, &DolphinRemoteEncoding::slotAboutToShow);
m_menu->setEnabled(false);
m_menu->setPopupMode(QToolButton::InstantPopup);
@@ -69,9 +68,7 @@ void DolphinRemoteEncoding::slotAboutToOpenUrl()
if (m_currentURL.scheme() != oldURL.scheme()) {
// This plugin works on ftp, fish, etc.
// everything whose type is T_FILESYSTEM except for local files
- if (!m_currentURL.isLocalFile() &&
- KProtocolManager::outputType(m_currentURL) == KProtocolInfo::T_FILESYSTEM) {
-
+ if (!m_currentURL.isLocalFile() && KProtocolManager::outputType(m_currentURL) == KProtocolInfo::T_FILESYSTEM) {
m_menu->setEnabled(true);
loadSettings();
} else {
@@ -87,12 +84,12 @@ void DolphinRemoteEncoding::slotAboutToOpenUrl()
void DolphinRemoteEncoding::fillMenu()
{
- QMenu* menu = m_menu->menu();
+ QMenu *menu = m_menu->menu();
menu->clear();
menu->addAction(i18n("Default"), this, SLOT(slotDefault()), 0)->setCheckable(true);
- for (int i = 0; i < m_encodingDescriptions.size();i++) {
- QAction* action = new QAction(m_encodingDescriptions.at(i), this);
+ for (int i = 0; i < m_encodingDescriptions.size(); i++) {
+ QAction *action = new QAction(m_encodingDescriptions.at(i), this);
action->setCheckable(true);
action->setData(i);
menu->addAction(action);
@@ -112,7 +109,7 @@ void DolphinRemoteEncoding::updateMenu()
}
// uncheck everything
- for (int i = 0; i < m_menu->menu()->actions().count(); i++) {
+ for (int i = 0; i < m_menu->menu()->actions().count(); i++) {
m_menu->menu()->actions().at(i)->setChecked(false);
}
@@ -131,14 +128,13 @@ void DolphinRemoteEncoding::updateMenu()
qCDebug(DolphinDebug) << "URL=" << m_currentURL << " charset=" << charset;
if (!isFound) {
- qCWarning(DolphinDebug) << "could not find entry for charset=" << charset ;
+ qCWarning(DolphinDebug) << "could not find entry for charset=" << charset;
} else {
m_menu->menu()->actions().at(id)->setChecked(true);
}
} else {
m_menu->menu()->actions().at(m_idDefault)->setChecked(true);
}
-
}
void DolphinRemoteEncoding::slotAboutToShow()
@@ -149,7 +145,7 @@ void DolphinRemoteEncoding::slotAboutToShow()
updateMenu();
}
-void DolphinRemoteEncoding::slotItemSelected(QAction* action)
+void DolphinRemoteEncoding::slotItemSelected(QAction *action)
{
if (action) {
int id = action->data().toInt();
@@ -197,7 +193,7 @@ void DolphinRemoteEncoding::slotDefault()
partList.erase(partList.begin());
}
- for (QStringList::const_iterator it = domains.constBegin(); it != domains.constEnd();++it) {
+ for (QStringList::const_iterator it = domains.constBegin(); it != domains.constEnd(); ++it) {
qCDebug(DolphinDebug) << "Domain to remove: " << *it;
if (config.hasGroup(*it)) {
config.deleteGroup(*it);
@@ -219,4 +215,3 @@ void DolphinRemoteEncoding::updateView()
m_actionHandler->currentView()->setUrl(m_currentURL);
m_actionHandler->currentView()->reload();
}
-
diff --git a/src/views/dolphinremoteencoding.h b/src/views/dolphinremoteencoding.h
index ae1d78b6d..c59de6406 100644
--- a/src/views/dolphinremoteencoding.h
+++ b/src/views/dolphinremoteencoding.h
@@ -22,35 +22,35 @@ class DolphinViewActionHandler;
* When browsing remote url, its possible to change encoding from Tools Menu.
*/
-class DOLPHIN_EXPORT DolphinRemoteEncoding: public QObject
+class DOLPHIN_EXPORT DolphinRemoteEncoding : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- DolphinRemoteEncoding(QObject* parent, DolphinViewActionHandler* actionHandler);
- ~DolphinRemoteEncoding() override;
+ DolphinRemoteEncoding(QObject *parent, DolphinViewActionHandler *actionHandler);
+ ~DolphinRemoteEncoding() override;
public Q_SLOTS:
- void slotAboutToOpenUrl();
- void slotItemSelected(QAction* action);
- void slotReload();
- void slotDefault();
+ void slotAboutToOpenUrl();
+ void slotItemSelected(QAction *action);
+ void slotReload();
+ void slotDefault();
private Q_SLOTS:
- void slotAboutToShow();
+ void slotAboutToShow();
private:
- void updateView();
- void loadSettings();
- void fillMenu();
- void updateMenu();
+ void updateView();
+ void loadSettings();
+ void fillMenu();
+ void updateMenu();
- KActionMenu* m_menu;
- QStringList m_encodingDescriptions;
- QUrl m_currentURL;
- DolphinViewActionHandler* m_actionHandler;
+ KActionMenu *m_menu;
+ QStringList m_encodingDescriptions;
+ QUrl m_currentURL;
+ DolphinViewActionHandler *m_actionHandler;
- bool m_loaded;
- int m_idDefault;
+ bool m_loaded;
+ int m_idDefault;
};
#endif
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index d16aa3b09..35d69e610 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -7,8 +7,8 @@
#include "dolphinview.h"
-#include "dolphin_generalsettings.h"
#include "dolphin_detailsmodesettings.h"
+#include "dolphin_generalsettings.h"
#include "dolphinitemlistview.h"
#include "dolphinnewfilemenuobserver.h"
#include "draganddrophelper.h"
@@ -19,8 +19,8 @@
#include "kitemviews/kitemlistheader.h"
#include "kitemviews/kitemlistselectionmanager.h"
#include "kitemviews/private/kitemlistroleeditor.h"
-#include "settings/viewmodes/viewmodesettings.h"
#include "selectionmode/singleclickselectionproxystyle.h"
+#include "settings/viewmodes/viewmodesettings.h"
#include "versioncontrol/versioncontrolobserver.h"
#include "viewproperties.h"
#include "views/tooltips/tooltipmanager.h"
@@ -71,33 +71,33 @@
#include <QToolTip>
#include <QVBoxLayout>
-DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
- QWidget(parent),
- m_active(true),
- m_tabsForFiles(false),
- m_assureVisibleCurrentIndex(false),
- m_isFolderWritable(true),
- m_dragging(false),
- m_url(url),
- m_viewPropertiesContext(),
- m_mode(DolphinView::IconsView),
- m_visibleRoles(),
- m_topLayout(nullptr),
- m_model(nullptr),
- m_view(nullptr),
- m_container(nullptr),
- m_toolTipManager(nullptr),
- m_selectionChangedTimer(nullptr),
- m_currentItemUrl(),
- m_scrollToCurrentItem(false),
- m_restoredContentsPosition(),
- m_selectedUrls(),
- m_clearSelectionBeforeSelectingNewItems(false),
- m_markFirstNewlySelectedItemAsCurrent(false),
- m_versionControlObserver(nullptr),
- m_twoClicksRenamingTimer(nullptr),
- m_placeholderLabel(nullptr),
- m_showLoadingPlaceholderTimer(nullptr)
+DolphinView::DolphinView(const QUrl &url, QWidget *parent)
+ : QWidget(parent)
+ , m_active(true)
+ , m_tabsForFiles(false)
+ , m_assureVisibleCurrentIndex(false)
+ , m_isFolderWritable(true)
+ , m_dragging(false)
+ , m_url(url)
+ , m_viewPropertiesContext()
+ , m_mode(DolphinView::IconsView)
+ , m_visibleRoles()
+ , m_topLayout(nullptr)
+ , m_model(nullptr)
+ , m_view(nullptr)
+ , m_container(nullptr)
+ , m_toolTipManager(nullptr)
+ , m_selectionChangedTimer(nullptr)
+ , m_currentItemUrl()
+ , m_scrollToCurrentItem(false)
+ , m_restoredContentsPosition()
+ , m_selectedUrls()
+ , m_clearSelectionBeforeSelectingNewItems(false)
+ , m_markFirstNewlySelectedItemAsCurrent(false)
+ , m_versionControlObserver(nullptr)
+ , m_twoClicksRenamingTimer(nullptr)
+ , m_placeholderLabel(nullptr)
+ , m_showLoadingPlaceholderTimer(nullptr)
{
m_topLayout = new QVBoxLayout(this);
m_topLayout->setSpacing(0);
@@ -106,14 +106,12 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
// When a new item has been created by the "Create New..." menu, the item should
// get selected and it must be assured that the item will get visible. As the
// creation is done asynchronously, several signals must be checked:
- connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::itemCreated,
- this, &DolphinView::observeCreatedItem);
+ connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::itemCreated, this, &DolphinView::observeCreatedItem);
m_selectionChangedTimer = new QTimer(this);
m_selectionChangedTimer->setSingleShot(true);
m_selectionChangedTimer->setInterval(300);
- connect(m_selectionChangedTimer, &QTimer::timeout,
- this, &DolphinView::emitSelectionChangedSignal);
+ connect(m_selectionChangedTimer, &QTimer::timeout, this, &DolphinView::emitSelectionChangedSignal);
m_model = new KFileItemModel(this);
m_view = new DolphinItemListView();
@@ -121,7 +119,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
m_view->setVisibleRoles({"text"});
applyModeToView();
- KItemListController* controller = new KItemListController(m_model, m_view, this);
+ KItemListController *controller = new KItemListController(m_model, m_view, this);
const int delay = GeneralSettings::autoExpandFolders() ? 750 : -1;
controller->setAutoActivationDelay(delay);
@@ -132,8 +130,12 @@ 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, [=] { hideToolTip(); });
- connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); });
+ connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] {
+ hideToolTip();
+ });
+ connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] {
+ hideToolTip();
+ });
m_showLoadingPlaceholderTimer = new QTimer(this);
m_showLoadingPlaceholderTimer->setInterval(500);
@@ -162,7 +164,7 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
centeringLayout->addWidget(m_placeholderLabel);
centeringLayout->setAlignment(m_placeholderLabel, Qt::AlignCenter);
m_placeholderLabel->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(m_placeholderLabel, &QWidget::customContextMenuRequested, this, [this](const QPoint& pos){
+ connect(m_placeholderLabel, &QWidget::customContextMenuRequested, this, [this](const QPoint &pos) {
slotViewContextMenuRequested(m_placeholderLabel->mapToGlobal(pos));
});
@@ -185,42 +187,33 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
connect(controller, &KItemListController::swipeUp, this, &DolphinView::slotSwipeUp);
connect(controller, &KItemListController::selectionModeChangeRequested, this, &DolphinView::selectionModeChangeRequested);
- connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted);
- connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
- connect(m_model, &KFileItemModel::directoryLoadingCanceled, this, &DolphinView::slotDirectoryLoadingCanceled);
- connect(m_model, &KFileItemModel::directoryLoadingProgress, this, &DolphinView::directoryLoadingProgress);
- connect(m_model, &KFileItemModel::directorySortingProgress, this, &DolphinView::directorySortingProgress);
- connect(m_model, &KFileItemModel::itemsChanged,
- this, &DolphinView::slotItemsChanged);
- connect(m_model, &KFileItemModel::itemsRemoved, this, &DolphinView::itemCountChanged);
- connect(m_model, &KFileItemModel::itemsInserted, this, &DolphinView::itemCountChanged);
- connect(m_model, &KFileItemModel::infoMessage, this, &DolphinView::infoMessage);
- connect(m_model, &KFileItemModel::errorMessage, this, &DolphinView::errorMessage);
+ connect(m_model, &KFileItemModel::directoryLoadingStarted, this, &DolphinView::slotDirectoryLoadingStarted);
+ connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
+ connect(m_model, &KFileItemModel::directoryLoadingCanceled, this, &DolphinView::slotDirectoryLoadingCanceled);
+ connect(m_model, &KFileItemModel::directoryLoadingProgress, this, &DolphinView::directoryLoadingProgress);
+ connect(m_model, &KFileItemModel::directorySortingProgress, this, &DolphinView::directorySortingProgress);
+ connect(m_model, &KFileItemModel::itemsChanged, this, &DolphinView::slotItemsChanged);
+ connect(m_model, &KFileItemModel::itemsRemoved, this, &DolphinView::itemCountChanged);
+ connect(m_model, &KFileItemModel::itemsInserted, this, &DolphinView::itemCountChanged);
+ connect(m_model, &KFileItemModel::infoMessage, this, &DolphinView::infoMessage);
+ connect(m_model, &KFileItemModel::errorMessage, this, &DolphinView::errorMessage);
connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
- connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
- connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged);
+ connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
+ connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged);
connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved);
- connect(this, &DolphinView::itemCountChanged,
- this, &DolphinView::updatePlaceholderLabel);
+ connect(this, &DolphinView::itemCountChanged, this, &DolphinView::updatePlaceholderLabel);
m_view->installEventFilter(this);
- connect(m_view, &DolphinItemListView::sortOrderChanged,
- this, &DolphinView::slotSortOrderChangedByHeader);
- connect(m_view, &DolphinItemListView::sortRoleChanged,
- this, &DolphinView::slotSortRoleChangedByHeader);
- connect(m_view, &DolphinItemListView::visibleRolesChanged,
- this, &DolphinView::slotVisibleRolesChangedByHeader);
- connect(m_view, &DolphinItemListView::roleEditingCanceled,
- this, &DolphinView::slotRoleEditingCanceled);
- connect(m_view->header(), &KItemListHeader::columnWidthChangeFinished,
- this, &DolphinView::slotHeaderColumnWidthChangeFinished);
- connect(m_view->header(), &KItemListHeader::sidePaddingChanged,
- this, &DolphinView::slotSidePaddingWidthChanged);
+ connect(m_view, &DolphinItemListView::sortOrderChanged, this, &DolphinView::slotSortOrderChangedByHeader);
+ connect(m_view, &DolphinItemListView::sortRoleChanged, this, &DolphinView::slotSortRoleChangedByHeader);
+ connect(m_view, &DolphinItemListView::visibleRolesChanged, this, &DolphinView::slotVisibleRolesChangedByHeader);
+ connect(m_view, &DolphinItemListView::roleEditingCanceled, this, &DolphinView::slotRoleEditingCanceled);
+ connect(m_view->header(), &KItemListHeader::columnWidthChangeFinished, this, &DolphinView::slotHeaderColumnWidthChangeFinished);
+ connect(m_view->header(), &KItemListHeader::sidePaddingChanged, this, &DolphinView::slotSidePaddingWidthChanged);
- KItemListSelectionManager* selectionManager = controller->selectionManager();
- connect(selectionManager, &KItemListSelectionManager::selectionChanged,
- this, &DolphinView::slotSelectionChanged);
+ KItemListSelectionManager *selectionManager = controller->selectionManager();
+ connect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &DolphinView::slotSelectionChanged);
#if HAVE_BALOO
m_toolTipManager = new ToolTipManager(this);
@@ -401,7 +394,7 @@ int DolphinView::itemsCount() const
KFileItemList DolphinView::selectedItems() const
{
- const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ const KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
KFileItemList selectedItems;
const auto items = selectionManager->selectedItems();
@@ -414,11 +407,11 @@ KFileItemList DolphinView::selectedItems() const
int DolphinView::selectedItemsCount() const
{
- const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ const KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
return selectionManager->selectedItems().count();
}
-void DolphinView::markUrlsAsSelected(const QList<QUrl>& urls)
+void DolphinView::markUrlsAsSelected(const QList<QUrl> &urls)
{
m_selectedUrls = urls;
}
@@ -431,10 +424,8 @@ void DolphinView::markUrlAsCurrent(const QUrl &url)
void DolphinView::selectItems(const QRegularExpression &regexp, bool enabled)
{
- const KItemListSelectionManager::SelectionMode mode = enabled
- ? KItemListSelectionManager::Select
- : KItemListSelectionManager::Deselect;
- KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ const KItemListSelectionManager::SelectionMode mode = enabled ? KItemListSelectionManager::Select : KItemListSelectionManager::Deselect;
+ KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
for (int index = 0; index < m_model->count(); index++) {
const KFileItem item = m_model->fileItem(index);
@@ -463,7 +454,7 @@ int DolphinView::zoomLevel() const
return m_view->zoomLevel();
}
-void DolphinView::setSortRole(const QByteArray& role)
+void DolphinView::setSortRole(const QByteArray &role)
{
if (role != sortRole()) {
updateSortRole(role);
@@ -472,7 +463,7 @@ void DolphinView::setSortRole(const QByteArray& role)
QByteArray DolphinView::sortRole() const
{
- const KItemModelBase* model = m_container->controller()->model();
+ const KItemModelBase *model = m_container->controller()->model();
return model->sortRole();
}
@@ -512,7 +503,7 @@ bool DolphinView::sortHiddenLast() const
return m_model->sortHiddenLast();
}
-void DolphinView::setVisibleRoles(const QList<QByteArray>& roles)
+void DolphinView::setVisibleRoles(const QList<QByteArray> &roles)
{
const QList<QByteArray> previousRoles = roles;
@@ -566,7 +557,7 @@ void DolphinView::writeSettings()
m_view->writeSettings();
}
-void DolphinView::setNameFilter(const QString& nameFilter)
+void DolphinView::setNameFilter(const QString &nameFilter)
{
m_model->setNameFilter(nameFilter);
}
@@ -576,7 +567,7 @@ QString DolphinView::nameFilter() const
return m_model->nameFilter();
}
-void DolphinView::setMimeTypeFilters(const QStringList& filters)
+void DolphinView::setMimeTypeFilters(const QStringList &filters)
{
return m_model->setMimeTypeFilters(filters);
}
@@ -600,7 +591,7 @@ void DolphinView::requestStatusBarText()
// Give a summary of the status of the selected files
const KFileItemList list = selectedItems();
- for (const KFileItem& item : list) {
+ for (const KFileItem &item : list) {
if (item.isDir()) {
++folderCount;
} else {
@@ -621,16 +612,13 @@ void DolphinView::requestStatusBarText()
return;
}
- m_statJobForStatusBarText = KIO::statDetails(m_model->rootItem().url(),
- KIO::StatJob::SourceSide, KIO::StatRecursiveSize, KIO::HideProgressInfo);
- connect(m_statJobForStatusBarText, &KJob::result,
- this, &DolphinView::slotStatJobResult);
+ m_statJobForStatusBarText = KIO::statDetails(m_model->rootItem().url(), KIO::StatJob::SourceSide, KIO::StatRecursiveSize, KIO::HideProgressInfo);
+ connect(m_statJobForStatusBarText, &KJob::result, this, &DolphinView::slotStatJobResult);
m_statJobForStatusBarText->start();
}
}
-void DolphinView::emitStatusBarText(const int folderCount, const int fileCount,
- KIO::filesize_t totalFileSize, const Selection selection)
+void DolphinView::emitStatusBarText(const int folderCount, const int fileCount, KIO::filesize_t totalFileSize, const Selection selection)
{
QString foldersText;
QString filesText;
@@ -647,13 +635,9 @@ void DolphinView::emitStatusBarText(const int folderCount, const int fileCount,
}
if (fileCount > 0 && folderCount > 0) {
- summary = i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
- foldersText, filesText,
- KFormat().formatByteSize(totalFileSize));
+ summary = i18nc("@info:status folders, files (size)", "%1, %2 (%3)", foldersText, filesText, KFormat().formatByteSize(totalFileSize));
} else if (fileCount > 0) {
- summary = i18nc("@info:status files (size)", "%1 (%2)",
- filesText,
- KFormat().formatByteSize(totalFileSize));
+ summary = i18nc("@info:status files (size)", "%1 (%2)", filesText, KFormat().formatByteSize(totalFileSize));
} else if (folderCount > 0) {
summary = foldersText;
} else {
@@ -662,9 +646,9 @@ void DolphinView::emitStatusBarText(const int folderCount, const int fileCount,
Q_EMIT statusBarTextChanged(summary);
}
-QList<QAction*> DolphinView::versionControlActions(const KFileItemList& items) const
+QList<QAction *> DolphinView::versionControlActions(const KFileItemList &items) const
{
- QList<QAction*> actions;
+ QList<QAction *> actions;
if (items.isEmpty()) {
const KFileItem item = m_model->rootItem();
@@ -678,7 +662,7 @@ QList<QAction*> DolphinView::versionControlActions(const KFileItemList& items) c
return actions;
}
-void DolphinView::setUrl(const QUrl& url)
+void DolphinView::setUrl(const QUrl &url)
{
if (url == m_url) {
return;
@@ -690,8 +674,7 @@ void DolphinView::setUrl(const QUrl& url)
hideToolTip();
- disconnect(m_view, &DolphinItemListView::roleEditingFinished,
- this, &DolphinView::slotRoleEditingFinished);
+ disconnect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
// It is important to clear the items from the model before
// applying the view properties, otherwise expensive operations
@@ -706,13 +689,13 @@ void DolphinView::setUrl(const QUrl& url)
void DolphinView::selectAll()
{
- KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
selectionManager->setSelected(0, m_model->count());
}
void DolphinView::invertSelection()
{
- KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
selectionManager->setSelected(0, m_model->count(), KItemListSelectionManager::Toggle);
}
@@ -732,8 +715,8 @@ void DolphinView::renameSelectedItems()
if (items.count() == 1 && GeneralSettings::renameInline()) {
const int index = m_model->index(items.first());
- QMetaObject::Connection * const connection = new QMetaObject::Connection;
- *connection = connect(m_view, &KItemListView::scrollingStopped, this, [=](){
+ QMetaObject::Connection *const connection = new QMetaObject::Connection;
+ *connection = connect(m_view, &KItemListView::scrollingStopped, this, [=]() {
QObject::disconnect(*connection);
delete connection;
@@ -741,15 +724,13 @@ void DolphinView::renameSelectedItems()
hideToolTip();
- connect(m_view, &DolphinItemListView::roleEditingFinished,
- this, &DolphinView::slotRoleEditingFinished);
+ connect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
});
m_view->scrollToItem(index);
} else {
- KIO::RenameFileDialog* dialog = new KIO::RenameFileDialog(items, this);
- connect(dialog, &KIO::RenameFileDialog::renamingFinished,
- this, &DolphinView::slotRenameDialogRenamingFinished);
+ KIO::RenameFileDialog *dialog = new KIO::RenameFileDialog(items, this);
+ connect(dialog, &KIO::RenameFileDialog::renamingFinished, this, &DolphinView::slotRenameDialogRenamingFinished);
dialog->open();
}
@@ -773,11 +754,10 @@ void DolphinView::trashSelectedItems()
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(window());
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
- KIO::Job* job = KIO::trash(list);
+ KIO::Job *job = KIO::trash(list);
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl(QStringLiteral("trash:/")), job);
KJobWidgets::setWindow(job, this);
- connect(job, &KIO::Job::result,
- this, &DolphinView::slotTrashFileFinished);
+ connect(job, &KIO::Job::result, this, &DolphinView::slotTrashFileFinished);
}
#endif
}
@@ -795,17 +775,16 @@ void DolphinView::deleteSelectedItems()
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(window());
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
- KIO::Job* job = KIO::del(list);
+ KIO::Job *job = KIO::del(list);
KJobWidgets::setWindow(job, this);
- connect(job, &KIO::Job::result,
- this, &DolphinView::slotDeleteFileFinished);
+ connect(job, &KIO::Job::result, this, &DolphinView::slotDeleteFileFinished);
}
#endif
}
void DolphinView::cutSelectedItemsToClipboard()
{
- QMimeData* mimeData = selectionMimeData();
+ QMimeData *mimeData = selectionMimeData();
KIO::setClipboardDataCut(mimeData, true);
KUrlMimeData::exportUrlsToPortal(mimeData);
QApplication::clipboard()->setMimeData(mimeData);
@@ -820,7 +799,7 @@ void DolphinView::copySelectedItemsToClipboard()
void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
{
- KIO::CopyJob* job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags);
+ KIO::CopyJob *job = KIO::copy(selection.urlList(), destinationUrl, KIO::DefaultFlags);
KJobWidgets::setWindow(job, this);
connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult);
@@ -830,13 +809,12 @@ void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &
void DolphinView::moveSelectedItems(const KFileItemList &selection, const QUrl &destinationUrl)
{
- KIO::CopyJob* job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags);
+ KIO::CopyJob *job = KIO::move(selection.urlList(), destinationUrl, KIO::DefaultFlags);
KJobWidgets::setWindow(job, this);
connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult);
connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotCopyingDone);
KIO::FileUndoManager::self()->recordCopyJob(job);
-
}
void DolphinView::paste()
@@ -865,7 +843,7 @@ void DolphinView::duplicateSelectedItems()
// but before the filename extension, if present
QList<QUrl> newSelection;
for (const auto &item : itemList) {
- const QUrl originalURL = item.url();
+ const QUrl originalURL = item.url();
const QString originalDirectoryPath = originalURL.adjusted(QUrl::RemoveFilename).path();
const QString originalFileName = item.name();
@@ -876,7 +854,7 @@ void DolphinView::duplicateSelectedItems()
// No extension; new filename is "<oldfilename> copy"
if (extension.isEmpty()) {
duplicateURL.setPath(originalDirectoryPath + i18nc("<filename> copy", "%1 copy", originalFileName));
- // There's an extension; new filename is "<oldfilename> copy.<extension>"
+ // There's an extension; new filename is "<oldfilename> copy.<extension>"
} else {
// Need to add a dot since QMimeDatabase::suffixForFileName() doesn't include it
extension = QLatin1String(".") + extension;
@@ -887,7 +865,7 @@ void DolphinView::duplicateSelectedItems()
duplicateURL.setPath(originalDirectoryPath + i18nc("<filename> copy", "%1 copy", originalFilenameWithoutExtension) + originalExtension);
}
- KIO::CopyJob* job = KIO::copyAs(originalURL, duplicateURL);
+ KIO::CopyJob *job = KIO::copyAs(originalURL, duplicateURL);
KJobWidgets::setWindow(job, this);
if (job) {
@@ -911,7 +889,7 @@ void DolphinView::updatePalette()
color.setAlpha(150);
}
- QWidget* viewport = m_container->viewport();
+ QWidget *viewport = m_container->viewport();
if (viewport) {
QPalette palette;
palette.setColor(viewport->backgroundRole(), color);
@@ -927,7 +905,7 @@ void DolphinView::abortTwoClicksRenaming()
m_twoClicksRenamingTimer->stop();
}
-bool DolphinView::eventFilter(QObject* watched, QEvent* event)
+bool DolphinView::eventFilter(QObject *watched, QEvent *event)
{
switch (event->type()) {
case QEvent::PaletteChange:
@@ -943,7 +921,7 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
case QEvent::KeyPress:
hideToolTip(ToolTipManager::HideBehavior::Instantly);
if (GeneralSettings::useTabForSwitchingSplitView()) {
- QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
+ QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) {
Q_EMIT toggleActiveViewRequested();
return true;
@@ -976,7 +954,7 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
break;
case QEvent::ToolTip:
- tryShowNameToolTip(static_cast<QHelpEvent*>(event));
+ tryShowNameToolTip(static_cast<QHelpEvent *>(event));
default:
break;
@@ -985,7 +963,7 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
return QWidget::eventFilter(watched, event);
}
-void DolphinView::wheelEvent(QWheelEvent* event)
+void DolphinView::wheelEvent(QWheelEvent *event)
{
if (event->modifiers().testFlag(Qt::ControlModifier)) {
const QPoint numDegrees = event->angleDelta() / 8;
@@ -998,13 +976,13 @@ void DolphinView::wheelEvent(QWheelEvent* event)
}
}
-void DolphinView::hideEvent(QHideEvent* event)
+void DolphinView::hideEvent(QHideEvent *event)
{
hideToolTip();
QWidget::hideEvent(event);
}
-bool DolphinView::event(QEvent* event)
+bool DolphinView::event(QEvent *event)
{
if (event->type() == QEvent::WindowDeactivate) {
/* See Bug 297355
@@ -1045,13 +1023,18 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes)
if (indexes.count() > 5) {
QString question = i18np("Are you sure you want to open 1 item?", "Are you sure you want to open %1 items?", indexes.count());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
- const int answer = KMessageBox::warningTwoActions(this, question, {},
+ const int answer = KMessageBox::warningTwoActions(
+ this,
+ question,
+ {},
#else
- const int answer = KMessageBox::warningYesNo(this, question, {},
+ const int answer =
+ KMessageBox::warningYesNo(this,
+ question,
+ {},
#endif
- KGuiItem(i18ncp("@action:button", "Open %1 Item", "Open %1 Items", indexes.count()),
- QStringLiteral("document-open")),
- KStandardGuiItem::cancel());
+ KGuiItem(i18ncp("@action:button", "Open %1 Item", "Open %1 Items", indexes.count()), QStringLiteral("document-open")),
+ KStandardGuiItem::cancel());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (answer != KMessageBox::PrimaryAction) {
#else
@@ -1066,7 +1049,7 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes)
for (int index : indexes) {
KFileItem item = m_model->fileItem(index);
- const QUrl& url = openItemAsFolderUrl(item);
+ const QUrl &url = openItemAsFolderUrl(item);
if (!url.isEmpty()) {
// Open folders in new tabs or in new windows depending on the modifier
@@ -1091,8 +1074,8 @@ void DolphinView::slotItemsActivated(const KItemSet &indexes)
void DolphinView::slotItemMiddleClicked(int index)
{
- const KFileItem& item = m_model->fileItem(index);
- const QUrl& url = openItemAsFolderUrl(item);
+ const KFileItem &item = m_model->fileItem(index);
+ const QUrl &url = openItemAsFolderUrl(item);
const auto modifiers = QGuiApplication::keyboardModifiers();
if (!url.isEmpty()) {
// keep in sync with KUrlNavigator::slotNavigatorButtonClicked
@@ -1111,7 +1094,7 @@ void DolphinView::slotItemMiddleClicked(int index)
}
}
-void DolphinView::slotItemContextMenuRequested(int index, const QPointF& pos)
+void DolphinView::slotItemContextMenuRequested(int index, const QPointF &pos)
{
// Force emit of a selection changed signal before we request the
// context menu, to update the edit-actions first. (See Bug 294013)
@@ -1123,18 +1106,18 @@ void DolphinView::slotItemContextMenuRequested(int index, const QPointF& pos)
Q_EMIT requestContextMenu(pos.toPoint(), item, selectedItems(), url());
}
-void DolphinView::slotViewContextMenuRequested(const QPointF& pos)
+void DolphinView::slotViewContextMenuRequested(const QPointF &pos)
{
Q_EMIT requestContextMenu(pos.toPoint(), KFileItem(), selectedItems(), url());
}
-void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
+void DolphinView::slotHeaderContextMenuRequested(const QPointF &pos)
{
ViewProperties props(viewPropertiesUrl());
QPointer<QMenu> menu = new QMenu(QApplication::activeWindow());
- KItemListView* view = m_container->controller()->view();
+ KItemListView *view = m_container->controller()->view();
const QList<QByteArray> visibleRolesSet = view->visibleRoles();
bool indexingEnabled = false;
@@ -1144,18 +1127,18 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
#endif
QString groupName;
- QMenu* groupMenu = nullptr;
+ QMenu *groupMenu = nullptr;
// Add all roles to the menu that can be shown or hidden by the user
const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
- for (const KFileItemModel::RoleInfo& info : rolesInfo) {
+ for (const KFileItemModel::RoleInfo &info : rolesInfo) {
if (info.role == "text") {
// It should not be possible to hide the "text" role
continue;
}
const QString text = m_model->roleDescription(info.role);
- QAction* action = nullptr;
+ QAction *action = nullptr;
if (info.group.isEmpty()) {
action = menu->addAction(text);
} else {
@@ -1171,34 +1154,32 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
action->setChecked(visibleRolesSet.contains(info.role));
action->setData(info.role);
- const bool enable = (!info.requiresBaloo && !info.requiresIndexer) ||
- (info.requiresBaloo) ||
- (info.requiresIndexer && indexingEnabled);
+ const bool enable = (!info.requiresBaloo && !info.requiresIndexer) || (info.requiresBaloo) || (info.requiresIndexer && indexingEnabled);
action->setEnabled(enable);
}
menu->addSeparator();
- QActionGroup* widthsGroup = new QActionGroup(menu);
+ QActionGroup *widthsGroup = new QActionGroup(menu);
const bool autoColumnWidths = props.headerColumnWidths().isEmpty();
- QAction* toggleSidePaddingAction = menu->addAction(i18nc("@action:inmenu", "Side Padding"));
+ QAction *toggleSidePaddingAction = menu->addAction(i18nc("@action:inmenu", "Side Padding"));
toggleSidePaddingAction->setCheckable(true);
toggleSidePaddingAction->setChecked(view->header()->sidePadding() > 0);
- QAction* autoAdjustWidthsAction = menu->addAction(i18nc("@action:inmenu", "Automatic Column Widths"));
+ QAction *autoAdjustWidthsAction = menu->addAction(i18nc("@action:inmenu", "Automatic Column Widths"));
autoAdjustWidthsAction->setCheckable(true);
autoAdjustWidthsAction->setChecked(autoColumnWidths);
autoAdjustWidthsAction->setActionGroup(widthsGroup);
- QAction* customWidthsAction = menu->addAction(i18nc("@action:inmenu", "Custom Column Widths"));
+ QAction *customWidthsAction = menu->addAction(i18nc("@action:inmenu", "Custom Column Widths"));
customWidthsAction->setCheckable(true);
customWidthsAction->setChecked(!autoColumnWidths);
customWidthsAction->setActionGroup(widthsGroup);
- QAction* action = menu->exec(pos.toPoint());
+ QAction *action = menu->exec(pos.toPoint());
if (menu && action) {
- KItemListHeader* header = view->header();
+ KItemListHeader *header = view->header();
if (action == autoAdjustWidthsAction) {
// Clear the column-widths from the viewproperties and turn on
@@ -1211,7 +1192,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
QList<int> columnWidths;
const auto visibleRoles = view->visibleRoles();
columnWidths.reserve(visibleRoles.count());
- for (const QByteArray& role : visibleRoles) {
+ for (const QByteArray &role : visibleRoles) {
columnWidths.append(header->columnWidth(role));
}
props.setHeaderColumnWidths(columnWidths);
@@ -1236,7 +1217,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
if (!header->automaticColumnResizing()) {
const auto visibleRoles = view->visibleRoles();
columnWidths.reserve(visibleRoles.count());
- for (const QByteArray& role : visibleRoles) {
+ for (const QByteArray &role : visibleRoles) {
columnWidths.append(header->columnWidth(role));
}
}
@@ -1247,7 +1228,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF& pos)
delete menu;
}
-void DolphinView::slotHeaderColumnWidthChangeFinished(const QByteArray& role, qreal current)
+void DolphinView::slotHeaderColumnWidthChangeFinished(const QByteArray &role, qreal current)
{
const QList<QByteArray> visibleRoles = m_view->visibleRoles();
@@ -1256,8 +1237,8 @@ void DolphinView::slotHeaderColumnWidthChangeFinished(const QByteArray& role, qr
if (columnWidths.count() != visibleRoles.count()) {
columnWidths.clear();
columnWidths.reserve(visibleRoles.count());
- const KItemListHeader* header = m_view->header();
- for (const QByteArray& role : visibleRoles) {
+ const KItemListHeader *header = m_view->header();
+ for (const QByteArray &role : visibleRoles) {
const int width = header->columnWidth(role);
columnWidths.append(width);
}
@@ -1304,7 +1285,7 @@ void DolphinView::slotItemUnhovered(int index)
Q_EMIT requestItemInfo(KFileItem());
}
-void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
+void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent *event)
{
QUrl destUrl;
KFileItem destItem = m_model->fileItem(index);
@@ -1318,11 +1299,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
destUrl = destItem.mostLocalUrl();
}
- QDropEvent dropEvent(event->pos().toPoint(),
- event->possibleActions(),
- event->mimeData(),
- event->buttons(),
- event->modifiers());
+ QDropEvent dropEvent(event->pos().toPoint(), event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers());
dropUrls(destUrl, &dropEvent, this);
setActive(true);
@@ -1330,7 +1307,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget *dropWidget)
{
- KIO::DropJob* job = DragAndDropHelper::dropUrls(destUrl, dropEvent, dropWidget);
+ KIO::DropJob *job = DragAndDropHelper::dropUrls(destUrl, dropEvent, dropWidget);
if (job) {
connect(job, &KIO::DropJob::result, this, &DolphinView::slotJobResult);
@@ -1344,18 +1321,18 @@ void DolphinView::dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget *
}
}
-void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
+void DolphinView::slotModelChanged(KItemModelBase *current, KItemModelBase *previous)
{
if (previous != nullptr) {
- Q_ASSERT(qobject_cast<KFileItemModel*>(previous));
- KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(previous);
+ Q_ASSERT(qobject_cast<KFileItemModel *>(previous));
+ KFileItemModel *fileItemModel = static_cast<KFileItemModel *>(previous);
disconnect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
m_versionControlObserver->setModel(nullptr);
}
if (current) {
- Q_ASSERT(qobject_cast<KFileItemModel*>(current));
- KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
+ Q_ASSERT(qobject_cast<KFileItemModel *>(current));
+ KFileItemModel *fileItemModel = static_cast<KFileItemModel *>(current);
connect(fileItemModel, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::slotDirectoryLoadingCompleted);
m_versionControlObserver->setModel(fileItemModel);
}
@@ -1391,7 +1368,7 @@ void DolphinView::slotCopyingDone(KIO::Job *, const QUrl &, const QUrl &to)
slotItemCreated(to);
}
-void DolphinView::slotItemCreated(const QUrl& url)
+void DolphinView::slotItemCreated(const QUrl &url)
{
if (m_markFirstNewlySelectedItemAsCurrent) {
markUrlAsCurrent(url);
@@ -1410,12 +1387,11 @@ void DolphinView::slotJobResult(KJob *job)
}
}
-void DolphinView::slotSelectionChanged(const KItemSet& current, const KItemSet& previous)
+void DolphinView::slotSelectionChanged(const KItemSet &current, const KItemSet &previous)
{
const int currentCount = current.count();
const int previousCount = previous.count();
- const bool selectionStateChanged = (currentCount == 0 && previousCount > 0) ||
- (currentCount > 0 && previousCount == 0);
+ const bool selectionStateChanged = (currentCount == 0 && previousCount > 0) || (currentCount > 0 && previousCount == 0);
// If nothing has been selected before and something got selected (or if something
// was selected before and now nothing is selected) the selectionChangedSignal must
@@ -1437,11 +1413,10 @@ void DolphinView::slotStatJobResult(KJob *job)
KIO::filesize_t totalFileSize = 0;
bool countFileSize = true;
- const auto entry = static_cast<KIO::StatJob *>(job)->statResult();
+ const auto entry = static_cast<KIO::StatJob *>(job)->statResult();
if (entry.contains(KIO::UDSEntry::UDS_RECURSIVE_SIZE)) {
// We have a precomputed value.
- totalFileSize = static_cast<KIO::filesize_t>(
- entry.numberValue(KIO::UDSEntry::UDS_RECURSIVE_SIZE));
+ totalFileSize = static_cast<KIO::filesize_t>(entry.numberValue(KIO::UDSEntry::UDS_RECURSIVE_SIZE));
countFileSize = false;
}
@@ -1460,12 +1435,12 @@ void DolphinView::slotStatJobResult(KJob *job)
emitStatusBarText(folderCount, fileCount, totalFileSize, NoSelection);
}
-void DolphinView::updateSortRole(const QByteArray& role)
+void DolphinView::updateSortRole(const QByteArray &role)
{
ViewProperties props(viewPropertiesUrl());
props.setSortRole(role);
- KItemModelBase* model = m_container->controller()->model();
+ KItemModelBase *model = m_container->controller()->model();
model->setSortRole(role);
Q_EMIT sortRoleChanged(role);
@@ -1501,7 +1476,6 @@ void DolphinView::updateSortHiddenLast(bool hiddenLast)
Q_EMIT sortHiddenLastChanged(hiddenLast);
}
-
QPair<bool, QString> DolphinView::pasteInfo() const
{
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
@@ -1525,7 +1499,7 @@ bool DolphinView::itemsExpandable() const
return m_mode == DetailsView;
}
-bool DolphinView::isExpanded(const KFileItem& item) const
+bool DolphinView::isExpanded(const KFileItem &item) const
{
Q_ASSERT(item.isDir());
Q_ASSERT(items().contains(item));
@@ -1535,7 +1509,7 @@ bool DolphinView::isExpanded(const KFileItem& item) const
return m_model->isExpanded(m_model->index(item));
}
-void DolphinView::restoreState(QDataStream& stream)
+void DolphinView::restoreState(QDataStream &stream)
{
// Read the version number of the view state and check if the version is supported.
quint32 version = 0;
@@ -1560,7 +1534,7 @@ void DolphinView::restoreState(QDataStream& stream)
m_model->restoreExpandedDirectories(urls);
}
-void DolphinView::saveState(QDataStream& stream)
+void DolphinView::saveState(QDataStream &stream)
{
stream << quint32(1); // View state version
@@ -1592,7 +1566,7 @@ KFileItem DolphinView::rootItem() const
return m_model->rootItem();
}
-void DolphinView::setViewPropertiesContext(const QString& context)
+void DolphinView::setViewPropertiesContext(const QString &context)
{
m_viewPropertiesContext = context;
}
@@ -1602,7 +1576,7 @@ QString DolphinView::viewPropertiesContext() const
return m_viewPropertiesContext;
}
-QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives)
+QUrl DolphinView::openItemAsFolderUrl(const KFileItem &item, const bool browseThroughArchives)
{
if (item.isNull()) {
return QUrl();
@@ -1615,7 +1589,7 @@ QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
}
if (item.isMimeTypeKnown()) {
- const QString& mimetype = item.mimetype();
+ const QString &mimetype = item.mimetype();
if (browseThroughArchives && item.isFile() && url.isLocalFile()) {
// Generic mechanism for redirecting to tar:/<path>/ when clicking on a tar file,
@@ -1623,7 +1597,7 @@ QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
// The .protocol file specifies the mimetype that the kioslave handles.
// Note that we don't use mimetype inheritance since we don't want to
// open OpenDocument files as zip folders...
- const QString& protocol = KProtocolManager::protocolForArchiveMimetype(mimetype);
+ const QString &protocol = KProtocolManager::protocolForArchiveMimetype(mimetype);
if (!protocol.isEmpty()) {
url.setScheme(protocol);
return url;
@@ -1655,14 +1629,14 @@ void DolphinView::resetZoomLevel()
setZoomLevel(ZoomLevelInfo::zoomLevelForIconSize(QSize(defaultIconSize, defaultIconSize)));
}
-void DolphinView::observeCreatedItem(const QUrl& url)
+void DolphinView::observeCreatedItem(const QUrl &url)
{
if (m_active) {
forceUrlsSelection(url, {url});
}
}
-void DolphinView::slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl)
+void DolphinView::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl)
{
if (oldUrl.matches(url(), QUrl::StripTrailingSlash)) {
Q_EMIT redirection(oldUrl, newUrl);
@@ -1673,7 +1647,7 @@ void DolphinView::slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUr
void DolphinView::updateViewState()
{
if (m_currentItemUrl != QUrl()) {
- KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
// if there is a selection already, leave it that way
if (!selectionManager->hasSelection()) {
@@ -1705,7 +1679,7 @@ void DolphinView::updateViewState()
}
if (!m_selectedUrls.isEmpty()) {
- KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
// if there is a selection already, leave it that way
if (!selectionManager->hasSelection()) {
@@ -1744,13 +1718,13 @@ void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior)
Q_UNUSED(behavior)
#endif
} else if (m_mode == DolphinView::IconsView) {
- QToolTip::hideText();
+ QToolTip::hideText();
}
}
void DolphinView::slotTwoClicksRenamingTimerTimeout()
{
- const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ const KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
// verify that only one item is selected
if (selectionManager->selectedItems().count() == 1) {
@@ -1764,7 +1738,7 @@ void DolphinView::slotTwoClicksRenamingTimerTimeout()
}
}
-void DolphinView::slotTrashFileFinished(KJob* job)
+void DolphinView::slotTrashFileFinished(KJob *job)
{
if (job->error() == 0) {
Q_EMIT operationCompletedMessage(i18nc("@info:status", "Trash operation completed."));
@@ -1773,7 +1747,7 @@ void DolphinView::slotTrashFileFinished(KJob* job)
}
}
-void DolphinView::slotDeleteFileFinished(KJob* job)
+void DolphinView::slotDeleteFileFinished(KJob *job)
{
if (job->error() == 0) {
Q_EMIT operationCompletedMessage(i18nc("@info:status", "Delete operation completed."));
@@ -1782,7 +1756,7 @@ void DolphinView::slotDeleteFileFinished(KJob* job)
}
}
-void DolphinView::slotRenamingResult(KJob* job)
+void DolphinView::slotRenamingResult(KJob *job)
{
if (job->error()) {
KIO::CopyJob *copyJob = qobject_cast<KIO::CopyJob *>(job);
@@ -1855,7 +1829,7 @@ void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOr
Q_EMIT sortOrderChanged(current);
}
-void DolphinView::slotSortRoleChangedByHeader(const QByteArray& current, const QByteArray& previous)
+void DolphinView::slotSortRoleChangedByHeader(const QByteArray &current, const QByteArray &previous)
{
Q_UNUSED(previous)
Q_ASSERT(m_model->sortRole() == current);
@@ -1866,8 +1840,7 @@ void DolphinView::slotSortRoleChangedByHeader(const QByteArray& current, const Q
Q_EMIT sortRoleChanged(current);
}
-void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& current,
- const QList<QByteArray>& previous)
+void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray> &current, const QList<QByteArray> &previous)
{
Q_UNUSED(previous)
Q_ASSERT(m_container->controller()->view()->visibleRoles() == current);
@@ -1884,14 +1857,12 @@ void DolphinView::slotVisibleRolesChangedByHeader(const QList<QByteArray>& curre
void DolphinView::slotRoleEditingCanceled()
{
- disconnect(m_view, &DolphinItemListView::roleEditingFinished,
- this, &DolphinView::slotRoleEditingFinished);
+ disconnect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
}
-void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value)
+void DolphinView::slotRoleEditingFinished(int index, const QByteArray &role, const QVariant &value)
{
- disconnect(m_view, &DolphinItemListView::roleEditingFinished,
- this, &DolphinView::slotRoleEditingFinished);
+ disconnect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
const KFileItemList items = selectedItems();
if (items.count() != 1) {
@@ -1914,26 +1885,27 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
KGuiItem yesGuiItem(i18nc("@action:button", "Rename and Hide"), QStringLiteral("view-hidden"));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
- const auto code = KMessageBox::questionTwoActions(this,
+ const auto code =
+ KMessageBox::questionTwoActions(this,
#else
- const auto code = KMessageBox::questionYesNo(this,
+ const auto code =
+ KMessageBox::questionYesNo(this,
#endif
- oldItem.isFile() ? i18n("Adding a dot to the beginning of this file's name will hide it from view.\n"
- "Do you still want to rename it?")
- : i18n("Adding a dot to the beginning of this folder's name will hide it from view.\n"
- "Do you still want to rename it?"),
- oldItem.isFile() ? i18n("Hide this File?") : i18n("Hide this Folder?"),
- yesGuiItem,
- KStandardGuiItem::cancel(),
- QStringLiteral("ConfirmHide")
- );
+ oldItem.isFile() ? i18n("Adding a dot to the beginning of this file's name will hide it from view.\n"
+ "Do you still want to rename it?")
+ : i18n("Adding a dot to the beginning of this folder's name will hide it from view.\n"
+ "Do you still want to rename it?"),
+ oldItem.isFile() ? i18n("Hide this File?") : i18n("Hide this Folder?"),
+ yesGuiItem,
+ KStandardGuiItem::cancel(),
+ QStringLiteral("ConfirmHide"));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (code == KMessageBox::SecondaryAction) {
#else
if (code == KMessageBox::No) {
#endif
- return;
+ return;
}
}
#endif
@@ -1950,7 +1922,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
m_model->setData(index, data);
}
- KIO::Job * job = KIO::moveAs(oldUrl, newUrl);
+ KIO::Job *job = KIO::moveAs(oldUrl, newUrl);
KJobWidgets::setWindow(job, this);
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job);
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
@@ -1966,14 +1938,13 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
if (retVal.direction != EditDone) {
const short indexShift = retVal.direction == EditNext ? 1 : -1;
m_container->controller()->selectionManager()->setSelected(index, 1, KItemListSelectionManager::Deselect);
- m_container->controller()->selectionManager()->setSelected(index + indexShift, 1,
- KItemListSelectionManager::Select);
+ m_container->controller()->selectionManager()->setSelected(index + indexShift, 1, KItemListSelectionManager::Select);
renameSelectedItems();
}
}
}
-void DolphinView::loadDirectory(const QUrl& url, bool reload)
+void DolphinView::loadDirectory(const QUrl &url, bool reload)
{
if (!url.isValid()) {
const QString location(url.toDisplayString(QUrl::PreferLocalFile));
@@ -1998,7 +1969,7 @@ void DolphinView::applyViewProperties()
applyViewProperties(props);
}
-void DolphinView::applyViewProperties(const ViewProperties& props)
+void DolphinView::applyViewProperties(const ViewProperties &props)
{
m_view->beginTransaction();
@@ -2077,9 +2048,9 @@ void DolphinView::applyViewProperties(const ViewProperties& props)
}
}
- KItemListView* itemListView = m_container->controller()->view();
+ KItemListView *itemListView = m_container->controller()->view();
if (itemListView->isHeaderVisible()) {
- KItemListHeader* header = itemListView->header();
+ KItemListHeader *header = itemListView->header();
const QList<int> headerColumnWidths = props.headerColumnWidths();
const int rolesCount = m_visibleRoles.count();
if (headerColumnWidths.count() == rolesCount) {
@@ -2102,14 +2073,22 @@ void DolphinView::applyViewProperties(const ViewProperties& props)
void DolphinView::applyModeToView()
{
switch (m_mode) {
- case IconsView: m_view->setItemLayout(KFileItemListView::IconsLayout); break;
- case CompactView: m_view->setItemLayout(KFileItemListView::CompactLayout); break;
- case DetailsView: m_view->setItemLayout(KFileItemListView::DetailsLayout); break;
- default: Q_ASSERT(false); break;
+ case IconsView:
+ m_view->setItemLayout(KFileItemListView::IconsLayout);
+ break;
+ case CompactView:
+ m_view->setItemLayout(KFileItemListView::CompactLayout);
+ break;
+ case DetailsView:
+ m_view->setItemLayout(KFileItemListView::DetailsLayout);
+ break;
+ default:
+ Q_ASSERT(false);
+ break;
}
}
-void DolphinView::pasteToUrl(const QUrl& url)
+void DolphinView::pasteToUrl(const QUrl &url)
{
KIO::PasteJob *job = KIO::paste(QApplication::clipboard()->mimeData(), url);
KJobWidgets::setWindow(job, this);
@@ -2125,7 +2104,7 @@ QList<QUrl> DolphinView::simplifiedSelectedUrls() const
const KFileItemList items = selectedItems();
urls.reserve(items.count());
- for (const KFileItem& item : items) {
+ for (const KFileItem &item : items) {
urls.append(item.url());
}
@@ -2137,9 +2116,9 @@ QList<QUrl> DolphinView::simplifiedSelectedUrls() const
return urls;
}
-QMimeData* DolphinView::selectionMimeData() const
+QMimeData *DolphinView::selectionMimeData() const
{
- const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
+ const KItemListSelectionManager *selectionManager = m_container->controller()->selectionManager();
const KItemSet selectedIndexes = selectionManager->selectedItems();
return m_model->createMimeData(selectedIndexes);
@@ -2178,12 +2157,12 @@ QUrl DolphinView::viewPropertiesUrl() const
return url;
}
-void DolphinView::slotRenameDialogRenamingFinished(const QList<QUrl>& urls)
+void DolphinView::slotRenameDialogRenamingFinished(const QList<QUrl> &urls)
{
forceUrlsSelection(urls.first(), urls);
}
-void DolphinView::forceUrlsSelection(const QUrl& current, const QList<QUrl>& selected)
+void DolphinView::forceUrlsSelection(const QUrl &current, const QList<QUrl> &selected)
{
clearSelection();
m_clearSelectionBeforeSelectingNewItems = true;
@@ -2197,12 +2176,12 @@ void DolphinView::copyPathToClipboard()
if (list.isEmpty()) {
return;
}
- const KFileItem& item = list.at(0);
+ const KFileItem &item = list.at(0);
QString path = item.localPath();
if (path.isEmpty()) {
path = item.url().toDisplayString();
}
- QClipboard* clipboard = QApplication::clipboard();
+ QClipboard *clipboard = QApplication::clipboard();
if (clipboard == nullptr) {
return;
}
@@ -2279,7 +2258,7 @@ void DolphinView::updatePlaceholderLabel()
m_placeholderLabel->setVisible(true);
}
-void DolphinView::tryShowNameToolTip(QHelpEvent* event)
+void DolphinView::tryShowNameToolTip(QHelpEvent *event)
{
if (!GeneralSettings::showToolTips() && m_mode == DolphinView::IconsView) {
const std::optional<int> index = m_view->itemAt(event->pos());
@@ -2291,7 +2270,7 @@ void DolphinView::tryShowNameToolTip(QHelpEvent* event)
// Check whether the filename has been elided
const bool isElided = m_view->isElided(index.value());
- if(isElided) {
+ if (isElided) {
const KFileItem item = m_model->fileItem(index.value());
const QString text = item.text();
const QPoint pos = mapToGlobal(event->pos());
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index 50b1b9270..8cf23c298 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -8,13 +8,13 @@
#ifndef DOLPHINVIEW_H
#define DOLPHINVIEW_H
-#include "dolphintabwidget.h"
#include "dolphin_export.h"
+#include "dolphintabwidget.h"
#include "tooltips/tooltipmanager.h"
+#include "config-dolphin.h"
#include <KFileItem>
#include <KIO/Job>
-#include "config-dolphin.h"
#include <kio/fileundomanager.h>
#include <kparts/part.h>
@@ -62,8 +62,7 @@ public:
* view mode is automatically updated if the directory itself
* defines a view mode (see class ViewProperties for details).
*/
- enum Mode
- {
+ enum Mode {
/**
* The items are shown as icons with a name-label below.
*/
@@ -86,7 +85,7 @@ public:
* @param url Specifies the content which should be shown.
* @param parent Parent widget of the view.
*/
- DolphinView(const QUrl& url, QWidget* parent);
+ DolphinView(const QUrl &url, QWidget *parent);
~DolphinView() override;
@@ -179,7 +178,7 @@ public:
* Marks the item indicated by \p url to be scrolled to and as the
* current item after directory DolphinView::url() has been loaded.
*/
- void markUrlAsCurrent(const QUrl& url);
+ void markUrlAsCurrent(const QUrl &url);
/**
* All items that match the regular expression \a regexp will get selected
@@ -206,7 +205,7 @@ public:
*/
void resetZoomLevel();
- void setSortRole(const QByteArray& role);
+ void setSortRole(const QByteArray &role);
QByteArray sortRole() const;
void setSortOrder(Qt::SortOrder order);
@@ -221,7 +220,7 @@ public:
bool sortHiddenLast() const;
/** Sets the additional information which should be shown for the items. */
- void setVisibleRoles(const QList<QByteArray>& roles);
+ void setVisibleRoles(const QList<QByteArray> &roles);
/** Returns the additional information which should be shown for the items. */
QList<QByteArray> visibleRoles() const;
@@ -243,7 +242,7 @@ public:
* Filters the currently shown items by \a nameFilter. All items
* which contain the given filter string will be shown.
*/
- void setNameFilter(const QString& nameFilter);
+ void setNameFilter(const QString &nameFilter);
QString nameFilter() const;
/**
@@ -251,7 +250,7 @@ public:
* whose content-type matches those given by the list of filters
* will be shown.
*/
- void setMimeTypeFilters(const QStringList& filters);
+ void setMimeTypeFilters(const QStringList &filters);
QStringList mimeTypeFilters() const;
/**
@@ -267,7 +266,7 @@ public:
* Returns the version control actions that are provided for the items \p items.
* Usually the actions are presented in the context menu.
*/
- QList<QAction*> versionControlActions(const KFileItemList& items) const;
+ QList<QAction *> versionControlActions(const KFileItemList &items) const;
/**
* Returns the state of the paste action:
@@ -301,12 +300,12 @@ public:
/**
* Restores the view state (current item, contents position, details view expansion state)
*/
- void restoreState(QDataStream& stream);
+ void restoreState(QDataStream &stream);
/**
* Saves the view state (current item, contents position, details view expansion state)
*/
- void saveState(QDataStream& stream);
+ void saveState(QDataStream &stream);
/**
* Returns the root item which represents the current URL.
@@ -320,7 +319,7 @@ public:
* makes sense if specific types of URLs (e.g. search-URLs) should
* share common view-properties.
*/
- void setViewPropertiesContext(const QString& context);
+ void setViewPropertiesContext(const QString &context);
QString viewPropertiesContext() const;
/**
@@ -329,7 +328,7 @@ public:
* @return a valid and adjusted url if the item can be opened as folder,
* otherwise return an empty url.
*/
- static QUrl openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives = true);
+ static QUrl openItemAsFolderUrl(const KFileItem &item, const bool browseThroughArchives = true);
/**
* Hides tooltip displayed over element.
@@ -341,7 +340,7 @@ public Q_SLOTS:
* Changes the directory to \a url. If the current directory is equal to
* \a url, nothing will be done (use DolphinView::reload() instead).
*/
- void setUrl(const QUrl& url);
+ void setUrl(const QUrl &url);
/**
* Selects all items.
@@ -428,7 +427,7 @@ public Q_SLOTS:
void updateViewState();
/** Activates the view if the item list container gets focus. */
- bool eventFilter(QObject* watched, QEvent* event) override;
+ bool eventFilter(QObject *watched, QEvent *event) override;
Q_SIGNALS:
/**
@@ -437,7 +436,7 @@ Q_SIGNALS:
void activated();
/** Is emitted if the URL of the view has been changed to \a url. */
- void urlChanged(const QUrl& url);
+ void urlChanged(const QUrl &url);
/**
* Is emitted when clicking on an item with the left mouse button.
@@ -458,7 +457,7 @@ Q_SIGNALS:
/**
* Is emitted if a new tab should be opened for the URL \a url.
*/
- void tabRequested(const QUrl& url);
+ void tabRequested(const QUrl &url);
/**
* Is emitted if a new tab should be opened for the URL \a url and set as active.
@@ -490,7 +489,7 @@ Q_SIGNALS:
void statusBarTextChanged(QString statusBarText);
/** Is emitted if the sorting by name, size or date has been changed. */
- void sortRoleChanged(const QByteArray& role);
+ void sortRoleChanged(const QByteArray &role);
/** Is emitted if the sort order (ascending or descending) has been changed. */
void sortOrderChanged(Qt::SortOrder order);
@@ -507,8 +506,7 @@ Q_SIGNALS:
void sortHiddenLastChanged(bool hiddenLast);
/** Is emitted if the additional information shown for this view has been changed. */
- void visibleRolesChanged(const QList<QByteArray>& current,
- const QList<QByteArray>& previous);
+ void visibleRolesChanged(const QList<QByteArray> &current, const QList<QByteArray> &previous);
/** Is emitted if the zoom level has been changed by zooming in or out. */
void zoomLevelChanged(int current, int previous);
@@ -517,40 +515,37 @@ Q_SIGNALS:
* Is emitted if information of an item is requested to be shown e. g. in the panel.
* If item is null, no item information request is pending.
*/
- void requestItemInfo(const KFileItem& item);
+ void requestItemInfo(const KFileItem &item);
/**
* Is emitted whenever the selection has been changed.
*/
- void selectionChanged(const KFileItemList& selection);
+ void selectionChanged(const KFileItemList &selection);
/**
* Is emitted if a context menu is requested for the item \a item,
* which is part of \a url. If the item is null, the context menu
* for the URL should be shown.
*/
- void requestContextMenu(const QPoint& pos,
- const KFileItem& item,
- const KFileItemList &selectedItems,
- const QUrl& url);
+ void requestContextMenu(const QPoint &pos, const KFileItem &item, const KFileItemList &selectedItems, const QUrl &url);
/**
* Is emitted if an information message with the content \a msg
* should be shown.
*/
- void infoMessage(const QString& msg);
+ void infoMessage(const QString &msg);
/**
* Is emitted if an error message with the content \a msg
* should be shown.
*/
- void errorMessage(const QString& msg);
+ void errorMessage(const QString &msg);
/**
* Is emitted if an "operation completed" message with the content \a msg
* should be shown.
*/
- void operationCompletedMessage(const QString& msg);
+ void operationCompletedMessage(const QString &msg);
/**
* Is emitted after DolphinView::setUrl() has been invoked and
@@ -588,13 +583,13 @@ Q_SIGNALS:
* Emitted when the file-item-model emits redirection.
* Testcase: fish://localhost
*/
- void redirection(const QUrl& oldUrl, const QUrl& newUrl);
+ void redirection(const QUrl &oldUrl, const QUrl &newUrl);
/**
* Is emitted when the URL set by DolphinView::setUrl() represents a file.
* In this case no signal errorMessage() will be emitted.
*/
- void urlIsFileError(const QUrl& url);
+ void urlIsFileError(const QUrl &url);
/**
* Is emitted when the write state of the folder has been changed. The application
@@ -631,7 +626,7 @@ Q_SIGNALS:
* Is emitted when the user clicks a tag or a link
* in the metadata widget of a tooltip.
*/
- void urlActivated(const QUrl& url);
+ void urlActivated(const QUrl &url);
void goUpRequested();
@@ -644,10 +639,10 @@ Q_SIGNALS:
protected:
/** Changes the zoom level if Control is pressed during a wheel event. */
- void wheelEvent(QWheelEvent* event) override;
+ void wheelEvent(QWheelEvent *event) override;
- void hideEvent(QHideEvent* event) override;
- bool event(QEvent* event) override;
+ void hideEvent(QHideEvent *event) override;
+ bool event(QEvent *event) override;
private Q_SLOTS:
/**
@@ -659,17 +654,17 @@ private Q_SLOTS:
void slotItemActivated(int index);
void slotItemsActivated(const KItemSet &indexes);
void slotItemMiddleClicked(int index);
- void slotItemContextMenuRequested(int index, const QPointF& pos);
- void slotViewContextMenuRequested(const QPointF& pos);
- void slotHeaderContextMenuRequested(const QPointF& pos);
- void slotHeaderColumnWidthChangeFinished(const QByteArray& role, qreal current);
+ void slotItemContextMenuRequested(int index, const QPointF &pos);
+ void slotViewContextMenuRequested(const QPointF &pos);
+ void slotHeaderContextMenuRequested(const QPointF &pos);
+ void slotHeaderColumnWidthChangeFinished(const QByteArray &role, qreal current);
void slotSidePaddingWidthChanged(qreal width);
void slotItemHovered(int index);
void slotItemUnhovered(int index);
- void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
- void slotModelChanged(KItemModelBase* current, KItemModelBase* previous);
+ void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent *event);
+ void slotModelChanged(KItemModelBase *current, KItemModelBase *previous);
void slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons);
- void slotRenameDialogRenamingFinished(const QList<QUrl>& urls);
+ void slotRenameDialogRenamingFinished(const QList<QUrl> &urls);
void slotSelectedItemTextPressed(int index);
void slotCopyingDone(KIO::Job *, const QUrl &, const QUrl &to);
void slotIncreaseZoom();
@@ -692,7 +687,7 @@ private Q_SLOTS:
* the signal is emitted only after no selection change has been done
* within a small delay.
*/
- void slotSelectionChanged(const KItemSet& current, const KItemSet& previous);
+ void slotSelectionChanged(const KItemSet &current, const KItemSet &previous);
/**
* Is called by emitDelayedSelectionChangedSignal() and emits the
@@ -713,7 +708,7 @@ private Q_SLOTS:
* Updates the view properties of the current URL to the
* sorting given by \a role.
*/
- void updateSortRole(const QByteArray& role);
+ void updateSortRole(const QByteArray &role);
/**
* Updates the view properties of the current URL to the
@@ -737,18 +732,18 @@ private Q_SLOTS:
* Indicates in the status bar that the delete operation
* of the job \a job has been finished.
*/
- void slotDeleteFileFinished(KJob* job);
+ void slotDeleteFileFinished(KJob *job);
/**
* Indicates in the status bar that the trash operation
* of the job \a job has been finished.
*/
- void slotTrashFileFinished(KJob* job);
+ void slotTrashFileFinished(KJob *job);
/**
* Invoked when the rename job is done, for error handling.
*/
- void slotRenamingResult(KJob* job);
+ void slotRenamingResult(KJob *job);
/**
* Invoked when the file item model has started the loading
@@ -783,17 +778,16 @@ private Q_SLOTS:
* Is invoked when the sort role has been changed by the user by clicking
* on a header item. The view properties of the directory will get updated.
*/
- void slotSortRoleChangedByHeader(const QByteArray& current, const QByteArray& previous);
+ void slotSortRoleChangedByHeader(const QByteArray &current, const QByteArray &previous);
/**
* Is invoked when the visible roles have been changed by the user by dragging
* a header item. The view properties of the directory will get updated.
*/
- void slotVisibleRolesChangedByHeader(const QList<QByteArray>& current,
- const QList<QByteArray>& previous);
+ void slotVisibleRolesChangedByHeader(const QList<QByteArray> &current, const QList<QByteArray> &previous);
void slotRoleEditingCanceled();
- void slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value);
+ void slotRoleEditingFinished(int index, const QByteArray &role, const QVariant &value);
/**
* Observes the item with the URL \a url. As soon as the directory
@@ -806,12 +800,12 @@ private Q_SLOTS:
* Called when a redirection happens.
* Testcase: fish://localhost
*/
- void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
+ void slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl);
void slotTwoClicksRenamingTimerTimeout();
private:
- void loadDirectory(const QUrl& url, bool reload = false);
+ void loadDirectory(const QUrl &url, bool reload = false);
/**
* Applies the view properties which are defined by the current URL
@@ -824,7 +818,7 @@ private:
/**
* Applies the given view properties to the DolphinView.
*/
- void applyViewProperties(const ViewProperties& props);
+ void applyViewProperties(const ViewProperties &props);
/**
* Applies the m_mode property to the corresponding
@@ -832,10 +826,7 @@ private:
*/
void applyModeToView();
- enum Selection {
- HasSelection,
- NoSelection
- };
+ enum Selection { HasSelection, NoSelection };
/**
* Helper method for DolphinView::requestStatusBarText().
* Generates the status bar text from the parameters and
@@ -844,14 +835,13 @@ private:
* @param selection if HasSelection is passed, the emitted status bar text will say
* that the folders and files which are counted here are selected.
*/
- void emitStatusBarText(const int folderCount, const int fileCount,
- KIO::filesize_t totalFileSize, const Selection selection);
+ void emitStatusBarText(const int folderCount, const int fileCount, KIO::filesize_t totalFileSize, const Selection selection);
/**
* Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
* Pastes the clipboard data into the URL \a url.
*/
- void pasteToUrl(const QUrl& url);
+ void pasteToUrl(const QUrl &url);
/**
* Returns a list of URLs for all selected items. The list is
@@ -863,7 +853,7 @@ private:
/**
* Returns the MIME data for all selected items.
*/
- QMimeData* selectionMimeData() const;
+ QMimeData *selectionMimeData() const;
/**
* Updates m_isFolderWritable dependent on whether the folder represented by
@@ -885,13 +875,13 @@ private:
* @param current URL to be set as current
* @param selected list of selected items
*/
- void forceUrlsSelection(const QUrl& current, const QList<QUrl>& selected);
+ void forceUrlsSelection(const QUrl &current, const QList<QUrl> &selected);
void abortTwoClicksRenaming();
void updatePlaceholderLabel();
- void tryShowNameToolTip(QHelpEvent* event);
+ void tryShowNameToolTip(QHelpEvent *event);
private:
void updatePalette();
@@ -904,12 +894,7 @@ private:
bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
// tooltip may be shown when hovering an item.
- enum class LoadingState {
- Idle,
- Loading,
- Canceled,
- Completed
- };
+ enum class LoadingState { Idle, Loading, Canceled, Completed };
LoadingState m_loadingState = LoadingState::Idle;
QUrl m_url;
@@ -919,15 +904,15 @@ private:
QPointer<KIO::StatJob> m_statJobForStatusBarText;
- QVBoxLayout* m_topLayout;
+ QVBoxLayout *m_topLayout;
- KFileItemModel* m_model;
- DolphinItemListView* m_view;
- KItemListContainer* m_container;
+ KFileItemModel *m_model;
+ DolphinItemListView *m_view;
+ KItemListContainer *m_container;
- ToolTipManager* m_toolTipManager;
+ ToolTipManager *m_toolTipManager;
- QTimer* m_selectionChangedTimer;
+ QTimer *m_selectionChangedTimer;
QUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5
bool m_scrollToCurrentItem; // Used for marking we need to scroll to current item or not
@@ -937,12 +922,12 @@ private:
bool m_clearSelectionBeforeSelectingNewItems;
bool m_markFirstNewlySelectedItemAsCurrent;
- VersionControlObserver* m_versionControlObserver;
+ VersionControlObserver *m_versionControlObserver;
- QTimer* m_twoClicksRenamingTimer;
+ QTimer *m_twoClicksRenamingTimer;
QUrl m_twoClicksRenamingItemUrl;
- QLabel* m_placeholderLabel;
- QTimer* m_showLoadingPlaceholderTimer;
+ QLabel *m_placeholderLabel;
+ QTimer *m_showLoadingPlaceholderTimer;
/// Used for selection mode. @see setSelectionMode()
std::unique_ptr<QProxyStyle> m_proxyStyle;
@@ -951,7 +936,7 @@ private:
friend class TestBase;
friend class DolphinDetailsViewTest;
friend class DolphinMainWindowTest;
- friend class DolphinPart; // Accesses m_model
+ friend class DolphinPart; // Accesses m_model
};
/// Allow using DolphinView::Mode in QVariant
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index fc88f5c17..cbe8b89e5 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -28,18 +28,18 @@
#include <QMenu>
#include <QPointer>
-DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection* collection, SelectionMode::ActionTextHelper* actionTextHelper, QObject* parent) :
- QObject(parent),
- m_actionCollection(collection),
- m_currentView(nullptr),
- m_sortByActions(),
- m_visibleRoles()
+DolphinViewActionHandler::DolphinViewActionHandler(KActionCollection *collection, SelectionMode::ActionTextHelper *actionTextHelper, QObject *parent)
+ : QObject(parent)
+ , m_actionCollection(collection)
+ , m_currentView(nullptr)
+ , m_sortByActions()
+ , m_visibleRoles()
{
Q_ASSERT(m_actionCollection);
createActions(actionTextHelper);
}
-void DolphinViewActionHandler::setCurrentView(DolphinView* view)
+void DolphinViewActionHandler::setCurrentView(DolphinView *view)
{
Q_ASSERT(view);
@@ -49,36 +49,25 @@ void DolphinViewActionHandler::setCurrentView(DolphinView* view)
m_currentView = view;
- connect(view, &DolphinView::modeChanged,
- this, &DolphinViewActionHandler::updateViewActions);
- connect(view, &DolphinView::previewsShownChanged,
- this, &DolphinViewActionHandler::slotPreviewsShownChanged);
- connect(view, &DolphinView::sortOrderChanged,
- this, &DolphinViewActionHandler::slotSortOrderChanged);
- connect(view, &DolphinView::sortFoldersFirstChanged,
- this, &DolphinViewActionHandler::slotSortFoldersFirstChanged);
- connect(view, &DolphinView::sortHiddenLastChanged,
- this, &DolphinViewActionHandler::slotSortHiddenLastChanged);
- connect(view, &DolphinView::visibleRolesChanged,
- this, &DolphinViewActionHandler::slotVisibleRolesChanged);
- connect(view, &DolphinView::groupedSortingChanged,
- this, &DolphinViewActionHandler::slotGroupedSortingChanged);
- connect(view, &DolphinView::hiddenFilesShownChanged,
- this, &DolphinViewActionHandler::slotHiddenFilesShownChanged);
- connect(view, &DolphinView::sortRoleChanged,
- this, &DolphinViewActionHandler::slotSortRoleChanged);
- connect(view, &DolphinView::zoomLevelChanged,
- this, &DolphinViewActionHandler::slotZoomLevelChanged);
- connect(view, &DolphinView::writeStateChanged,
- this, &DolphinViewActionHandler::slotWriteStateChanged);
- connect(view, &DolphinView::selectionModeChangeRequested,
- this, [this](bool enabled) { Q_EMIT selectionModeChangeTriggered(enabled); });
- connect(view, &DolphinView::selectionChanged,
- this, &DolphinViewActionHandler::slotSelectionChanged);
+ connect(view, &DolphinView::modeChanged, this, &DolphinViewActionHandler::updateViewActions);
+ connect(view, &DolphinView::previewsShownChanged, this, &DolphinViewActionHandler::slotPreviewsShownChanged);
+ connect(view, &DolphinView::sortOrderChanged, this, &DolphinViewActionHandler::slotSortOrderChanged);
+ connect(view, &DolphinView::sortFoldersFirstChanged, this, &DolphinViewActionHandler::slotSortFoldersFirstChanged);
+ connect(view, &DolphinView::sortHiddenLastChanged, this, &DolphinViewActionHandler::slotSortHiddenLastChanged);
+ connect(view, &DolphinView::visibleRolesChanged, this, &DolphinViewActionHandler::slotVisibleRolesChanged);
+ connect(view, &DolphinView::groupedSortingChanged, this, &DolphinViewActionHandler::slotGroupedSortingChanged);
+ connect(view, &DolphinView::hiddenFilesShownChanged, this, &DolphinViewActionHandler::slotHiddenFilesShownChanged);
+ connect(view, &DolphinView::sortRoleChanged, this, &DolphinViewActionHandler::slotSortRoleChanged);
+ connect(view, &DolphinView::zoomLevelChanged, this, &DolphinViewActionHandler::slotZoomLevelChanged);
+ connect(view, &DolphinView::writeStateChanged, this, &DolphinViewActionHandler::slotWriteStateChanged);
+ connect(view, &DolphinView::selectionModeChangeRequested, this, [this](bool enabled) {
+ Q_EMIT selectionModeChangeTriggered(enabled);
+ });
+ connect(view, &DolphinView::selectionChanged, this, &DolphinViewActionHandler::slotSelectionChanged);
slotSelectionChanged(m_currentView->selectedItems());
}
-DolphinView* DolphinViewActionHandler::currentView()
+DolphinView *DolphinViewActionHandler::currentView()
{
return m_currentView;
}
@@ -87,19 +76,20 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
{
// This action doesn't appear in the GUI, it's for the shortcut only.
// KNewFileMenu takes care of the GUI stuff.
- QAction* newDirAction = m_actionCollection->addAction(QStringLiteral("create_dir"));
+ QAction *newDirAction = m_actionCollection->addAction(QStringLiteral("create_dir"));
newDirAction->setText(i18nc("@action", "Create Folder..."));
m_actionCollection->setDefaultShortcuts(newDirAction, KStandardShortcut::createFolder());
newDirAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new")));
- newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable
+ newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable
connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectoryTriggered);
// File menu
auto renameAction = KStandardAction::renameFile(this, &DolphinViewActionHandler::slotRename, m_actionCollection);
- renameAction->setWhatsThis(xi18nc("@info:whatsthis", "This renames the "
- "items in your current selection.<nl/>Renaming multiple items "
- "at once amounts to their new names differing only in a number."));
+ renameAction->setWhatsThis(xi18nc("@info:whatsthis",
+ "This renames the "
+ "items in your current selection.<nl/>Renaming multiple items "
+ "at once amounts to their new names differing only in a number."));
auto trashAction = KStandardAction::moveToTrash(this, &DolphinViewActionHandler::slotTrashActivated, m_actionCollection);
auto trashShortcuts = trashAction->shortcuts();
@@ -107,10 +97,11 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
trashShortcuts.append(QKeySequence::Delete);
m_actionCollection->setDefaultShortcuts(trashAction, trashShortcuts);
}
- trashAction->setWhatsThis(xi18nc("@info:whatsthis", "This moves the "
- "items in your current selection to the <filename>Trash"
- "</filename>.<nl/>The trash is a temporary storage where "
- "items can be deleted from if disk space is needed."));
+ trashAction->setWhatsThis(xi18nc("@info:whatsthis",
+ "This moves the "
+ "items in your current selection to the <filename>Trash"
+ "</filename>.<nl/>The trash is a temporary storage where "
+ "items can be deleted from if disk space is needed."));
auto deleteAction = KStandardAction::deleteFile(this, &DolphinViewActionHandler::slotDeleteItems, m_actionCollection);
auto deleteShortcuts = deleteAction->shortcuts();
@@ -118,46 +109,45 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
deleteShortcuts.append(Qt::SHIFT | Qt::Key_Delete);
m_actionCollection->setDefaultShortcuts(deleteAction, deleteShortcuts);
}
- deleteAction->setWhatsThis(xi18nc("@info:whatsthis", "This deletes "
- "the items in your current selection completely. They can "
- "not be recovered by normal means."));
+ deleteAction->setWhatsThis(xi18nc("@info:whatsthis",
+ "This deletes "
+ "the items in your current selection completely. They can "
+ "not be recovered by normal means."));
// This action is useful for being enabled when KStandardAction::MoveToTrash should be
// disabled and KStandardAction::DeleteFile is enabled (e.g. non-local files), so that Key_Del
// can be used for deleting the file (#76016). It needs to be a separate action
// so that the Edit menu isn't affected.
- QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut"));
+ QAction *deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut"));
// The descriptive text is just for the shortcuts editor.
deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)"));
m_actionCollection->setDefaultShortcuts(deleteWithTrashShortcut, KStandardShortcut::moveToTrash());
deleteWithTrashShortcut->setEnabled(false);
connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
- QAction* duplicateAction = m_actionCollection->addAction(QStringLiteral("duplicate"));
+ QAction *duplicateAction = m_actionCollection->addAction(QStringLiteral("duplicate"));
duplicateAction->setText(i18nc("@action:inmenu File", "Duplicate Here"));
duplicateAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-duplicate")));
m_actionCollection->setDefaultShortcut(duplicateAction, Qt::CTRL | Qt::Key_D);
duplicateAction->setEnabled(false);
connect(duplicateAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDuplicate);
- QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") );
+ QAction *propertiesAction = m_actionCollection->addAction(QStringLiteral("properties"));
// Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
- propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
+ propertiesAction->setText(i18nc("@action:inmenu File", "Properties"));
propertiesAction->setWhatsThis(xi18nc("@info:whatsthis properties",
- "This shows a complete list of properties of the currently "
- "selected items in a new window.<nl/>If nothing is selected the "
- "window will be about the currently viewed folder instead.<nl/>"
- "You can configure advanced options there like managing "
- "read- and write-permissions."));
+ "This shows a complete list of properties of the currently "
+ "selected items in a new window.<nl/>If nothing is selected the "
+ "window will be about the currently viewed folder instead.<nl/>"
+ "You can configure advanced options there like managing "
+ "read- and write-permissions."));
propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT | Qt::Key_Return, Qt::ALT | Qt::Key_Enter});
connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties);
- QAction *copyPathAction = m_actionCollection->addAction( QStringLiteral("copy_location") );
+ QAction *copyPathAction = m_actionCollection->addAction(QStringLiteral("copy_location"));
copyPathAction->setText(i18nc("@action:incontextmenu", "Copy Location"));
- copyPathAction->setWhatsThis(i18nc("@info:whatsthis copy_location",
- "This will copy the path of the first selected item into the clipboard."
- ));
+ copyPathAction->setWhatsThis(i18nc("@info:whatsthis copy_location", "This will copy the path of the first selected item into the clipboard."));
copyPathAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy-path")));
m_actionCollection->setDefaultShortcuts(copyPathAction, {Qt::CTRL | Qt::ALT | Qt::Key_C});
@@ -192,32 +182,32 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
// actions in slotSelectionChanged() after the static ones above.
// View menu
- KToggleAction* iconsAction = iconsModeAction();
- KToggleAction* compactAction = compactModeAction();
- KToggleAction* detailsAction = detailsModeAction();
+ KToggleAction *iconsAction = iconsModeAction();
+ KToggleAction *compactAction = compactModeAction();
+ KToggleAction *detailsAction = detailsModeAction();
iconsAction->setWhatsThis(xi18nc("@info:whatsthis Icons view mode",
- "<para>This switches to a view mode that focuses on the folder "
- "and file icons. This mode makes it easy to distinguish folders "
- "from files and to detect items with distinctive <emphasis>"
- "file types</emphasis>.</para><para> This mode is handy to "
- "browse through pictures when the <interface>Preview"
- "</interface> option is enabled.</para>"));
+ "<para>This switches to a view mode that focuses on the folder "
+ "and file icons. This mode makes it easy to distinguish folders "
+ "from files and to detect items with distinctive <emphasis>"
+ "file types</emphasis>.</para><para> This mode is handy to "
+ "browse through pictures when the <interface>Preview"
+ "</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>"
- "This helps to keep the overview in folders with many items.</para>"));
+ "<para>This switches to a compact view mode that lists the folders "
+ "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 "
- "and file details.</para><para>Click on a detail in the column "
- "header to sort the items by it. Click again to sort the other "
- "way around. To select which details should be displayed click "
- "the header with the right mouse button.</para><para>You can "
- "view the contents of a folder without leaving the current "
- "location by clicking to the left of it. This way you can view "
- "the contents of multiple folders in the same list.</para>"));
+ "<para>This switches to a list view mode that focuses on folder "
+ "and file details.</para><para>Click on a detail in the column "
+ "header to sort the items by it. Click again to sort the other "
+ "way around. To select which details should be displayed click "
+ "the header with the right mouse button.</para><para>You can "
+ "view the contents of a folder without leaving the current "
+ "location by clicking to the left of it. This way you can view "
+ "the contents of multiple folders in the same list.</para>"));
- KSelectAction* viewModeActions = m_actionCollection->add<KSelectAction>(QStringLiteral("view_mode"));
+ KSelectAction *viewModeActions = m_actionCollection->add<KSelectAction>(QStringLiteral("view_mode"));
viewModeActions->setText(i18nc("@action:intoolbar", "View Mode"));
viewModeActions->addAction(iconsAction);
viewModeActions->addAction(compactAction);
@@ -225,12 +215,10 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
viewModeActions->setToolBarMode(KSelectAction::MenuMode);
connect(viewModeActions, &KSelectAction::triggered, this, &DolphinViewActionHandler::slotViewModeActionTriggered);
- QAction* zoomInAction = KStandardAction::zoomIn(this,
- &DolphinViewActionHandler::zoomIn,
- m_actionCollection);
+ QAction *zoomInAction = KStandardAction::zoomIn(this, &DolphinViewActionHandler::zoomIn, m_actionCollection);
zoomInAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This increases the icon size."));
- QAction* zoomResetAction = m_actionCollection->addAction(QStringLiteral("view_zoom_reset"));
+ 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."));
@@ -238,12 +226,10 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
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);
+ QAction *zoomOutAction = KStandardAction::zoomOut(this, &DolphinViewActionHandler::zoomOut, m_actionCollection);
zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom out", "This reduces the icon size."));
- KActionMenu* zoomMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("zoom"));
+ KActionMenu *zoomMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("zoom"));
zoomMenu->setText(i18nc("@action:inmenu menu of zoom actions", "Zoom"));
zoomMenu->setIcon(QIcon::fromTheme(QStringLiteral("zoom")));
zoomMenu->setPopupMode(QToolButton::InstantPopup);
@@ -251,49 +237,50 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
zoomMenu->addAction(zoomResetAction);
zoomMenu->addAction(zoomOutAction);
- KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview"));
+ KToggleAction *showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_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 "
- "contents.<nl/>For example the icons of images become scaled "
- "down versions of the images."));
+ showPreview->setWhatsThis(xi18nc("@info:whatsthis",
+ "When this is "
+ "enabled, the icons are based on the actual file or folder "
+ "contents.<nl/>For example the icons of images become scaled "
+ "down versions of the images."));
showPreview->setIcon(QIcon::fromTheme(QStringLiteral("view-preview")));
connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview);
- KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>(QStringLiteral("folders_first"));
+ KToggleAction *sortFoldersFirst = m_actionCollection->add<KToggleAction>(QStringLiteral("folders_first"));
sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First"));
connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst);
- KToggleAction* sortHiddenLast = m_actionCollection->add<KToggleAction>(QStringLiteral("hidden_last"));
+ KToggleAction *sortHiddenLast = m_actionCollection->add<KToggleAction>(QStringLiteral("hidden_last"));
sortHiddenLast->setText(i18nc("@action:inmenu Sort", "Hidden Files Last"));
connect(sortHiddenLast, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortHiddenLast);
// View -> Sort By
- QActionGroup* sortByActionGroup = createFileItemRolesActionGroup(QStringLiteral("sort_by_"));
+ QActionGroup *sortByActionGroup = createFileItemRolesActionGroup(QStringLiteral("sort_by_"));
- KActionMenu* sortByActionMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("sort"));
+ KActionMenu *sortByActionMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("sort"));
sortByActionMenu->setIcon(QIcon::fromTheme(QStringLiteral("view-sort")));
sortByActionMenu->setText(i18nc("@action:inmenu View", "Sort By"));
sortByActionMenu->setPopupMode(QToolButton::InstantPopup);
const auto sortByActionGroupActions = sortByActionGroup->actions();
- for (QAction* action : sortByActionGroupActions) {
+ for (QAction *action : sortByActionGroupActions) {
sortByActionMenu->addAction(action);
}
sortByActionMenu->addSeparator();
- QActionGroup* group = new QActionGroup(sortByActionMenu);
+ QActionGroup *group = new QActionGroup(sortByActionMenu);
group->setExclusive(true);
- KToggleAction* ascendingAction = m_actionCollection->add<KToggleAction>(QStringLiteral("ascending"));
+ KToggleAction *ascendingAction = m_actionCollection->add<KToggleAction>(QStringLiteral("ascending"));
ascendingAction->setActionGroup(group);
connect(ascendingAction, &QAction::triggered, this, [this] {
m_currentView->setSortOrder(Qt::AscendingOrder);
});
- KToggleAction* descendingAction = m_actionCollection->add<KToggleAction>(QStringLiteral("descending"));
+ KToggleAction *descendingAction = m_actionCollection->add<KToggleAction>(QStringLiteral("descending"));
descendingAction->setActionGroup(group);
connect(descendingAction, &QAction::triggered, this, [this] {
m_currentView->setSortOrder(Qt::DescendingOrder);
@@ -306,62 +293,62 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
sortByActionMenu->addAction(sortHiddenLast);
// View -> Additional Information
- QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_"));
+ QActionGroup *visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_"));
- KActionMenu* visibleRolesMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("additional_info"));
+ KActionMenu *visibleRolesMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("additional_info"));
visibleRolesMenu->setText(i18nc("@action:inmenu View", "Show Additional Information"));
visibleRolesMenu->setIcon(QIcon::fromTheme(QStringLiteral("documentinfo")));
visibleRolesMenu->setPopupMode(QToolButton::InstantPopup);
const auto visibleRolesGroupActions = visibleRolesGroup->actions();
- for (QAction* action : visibleRolesGroupActions) {
+ for (QAction *action : visibleRolesGroupActions) {
visibleRolesMenu->addAction(action);
}
- KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>(QStringLiteral("show_in_groups"));
+ KToggleAction *showInGroups = m_actionCollection->add<KToggleAction>(QStringLiteral("show_in_groups"));
showInGroups->setIcon(QIcon::fromTheme(QStringLiteral("view-group")));
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
showInGroups->setWhatsThis(i18nc("@info:whatsthis", "This groups files and folders by their first letter."));
connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
- KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files"));
+ KToggleAction *showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files"));
showHiddenFiles->setIcon(QIcon::fromTheme(QStringLiteral("view-visible")));
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
- showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis", "<para>When "
- "this is enabled <emphasis>hidden</emphasis> files and folders "
- "are visible. They will be displayed semi-transparent.</para>"
- "<para>Hidden items only differ from other ones in that their "
- "name starts with a \".\". In general there is no need for "
- "users to access them which is why they are hidden.</para>"));
+ showHiddenFiles->setWhatsThis(xi18nc("@info:whatsthis",
+ "<para>When "
+ "this is enabled <emphasis>hidden</emphasis> files and folders "
+ "are visible. They will be displayed semi-transparent.</para>"
+ "<para>Hidden items only differ from other ones in that their "
+ "name starts with a \".\". In general there is no need for "
+ "users to access them which is why they are hidden.</para>"));
m_actionCollection->setDefaultShortcuts(showHiddenFiles, KStandardShortcut::showHideHiddenFiles());
connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
- QAction* adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties"));
+ QAction *adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties"));
adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Display Style..."));
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."));
+ 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);
}
-QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix)
+QActionGroup *DolphinViewActionHandler::createFileItemRolesActionGroup(const QString &groupPrefix)
{
const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_"));
Q_ASSERT(isSortGroup || groupPrefix == QLatin1String("show_"));
- QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection);
+ QActionGroup *rolesActionGroup = new QActionGroup(m_actionCollection);
rolesActionGroup->setExclusive(isSortGroup);
if (isSortGroup) {
- connect(rolesActionGroup, &QActionGroup::triggered,
- this, &DolphinViewActionHandler::slotSortTriggered);
+ connect(rolesActionGroup, &QActionGroup::triggered, this, &DolphinViewActionHandler::slotSortTriggered);
} else {
- connect(rolesActionGroup, &QActionGroup::triggered,
- this, &DolphinViewActionHandler::toggleVisibleRole);
+ connect(rolesActionGroup, &QActionGroup::triggered, this, &DolphinViewActionHandler::toggleVisibleRole);
}
QString groupName;
- KActionMenu* groupMenu = nullptr;
- QActionGroup* groupMenuGroup = nullptr;
+ KActionMenu *groupMenu = nullptr;
+ QActionGroup *groupMenuGroup = nullptr;
bool indexingEnabled = false;
#if HAVE_BALOO
@@ -370,13 +357,13 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
#endif
const QList<KFileItemModel::RoleInfo> rolesInfo = KFileItemModel::rolesInformation();
- for (const KFileItemModel::RoleInfo& info : rolesInfo) {
+ for (const KFileItemModel::RoleInfo &info : rolesInfo) {
if (!isSortGroup && info.role == "text") {
// It should not be possible to hide the "text" role
continue;
}
- KToggleAction* action = nullptr;
+ KToggleAction *action = nullptr;
const QString name = groupPrefix + info.role;
if (info.group.isEmpty()) {
action = m_actionCollection->add<KToggleAction>(name);
@@ -391,11 +378,9 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
groupMenuGroup = new QActionGroup(groupMenu);
groupMenuGroup->setExclusive(isSortGroup);
if (isSortGroup) {
- connect(groupMenuGroup, &QActionGroup::triggered,
- this, &DolphinViewActionHandler::slotSortTriggered);
+ connect(groupMenuGroup, &QActionGroup::triggered, this, &DolphinViewActionHandler::slotSortTriggered);
} else {
- connect(groupMenuGroup, &QActionGroup::triggered,
- this, &DolphinViewActionHandler::toggleVisibleRole);
+ connect(groupMenuGroup, &QActionGroup::triggered, this, &DolphinViewActionHandler::toggleVisibleRole);
}
}
@@ -406,9 +391,7 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
action->setText(info.translation);
action->setData(info.role);
- const bool enable = (!info.requiresBaloo && !info.requiresIndexer) ||
- (info.requiresBaloo) ||
- (info.requiresIndexer && indexingEnabled);
+ const bool enable = (!info.requiresBaloo && !info.requiresIndexer) || (info.requiresBaloo) || (info.requiresIndexer && indexingEnabled);
action->setEnabled(enable);
if (isSortGroup) {
@@ -421,12 +404,12 @@ QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QSt
return rolesActionGroup;
}
-void DolphinViewActionHandler::slotViewModeActionTriggered(QAction* action)
+void DolphinViewActionHandler::slotViewModeActionTriggered(QAction *action)
{
const DolphinView::Mode mode = action->data().value<DolphinView::Mode>();
m_currentView->setViewMode(mode);
- QAction* viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
+ QAction *viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
viewModeMenu->setIcon(action->icon());
}
@@ -493,22 +476,22 @@ QString DolphinViewActionHandler::currentViewModeActionName() const
return QString(); // can't happen
}
-KActionCollection* DolphinViewActionHandler::actionCollection()
+KActionCollection *DolphinViewActionHandler::actionCollection()
{
return m_actionCollection;
}
void DolphinViewActionHandler::updateViewActions()
{
- QAction* viewModeAction = m_actionCollection->action(currentViewModeActionName());
+ QAction *viewModeAction = m_actionCollection->action(currentViewModeActionName());
if (viewModeAction) {
viewModeAction->setChecked(true);
- QAction* viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
+ QAction *viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
viewModeMenu->setIcon(viewModeAction->icon());
}
- QAction* showPreviewAction = m_actionCollection->action(QStringLiteral("show_preview"));
+ QAction *showPreviewAction = m_actionCollection->action(QStringLiteral("show_preview"));
showPreviewAction->setChecked(m_currentView->previewsShown());
slotSortOrderChanged(m_currentView->sortOrder());
@@ -557,8 +540,8 @@ void DolphinViewActionHandler::toggleSortHiddenLast()
void DolphinViewActionHandler::slotSortOrderChanged(Qt::SortOrder order)
{
- QAction* descending = m_actionCollection->action(QStringLiteral("descending"));
- QAction* ascending = m_actionCollection->action(QStringLiteral("ascending"));
+ QAction *descending = m_actionCollection->action(QStringLiteral("descending"));
+ QAction *ascending = m_actionCollection->action(QStringLiteral("ascending"));
const bool sortDescending = (order == Qt::DescendingOrder);
descending->setChecked(sortDescending);
ascending->setChecked(!sortDescending);
@@ -574,7 +557,7 @@ void DolphinViewActionHandler::slotSortHiddenLastChanged(bool hiddenLast)
m_actionCollection->action(QStringLiteral("hidden_last"))->setChecked(hiddenLast);
}
-void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
+void DolphinViewActionHandler::toggleVisibleRole(QAction *action)
{
Q_EMIT actionBeingHandled();
@@ -596,17 +579,16 @@ void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
}
}
-void DolphinViewActionHandler::slotVisibleRolesChanged(const QList<QByteArray>& current,
- const QList<QByteArray>& previous)
+void DolphinViewActionHandler::slotVisibleRolesChanged(const QList<QByteArray> &current, const QList<QByteArray> &previous)
{
Q_UNUSED(previous)
const auto checkedRoles = QSet<QByteArray>(current.constBegin(), current.constEnd());
- QHashIterator<QByteArray, KToggleAction*> it(m_visibleRoles);
+ QHashIterator<QByteArray, KToggleAction *> it(m_visibleRoles);
while (it.hasNext()) {
it.next();
- const QByteArray& role = it.key();
- KToggleAction* action = it.value();
+ const QByteArray &role = it.key();
+ KToggleAction *action = it.value();
action->setChecked(checkedRoles.contains(role));
}
}
@@ -618,7 +600,7 @@ void DolphinViewActionHandler::toggleGroupedSorting(bool grouped)
void DolphinViewActionHandler::slotGroupedSortingChanged(bool groupedSorting)
{
- QAction* showInGroupsAction = m_actionCollection->action(QStringLiteral("show_in_groups"));
+ QAction *showInGroupsAction = m_actionCollection->action(QStringLiteral("show_in_groups"));
showInGroupsAction->setChecked(groupedSorting);
}
@@ -630,19 +612,18 @@ void DolphinViewActionHandler::toggleShowHiddenFiles(bool show)
void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown)
{
- QAction* showHiddenFilesAction = m_actionCollection->action(QStringLiteral("show_hidden_files"));
+ QAction *showHiddenFilesAction = m_actionCollection->action(QStringLiteral("show_hidden_files"));
showHiddenFilesAction->setChecked(shown);
}
void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)
{
- m_actionCollection->action(QStringLiteral("create_dir"))->setEnabled(isFolderWritable &&
- KProtocolManager::supportsMakeDir(currentView()->url()));
+ m_actionCollection->action(QStringLiteral("create_dir"))->setEnabled(isFolderWritable && KProtocolManager::supportsMakeDir(currentView()->url()));
}
-KToggleAction* DolphinViewActionHandler::iconsModeAction()
+KToggleAction *DolphinViewActionHandler::iconsModeAction()
{
- KToggleAction* iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("icons"));
+ KToggleAction *iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("icons"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Icons"));
iconsView->setToolTip(i18nc("@info", "Icons view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL | Qt::Key_1);
@@ -651,9 +632,9 @@ KToggleAction* DolphinViewActionHandler::iconsModeAction()
return iconsView;
}
-KToggleAction* DolphinViewActionHandler::compactModeAction()
+KToggleAction *DolphinViewActionHandler::compactModeAction()
{
- KToggleAction* iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("compact"));
+ KToggleAction *iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("compact"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Compact"));
iconsView->setToolTip(i18nc("@info", "Compact view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL | Qt::Key_2);
@@ -662,9 +643,9 @@ KToggleAction* DolphinViewActionHandler::compactModeAction()
return iconsView;
}
-KToggleAction* DolphinViewActionHandler::detailsModeAction()
+KToggleAction *DolphinViewActionHandler::detailsModeAction()
{
- KToggleAction* detailsView = m_actionCollection->add<KToggleAction>(QStringLiteral("details"));
+ KToggleAction *detailsView = m_actionCollection->add<KToggleAction>(QStringLiteral("details"));
detailsView->setText(i18nc("@action:inmenu View Mode", "Details"));
detailsView->setToolTip(i18nc("@info", "Details view mode"));
m_actionCollection->setDefaultShortcut(detailsView, Qt::CTRL | Qt::Key_3);
@@ -673,20 +654,20 @@ KToggleAction* DolphinViewActionHandler::detailsModeAction()
return detailsView;
}
-void DolphinViewActionHandler::slotSortRoleChanged(const QByteArray& role)
+void DolphinViewActionHandler::slotSortRoleChanged(const QByteArray &role)
{
- KToggleAction* action = m_sortByActions.value(role);
+ KToggleAction *action = m_sortByActions.value(role);
if (action) {
action->setChecked(true);
if (!action->icon().isNull()) {
- QAction* sortByMenu = m_actionCollection->action(QStringLiteral("sort"));
+ QAction *sortByMenu = m_actionCollection->action(QStringLiteral("sort"));
sortByMenu->setIcon(action->icon());
}
}
- QAction* descending = m_actionCollection->action(QStringLiteral("descending"));
- QAction* ascending = m_actionCollection->action(QStringLiteral("ascending"));
+ QAction *descending = m_actionCollection->action(QStringLiteral("descending"));
+ QAction *ascending = m_actionCollection->action(QStringLiteral("ascending"));
if (role == "text" || role == "type" || role == "extension" || role == "tags" || role == "comment") {
descending->setText(i18nc("Sort descending", "Z-A"));
@@ -712,18 +693,18 @@ void DolphinViewActionHandler::slotZoomLevelChanged(int current, int previous)
{
Q_UNUSED(previous)
- QAction* zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
+ QAction *zoomInAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomIn));
if (zoomInAction) {
zoomInAction->setEnabled(current < ZoomLevelInfo::maximumLevel());
}
- QAction* zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
+ QAction *zoomOutAction = m_actionCollection->action(KStandardAction::name(KStandardAction::ZoomOut));
if (zoomOutAction) {
zoomOutAction->setEnabled(current > ZoomLevelInfo::minimumLevel());
}
}
-void DolphinViewActionHandler::slotSortTriggered(QAction* action)
+void DolphinViewActionHandler::slotSortTriggered(QAction *action)
{
// The radiobuttons of the "Sort By"-menu are split between the main-menu
// and several sub-menus. Because of this they don't have a common
@@ -732,10 +713,10 @@ void DolphinViewActionHandler::slotSortTriggered(QAction* action)
// be assured that all other actions get unchecked, except the ascending/
// descending actions
for (QAction *groupAction : qAsConst(m_sortByActions)) {
- KActionMenu* actionMenu = qobject_cast<KActionMenu*>(groupAction);
+ KActionMenu *actionMenu = qobject_cast<KActionMenu *>(groupAction);
if (actionMenu) {
const auto actions = actionMenu->menu()->actions();
- for (QAction* subAction : actions) {
+ for (QAction *subAction : actions) {
subAction->setChecked(false);
}
} else if (groupAction->actionGroup()) {
@@ -770,7 +751,7 @@ void DolphinViewActionHandler::slotDuplicate()
void DolphinViewActionHandler::slotProperties()
{
- KPropertiesDialog* dialog = nullptr;
+ KPropertiesDialog *dialog = nullptr;
const KFileItemList list = m_currentView->selectedItems();
if (list.isEmpty()) {
const QUrl url = m_currentView->url();
@@ -795,14 +776,14 @@ void DolphinViewActionHandler::slotCopyPath()
}
}
-void DolphinViewActionHandler::slotSelectionChanged(const KFileItemList& selection)
+void DolphinViewActionHandler::slotSelectionChanged(const KFileItemList &selection)
{
QString basicActionsMenuText;
if (selection.isEmpty()) {
- basicActionsMenuText =
- i18nc("@action:inmenu menu with actions like copy, paste, rename. The user's selection is empty when this text is shown.",
- "Actions for Current View");
+ basicActionsMenuText = i18nc("@action:inmenu menu with actions like copy, paste, rename. The user's selection is empty when this text is shown.",
+ "Actions for Current View");
} else {
+ // clang-format off
QFontMetrics fontMetrics = QMenu().fontMetrics();
// i18n: @action:inmenu menu with actions like copy, paste, rename.
// %1 is a textual representation of the currently selected files or folders. This can be the name of
@@ -810,13 +791,15 @@ void DolphinViewActionHandler::slotSelectionChanged(const KFileItemList& selecti
// If this sort of word puzzle can not be correctly translated in your language, translate it as "NULL" (without the quotes)
// and a fallback will be used.
basicActionsMenuText = i18n("Actions for %1", fileItemListToString(selection, fontMetrics.averageCharWidth() * 40, fontMetrics, ItemsState::Selected));
+ // clang-format on
}
if (basicActionsMenuText == QStringLiteral("NULL")) {
const KFileItemListProperties properties(selection);
- basicActionsMenuText =
- i18ncp("@action:inmenu menu with actions like copy, paste, rename. %1 is the amount of selected files/folders.",
- "Actions for One Selected Item", "Actions for %1 Selected Items", selection.count());
+ basicActionsMenuText = i18ncp("@action:inmenu menu with actions like copy, paste, rename. %1 is the amount of selected files/folders.",
+ "Actions for One Selected Item",
+ "Actions for %1 Selected Items",
+ selection.count());
}
QAction *basicActionsMenu = m_actionCollection->action(QStringLiteral("basic_actions"));
diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h
index 8631936d9..f36b3d1d0 100644
--- a/src/views/dolphinviewactionhandler.h
+++ b/src/views/dolphinviewactionhandler.h
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
-
#ifndef DOLPHINVIEWACTIONHANDLER_H
#define DOLPHINVIEWACTIONHANDLER_H
@@ -21,8 +20,9 @@ class QActionGroup;
class DolphinView;
class KActionCollection;
class KFileItemList;
-namespace SelectionMode {
- class ActionTextHelper;
+namespace SelectionMode
+{
+class ActionTextHelper;
}
/**
@@ -44,17 +44,17 @@ class DOLPHIN_EXPORT DolphinViewActionHandler : public QObject
Q_OBJECT
public:
- explicit DolphinViewActionHandler(KActionCollection* collection, SelectionMode::ActionTextHelper* actionTextHelper, QObject* parent);
+ explicit DolphinViewActionHandler(KActionCollection *collection, SelectionMode::ActionTextHelper *actionTextHelper, QObject *parent);
/**
* Sets the view that this action handler should work on.
*/
- void setCurrentView(DolphinView* view);
+ void setCurrentView(DolphinView *view);
/**
* Returns the view that this action handler should work on.
*/
- DolphinView* currentView();
+ DolphinView *currentView();
/**
* Returns the name of the action for the current viewmode
@@ -64,7 +64,7 @@ public:
/**
* Returns m_actionCollection
*/
- KActionCollection* actionCollection();
+ KActionCollection *actionCollection();
public Q_SLOTS:
/**
@@ -94,7 +94,7 @@ private Q_SLOTS:
/**
* Emitted when the user requested a change of view mode
*/
- void slotViewModeActionTriggered(QAction*);
+ void slotViewModeActionTriggered(QAction *);
/**
* Let the user input a name for the selected item(s) and trigger
@@ -126,7 +126,7 @@ 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();
@@ -156,7 +156,7 @@ private Q_SLOTS:
/**
* Updates the state of the 'Sort by' actions.
*/
- void slotSortRoleChanged(const QByteArray& role);
+ void slotSortRoleChanged(const QByteArray &role);
/**
* Updates the state of the 'Zoom In' and 'Zoom Out' actions.
@@ -167,18 +167,17 @@ private Q_SLOTS:
* Switches on or off the displaying of additional information
* as specified by \a action.
*/
- void toggleVisibleRole(QAction* action);
+ void toggleVisibleRole(QAction *action);
/**
* Changes the sorting of the current view.
*/
- void slotSortTriggered(QAction*);
+ void slotSortTriggered(QAction *);
/**
* Updates the state of the 'Additional Information' actions.
*/
- void slotVisibleRolesChanged(const QList<QByteArray>& current,
- const QList<QByteArray>& previous);
+ void slotVisibleRolesChanged(const QList<QByteArray> &current, const QList<QByteArray> &previous);
/**
* Switches between sorting by groups or not.
@@ -234,7 +233,7 @@ private Q_SLOTS:
* The name is changed to something like "Actions for 3 Selected Items" to be extra
* explicit of how these basic actions are used.
*/
- void slotSelectionChanged(const KFileItemList& selection);
+ void slotSelectionChanged(const KFileItemList &selection);
private:
/**
@@ -251,31 +250,31 @@ private:
* The changes of actions are reported to slotSortTriggered() or
* toggleAdditionalInfo().
*/
- QActionGroup* createFileItemRolesActionGroup(const QString& groupPrefix);
+ QActionGroup *createFileItemRolesActionGroup(const QString &groupPrefix);
/**
* Returns the "switch to icons mode" action.
* Helper method for createActions();
*/
- KToggleAction* iconsModeAction();
+ KToggleAction *iconsModeAction();
/**
* Returns the "switch to compact mode" action.
* Helper method for createActions();
*/
- KToggleAction* compactModeAction();
+ KToggleAction *compactModeAction();
/**
* Returns the "switch to details mode" action.
* Helper method for createActions();
*/
- KToggleAction* detailsModeAction();
+ KToggleAction *detailsModeAction();
- KActionCollection* m_actionCollection;
- DolphinView* m_currentView;
+ KActionCollection *m_actionCollection;
+ DolphinView *m_currentView;
- QHash<QByteArray, KToggleAction*> m_sortByActions;
- QHash<QByteArray, KToggleAction*> m_visibleRoles;
+ QHash<QByteArray, KToggleAction *> m_sortByActions;
+ QHash<QByteArray, KToggleAction *> m_visibleRoles;
};
#endif /* DOLPHINVIEWACTIONHANDLER_H */
diff --git a/src/views/draganddrophelper.cpp b/src/views/draganddrophelper.cpp
index b3f2a4c3e..aaf2baa38 100644
--- a/src/views/draganddrophelper.cpp
+++ b/src/views/draganddrophelper.cpp
@@ -17,30 +17,34 @@
QHash<QUrl, bool> DragAndDropHelper::m_urlListMatchesUrlCache;
-bool DragAndDropHelper::urlListMatchesUrl(const QList<QUrl>& urls, const QUrl& destUrl)
+bool DragAndDropHelper::urlListMatchesUrl(const QList<QUrl> &urls, const QUrl &destUrl)
{
auto iteratorResult = m_urlListMatchesUrlCache.constFind(destUrl);
if (iteratorResult != m_urlListMatchesUrlCache.constEnd()) {
return *iteratorResult;
}
- const bool destUrlMatches =
- std::find_if(urls.constBegin(), urls.constEnd(), [destUrl](const QUrl& url) {
- return url.matches(destUrl, QUrl::StripTrailingSlash);
- }) != urls.constEnd();
+ const bool destUrlMatches = std::find_if(urls.constBegin(),
+ urls.constEnd(),
+ [destUrl](const QUrl &url) {
+ return url.matches(destUrl, QUrl::StripTrailingSlash);
+ })
+ != urls.constEnd();
return *m_urlListMatchesUrlCache.insert(destUrl, destUrlMatches);
}
-KIO::DropJob* DragAndDropHelper::dropUrls(const QUrl& destUrl, QDropEvent* event, QWidget* window)
+KIO::DropJob *DragAndDropHelper::dropUrls(const QUrl &destUrl, QDropEvent *event, QWidget *window)
{
- const QMimeData* mimeData = event->mimeData();
+ const QMimeData *mimeData = event->mimeData();
if (isArkDndMimeType(mimeData)) {
const QString remoteDBusClient = mimeData->data(arkDndServiceMimeType());
const QString remoteDBusPath = mimeData->data(arkDndPathMimeType());
- QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient, remoteDBusPath,
- QStringLiteral("org.kde.ark.DndExtract"), QStringLiteral("extractSelectedFilesTo"));
+ QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient,
+ remoteDBusPath,
+ QStringLiteral("org.kde.ark.DndExtract"),
+ QStringLiteral("extractSelectedFilesTo"));
message.setArguments({destUrl.toDisplayString(QUrl::PreferLocalFile)});
QDBusConnection::sessionBus().call(message);
} else {
@@ -64,6 +68,5 @@ void DragAndDropHelper::clearUrlListMatchesUrlCache()
bool DragAndDropHelper::isArkDndMimeType(const QMimeData *mimeData)
{
- return mimeData->hasFormat(arkDndServiceMimeType())
- && mimeData->hasFormat(arkDndPathMimeType());
+ return mimeData->hasFormat(arkDndServiceMimeType()) && mimeData->hasFormat(arkDndPathMimeType());
}
diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h
index 19a30404e..656cefe1b 100644
--- a/src/views/draganddrophelper.h
+++ b/src/views/draganddrophelper.h
@@ -17,7 +17,10 @@
class QDropEvent;
class QMimeData;
class QWidget;
-namespace KIO { class DropJob; }
+namespace KIO
+{
+class DropJob;
+}
class DOLPHIN_EXPORT DragAndDropHelper
{
@@ -35,26 +38,31 @@ public:
* @return KIO::DropJob pointer or null in case the destUrl is contained
* in the mimeData url list.
*/
- static KIO::DropJob* dropUrls(const QUrl& destUrl,
- QDropEvent* event,
- QWidget *window);
+ static KIO::DropJob *dropUrls(const QUrl &destUrl, QDropEvent *event, QWidget *window);
/**
* @return True if destUrl is contained in the urls parameter.
*/
- static bool urlListMatchesUrl(const QList<QUrl>& urls, const QUrl& destUrl);
+ static bool urlListMatchesUrl(const QList<QUrl> &urls, const QUrl &destUrl);
/**
* @return True if mimeData contains Ark's drag and drop mime types.
*/
static bool isArkDndMimeType(const QMimeData *mimeData);
- static QString arkDndServiceMimeType() { return QStringLiteral("application/x-kde-ark-dndextract-service"); }
- static QString arkDndPathMimeType() { return QStringLiteral("application/x-kde-ark-dndextract-path"); }
+ static QString arkDndServiceMimeType()
+ {
+ return QStringLiteral("application/x-kde-ark-dndextract-service");
+ }
+ static QString arkDndPathMimeType()
+ {
+ return QStringLiteral("application/x-kde-ark-dndextract-path");
+ }
/**
* clear the internal cache.
*/
static void clearUrlListMatchesUrlCache();
+
private:
/**
* Stores the results of the expensive checks made in urlListMatchesUrl.
diff --git a/src/views/tooltips/dolphinfilemetadatawidget.cpp b/src/views/tooltips/dolphinfilemetadatawidget.cpp
index 80d22d837..3686b0f18 100644
--- a/src/views/tooltips/dolphinfilemetadatawidget.cpp
+++ b/src/views/tooltips/dolphinfilemetadatawidget.cpp
@@ -8,10 +8,10 @@
#include "dolphinfilemetadatawidget.h"
+#include <Baloo/FileMetaDataWidget>
#include <KColorScheme>
#include <KSeparator>
#include <KStringHandler>
-#include <Baloo/FileMetaDataWidget>
#include <QLabel>
#include <QStyleOptionFrame>
@@ -20,11 +20,11 @@
#include <QTextLayout>
#include <QVBoxLayout>
-DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) :
- QWidget(parent),
- m_preview(nullptr),
- m_name(nullptr),
- m_fileMetaDataWidget(nullptr)
+DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget *parent)
+ : QWidget(parent)
+ , m_preview(nullptr)
+ , m_name(nullptr)
+ , m_fileMetaDataWidget(nullptr)
{
// Create widget for file preview
m_preview = new QLabel(this);
@@ -45,14 +45,12 @@ DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) :
// Create widget for the meta data
m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this);
- connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished,
- this, &DolphinFileMetaDataWidget::metaDataRequestFinished);
- connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::urlActivated,
- this, &DolphinFileMetaDataWidget::urlActivated);
+ connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished, this, &DolphinFileMetaDataWidget::metaDataRequestFinished);
+ connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::urlActivated, this, &DolphinFileMetaDataWidget::urlActivated);
m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
m_fileMetaDataWidget->setReadOnly(true);
- QVBoxLayout* textLayout = new QVBoxLayout();
+ QVBoxLayout *textLayout = new QVBoxLayout();
textLayout->addWidget(m_name);
textLayout->addWidget(new KSeparator());
textLayout->addWidget(m_fileMetaDataWidget);
@@ -64,7 +62,7 @@ DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) :
// (see bug #241608)
textLayout->addStretch();
- QHBoxLayout* layout = new QHBoxLayout(this);
+ QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(m_preview);
layout->addSpacing(layout->contentsMargins().left());
layout->addLayout(textLayout);
@@ -74,7 +72,7 @@ DolphinFileMetaDataWidget::~DolphinFileMetaDataWidget()
{
}
-void DolphinFileMetaDataWidget::setPreview(const QPixmap& pixmap)
+void DolphinFileMetaDataWidget::setPreview(const QPixmap &pixmap)
{
m_preview->setPixmap(pixmap);
}
@@ -88,7 +86,7 @@ QPixmap DolphinFileMetaDataWidget::preview() const
return QPixmap();
}
-void DolphinFileMetaDataWidget::setName(const QString& name)
+void DolphinFileMetaDataWidget::setName(const QString &name)
{
QTextOption textOption;
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
@@ -124,7 +122,7 @@ QString DolphinFileMetaDataWidget::name() const
return m_name->text();
}
-void DolphinFileMetaDataWidget::setItems(const KFileItemList& items)
+void DolphinFileMetaDataWidget::setItems(const KFileItemList &items)
{
m_fileMetaDataWidget->setItems(items);
}
@@ -133,4 +131,3 @@ KFileItemList DolphinFileMetaDataWidget::items() const
{
return m_fileMetaDataWidget->items();
}
-
diff --git a/src/views/tooltips/dolphinfilemetadatawidget.h b/src/views/tooltips/dolphinfilemetadatawidget.h
index 63bd8b093..89f947498 100644
--- a/src/views/tooltips/dolphinfilemetadatawidget.h
+++ b/src/views/tooltips/dolphinfilemetadatawidget.h
@@ -16,8 +16,9 @@
class KFileItemList;
class QLabel;
-namespace Baloo {
- class FileMetaDataWidget;
+namespace Baloo
+{
+class FileMetaDataWidget;
}
/**
@@ -29,13 +30,13 @@ class DolphinFileMetaDataWidget : public QWidget
Q_OBJECT
public:
- explicit DolphinFileMetaDataWidget(QWidget* parent = nullptr);
+ explicit DolphinFileMetaDataWidget(QWidget *parent = nullptr);
~DolphinFileMetaDataWidget() override;
- void setPreview(const QPixmap& pixmap);
+ void setPreview(const QPixmap &pixmap);
QPixmap preview() const;
- void setName(const QString& name);
+ void setName(const QString &name);
QString name() const;
/**
@@ -43,7 +44,7 @@ public:
* The signal metaDataRequestFinished() will be emitted,
* as soon as the meta data for the items has been received.
*/
- void setItems(const KFileItemList& items);
+ void setItems(const KFileItemList &items);
KFileItemList items() const;
Q_SIGNALS:
@@ -51,18 +52,18 @@ Q_SIGNALS:
* Is emitted after the meta data has been received for the items
* set by DolphinFileMetaDataWidget::setItems().
*/
- void metaDataRequestFinished(const KFileItemList& items);
+ void metaDataRequestFinished(const KFileItemList &items);
/**
* Is emitted when the user clicks a tag or a link
* in the metadata widget.
*/
- void urlActivated(const QUrl& url);
+ void urlActivated(const QUrl &url);
private:
- QLabel* m_preview;
- QLabel* m_name;
- Baloo::FileMetaDataWidget* m_fileMetaDataWidget;
+ QLabel *m_preview;
+ QLabel *m_name;
+ Baloo::FileMetaDataWidget *m_fileMetaDataWidget;
};
#endif
diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp
index 5a40d1023..c9d22eedf 100644
--- a/src/views/tooltips/tooltipmanager.cpp
+++ b/src/views/tooltips/tooltipmanager.cpp
@@ -8,19 +8,20 @@
#include "dolphinfilemetadatawidget.h"
-#include <KIO/PreviewJob>
#include <KConfigGroup>
+#include <KIO/PreviewJob>
+#include <KIconLoader>
#include <KJobWidgets>
#include <KSharedConfig>
#include <KToolTipWidget>
-#include <KIconLoader>
#include <QApplication>
#include <QStyle>
#include <QTimer>
#include <QWindow>
-class IconLoaderSingleton {
+class IconLoaderSingleton
+{
public:
IconLoaderSingleton() = default;
@@ -29,17 +30,17 @@ public:
Q_GLOBAL_STATIC(IconLoaderSingleton, iconLoader)
-ToolTipManager::ToolTipManager(QWidget* parent) :
- QObject(parent),
- m_showToolTipTimer(nullptr),
- m_contentRetrievalTimer(nullptr),
- m_transientParent(nullptr),
- m_toolTipRequested(false),
- m_metaDataRequested(false),
- m_appliedWaitCursor(false),
- m_margin(4),
- m_item(),
- m_itemRect()
+ToolTipManager::ToolTipManager(QWidget *parent)
+ : QObject(parent)
+ , m_showToolTipTimer(nullptr)
+ , m_contentRetrievalTimer(nullptr)
+ , m_transientParent(nullptr)
+ , m_toolTipRequested(false)
+ , m_metaDataRequested(false)
+ , m_appliedWaitCursor(false)
+ , m_margin(4)
+ , m_item()
+ , m_itemRect()
{
if (parent) {
m_margin = qMax(m_margin, parent->style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth));
@@ -65,7 +66,7 @@ ToolTipManager::~ToolTipManager()
}
}
-void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect, QWindow *transientParent)
+void ToolTipManager::showToolTip(const KFileItem &item, const QRectF &itemRect, QWindow *transientParent)
{
hideToolTip(HideBehavior::Instantly);
@@ -134,23 +135,17 @@ void ToolTipManager::startContentRetrieval()
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);
+ KIO::PreviewJob *job = new KIO::PreviewJob(KFileItemList() << m_item, QSize(256, 256), &plugins);
job->setIgnoreMaximumSize(m_item.isLocalFile() && !m_item.isSlow());
if (job->uiDelegate()) {
KJobWidgets::setWindow(job, qApp->activeWindow());
}
- connect(job, &KIO::PreviewJob::gotPreview,
- this, &ToolTipManager::setPreviewPix);
- connect(job, &KIO::PreviewJob::failed,
- this, &ToolTipManager::previewFailed);
+ connect(job, &KIO::PreviewJob::gotPreview, this, &ToolTipManager::setPreviewPix);
+ connect(job, &KIO::PreviewJob::failed, this, &ToolTipManager::previewFailed);
}
-
-void ToolTipManager::setPreviewPix(const KFileItem& item,
- const QPixmap& pixmap)
+void ToolTipManager::setPreviewPix(const KFileItem &item, const QPixmap &pixmap)
{
if (!m_toolTipRequested || (m_item.url() != item.url())) {
// No tooltip is requested anymore or an old preview has been received
@@ -173,7 +168,7 @@ void ToolTipManager::previewFailed()
return;
}
QPalette pal;
- for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) {
+ for (auto state : {QPalette::Active, QPalette::Inactive, QPalette::Disabled}) {
pal.setBrush(state, QPalette::WindowText, pal.toolTipText());
pal.setBrush(state, QPalette::Window, pal.toolTipBase());
}
@@ -224,4 +219,3 @@ void ToolTipManager::showToolTip()
m_toolTipRequested = false;
}
-
diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h
index c86c97f6b..9aee295ff 100644
--- a/src/views/tooltips/tooltipmanager.h
+++ b/src/views/tooltips/tooltipmanager.h
@@ -29,12 +29,9 @@ class ToolTipManager : public QObject
Q_OBJECT
public:
- enum class HideBehavior {
- Instantly,
- Later
- };
+ enum class HideBehavior { Instantly, Later };
- explicit ToolTipManager(QWidget* parent);
+ explicit ToolTipManager(QWidget *parent);
~ToolTipManager() override;
/**
@@ -43,7 +40,7 @@ public:
* The tooltip manager takes care that the tooltip is shown
* slightly delayed and with a proper \p transientParent.
*/
- void showToolTip(const KFileItem& item, const QRectF& itemRect, QWindow *transientParent);
+ void showToolTip(const KFileItem &item, const QRectF &itemRect, QWindow *transientParent);
/**
* Hides the currently shown tooltip.
@@ -55,11 +52,11 @@ Q_SIGNALS:
* Is emitted when the user clicks a tag or a link
* in the metadata widget.
*/
- void urlActivated(const QUrl& url);
+ void urlActivated(const QUrl &url);
private Q_SLOTS:
void startContentRetrieval();
- void setPreviewPix(const KFileItem& item, const QPixmap& pix);
+ void setPreviewPix(const KFileItem &item, const QPixmap &pix);
void previewFailed();
void slotMetaDataRequestFinished();
void showToolTip();
@@ -67,14 +64,14 @@ private Q_SLOTS:
private:
/// Timeout from requesting a tooltip until the tooltip
/// should be shown
- QTimer* m_showToolTipTimer;
+ QTimer *m_showToolTipTimer;
/// Timeout from requesting a tooltip until the retrieving of
/// the tooltip content like preview and meta data gets started.
- QTimer* m_contentRetrievalTimer;
+ QTimer *m_contentRetrievalTimer;
/// Transient parent of the tooltip, mandatory on Wayland.
- QWindow* m_transientParent;
+ QWindow *m_transientParent;
QScopedPointer<KToolTipWidget> m_tooltipWidget;
DolphinFileMetaDataWidget *m_fileMetaDataWidget = nullptr;
diff --git a/src/views/versioncontrol/kversioncontrolplugin.cpp b/src/views/versioncontrol/kversioncontrolplugin.cpp
index 9cbf0eb5b..0190bb365 100644
--- a/src/views/versioncontrol/kversioncontrolplugin.cpp
+++ b/src/views/versioncontrol/kversioncontrolplugin.cpp
@@ -7,8 +7,8 @@
#include "kversioncontrolplugin.h"
-KVersionControlPlugin::KVersionControlPlugin(QObject* parent) :
- QObject(parent)
+KVersionControlPlugin::KVersionControlPlugin(QObject *parent)
+ : QObject(parent)
{
}
@@ -16,7 +16,7 @@ KVersionControlPlugin::~KVersionControlPlugin()
{
}
-QString KVersionControlPlugin::localRepositoryRoot(const QString &/*directory*/) const
+QString KVersionControlPlugin::localRepositoryRoot(const QString & /*directory*/) const
{
return QString();
}
diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h
index d3a39fbd6..1a4111452 100644
--- a/src/views/versioncontrol/kversioncontrolplugin.h
+++ b/src/views/versioncontrol/kversioncontrolplugin.h
@@ -73,8 +73,7 @@ class DOLPHINVCS_EXPORT KVersionControlPlugin : public QObject
Q_OBJECT
public:
- enum ItemVersion
- {
+ enum ItemVersion {
/** The file is not under version control. */
UnversionedVersion,
/**
@@ -131,7 +130,7 @@ public:
MissingVersion
};
- KVersionControlPlugin(QObject* parent = nullptr);
+ KVersionControlPlugin(QObject *parent = nullptr);
~KVersionControlPlugin() override;
/**
@@ -145,7 +144,7 @@ public:
* Returns the path of the local repository root for the versioned directory
* Returns an empty QString when directory is not part of a working copy
*/
- virtual QString localRepositoryRoot(const QString& directory) const;
+ virtual QString localRepositoryRoot(const QString &directory) const;
/**
* Is invoked whenever the version control
@@ -153,7 +152,7 @@ public:
* \p directory. It is assured that the directory
* contains a trailing slash.
*/
- virtual bool beginRetrieval(const QString& directory) = 0;
+ virtual bool beginRetrieval(const QString &directory) = 0;
/**
* Is invoked after the version control information has been
@@ -169,13 +168,13 @@ public:
* invoked before and that the file is part of the directory specified
* in beginRetrieval().
*/
- virtual ItemVersion itemVersion(const KFileItem& item) const = 0;
+ virtual ItemVersion itemVersion(const KFileItem &item) const = 0;
/**
* @return List of actions that are available for the \p items in a version controlled
* path.
*/
- virtual QList<QAction*> versionControlActions(const KFileItemList& items) const = 0;
+ virtual QList<QAction *> versionControlActions(const KFileItemList &items) const = 0;
/**
* @return List of actions that are available for the out of version control
@@ -183,7 +182,7 @@ public:
* is for clone/checkout actions.
* @since 21.04
*/
- virtual QList<QAction*> outOfVersionControlActions(const KFileItemList& items) const = 0;
+ virtual QList<QAction *> outOfVersionControlActions(const KFileItemList &items) const = 0;
Q_SIGNALS:
/**
@@ -201,20 +200,19 @@ Q_SIGNALS:
* Is emitted if an information message with the content \a msg
* should be shown.
*/
- void infoMessage(const QString& msg);
+ void infoMessage(const QString &msg);
/**
* Is emitted if an error message with the content \a msg
* should be shown.
*/
- void errorMessage(const QString& msg);
+ void errorMessage(const QString &msg);
/**
* Is emitted if an "operation completed" message with the content \a msg
* should be shown.
*/
- void operationCompletedMessage(const QString& msg);
+ void operationCompletedMessage(const QString &msg);
};
#endif // KVERSIONCONTROLPLUGIN_H
-
diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp
index cf45bbff1..37c36f40c 100644
--- a/src/views/versioncontrol/updateitemstatesthread.cpp
+++ b/src/views/versioncontrol/updateitemstatesthread.cpp
@@ -6,13 +6,11 @@
#include "updateitemstatesthread.h"
-
-UpdateItemStatesThread::UpdateItemStatesThread(KVersionControlPlugin* plugin,
- const QMap<QString, QVector<VersionControlObserver::ItemState> >& itemStates) :
- QThread(),
- m_globalPluginMutex(nullptr),
- m_plugin(plugin),
- m_itemStates(itemStates)
+UpdateItemStatesThread::UpdateItemStatesThread(KVersionControlPlugin *plugin, const QMap<QString, QVector<VersionControlObserver::ItemState>> &itemStates)
+ : QThread()
+ , m_globalPluginMutex(nullptr)
+ , m_plugin(plugin)
+ , m_itemStates(itemStates)
{
// Several threads may share one instance of a plugin. A global
// mutex is required to serialize the retrieval of version control
@@ -31,13 +29,13 @@ void UpdateItemStatesThread::run()
Q_ASSERT(m_plugin);
QMutexLocker pluginLocker(m_globalPluginMutex);
- QMap<QString, QVector<VersionControlObserver::ItemState> >::iterator it = m_itemStates.begin();
+ QMap<QString, QVector<VersionControlObserver::ItemState>>::iterator it = m_itemStates.begin();
for (; it != m_itemStates.end(); ++it) {
if (m_plugin->beginRetrieval(it.key())) {
- QVector<VersionControlObserver::ItemState>& items = it.value();
+ QVector<VersionControlObserver::ItemState> &items = it.value();
const int count = items.count();
for (int i = 0; i < count; ++i) {
- const KFileItem& item = items.at(i).first;
+ const KFileItem &item = items.at(i).first;
const KVersionControlPlugin::ItemVersion version = m_plugin->itemVersion(item);
items[i].second = version;
}
@@ -47,8 +45,7 @@ void UpdateItemStatesThread::run()
}
}
-QMap<QString, QVector<VersionControlObserver::ItemState> > UpdateItemStatesThread::itemStates() const
+QMap<QString, QVector<VersionControlObserver::ItemState>> UpdateItemStatesThread::itemStates() const
{
return m_itemStates;
}
-
diff --git a/src/views/versioncontrol/updateitemstatesthread.h b/src/views/versioncontrol/updateitemstatesthread.h
index eac28bb78..24f060d26 100644
--- a/src/views/versioncontrol/updateitemstatesthread.h
+++ b/src/views/versioncontrol/updateitemstatesthread.h
@@ -31,20 +31,19 @@ public:
* UpdateItemStatesThread::unlockPlugin() must be used.
* @param itemStates List of items, where the states get updated.
*/
- UpdateItemStatesThread(KVersionControlPlugin* plugin,
- const QMap<QString, QVector<VersionControlObserver::ItemState> >& itemStates);
+ UpdateItemStatesThread(KVersionControlPlugin *plugin, const QMap<QString, QVector<VersionControlObserver::ItemState>> &itemStates);
~UpdateItemStatesThread() override;
- QMap<QString, QVector<VersionControlObserver::ItemState> > itemStates() const;
+ QMap<QString, QVector<VersionControlObserver::ItemState>> itemStates() const;
protected:
void run() override;
private:
- QMutex* m_globalPluginMutex; // Protects the m_plugin globally
- KVersionControlPlugin* m_plugin;
+ QMutex *m_globalPluginMutex; // Protects the m_plugin globally
+ KVersionControlPlugin *m_plugin;
- QMap<QString, QVector<VersionControlObserver::ItemState> > m_itemStates;
+ QMap<QString, QVector<VersionControlObserver::ItemState>> m_itemStates;
};
#endif // UPDATEITEMSTATESTHREAD_H
diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp
index e0505675a..28fbbef1a 100644
--- a/src/views/versioncontrol/versioncontrolobserver.cpp
+++ b/src/views/versioncontrol/versioncontrolobserver.cpp
@@ -8,9 +8,9 @@
#include "dolphin_versioncontrolsettings.h"
#include "dolphindebug.h"
-#include "views/dolphinview.h"
#include "kitemviews/kfileitemmodel.h"
#include "updateitemstatesthread.h"
+#include "views/dolphinview.h"
#include <KLocalizedString>
#include <KPluginFactory>
@@ -18,16 +18,16 @@
#include <QTimer>
-VersionControlObserver::VersionControlObserver(QObject* parent) :
- QObject(parent),
- m_pendingItemStatesUpdate(false),
- m_silentUpdate(false),
- m_view(nullptr),
- m_model(nullptr),
- m_dirVerificationTimer(nullptr),
- m_pluginsInitialized(false),
- m_plugin(nullptr),
- m_updateItemStatesThread(nullptr)
+VersionControlObserver::VersionControlObserver(QObject *parent)
+ : QObject(parent)
+ , m_pendingItemStatesUpdate(false)
+ , m_silentUpdate(false)
+ , m_view(nullptr)
+ , m_model(nullptr)
+ , m_dirVerificationTimer(nullptr)
+ , m_pluginsInitialized(false)
+ , m_plugin(nullptr)
+ , m_updateItemStatesThread(nullptr)
{
// The verification timer specifies the timeout until the shown directory
// is checked whether it is versioned. Per default it is assumed that users
@@ -37,8 +37,7 @@ VersionControlObserver::VersionControlObserver(QObject* parent) :
m_dirVerificationTimer = new QTimer(this);
m_dirVerificationTimer->setSingleShot(true);
m_dirVerificationTimer->setInterval(500);
- connect(m_dirVerificationTimer, &QTimer::timeout,
- this, &VersionControlObserver::verifyDirectory);
+ connect(m_dirVerificationTimer, &QTimer::timeout, this, &VersionControlObserver::verifyDirectory);
}
VersionControlObserver::~VersionControlObserver()
@@ -49,54 +48,48 @@ VersionControlObserver::~VersionControlObserver()
}
}
-void VersionControlObserver::setModel(KFileItemModel* model)
+void VersionControlObserver::setModel(KFileItemModel *model)
{
if (m_model) {
- disconnect(m_model, &KFileItemModel::itemsInserted,
- this, &VersionControlObserver::delayedDirectoryVerification);
- disconnect(m_model, &KFileItemModel::itemsChanged,
- this, &VersionControlObserver::slotItemsChanged);
+ disconnect(m_model, &KFileItemModel::itemsInserted, this, &VersionControlObserver::delayedDirectoryVerification);
+ disconnect(m_model, &KFileItemModel::itemsChanged, this, &VersionControlObserver::slotItemsChanged);
}
m_model = model;
if (model) {
- connect(m_model, &KFileItemModel::itemsInserted,
- this, &VersionControlObserver::delayedDirectoryVerification);
- connect(m_model, &KFileItemModel::itemsChanged,
- this, &VersionControlObserver::slotItemsChanged);
+ connect(m_model, &KFileItemModel::itemsInserted, this, &VersionControlObserver::delayedDirectoryVerification);
+ connect(m_model, &KFileItemModel::itemsChanged, this, &VersionControlObserver::slotItemsChanged);
}
}
-KFileItemModel* VersionControlObserver::model() const
+KFileItemModel *VersionControlObserver::model() const
{
return m_model;
}
-void VersionControlObserver::setView(DolphinView* view)
+void VersionControlObserver::setView(DolphinView *view)
{
if (m_view) {
- disconnect(m_view, &DolphinView::activated,
- this, &VersionControlObserver::delayedDirectoryVerification);
+ disconnect(m_view, &DolphinView::activated, this, &VersionControlObserver::delayedDirectoryVerification);
}
m_view = view;
if (m_view) {
- connect(m_view, &DolphinView::activated,
- this, &VersionControlObserver::delayedDirectoryVerification);
+ connect(m_view, &DolphinView::activated, this, &VersionControlObserver::delayedDirectoryVerification);
}
}
-DolphinView* VersionControlObserver::view() const
+DolphinView *VersionControlObserver::view() const
{
return m_view;
}
-QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) const
+QList<QAction *> VersionControlObserver::actions(const KFileItemList &items) const
{
bool hasNullItems = false;
- for (const KFileItem& item : items) {
+ for (const KFileItem &item : items) {
if (item.isNull()) {
qCWarning(DolphinDebug) << "Requesting version-control-actions for empty items";
hasNullItems = true;
@@ -111,7 +104,7 @@ QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) cons
if (isVersionControlled()) {
return m_plugin->versionControlActions(items);
} else {
- QList<QAction*> actions;
+ QList<QAction *> actions;
for (const QPointer<KVersionControlPlugin> &plugin : qAsConst(m_plugins)) {
actions << plugin->outOfVersionControlActions(items);
}
@@ -131,14 +124,14 @@ void VersionControlObserver::silentDirectoryVerification()
m_dirVerificationTimer->start();
}
-void VersionControlObserver::slotItemsChanged(const KItemRangeList& itemRanges, const QSet<QByteArray>& roles)
+void VersionControlObserver::slotItemsChanged(const KItemRangeList &itemRanges, const QSet<QByteArray> &roles)
{
Q_UNUSED(itemRanges)
// Because "version" role is emitted by VCS plugin (ourselves) we don't need to
// analyze it and update directory item states information. So lets check if
// there is only "version".
- if ( !(roles.count() == 1 && roles.contains("version")) ) {
+ if (!(roles.count() == 1 && roles.contains("version"))) {
delayedDirectoryVerification();
}
}
@@ -176,20 +169,20 @@ void VersionControlObserver::verifyDirectory()
void VersionControlObserver::slotThreadFinished()
{
- UpdateItemStatesThread* thread = m_updateItemStatesThread;
+ UpdateItemStatesThread *thread = m_updateItemStatesThread;
m_updateItemStatesThread = nullptr; // The thread deletes itself automatically (see updateItemStates())
if (!m_plugin || !thread) {
return;
}
- const QMap<QString, QVector<ItemState> >& itemStates = thread->itemStates();
- QMap<QString, QVector<ItemState> >::const_iterator it = itemStates.constBegin();
+ const QMap<QString, QVector<ItemState>> &itemStates = thread->itemStates();
+ QMap<QString, QVector<ItemState>>::const_iterator it = itemStates.constBegin();
for (; it != itemStates.constEnd(); ++it) {
- const QVector<ItemState>& items = it.value();
+ const QVector<ItemState> &items = it.value();
- for (const ItemState& item : items) {
- const KFileItem& fileItem = item.first;
+ for (const ItemState &item : items) {
+ const KFileItem &fileItem = item.first;
const KVersionControlPlugin::ItemVersion version = item.second;
QHash<QByteArray, QVariant> values;
values.insert("version", QVariant(version));
@@ -220,7 +213,7 @@ void VersionControlObserver::updateItemStates()
return;
}
- QMap<QString, QVector<ItemState> > itemStates;
+ QMap<QString, QVector<ItemState>> itemStates;
createItemStatesList(itemStates);
if (!itemStates.isEmpty()) {
@@ -228,17 +221,14 @@ void VersionControlObserver::updateItemStates()
Q_EMIT infoMessage(i18nc("@info:status", "Updating version information..."));
}
m_updateItemStatesThread = new UpdateItemStatesThread(m_plugin, itemStates);
- connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
- this, &VersionControlObserver::slotThreadFinished);
- connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished,
- m_updateItemStatesThread, &UpdateItemStatesThread::deleteLater);
+ connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished, this, &VersionControlObserver::slotThreadFinished);
+ connect(m_updateItemStatesThread, &UpdateItemStatesThread::finished, m_updateItemStatesThread, &UpdateItemStatesThread::deleteLater);
m_updateItemStatesThread->start(); // slotThreadFinished() is called when finished
}
}
-int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState> >& itemStates,
- const int firstIndex)
+int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState>> &itemStates, const int firstIndex)
{
const int itemCount = m_model->count();
const int currentExpansionLevel = m_model->expandedParentsCount(firstIndex);
@@ -265,7 +255,7 @@ int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState
}
if (!items.isEmpty()) {
- const QUrl& url = items.first().first.url();
+ const QUrl &url = items.first().first.url();
itemStates.insert(url.adjusted(QUrl::RemoveFilename).path(), items);
}
@@ -294,21 +284,17 @@ void VersionControlObserver::initPlugins()
}
for (auto &plugin : qAsConst(m_plugins)) {
- connect(plugin, &KVersionControlPlugin::itemVersionsChanged,
- this, &VersionControlObserver::silentDirectoryVerification);
- connect(plugin, &KVersionControlPlugin::infoMessage,
- this, &VersionControlObserver::infoMessage);
- connect(plugin, &KVersionControlPlugin::errorMessage,
- this, &VersionControlObserver::errorMessage);
- connect(plugin, &KVersionControlPlugin::operationCompletedMessage,
- this, &VersionControlObserver::operationCompletedMessage);
+ connect(plugin, &KVersionControlPlugin::itemVersionsChanged, this, &VersionControlObserver::silentDirectoryVerification);
+ connect(plugin, &KVersionControlPlugin::infoMessage, this, &VersionControlObserver::infoMessage);
+ connect(plugin, &KVersionControlPlugin::errorMessage, this, &VersionControlObserver::errorMessage);
+ connect(plugin, &KVersionControlPlugin::operationCompletedMessage, this, &VersionControlObserver::operationCompletedMessage);
}
m_pluginsInitialized = true;
}
}
-KVersionControlPlugin* VersionControlObserver::searchPlugin(const QUrl& directory)
+KVersionControlPlugin *VersionControlObserver::searchPlugin(const QUrl &directory)
{
initPlugins();
@@ -337,4 +323,3 @@ bool VersionControlObserver::isVersionControlled() const
{
return m_plugin != nullptr;
}
-
diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h
index 064a3088f..3d2edcef7 100644
--- a/src/views/versioncontrol/versioncontrolobserver.h
+++ b/src/views/versioncontrol/versioncontrolobserver.h
@@ -40,34 +40,34 @@ class DOLPHIN_EXPORT VersionControlObserver : public QObject
Q_OBJECT
public:
- explicit VersionControlObserver(QObject* parent = nullptr);
+ explicit VersionControlObserver(QObject *parent = nullptr);
~VersionControlObserver() override;
- void setModel(KFileItemModel* model);
- KFileItemModel* model() const;
- void setView(DolphinView* view);
- DolphinView* view() const;
+ void setModel(KFileItemModel *model);
+ KFileItemModel *model() const;
+ void setView(DolphinView *view);
+ DolphinView *view() const;
- QList<QAction*> actions(const KFileItemList& items) const;
+ QList<QAction *> actions(const KFileItemList &items) const;
Q_SIGNALS:
/**
* Is emitted if an information message with the content \a msg
* should be shown.
*/
- void infoMessage(const QString& msg);
+ void infoMessage(const QString &msg);
/**
* Is emitted if an error message with the content \a msg
* should be shown.
*/
- void errorMessage(const QString& msg);
+ void errorMessage(const QString &msg);
/**
* Is emitted if an "operation completed" message with the content \a msg
* should be shown.
*/
- void operationCompletedMessage(const QString& msg);
+ void operationCompletedMessage(const QString &msg);
private Q_SLOTS:
/**
@@ -89,7 +89,7 @@ private Q_SLOTS:
* Invokes delayedDirectoryVerification() only if the itemsChanged() signal has not
* been triggered by the VCS plugin itself.
*/
- void slotItemsChanged(const KItemRangeList& itemRanges, const QSet<QByteArray>& roles);
+ void slotItemsChanged(const KItemRangeList &itemRanges, const QSet<QByteArray> &roles);
void verifyDirectory();
@@ -117,14 +117,13 @@ private:
*
* @return The number of (recursive) processed items.
*/
- int createItemStatesList(QMap<QString, QVector<ItemState> >& itemStates,
- const int firstIndex = 0);
+ int createItemStatesList(QMap<QString, QVector<ItemState>> &itemStates, const int firstIndex = 0);
/**
* Returns a matching plugin for the given directory.
* 0 is returned, if no matching plugin has been found.
*/
- KVersionControlPlugin* searchPlugin(const QUrl& directory);
+ KVersionControlPlugin *searchPlugin(const QUrl &directory);
/**
* Returns true, if the directory contains a version control information.
@@ -139,18 +138,17 @@ private:
// of version states
QString m_localRepoRoot;
- DolphinView* m_view;
- KFileItemModel* m_model;
+ DolphinView *m_view;
+ KFileItemModel *m_model;
- QTimer* m_dirVerificationTimer;
+ QTimer *m_dirVerificationTimer;
bool m_pluginsInitialized;
- KVersionControlPlugin* m_plugin;
+ KVersionControlPlugin *m_plugin;
QList<QPointer<KVersionControlPlugin>> m_plugins;
- UpdateItemStatesThread* m_updateItemStatesThread;
+ UpdateItemStatesThread *m_updateItemStatesThread;
friend class UpdateItemStatesThread;
};
#endif // REVISIONCONTROLOBSERVER_H
-
diff --git a/src/views/viewmodecontroller.cpp b/src/views/viewmodecontroller.cpp
index 4bdd8321a..55be625d7 100644
--- a/src/views/viewmodecontroller.cpp
+++ b/src/views/viewmodecontroller.cpp
@@ -8,11 +8,11 @@
#include "zoomlevelinfo.h"
-ViewModeController::ViewModeController(QObject* parent) :
- QObject(parent),
- m_zoomLevel(0),
- m_nameFilter(),
- m_url()
+ViewModeController::ViewModeController(QObject *parent)
+ : QObject(parent)
+ , m_zoomLevel(0)
+ , m_nameFilter()
+ , m_url()
{
}
@@ -25,7 +25,7 @@ QUrl ViewModeController::url() const
return m_url;
}
-void ViewModeController::redirectToUrl(const QUrl& url)
+void ViewModeController::redirectToUrl(const QUrl &url)
{
m_url = url;
}
@@ -35,7 +35,7 @@ void ViewModeController::indicateActivationChange(bool active)
Q_EMIT activationChanged(active);
}
-void ViewModeController::setNameFilter(const QString& nameFilter)
+void ViewModeController::setNameFilter(const QString &nameFilter)
{
if (nameFilter != m_nameFilter) {
m_nameFilter = nameFilter;
@@ -63,7 +63,7 @@ int ViewModeController::zoomLevel() const
return m_zoomLevel;
}
-void ViewModeController::setUrl(const QUrl& url)
+void ViewModeController::setUrl(const QUrl &url)
{
if (m_url != url) {
m_url = url;
@@ -71,4 +71,3 @@ void ViewModeController::setUrl(const QUrl& url)
Q_EMIT urlChanged(url);
}
}
-
diff --git a/src/views/viewmodecontroller.h b/src/views/viewmodecontroller.h
index bd92a60a2..3aebf1638 100644
--- a/src/views/viewmodecontroller.h
+++ b/src/views/viewmodecontroller.h
@@ -26,7 +26,7 @@ class DOLPHIN_EXPORT ViewModeController : public QObject
Q_OBJECT
public:
- explicit ViewModeController(QObject* parent = nullptr);
+ explicit ViewModeController(QObject *parent = nullptr);
~ViewModeController() override;
/**
@@ -38,7 +38,7 @@ public:
* Sets the URL to \a url and does nothing else. Called when
* a redirection happens. See ViewModeController::setUrl()
*/
- void redirectToUrl(const QUrl& url);
+ void redirectToUrl(const QUrl &url);
/**
* Informs the view mode implementation about a change of the activation
@@ -58,7 +58,7 @@ public:
/**
* Sets the name filter to \a and emits the signal nameFilterChanged().
*/
- void setNameFilter(const QString& nameFilter);
+ void setNameFilter(const QString &nameFilter);
QString nameFilter() const;
public Q_SLOTS:
@@ -66,13 +66,13 @@ public Q_SLOTS:
* Sets the URL to \a url and emits the signals cancelPreviews() and
* urlChanged() if \a url is different for the current URL.
*/
- void setUrl(const QUrl& url);
+ void setUrl(const QUrl &url);
Q_SIGNALS:
/**
* Is emitted if the URL has been changed by ViewModeController::setUrl().
*/
- void urlChanged(const QUrl& url);
+ void urlChanged(const QUrl &url);
/**
* Is emitted, if ViewModeController::indicateActivationChange() has been
@@ -85,7 +85,7 @@ Q_SIGNALS:
* Is emitted if the name filter has been changed by
* ViewModeController::setNameFilter().
*/
- void nameFilterChanged(const QString& nameFilter);
+ void nameFilterChanged(const QString &nameFilter);
/**
* Is emitted if the zoom level has been changed by
diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp
index e6dbcd811..f42adbce7 100644
--- a/src/views/viewproperties.cpp
+++ b/src/views/viewproperties.cpp
@@ -15,27 +15,28 @@
#include <KFileItem>
-namespace {
- const int AdditionalInfoViewPropertiesVersion = 1;
- const int NameRolePropertiesVersion = 2;
- const int DateRolePropertiesVersion = 4;
- const int CurrentViewPropertiesVersion = 4;
+namespace
+{
+const int AdditionalInfoViewPropertiesVersion = 1;
+const int NameRolePropertiesVersion = 2;
+const int DateRolePropertiesVersion = 4;
+const int CurrentViewPropertiesVersion = 4;
- // String representation to mark the additional properties of
- // the details view as customized by the user. See
- // ViewProperties::visibleRoles() for more information.
- const char CustomizedDetailsString[] = "CustomizedDetails";
+// String representation to mark the additional properties of
+// the details view as customized by the user. See
+// ViewProperties::visibleRoles() for more information.
+const char CustomizedDetailsString[] = "CustomizedDetails";
- // Filename that is used for storing the properties
- const char ViewPropertiesFileName[] = ".directory";
+// Filename that is used for storing the properties
+const char ViewPropertiesFileName[] = ".directory";
}
-ViewProperties::ViewProperties(const QUrl& url) :
- m_changedProps(false),
- m_autoSave(true),
- m_node(nullptr)
+ViewProperties::ViewProperties(const QUrl &url)
+ : m_changedProps(false)
+ , m_autoSave(true)
+ , m_node(nullptr)
{
- GeneralSettings* settings = GeneralSettings::self();
+ GeneralSettings *settings = GeneralSettings::self();
const bool useGlobalViewProps = settings->globalViewProps() || url.isEmpty();
bool useSearchView = false;
bool useTrashView = false;
@@ -78,10 +79,10 @@ ViewProperties::ViewProperties(const QUrl& url) :
}
if (useDestinationDir) {
- #ifdef Q_OS_WIN
+#ifdef Q_OS_WIN
// m_filePath probably begins with C:/ - the colon is not a valid character for paths though
- m_filePath = QDir::separator() + m_filePath.remove(QLatin1Char(':'));
- #endif
+ m_filePath = QDir::separator() + m_filePath.remove(QLatin1Char(':'));
+#endif
m_filePath = destinationDir(QStringLiteral("local")) + m_filePath;
}
@@ -97,9 +98,8 @@ ViewProperties::ViewProperties(const QUrl& url) :
// If the .directory file does not exist or the timestamp is too old,
// use default values instead.
- const bool useDefaultProps = (!useGlobalViewProps || useSearchView || useTrashView || useRecentDocumentsView || useDownloadsView) &&
- (!QFile::exists(file) ||
- (m_node->timestamp() < settings->viewPropsTimestamp()));
+ const bool useDefaultProps = (!useGlobalViewProps || useSearchView || useTrashView || useRecentDocumentsView || useDownloadsView)
+ && (!QFile::exists(file) || (m_node->timestamp() < settings->viewPropsTimestamp()));
if (useDefaultProps) {
if (useSearchView) {
const QString path = url.path();
@@ -134,7 +134,7 @@ ViewProperties::ViewProperties(const QUrl& url) :
}
} else {
// The global view-properties act as default for directories without
- // any view-property configuration. Constructing a ViewProperties
+ // any view-property configuration. Constructing a ViewProperties
// instance for an empty QUrl ensures that the global view-properties
// are loaded.
QUrl emptyUrl;
@@ -230,7 +230,7 @@ bool ViewProperties::hiddenFilesShown() const
return m_node->hiddenFilesShown();
}
-void ViewProperties::setSortRole(const QByteArray& role)
+void ViewProperties::setSortRole(const QByteArray &role)
{
if (m_node->sortRole() != role) {
m_node->setSortRole(role);
@@ -282,7 +282,7 @@ bool ViewProperties::sortHiddenLast() const
return m_node->sortHiddenLast();
}
-void ViewProperties::setVisibleRoles(const QList<QByteArray>& roles)
+void ViewProperties::setVisibleRoles(const QList<QByteArray> &roles)
{
if (roles == visibleRoles()) {
return;
@@ -303,13 +303,12 @@ void ViewProperties::setVisibleRoles(const QList<QByteArray>& roles)
// Add the updated values for the current view-mode
newVisibleRoles.reserve(roles.count());
- for (const QByteArray& role : roles) {
+ for (const QByteArray &role : roles) {
newVisibleRoles.append(prefix + role);
}
if (oldVisibleRoles != newVisibleRoles) {
- const bool markCustomizedDetails = (m_node->viewMode() == DolphinView::DetailsView)
- && !newVisibleRoles.contains(CustomizedDetailsString);
+ const bool markCustomizedDetails = (m_node->viewMode() == DolphinView::DetailsView) && !newVisibleRoles.contains(CustomizedDetailsString);
if (markCustomizedDetails) {
// The additional information of the details-view has been modified. Set a marker,
// so that it is allowed to also show no additional information without doing the
@@ -346,7 +345,7 @@ QList<QByteArray> ViewProperties::visibleRoles() const
const int prefixLength = prefix.length();
const QStringList visibleRoles = m_node->visibleRoles();
- for (const QString& visibleRole : visibleRoles) {
+ for (const QString &visibleRole : visibleRoles) {
if (visibleRole.startsWith(prefix)) {
const QByteArray role = visibleRole.right(visibleRole.length() - prefixLength).toLatin1();
if (role != "text") {
@@ -358,8 +357,7 @@ QList<QByteArray> ViewProperties::visibleRoles() const
// For the details view the size and date should be shown per default
// until the additional information has been explicitly changed by the user
const bool useDefaultValues = roles.count() == 1 // "text"
- && (m_node->viewMode() == DolphinView::DetailsView)
- && !visibleRoles.contains(CustomizedDetailsString);
+ && (m_node->viewMode() == DolphinView::DetailsView) && !visibleRoles.contains(CustomizedDetailsString);
if (useDefaultValues) {
roles.append("size");
roles.append("modificationtime");
@@ -368,7 +366,7 @@ QList<QByteArray> ViewProperties::visibleRoles() const
return roles;
}
-void ViewProperties::setHeaderColumnWidths(const QList<int>& widths)
+void ViewProperties::setHeaderColumnWidths(const QList<int> &widths)
{
if (m_node->headerColumnWidths() != widths) {
m_node->setHeaderColumnWidths(widths);
@@ -381,7 +379,7 @@ QList<int> ViewProperties::headerColumnWidths() const
return m_node->headerColumnWidths();
}
-void ViewProperties::setDirProperties(const ViewProperties& props)
+void ViewProperties::setDirProperties(const ViewProperties &props)
{
setViewMode(props.viewMode());
setPreviewsShown(props.previewsShown());
@@ -428,7 +426,7 @@ bool ViewProperties::exist() const
return QFile::exists(file);
}
-QString ViewProperties::destinationDir(const QString& subDir) const
+QString ViewProperties::destinationDir(const QString &subDir) const
{
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
path.append("/view_properties/").append(subDir);
@@ -440,10 +438,17 @@ QString ViewProperties::viewModePrefix() const
QString prefix;
switch (m_node->viewMode()) {
- case DolphinView::IconsView: prefix = QStringLiteral("Icons_"); break;
- case DolphinView::CompactView: prefix = QStringLiteral("Compact_"); break;
- case DolphinView::DetailsView: prefix = QStringLiteral("Details_"); break;
- default: qCWarning(DolphinDebug) << "Unknown view-mode of the view properties";
+ case DolphinView::IconsView:
+ prefix = QStringLiteral("Icons_");
+ break;
+ case DolphinView::CompactView:
+ prefix = QStringLiteral("Compact_");
+ break;
+ case DolphinView::DetailsView:
+ prefix = QStringLiteral("Details_");
+ break;
+ default:
+ qCWarning(DolphinDebug) << "Unknown view-mode of the view properties";
}
return prefix;
@@ -460,7 +465,7 @@ void ViewProperties::convertAdditionalInfo()
// the internal role. One special-case must be handled: "LinkDestination"
// has been used for "destination".
visibleRoles.reserve(visibleRoles.count() + additionalInfo.count());
- for (const QString& info : additionalInfo) {
+ for (const QString &info : additionalInfo) {
QString visibleRole = info;
int index = visibleRole.indexOf('_');
if (index >= 0 && index + 1 < visibleRole.length()) {
@@ -525,7 +530,7 @@ void ViewProperties::convertDateRoleToModificationTimeRole()
update();
}
-bool ViewProperties::isPartOfHome(const QString& filePath)
+bool ViewProperties::isPartOfHome(const QString &filePath)
{
// For performance reasons cache the path in a static QString
// (see QDir::homePath() for more details)
@@ -538,7 +543,7 @@ bool ViewProperties::isPartOfHome(const QString& filePath)
return filePath.startsWith(homePath);
}
-QString ViewProperties::directoryHashForUrl(const QUrl& url)
+QString ViewProperties::directoryHashForUrl(const QUrl &url)
{
const QByteArray hashValue = QCryptographicHash::hash(url.toEncoded(), QCryptographicHash::Sha1);
QString hashString = hashValue.toBase64();
diff --git a/src/views/viewproperties.h b/src/views/viewproperties.h
index def8aa738..29827c38b 100644
--- a/src/views/viewproperties.h
+++ b/src/views/viewproperties.h
@@ -38,7 +38,7 @@ class ViewPropertySettings;
class DOLPHIN_EXPORT ViewProperties
{
public:
- explicit ViewProperties(const QUrl& url);
+ explicit ViewProperties(const QUrl &url);
virtual ~ViewProperties();
void setViewMode(DolphinView::Mode mode);
@@ -53,7 +53,7 @@ public:
void setGroupedSorting(bool grouped);
bool groupedSorting() const;
- void setSortRole(const QByteArray& role);
+ void setSortRole(const QByteArray &role);
QByteArray sortRole() const;
void setSortOrder(Qt::SortOrder sortOrder);
@@ -70,7 +70,7 @@ public:
* Note that the additional-info property is the only property where
* the value is dependent from another property (in this case the view-mode).
*/
- void setVisibleRoles(const QList<QByteArray>& info);
+ void setVisibleRoles(const QList<QByteArray> &info);
/**
* Returns the additional information for the current set view-mode.
@@ -79,7 +79,7 @@ public:
*/
QList<QByteArray> visibleRoles() const;
- void setHeaderColumnWidths(const QList<int>& widths);
+ void setHeaderColumnWidths(const QList<int> &widths);
QList<int> headerColumnWidths() const;
/**
@@ -87,7 +87,7 @@ public:
* show hidden files, sorting and sort order like
* set in \a props.
*/
- void setDirProperties(const ViewProperties& props);
+ void setDirProperties(const ViewProperties &props);
/**
* If \a autoSave is true, the properties are automatically
@@ -122,7 +122,7 @@ private:
* properties are stored. \a subDir specifies the used sub
* directory.
*/
- QString destinationDir(const QString& subDir) const;
+ QString destinationDir(const QString &subDir) const;
/**
* Returns the view-mode prefix when storing additional properties for
@@ -153,7 +153,7 @@ private:
/**
* Returns true, if \a filePath is part of the home-path (see QDir::homePath()).
*/
- static bool isPartOfHome(const QString& filePath);
+ static bool isPartOfHome(const QString &filePath);
/**
* @return A hash-value for an URL that can be used as directory name.
@@ -167,7 +167,7 @@ private:
bool m_changedProps;
bool m_autoSave;
QString m_filePath;
- ViewPropertySettings* m_node;
+ ViewPropertySettings *m_node;
};
#endif
diff --git a/src/views/zoomlevelinfo.cpp b/src/views/zoomlevelinfo.cpp
index 6e499967a..2ad8711df 100644
--- a/src/views/zoomlevelinfo.cpp
+++ b/src/views/zoomlevelinfo.cpp
@@ -24,26 +24,48 @@ int ZoomLevelInfo::iconSizeForZoomLevel(int level)
{
int size = KIconLoader::SizeMedium;
switch (level) {
- case 0: size = KIconLoader::SizeSmall; break;
- case 1: size = KIconLoader::SizeSmallMedium; break;
- case 2: size = KIconLoader::SizeMedium; break;
- case 3: size = KIconLoader::SizeLarge; break;
- case 4: size = KIconLoader::SizeHuge; break;
- default: size = KIconLoader::SizeHuge + ((level - 4) << 4);
+ case 0:
+ size = KIconLoader::SizeSmall;
+ break;
+ case 1:
+ size = KIconLoader::SizeSmallMedium;
+ break;
+ case 2:
+ size = KIconLoader::SizeMedium;
+ break;
+ case 3:
+ size = KIconLoader::SizeLarge;
+ break;
+ case 4:
+ size = KIconLoader::SizeHuge;
+ break;
+ default:
+ size = KIconLoader::SizeHuge + ((level - 4) << 4);
}
return size;
}
-int ZoomLevelInfo::zoomLevelForIconSize(const QSize& size)
+int ZoomLevelInfo::zoomLevelForIconSize(const QSize &size)
{
int level = 0;
switch (size.height()) {
- case KIconLoader::SizeSmall: level = 0; break;
- case KIconLoader::SizeSmallMedium: level = 1; break;
- case KIconLoader::SizeMedium: level = 2; break;
- case KIconLoader::SizeLarge: level = 3; break;
- case KIconLoader::SizeHuge: level = 4; break;
- default: level = 4 + ((size.height() - KIconLoader::SizeHuge) >> 4);
+ case KIconLoader::SizeSmall:
+ level = 0;
+ break;
+ case KIconLoader::SizeSmallMedium:
+ level = 1;
+ break;
+ case KIconLoader::SizeMedium:
+ level = 2;
+ break;
+ case KIconLoader::SizeLarge:
+ level = 3;
+ break;
+ case KIconLoader::SizeHuge:
+ level = 4;
+ break;
+ default:
+ level = 4 + ((size.height() - KIconLoader::SizeHuge) >> 4);
}
return level;
}
diff --git a/src/views/zoomlevelinfo.h b/src/views/zoomlevelinfo.h
index 956584826..2d444eaf0 100644
--- a/src/views/zoomlevelinfo.h
+++ b/src/views/zoomlevelinfo.h
@@ -13,7 +13,8 @@ class QSize;
* @short Helper class for getting information about the zooming
* capabilities.
*/
-class ZoomLevelInfo {
+class ZoomLevelInfo
+{
public:
static int minimumLevel();
static int maximumLevel();
@@ -32,7 +33,7 @@ public:
* is between the range ZoomLevelInfo::minimumLevel() and
* ZoomLevelInfo::maximumLevel().
*/
- static int zoomLevelForIconSize(const QSize& size);
+ static int zoomLevelForIconSize(const QSize &size);
};
#endif