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 <QtCore/QObject>
00027 #include <QtCore/QString>
00028 #include <kio/global.h>
00029 #include <kio/udsentry.h>
00030 #include <kurl.h>
00031 #include <kio/jobclasses.h>
00032
00033 class QStringList;
00034 class QWidget;
00035
00036 template<typename T, typename K> class QMap;
00037
00038 class KJob;
00039 namespace KIO {
00040
00041 class Job;
00042
00043 class NetAccessPrivate;
00064 class KIO_EXPORT NetAccess : public QObject
00065 {
00066 Q_OBJECT
00067
00068 public:
00069 enum StatSide {
00070 SourceSide,
00071 DestinationSide
00072 };
00073
00126 static bool download(const KUrl& src, QString & target, QWidget* window);
00127
00139 static void removeTempFile(const QString& name);
00140
00159 static bool upload(const QString& src, const KUrl& target, QWidget* window);
00160
00177 static bool file_copy( const KUrl& src, const KUrl& target, QWidget* window = 0 );
00179 static KDE_DEPRECATED bool copy( const KUrl& src, const KUrl& target,
00180 QWidget* window = 0 );
00181
00202 static bool dircopy( const KUrl& src, const KUrl& target, QWidget* window );
00203
00207 static bool dircopy( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
00208
00214 static KDE_DEPRECATED bool move( const KUrl& src, const KUrl& target, QWidget* window = 0L );
00215
00221 static KDE_DEPRECATED bool move( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
00222
00238 static KDE_DEPRECATED bool exists(const KUrl& url, bool source, QWidget* window);
00239
00254 static bool exists(const KUrl& url, StatSide statSide, QWidget* window);
00255
00272 static bool stat(const KUrl& url, KIO::UDSEntry & entry, QWidget* window);
00273
00274
00290 static KUrl mostLocalUrl(const KUrl& url, QWidget* window);
00291
00306 static bool del( const KUrl & url, QWidget* window );
00307
00323 static bool mkdir( const KUrl & url, QWidget* window, int permissions = -1 );
00324
00343 static QString fish_execute( const KUrl & url, const QString &command, QWidget* window );
00344
00377 static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
00378 KUrl* finalURL=0, QMap<QString,QString>* metaData=0 );
00379
00398 static QString mimetype( const KUrl & url, QWidget* window );
00399
00400
00406 static QString lastErrorString();
00407
00412 static int lastError();
00413
00414 Q_SIGNALS:
00415 void leaveModality();
00416 private:
00420 NetAccess();
00421
00425 ~NetAccess();
00426
00430 bool filecopyInternal(const KUrl& src, const KUrl& target, int permissions,
00431 KIO::JobFlags flags, QWidget* window, bool move);
00432 bool dircopyInternal(const KUrl::List& src, const KUrl& target,
00433 QWidget* window, bool move);
00434 bool statInternal(const KUrl & url, int details, StatSide side, QWidget* window = 0);
00435
00436 bool delInternal(const KUrl & url, QWidget* window = 0);
00437 bool mkdirInternal(const KUrl & url, int permissions, QWidget* window = 0);
00438 QString fish_executeInternal(const KUrl & url, const QString &command, QWidget* window = 0);
00439 bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
00440 KUrl* finalURL, QMap<QString,QString>* metaData );
00441
00442 QString mimetypeInternal(const KUrl & url, QWidget* window = 0);
00443 void enter_loop();
00444
00445 friend class I_like_this_class;
00446
00447 private Q_SLOTS:
00448 void slotResult( KJob * job );
00449 void slotMimetype( KIO::Job * job, const QString & type );
00450 void slotData( KIO::Job*, const QByteArray& );
00451 void slotRedirection( KIO::Job*, const KUrl& );
00452
00453 private:
00454 NetAccessPrivate * const d;
00455 };
00456
00457 }
00458
00459 #endif