konq_drag.h

00001 /*  This file is part of the KDE project
00002     Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program; if not, write to the Free Software
00016     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017 */
00018 
00019 #ifndef __konqdrag_h__
00020 #define __konqdrag_h__
00021 
00022 #include <qdragobject.h>
00023 #include <qrect.h>
00024 #include <qstring.h>
00025 #include <qiconview.h>
00026 
00027 #include <libkonq_export.h>
00028 
00029 #include <kurl.h>
00030 
00031 /*****************************************************************************
00032  *
00033  * Class KonqIconDrag
00034  *
00035  *****************************************************************************/
00036 
00037 // Clipboard/dnd data for: Icons + URLS + isCut
00038 class LIBKONQ_EXPORT KonqIconDrag : public QIconDrag
00039 {
00040     Q_OBJECT
00041 
00042 public:
00043     KonqIconDrag( QWidget * dragSource, const char* name = 0 );
00044     virtual ~KonqIconDrag() {}
00045 
00046     const char* format( int i ) const;
00047     QByteArray encodedData( const char* mime ) const;
00048 
00049     void append( const QIconDragItem &item, const QRect &pr,
00050                  const QRect &tr, const QString &url );
00051 
00052     void setMoveSelection( bool move ) { m_bCutSelection = move; }
00053 
00054     static bool canDecode( const QMimeSource* e );
00055 
00056 protected: // KDE4: private. And d pointer...
00057     QStringList urls;
00058     bool m_bCutSelection;
00059 };
00060 
00066 class LIBKONQ_EXPORT KonqIconDrag2 : public KonqIconDrag
00067 {
00068     Q_OBJECT
00069 
00070 public:
00071     KonqIconDrag2( QWidget * dragSource );
00072     virtual ~KonqIconDrag2() {}
00073 
00074     virtual const char* format( int i ) const;
00075     virtual QByteArray encodedData( const char* mime ) const;
00076 
00077     void append( const QIconDragItem &item, const QRect &pr,
00078                  const QRect &tr, const QString &url, const KURL &mostLocalURL );
00079 
00080 private:
00081     QStringList m_kdeURLs;
00082 };
00083 
00084 // Clipboard/dnd data for: URLS + isCut
00085 class LIBKONQ_EXPORT KonqDrag : public QUriDrag
00086 {
00087 public:
00088     // KDE4: remove, use KonqDrag constructor instead
00089     static KonqDrag * newDrag( const KURL::List & urls,
00090                                bool move, QWidget * dragSource = 0, const char* name = 0 );
00091 
00100     KonqDrag( const KURL::List & urls, const KURL::List& mostLocalUrls, bool cut, QWidget * dragSource = 0 );
00101 
00102 protected:
00103     // KDE4: remove
00104     KonqDrag( const QStrList & urls, bool cut, QWidget * dragSource, const char* name );
00105 
00106 public:
00107     virtual ~KonqDrag() {}
00108 
00109     virtual const char* format( int i ) const;
00110     virtual QByteArray encodedData( const char* mime ) const;
00111 
00112     void setMoveSelection( bool move ) { m_bCutSelection = move; }
00113 
00114     // Returns true if the data was cut (used for KonqIconDrag too)
00115     static bool decodeIsCutSelection( const QMimeSource *e );
00116 
00117 protected: // KDE4: private. And d pointer...
00118     bool m_bCutSelection;
00119     QStrList m_urls; // this is set to the "most local urls". KDE4: KURL::List
00120 };
00121 
00122 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys