kio Library API Documentation

netaccess.h

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., 59 Temple Place - Suite 330,
00020     Boston, MA 02111-1307, USA.
00021 */
00022 
00023 #ifndef __kio_netaccess_h
00024 #define __kio_netaccess_h
00025 
00026 #include <qobject.h>
00027 #include <qstring.h>
00028 #include <kio/global.h>
00029 
00030 class QStringList;
00031 class QWidget;
00032 class KURL;
00033 template<typename T, typename K> class QMap;
00034 
00035 namespace KIO {
00036 
00037   class Job;
00038 
00059 class KIO_EXPORT NetAccess : public QObject
00060 {
00061   Q_OBJECT
00062 
00063 public:
00116     static bool download(const KURL& src, QString & target, QWidget* window);
00117 
00121     static bool download(const KURL& src, QString & target) KDE_DEPRECATED;
00122 
00134     static void removeTempFile(const QString& name);
00135 
00154     static bool upload(const QString& src, const KURL& target, QWidget* window);
00155 
00159     static bool upload(const QString& src, const KURL& target) KDE_DEPRECATED;
00160 
00179     static bool copy( const KURL& src, const KURL& target, QWidget* window );
00180     // KDE4: rename to file_copy
00181 
00185     static bool copy( const KURL& src, const KURL& target ) KDE_DEPRECATED;
00186     // KDE4: merge with above
00187 
00191     static bool file_copy( const KURL& src, const KURL& dest, int permissions=-1,
00192                             bool overwrite=false, bool resume=false, QWidget* window = 0L );
00193 
00199     static bool file_move( const KURL& src, const KURL& target, int permissions=-1,
00200                            bool overwrite=false, bool resume=false, QWidget* window = 0L );
00201 
00202 
00222     static bool dircopy( const KURL& src, const KURL& target, QWidget* window );
00223 
00227     static bool dircopy( const KURL& src, const KURL& target ) KDE_DEPRECATED; // KDE4: merge
00228 
00232     static bool dircopy( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00233 
00239     static bool move( const KURL& src, const KURL& target, QWidget* window = 0L );
00240 
00246     static bool move( const KURL::List& src, const KURL& target, QWidget* window = 0L );
00247 
00263     static bool exists(const KURL& url, bool source, QWidget* window);
00264 
00268     static bool exists(const KURL& url, QWidget* window) KDE_DEPRECATED;
00269 
00273     static bool exists(const KURL& url) KDE_DEPRECATED;
00274 
00278     static bool exists(const KURL& url, bool source) KDE_DEPRECATED; // KDE4: merge
00279 
00296     static bool stat(const KURL& url, KIO::UDSEntry & entry, QWidget* window);
00297 
00301     static bool stat(const KURL& url, KIO::UDSEntry & entry) KDE_DEPRECATED;
00302 
00317     static bool del( const KURL & url, QWidget* window );
00318 
00325     static bool del( const KURL & url ) KDE_DEPRECATED;
00326 
00341     static bool mkdir( const KURL & url, QWidget* window, int permissions = -1 );
00342 
00349     static bool mkdir( const KURL & url, int permissions = -1 ) KDE_DEPRECATED;
00350 
00369     static QString fish_execute( const KURL & url, const QString command, QWidget* window );
00370 
00405     static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
00406                                 KURL* finalURL=0, QMap<QString,QString>* metaData=0 );
00407 
00430     static QString mimetype( const KURL & url, QWidget* window );
00431 
00438     static QString mimetype( const KURL & url ) KDE_DEPRECATED;
00439 
00445     static QString lastErrorString() { return lastErrorMsg ? *lastErrorMsg : QString::null; }
00446 
00452     static int lastError() { return lastErrorCode; }
00453 
00454 private:
00458     NetAccess() : m_metaData(0), d(0) {}
00459 
00463     ~NetAccess() {}
00464 
00468     bool filecopyInternal(const KURL& src, const KURL& target, int permissions,
00469                           bool overwrite, bool resume, QWidget* window, bool move);
00470     bool dircopyInternal(const KURL::List& src, const KURL& target,
00471                          QWidget* window, bool move);
00472     bool statInternal(const KURL & url, int details, bool source, QWidget* window = 0);
00473 
00474     bool delInternal(const KURL & url, QWidget* window = 0);
00475     bool mkdirInternal(const KURL & url, int permissions, QWidget* window = 0);
00476     QString fish_executeInternal(const KURL & url, const QString command, QWidget* window = 0);
00477     bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
00478                                  KURL* finalURL, QMap<QString,QString>* metaData );
00479 
00480     QString mimetypeInternal(const KURL & url, QWidget* window = 0);
00481     void enter_loop();
00482 
00486     static QStringList* tmpfiles;
00487 
00488     static QString* lastErrorMsg;
00489     static int lastErrorCode;
00490 
00491     friend class I_like_this_class;
00492 
00493 private slots:
00494     void slotResult( KIO::Job * job );
00495     void slotMimetype( KIO::Job * job, const QString & type );
00496     void slotData( KIO::Job*, const QByteArray& );
00497     void slotRedirection( KIO::Job*, const KURL& );
00498 
00499 private:
00500     UDSEntry m_entry;
00501     QString m_mimetype;
00502     QByteArray m_data;
00503     KURL m_url;
00504     QMap<QString, QString> *m_metaData;
00505 
00509     bool bJobOK;
00510 
00511 private:
00512     class NetAccessPrivate* d; // not really needed, the ctor is private already.
00513 };
00514 
00515 }
00516 
00517 #endif
KDE Logo
This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Jan 23 19:33:35 2006 by doxygen 1.4.3 written by Dimitri van Heesch, © 1997-2003