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 00261 #ifndef KDE_NO_DEPRECATED 00262 static KDE_DEPRECATED bool exists(const KUrl& url, bool source, QWidget* window); 00263 #endif 00264 00279 static bool exists(const KUrl& url, StatSide statSide, QWidget* window); 00280 00297 static bool stat(const KUrl& url, KIO::UDSEntry & entry, QWidget* window); 00298 00299 00315 static KUrl mostLocalUrl(const KUrl& url, QWidget* window); 00316 00331 static bool del( const KUrl & url, QWidget* window ); 00332 00348 static bool mkdir( const KUrl & url, QWidget* window, int permissions = -1 ); 00349 00368 static QString fish_execute( const KUrl & url, const QString &command, QWidget* window ); 00369 00402 static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0, 00403 KUrl* finalURL=0, QMap<QString,QString>* metaData=0 ); 00404 00423 static QString mimetype( const KUrl & url, QWidget* window ); 00424 00425 00431 static QString lastErrorString(); 00432 00437 static int lastError(); 00438 00439 Q_SIGNALS: 00440 void leaveModality(); 00441 private: 00445 NetAccess(); 00446 00450 ~NetAccess(); 00451 00455 bool filecopyInternal(const KUrl& src, const KUrl& target, int permissions, 00456 KIO::JobFlags flags, QWidget* window, bool move); 00457 bool dircopyInternal(const KUrl::List& src, const KUrl& target, 00458 QWidget* window, bool move); 00459 bool statInternal(const KUrl & url, int details, StatSide side, QWidget* window = 0); 00460 00461 bool delInternal(const KUrl & url, QWidget* window = 0); 00462 bool mkdirInternal(const KUrl & url, int permissions, QWidget* window = 0); 00463 QString fish_executeInternal(const KUrl & url, const QString &command, QWidget* window = 0); 00464 bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data, 00465 KUrl* finalURL, QMap<QString,QString>* metaData ); 00466 00467 QString mimetypeInternal(const KUrl & url, QWidget* window = 0); 00468 void enter_loop(); 00469 00470 friend class I_like_this_class; 00471 00472 private Q_SLOTS: 00473 void slotResult( KJob * job ); 00474 void slotMimetype( KIO::Job * job, const QString & type ); 00475 void slotData( KIO::Job*, const QByteArray& ); 00476 void slotRedirection( KIO::Job*, const KUrl& ); 00477 00478 private: 00479 NetAccessPrivate * const d; 00480 }; 00481 00482 } 00483 00484 #endif
KDE 4.7 API Reference