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

tdeio/tdeio

  • tdeio
  • tdeio
slavebase.h
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 <kurl.h>
24 #include <tdeconfigbase.h>
25 #include <tdeio/global.h>
26 #include <tdeio/authinfo.h>
27 
28 class DCOPClient;
29 class KRemoteEncoding;
30 
31 namespace TDEIO {
32 
33 class Connection;
34 class SlaveBasePrivate;
35 
45 class TDEIO_EXPORT SlaveBase
46 {
47 public:
48  SlaveBase( const TQCString &protocol, const TQCString &pool_socket, const TQCString &app_socket);
49  virtual ~SlaveBase();
50 
55  void exit();
56 
60  void dispatchLoop();
61 
65  void setConnection( Connection* connection ) { m_pConnection = connection; }
69  Connection *connection() const { return m_pConnection; }
70 
71 
73  // Message Signals to send to the job
75 
84  void data( const TQByteArray &data );
85 
90  void dataReq( );
91 
109  void error( int _errid, const TQString &_text );
110 
114  void connected();
115 
120  void finished();
121 
125  void needSubURLData();
126 
133  void slaveStatus(const TQString &host, bool connected);
134 
141  void statEntry( const UDSEntry& _entry );
142 
148  void listEntries( const UDSEntryList& _entry );
149 
157  bool canResume( TDEIO::filesize_t offset );
158 
159  /*
160  * Call this at the beginning of get(), if the "resume" metadata was set
161  * and resuming is implemented by this protocol.
162  */
163  void canResume();
164 
166  // Info Signals to send to the job
168 
174  void totalSize( TDEIO::filesize_t _bytes );
180  void processedSize( TDEIO::filesize_t _bytes );
181 
193  void processedPercent( float percent );
194 
200  void speed( unsigned long _bytes_per_second );
201 
206  void redirection( const KURL &_url );
207 
213  void errorPage();
214 
219  void mimeType( const TQString &_type );
220 
224  void warning( const TQString &msg );
225 
230  void infoMessage( const TQString &msg );
231 
232  enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
233 
247  int messageBox( MessageBoxType type, const TQString &text,
248  const TQString &caption = TQString::null,
249  const TQString &buttonYes = TQString::null,
250  const TQString &buttonNo = TQString::null );
251 
268  int messageBox( const TQString &text, MessageBoxType type,
269  const TQString &caption = TQString::null,
270  const TQString &buttonYes = TQString::null,
271  const TQString &buttonNo = TQString::null,
272  const TQString &dontAskAgainName = TQString::null );
273 
278  void setMetaData(const TQString &key, const TQString &value);
279 
285  bool hasMetaData(const TQString &key) const;
286 
291  TQString metaData(const TQString &key) const;
292 
298  bool hasMetaData(const TQString &key);
299 
304  TQString metaData(const TQString &key);
305 
311  MetaData allMetaData() const { return mIncomingMetaData; }
312 
320  TDEConfigBase* config();
321 
328  KRemoteEncoding* remoteEncoding();
329 
330 
332  // Commands sent by the job, the slave has to
333  // override what it wants to implement
335 
347  virtual void setHost(const TQString& host, int port, const TQString& user, const TQString& pass);
348 
352  virtual void setSubURL(const KURL&url);
353 
363  virtual void openConnection();
364 
373  virtual void closeConnection();
374 
381  virtual void get( const KURL& url );
382 
398  virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
399 
405  virtual void stat( const KURL& url );
406 
419  virtual void mimetype( const KURL& url );
420 
428  virtual void listDir( const KURL& url );
429 
437  virtual void mkdir( const KURL&url, int permissions );
438 
447  virtual void rename( const KURL& src, const KURL& dest, bool overwrite );
448 
456  virtual void symlink( const TQString& target, const KURL& dest, bool overwrite );
457 
462  virtual void chmod( const KURL& url, int permissions );
463 
474  virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
475 
482  virtual void del( const KURL &url, bool isfile);
483 
484  // TODO KDE4: add setLinkDest() or something, to modify symlink targets.
485  // Will be used for tdeio_file but also tdeio_remote (#97129)
486 
495  virtual void special( const TQByteArray & data );
496 
504  virtual void multiGet( const TQByteArray & data );
505 
510  virtual void slave_status();
511 
516  virtual void reparseConfiguration();
517 
523  virtual void localURL( const KURL& remoteURL );
524 
528  int connectTimeout();
529 
533  int proxyConnectTimeout();
534 
539  int responseTimeout();
540 
545  int readTimeout();
546 
561  void setTimeoutSpecialCommand(int timeout, const TQByteArray &data=TQByteArray());
562 
566  static void sigsegv_handler(int);
570  static void sigpipe_handler(int);
571 
573  // Dispatching (internal)
575 
579  virtual bool dispatch();
583  virtual void dispatch( int command, const TQByteArray &data );
584 
593  int readData( TQByteArray &buffer );
594 
606  void listEntry( const UDSEntry& _entry, bool ready);
607 
612  void connectSlave(const TQString& path);
613  void disconnectSlave();
614 
664  bool openPassDlg( TDEIO::AuthInfo& info, const TQString &errorMsg );
665 
670  bool openPassDlg( TDEIO::AuthInfo& info );
671 
699  bool checkCachedAuthentication( AuthInfo& info );
700 
707  bool cacheAuthentication( const AuthInfo& info );
708 
713  bool pingCacheDaemon() const;
714 
721  TQString createAuthCacheKey( const KURL& url );
722 
730  void sendAuthenticationKey( const TQCString& gKey, const TQCString& key, bool keep );
731 
740  void delCachedAuthentication( const TQString& key );
741 
746  void setMultipleAuthCaching( bool ) {};
747 
752  bool multipleAuthCaching() const { return false; }
753 
772  bool requestNetwork(const TQString& host = TQString::null);
773 
787  void dropNetwork(const TQString& host = TQString::null);
788 
793  DCOPClient *dcopClient();
794 
799  int waitForAnswer( int expected1, int expected2, TQByteArray & data, int * pCmd = 0 );
800 
804  void sendMetaData();
805 
809  TQCString mProtocol;
810 
811  Connection * m_pConnection;
812 
813  MetaData mOutgoingMetaData;
814  MetaData mIncomingMetaData;
815 
822  bool wasKilled() const;
823 
828  void setKillFlag();
829 
830 protected:
831  UDSEntryList pendingListEntries;
832  uint listEntryCurrentSize;
833  long listEntry_sec, listEntry_usec;
834  Connection *appconn;
835  TQString mPoolSocket;
836  TQString mAppSocket;
837  bool mConnectedToApp;
838  static long s_seqNr;
839  virtual void virtual_hook( int id, void* data );
840 
841 private:
842  SlaveBasePrivate *d;
843 };
844 
845 }
846 
847 #endif
TDEIO::chmod
TDEIO_EXPORT ChmodJob * chmod(const KFileItemList &lstItems, int permissions, int mask, TQString newOwner, TQString newGroup, bool recursive, bool showProgressInfo=true)
Creates a job that changes permissions/ownership on several files or directories, optionally recursiv...
Definition: chmodjob.cpp:230
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::SlaveBase
There are two classes that specifies the protocol between application (job) and tdeioslave.
Definition: slavebase.h:45
TDEIO::filesize_t
TQ_ULLONG filesize_t
64-bit file size
Definition: global.h:39
TDEIO::del
TDEIO_EXPORT DeleteJob * del(const KURL &src, bool shred=false, bool showProgressInfo=true)
Delete a file or directory.
Definition: job.cpp:4421
KRemoteEncoding
Allows encoding and decoding properly remote filenames into Unicode.
Definition: kremoteencoding.h:44
TDEIO::SlaveBase::multipleAuthCaching
bool multipleAuthCaching() const
Definition: slavebase.h:752
TDEIO
A namespace for TDEIO globals.
Definition: authinfo.h:29
TDEIO::copy
TDEIO_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:3921
TDEIO::localURL
TDEIO_EXPORT LocalURLJob * localURL(const KURL &remoteUrl)
Retrieve local URL if available.
Definition: job.cpp:841
TDEIO::stat
TDEIO_EXPORT StatJob * stat(const KURL &url, bool showProgressInfo=true)
Find all details for one file or directory.
Definition: job.cpp:921
TDEIO::mimetype
TDEIO_EXPORT MimetypeJob * mimetype(const KURL &url, bool showProgressInfo=true)
Find mimetype for one file or directory.
Definition: job.cpp:1544
TDEIO::Connection
This class provides a simple means for IPC between two applications via a pipe.
Definition: connection.h:48
TDEIO::AuthInfo
This class is intended to make it easier to prompt for, cache and retrieve authorization information...
Definition: authinfo.h:51
TDEIO::symlink
TDEIO_EXPORT SimpleJob * symlink(const TQString &target, const KURL &dest, bool overwrite, bool showProgressInfo=true)
Create or move a symlink.
Definition: job.cpp:779
TDEIO::SlaveBase::mProtocol
TQCString mProtocol
Name of the protocol supported by this slave.
Definition: slavebase.h:809
TDEIO::SlaveBase::setMultipleAuthCaching
void setMultipleAuthCaching(bool)
Definition: slavebase.h:746
TDEIO::put
TDEIO_EXPORT TransferJob * put(const KURL &url, int permissions, bool overwrite, bool resume, bool showProgressInfo=true)
Put (a.k.a.
Definition: job.cpp:1415
TDEIO::rename
TDEIO_EXPORT SimpleJob * rename(const KURL &src, const KURL &dest, bool overwrite)
Rename a file or directory.
Definition: job.cpp:772
TDEIO::mkdir
TDEIO_EXPORT SimpleJob * mkdir(const KURL &url, int permissions=-1)
Creates a single directory.
Definition: job.cpp:751
TDEIO::special
TDEIO_EXPORT SimpleJob * special(const KURL &url, const TQByteArray &data, bool showProgressInfo=true)
Execute any command that is specific to one slave (protocol).
Definition: job.cpp:786
TDEIO::listDir
TDEIO_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:2187
TDEIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:515

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.8.8
This website is maintained by Timothy Pearson.