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:
00117 static bool download(const KURL& src, QString & target, QWidget* window);
00118
00122 static bool download(const KURL& src, QString & target) KDE_DEPRECATED;
00123
00135 static void removeTempFile(const QString& name);
00136
00156 static bool upload(const QString& src, const KURL& target, QWidget* window);
00157
00161 static bool upload(const QString& src, const KURL& target) KDE_DEPRECATED;
00162
00181 static bool copy( const KURL& src, const KURL& target, QWidget* window );
00182
00183
00187 static bool copy( const KURL& src, const KURL& target ) KDE_DEPRECATED;
00188
00189
00193 static bool file_copy( const KURL& src, const KURL& dest, int permissions=-1,
00194 bool overwrite=false, bool resume=false, QWidget* window = 0L );
00195
00201 static bool file_move( const KURL& src, const KURL& target, int permissions=-1,
00202 bool overwrite=false, bool resume=false, QWidget* window = 0L );
00203
00204
00224 static bool dircopy( const KURL& src, const KURL& target, QWidget* window );
00225
00229 static bool dircopy( const KURL& src, const KURL& target ) KDE_DEPRECATED;
00230
00234 static bool dircopy( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00235
00241 static bool move( const KURL& src, const KURL& target, QWidget* window = 0L );
00242
00248 static bool move( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00249
00266 static bool exists(const KURL& url, bool source, QWidget* window);
00267
00272 static bool exists(const KURL& url, QWidget* window) KDE_DEPRECATED;
00273
00277 static bool exists(const KURL& url) KDE_DEPRECATED;
00278
00282 static bool exists(const KURL& url, bool source) KDE_DEPRECATED;
00283
00300 static bool stat(const KURL& url, KIO::UDSEntry & entry, QWidget* window);
00301
00305 static bool stat(const KURL& url, KIO::UDSEntry & entry) KDE_DEPRECATED;
00306
00323 static KURL mostLocalURL(const KURL& url, QWidget* window);
00324
00339 static bool del( const KURL & url, QWidget* window );
00340
00347 static bool del( const KURL & url ) KDE_DEPRECATED;
00348
00364 static bool mkdir( const KURL & url, QWidget* window, int permissions = -1 );
00365
00372 static bool mkdir( const KURL & url, int permissions = -1 ) KDE_DEPRECATED;
00373
00392 static QString fish_execute( const KURL & url, const QString command, QWidget* window );
00393
00428 static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
00429 KURL* finalURL=0, QMap<QString,QString>* metaData=0 );
00430
00453 static QString mimetype( const KURL & url, QWidget* window );
00454
00461 static QString mimetype( const KURL & url ) KDE_DEPRECATED;
00462
00468 static QString lastErrorString() { return lastErrorMsg ? *lastErrorMsg : QString::null; }
00469
00475 static int lastError() { return lastErrorCode; }
00476
00477 private:
00481 NetAccess() : m_metaData(0), d(0) {}
00482
00486 ~NetAccess() {}
00487
00491 bool filecopyInternal(const KURL& src, const KURL& target, int permissions,
00492 bool overwrite, bool resume, QWidget* window, bool move);
00493 bool dircopyInternal(const KURL::List& src, const KURL& target,
00494 QWidget* window, bool move);
00495 bool statInternal(const KURL & url, int details, bool source, QWidget* window = 0);
00496
00497 bool delInternal(const KURL & url, QWidget* window = 0);
00498 bool mkdirInternal(const KURL & url, int permissions, QWidget* window = 0);
00499 QString fish_executeInternal(const KURL & url, const QString command, QWidget* window = 0);
00500 bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
00501 KURL* finalURL, QMap<QString,QString>* metaData );
00502
00503 QString mimetypeInternal(const KURL & url, QWidget* window = 0);
00504 void enter_loop();
00505
00509 static QStringList* tmpfiles;
00510
00511 static QString* lastErrorMsg;
00512 static int lastErrorCode;
00513
00514 friend class I_like_this_class;
00515
00516 private slots:
00517 void slotResult( KIO::Job * job );
00518 void slotMimetype( KIO::Job * job, const QString & type );
00519 void slotData( KIO::Job*, const QByteArray& );
00520 void slotRedirection( KIO::Job*, const KURL& );
00521
00522 private:
00523 UDSEntry m_entry;
00524 QString m_mimetype;
00525 QByteArray m_data;
00526 KURL m_url;
00527 QMap<QString, QString> *m_metaData;
00528
00532 bool bJobOK;
00533
00534 private:
00535 class NetAccessPrivate* d;
00536 };
00537
00538 }
00539
00540 #endif