#ifndef KITEMLISTCONTROLLER_H
#define KITEMLISTCONTROLLER_H
-#include <libdolphin_export.h>
+#include "dolphin_export.h"
+#include "kitemset.h"
#include <QObject>
-#include <QPixmap>
#include <QPointF>
-#include <QSet>
+class QTimer;
class KItemModelBase;
class KItemListKeyboardSearchManager;
class KItemListSelectionManager;
class QHideEvent;
class QInputMethodEvent;
class QKeyEvent;
-class QMimeData;
class QShowEvent;
class QTransform;
* @see KItemModelBase
* @see KItemListSelectionManager
*/
-class LIBDOLPHINPRIVATE_EXPORT KItemListController : public QObject
+class DOLPHIN_EXPORT KItemListController : public QObject
{
Q_OBJECT
- Q_ENUMS(SelectionBehavior)
Q_PROPERTY(KItemModelBase* model READ model WRITE setModel)
Q_PROPERTY(KItemListView *view READ view WRITE setView)
Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior)
SingleSelection,
MultiSelection
};
+ Q_ENUM(SelectionBehavior)
enum AutoActivationBehavior {
ActivationAndExpansion,
* @param view View of the controller. The ownership is passed to the controller.
* @param parent Optional parent object.
*/
- KItemListController(KItemModelBase* model, KItemListView* view, QObject* parent = 0);
- virtual ~KItemListController();
+ KItemListController(KItemModelBase* model, KItemListView* view, QObject* parent = nullptr);
+ ~KItemListController() override;
void setModel(KItemModelBase* model);
KItemModelBase* model() const;
void setMouseDoubleClickAction(MouseDoubleClickAction action);
MouseDoubleClickAction mouseDoubleClickAction() const;
+ int indexCloseToMousePressedPosition() const;
+
/**
* Sets the delay in milliseconds when dragging an object above an item
* until the item gets activated automatically. A value of -1 indicates
/**
* If set to true, the signals itemActivated() and itemsActivated() are emitted
- * after a single-click of the left mouse button. If set to false (the default),
- * the setting from KGlobalSettings::singleClick() is used.
+ * after a single-click of the left mouse button. If set to false (the default),
+ * the setting from style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) is used.
*/
void setSingleClickActivationEnforced(bool singleClick);
bool singleClickActivationEnforced() const;
* Is emitted if more than one item has been activated by pressing Return/Enter
* when having a selection.
*/
- void itemsActivated(const QSet<int>& indexes);
+ void itemsActivated(const KItemSet& indexes);
void itemMiddleClicked(int index);
*/
void aboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
+ /**
+ * Is emitted if the Escape key is pressed.
+ */
+ void escapePressed();
+
void modelChanged(KItemModelBase* current, KItemModelBase* previous);
void viewChanged(KItemListView* current, KItemListView* previous);
+ void selectedItemTextPressed(int index);
+
private slots:
void slotViewScrollOffsetChanged(qreal current, qreal previous);
* the current selection it is remembered in m_oldSelection before the
* rubberband gets activated.
*/
- QSet<int> m_oldSelection;
+ KItemSet m_oldSelection;
/**
* Assuming a view is given with a vertical scroll-orientation, grouped items and