rpms/kdebase/F-11 kdebase-4.3.2-kde#160679-bookmark-crash.patch, NONE, 1.1 kdebase.spec, 1.382, 1.383
Kevin Kofler
kkofler at fedoraproject.org
Fri Oct 9 00:28:11 UTC 2009
Author: kkofler
Update of /cvs/pkgs/rpms/kdebase/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10289/F-11
Modified Files:
kdebase.spec
Added Files:
kdebase-4.3.2-kde#160679-bookmark-crash.patch
Log Message:
* Fri Oct 09 2009 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.3.2-3
- backport upstream patch for bookmark editor drag&drop crash (kde#160679)
kdebase-4.3.2-kde#160679-bookmark-crash.patch:
bookmarklistview.cpp | 34 ++++++++++++++++++++-------
bookmarkmodel.cpp | 64 +++++++++++++++++++++++++++++++++++----------------
2 files changed, 71 insertions(+), 27 deletions(-)
--- NEW FILE kdebase-4.3.2-kde#160679-bookmark-crash.patch ---
Index: apps/keditbookmarks/bookmarkmodel.cpp
===================================================================
--- apps/keditbookmarks/bookmarkmodel.cpp (Revision 1032327)
+++ apps/keditbookmarks/bookmarkmodel.cpp (Revision 1032328)
@@ -78,7 +78,7 @@
//Text
if(index.isValid() && (role == Qt::DisplayRole || role == Qt::EditRole))
{
- KBookmark bk = bookmarkForIndex(index);
+ const KBookmark bk = bookmarkForIndex(index);
if(bk.address().isEmpty())
{
if(index.column() == 0)
@@ -100,12 +100,12 @@
: subnode.firstChild().toText().data();
}
case 3: { //Status column
- QString text1 = ""; //FIXME favicon state
- QString text2 = ""; //FIXME link state
- if(text1.isNull() || text2.isNull())
- return QVariant( text1 + text2);
+ QString text1; //FIXME favicon state
+ QString text2; //FIXME link state
+ if(text1.isEmpty() || text2.isEmpty())
+ return QVariant( text1 + text2 );
else
- return QVariant( text1 + " -- " + text2);
+ return QVariant( text1 + " -- " + text2 );
}
default:
return QVariant( QString() ); //can't happen
@@ -141,12 +141,14 @@
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
}
else
+ {
if(index.column() < 3)
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled;
+ }
}
// root
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled;
}
bool KBookmarkModel::setData(const QModelIndex &index, const QVariant &value, int role)
@@ -187,7 +189,7 @@
return createIndex(row, column, d->mRootItem);
TreeItem * item = static_cast<TreeItem *>(parent.internalPointer());
- if(row == item->childCount()) {// Received drop below last row, simulate drop on last row
+ if(row == item->childCount()) {// Received drop below last row, simulate drop on last row
return createIndex(row-1, column, item->child(row-1));
}
@@ -284,22 +286,42 @@
bool KBookmarkModel::dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent)
{
- Q_UNUSED(action)
-
//FIXME this only works for internal drag and drops
//FIXME Moving is *very* buggy
-
- QModelIndex idx;
+ QModelIndex dropDestIndex;
+ bool isInsertBetweenOp = false;
if(row == -1)
- idx = parent;
+ {
+ dropDestIndex = parent;
+ }
else
- idx = index(row, column, parent);
+ {
+ isInsertBetweenOp = true;
+ dropDestIndex= index(row, column, parent);
+ }
- KBookmark bk = bookmarkForIndex(idx);
- QString addr = bk.address();
- if(bk.isGroup())
- addr += "/0";
+ KBookmark dropDestBookmark = bookmarkForIndex(dropDestIndex);
+ if (dropDestBookmark.isNull())
+ {
+ // Presumably an invalid index: assume we want to place this in the root bookmark
+ // folder.
+ dropDestBookmark = d->mRoot;
+ }
+ QString addr = dropDestBookmark.address();
+ if(dropDestBookmark.isGroup() && !isInsertBetweenOp)
+ {
+ addr += "/0";
+ }
+ // bookmarkForIndex(...) does not distinguish between the last item in the folder
+ // and the point *after* the last item in the folder (and its hard to see how to
+ // modify it so it does), so do the check here.
+ if (isInsertBetweenOp && row == dropDestBookmark.positionInParent() + 1)
+ {
+ // Attempting to insert underneath the last item in a folder; adjust the address.
+ addr = KBookmark::nextAddress(addr);
+ }
+
if(action == Qt::CopyAction)
{
KEBMacroCommand * cmd = CmdGen::insertMimeSource("Copy", data, addr);
@@ -338,6 +360,10 @@
KBookmark KBookmarkModel::bookmarkForIndex(const QModelIndex& index) const
{
+ if (!index.isValid())
+ {
+ return KBookmark();
+ }
return static_cast<TreeItem *>(index.internalPointer())->bookmark();
}
Index: apps/keditbookmarks/bookmarklistview.cpp
===================================================================
--- apps/keditbookmarks/bookmarklistview.cpp (Revision 1032327)
+++ apps/keditbookmarks/bookmarklistview.cpp (Revision 1032328)
@@ -43,6 +43,7 @@
}
+
/* ----------- */
BookmarkFolderView::BookmarkFolderView( BookmarkListView * view, QWidget * parent )
@@ -53,6 +54,7 @@
setModel(mmodel);
header()->setVisible(false);
setRootIsDecorated(false);
+ setDropIndicatorShown(true);
expandAll();
setCurrentIndex( mmodel->index(0,0, QModelIndex()));
@@ -88,7 +90,6 @@
return static_cast<KBookmarkModel *>(mmodel->sourceModel())->bookmarkForIndex(index);
}
-
/********/
@@ -173,15 +174,32 @@
bool BookmarkFolderViewFilterModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
- // FIXME Probably bug in QT, send bug report
- kDebug()<<"BookmarkFolderViewFilterModel::dropMimeData"<<endl;
- QModelIndex idx;
+ QModelIndex dropDestProxyIndex;
+ bool isInsertBetweenOp = false;
if(row == -1)
- idx = parent;
+ {
+ dropDestProxyIndex = parent;
+ }
else
- idx = index(row, column, parent);
- QModelIndex src = mapToSource(idx);
- return sourceModel()->dropMimeData( data, action, -1, -1, src);
+ {
+ dropDestProxyIndex = index(row, column, parent);
+ isInsertBetweenOp = true;
+ }
+ QModelIndex dropDestIndex = mapToSource(dropDestProxyIndex);
+ if (!isInsertBetweenOp)
+ {
+ // Just dropping it onto dropDestIndex - ignore row and column.
+ return sourceModel()->dropMimeData( data, action, -1, -1, dropDestIndex);
+ }
+ else
+ {
+ // Dropping before dropDestIndex. We want to keep row and column
+ // relative to the parent.
+ // I'm reasonably certain the parent must be valid in this case. If you get a crash here - nag me!
+ Q_ASSERT(parent.isValid());
+ QModelIndex dropDestParentIndex = mapToSource(parent);
+ return sourceModel()->dropMimeData( data, action, dropDestIndex.row(), dropDestIndex.column(), dropDestParentIndex);
+ }
}
BookmarkFolderViewFilterModel::~BookmarkFolderViewFilterModel()
Index: kdebase.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase/F-11/kdebase.spec,v
retrieving revision 1.382
retrieving revision 1.383
diff -u -p -r1.382 -r1.383
--- kdebase.spec 7 Oct 2009 11:00:13 -0000 1.382
+++ kdebase.spec 9 Oct 2009 00:28:11 -0000 1.383
@@ -1,7 +1,7 @@
Name: kdebase
Summary: K Desktop Environment 4 - Core Files
Version: 4.3.2
-Release: 2%{?dist}
+Release: 3%{?dist}
Epoch: 6
License: GPLv2
@@ -17,6 +17,7 @@ Patch2: kdebase-4.2.1-home-icon.patch
# 4.3 upstream patches
Patch100: kdebase-4.3.2-dolphin-kde#202176.patch
+Patch101: kdebase-4.3.2-kde#160679-bookmark-crash.patch
%ifnarch s390 s390x
Requires: eject
@@ -112,6 +113,7 @@ Requires: kdelibs4-devel kdepimlibs4-dev
# 4.3 upstream patches
%patch100 -p1 -b .dolphin-kde#202176
+%patch101 -p0 -b .kde#160679
# fix incorrect assumption that we're building in a combined kdebase tree
sed -i -e 's/EXISTS "${kdebase_SOURCE_DIR}"/0/g' apps/CMakeLists.txt
@@ -234,6 +236,9 @@ fi
%changelog
+* Fri Oct 09 2009 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.3.2-3
+- backport upstream patch for bookmark editor drag&drop crash (kde#160679)
+
* Wed Oct 07 2009 Than Ngo <than at redhat.com> - 4.3.2-2
- fix Dolphin crash (regression)
More information about the fedora-extras-commits
mailing list