00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __tdeio_netaccess_h
00024 #define __tdeio_netaccess_h
00025
00026 #include <tqobject.h>
00027 #include <tqstring.h>
00028 #include <tdeio/global.h>
00029
00030 class TQStringList;
00031 class TQWidget;
00032 class KURL;
00033 template<typename T, typename K> class TQMap;
00034
00035 namespace TDEIO {
00036
00037 class Job;
00038
00059 class TDEIO_EXPORT NetAccess : public TQObject
00060 {
00061 Q_OBJECT
00062
00063 public:
00117 static bool download(const KURL& src, TQString & target, TQWidget* window);
00118
00122 static bool download(const KURL& src, TQString & target) KDE_DEPRECATED;
00123
00135 static void removeTempFile(const TQString& name);
00136
00156 static bool upload(const TQString& src, const KURL& target, TQWidget* window);
00157
00161 static bool upload(const TQString& src, const KURL& target) KDE_DEPRECATED;
00162
00181 static bool copy( const KURL& src, const KURL& target, TQWidget* 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, TQWidget* window = 0L );
00195
00201 static bool file_move( const KURL& src, const KURL& target, int permissions=-1,
00202 bool overwrite=false, bool resume=false, TQWidget* window = 0L );
00203
00204
00224 static bool dircopy( const KURL& src, const KURL& target, TQWidget* 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, TQWidget* window = 0L );
00235
00241 static bool move( const KURL& src, const KURL& target, TQWidget* window = 0L );
00242
00248 static bool move( const KURL::List& src, const KURL& target, TQWidget* window = 0L );
00249
00262 static KURL localURL(const KURL& url, TQWidget* window);
00263
00280 static bool exists(const KURL& url, bool source, TQWidget* window);
00281
00286 static bool exists(const KURL& url, TQWidget* window) KDE_DEPRECATED;
00287
00291 static bool exists(const KURL& url) KDE_DEPRECATED;
00292
00296 static bool exists(const KURL& url, bool source) KDE_DEPRECATED;
00297
00314 static bool stat(const KURL& url, TDEIO::UDSEntry & entry, TQWidget* window);
00315
00319 static bool stat(const KURL& url, TDEIO::UDSEntry & entry) KDE_DEPRECATED;
00320
00337 static KURL mostLocalURL(const KURL& url, TQWidget* window);
00338
00353 static bool del( const KURL & url, TQWidget* window );
00354
00361 static bool del( const KURL & url ) KDE_DEPRECATED;
00362
00378 static bool mkdir( const KURL & url, TQWidget* window, int permissions = -1 );
00379
00386 static bool mkdir( const KURL & url, int permissions = -1 ) KDE_DEPRECATED;
00387
00406 static TQString fish_execute( const KURL & url, const TQString command, TQWidget* window );
00407
00442 static bool synchronousRun( Job* job, TQWidget* window, TQByteArray* data=0,
00443 KURL* finalURL=0, TQMap<TQString,TQString>* metaData=0 );
00444
00467 static TQString mimetype( const KURL & url, TQWidget* window );
00468
00475 static TQString mimetype( const KURL & url ) KDE_DEPRECATED;
00476
00482 static TQString lastErrorString() { return lastErrorMsg ? *lastErrorMsg : TQString::null; }
00483
00489 static int lastError() { return lastErrorCode; }
00490
00491 private:
00495 NetAccess() : m_metaData(0), d(0) {}
00496
00500 ~NetAccess() {}
00501
00505 bool filecopyInternal(const KURL& src, const KURL& target, int permissions,
00506 bool overwrite, bool resume, TQWidget* window, bool move);
00507 bool dircopyInternal(const KURL::List& src, const KURL& target,
00508 TQWidget* window, bool move);
00509 bool statInternal(const KURL & url, int details, bool source, TQWidget* window = 0);
00510 KURL localURLInternal( const KURL & url, TQWidget* window = 0);
00511
00512 bool delInternal(const KURL & url, TQWidget* window = 0);
00513 bool mkdirInternal(const KURL & url, int permissions, TQWidget* window = 0);
00514 TQString fish_executeInternal(const KURL & url, const TQString command, TQWidget* window = 0);
00515 bool synchronousRunInternal( Job* job, TQWidget* window, TQByteArray* data,
00516 KURL* finalURL, TQMap<TQString,TQString>* metaData );
00517
00518 TQString mimetypeInternal(const KURL & url, TQWidget* window = 0);
00519 void enter_loop();
00520
00524 static TQStringList* tmpfiles;
00525
00526 static TQString* lastErrorMsg;
00527 static int lastErrorCode;
00528
00529 friend class I_like_this_class;
00530
00531 private slots:
00532 void slotResult( TDEIO::Job * job );
00533 void slotMimetype( TDEIO::Job * job, const TQString & type );
00534 void slotLocalURL(TDEIO::Job*, const KURL&, bool);
00535 void slotData( TDEIO::Job*, const TQByteArray& );
00536 void slotRedirection( TDEIO::Job*, const KURL& );
00537
00538 private:
00539 UDSEntry m_entry;
00540 TQString m_mimetype;
00541 KURL m_localURL;
00542 TQByteArray m_data;
00543 KURL m_url;
00544 TQMap<TQString, TQString> *m_metaData;
00545
00549 bool bJobOK;
00550
00551 private:
00552 class NetAccessPrivate* d;
00553 };
00554
00555 }
00556
00557 #endif