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
00138 static bool download(const KUrl& src, QString & target, QWidget* window);
00139
00151 static void removeTempFile(const QString& name);
00152
00171 static bool upload(const QString& src, const KUrl& target, QWidget* window);
00172
00189 static bool file_copy( const KUrl& src, const KUrl& target, QWidget* window = 0 );
00191 static KDE_DEPRECATED bool copy( const KUrl& src, const KUrl& target,
00192 QWidget* window = 0 );
00193
00214 static bool dircopy( const KUrl& src, const KUrl& target, QWidget* window );
00215
00219 static bool dircopy( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
00220
00226 static KDE_DEPRECATED bool move( const KUrl& src, const KUrl& target, QWidget* window = 0L );
00227
00233 static KDE_DEPRECATED bool move( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
00234
00250 static KDE_DEPRECATED bool exists(const KUrl& url, bool source, QWidget* window);
00251
00266 static bool exists(const KUrl& url, StatSide statSide, QWidget* window);
00267
00284 static bool stat(const KUrl& url, KIO::UDSEntry & entry, QWidget* window);
00285
00286
00302 static KUrl mostLocalUrl(const KUrl& url, QWidget* window);
00303
00318 static bool del( const KUrl & url, QWidget* window );
00319
00335 static bool mkdir( const KUrl & url, QWidget* window, int permissions = -1 );
00336
00355 static QString fish_execute( const KUrl & url, const QString &command, QWidget* window );
00356
00389 static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
00390 KUrl* finalURL=0, QMap<QString,QString>* metaData=0 );
00391
00410 static QString mimetype( const KUrl & url, QWidget* window );
00411
00412
00418 static QString lastErrorString();
00419
00424 static int lastError();
00425
00426 Q_SIGNALS:
00427 void leaveModality();
00428 private:
00432 NetAccess();
00433
00437 ~NetAccess();
00438
00442 bool filecopyInternal(const KUrl& src, const KUrl& target, int permissions,
00443 KIO::JobFlags flags, QWidget* window, bool move);
00444 bool dircopyInternal(const KUrl::List& src, const KUrl& target,
00445 QWidget* window, bool move);
00446 bool statInternal(const KUrl & url, int details, StatSide side, QWidget* window = 0);
00447
00448 bool delInternal(const KUrl & url, QWidget* window = 0);
00449 bool mkdirInternal(const KUrl & url, int permissions, QWidget* window = 0);
00450 QString fish_executeInternal(const KUrl & url, const QString &command, QWidget* window = 0);
00451 bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
00452 KUrl* finalURL, QMap<QString,QString>* metaData );
00453
00454 QString mimetypeInternal(const KUrl & url, QWidget* window = 0);
00455 void enter_loop();
00456
00457 friend class I_like_this_class;
00458
00459 private Q_SLOTS:
00460 void slotResult( KJob * job );
00461 void slotMimetype( KIO::Job * job, const QString & type );
00462 void slotData( KIO::Job*, const QByteArray& );
00463 void slotRedirection( KIO::Job*, const KUrl& );
00464
00465 private:
00466 NetAccessPrivate * const d;
00467 };
00468
00469 }
00470
00471 #endif