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

KIO

  • kio
  • kio
slave.h
Go to the documentation of this file.
1// -*- c++ -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (c) 2000 Waldo Bastian <bastian@kde.org>
5 * 2000 Stephan Kulow <coolo@kde.org>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License version 2 as published by the Free Software Foundation.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 **/
21
22#ifndef KIO_SLAVE_H
23#define KIO_SLAVE_H
24
25#define KIO_SLAVE_EXPORT KIO_EXPORT
26
27#include <time.h>
28#include <unistd.h>
29
30#include <QtCore/QObject>
31
32#include <kurl.h>
33
34#include "kio/slaveinterface.h"
35
36namespace KIO {
37
38class SlavePrivate;
39class SimpleJob;
40// Attention developers: If you change the implementation of KIO::Slave,
41// do *not* use connection() or slaveconn but the respective KIO::Slave
42// accessor methods. Otherwise classes derived from Slave might break. (LS)
43//
44// Do not use this class directly, outside of KIO. Only use the Slave pointer
45// that is returned by the scheduler for passing it around.
46//
47// TODO: KDE5: Separate public API and private stuff for this better
48class KIO_SLAVE_EXPORT Slave : public KIO::SlaveInterface
49{
50 Q_OBJECT
51public:
52 explicit Slave(const QString &protocol, QObject *parent = 0);
53
54 virtual ~Slave();
55
56 void setPID(pid_t);
57 int slave_pid();
58
59 void setJob(KIO::SimpleJob *job);
60 KIO::SimpleJob *job() const;
61
65 void kill();
66
70 bool isAlive();
71
79 virtual void setHost( const QString &host, quint16 port,
80 const QString &user, const QString &passwd);
81
85 void resetHost();
86
90 virtual void setConfig(const MetaData &config);
91
97 QString protocol();
98
99 void setProtocol(const QString & protocol);
100
113 QString slaveProtocol();
114
118 QString host();
119
123 quint16 port();
124
128 QString user();
129
133 QString passwd();
134
145 static Slave* createSlave( const QString &protocol, const KUrl& url, int& error, QString& error_text );
146
151 static Slave* holdSlave( const QString &protocol, const KUrl& url );
152
158 static bool checkForHeldSlave(const KUrl& url);
159
160 // == communication with connected kioslave ==
161 // whenever possible prefer these methods over the respective
162 // methods in connection()
166 virtual void suspend();
167
171 virtual void resume();
172
177 virtual bool suspended();
178
184 virtual void send(int cmd, const QByteArray &arr = QByteArray());
185
186 // == end communication with connected kioslave ==
195 virtual void hold(const KUrl &url); // TODO KDE5: no reason to be virtual
196
200 time_t idleTime();
201
205 void setIdle();
206
207 /*
208 * @returns Whether the slave is connected
209 * (Connection oriented slaves only)
210 */
211 bool isConnected();
212 void setConnected(bool c);
213
214 void ref();
215 void deref();
216
217public Q_SLOTS:
218 void accept();
219 void gotInput();
220 void timeout();
221
222Q_SIGNALS:
223 void slaveDied(KIO::Slave *slave);
224
225private:
226 Q_DECLARE_PRIVATE(Slave)
227};
228
229}
230
231#undef KIO_SLAVE_EXPORT
232
233#endif
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition global.h:397
KIO::SimpleJob
A simple job (one url and one command).
Definition jobclasses.h:322
KIO::SlaveInterface
There are two classes that specifies the protocol between application ( KIO::Job) and kioslave.
Definition slaveinterface.h:99
KIO::SlaveInterface::error
void error(int, const QString &)
KIO::Slave
Definition slave.h:49
KIO::Slave::setPID
void setPID(pid_t)
Definition slave.cpp:261
KIO::Slave::host
QString host()
Definition slave.cpp:193
KIO::Slave::slave_pid
int slave_pid()
Definition slave.cpp:267
KIO::Slave::holdSlave
static Slave * holdSlave(const QString &protocol, const KUrl &url)
Requests a slave on hold for ths url, from klauncher, if there is such a job.
Definition slave.cpp:484
KIO::Slave::ref
void ref()
Definition slave.cpp:235
KIO::Slave::job
KIO::SimpleJob * job() const
Definition slave.cpp:282
KIO::Slave::suspended
virtual bool suspended()
Tells whether the kioslave is suspended.
Definition slave.cpp:326
KIO::Slave::send
virtual void send(int cmd, const QByteArray &arr=QByteArray())
Sends the given command to the kioslave.
Definition slave.cpp:332
KIO::Slave::hold
virtual void hold(const KUrl &url)
Puts the kioslave associated with url at halt, and return it to klauncher, in order to let another ap...
Definition slave.cpp:294
KIO::Slave::setHost
virtual void setHost(const QString &host, quint16 port, const QString &user, const QString &passwd)
Set host for url.
Definition slave.cpp:378
KIO::Slave::setJob
void setJob(KIO::SimpleJob *job)
Definition slave.cpp:273
KIO::Slave::suspend
virtual void suspend()
Suspends the operation of the attached kioslave.
Definition slave.cpp:314
KIO::Slave::checkForHeldSlave
static bool checkForHeldSlave(const KUrl &url)
Returns true if klauncher is holding a slave for url.
Definition slave.cpp:508
KIO::Slave::slaveProtocol
QString slaveProtocol()
The actual protocol used to handle the request.
Definition slave.cpp:187
KIO::Slave::accept
void accept()
Definition slave.cpp:113
KIO::Slave::createSlave
static Slave * createSlave(const QString &protocol, const KUrl &url, int &error, QString &error_text)
Creates a new slave.
Definition slave.cpp:410
KIO::Slave::kill
void kill()
Force termination.
Definition slave.cpp:361
KIO::Slave::user
QString user()
Definition slave.cpp:205
KIO::Slave::setConnected
void setConnected(bool c)
Definition slave.cpp:229
KIO::Slave::gotInput
void gotInput()
Definition slave.cpp:338
KIO::Slave::protocol
QString protocol()
The protocol this slave handles.
Definition slave.cpp:175
KIO::Slave::Slave
Slave(const QString &protocol, QObject *parent=0)
Definition slave.cpp:160
KIO::Slave::idleTime
time_t idleTime()
Definition slave.cpp:252
KIO::Slave::setIdle
void setIdle()
Marks this slave as idle.
Definition slave.cpp:217
KIO::Slave::isConnected
bool isConnected()
Definition slave.cpp:223
KIO::Slave::passwd
QString passwd()
Definition slave.cpp:211
KIO::Slave::port
quint16 port()
Definition slave.cpp:199
KIO::Slave::slaveDied
void slaveDied(KIO::Slave *slave)
KIO::Slave::timeout
void timeout()
Definition slave.cpp:123
KIO::Slave::deref
void deref()
Definition slave.cpp:241
KIO::Slave::setProtocol
void setProtocol(const QString &protocol)
Definition slave.cpp:181
KIO::Slave::resume
virtual void resume()
Resumes the operation of the attached kioslave.
Definition slave.cpp:320
KIO::Slave::resetHost
void resetHost()
Clear host info.
Definition slave.cpp:394
KIO::Slave::isAlive
bool isAlive()
Definition slave.cpp:288
KIO::Slave::setConfig
virtual void setConfig(const MetaData &config)
Configure slave.
Definition slave.cpp:401
KUrl
QObject
kurl.h
KIO
A namespace for KIO globals.
Definition kbookmarkmenu.h:55
KIO_SLAVE_EXPORT
#define KIO_SLAVE_EXPORT
Definition slave.h:25
slaveinterface.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 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