• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
slavebase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2000 David Faure <faure@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef SLAVEBASE_H
21#define SLAVEBASE_H
22
23#include <kio/global.h>
24#include <kio/udsentry.h>
25#include <kio/authinfo.h>
26#include <kio/jobclasses.h> // for KIO::JobFlags
27#include <klocale.h>
28
29#include <QtCore/QByteArray>
30#include <QtNetwork/QHostInfo>
31
32class KConfigGroup;
33class KRemoteEncoding;
34class KUrl;
35
36namespace KIO {
37
38class Connection;
39class SlaveBasePrivate;
40
50class KIO_EXPORT SlaveBase
51{
52public:
53 SlaveBase( const QByteArray &protocol, const QByteArray &pool_socket, const QByteArray &app_socket);
54 virtual ~SlaveBase();
55
60 void exit();
61
65 void dispatchLoop();
66
68 // Message Signals to send to the job
70
79 void data( const QByteArray &data );
80
85 void dataReq( );
86
91 void opened();
92
121 void error( int _errid, const QString &_text );
122
126 void connected();
127
133 void finished();
134
138 void needSubUrlData();
139
146 void slaveStatus(const QString &host, bool connected);
147
154 void statEntry( const UDSEntry& _entry );
155
161 void listEntries( const UDSEntryList& _entry );
162
170 bool canResume( KIO::filesize_t offset );
171
176 void canResume();
177
179 // Info Signals to send to the job
181
186 void totalSize( KIO::filesize_t _bytes );
192 void processedSize( KIO::filesize_t _bytes );
193
194 void position( KIO::filesize_t _pos );
195
196 void written( KIO::filesize_t _bytes );
197
209 void processedPercent( float percent );
210
216 void speed( unsigned long _bytes_per_second );
217
222 void redirection( const KUrl &_url );
223
229 void errorPage();
230
235 void mimeType( const QString &_type );
236
240 void warning( const QString &msg );
241
246 void infoMessage( const QString &msg );
247
248 enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
249
263 int messageBox( MessageBoxType type, const QString &text,
264 const QString &caption = QString(),
265 const QString &buttonYes = i18n("&Yes"),
266 const QString &buttonNo = i18n("&No"));
267
283 int messageBox( const QString &text, MessageBoxType type,
284 const QString &caption = QString(),
285 const QString &buttonYes = i18n("&Yes"),
286 const QString &buttonNo = i18n("&No"),
287 const QString &dontAskAgainName = QString() );
288
293 void setMetaData(const QString &key, const QString &value);
294
299 bool hasMetaData(const QString &key) const;
300
304 QString metaData(const QString &key) const;
305
306
311 MetaData allMetaData() const;
312
320 KConfigGroup* config();
321
326 KRemoteEncoding* remoteEncoding();
327
328
330 // Commands sent by the job, the slave has to
331 // override what it wants to implement
333
345 virtual void setHost(const QString& host, quint16 port, const QString& user, const QString& pass);
346
350 virtual void setSubUrl(const KUrl&url);
351
361 virtual void openConnection();
362
371 virtual void closeConnection();
372
392 virtual void get( const KUrl& url );
393
400 virtual void open( const KUrl &url, QIODevice::OpenMode mode );
401
402 virtual void read( KIO::filesize_t size );
403 virtual void write( const QByteArray &data );
404 virtual void seek( KIO::filesize_t offset );
405 virtual void close();
406
422 virtual void put( const KUrl& url, int permissions, JobFlags flags );
423
439 virtual void stat( const KUrl& url );
440
453 virtual void mimetype( const KUrl& url );
454
464 virtual void listDir( const KUrl& url );
465
473 virtual void mkdir( const KUrl&url, int permissions );
474
501 virtual void rename( const KUrl& src, const KUrl& dest, JobFlags flags );
502
510 virtual void symlink( const QString& target, const KUrl& dest, JobFlags flags );
511
516 virtual void chmod( const KUrl& url, int permissions );
517
522 virtual void chown( const KUrl& url, const QString& owner, const QString& group );
523
531 virtual void setModificationTime( const KUrl& url, const QDateTime& mtime );
532
557 virtual void copy( const KUrl &src, const KUrl &dest, int permissions, JobFlags flags );
558
569 virtual void del( const KUrl &url, bool isfile);
570
576 virtual void setLinkDest( const KUrl& url, const QString& target );
577
586 virtual void special( const QByteArray & data );
587
595 virtual void multiGet( const QByteArray & data );
596
601 virtual void slave_status();
602
607 virtual void reparseConfiguration();
608
609
613 int connectTimeout();
614
618 int proxyConnectTimeout();
619
624 int responseTimeout();
625
630 int readTimeout();
631
645 void setTimeoutSpecialCommand(int timeout, const QByteArray &data=QByteArray());
646
648 // Dispatching (internal)
650
654 virtual void dispatch( int command, const QByteArray &data );
655
659 virtual void dispatchOpenCommand( int command, const QByteArray &data );
660
669 int readData( QByteArray &buffer );
670
682 void listEntry( const UDSEntry& _entry, bool ready);
683
688 void connectSlave(const QString& path);
689 void disconnectSlave();
690
743 bool openPasswordDialog( KIO::AuthInfo& info, const QString &errorMsg = QString() );
744
772 bool checkCachedAuthentication( AuthInfo& info );
773
800 bool cacheAuthentication( const AuthInfo& info );
801
820 bool requestNetwork(const QString& host = QString());
821
835 void dropNetwork(const QString& host = QString());
836
841 int waitForAnswer( int expected1, int expected2, QByteArray & data, int * pCmd = 0 );
842
855 void sendMetaData();
856
863 void sendAndKeepMetaData();
864
870 bool wasKilled() const;
871
875 void setKillFlag();
876
880 void lookupHost(const QString& host);
881
885 int waitForHostInfo(QHostInfo& info);
886
887protected:
891 QByteArray mProtocol;
892 //Often used by TcpSlaveBase and unlikely to change
893 MetaData mOutgoingMetaData;
894 MetaData mIncomingMetaData;
895
896 enum VirtualFunctionId {
897 AppConnectionMade = 0
898 };
899 virtual void virtual_hook( int id, void* data );
900
901private:
902#if 0 // TODO KDE5: enable
903 // This helps catching missing tr() calls in error().
904 void error( int _errid, const QByteArray &_text );
905#endif
906 void send(int cmd, const QByteArray& arr = QByteArray());
907 SlaveBasePrivate* const d;
908 friend class SlaveBasePrivate;
909};
910
911}
912
913#endif
authinfo.h
KConfigGroup
KIO::AuthInfo
This class is intended to make it easier to prompt for, cache and retrieve authorization information.
Definition: authinfo.h:58
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:397
KIO::SlaveBase
There are two classes that specifies the protocol between application (job) and kioslave.
Definition: slavebase.h:51
KIO::SlaveBase::VirtualFunctionId
VirtualFunctionId
Definition: slavebase.h:896
KIO::SlaveBase::mOutgoingMetaData
MetaData mOutgoingMetaData
Definition: slavebase.h:893
KIO::SlaveBase::mProtocol
QByteArray mProtocol
Name of the protocol supported by this slave.
Definition: slavebase.h:891
KIO::SlaveBase::MessageBoxType
MessageBoxType
Definition: slavebase.h:248
KIO::SlaveBase::mIncomingMetaData
MetaData mIncomingMetaData
Definition: slavebase.h:894
KIO::UDSEntry
Universal Directory Service.
Definition: udsentry.h:59
KRemoteEncoding
Allows encoding and decoding properly remote filenames into Unicode.
Definition: kremoteencoding.h:45
KUrl
QList< UDSEntry >
global.h
jobclasses.h
klocale.h
i18n
QString i18n(const char *text)
chmod
int chmod(const QString &path, mode_t mode)
mkdir
int mkdir(const QString &pathname, mode_t)
open
int open(const QString &pathname, int flags, mode_t mode)
stat
int stat(const QString &path, KDE_struct_stat *buf)
rename
int rename(const QString &in, const QString &out)
config
KSharedConfigPtr config()
KIO
A namespace for KIO globals.
Definition: kbookmarkmenu.h:55
KIO::chown
SimpleJob * chown(const KUrl &url, const QString &owner, const QString &group)
Changes ownership and group of a file or directory.
Definition: job.cpp:718
KIO::setModificationTime
SimpleJob * setModificationTime(const KUrl &url, const QDateTime &mtime)
Changes the modification time on a file or directory.
Definition: job.cpp:724
KIO::put
TransferJob * put(const KUrl &url, int permissions, JobFlags flags=DefaultFlags)
Put (a.k.a.
Definition: job.cpp:1700
KIO::listDir
ListJob * listDir(const KUrl &url, JobFlags flags=DefaultFlags, bool includeHidden=true)
List the contents of url, which is assumed to be a directory.
Definition: job.cpp:2735
KIO::get
TransferJob * get(const KUrl &url, LoadType reload=NoReload, JobFlags flags=DefaultFlags)
Get (a.k.a.
Definition: job.cpp:1369
KIO::special
SimpleJob * special(const KUrl &url, const QByteArray &data, JobFlags flags=DefaultFlags)
Execute any command that is specific to one slave (protocol).
Definition: job.cpp:745
KIO::mimetype
MimetypeJob * mimetype(const KUrl &url, JobFlags flags=DefaultFlags)
Find mimetype for one file or directory.
Definition: job.cpp:1856
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
KIO::symlink
SimpleJob * symlink(const QString &target, const KUrl &dest, JobFlags flags=DefaultFlags)
Create or move a symlink.
Definition: job.cpp:738
Information
Information
copy
KAction * copy(const QObject *recvr, const char *slot, QObject *parent)
close
KAction * close(const QObject *recvr, const char *slot, QObject *parent)
del
KGuiItem del()
udsentry.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal