1
/**************************************************************************
2
* kfiledndiconview.h - description
4
* begin : Wed Nov 1 2000
5
* copyright : (C) 2000 by Bj�rn Sahlstr�m
6
* email : kbjorn@users.sourceforge.net
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
**************************************************************************/
18
#ifndef KFILEDNDICONVIEW_H
19
#define KFILEDNDICONVIEW_H
23
#include <kfileiconview.h>
27
* This is a fileview inherited from @ref KFileIconView.
28
* It adds "drag and drop" suitable for a @ref KFileIconView
29
* No special setup is needed, just connect to the @ref dropped signals
30
* and the view will take care of the rest.
31
* @short Drag and drop" aware @ref KFileIconView
32
* @author Bj�rn Sahlstr�m
35
class KFileDnDIconView : public KFileIconView
38
public: // Public methods
40
KFileDnDIconView( QWidget *parent = 0, const char *name = 0 );
41
virtual ~KFileDnDIconView();
44
* Set if Drag'n drop should be enabled or not, default is enabled.
46
void setDnDEnabled( bool );
49
* @returns wether DnD is enabled or not.
51
bool isDnDEnabled() const
57
* Sets the auto open time, which means the time that will
58
* elapse before a directory is automatically opened after entered by DnD.
59
* Only need to call this if you want to change the predefined time that is 750 ms.
60
* This also calls @ref #useAutoOpenTimer so no need to call this to.
62
void setAutoOpenTime( const int& time );
65
* Set this to true if you want the view to use it's auto open functionallity otherwhise set it to false.
66
* By default this is turned ON.
68
void useAutoOpenTimer( bool on = true );
71
* @returns true if auto open functionallity is turned ON (default), otherwhise false
72
* @see #useAutoOpenTimer
73
* @see #setAutoOpenTime
75
bool isAutoOpening() const
77
return m_useAutoOpenTimer;
80
virtual void readConfig( KConfig*, const QString& group = QString::null );
81
virtual void writeConfig( KConfig*, const QString& group = QString::null );
85
* Emitted whenever an decodable item is dropped in the view.
86
* Note: The @ref QDropEvent contains a @ref KURLDrag object.
88
void dropped( QDropEvent* );
92
* Called when the auto timer times out. Open the current folder.
94
void slotOpenFolder();
97
virtual void contentsDragEnterEvent( QDragEnterEvent *e );
98
virtual void contentsDragMoveEvent( QDragMoveEvent *e );
99
virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
100
virtual void contentsDropEvent( QDropEvent* e );
103
* Creates a @ref QDragObject containing all urls of the selected @ref KFileItem of the view,
104
* @returns the @ref QDragObject
106
virtual QDragObject* dragObject();
109
*Creates the drag item and starts the drag
111
virtual void startDrag();
114
*@returns true if we can decode the drag and support the action
116
virtual bool acceptDrag( QDropEvent* event ) const;
120
QTimer m_autoOpenTimer;
122
bool m_useAutoOpenTimer;
123
QIconViewItem* m_dropItem;
127
// kate: indent-mode csands; tab-width 4; auto-insert-doxygen on;