From e40662f7a9769790acb07173201e603a267a6fc8 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Thu, 4 Jun 2015 13:55:13 -0500 Subject: [PATCH] Revert upstream kplaces sync fix ( +Date: Wed, 29 Apr 2015 16:02:02 +0200 +Subject: [PATCH 15/32] Remove bookmarks syncing from KFilePlacesModel and use + user-places.xbel only. + +FIXED-IN: 4.14.8 +BUG: 345174 +REVIEW: 123568 +--- + kfile/CMakeLists.txt | 1 - + kfile/kfileplacesmodel.cpp | 21 +-- + kfile/kfileplacessharedbookmarks.cpp | 276 ----------------------------------- + kfile/kfileplacessharedbookmarks_p.h | 56 ------- + 4 files changed, 3 insertions(+), 351 deletions(-) + delete mode 100644 kfile/kfileplacessharedbookmarks.cpp + delete mode 100644 kfile/kfileplacessharedbookmarks_p.h + +diff --git a/kfile/CMakeLists.txt b/kfile/CMakeLists.txt +index ceae140..e796908 100644 +--- a/kfile/CMakeLists.txt ++++ b/kfile/CMakeLists.txt +@@ -22,7 +22,6 @@ set(kfile_LIB_SRCS + kfilewidget.cpp + kfileplacesitem.cpp + kfileplacesmodel.cpp +- kfileplacessharedbookmarks.cpp + kfileplacesview.cpp + kfileplaceeditdialog.cpp + kfilepreviewgenerator.cpp +diff --git a/kfile/kfileplacesmodel.cpp b/kfile/kfileplacesmodel.cpp +index 24f95ad..a3ac9fb 100644 +--- a/kfile/kfileplacesmodel.cpp ++++ b/kfile/kfileplacesmodel.cpp +@@ -19,7 +19,6 @@ + */ + #include "kfileplacesmodel.h" + #include "kfileplacesitem_p.h" +-#include "kfileplacessharedbookmarks_p.h" + + #ifdef _WIN32_WCE + #include "Windows.h" +@@ -61,10 +60,9 @@ + class KFilePlacesModel::Private + { + public: +- Private(KFilePlacesModel *self) : q(self), bookmarkManager(0), sharedBookmarks(0) {} ++ Private(KFilePlacesModel *self) : q(self), bookmarkManager(0) {} + ~Private() + { +- delete sharedBookmarks; + qDeleteAll(items); + } + +@@ -76,7 +74,6 @@ public: + + Solid::Predicate predicate; + KBookmarkManager *bookmarkManager; +- KFilePlacesSharedBookmarks * sharedBookmarks; + + void reloadAndSignal(); + QList loadBookmarkList(); +@@ -93,8 +90,8 @@ public: + KFilePlacesModel::KFilePlacesModel(QObject *parent) + : QAbstractItemModel(parent), d(new Private(this)) + { +- const QString file = KStandardDirs::locateLocal("data", "kfileplaces/bookmarks.xml"); +- d->bookmarkManager = KBookmarkManager::managerForFile(file, "kfilePlaces"); ++ const QString file = KStandardDirs().localxdgdatadir() + "user-places.xbel"; ++ d->bookmarkManager = KBookmarkManager::managerForExternalFile(file); + + // Let's put some places in there if it's empty. We have a corner case here: + // Given you have bookmarked some folders (which have been saved on +@@ -146,9 +143,6 @@ KFilePlacesModel::KFilePlacesModel(QObject *parent) + d->bookmarkManager->saveAs(file); + } + +- // create after, so if we have own places, they are added afterwards, in case of equal priorities +- d->sharedBookmarks = new KFilePlacesSharedBookmarks(d->bookmarkManager); +- + QString predicate("[[[[ StorageVolume.ignored == false AND [ StorageVolume.usage == 'FileSystem' OR StorageVolume.usage == 'Encrypted' ]]" + " OR " + "[ IS StorageAccess AND StorageDrive.driveType == 'Floppy' ]]" +@@ -632,8 +626,6 @@ bool KFilePlacesModel::dropMimeData(const QMimeData *data, Qt::DropAction action + return false; + } + +- d->sharedBookmarks->updateSharedBookmarks(); +- + d->reloadAndSignal(); + + return true; +@@ -661,8 +653,6 @@ void KFilePlacesModel::addPlace(const QString &text, const KUrl &url, + d->bookmarkManager->root().moveBookmark(bookmark, item->bookmark()); + } + +- d->sharedBookmarks->updateSharedBookmarks(); +- + d->reloadAndSignal(); + } + +@@ -684,8 +674,6 @@ void KFilePlacesModel::editPlace(const QModelIndex &index, const QString &text, + bookmark.setIcon(iconName); + bookmark.setMetaDataItem("OnlyInApp", appName); + +- d->sharedBookmarks->updateSharedBookmarks(); +- + d->reloadAndSignal(); + emit dataChanged(index, index); + } +@@ -703,7 +691,6 @@ void KFilePlacesModel::removePlace(const QModelIndex &index) const + if (bookmark.isNull()) return; + + d->bookmarkManager->root().deleteBookmark(bookmark); +- d->sharedBookmarks->updateSharedBookmarks(); + d->reloadAndSignal(); + } + +@@ -719,8 +706,6 @@ void KFilePlacesModel::setPlaceHidden(const QModelIndex &index, bool hidden) + + bookmark.setMetaDataItem("IsHidden", (hidden ? "true" : "false")); + +- d->sharedBookmarks->updateSharedBookmarks(); +- + d->reloadAndSignal(); + emit dataChanged(index, index); + } +diff --git a/kfile/kfileplacessharedbookmarks.cpp b/kfile/kfileplacessharedbookmarks.cpp +deleted file mode 100644 +index 5385d42..0000000 +--- a/kfile/kfileplacessharedbookmarks.cpp ++++ /dev/null +@@ -1,276 +0,0 @@ +-/* This file is part of the KDE project +- Copyright (C) 2008 Norbert Frese +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Library General Public +- License version 2 as published by the Free Software Foundation. +- +- This library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Library General Public License for more details. +- +- You should have received a copy of the GNU Library General Public License +- along with this library; see the file COPYING.LIB. If not, write to +- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +- Boston, MA 02110-1301, USA. +- +-*/ +- +-#include "kfileplacessharedbookmarks_p.h" +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-//////////////// utility functions +- +-static bool compareBookmarks(const KBookmark & bookmark1, const KBookmark & bookmark2) +-{ +- return (bookmark1.url() == bookmark2.url() || bookmark1.text() == bookmark2.text()); +-} +- +-static bool deepCompareDomNodes(const QDomNode & node1, const QDomNode & node2) +-{ +- +- // compare name and value +- if (node1.nodeName() != node2.nodeName() || node1.nodeValue() != node2.nodeValue()) +- return false; +- +- // recursively compare children +- const QDomNodeList node1Children = node1.childNodes(); +- const QDomNodeList node2Children = node2.childNodes(); +- +- if (node1Children.count () != node2Children.count ()) +- return false; +- +- for (int i=0; iroot(); +- KBookmark bookmark = root.first(); +- +- KBookmarkGroup sharedRoot = m_sharedBookmarkManager->root(); +- KBookmark sharedBookmark = sharedRoot.first(); +- +- bool dirty = false; +- +- while (!bookmark.isNull()) { +- //kDebug() << "importing" << bookmark.text(); +- +- // skip over system items +- if (bookmark.metaDataItem("isSystemItem") == "true") { +- bookmark = root.next(bookmark); +- continue; +- } +- +- // do the bookmarks match? +- if (!sharedBookmark.isNull() && compareBookmarks(bookmark, sharedBookmark)) { +- //kDebug() << "excat comparing: targetbk:\n" << nodeAsString(bookmark.internalElement()) << "\nsourcbk:\n" << nodeAsString(sharedBookmark.internalElement()); +- +- if (!exactCompareBookmarks(bookmark, sharedBookmark)) { +- KBookmark cloneTarget=bookmark; +- KBookmark cloneSource = sharedBookmark; +- +- sharedBookmark = sharedRoot.next(sharedBookmark); +- bookmark = root.next(bookmark); +- +- //kDebug() << "cloning" << cloneSource.text(); +- //kDebug() << "cloning: target=\n" << nodeAsString(cloneTarget.internalElement()) << "\n source:\n" << nodeAsString(cloneSource.internalElement()); +- +- cloneBookmarkContents(cloneTarget, cloneSource); +- dirty = true; +- continue; +- } else { +- //kDebug() << "keeping" << bookmark.text(); +- } +- sharedBookmark = sharedRoot.next(sharedBookmark); +- bookmark = root.next(bookmark); +- continue; +- } +- +- // they don't match -> remove +- //kDebug() << "removing" << bookmark.text(); +- KBookmark bookmarkToRemove = bookmark; +- bookmark = root.next(bookmark); +- root.deleteBookmark(bookmarkToRemove); +- +- dirty = true; +- } +- +- // append the remaining shared bookmarks +- while(!sharedBookmark.isNull()) { +- root.addBookmark(cloneBookmark(sharedBookmark)); +- sharedBookmark = sharedRoot.next(sharedBookmark); +- dirty = true; +- } +- +- return dirty; +-} +- +-bool KFilePlacesSharedBookmarks::exportSharedBookmarks() +-{ +- KBookmarkGroup root = m_placesBookmarkManager->root(); +- KBookmark bookmark = root.first(); +- +- KBookmarkGroup sharedRoot = m_sharedBookmarkManager->root(); +- KBookmark sharedBookmark = sharedRoot.first(); +- +- bool dirty = false; +- +- // first check if they are the same +- int count=0; +- while (!bookmark.isNull()) { +- //kDebug() << "exporting..." << bookmark.text(); +- +- // skip over system items +- if (bookmark.metaDataItem("isSystemItem") == "true") { +- bookmark = root.next(bookmark); +- continue; +- } +- count++; +- +- // end of sharedBookmarks? +- if (sharedBookmark.isNull()) { +- dirty=true; +- break; +- } +- +- // do the bookmarks match? +- if (compareBookmarks(bookmark, sharedBookmark)) { +- if (!exactCompareBookmarks(bookmark, sharedBookmark)) { +- dirty = true; +- break; +- } +- } else { +- dirty=true; +- break; +- } +- sharedBookmark = sharedRoot.next(sharedBookmark); +- bookmark = root.next(bookmark); +- } +- +- //kDebug() << "dirty=" << dirty << " oldsize=" << bookmarkGroupSize(sharedRoot) << " count=" << count; +- +- if (bookmarkGroupSize(sharedRoot) != count) +- dirty=true; +- +- if (dirty) { +- emptyBookmarkGroup(sharedRoot); +- +- // append all bookmarks +- KBookmark bookmark = root.first(); +- +- while(!bookmark.isNull()) { +- +- if (bookmark.metaDataItem("isSystemItem") == "true") { +- bookmark = root.next(bookmark); +- continue; +- } +- +- sharedRoot.addBookmark(cloneBookmark(bookmark)); +- bookmark = root.next(bookmark); +- dirty = true; +- } +- } +- +- return dirty; +- +-} +- +-void KFilePlacesSharedBookmarks::slotSharedBookmarksChanged() +-{ +- //kDebug() << "shared bookmarks changed"; +- bool dirty = integrateSharedBookmarks(); +- if (dirty) m_placesBookmarkManager->emitChanged(); +-} +- +-void KFilePlacesSharedBookmarks::updateSharedBookmarks() +-{ +- //kDebug() << "places bookmarks changed"; +- bool dirty = exportSharedBookmarks(); +- if (dirty) m_sharedBookmarkManager->emitChanged(); +-} +- +-#include "kfileplacessharedbookmarks_p.moc" +diff --git a/kfile/kfileplacessharedbookmarks_p.h b/kfile/kfileplacessharedbookmarks_p.h +deleted file mode 100644 +index 654fe18..0000000 +--- a/kfile/kfileplacessharedbookmarks_p.h ++++ /dev/null +@@ -1,56 +0,0 @@ +-/* This file is part of the KDE project +- Copyright (C) 2008 Norbert Frese +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Library General Public +- License version 2 as published by the Free Software Foundation. +- +- This library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Library General Public License for more details. +- +- You should have received a copy of the GNU Library General Public License +- along with this library; see the file COPYING.LIB. If not, write to +- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +- Boston, MA 02110-1301, USA. +- +-*/ +- +-#ifndef KFILEPLACESSHAREDBOOKMARKS_P_H +-#define KFILEPLACESSHAREDBOOKMARKS_P_H +- +-#include +-#include +- +-/** +- * keeps the KFilePlacesModel bookmarks and the shared bookmark spec +- * shortcuts in sync +- */ +-class KFilePlacesSharedBookmarks : public QObject +-{ +- Q_OBJECT +-public: +- +- KFilePlacesSharedBookmarks(KBookmarkManager * mgr); +- ~KFilePlacesSharedBookmarks() { /* delete m_sharedBookmarkManager; */} +- +- void updateSharedBookmarks(); +- +-private: +- +- bool integrateSharedBookmarks(); +- bool exportSharedBookmarks(); +- +- KBookmarkManager *m_placesBookmarkManager; +- KBookmarkManager *m_sharedBookmarkManager; +- +-private Q_SLOTS: +- +- void slotSharedBookmarksChanged(); +-}; +- +- +- +- +-#endif /*KFILEPLACESSHARED_P_H_*/ +-- +2.4.2 + diff --git a/kdelibs.spec b/kdelibs.spec index fcf8965..2120879 100644 --- a/kdelibs.spec +++ b/kdelibs.spec @@ -52,7 +52,7 @@ Summary: KDE Libraries # shipped with kde applications, version... %global apps_version 15.04.2 Version: 4.14.9 -Release: 1%{?dist} +Release: 1%{?dist}.1 Name: kdelibs Epoch: 6 @@ -204,6 +204,9 @@ Patch092: return-application-icons-properly.patch # revert disabling of packagekit Patch093: turn-the-packagekit-support-feature-off-by-default.patch +# plasma5 places syncing problems +Patch094: 0015-Remove-bookmarks-syncing-from-KFilePlacesModel-and-u.patch + ## security fix # rhel patches @@ -463,6 +466,9 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage %if 0%{?plasma_packagekit} %patch093 -p1 -R -b .turn-the-packagekit-support-feature-off-by-default %endif +%if 0%{?fedora} < 22 +%patch094 -p1 -R -b .0015 +%endif # security fixes @@ -817,6 +823,9 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || : %changelog +* Thu Jun 04 2015 Rex Dieter 6:4.14.9-1.1 +- Revert upstream kplaces sync fix ( 6:4.14.9-1 - 4.14.9 (kde-apps-15.04.2)