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

tdeio/tdeio

  • tdeio
  • tdeio
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 __tdeio_slaveinterface_h
21 #define __tdeio_slaveinterface_h
22 
23 #include <unistd.h>
24 #include <sys/types.h>
25 
26 #include <tqobject.h>
27 
28 #include <kurl.h>
29 #include <tdeio/global.h>
30 #include <tdeio/authinfo.h>
31 #include <kdatastream.h>
32 
33 namespace TDEIO {
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  INF_LOCALURL
59  // add new ones here once a release is done, to avoid breaking binary compatibility
60  };
61 
65  enum Message {
66  MSG_DATA = 100,
67  MSG_DATA_REQ,
68  MSG_ERROR,
69  MSG_CONNECTED,
70  MSG_FINISHED,
71  MSG_STAT_ENTRY,
72  MSG_LIST_ENTRIES,
73  MSG_RENAMED, // unused
74  MSG_RESUME,
75  MSG_SLAVE_STATUS,
76  MSG_SLAVE_ACK,
77  MSG_NET_REQUEST,
78  MSG_NET_DROP,
79  MSG_NEED_SUBURL_DATA,
80  MSG_CANRESUME,
81  MSG_AUTH_KEY, // deprecated.
82  MSG_DEL_AUTH_KEY // deprecated.
83  // add new ones here once a release is done, to avoid breaking binary compatibility
84  };
85 
93 class TDEIO_EXPORT SlaveInterface : public TQObject
94 {
95  TQ_OBJECT
96 
97 public:
98  SlaveInterface( Connection *connection );
99  virtual ~SlaveInterface();
100 
101  void setConnection( Connection* connection ) { m_pConnection = connection; }
102  Connection *connection() const { return m_pConnection; }
103 
104  void setProgressId( int id ) { m_progressId = id; }
105  int progressId() const { return m_progressId; }
106 
110  void sendResumeAnswer( bool resume );
111 
112  void setOffset( TDEIO::filesize_t offset );
113  TDEIO::filesize_t offset() const;
114 
115 signals:
117  // Messages sent by the slave
119 
120  void data( const TQByteArray & );
121  void dataReq( );
122  void error( int , const TQString & );
123  void connected();
124  void finished();
125  void slaveStatus(pid_t, const TQCString &, const TQString &, bool);
126  void listEntries( const TDEIO::UDSEntryList& );
127  void statEntry( const TDEIO::UDSEntry& );
128  void needSubURLData();
129  void needProgressId();
130 
131  void canResume( TDEIO::filesize_t ) ;
132 
134  // Info sent by the slave
136  void metaData( const TDEIO::MetaData & );
137  void totalSize( TDEIO::filesize_t ) ;
138  void processedSize( TDEIO::filesize_t ) ;
139  void redirection( const KURL& ) ;
140  void localURL( const KURL&, bool ) ;
141 
142  void speed( unsigned long ) ;
143  void errorPage() ;
144  void mimeType( const TQString & ) ;
145  void warning( const TQString & ) ;
146  void infoMessage( const TQString & ) ;
147  void connectFinished();
148 
152  void authorizationKey( const TQCString&, const TQCString&, bool );
153 
157  void delAuthorization( const TQCString& grpkey );
158 
159 protected:
161  // Dispatching
163 
164  virtual bool dispatch();
165  virtual bool dispatch( int _cmd, const TQByteArray &data );
166 
206  void openPassDlg( TDEIO::AuthInfo& info );
207 
211  void openPassDlg( const TQString& prompt, const TQString& user,
212  const TQString& caption, const TQString& comment,
213  const TQString& label, bool readOnly ) TDE_DEPRECATED;
214 
218  void openPassDlg( const TQString& prompt, const TQString& user, bool readOnly ) TDE_DEPRECATED;
219 
220  void messageBox( int type, const TQString &text, const TQString &caption,
221  const TQString &buttonYes, const TQString &buttonNo );
222 
226  void messageBox( int type, const TQString &text, const TQString &caption,
227  const TQString &buttonYes, const TQString &buttonNo, const TQString &dontAskAgainName );
228 
229  // I need to identify the slaves
230  void requestNetwork( const TQString &, const TQString &);
231  void dropNetwork( const TQString &, const TQString &);
232 
237  static void sigpipe_handler(int);
238 
239 protected slots:
240  void calcSpeed();
241 
242 protected:
243  Connection * m_pConnection;
244 
245 private:
246  int m_progressId;
247 protected:
248  virtual void virtual_hook( int id, void* data );
249 private:
250  SlaveInterfacePrivate *d;
251 };
252 
253 }
254 
255 inline TQDataStream &operator >>(TQDataStream &s, TDEIO::UDSAtom &a )
256 {
257  TQ_INT32 l;
258  s >> a.m_uds;
259 
260  if ( a.m_uds & TDEIO::UDS_LONG ) {
261  s >> l;
262  a.m_long = l;
263  a.m_str = TQString::null;
264  } else if ( a.m_uds & TDEIO::UDS_STRING ) {
265  s >> a.m_str;
266  a.m_long = 0;
267  } else {} // DIE!
268  // assert( 0 );
269 
270  return s;
271 }
272 
273 inline TQDataStream &operator <<(TQDataStream &s, const TDEIO::UDSAtom &a )
274 {
275  s << a.m_uds;
276 
277  if ( a.m_uds & TDEIO::UDS_LONG )
278  s << (TQ_INT32) a.m_long;
279  else if ( a.m_uds & TDEIO::UDS_STRING )
280  s << a.m_str;
281  else {} // DIE!
282  // assert( 0 );
283 
284  return s;
285 }
286 
287 TDEIO_EXPORT TQDataStream &operator <<(TQDataStream &s, const TDEIO::UDSEntry &e );
288 TDEIO_EXPORT TQDataStream &operator >>(TQDataStream &s, TDEIO::UDSEntry &e );
289 
290 #endif
TDEIO::AuthInfo
This class is intended to make it easier to prompt for, cache and retrieve authorization information.
Definition: authinfo.h:52
TDEIO::Connection
This class provides a simple means for IPC between two applications via a pipe.
Definition: connection.h:49
TDEIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:516
TDEIO::SlaveInterface
There are two classes that specifies the protocol between application (TDEIO::Job) and tdeioslave.
Definition: slaveinterface.h:94
TDEIO::SlaveInterface::delAuthorization
void delAuthorization(const TQCString &grpkey)
TDEIO::SlaveInterface::authorizationKey
void authorizationKey(const TQCString &, const TQCString &, bool)
TDEIO
A namespace for TDEIO globals.
Definition: authinfo.h:29
TDEIO::Info
Info
Identifiers for TDEIO informational messages.
Definition: slaveinterface.h:44
TDEIO::Message
Message
Identifiers for TDEIO data messages.
Definition: slaveinterface.h:65
TDEIO::localURL
TDEIO_EXPORT LocalURLJob * localURL(const KURL &remoteUrl)
Retrieve local URL if available.
Definition: job.cpp:870
TDEIO::UDS_STRING
@ UDS_STRING
First let's define the item types.
Definition: global.h:310
TDEIO::UDSEntry
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
Definition: global.h:507
TDEIO::filesize_t
TQ_ULLONG filesize_t
64-bit file size
Definition: global.h:39

tdeio/tdeio

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

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.1
This website is maintained by Timothy Pearson.