]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/places/placesitemmodel.cpp
Removed unused KGlobal includes and use KIO/Job instead of KIO/JobClasses
[dolphin.git] / src / panels / places / placesitemmodel.cpp
index cfe6d2e462dfdeb2d0ea97a4744d718df2737f3b..95a913e829aa98d78804e46ebd83c3fcec8f1bc8 100644 (file)
 #include <KBookmarkManager>
 #include <KDebug>
 #include <QIcon>
-#include <kprotocolinfo.h>
+#include <KProtocolInfo>
 #include <KLocalizedString>
 #include <KComponentData>
 #include <QStandardPaths>
 #include <KUser>
-#include <KGlobal>
+#include <KAboutData>
 #include "placesitem.h"
 #include <QAction>
 #include <QDate>
@@ -80,7 +80,6 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
     m_systemBookmarksIndexes(),
     m_bookmarkedItems(),
     m_hiddenItemToRemove(-1),
-    m_saveBookmarksTimer(0),
     m_updateBookmarksTimer(0),
     m_storageSetupInProgress()
 {
@@ -97,11 +96,6 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
 
     const int syncBookmarksTimeout = 100;
 
-    m_saveBookmarksTimer = new QTimer(this);
-    m_saveBookmarksTimer->setInterval(syncBookmarksTimeout);
-    m_saveBookmarksTimer->setSingleShot(true);
-    connect(m_saveBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::saveBookmarks);
-
     m_updateBookmarksTimer = new QTimer(this);
     m_updateBookmarksTimer->setInterval(syncBookmarksTimeout);
     m_updateBookmarksTimer->setSingleShot(true);
@@ -501,8 +495,6 @@ void PlacesItemModel::onItemInserted(int index)
         m_bookmarkedItems.insert(bookmarkIndex, 0);
     }
 
-    triggerBookmarksSaving();
-
 #ifdef PLACESITEMMODEL_DEBUG
     kDebug() << "Inserted item" << index;
     showModelState();
@@ -521,8 +513,6 @@ void PlacesItemModel::onItemRemoved(int index, KStandardItem* removedItem)
     Q_ASSERT(!m_bookmarkedItems[boomarkIndex]);
     m_bookmarkedItems.removeAt(boomarkIndex);
 
-    triggerBookmarksSaving();
-
 #ifdef PLACESITEMMODEL_DEBUG
     kDebug() << "Removed item" << index;
     showModelState();
@@ -552,8 +542,6 @@ void PlacesItemModel::onItemChanged(int index, const QSet<QByteArray>& changedRo
             QTimer::singleShot(0, this, SLOT(hideItem()));
         }
     }
-
-    triggerBookmarksSaving();
 }
 
 void PlacesItemModel::slotDeviceAdded(const QString& udi)
@@ -833,8 +821,8 @@ bool PlacesItemModel::acceptBookmark(const KBookmark& bookmark,
     const bool deviceAvailable = availableDevices.contains(udi);
 
     const bool allowedHere = (appName.isEmpty()
-                              || appName == KGlobal::mainComponent().componentName()
-                              || appName == KGlobal::mainComponent().componentName() + AppNamePrefix)
+                              || appName == KAboutData::applicationData().componentName()
+                              || appName == KAboutData::applicationData().componentName() + AppNamePrefix)
                              && (m_fileIndexingEnabled || (url.scheme() != QLatin1String("timeline") &&
                                                            url.scheme() != QLatin1String("search")));
 
@@ -853,7 +841,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da
         // As long as the KFilePlacesView from kdelibs is available, the system-bookmarks
         // for "Recently Saved" and "Search For" should be a setting available only
         // in the Places Panel (see description of AppNamePrefix for more details).
-        const QString appName = KGlobal::mainComponent().componentName() + AppNamePrefix;
+        const QString appName = KAboutData::applicationData().componentName() + AppNamePrefix;
         bookmark.setMetaDataItem("OnlyInApp", appName);
     }
 
@@ -1035,20 +1023,12 @@ void PlacesItemModel::hideItem(int index)
             // bookmark should still be remembered, so readd it again:
             m_bookmarkManager->root().addBookmark(hiddenBookmark);
             m_bookmarkManager->root().moveBookmark(hiddenBookmark, previousBookmark);
-            triggerBookmarksSaving();
         }
 
         m_bookmarkedItems.insert(newIndex, hiddenItem);
     }
 }
 
-void PlacesItemModel::triggerBookmarksSaving()
-{
-    if (m_saveBookmarksTimer) {
-        m_saveBookmarksTimer->start();
-    }
-}
-
 QString PlacesItemModel::internalMimeType() const
 {
     return "application/x-dolphinplacesmodel-" +