]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/settings/services/servicessettingspage.cpp
Use a faster way to determine kio-stash isn't installed
[dolphin.git] / src / settings / services / servicessettingspage.cpp
index b1a59e0f4cb038f11d3e0a00fc5a7f62a9f7485e..fa064d8a13bf78fcb3126175157da2b30c6ced02 100644 (file)
@@ -1,21 +1,8 @@
-/***************************************************************************
- *   Copyright (C) 2009-2010 by Peter Penz <peter.penz19@gmail.com>        *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2009-2010 Peter Penz <peter.penz19@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #include "servicessettingspage.h"
 
@@ -36,6 +23,7 @@
 #include <QGridLayout>
 #include <QLabel>
 #include <QListWidget>
+#include <QScroller>
 #include <QShowEvent>
 #include <QSortFilterProxyModel>
 #include <QLineEdit>
@@ -69,6 +57,8 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
     });
 
     m_listView = new QListView(this);
+    QScroller::grabGesture(m_listView->viewport(), QScroller::TouchGesture);
+
     auto *delegate = new ServiceItemDelegate(m_listView, m_listView);
     m_serviceModel = new ServiceModel(this);
     m_sortModel = new QSortFilterProxyModel(this);
@@ -82,15 +72,25 @@ ServicesSettingsPage::ServicesSettingsPage(QWidget* parent) :
     m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);
     connect(m_listView, &QListView::clicked, this, &ServicesSettingsPage::changed);
 
+#ifndef Q_OS_WIN
     auto *downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."),
                                                   QStringLiteral("servicemenu.knsrc"),
                                                   this);
-    connect(downloadButton, &KNS3::Button::dialogFinished, this, &ServicesSettingsPage::loadServices);
+    connect(downloadButton, &KNS3::Button::dialogFinished, this, [this](const KNS3::Entry::List &changedEntries) {
+           if (!changedEntries.isEmpty()) {
+               m_serviceModel->clear();
+               loadServices();
+           }
+    });
+
+#endif
 
     topLayout->addWidget(label);
     topLayout->addWidget(m_searchLineEdit);
     topLayout->addWidget(m_listView);
+#ifndef Q_OS_WIN
     topLayout->addWidget(downloadButton);
+#endif
 
     m_enabledVcsPlugins = VersionControlSettings::enabledPlugins();
     std::sort(m_enabledVcsPlugins.begin(), m_enabledVcsPlugins.end());