1/*
2 * SPDX-FileCopyrightText: 2024 Nathan Misner <nathan@infochunk.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include "smoothscrollwatcher.h"
8
9#ifdef KIRIGAMI_ENABLE_DBUS
10#include <QDBusConnection>
11#endif
12
13#include "kirigamiplatform_logging.h"
14
15namespace Kirigami
16{
17namespace Platform
18{
19Q_GLOBAL_STATIC(SmoothScrollWatcher, smoothScrollWatcherSelf)
20
21SmoothScrollWatcher::SmoothScrollWatcher(QObject *parent)
22 : QObject(parent)
23{
24#ifdef KIRIGAMI_ENABLE_DBUS
25 QDBusConnection::sessionBus().connect(QStringLiteral(""),
26 QStringLiteral("/SmoothScroll"),
27 QStringLiteral("org.kde.SmoothScroll"),
28 QStringLiteral("notifyChange"),
29 receiver: this,
30 SLOT(setEnabled(bool)));
31#endif
32 m_enabled = true;
33}
34
35SmoothScrollWatcher::~SmoothScrollWatcher() = default;
36
37bool SmoothScrollWatcher::enabled() const
38{
39 return m_enabled;
40}
41
42SmoothScrollWatcher *SmoothScrollWatcher::self()
43{
44 return smoothScrollWatcherSelf();
45}
46
47void SmoothScrollWatcher::setEnabled(bool value)
48{
49 m_enabled = value;
50 Q_EMIT enabledChanged(value);
51}
52
53}
54}
55
56#include "moc_smoothscrollwatcher.cpp"
57

source code of kirigami/src/platform/smoothscrollwatcher.cpp