D6281: Prevent folders from drag and dropping onto themselves in dolphin main view
Henrik Fehlauer
noreply at phabricator.kde.org
Wed Oct 25 23:23:27 BST 2017
rkflx requested changes to this revision.
rkflx added a comment.
This revision now requires changes to proceed.
@emateli I'm afraid your latest changes do not build for me, due making `indexIsDir` pure virtual and guarding it with `HAVE_BALOO`. I needed the following patch, could you have a look?
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 195e86eba..fe97343c9 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -2419,7 +2419,7 @@ QUrl KFileItemModel::indexGetUrl(int index) const
return fileItem(index).url();
}
-bool KFileItemModel::indexIsDir(int index)
+bool KFileItemModel::indexIsDir(int index) const
{
return fileItem(index).isDir();
}
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index 027ed37c2..6cd9ec500 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -146,7 +146,7 @@ public:
KFileItem rootItem() const;
QUrl indexGetUrl(int index) const Q_DECL_OVERRIDE;
- bool indexIsDir(int index) Q_DECL_OVERRIDE;
+ bool indexIsDir(int index) const Q_DECL_OVERRIDE;
/**
* Clears all items of the model.
diff --git a/src/kitemviews/kitemmodelbase.cpp b/src/kitemviews/kitemmodelbase.cpp
index 251b57dd6..8086c595e 100644
--- a/src/kitemviews/kitemmodelbase.cpp
+++ b/src/kitemviews/kitemmodelbase.cpp
@@ -171,6 +171,12 @@ QUrl KItemModelBase::indexGetUrl(int index) const
return QUrl();
}
+bool KItemModelBase::indexIsDir(int index) const
+{
+ Q_UNUSED(index);
+ return false;
+}
+
QUrl KItemModelBase::directory() const
{
return QUrl();
diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h
index 844171343..7dc33a995 100644
--- a/src/kitemviews/kitemmodelbase.h
+++ b/src/kitemviews/kitemmodelbase.h
@@ -190,7 +190,7 @@ public:
/**
* @return True, if item at specified index is a directory
*/
- virtual bool indexIsDir(int index) = 0;
+ virtual bool indexIsDir(int index) const;
/**
* @return Parent directory of the items that are shown
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index 5e64e1551..193a8615b 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -1202,14 +1202,13 @@ QUrl PlacesItemModel::searchUrlForType(const QString& type)
return query.toSearchUrl();
}
+#endif
-bool PlacesItemModel::indexIsDir(int index)
+bool PlacesItemModel::indexIsDir(int index) const
{
return true;
}
-#endif
-
#ifdef PLACESITEMMODEL_DEBUG
void PlacesItemModel::showModelState()
{
diff --git a/src/panels/places/placesitemmodel.h b/src/panels/places/placesitemmodel.h
index 805de3af9..1a2c0d315 100644
--- a/src/panels/places/placesitemmodel.h
+++ b/src/panels/places/placesitemmodel.h
@@ -133,7 +133,7 @@ public:
void saveBookmarks();
QUrl indexGetUrl(int index) const Q_DECL_OVERRIDE;
- bool indexIsDir(int index) Q_DECL_OVERRIDE;
+ bool indexIsDir(int index) const Q_DECL_OVERRIDE;
signals:
void errorMessage(const QString& message);
REVISION DETAIL
https://phabricator.kde.org/D6281
To: emateli, #dolphin, elvisangelaccio, ngraham, rkflx
Cc: rkflx, ngraham, elvisangelaccio, dfaure, anthonyfieroni, #konqueror, spoorun, navarromorales, firef, andrebarros, emmanuelp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20171025/570a9d8c/attachment.htm>
More information about the kfm-devel
mailing list