From 632389517ca496031bb1cbe468d904884961bf57 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 27 Mar 2010 19:04:11 +0100 Subject: - Fix a crash when the cancel button of the add bookmark menu is clicked - Use the same behaviour for delete bookmark as the toolbar - Some strings changed - Keep the selection of a folder when it's expanded/collapsed - Fix the name of some methods and properties - Code cleaned a bit --- src/bookmarks/bookmarkstreemodel.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/bookmarks/bookmarkstreemodel.cpp') diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index d63c92d3..836401a6 100644 --- a/src/bookmarks/bookmarkstreemodel.cpp +++ b/src/bookmarks/bookmarkstreemodel.cpp @@ -148,8 +148,9 @@ BookmarksTreeModel::BookmarksTreeModel(QObject *parent) , m_root(0) { resetModel(); - connect( this, SIGNAL(bookmarkChangedFinished()), parent, SLOT(callAutoExpand())); - connect( Application::bookmarkProvider()->bookmarkManager(), SIGNAL( changed(QString,QString) ), this, SLOT( bookmarksChanged(QString) ) ); + connect( this, SIGNAL(bookmarksUpdated()), parent, SLOT(loadFoldedState())); + connect( Application::bookmarkProvider()->bookmarkManager(), SIGNAL( changed(QString,QString) ), this, SLOT( bookmarksChanged() ) ); + connect( parent, SIGNAL(saveOnlyRequested()), this, SLOT(saveOnly()) ); } @@ -283,11 +284,10 @@ QVariant BookmarksTreeModel::data(const QModelIndex &index, int role) const } -void BookmarksTreeModel::bookmarksChanged( const QString &groupAddress ) +void BookmarksTreeModel::bookmarksChanged() { - Q_UNUSED(groupAddress); resetModel(); - emit bookmarkChangedFinished(); + emit bookmarksUpdated(); } @@ -336,6 +336,20 @@ KBookmark BookmarksTreeModel::bookmarkForIndex(const QModelIndex index) const } +void BookmarksTreeModel::saveOnly() +{ + disconnect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString,QString)), this, SLOT(bookmarksChanged())); + connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString,QString)), this, SLOT(reconnectManager())); + Application::bookmarkProvider()->bookmarkManager()->emitChanged(); +} + + +void BookmarksTreeModel::reconnectManager() +{ + connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL( changed(QString,QString) ), this, SLOT(bookmarksChanged())); +} + + Qt::DropActions BookmarksTreeModel::supportedDropActions () const { return Qt::MoveAction; -- cgit v1.2.1