netaccess.h
/*
This file is part of the KDE libraries
Copyright (C) 1997 Torben Weis (weis@kde.org)
Copyright (C) 1998 Matthias Ettrich (ettrich@kde.org)
Copyright (C) 1999-2004 David Faure (faure@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kio_netaccess_h
#define __kio_netaccess_h
#include <qobject.h>
#include <qstring.h>
#include <kio/global.h>
class QStringList;
class QWidget;
class KURL;
template<typename T, typename K> class QMap;
namespace KIO {
class Job;
class KIO_EXPORT NetAccess : public QObject
{
Q_OBJECT
public:
static bool download(const KURL& src, QString & target, QWidget* window);
static bool download(const KURL& src, QString & target) KDE_DEPRECATED;
static void removeTempFile(const QString& name);
static bool upload(const QString& src, const KURL& target, QWidget* window);
static bool upload(const QString& src, const KURL& target) KDE_DEPRECATED;
static bool copy( const KURL& src, const KURL& target, QWidget* window );
// KDE4: rename to file_copy
static bool copy( const KURL& src, const KURL& target ) KDE_DEPRECATED;
// KDE4: merge with above
static bool file_copy( const KURL& src, const KURL& dest, int permissions=-1,
bool overwrite=false, bool resume=false, QWidget* window = 0L );
static bool file_move( const KURL& src, const KURL& target, int permissions=-1,
bool overwrite=false, bool resume=false, QWidget* window = 0L );
static bool dircopy( const KURL& src, const KURL& target, QWidget* window );
static bool dircopy( const KURL& src, const KURL& target ) KDE_DEPRECATED; // KDE4: merge
static bool dircopy( const KURL::List& src, const KURL& target, QWidget* window = 0L );
static bool move( const KURL& src, const KURL& target, QWidget* window = 0L );
static bool move( const KURL::List& src, const KURL& target, QWidget* window = 0L );
static bool exists(const KURL& url, bool source, QWidget* window);
static bool exists(const KURL& url, QWidget* window) KDE_DEPRECATED;
static bool exists(const KURL& url) KDE_DEPRECATED;
static bool exists(const KURL& url, bool source) KDE_DEPRECATED; // KDE4: merge
static bool stat(const KURL& url, KIO::UDSEntry & entry, QWidget* window);
static bool stat(const KURL& url, KIO::UDSEntry & entry) KDE_DEPRECATED;
static KURL mostLocalURL(const KURL& url, QWidget* window);
static bool del( const KURL & url, QWidget* window );
static bool del( const KURL & url ) KDE_DEPRECATED;
static bool mkdir( const KURL & url, QWidget* window, int permissions = -1 );
static bool mkdir( const KURL & url, int permissions = -1 ) KDE_DEPRECATED;
static QString fish_execute( const KURL & url, const QString command, QWidget* window );
static bool synchronousRun( Job* job, QWidget* window, QByteArray* data=0,
KURL* finalURL=0, QMap<QString,QString>* metaData=0 );
static QString mimetype( const KURL & url, QWidget* window );
static QString mimetype( const KURL & url ) KDE_DEPRECATED;
static QString lastErrorString() { return lastErrorMsg ? *lastErrorMsg : QString::null; }
static int lastError() { return lastErrorCode; }
private:
NetAccess() : m_metaData(0), d(0) {}
~NetAccess() {}
bool filecopyInternal(const KURL& src, const KURL& target, int permissions,
bool overwrite, bool resume, QWidget* window, bool move);
bool dircopyInternal(const KURL::List& src, const KURL& target,
QWidget* window, bool move);
bool statInternal(const KURL & url, int details, bool source, QWidget* window = 0);
bool delInternal(const KURL & url, QWidget* window = 0);
bool mkdirInternal(const KURL & url, int permissions, QWidget* window = 0);
QString fish_executeInternal(const KURL & url, const QString command, QWidget* window = 0);
bool synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
KURL* finalURL, QMap<QString,QString>* metaData );
QString mimetypeInternal(const KURL & url, QWidget* window = 0);
void enter_loop();
static QStringList* tmpfiles;
static QString* lastErrorMsg;
static int lastErrorCode;
friend class I_like_this_class;
private slots:
void slotResult( KIO::Job * job );
void slotMimetype( KIO::Job * job, const QString & type );
void slotData( KIO::Job*, const QByteArray& );
void slotRedirection( KIO::Job*, const KURL& );
private:
UDSEntry m_entry;
QString m_mimetype;
QByteArray m_data;
KURL m_url;
QMap<QString, QString> *m_metaData;
bool bJobOK;
private:
class NetAccessPrivate* d; // not really needed, the ctor is private already.
};
}
#endif
KIO::NetAccess
Net Transparency.
Definition: netaccess.h:59
KIO::file_copy
KIO_EXPORT FileCopyJob * file_copy(const KURL &src, const KURL &dest, int permissions=-1, bool overwrite=false, bool resume=false, bool showProgressInfo=true)
Copy a single file.
Definition: job.cpp:1963
KIO::NetAccess::lastErrorString
static QString lastErrorString()
Returns the error string for the last job, in case it failed.
Definition: netaccess.h:468
KIO::move
KIO_EXPORT CopyJob * move(const KURL &src, const KURL &dest, bool showProgressInfo=true)
Moves a file or directory src to the given destination dest.
Definition: job.cpp:3908
KIO::mimetype
KIO_EXPORT MimetypeJob * mimetype(const KURL &url, bool showProgressInfo=true)
Find mimetype for one file or directory.
Definition: job.cpp:1509
KIO::copy
KIO_EXPORT CopyJob * copy(const KURL &src, const KURL &dest, bool showProgressInfo=true)
Copy a file or directory src into the destination dest, which can be a file (including the final file...
Definition: job.cpp:3886
KIO::NetAccess::lastError
static int lastError()
Returns the error code for the last job, in case it failed.
Definition: netaccess.h:475
KIO::stat
KIO_EXPORT StatJob * stat(const KURL &url, bool showProgressInfo=true)
Find all details for one file or directory.
Definition: job.cpp:886
KIO::file_move
KIO_EXPORT FileCopyJob * file_move(const KURL &src, const KURL &dest, int permissions=-1, bool overwrite=false, bool resume=false, bool showProgressInfo=true)
Move a single file.
Definition: job.cpp:1969
KIO::del
KIO_EXPORT DeleteJob * del(const KURL &src, bool shred=false, bool showProgressInfo=true)
Delete a file or directory.
Definition: job.cpp:4386
KIO::UDSEntry
QValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the informations for a file or URL.
Definition: global.h:504
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:68
KIO::mkdir
KIO_EXPORT SimpleJob * mkdir(const KURL &url, int permissions=-1)
Creates a single directory.
Definition: job.cpp:751

KDE Home | KDE Accessibility Home | Description of Access Keys