Kirigami2

smoothscrollwatcher.cpp
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 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"
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QDBusConnection sessionBus()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.