┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kitemlistwidget.cpp5
-rw-r--r--src/kitemviews/kitemlistwidget.h5
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp5
-rw-r--r--src/kitemviews/private/kitemlistsmoothscroller.cpp2
-rw-r--r--src/search/bar.h2
-rw-r--r--src/search/chip.h2
-rw-r--r--src/search/popup.h2
-rw-r--r--src/search/selectors/dateselector.h2
-rw-r--r--src/search/selectors/filetypeselector.h2
-rw-r--r--src/search/selectors/minimumratingselector.h2
-rw-r--r--src/search/selectors/tagsselector.cpp6
-rw-r--r--src/search/selectors/tagsselector.h2
-rw-r--r--src/search/widgetmenu.cpp4
-rw-r--r--src/settings/interface/folderstabssettingspage.cpp3
-rw-r--r--src/statusbar/diskspaceusagemenu.cpp4
-rw-r--r--src/tests/dolphinmainwindowtest.cpp27
-rw-r--r--src/tests/kitemlistcontrollertest.cpp1
-rw-r--r--src/views/dolphinview.cpp2
-rw-r--r--src/views/dolphinviewactionhandler.cpp3
19 files changed, 42 insertions, 39 deletions
diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp
index dac5ac296..baf244572 100644
--- a/src/kitemviews/kitemlistwidget.cpp
+++ b/src/kitemviews/kitemlistwidget.cpp
@@ -98,6 +98,11 @@ QHash<QByteArray, QVariant> KItemListWidget::data() const
return m_data;
}
+QVariant KItemListWidget::value(const QByteArray &key) const
+{
+ return m_data.value(key);
+}
+
void KItemListWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option)
diff --git a/src/kitemviews/kitemlistwidget.h b/src/kitemviews/kitemlistwidget.h
index e254292c0..0e07d7ab5 100644
--- a/src/kitemviews/kitemlistwidget.h
+++ b/src/kitemviews/kitemlistwidget.h
@@ -52,8 +52,6 @@ class DOLPHIN_EXPORT KItemListWidget : public QGraphicsWidget
{
Q_OBJECT
- Q_PROPERTY(int iconSize READ iconSize WRITE setIconSize)
-
public:
KItemListWidget(KItemListWidgetInformant *informant, QGraphicsItem *parent);
~KItemListWidget() override;
@@ -63,6 +61,7 @@ public:
void setData(const QHash<QByteArray, QVariant> &data, const QSet<QByteArray> &roles = QSet<QByteArray>());
QHash<QByteArray, QVariant> data() const;
+ QVariant value(const QByteArray &key) const;
/**
* Draws the hover-rectangle if the item is hovered. Overwrite this method
@@ -251,8 +250,6 @@ private:
void drawItemStyleOption(QPainter *painter, QWidget *widget, QStyle::State styleState);
private:
- Q_PROPERTY(qreal hoverOpacity READ hoverOpacity WRITE setHoverOpacity)
-
KItemListWidgetInformant *m_informant;
int m_index;
bool m_selected;
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index 729411c11..566c4dec2 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -647,7 +647,7 @@ void KStandardItemListWidget::startActivateSoonAnimation(int timeUntilActivation
m_activateSoonAnimation->setEndValue(1.0);
m_activateSoonAnimation->setDuration(timeUntilActivation);
- const QVariant originalIconName{data()["iconName"]};
+ const QVariant originalIconName{value("iconName")};
connect(m_activateSoonAnimation, &QVariantAnimation::valueChanged, this, [originalIconName, this](const QVariant &value) {
auto progress = value.toFloat();
@@ -682,7 +682,7 @@ void KStandardItemListWidget::startActivateSoonAnimation(int timeUntilActivation
bool KStandardItemListWidget::isIconControlledByActivateSoonAnimation() const
{
- return m_activateSoonAnimation && data()["iconName"] == "folder-open";
+ return m_activateSoonAnimation && value("iconName") == "folder-open";
}
KItemListWidgetInformant *KStandardItemListWidget::createInformant()
@@ -1121,7 +1121,6 @@ void KStandardItemListWidget::updatePixmapCache()
// use a generic icon as fallback
iconName = QStringLiteral("unknown");
}
- const QStringList overlays = values["iconOverlays"].toStringList();
const bool hasFocus = scene()->views()[0]->parentWidget()->hasFocus();
m_pixmap = pixmapForIcon(iconName,
QSize(maxIconWidth, maxIconHeight),
diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp
index 0e7546044..14a280e33 100644
--- a/src/kitemviews/private/kitemlistsmoothscroller.cpp
+++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp
@@ -29,7 +29,7 @@ KItemListSmoothScroller::KItemListSmoothScroller(QScrollBar *scrollBar, QObject
KConfigGroup configGroup(globalConfig, QStringLiteral("KDE"));
updateAnimationDuration(configGroup.readEntry("SmoothScroll", true));
- QDBusConnection::sessionBus().connect(QStringLiteral(""),
+ QDBusConnection::sessionBus().connect(QString(),
QStringLiteral("/SmoothScroll"),
QStringLiteral("org.kde.SmoothScroll"),
QStringLiteral("notifyChange"),
diff --git a/src/search/bar.h b/src/search/bar.h
index e681b8a6e..e8a401748 100644
--- a/src/search/bar.h
+++ b/src/search/bar.h
@@ -141,7 +141,7 @@ private Q_SLOTS:
* @see UpdatableStateInterface::updateStateToMatch().
* @see commitCurrentConfiguration().
*/
- void slotConfigurationChanged(const DolphinQuery &searchConfiguration);
+ void slotConfigurationChanged(const Search::DolphinQuery &searchConfiguration);
/**
* Changes the m_searchConfiguration in response to the user editing the search term. If no further changes to the search term happen within a time limit,
diff --git a/src/search/chip.h b/src/search/chip.h
index 94e51968d..8cd1fce24 100644
--- a/src/search/chip.h
+++ b/src/search/chip.h
@@ -41,7 +41,7 @@ public:
Q_SIGNALS:
/** Is emitted whenever settings have changed and a new search might be necessary. */
- void configurationChanged(const DolphinQuery &dolphinQuery);
+ void configurationChanged(const Search::DolphinQuery &dolphinQuery);
protected:
void paintEvent(QPaintEvent *event) override;
diff --git a/src/search/popup.h b/src/search/popup.h
index 423c9dde6..5ebcc51a3 100644
--- a/src/search/popup.h
+++ b/src/search/popup.h
@@ -45,7 +45,7 @@ public:
Q_SIGNALS:
/** Is emitted whenever settings have changed and a new search might be necessary. */
- void configurationChanged(const DolphinQuery &dolphinQuery);
+ void configurationChanged(const Search::DolphinQuery &dolphinQuery);
/**
* Requests for @p message with the given @p messageType to be shown to the user in a non-modal way.
diff --git a/src/search/selectors/dateselector.h b/src/search/selectors/dateselector.h
index 99cecec06..860c65100 100644
--- a/src/search/selectors/dateselector.h
+++ b/src/search/selectors/dateselector.h
@@ -28,7 +28,7 @@ public:
Q_SIGNALS:
/** Is emitted whenever settings have changed and a new search might be necessary. */
- void configurationChanged(const DolphinQuery &dolphinQuery);
+ void configurationChanged(const Search::DolphinQuery &dolphinQuery);
private:
void updateState(const std::shared_ptr<const DolphinQuery> &dolphinQuery) override;
diff --git a/src/search/selectors/filetypeselector.h b/src/search/selectors/filetypeselector.h
index bfc827344..10e9ea5e5 100644
--- a/src/search/selectors/filetypeselector.h
+++ b/src/search/selectors/filetypeselector.h
@@ -26,7 +26,7 @@ public:
Q_SIGNALS:
/** Is emitted whenever settings have changed and a new search might be necessary. */
- void configurationChanged(const DolphinQuery &dolphinQuery);
+ void configurationChanged(const Search::DolphinQuery &dolphinQuery);
private:
void updateState(const std::shared_ptr<const DolphinQuery> &dolphinQuery) override;
diff --git a/src/search/selectors/minimumratingselector.h b/src/search/selectors/minimumratingselector.h
index 02364cd1a..f1c14cf6c 100644
--- a/src/search/selectors/minimumratingselector.h
+++ b/src/search/selectors/minimumratingselector.h
@@ -31,7 +31,7 @@ public:
Q_SIGNALS:
/** Is emitted whenever settings have changed and a new search might be necessary. */
- void configurationChanged(const DolphinQuery &dolphinQuery);
+ void configurationChanged(const Search::DolphinQuery &dolphinQuery);
private:
void updateState(const std::shared_ptr<const DolphinQuery> &dolphinQuery) override;
diff --git a/src/search/selectors/tagsselector.cpp b/src/search/selectors/tagsselector.cpp
index 95d7ff52a..d6efb9081 100644
--- a/src/search/selectors/tagsselector.cpp
+++ b/src/search/selectors/tagsselector.cpp
@@ -133,7 +133,8 @@ void TagsSelector::updateMenu(const std::shared_ptr<const DolphinQuery> &dolphin
menu()->hide(); // The menu needs to be hidden now, then updated, and then shown again.
}
// Delete all existing actions in the menu
- for (QAction *action : menu()->actions()) {
+ const auto actions = menu()->actions();
+ for (QAction *action : actions) {
action->deleteLater();
}
menu()->clear();
@@ -180,7 +181,8 @@ void TagsSelector::updateState(const std::shared_ptr<const DolphinQuery> &dolphi
setIcon(QIcon{}); // No icon for the empty state
setText(i18nc("@action:button Required tags for search results: None", "None"));
}
- for (const auto &tag : dolphinQuery->requiredTags()) {
+ const auto tags = dolphinQuery->requiredTags();
+ for (const auto &tag : tags) {
tagsList()->addTag(tag); // We add it just in case this tag is not (or no longer) available on the system. This way the UI always works as expected.
}
if (menu()->isVisible()) {
diff --git a/src/search/selectors/tagsselector.h b/src/search/selectors/tagsselector.h
index 386cbb924..9aeba908f 100644
--- a/src/search/selectors/tagsselector.h
+++ b/src/search/selectors/tagsselector.h
@@ -27,7 +27,7 @@ public:
Q_SIGNALS:
/** Is emitted whenever settings have changed and a new search might be necessary. */
- void configurationChanged(const DolphinQuery &dolphinQuery);
+ void configurationChanged(const Search::DolphinQuery &dolphinQuery);
private:
/**
diff --git a/src/search/widgetmenu.cpp b/src/search/widgetmenu.cpp
index 701a0ce9c..5624e2dfc 100644
--- a/src/search/widgetmenu.cpp
+++ b/src/search/widgetmenu.cpp
@@ -41,7 +41,7 @@ void WidgetMenu::mouseReleaseEvent(QMouseEvent *event)
void WidgetMenu::resizeToFitContents()
{
- auto *widgetAction = static_cast<QWidgetAction *>(actions().first());
+ auto *widgetAction = static_cast<QWidgetAction *>(actions().constFirst());
auto focusedChildWidget = QApplication::focusWidget();
if (!widgetAction->defaultWidget()->isAncestorOf(focusedChildWidget)) {
focusedChildWidget = nullptr;
@@ -60,7 +60,7 @@ void WidgetMenu::resizeToFitContents()
void WidgetMenu::showEvent(QShowEvent *event)
{
if (!event->spontaneous()) {
- auto widgetAction = static_cast<QWidgetAction *>(actions().first());
+ auto widgetAction = static_cast<QWidgetAction *>(actions().constFirst());
widgetAction->defaultWidget()->setFocus();
}
QMenu::showEvent(event);
diff --git a/src/settings/interface/folderstabssettingspage.cpp b/src/settings/interface/folderstabssettingspage.cpp
index c4bc0d740..0e6c1aaab 100644
--- a/src/settings/interface/folderstabssettingspage.cpp
+++ b/src/settings/interface/folderstabssettingspage.cpp
@@ -248,7 +248,8 @@ void FoldersTabsSettingsPage::useCurrentLocation()
{
#ifndef IS_KCM
DolphinMainWindow *mainWindow = nullptr;
- for (const auto widget : QApplication::topLevelWidgets()) {
+ const auto topLevelsWidgets = QApplication::topLevelWidgets();
+ for (const auto widget : topLevelsWidgets) {
mainWindow = qobject_cast<DolphinMainWindow *>(widget);
if (mainWindow) {
break;
diff --git a/src/statusbar/diskspaceusagemenu.cpp b/src/statusbar/diskspaceusagemenu.cpp
index e750a70e6..ef5a005b6 100644
--- a/src/statusbar/diskspaceusagemenu.cpp
+++ b/src/statusbar/diskspaceusagemenu.cpp
@@ -130,8 +130,8 @@ void DiskSpaceUsageMenu::updateMenu()
void DiskSpaceUsageMenu::showEvent(QShowEvent *event)
{
- if (!event->spontaneous()) {
- auto widgetAction = qobject_cast<QWidgetAction *>(actions().first());
+ if (!event->spontaneous() && !actions().isEmpty()) {
+ auto widgetAction = qobject_cast<QWidgetAction *>(*actions().constBegin());
if (widgetAction) {
widgetAction->defaultWidget()->setFocus();
}
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index 4ae36e7e6..b3e52ce23 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -154,20 +154,20 @@ void DolphinMainWindowTest::testSyncDesktopAndPhoneUi()
do {
QVERIFY2(desktopUiElement.tagName() == phoneUiElement.tagName(),
qPrintable(QStringLiteral("Node mismatch: dolphinui.rc/%1::%2 and dolphinuiforphones.rc/%3::%4")
- .arg(desktopUiElement.parentNode().toElement().tagName())
- .arg(desktopUiElement.tagName())
- .arg(phoneUiElement.parentNode().toElement().tagName())
- .arg(phoneUiElement.tagName())));
+ .arg(desktopUiElement.parentNode().toElement().tagName(),
+ desktopUiElement.tagName(),
+ phoneUiElement.parentNode().toElement().tagName(),
+ phoneUiElement.tagName())));
QCOMPARE(desktopUiElement.text(), phoneUiElement.text());
const auto desktopUiElementAttributes = desktopUiElement.attributes();
const auto phoneUiElementAttributes = phoneUiElement.attributes();
for (int i = 0; i < desktopUiElementAttributes.count(); i++) {
QVERIFY2(phoneUiElementAttributes.count() >= i,
qPrintable(QStringLiteral("Attribute mismatch: dolphinui.rc/%1::%2 has more attributes than dolphinuiforphones.rc/%3::%4")
- .arg(desktopUiElement.parentNode().toElement().tagName())
- .arg(desktopUiElement.tagName())
- .arg(phoneUiElement.parentNode().toElement().tagName())
- .arg(phoneUiElement.tagName())));
+ .arg(desktopUiElement.parentNode().toElement().tagName(),
+ desktopUiElement.tagName(),
+ phoneUiElement.parentNode().toElement().tagName(),
+ phoneUiElement.tagName())));
if (exceptions.count(desktopUiElementAttributes.item(i).nodeName())) {
continue;
}
@@ -177,12 +177,11 @@ void DolphinMainWindowTest::testSyncDesktopAndPhoneUi()
}
QVERIFY2(desktopUiElementAttributes.count() == phoneUiElementAttributes.count(),
qPrintable(QStringLiteral("Attribute mismatch: dolphinui.rc/%1::%2 has fewer attributes than dolphinuiforphones.rc/%3::%4. %5 < %6")
- .arg(desktopUiElement.parentNode().toElement().tagName())
- .arg(desktopUiElement.tagName())
- .arg(phoneUiElement.parentNode().toElement().tagName())
- .arg(phoneUiElement.tagName())
- .arg(phoneUiElementAttributes.count())
- .arg(desktopUiElementAttributes.count())));
+ .arg(desktopUiElement.parentNode().toElement().tagName(),
+ desktopUiElement.tagName(),
+ phoneUiElement.parentNode().toElement().tagName(),
+ phoneUiElement.tagName())
+ .arg(phoneUiElementAttributes.count(), desktopUiElementAttributes.count())));
desktopUiElement = nextUiElement(desktopUiElement);
phoneUiElement = nextUiElement(phoneUiElement);
diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp
index b05f4b23d..e9e1e66c2 100644
--- a/src/tests/kitemlistcontrollertest.cpp
+++ b/src/tests/kitemlistcontrollertest.cpp
@@ -505,7 +505,6 @@ void KItemListControllerTest::testKeyboardNavigationMultiSelection_data()
const Qt::Key previousRowKey = Qt::Key_Up;
const Qt::LayoutDirection layoutDirection = Qt::LeftToRight;
- const KItemListController::SelectionBehavior &selectionBehavior = KItemListController::MultiSelection;
const bool groupingEnabled = false;
QList<QPair<KeyPress, ViewState>> testList;
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index ee7ac51d2..0afa27d73 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -1883,7 +1883,7 @@ void DolphinView::selectNextItem()
Q_ASSERT_X(false, "DolphinView", "Selecting the next item failed.");
return;
}
- const auto lastSelectedIndex = m_model->index(selectedItems().last());
+ const auto lastSelectedIndex = m_model->index(*selectedItems().constEnd());
if (lastSelectedIndex < 0) {
Q_ASSERT_X(false, "DolphinView", "Selecting the next item failed.");
return;
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index 079cd22fd..ce698a178 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -364,7 +364,8 @@ void DolphinViewActionHandler::createActions(SelectionMode::ActionTextHelper *ac
viewSettings->setText(i18nc("@action:intoolbar", "View Settings"));
viewSettings->setWhatsThis(
xi18nc("@info:whatsthis View Settings Toolbutton", "This cycles through all view modes. The dropdown menu contains various view-related actions."));
- for (QAction *action : viewModeActions->actions()) {
+ const auto actions = viewModeActions->actions();
+ for (QAction *action : actions) {
viewSettings->addAction(action);
}
viewSettings->addSeparator();