slavebase.h
/*
Copyright (C) 2000 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 __slavebase_h
#define __slavebase_h
#include <kurl.h>
#include <kconfigbase.h>
#include <kio/global.h>
#include <kio/authinfo.h>
class DCOPClient;
class KRemoteEncoding;
namespace KIO {
class Connection;
class SlaveBasePrivate;
class KIO_EXPORT SlaveBase
{
public:
SlaveBase( const QCString &protocol, const QCString &pool_socket, const QCString &app_socket);
virtual ~SlaveBase();
void exit();
void dispatchLoop();
void setConnection( Connection* connection ) { m_pConnection = connection; }
Connection *connection() const { return m_pConnection; }
// Message Signals to send to the job
void data( const QByteArray &data );
void dataReq( );
void error( int _errid, const QString &_text );
void connected();
void finished();
void needSubURLData();
void slaveStatus(const QString &host, bool connected);
void statEntry( const UDSEntry& _entry );
void listEntries( const UDSEntryList& _entry );
bool canResume( KIO::filesize_t offset );
/*
* Call this at the beginning of get(), if the "resume" metadata was set
* and resuming is implemented by this protocol.
*/
void canResume();
// Info Signals to send to the job
void totalSize( KIO::filesize_t _bytes );
void processedSize( KIO::filesize_t _bytes );
void processedPercent( float percent );
void speed( unsigned long _bytes_per_second );
void redirection( const KURL &_url );
void errorPage();
void mimeType( const QString &_type );
void warning( const QString &msg );
void infoMessage( const QString &msg );
enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
int messageBox( MessageBoxType type, const QString &text,
const QString &caption = QString::null,
const QString &buttonYes = QString::null,
const QString &buttonNo = QString::null );
int messageBox( const QString &text, MessageBoxType type,
const QString &caption = QString::null,
const QString &buttonYes = QString::null,
const QString &buttonNo = QString::null,
const QString &dontAskAgainName = QString::null );
void setMetaData(const QString &key, const QString &value);
bool hasMetaData(const QString &key) const;
QString metaData(const QString &key) const;
bool hasMetaData(const QString &key);
QString metaData(const QString &key);
MetaData allMetaData() const { return mIncomingMetaData; }
KConfigBase* config();
KRemoteEncoding* remoteEncoding();
// Commands sent by the job, the slave has to
// override what it wants to implement
virtual void setHost(const QString& host, int port, const QString& user, const QString& pass);
virtual void setSubURL(const KURL&url);
virtual void openConnection();
virtual void closeConnection();
virtual void get( const KURL& url );
virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
virtual void stat( const KURL& url );
virtual void mimetype( const KURL& url );
virtual void listDir( const KURL& url );
virtual void mkdir( const KURL&url, int permissions );
virtual void rename( const KURL& src, const KURL& dest, bool overwrite );
virtual void symlink( const QString& target, const KURL& dest, bool overwrite );
virtual void chmod( const KURL& url, int permissions );
virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
virtual void del( const KURL &url, bool isfile);
// TODO KDE4: add setLinkDest() or something, to modify symlink targets.
// Will be used for kio_file but also kio_remote (#97129)
virtual void special( const QByteArray & data );
virtual void multiGet( const QByteArray & data );
virtual void slave_status();
virtual void reparseConfiguration();
int connectTimeout();
int proxyConnectTimeout();
int responseTimeout();
int readTimeout();
void setTimeoutSpecialCommand(int timeout, const QByteArray &data=QByteArray());
static void sigsegv_handler(int);
static void sigpipe_handler(int);
// Dispatching (internal)
virtual bool dispatch();
virtual void dispatch( int command, const QByteArray &data );
int readData( QByteArray &buffer );
void listEntry( const UDSEntry& _entry, bool ready);
void connectSlave(const QString& path);
void disconnectSlave();
bool openPassDlg( KIO::AuthInfo& info, const QString &errorMsg );
bool openPassDlg( KIO::AuthInfo& info );
bool checkCachedAuthentication( AuthInfo& info );
bool cacheAuthentication( const AuthInfo& info );
bool pingCacheDaemon() const;
QString createAuthCacheKey( const KURL& url );
void sendAuthenticationKey( const QCString& gKey, const QCString& key, bool keep );
void delCachedAuthentication( const QString& key );
void setMultipleAuthCaching( bool ) {};
bool multipleAuthCaching() const { return false; }
bool requestNetwork(const QString& host = QString::null);
void dropNetwork(const QString& host = QString::null);
DCOPClient *dcopClient();
int waitForAnswer( int expected1, int expected2, QByteArray & data, int * pCmd = 0 );
void sendMetaData();
QCString mProtocol;
Connection * m_pConnection;
MetaData mOutgoingMetaData;
MetaData mIncomingMetaData;
bool wasKilled() const;
void setKillFlag();
protected:
UDSEntryList pendingListEntries;
uint listEntryCurrentSize;
long listEntry_sec, listEntry_usec;
Connection *appconn;
QString mPoolSocket;
QString mAppSocket;
bool mConnectedToApp;
static long s_seqNr;
virtual void virtual_hook( int id, void* data );
private:
SlaveBasePrivate *d;
};
}
#endif
KIO::put
KIO_EXPORT TransferJob * put(const KURL &url, int permissions, bool overwrite, bool resume, bool showProgressInfo=true)
Put (a.k.a.
Definition: job.cpp:1380
KIO::SlaveBase::setMultipleAuthCaching
void setMultipleAuthCaching(bool)
Definition: slavebase.h:740
KIO::SlaveBase::multipleAuthCaching
bool multipleAuthCaching() const
Definition: slavebase.h:746
KIO::SlaveBase::mProtocol
QCString mProtocol
Name of the protocol supported by this slave.
Definition: slavebase.h:803
KIO::symlink
KIO_EXPORT SimpleJob * symlink(const QString &target, const KURL &dest, bool overwrite, bool showProgressInfo=true)
Create or move a symlink.
Definition: job.cpp:779
KRemoteEncoding
Allows encoding and decoding properly remote filenames into Unicode.
Definition: kremoteencoding.h:44
KIO::AuthInfo
This class is intended to make it easier to prompt for, cache and retrieve authorization information...
Definition: authinfo.h:51
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:512
KIO::listDir
KIO_EXPORT ListJob * listDir(const KURL &url, bool showProgressInfo=true, bool includeHidden=true)
List the contents of url, which is assumed to be a directory.
Definition: job.cpp:2152
KIO::mimetype
KIO_EXPORT MimetypeJob * mimetype(const KURL &url, bool showProgressInfo=true)
Find mimetype for one file or directory.
Definition: job.cpp:1509
KIO::chmod
KIO_EXPORT ChmodJob * chmod(const KFileItemList &lstItems, int permissions, int mask, QString newOwner, QString newGroup, bool recursive, bool showProgressInfo=true)
Creates a job that changes permissions/ownership on several files or directories, optionally recursiv...
Definition: chmodjob.cpp:230
KIO::SlaveBase
There are two classes that specifies the protocol between application (job) and kioslave.
Definition: slavebase.h:45
KIO::Connection
This class provides a simple means for IPC between two applications via a pipe.
Definition: connection.h:49
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::rename
KIO_EXPORT SimpleJob * rename(const KURL &src, const KURL &dest, bool overwrite)
Rename a file or directory.
Definition: job.cpp:772
KIO::filesize_t
Q_ULLONG filesize_t
64-bit file size
Definition: global.h:39
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::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::mkdir
KIO_EXPORT SimpleJob * mkdir(const KURL &url, int permissions=-1)
Creates a single directory.
Definition: job.cpp:751
KIO::special
KIO_EXPORT SimpleJob * special(const KURL &url, const QByteArray &data, bool showProgressInfo=true)
Execute any command that is specific to one slave (protocol).
Definition: job.cpp:786

KDE Home | KDE Accessibility Home | Description of Access Keys