• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kio
 

kio/kio

  • kio
  • kio
slaveinterface.h
1 /* This file is part of the KDE project
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 __kio_slaveinterface_h
21 #define __kio_slaveinterface_h
22 
23 #include <unistd.h>
24 #include <sys/types.h>
25 
26 #include <tqobject.h>
27 
28 #include <kurl.h>
29 #include <kio/global.h>
30 #include <kio/authinfo.h>
31 #include <kdatastream.h>
32 
33 namespace KIO {
34 
35 class Connection;
36 // better there is one ...
37 class SlaveInterfacePrivate;
38 
39  // Definition of enum Command has been moved to global.h
40 
44  enum Info {
45  INF_TOTAL_SIZE = 10,
46  INF_PROCESSED_SIZE = 11,
47  INF_SPEED,
48  INF_REDIRECTION = 20,
49  INF_MIME_TYPE = 21,
50  INF_ERROR_PAGE = 22,
51  INF_WARNING = 23,
52  INF_GETTING_FILE, // Deprecated
53  INF_NEED_PASSWD = 25,
54  INF_INFOMESSAGE,
55  INF_META_DATA,
56  INF_NETWORK_STATUS,
57  INF_MESSAGEBOX
58  // add new ones here once a release is done, to avoid breaking binary compatibility
59  };
60 
64  enum Message {
65  MSG_DATA = 100,
66  MSG_DATA_REQ,
67  MSG_ERROR,
68  MSG_CONNECTED,
69  MSG_FINISHED,
70  MSG_STAT_ENTRY,
71  MSG_LIST_ENTRIES,
72  MSG_RENAMED, // unused
73  MSG_RESUME,
74  MSG_SLAVE_STATUS,
75  MSG_SLAVE_ACK,
76  MSG_NET_REQUEST,
77  MSG_NET_DROP,
78  MSG_NEED_SUBURL_DATA,
79  MSG_CANRESUME,
80  MSG_AUTH_KEY, // deprecated.
81  MSG_DEL_AUTH_KEY // deprecated.
82  // add new ones here once a release is done, to avoid breaking binary compatibility
83  };
84 
92 class KIO_EXPORT SlaveInterface : public TQObject
93 {
94  Q_OBJECT
95 
96 public:
97  SlaveInterface( Connection *connection );
98  virtual ~SlaveInterface();
99 
100  void setConnection( Connection* connection ) { m_pConnection = connection; }
101  Connection *connection() const { return m_pConnection; }
102 
103  void setProgressId( int id ) { m_progressId = id; }
104  int progressId() const { return m_progressId; }
105 
109  void sendResumeAnswer( bool resume );
110 
111  void setOffset( KIO::filesize_t offset );
112  KIO::filesize_t offset() const;
113 
114 signals:
116  // Messages sent by the slave
118 
119  void data( const TQByteArray & );
120  void dataReq( );
121  void error( int , const TQString & );
122  void connected();
123  void finished();
124  void slaveStatus(pid_t, const TQCString &, const TQString &, bool);
125  void listEntries( const KIO::UDSEntryList& );
126  void statEntry( const KIO::UDSEntry& );
127  void needSubURLData();
128  void needProgressId();
129 
130  void canResume( KIO::filesize_t ) ;
131 
133  // Info sent by the slave
135  void metaData( const KIO::MetaData & );
136  void totalSize( KIO::filesize_t ) ;
137  void processedSize( KIO::filesize_t ) ;
138  void redirection( const KURL& ) ;
139 
140  void speed( unsigned long ) ;
141  void errorPage() ;
142  void mimeType( const TQString & ) ;
143  void warning( const TQString & ) ;
144  void infoMessage( const TQString & ) ;
145  void connectFinished();
146 
150  void authorizationKey( const TQCString&, const TQCString&, bool );
151 
155  void delAuthorization( const TQCString& grpkey );
156 
157 protected:
159  // Dispatching
161 
162  virtual bool dispatch();
163  virtual bool dispatch( int _cmd, const TQByteArray &data );
164 
204  void openPassDlg( KIO::AuthInfo& info );
205 
209  void openPassDlg( const TQString& prompt, const TQString& user,
210  const TQString& caption, const TQString& comment,
211  const TQString& label, bool readOnly ) KDE_DEPRECATED;
212 
216  void openPassDlg( const TQString& prompt, const TQString& user, bool readOnly ) KDE_DEPRECATED;
217 
218  void messageBox( int type, const TQString &text, const TQString &caption,
219  const TQString &buttonYes, const TQString &buttonNo );
220 
224  void messageBox( int type, const TQString &text, const TQString &caption,
225  const TQString &buttonYes, const TQString &buttonNo, const TQString &dontAskAgainName );
226 
227  // I need to identify the slaves
228  void requestNetwork( const TQString &, const TQString &);
229  void dropNetwork( const TQString &, const TQString &);
230 
235  static void sigpipe_handler(int);
236 
237 protected slots:
238  void calcSpeed();
239 
240 protected:
241  Connection * m_pConnection;
242 
243 private:
244  int m_progressId;
245 protected:
246  virtual void virtual_hook( int id, void* data );
247 private:
248  SlaveInterfacePrivate *d;
249 };
250 
251 }
252 
253 inline TQDataStream &operator >>(TQDataStream &s, KIO::UDSAtom &a )
254 {
255  TQ_INT32 l;
256  s >> a.m_uds;
257 
258  if ( a.m_uds & KIO::UDS_LONG ) {
259  s >> l;
260  a.m_long = l;
261  a.m_str = TQString::null;
262  } else if ( a.m_uds & KIO::UDS_STRING ) {
263  s >> a.m_str;
264  a.m_long = 0;
265  } else {} // DIE!
266  // assert( 0 );
267 
268  return s;
269 }
270 
271 inline TQDataStream &operator <<(TQDataStream &s, const KIO::UDSAtom &a )
272 {
273  s << a.m_uds;
274 
275  if ( a.m_uds & KIO::UDS_LONG )
276  s << (TQ_INT32) a.m_long;
277  else if ( a.m_uds & KIO::UDS_STRING )
278  s << a.m_str;
279  else {} // DIE!
280  // assert( 0 );
281 
282  return s;
283 }
284 
285 KIO_EXPORT TQDataStream &operator <<(TQDataStream &s, const KIO::UDSEntry &e );
286 KIO_EXPORT TQDataStream &operator >>(TQDataStream &s, KIO::UDSEntry &e );
287 
288 #endif
KIO::SlaveInterface
There are two classes that specifies the protocol between application (KIO::Job) and kioslave...
Definition: slaveinterface.h:92
KIO::UDS_STRING
First let's define the item types.
Definition: global.h:309
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:514
KIO::Info
Info
Identifiers for KIO informational messages.
Definition: slaveinterface.h:44
KIO::UDSEntry
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
Definition: global.h:506
KIO::Connection
This class provides a simple means for IPC between two applications via a pipe.
Definition: connection.h:49
KIO::filesize_t
TQ_ULLONG filesize_t
64-bit file size
Definition: global.h:39
KIO::Message
Message
Identifiers for KIO data messages.
Definition: slaveinterface.h:64

kio/kio

Skip menu "kio/kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kio/kio

Skip menu "kio/kio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kio by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |