X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/8ffc72e87f4cffa8dce32da06e9a1d51a595765e..e57f6215659ee36877c7c36c9e3fcba0ba5d03a0:/src/kitemviews/kitemlistselectionmanager.h diff --git a/src/kitemviews/kitemlistselectionmanager.h b/src/kitemviews/kitemlistselectionmanager.h index 6b0435139..ba9dd538a 100644 --- a/src/kitemviews/kitemlistselectionmanager.h +++ b/src/kitemviews/kitemlistselectionmanager.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program 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 General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTSELECTIONMANAGER_H #define KITEMLISTSELECTIONMANAGER_H @@ -37,25 +24,18 @@ class DOLPHIN_EXPORT KItemListSelectionManager : public QObject { Q_OBJECT - enum RangesRemovingBehaviour { - DiscardRemovedIndex, - AdjustRemovedIndex - }; + enum RangesRemovingBehaviour { DiscardRemovedIndex, AdjustRemovedIndex }; public: - enum SelectionMode { - Select, - Deselect, - Toggle - }; + enum SelectionMode { Select, Deselect, Toggle }; - explicit KItemListSelectionManager(QObject* parent = nullptr); + explicit KItemListSelectionManager(QObject *parent = nullptr); ~KItemListSelectionManager() override; void setCurrentItem(int current); int currentItem() const; - void setSelectedItems(const KItemSet& items); + void setSelectedItems(const KItemSet &items); KItemSet selectedItems() const; bool isSelected(int index) const; bool hasSelection() const; @@ -74,24 +54,23 @@ public: void endAnchoredSelection(); bool isAnchoredSelectionActive() const; - KItemModelBase* model() const; + KItemModelBase *model() const; -signals: +Q_SIGNALS: void currentChanged(int current, int previous); - void selectionChanged(const KItemSet& current, const KItemSet& previous); + void selectionChanged(const KItemSet ¤t, const KItemSet &previous); private: - void setModel(KItemModelBase* model); - void itemsInserted(const KItemRangeList& itemRanges); - void itemsRemoved(const KItemRangeList& itemRanges); - void itemsMoved(const KItemRange& itemRange, const QList& movedToIndexes); - + void setModel(KItemModelBase *model); + void itemsInserted(const KItemRangeList &itemRanges); + void itemsRemoved(const KItemRangeList &itemRanges); + void itemsMoved(const KItemRange &itemRange, const QList &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; + int indexAfterRangesRemoving(int index, const KItemRangeList &itemRanges, const RangesRemovingBehaviour behaviour) const; private: int m_currentItem; @@ -99,10 +78,10 @@ private: KItemSet m_selectedItems; bool m_isAnchoredSelectionActive; - KItemModelBase* m_model; + KItemModelBase *m_model; friend class KItemListController; // Calls setModel() - friend class KItemListView; // Calls itemsInserted(), itemsRemoved() and itemsMoved() + friend class KItemListView; // Calls itemsInserted(), itemsRemoved() and itemsMoved() friend class KItemListSelectionManagerTest; };