kurldrag.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License.
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 GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __KURLDRAG_H
00021 #define __KURLDRAG_H
00022 
00023 #include <qstringlist.h>
00024 #include <qdragobject.h>
00025 #include <kurl.h>
00026 #include "kdelibs_export.h"
00027 class QMimeSource;
00028 
00029 class KURLDragPrivate;
00044 class KDECORE_EXPORT KURLDrag : public QUriDrag
00045 {
00046 public:
00057   KURLDrag( const KURL::List &urls, QWidget* dragSource = 0, const char * name = 0 );
00068   KURLDrag( const KURL::List &urls, const QMap<QString, QString>& metaData,
00069             QWidget* dragSource = 0, const char * name = 0 );
00070 
00071   virtual ~KURLDrag();
00072 
00080   void setExportAsText( bool exp );
00081 
00085   static KURLDrag * newDrag( const KURL::List &urls, QWidget* dragSource = 0, const char * name = 0 ) KDE_DEPRECATED;
00086 
00090   static KURLDrag * newDrag( const KURL::List &urls, const QMap<QString, QString>& metaData,
00091                              QWidget* dragSource = 0, const char * name = 0 ) KDE_DEPRECATED;
00092 
00100   QMap<QString, QString> &metaData() { return m_metaData; }
00101 
00110   static bool decode( const QMimeSource *e, KURL::List &urls );
00111 
00122   static bool decode( const QMimeSource *e, KURL::List &urls, QMap<QString,QString>& metaData );
00123 
00128   static QString urlToString(const KURL &url);
00129 
00134   static KURL stringToUrl(const QCString &s);
00135 
00136 #ifdef Q_WS_QWS
00137 
00142   static bool decode( QStringList const &e, KURL::List &uris );
00143 #endif
00144 
00146   virtual const char * format( int i ) const;
00148   virtual QByteArray encodedData( const char* mime ) const;
00149 
00150 protected:
00154   KURLDrag( const QStrList & urls, const QMap<QString,QString>& metaData,
00155             QWidget * dragSource, const char* name ) KDE_DEPRECATED;
00156 
00157 private:
00158   void init(const KURL::List &urls);
00159 
00160   QStrList m_urls;
00161   QMap<QString,QString> m_metaData;
00162   KURLDragPrivate* d;
00163 };
00164 
00165 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys