m_systemBookmarksIndexes(),
m_bookmarkedItems(),
m_hiddenItemToRemove(-1),
- m_saveBookmarksTimer(0),
m_updateBookmarksTimer(0),
m_storageSetupInProgress()
{
const int syncBookmarksTimeout = 100;
- m_saveBookmarksTimer = new QTimer(this);
- m_saveBookmarksTimer->setInterval(syncBookmarksTimeout);
- m_saveBookmarksTimer->setSingleShot(true);
- connect(m_saveBookmarksTimer, SIGNAL(timeout()), this, SLOT(saveBookmarks()));
-
m_updateBookmarksTimer = new QTimer(this);
m_updateBookmarksTimer->setInterval(syncBookmarksTimeout);
m_updateBookmarksTimer->setSingleShot(true);
m_bookmarkedItems.insert(bookmarkIndex, 0);
}
- triggerBookmarksSaving();
-
#ifdef PLACESITEMMODEL_DEBUG
kDebug() << "Inserted item" << index;
showModelState();
Q_ASSERT(!m_bookmarkedItems[boomarkIndex]);
m_bookmarkedItems.removeAt(boomarkIndex);
- triggerBookmarksSaving();
-
#ifdef PLACESITEMMODEL_DEBUG
kDebug() << "Removed item" << index;
showModelState();
QTimer::singleShot(0, this, SLOT(hideItem()));
}
}
-
- triggerBookmarksSaving();
}
void PlacesItemModel::slotDeviceAdded(const QString& udi)
// 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-" +
static KUrl convertedUrl(const KUrl& url);
virtual void clear();
+
+ /**
+ * 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);
*/
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;
*/
void hideItem(int index);
- /**
- * Triggers a delayed saving of bookmarks by starting
- * m_saveBookmarksTimer.
- */
- void triggerBookmarksSaving();
-
QString internalMimeType() const;
/**
// removing an item is not allowed.
int m_hiddenItemToRemove;
- QTimer* m_saveBookmarksTimer;
QTimer* m_updateBookmarksTimer;
QHash<QObject*, int> m_storageSetupInProgress;
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.
void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
{
m_model->dropMimeDataBefore(index, event->mimeData());
+ m_model->saveBookmarks();
}
void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent)
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;
oldItem->setText(dialog->text());
oldItem->setUrl(dialog->url());
oldItem->setIcon(dialog->icon());
+ m_model->saveBookmarks();
}
}