Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7888926
kazv-io.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
kazv-io.cpp
View Options
#include
<QUrl>
#include
<KIO/StoredTransferJob>
#include
<QObject>
#include
<QString>
#include
<QSaveFile>
#include
<QIODevice>
#include
<QFileDialog>
#include
<QDebug>
#include
"kazv-io.hpp"
void
KazvIO::saveFileAs
(
QUrl
url
)
{
m_job
=
KIO
::
storedGet
(
url
);
connect
(
m_job
,
&
KJob
::
result
,
this
,
&
KazvIO
::
downloadFinished
);
connect
(
m_job
,
&
KJob
::
percentChanged
,
this
,
&
KazvIO
::
onPercentChanged
);
m_job
->
start
();
}
void
KazvIO::downloadFinished
(
KJob
*
job
)
{
if
(
job
->
error
())
{
qDebug
()
<<
job
->
errorString
();
return
;
}
auto
storedJob
=
qobject_cast
<
KIO
::
StoredTransferJob
*>
(
job
);
if
(
storedJob
)
{
auto
fileName
=
QFileDialog
::
getSaveFileName
();
auto
file
=
QSaveFile
(
fileName
);
file
.
open
(
QIODevice
::
WriteOnly
);
file
.
write
(
storedJob
->
data
());
file
.
commit
();
}
}
float
KazvIO::progress
()
{
return
m_progress
;
}
void
KazvIO::onPercentChanged
(
KJob
*
job
,
unsigned
long
percent
)
{
m_progress
=
1.0
*
percent
/
100
;
progressChanged
();
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Thu, Oct 2, 2:14 AM (17 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
486903
Default Alt Text
kazv-io.cpp (1 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment