~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to buildtools/autotools/kfiledndiconview.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**************************************************************************
2
 
*                        kfiledndiconview.h  -  description
3
 
*                          -------------------
4
 
*  begin                : Wed Nov 1 2000
5
 
*  copyright            : (C) 2000 by Bj�rn Sahlstr�m
6
 
*  email                : kbjorn@users.sourceforge.net
7
 
***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
*                                                                         *
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.                                   *
15
 
*                                                                        *
16
 
**************************************************************************/
17
 
 
18
 
#ifndef KFILEDNDICONVIEW_H
19
 
#define KFILEDNDICONVIEW_H
20
 
 
21
 
#include <qwidget.h>
22
 
#include <qtimer.h> 
23
 
#include <kfileiconview.h>
24
 
#include <kurldrag.h>
25
 
 
26
 
/**
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
33
 
*/
34
 
 
35
 
class KFileDnDIconView : public KFileIconView
36
 
{
37
 
        Q_OBJECT
38
 
public:  // Public methods
39
 
 
40
 
        KFileDnDIconView( QWidget *parent = 0, const char *name = 0 );
41
 
        virtual ~KFileDnDIconView();
42
 
        
43
 
        /**
44
 
         * Set if Drag'n drop should be enabled or not, default is enabled.
45
 
         */
46
 
        void setDnDEnabled( bool );
47
 
        
48
 
        /**
49
 
         * @returns wether DnD is enabled or not.
50
 
         */
51
 
        bool isDnDEnabled() const
52
 
        {
53
 
                return m_dndEnabled;
54
 
        }
55
 
        
56
 
        /**
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.
61
 
        */
62
 
        void setAutoOpenTime( const int& time );
63
 
        
64
 
        /**
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.
67
 
         */
68
 
        void useAutoOpenTimer( bool on = true );
69
 
        
70
 
        /**
71
 
         * @returns true if auto open functionallity is turned ON (default), otherwhise false
72
 
         * @see #useAutoOpenTimer
73
 
         * @see #setAutoOpenTime
74
 
         */
75
 
        bool isAutoOpening() const
76
 
        {
77
 
                return m_useAutoOpenTimer;
78
 
        }
79
 
 
80
 
        virtual void readConfig( KConfig*, const QString& group = QString::null );
81
 
        virtual void writeConfig( KConfig*, const QString& group = QString::null );
82
 
signals:
83
 
        
84
 
        /**
85
 
         * Emitted whenever an decodable item is dropped in the view.
86
 
         * Note: The @ref QDropEvent contains a @ref KURLDrag object.
87
 
         */
88
 
        void dropped( QDropEvent* );
89
 
        
90
 
protected slots:
91
 
        /**
92
 
         * Called when the auto timer times out. Open the current folder.
93
 
         */
94
 
        void slotOpenFolder();
95
 
        
96
 
protected:
97
 
        virtual void contentsDragEnterEvent( QDragEnterEvent *e );
98
 
        virtual void contentsDragMoveEvent( QDragMoveEvent *e );
99
 
        virtual void contentsDragLeaveEvent( QDragLeaveEvent *e );
100
 
        virtual void contentsDropEvent( QDropEvent* e );
101
 
        
102
 
        /**
103
 
         * Creates a @ref QDragObject containing all urls of the selected @ref KFileItem of the view,
104
 
         * @returns the @ref QDragObject
105
 
         */
106
 
        virtual QDragObject* dragObject();
107
 
        
108
 
        /**
109
 
         *Creates the drag item and starts the drag
110
 
         */
111
 
        virtual void startDrag();
112
 
        
113
 
        /**
114
 
         *@returns true if we can decode the drag and support the action
115
 
         */
116
 
        virtual bool acceptDrag( QDropEvent* event ) const;
117
 
        
118
 
protected:
119
 
        
120
 
        QTimer m_autoOpenTimer;
121
 
        int m_autoOpenTime;
122
 
        bool m_useAutoOpenTimer;
123
 
        QIconViewItem* m_dropItem;
124
 
        bool m_dndEnabled;
125
 
};
126
 
#endif 
127
 
// kate: indent-mode csands; tab-width 4; auto-insert-doxygen on;
128