┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/selectionmanager.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-01-26 21:45:28 +0000
committerPeter Penz <[email protected]>2008-01-26 21:45:28 +0000
commitf6c7b90edf05a52fba6e2a06caa0247e909b43e8 (patch)
treecda08606cd172d460d404f7f822b528985fa8e03 /src/selectionmanager.h
parent453131d6e8a59af87e943455e26074ce8e3ddae3 (diff)
Blend in a toggle button when hovering items. This allows selecting items without using the rubberband or Ctrl/Shift-keys in the single-click mode. Any feedback from users is highly welcome (I think people will either love or hate this feature, I'm really not sure -> it can be turned off too).
svn path=/trunk/KDE/kdebase/apps/; revision=766901
Diffstat (limited to 'src/selectionmanager.h')
-rw-r--r--src/selectionmanager.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/selectionmanager.h b/src/selectionmanager.h
new file mode 100644
index 000000000..1bf4f8b8c
--- /dev/null
+++ b/src/selectionmanager.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2008 by Peter Penz <[email protected]> *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+#ifndef SELECTIONMANAGER_H
+#define SELECTIONMANAGER_H
+
+#include <kfileitem.h>
+
+#include <QObject>
+
+class DolphinSortFilterProxyModel;
+class QAbstractItemView;
+class QModelIndex;
+class QAbstractButton;
+
+/**
+ * @brief Allows to select and deselect items for the single-click mode.
+ *
+ * Whenever an item is hovered by the mouse, a toggle button is shown
+ * which allows to select/deselect the current item.
+ */
+class SelectionManager : public QObject
+{
+ Q_OBJECT
+
+public:
+ SelectionManager(QAbstractItemView* parent);
+ virtual ~SelectionManager();
+
+signals:
+ /** Is emitted if the selection has been changed by the toggle button. */
+ void selectionChanged();
+
+private slots:
+ void slotEntered(const QModelIndex& index);
+ void slotViewportEntered();
+ void slotSelectionChanged();
+ void setItemSelected(bool selected);
+
+private:
+ KFileItem itemForIndex(const QModelIndex& index) const;
+ const QModelIndex indexForItem(const KFileItem& item) const;
+
+private:
+ QAbstractItemView* m_view;
+ QAbstractButton* m_button;
+ KFileItem m_item;
+};
+
+#endif