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;
00066 class KIO_EXPORT NetAccess : public QObject
00067 {
00068 Q_OBJECT
00069
00070 public:
00071 enum StatSide {
00072 SourceSide,
00073 DestinationSide
00074 };
00075
00140 static bool download(const KUrl& src, QString & target, QWidget* window);
00141
00153 static void removeTempFile(const QString& name);
00154
00173 static bool upload(const QString& src, const KUrl& target, QWidget* window);
00174
00191 static bool file_copy( const KUrl& src, const KUrl& target, QWidget* window = 0 );
00193 static KDE_DEPRECATED bool copy( const KUrl& src, const KUrl& target,
00194 QWidget* window = 0 );
00195
00216 static bool dircopy( const KUrl& src, const KUrl& target, QWidget* window );
00217
00221 static bool dircopy( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
00222
00228 static KDE_DEPRECATED bool move( const KUrl& src, const KUrl& target, QWidget* window = 0L );
00229
00235 static KDE_DEPRECATED bool move( const KUrl::List& src, const KUrl& target, QWidget* window = 0L );
00236
00252 static KDE_DEPRECATED bool exists(const KUrl& url, bool source, QWidget* window);
00253
00268 static bool exists(const KUrl& url, StatSide statSide, QWidget* window);
00269
00286 static bool stat(const KUrl& url, KIO::UDSEntry & entry, QWidget* window);
00287
00288
00304 static KUrl mostLocalUrl(const KUrl& url, QWidget* window);
00305
00320 static bool del( const KUrl & url, QWidget* window );
00321
00337 static bool mkdir( const KUrl & url, QWidget* window, int permissions = -1 );
00338
00357 static QString fish_execute( const KUrl & url, const QString &command, QWidget* window );
00358
00391 static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
00392 KUrl* finalURL=0, QMap<QString,QString>* metaData=0 );
00393
00412 static QString mimetype( const KUrl & url, QWidget* window );
00413
00414
00420 static QString lastErrorString();
00421
00426 static int lastError();
00427
00428 Q_SIGNALS:
00429 void leaveModality();
00430 private:
00434 NetAccess();
00435
00439 ~NetAccess();
00440
00444 bool filecopyInternal(const KUrl& src, const KUrl& target, int permissions,
00445 KIO::JobFlags flags, QWidget* window, bool move);
00446 bool dircopyInternal(const KUrl::List& src, const KUrl& target,
00447 QWidget* window, bool move);
00448 bool statInternal(const KUrl & url, int details, StatSide side, QWidget* window = 0);
00449
00450 bool delInternal(const KUrl & url, QWidget* window = 0);
00451 bool mkdirInternal(const KUrl & url, int permissions, QWidget* window = 0);
00452 QString fish_executeInternal(const KUrl & url, const QString &command, QWidget* window = 0);
00453 bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
00454 KUrl* finalURL, QMap<QString,QString>* metaData );
00455
00456 QString mimetypeInternal(const KUrl & url, QWidget* window = 0);
00457 void enter_loop();
00458
00459 friend class I_like_this_class;
00460
00461 private Q_SLOTS:
00462 void slotResult( KJob * job );
00463 void slotMimetype( KIO::Job * job, const QString & type );
00464 void slotData( KIO::Job*, const QByteArray& );
00465 void slotRedirection( KIO::Job*, const KUrl& );
00466
00467 private:
00468 NetAccessPrivate * const d;
00469 };
00470
00471 }
00472
00473 #endif