Page MenuHomePhorge

kazv-io.hpp
No OneTemporary

Size
997 B
Referenced Files
None
Subscribers
None

kazv-io.hpp

#include <QObject>
#include <QUrl>
#include <KIO/Job>
#include <QtQml>
#include <KIO/TransferJob>
#include <QPointer>
#include <QSaveFile>
#include <QByteArray>
class KazvIO : public QObject {
Q_OBJECT
QML_ELEMENT
// Progress in decimal form, from 0 to 1
Q_PROPERTY(float progress READ progress NOTIFY progressChanged)
Q_PROPERTY(QUrl fileUrl READ fileUrl WRITE setFileUrl NOTIFY fileUrlChanged)
public:
KazvIO();
Q_INVOKABLE void download(QUrl url);
Q_INVOKABLE void suspend();
Q_INVOKABLE void resume();
Q_INVOKABLE void cancel();
float progress();
QUrl fileUrl();
void setFileUrl(QUrl fileUrl);
signals:
void progressChanged();
void fileUrlChanged();
void result();
private:
QPointer<KIO::TransferJob> m_job;
float m_progress = 0;
QUrl m_fileUrl;
QSaveFile m_file;
void updatePercent(KJob* job, unsigned long percent);
void write(KJob* job, const QByteArray& data);
void emitResult(KJob* job);
};

File Metadata

Mime Type
text/x-c++
Expires
Thu, Oct 2, 2:28 AM (22 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
486943
Default Alt Text
kazv-io.hpp (997 B)

Event Timeline