00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __kio_netaccess_h
00024 #define __kio_netaccess_h
00025
00026 #include <qobject.h>
00027 #include <qstring.h>
00028 #include <kio/global.h>
00029
00030 class QStringList;
00031 class QWidget;
00032 class KURL;
00033 template<typename T, typename K> class QMap;
00034
00035 namespace KIO {
00036
00037 class Job;
00038
00059 class KIO_EXPORT NetAccess : public QObject
00060 {
00061 Q_OBJECT
00062
00063 public:
00116 static bool download(const KURL& src, QString & target, QWidget* window);
00117
00121 static bool download(const KURL& src, QString & target) KDE_DEPRECATED;
00122
00134 static void removeTempFile(const QString& name);
00135
00154 static bool upload(const QString& src, const KURL& target, QWidget* window);
00155
00159 static bool upload(const QString& src, const KURL& target) KDE_DEPRECATED;
00160
00179 static bool copy( const KURL& src, const KURL& target, QWidget* window );
00180
00181
00185 static bool copy( const KURL& src, const KURL& target ) KDE_DEPRECATED;
00186
00187
00191 static bool file_copy( const KURL& src, const KURL& dest, int permissions=-1,
00192 bool overwrite=false, bool resume=false, QWidget* window = 0L );
00193
00199 static bool file_move( const KURL& src, const KURL& target, int permissions=-1,
00200 bool overwrite=false, bool resume=false, QWidget* window = 0L );
00201
00202
00222 static bool dircopy( const KURL& src, const KURL& target, QWidget* window );
00223
00227 static bool dircopy( const KURL& src, const KURL& target ) KDE_DEPRECATED;
00228
00232 static bool dircopy( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00233
00239 static bool move( const KURL& src, const KURL& target, QWidget* window = 0L );
00240
00246 static bool move( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00247
00263 static bool exists(const KURL& url, bool source, QWidget* window);
00264
00268 static bool exists(const KURL& url, QWidget* window) KDE_DEPRECATED;
00269
00273 static bool exists(const KURL& url) KDE_DEPRECATED;
00274
00278 static bool exists(const KURL& url, bool source) KDE_DEPRECATED;
00279
00296 static bool stat(const KURL& url, KIO::UDSEntry & entry, QWidget* window);
00297
00301 static bool stat(const KURL& url, KIO::UDSEntry & entry) KDE_DEPRECATED;
00302
00317 static bool del( const KURL & url, QWidget* window );
00318
00325 static bool del( const KURL & url ) KDE_DEPRECATED;
00326
00341 static bool mkdir( const KURL & url, QWidget* window, int permissions = -1 );
00342
00349 static bool mkdir( const KURL & url, int permissions = -1 ) KDE_DEPRECATED;
00350
00369 static QString fish_execute( const KURL & url, const QString command, QWidget* window );
00370
00405 static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
00406 KURL* finalURL=0, QMap<QString,QString>* metaData=0 );
00407
00430 static QString mimetype( const KURL & url, QWidget* window );
00431
00438 static QString mimetype( const KURL & url ) KDE_DEPRECATED;
00439
00445 static QString lastErrorString() { return lastErrorMsg ? *lastErrorMsg : QString::null; }
00446
00452 static int lastError() { return lastErrorCode; }
00453
00454 private:
00458 NetAccess() : m_metaData(0), d(0) {}
00459
00463 ~NetAccess() {}
00464
00468 bool filecopyInternal(const KURL& src, const KURL& target, int permissions,
00469 bool overwrite, bool resume, QWidget* window, bool move);
00470 bool dircopyInternal(const KURL::List& src, const KURL& target,
00471 QWidget* window, bool move);
00472 bool statInternal(const KURL & url, int details, bool source, QWidget* window = 0);
00473
00474 bool delInternal(const KURL & url, QWidget* window = 0);
00475 bool mkdirInternal(const KURL & url, int permissions, QWidget* window = 0);
00476 QString fish_executeInternal(const KURL & url, const QString command, QWidget* window = 0);
00477 bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
00478 KURL* finalURL, QMap<QString,QString>* metaData );
00479
00480 QString mimetypeInternal(const KURL & url, QWidget* window = 0);
00481 void enter_loop();
00482
00486 static QStringList* tmpfiles;
00487
00488 static QString* lastErrorMsg;
00489 static int lastErrorCode;
00490
00491 friend class I_like_this_class;
00492
00493 private slots:
00494 void slotResult( KIO::Job * job );
00495 void slotMimetype( KIO::Job * job, const QString & type );
00496 void slotData( KIO::Job*, const QByteArray& );
00497 void slotRedirection( KIO::Job*, const KURL& );
00498
00499 private:
00500 UDSEntry m_entry;
00501 QString m_mimetype;
00502 QByteArray m_data;
00503 KURL m_url;
00504 QMap<QString, QString> *m_metaData;
00505
00509 bool bJobOK;
00510
00511 private:
00512 class NetAccessPrivate* d;
00513 };
00514
00515 }
00516
00517 #endif