00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef __kio_netaccess_h
00025 #define __kio_netaccess_h
00026 
00027 #include <qobject.h>
00028 #include <qstring.h>
00029 #include <kio/global.h>
00030 #include <kdemacros.h>
00031 
00032 class QStringList;
00033 class QWidget;
00034 class KURL;
00035 
00036 namespace KIO {
00037 
00038   class Job;
00039 
00060 class NetAccess : public QObject
00061 {
00062   Q_OBJECT
00063 
00064 public:
00110     static bool download(const KURL& src, QString & target, QWidget* window);
00111 
00115     static bool download(const KURL& src, QString & target) KDE_DEPRECATED;
00116 
00128     static void removeTempFile(const QString& name);
00129 
00148     static bool upload(const QString& src, const KURL& target, QWidget* window);
00149 
00153     static bool upload(const QString& src, const KURL& target) KDE_DEPRECATED;
00154 
00173     static bool copy( const KURL& src, const KURL& target, QWidget* window );
00174     
00175 
00179     static bool copy( const KURL& src, const KURL& target ) KDE_DEPRECATED;
00180     
00181 
00185     static bool file_copy( const KURL& src, const KURL& dest, int permissions=-1,
00186                             bool overwrite=false, bool resume=false, QWidget* window = 0L );
00187 
00193     static bool file_move( const KURL& src, const KURL& target, int permissions=-1,
00194                            bool overwrite=false, bool resume=false, QWidget* window = 0L );
00195 
00196 
00216     static bool dircopy( const KURL& src, const KURL& target, QWidget* window );
00217 
00221     static bool dircopy( const KURL& src, const KURL& target ) KDE_DEPRECATED; 
00222 
00226     static bool dircopy( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00227 
00233     static bool move( const KURL& src, const KURL& target, QWidget* window = 0L );
00234 
00240     static bool move( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00241 
00257     static bool exists(const KURL& url, bool source, QWidget* window);
00258 
00262     static bool exists(const KURL& url, QWidget* window) KDE_DEPRECATED;
00263 
00267     static bool exists(const KURL& url) KDE_DEPRECATED;
00268 
00272     static bool exists(const KURL& url, bool source) KDE_DEPRECATED; 
00273 
00290     static bool stat(const KURL& url, KIO::UDSEntry & entry, QWidget* window);
00291 
00295     static bool stat(const KURL& url, KIO::UDSEntry & entry) KDE_DEPRECATED;
00296 
00311     static bool del( const KURL & url, QWidget* window );
00312 
00316     static bool del( const KURL & url ) KDE_DEPRECATED;
00317 
00332     static bool mkdir( const KURL & url, QWidget* window, int permissions = -1 );
00333 
00337     static bool mkdir( const KURL & url, int permissions = -1 ) KDE_DEPRECATED;
00338 
00357     static QString fish_execute( const KURL & url, const QString command, QWidget* window );
00358 
00381     static QString mimetype( const KURL & url, QWidget* window );
00382 
00386     static QString mimetype( const KURL & url ) KDE_DEPRECATED;
00387 
00392     static QString lastErrorString() { return lastErrorMsg ? *lastErrorMsg : QString::null; }
00393 
00394 private:
00398     NetAccess() {}
00399 
00403     ~NetAccess() {}
00404 
00408     bool filecopyInternal(const KURL& src, const KURL& target, int permissions,
00409                           bool overwrite, bool resume, QWidget* window, bool move);
00410     bool dircopyInternal(const KURL::List& src, const KURL& target,
00411                          QWidget* window, bool move);
00412     bool statInternal(const KURL & url, int details, bool source, QWidget* window = 0);
00413     UDSEntry m_entry;
00414     bool delInternal(const KURL & url, QWidget* window = 0);
00415     bool mkdirInternal(const KURL & url, int permissions, QWidget* window = 0);
00416     QString fish_executeInternal(const KURL & url, const QString command, QWidget* window = 0);
00417 
00418     QString mimetypeInternal(const KURL & url, QWidget* window = 0);
00419     void enter_loop();
00420     QString m_mimetype;
00421 
00425     static QStringList* tmpfiles;
00426 
00427     static QString* lastErrorMsg;
00431     bool bJobOK;
00432     friend class I_like_this_class;
00433 
00434 private slots:
00435     void slotResult( KIO::Job * job );
00436     void slotMimetype( KIO::Job * job, const QString & type );
00437 private:
00438     class NetAccessPrivate* d;
00439 };
00440 
00441 }
00442 
00443 #endif