mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Fix a bunch of clazy warnings
This commit is contained in:
parent
a55bba67bc
commit
079f903bc8
|
@ -7,7 +7,6 @@
|
||||||
#include "dolphincontextmenu.h"
|
#include "dolphincontextmenu.h"
|
||||||
|
|
||||||
#include "dolphin_contextmenusettings.h"
|
#include "dolphin_contextmenusettings.h"
|
||||||
#include "dolphin_generalsettings.h"
|
|
||||||
#include "dolphinmainwindow.h"
|
#include "dolphinmainwindow.h"
|
||||||
#include "dolphinnewfilemenu.h"
|
#include "dolphinnewfilemenu.h"
|
||||||
#include "dolphinplacesmodelsingleton.h"
|
#include "dolphinplacesmodelsingleton.h"
|
||||||
|
@ -16,7 +15,6 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "trash/dolphintrash.h"
|
#include "trash/dolphintrash.h"
|
||||||
#include "views/dolphinview.h"
|
#include "views/dolphinview.h"
|
||||||
#include "views/viewmodecontroller.h"
|
|
||||||
|
|
||||||
#include <KActionCollection>
|
#include <KActionCollection>
|
||||||
#include <KFileItemListProperties>
|
#include <KFileItemListProperties>
|
||||||
|
|
|
@ -1144,7 +1144,8 @@ void DolphinMainWindow::openTerminalHere()
|
||||||
{
|
{
|
||||||
QList<QUrl> urls = {};
|
QList<QUrl> urls = {};
|
||||||
|
|
||||||
for (const KFileItem &item : m_activeViewContainer->view()->selectedItems()) {
|
const auto selectedItems = m_activeViewContainer->view()->selectedItems();
|
||||||
|
for (const KFileItem &item : selectedItems) {
|
||||||
QUrl url = item.targetUrl();
|
QUrl url = item.targetUrl();
|
||||||
if (item.isFile()) {
|
if (item.isFile()) {
|
||||||
url.setPath(QFileInfo(url.path()).absolutePath());
|
url.setPath(QFileInfo(url.path()).absolutePath());
|
||||||
|
@ -1174,7 +1175,7 @@ void DolphinMainWindow::openTerminalHere()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QUrl &url : urls) {
|
for (const QUrl &url : std::as_const(urls)) {
|
||||||
openTerminalJob(url);
|
openTerminalJob(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ class DolphinPart : public KParts::ReadOnlyPart
|
||||||
// Used by konqueror. Technically it means "we want undo enabled if
|
// Used by konqueror. Technically it means "we want undo enabled if
|
||||||
// there are things in the undo history and the current part is a dolphin part".
|
// there are things in the undo history and the current part is a dolphin part".
|
||||||
// Even though it's konqueror doing the undo...
|
// Even though it's konqueror doing the undo...
|
||||||
Q_PROPERTY(bool supportsUndo READ supportsUndo)
|
Q_PROPERTY(bool supportsUndo READ supportsUndo CONSTANT)
|
||||||
|
|
||||||
Q_PROPERTY(QString currentViewMode READ currentViewMode WRITE setCurrentViewMode)
|
Q_PROPERTY(QString currentViewMode READ currentViewMode WRITE setCurrentViewMode)
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,9 @@ public Q_SLOTS:
|
||||||
* Opens a new tab in the background showing the URL \a primaryUrl and the
|
* Opens a new tab in the background showing the URL \a primaryUrl and the
|
||||||
* optional URL \a secondaryUrl.
|
* optional URL \a secondaryUrl.
|
||||||
*/
|
*/
|
||||||
void openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl = QUrl(), NewTabPosition position = NewTabPosition::FollowSetting);
|
void openNewTab(const QUrl &primaryUrl,
|
||||||
|
const QUrl &secondaryUrl = QUrl(),
|
||||||
|
DolphinTabWidget::NewTabPosition position = DolphinTabWidget::NewTabPosition::FollowSetting);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens each directory in \p dirs in a separate tab unless it is already open.
|
* Opens each directory in \p dirs in a separate tab unless it is already open.
|
||||||
|
|
|
@ -49,11 +49,8 @@ class QTouchEvent;
|
||||||
class DOLPHIN_EXPORT KItemListController : public QObject
|
class DOLPHIN_EXPORT KItemListController : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(KItemModelBase *model READ model WRITE setModel)
|
Q_PROPERTY(KItemModelBase *model READ model WRITE setModel NOTIFY modelChanged)
|
||||||
Q_PROPERTY(KItemListView *view READ view WRITE setView)
|
Q_PROPERTY(KItemListView *view READ view WRITE setView NOTIFY viewChanged)
|
||||||
Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior)
|
|
||||||
Q_PROPERTY(AutoActivationBehavior autoActivationBehavior READ autoActivationBehavior WRITE setAutoActivationBehavior)
|
|
||||||
Q_PROPERTY(MouseDoubleClickAction mouseDoubleClickAction READ mouseDoubleClickAction WRITE setMouseDoubleClickAction)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum SelectionBehavior { NoSelection, SingleSelection, MultiSelection };
|
enum SelectionBehavior { NoSelection, SingleSelection, MultiSelection };
|
||||||
|
|
|
@ -53,8 +53,8 @@ class DOLPHIN_EXPORT KItemListView : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(qreal scrollOffset READ scrollOffset WRITE setScrollOffset)
|
Q_PROPERTY(qreal scrollOffset READ scrollOffset WRITE setScrollOffset NOTIFY scrollOffsetChanged)
|
||||||
Q_PROPERTY(qreal itemOffset READ itemOffset WRITE setItemOffset)
|
Q_PROPERTY(qreal itemOffset READ itemOffset WRITE setItemOffset NOTIFY itemOffsetChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KItemListView(QGraphicsWidget *parent = nullptr);
|
explicit KItemListView(QGraphicsWidget *parent = nullptr);
|
||||||
|
|
|
@ -136,7 +136,7 @@ void KItemListHeaderWidget::setSidePadding(qreal width)
|
||||||
{
|
{
|
||||||
if (m_sidePadding != width) {
|
if (m_sidePadding != width) {
|
||||||
m_sidePadding = width;
|
m_sidePadding = width;
|
||||||
sidePaddingChanged(width);
|
Q_EMIT sidePaddingChanged(width);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
class DOLPHIN_EXPORT KItemListRubberBand : public QObject
|
class DOLPHIN_EXPORT KItemListRubberBand : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QPointF endPosition MEMBER m_endPos READ endPosition WRITE setEndPosition)
|
Q_PROPERTY(QPointF endPosition MEMBER m_endPos READ endPosition WRITE setEndPosition NOTIFY endPositionChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KItemListRubberBand(QObject *parent = nullptr);
|
explicit KItemListRubberBand(QObject *parent = nullptr);
|
||||||
|
|
|
@ -49,7 +49,7 @@ QStringList splitOutsideQuotes(const QString &text)
|
||||||
// - Groups with two leading quotes must close both on them (filename:""abc xyz" tuv")
|
// - Groups with two leading quotes must close both on them (filename:""abc xyz" tuv")
|
||||||
// - Groups enclosed in quotes
|
// - Groups enclosed in quotes
|
||||||
// - Words separated by spaces
|
// - Words separated by spaces
|
||||||
const QRegularExpression subTermsRegExp("(\\S*?\"\"[^\"]+\"[^\"]+\"+|\\S*?\"[^\"]+\"+|(?<=\\s|^)\\S+(?=\\s|$))");
|
static const QRegularExpression subTermsRegExp("(\\S*?\"\"[^\"]+\"[^\"]+\"+|\\S*?\"[^\"]+\"+|(?<=\\s|^)\\S+(?=\\s|$))");
|
||||||
auto subTermsMatchIterator = subTermsRegExp.globalMatch(text);
|
auto subTermsMatchIterator = subTermsRegExp.globalMatch(text);
|
||||||
|
|
||||||
QStringList textParts;
|
QStringList textParts;
|
||||||
|
|
|
@ -46,7 +46,7 @@ void BackgroundColorHelper::controlBackgroundColor(QWidget *widget)
|
||||||
BackgroundColorHelper::BackgroundColorHelper()
|
BackgroundColorHelper::BackgroundColorHelper()
|
||||||
{
|
{
|
||||||
updateBackgroundColor();
|
updateBackgroundColor();
|
||||||
QObject::connect(qApp, &QGuiApplication::paletteChanged, [=]() {
|
QObject::connect(qApp, &QGuiApplication::paletteChanged, qApp, [=]() {
|
||||||
slotPaletteChanged();
|
slotPaletteChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ void BottomBarContentsContainer::addCopyContents()
|
||||||
|
|
||||||
auto *copyButton = new QPushButton(this);
|
auto *copyButton = new QPushButton(this);
|
||||||
// We claim to have PasteContents already so triggering the copy action next won't instantly hide the bottom bar.
|
// We claim to have PasteContents already so triggering the copy action next won't instantly hide the bottom bar.
|
||||||
connect(copyButton, &QAbstractButton::clicked, [this]() {
|
connect(copyButton, &QAbstractButton::clicked, this, [this]() {
|
||||||
if (GeneralSettings::showPasteBarAfterCopying()) {
|
if (GeneralSettings::showPasteBarAfterCopying()) {
|
||||||
m_contents = BottomBar::Contents::PasteContents; // prevents hiding
|
m_contents = BottomBar::Contents::PasteContents; // prevents hiding
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ void BottomBarContentsContainer::addCopyContents()
|
||||||
// Connect the copy action as a second step.
|
// Connect the copy action as a second step.
|
||||||
m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Copy)), copyButton);
|
m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Copy)), copyButton);
|
||||||
// Finally connect the lambda that actually changes the contents to the PasteContents.
|
// Finally connect the lambda that actually changes the contents to the PasteContents.
|
||||||
connect(copyButton, &QAbstractButton::clicked, [this]() {
|
connect(copyButton, &QAbstractButton::clicked, this, [this]() {
|
||||||
if (GeneralSettings::showPasteBarAfterCopying()) {
|
if (GeneralSettings::showPasteBarAfterCopying()) {
|
||||||
resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because
|
resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because
|
||||||
// it instantly deletes the button and then the other slots won't be called.
|
// it instantly deletes the button and then the other slots won't be called.
|
||||||
|
@ -244,7 +244,7 @@ void BottomBarContentsContainer::addCutContents()
|
||||||
|
|
||||||
auto *cutButton = new QPushButton(this);
|
auto *cutButton = new QPushButton(this);
|
||||||
// We claim to have PasteContents already so triggering the cut action next won't instantly hide the bottom bar.
|
// We claim to have PasteContents already so triggering the cut action next won't instantly hide the bottom bar.
|
||||||
connect(cutButton, &QAbstractButton::clicked, [this]() {
|
connect(cutButton, &QAbstractButton::clicked, this, [this]() {
|
||||||
if (GeneralSettings::showPasteBarAfterCopying()) {
|
if (GeneralSettings::showPasteBarAfterCopying()) {
|
||||||
m_contents = BottomBar::Contents::PasteContents; // prevents hiding
|
m_contents = BottomBar::Contents::PasteContents; // prevents hiding
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ void BottomBarContentsContainer::addCutContents()
|
||||||
// Connect the cut action as a second step.
|
// Connect the cut action as a second step.
|
||||||
m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Cut)), cutButton);
|
m_mainAction = ActionWithWidget(m_actionCollection->action(KStandardAction::name(KStandardAction::Cut)), cutButton);
|
||||||
// Finally connect the lambda that actually changes the contents to the PasteContents.
|
// Finally connect the lambda that actually changes the contents to the PasteContents.
|
||||||
connect(cutButton, &QAbstractButton::clicked, [this]() {
|
connect(cutButton, &QAbstractButton::clicked, this, [this]() {
|
||||||
if (GeneralSettings::showPasteBarAfterCopying()) {
|
if (GeneralSettings::showPasteBarAfterCopying()) {
|
||||||
resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because
|
resetContents(BottomBar::Contents::PasteContents); // resetContents() needs to be connected last because
|
||||||
// it instantly deletes the button and then the other slots won't be called.
|
// it instantly deletes the button and then the other slots won't be called.
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "contextmenusettingspage.h"
|
#include "contextmenusettingspage.h"
|
||||||
|
|
||||||
#include "dolphin_contextmenusettings.h"
|
#include "dolphin_contextmenusettings.h"
|
||||||
#include "dolphin_generalsettings.h"
|
|
||||||
#include "dolphin_versioncontrolsettings.h"
|
#include "dolphin_versioncontrolsettings.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "settings/serviceitemdelegate.h"
|
#include "settings/serviceitemdelegate.h"
|
||||||
|
|
|
@ -32,9 +32,6 @@ public:
|
||||||
void applySettings() override;
|
void applySettings() override;
|
||||||
void restoreDefaults() override;
|
void restoreDefaults() override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void changed();
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
|
||||||
void slotDefaultSliderMoved(int value);
|
void slotDefaultSliderMoved(int value);
|
||||||
|
|
|
@ -22,7 +22,7 @@ DolphinItemListView::DolphinItemListView(QGraphicsWidget *parent)
|
||||||
: KFileItemListView(parent)
|
: KFileItemListView(parent)
|
||||||
, m_zoomLevel(0)
|
, m_zoomLevel(0)
|
||||||
{
|
{
|
||||||
updateFont();
|
DolphinItemListView::updateFont();
|
||||||
updateGridSize();
|
updateGridSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1419,6 +1419,14 @@ void DolphinView::slotItemCreated(const QUrl &url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DolphinView::onDirectoryLoadingCompleted()
|
||||||
|
{
|
||||||
|
// the model should now contain all the items created by the job
|
||||||
|
updateSelectionState();
|
||||||
|
m_selectJobCreatedItems = false;
|
||||||
|
m_selectedUrls.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void DolphinView::slotJobResult(KJob *job)
|
void DolphinView::slotJobResult(KJob *job)
|
||||||
{
|
{
|
||||||
if (job->error() && job->error() != KIO::ERR_USER_CANCELED) {
|
if (job->error() && job->error() != KIO::ERR_USER_CANCELED) {
|
||||||
|
@ -1434,21 +1442,7 @@ void DolphinView::slotJobResult(KJob *job)
|
||||||
updateSelectionState();
|
updateSelectionState();
|
||||||
if (!m_selectedUrls.isEmpty()) {
|
if (!m_selectedUrls.isEmpty()) {
|
||||||
// not all urls were found, the model may not be up to date
|
// not all urls were found, the model may not be up to date
|
||||||
// TODO KF6 replace with Qt::singleShotConnection
|
connect(m_model, &KFileItemModel::directoryLoadingCompleted, this, &DolphinView::onDirectoryLoadingCompleted, Qt::UniqueConnection);
|
||||||
QMetaObject::Connection *const connection = new QMetaObject::Connection;
|
|
||||||
*connection = connect(
|
|
||||||
m_model,
|
|
||||||
&KFileItemModel::directoryLoadingCompleted,
|
|
||||||
this,
|
|
||||||
[this, connection]() {
|
|
||||||
// the model should now contain all the items created by the job
|
|
||||||
updateSelectionState();
|
|
||||||
m_selectJobCreatedItems = false;
|
|
||||||
m_selectedUrls.clear();
|
|
||||||
QObject::disconnect(*connection);
|
|
||||||
delete connection;
|
|
||||||
},
|
|
||||||
Qt::UniqueConnection);
|
|
||||||
} else {
|
} else {
|
||||||
m_selectJobCreatedItems = false;
|
m_selectJobCreatedItems = false;
|
||||||
m_selectedUrls.clear();
|
m_selectedUrls.clear();
|
||||||
|
|
|
@ -824,6 +824,8 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void slotTwoClicksRenamingTimerTimeout();
|
void slotTwoClicksRenamingTimerTimeout();
|
||||||
|
|
||||||
|
void onDirectoryLoadingCompleted();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadDirectory(const QUrl &url, bool reload = false);
|
void loadDirectory(const QUrl &url, bool reload = false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue