]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistselectionmanager.h
Merge remote-tracking branch 'origin/KDE/4.11'
[dolphin.git] / src / kitemviews / kitemlistselectionmanager.h
index 2761940f54b15555f89b4710578b943537a9aa18..c89b8a4b85916655e48a7853eb889849ec2c8e16 100644 (file)
@@ -39,6 +39,11 @@ class LIBDOLPHINPRIVATE_EXPORT KItemListSelectionManager : public QObject
 {
     Q_OBJECT
 
+    enum RangesRemovingBehaviour {
+        DiscardRemovedIndex,
+        AdjustRemovedIndex
+    };
+
 public:
     enum SelectionMode {
         Select,
@@ -54,6 +59,7 @@ public:
 
     void setSelectedItems(const QSet<int>& items);
     QSet<int> selectedItems() const;
+    bool isSelected(int index) const;
     bool hasSelection() const;
 
     void setSelected(int index, int count = 1, SelectionMode mode = Select);
@@ -61,7 +67,6 @@ public:
 
     void beginAnchoredSelection(int anchor);
     void endAnchoredSelection();
-    int anchorItem() const;
     bool isAnchoredSelectionActive() const;
 
     KItemModelBase* model() const;
@@ -74,6 +79,14 @@ private:
     void setModel(KItemModelBase* model);
     void itemsInserted(const KItemRangeList& itemRanges);
     void itemsRemoved(const KItemRangeList& itemRanges);
+    void itemsMoved(const KItemRange& itemRange, const QList<int>& movedToIndexes);
+
+
+    /**
+     * Helper method for itemsRemoved. Returns the changed index after removing
+     * the given range. If the index is part of the range, -1 will be returned.
+     */
+    int indexAfterRangesRemoving(int index, const KItemRangeList& itemRanges, const RangesRemovingBehaviour behaviour) const;
 
 private:
     int m_currentItem;
@@ -84,7 +97,7 @@ private:
     KItemModelBase* m_model;
 
     friend class KItemListController; // Calls setModel()
-    friend class KItemListView;       // Calls itemsInserted() and itemsRemoved()
+    friend class KItemListView;       // Calls itemsInserted(), itemsRemoved() and itemsMoved()
     friend class KItemListSelectionManagerTest;
 };