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

KIO

  • kio
  • kio
dataslave.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*
3  * This file is part of the KDE libraries
4  * Copyright (c) 2003 Leo Savernik <l.savernik@aon.at>
5  * Derived from slave.h
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_DATASLAVE_H
23 #define KIO_DATASLAVE_H
24 
25 #include "global.h"
26 #include "slave.h"
27 
28 class QTimer;
29 
30 // don't forget to sync DISPATCH_IMPL in dataslave.h
31 #define DISPATCH_DECL(type) \
32  void dispatch_##type();
33 
34 // don't forget to sync DISPATCH_IMPL1 in dataslave.h
35 #define DISPATCH_DECL1(type, paramtype, param) \
36  void dispatch_##type(paramtype param);
37 
38 namespace KIO {
39 
49  class DataSlave : public KIO::Slave {
50  Q_OBJECT
51  public:
52  DataSlave();
53 
54  virtual ~DataSlave();
55 
56  virtual void setHost(const QString &host, quint16 port,
57  const QString &user, const QString &passwd);
58  virtual void setConfig(const MetaData &config);
59 
60  virtual void suspend();
61  virtual void resume();
62  virtual bool suspended();
63  virtual void send(int cmd, const QByteArray &arr = QByteArray());
64 
65  virtual void hold(const KUrl &url);
66 
67  // pure virtual methods that are defined by the actual protocol
68  virtual void get(const KUrl &url) = 0;
69  virtual void mimetype(const KUrl &url) = 0;
70 
71  protected:
76  void setAllMetaData(const MetaData &);
81  void sendMetaData();
82 
83  // queuing methods
85  enum QueueType { Queue_mimeType = 1, Queue_totalSize,
86  Queue_sendMetaData, Queue_data, Queue_finished };
90  struct QueueStruct {
91  QueueType type;
92  QString s;
93  KIO::filesize_t size;
94  QByteArray ba;
95 
96  QueueStruct() {}
97  QueueStruct(QueueType type) : type(type) {}
98  };
99  typedef QList<QueueStruct> DispatchQueue;
100  DispatchQueue dispatchQueue;
101 
102  DISPATCH_DECL1(mimeType, const QString &, s)
103  DISPATCH_DECL1(totalSize, KIO::filesize_t, size)
104  DISPATCH_DECL(sendMetaData)
105  DISPATCH_DECL1(data, const QByteArray &, ba)
106  DISPATCH_DECL(finished)
107 
108  protected Q_SLOTS:
112  void dispatchNext();
113  private:
114  MetaData meta_data;
115  bool _suspended;
116  QTimer *timer;
117  };
118 
119 }
120 
121 #undef DISPATCH_DECL
122 #undef DISPATCH_DECL1
123 
124 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Apr 20 2013 06:03:08 by doxygen 1.8.3.1 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.10.2 API Reference

Skip menu "kdelibs-4.10.2 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