┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2015-02-19 20:34:35 +0100
committerEmmanuel Pescosta <[email protected]>2015-02-19 20:34:35 +0100
commit8679115552ec65ccfc6cbc1db68414d80e3a081b (patch)
tree0d458ead5d254932fa5707ec8ca74cd2a5dd1ecc /src/panels
parent9221362ceaf695b02b316f88cbf27e1ba96c89db (diff)
parent1ef5434572d0289a160589395b8b80cd800bc195 (diff)
Merge branch 'master' into frameworks
Diffstat (limited to 'src/panels')
-rw-r--r--src/panels/places/placesitemmodel.cpp20
-rw-r--r--src/panels/places/placesitemmodel.h21
-rw-r--r--src/panels/places/placespanel.cpp5
3 files changed, 13 insertions, 33 deletions
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index 0f5854656..0a8fe9cb3 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -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)
@@ -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-" +
diff --git a/src/panels/places/placesitemmodel.h b/src/panels/places/placesitemmodel.h
index 38fcfe6af..aa8bb16fe 100644
--- a/src/panels/places/placesitemmodel.h
+++ b/src/panels/places/placesitemmodel.h
@@ -122,6 +122,14 @@ public:
static QUrl convertedUrl(const QUrl& url);
virtual void clear() Q_DECL_OVERRIDE;
+
+ /**
+ * Saves the bookmarks and indicates to other applications that the
+ * state of the bookmarks has been changed. Is only called by the
+ * timeout of m_saveBookmarksTimer to prevent unnecessary savings.
+ */
+ void saveBookmarks();
+
signals:
void errorMessage(const QString& message);
void storageSetupDone(int index, bool success);
@@ -145,12 +153,6 @@ private slots:
*/
void updateBookmarks();
- /**
- * Saves the bookmarks and indicates to other applications that the
- * state of the bookmarks has been changed. Is only called by the
- * timeout of m_saveBookmarksTimer to prevent unnecessary savings.
- */
- void saveBookmarks();
private:
struct SystemBookmarkData;
@@ -197,12 +199,6 @@ private:
*/
void hideItem(int index);
- /**
- * Triggers a delayed saving of bookmarks by starting
- * m_saveBookmarksTimer.
- */
- void triggerBookmarksSaving();
-
QString internalMimeType() const;
/**
@@ -285,7 +281,6 @@ private:
// removing an item is not allowed.
int m_hiddenItemToRemove;
- QTimer* m_saveBookmarksTimer;
QTimer* m_updateBookmarksTimer;
QHash<QObject*, int> m_storageSetupInProgress;
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 631b6b69d..5618cee21 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -286,8 +286,10 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
editEntry(index);
} else if (action == removeAction) {
m_model->removeItem(index);
+ m_model->saveBookmarks();
} else if (action == hideAction) {
item->setHidden(hideAction->isChecked());
+ m_model->saveBookmarks();
} else if (action == openInNewTabAction) {
// TriggerItem does set up the storage first and then it will
// emit the slotItemMiddleClicked signal, because of Qt::MiddleButton.
@@ -402,6 +404,7 @@ void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success)
void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
{
m_model->dropMimeDataBefore(index, event->mimeData());
+ m_model->saveBookmarks();
}
void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent)
@@ -463,6 +466,7 @@ void PlacesPanel::addEntry()
if (dialog->exec() == QDialog::Accepted) {
PlacesItem* item = m_model->createPlacesItem(dialog->text(), dialog->url(), dialog->icon());
m_model->appendItemToGroup(item);
+ m_model->saveBookmarks();
}
delete dialog;
@@ -484,6 +488,7 @@ void PlacesPanel::editEntry(int index)
oldItem->setText(dialog->text());
oldItem->setUrl(dialog->url());
oldItem->setIcon(dialog->icon());
+ m_model->saveBookmarks();
}
}