diff options
| author | Peter Penz <[email protected]> | 2011-09-04 17:40:44 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-09-04 17:41:15 +0200 |
| commit | 7a91492cff931c0c4e0d38dd0aee77d9dcb29373 (patch) | |
| tree | 97c0e00397f95c673ff5dc3a4cf0dcb79a0134df /src/views/draganddrophelper.h | |
| parent | 8266e456a10670fe5ef855680d61e0b6ab0d6292 (diff) | |
Improved drag and drop support
Diffstat (limited to 'src/views/draganddrophelper.h')
| -rw-r--r-- | src/views/draganddrophelper.h | 62 |
1 files changed, 10 insertions, 52 deletions
diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h index b107efc18..85e47077d 100644 --- a/src/views/draganddrophelper.h +++ b/src/views/draganddrophelper.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2007 by Peter Penz <[email protected]> * + * Copyright (C) 2007-2011 by Peter Penz <[email protected]> * * Copyright (C) 2007 by David Faure <[email protected]> * * * * This program is free software; you can redistribute it and/or modify * @@ -22,44 +22,17 @@ #define DRAGANDDROPHELPER_H #include "libdolphin_export.h" -#include <QObject> -#include <QPixmap> -class DolphinViewController; +#include <QString> + class KFileItem; class KUrl; class QDropEvent; -class QAbstractItemView; -class QMimeData; class QWidget; -/** - * @brief Helper class for having a common drag and drop behavior. - * - * The class is used by DolphinIconsView, DolphinDetailsView, - * DolphinColumnView and PanelTreeView to have a consistent - * drag and drop behavior between all views. - */ -class LIBDOLPHINPRIVATE_EXPORT DragAndDropHelper : public QObject +class LIBDOLPHINPRIVATE_EXPORT DragAndDropHelper { - Q_OBJECT - public: - static DragAndDropHelper& instance(); - - /** - * Creates a drag object for the view \a itemView for all selected items. - */ - void startDrag(QAbstractItemView* itemView, - Qt::DropActions supportedActions, - DolphinViewController* dolphinViewController = 0); - - /** - * Returns true if and only if the view \a itemView was the last view to - * be passed to startDrag(...), and that drag is still in progress. - */ - bool isDragSource(QAbstractItemView* itemView) const; - /** * Handles the dropping of URLs to the given * destination. A context menu with the options @@ -69,28 +42,13 @@ public: * @param destPath Path of the destination. * @param event Drop event. * @param widget Source widget where the dragging has been started. + * @return Error message if dropping is not possible. If an empty string + * is returned, the dropping has been successful. */ - void dropUrls(const KFileItem& destItem, - const KUrl& destPath, - QDropEvent* event, - QWidget* widget); -signals: - void errorMessage(const QString& msg); - -private: - DragAndDropHelper(); - - /** - * Creates a pixmap the contains the all icons of the items - * that are dragged. - */ - QPixmap createDragPixmap(QAbstractItemView* itemView) const; - - // The last view passed in startDrag(...), or 0 if - // no startDrag(...) initiated drag is in progress. - QAbstractItemView *m_dragSource; - - friend class DragAndDropHelperSingleton; + static QString dropUrls(const KFileItem& destItem, + const KUrl& destPath, + QDropEvent* event, + QWidget* widget); }; #endif |
