]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/private/kitemlistsmoothscroller.cpp
Clazy fix
[dolphin.git] / src / kitemviews / private / kitemlistsmoothscroller.cpp
index fd26d198f23b5c4a8dd22ccf0dec4ad9d71e18ea..14a280e33f7005a05829711ad6489fa622eddc5f 100644 (file)
@@ -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"),
@@ -56,6 +56,9 @@ QScrollBar *KItemListSmoothScroller::scrollBar() const
 
 void KItemListSmoothScroller::setTargetObject(QObject *target)
 {
+    if (m_animation->state() == QAbstractAnimation::Running) {
+        m_animation->stop();
+    }
     m_animation->setTargetObject(target);
 }
 
@@ -66,6 +69,9 @@ QObject *KItemListSmoothScroller::targetObject() const
 
 void KItemListSmoothScroller::setPropertyName(const QByteArray &propertyName)
 {
+    if (m_animation->state() == QAbstractAnimation::Running) {
+        m_animation->stop();
+    }
     m_animation->setPropertyName(propertyName);
 }
 
@@ -214,4 +220,12 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent *event)
     m_smoothScrolling = previous;
 }
 
+bool KItemListSmoothScroller::isAnimating()
+{
+    if (m_animation) {
+        return (m_animation->state() == QAbstractAnimation::Running);
+    }
+    return false;
+}
+
 #include "moc_kitemlistsmoothscroller.cpp"