KIO
netaccess.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE libraries 00003 Copyright (C) 1997 Torben Weis (weis@kde.org) 00004 Copyright (C) 1998 Matthias Ettrich (ettrich@kde.org) 00005 Copyright (C) 1999-2004 David Faure (faure@kde.org) 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 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> // for KIO::JobFlags 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; 00067 class KIO_EXPORT NetAccess : public QObject 00068 { 00069 Q_OBJECT 00070 00071 public: 00072 enum StatSide { 00073 SourceSide, 00074 DestinationSide 00075 }; 00076 00141 static bool download(const KUrl& src, QString & target, QWidget* window); 00142 00154 static void removeTempFile(const QString& name); 00155 00174 static bool upload(const QString& src, const KUrl& target, QWidget* window); 00175 00192 static bool file_copy( const KUrl& src, const KUrl& target, QWidget* window = 0 ); 00194 #ifndef KDE_NO_DEPRECATED 00195 static KDE_DEPRECATED bool copy( const KUrl& src, const KUrl& target, 00196 QWidget* window = 0 ); 00197 #endif 00198 00219 static bool dircopy( const KUrl& src, const KUrl& target, QWidget* window ); // TODO deprecate in favor of KIO::copy + synchronousRun (or job->exec()) 00220 00224 static bool dircopy( const KUrl::List& src, const KUrl& target, QWidget* window = 0L ); // TODO deprecate in favor of KIO::copy + synchronousRun (or job->exec()) 00225 00231 #ifndef KDE_NO_DEPRECATED 00232 static KDE_DEPRECATED bool move( const KUrl& src, const KUrl& target, QWidget* window = 0L ); 00233 #endif 00234 00240 #ifndef KDE_NO_DEPRECATED 00241 static KDE_DEPRECATED bool move( const KUrl::List& src, const KUrl& target, QWidget* window = 0L ); 00242 #endif 00243 00259 #ifndef KDE_NO_DEPRECATED 00260 static KDE_DEPRECATED bool exists(const KUrl& url, bool source, QWidget* window); 00261 #endif 00262 00277 static bool exists(const KUrl& url, StatSide statSide, QWidget* window); 00278 00295 static bool stat(const KUrl& url, KIO::UDSEntry & entry, QWidget* window); 00296 00297 00313 static KUrl mostLocalUrl(const KUrl& url, QWidget* window); 00314 00329 static bool del( const KUrl & url, QWidget* window ); 00330 00346 static bool mkdir( const KUrl & url, QWidget* window, int permissions = -1 ); 00347 00366 static QString fish_execute( const KUrl & url, const QString &command, QWidget* window ); 00367 00400 static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0, 00401 KUrl* finalURL=0, QMap<QString,QString>* metaData=0 ); 00402 00421 static QString mimetype( const KUrl & url, QWidget* window ); 00422 00423 00429 static QString lastErrorString(); 00430 00435 static int lastError(); 00436 00437 Q_SIGNALS: 00438 void leaveModality(); 00439 private: 00443 NetAccess(); 00444 00448 ~NetAccess(); 00449 00453 bool filecopyInternal(const KUrl& src, const KUrl& target, int permissions, 00454 KIO::JobFlags flags, QWidget* window, bool move); 00455 bool dircopyInternal(const KUrl::List& src, const KUrl& target, 00456 QWidget* window, bool move); 00457 bool statInternal(const KUrl & url, int details, StatSide side, QWidget* window = 0); 00458 00459 bool delInternal(const KUrl & url, QWidget* window = 0); 00460 bool mkdirInternal(const KUrl & url, int permissions, QWidget* window = 0); 00461 QString fish_executeInternal(const KUrl & url, const QString &command, QWidget* window = 0); 00462 bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data, 00463 KUrl* finalURL, QMap<QString,QString>* metaData ); 00464 00465 QString mimetypeInternal(const KUrl & url, QWidget* window = 0); 00466 void enter_loop(); 00467 00468 friend class I_like_this_class; 00469 00470 private Q_SLOTS: 00471 void slotResult( KJob * job ); 00472 void slotMimetype( KIO::Job * job, const QString & type ); 00473 void slotData( KIO::Job*, const QByteArray& ); 00474 void slotRedirection( KIO::Job*, const KUrl& ); 00475 00476 private: 00477 NetAccessPrivate * const d; 00478 }; 00479 00480 } 00481 00482 #endif
KDE 4.6 API Reference