Disable clipboardsharing in view only mode.
[kdenetwork.git] / kget / core / datasourcefactory.h
blobb52126b447864cce8ae847887f9dd9eb2e9250d6
1 /* This file is part of the KDE project
3 Copyright (C) 2008 Lukas Appelhans <l.appelhans@gmx.de>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9 */
10 #ifndef DATASOURCEFACTORY_H
11 #define DATASOURCEFACTORY_H
13 #include "kget_export.h"
15 #include "bitset.h"
17 #include <kio/job.h>
18 #include <QMap>
20 class TransferDataSource;
22 namespace KIO
24 class FileJob;
27 /**
28 This class manages multiple DataSources and saves the data to the file
30 class KGET_EXPORT DataSourceFactory : public QObject
32 Q_OBJECT
33 public:
34 DataSourceFactory(const KUrl &dest, const KIO::fileoffset_t &size, const KIO::fileoffset_t &segSize, QObject *parent);
35 ~DataSourceFactory();
37 void start();
38 void stop();
40 void addDataSource(TransferDataSource *source, const KUrl &url);
41 void removeDataSource(TransferDataSource *source);
43 private slots:
44 void assignSegment(TransferDataSource *source = 0);
45 void writeData(const KIO::fileoffset_t &offset, const QByteArray &data);
47 private:
48 KUrl m_dest;
49 KIO::fileoffset_t m_size;
50 KIO::fileoffset_t m_segSize;
51 QMap< TransferDataSource*, KUrl> m_dataSources;//The QPair is <offset, bytes>
52 BitSet *m_chunks;
53 KIO::FileJob* m_putJob;
56 #endif