<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
Thank you so much for your help.
<br>
</div>
<div>
<br>
</div>
<div>
Best Regards,
<br>
</div>
<blockquote type="cite">
<div>
El 05/11/2020 23:24 Albert Astals Cid <<a href="mailto:aacid@kde.org">aacid@kde.org</a>> escribió:
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
El dimarts, 3 de novembre de 2020, a les 17:41:28 CET, Gabriel Domínguez Camarero va escriure:
</div>
<blockquote type="cite">
<div>
Hi,
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
The first question " I have tried to do this but there some error that block me to open a file. I dont know if i am using correctly the class KCompressionDevice." is related with the code down bellow.
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
auto kgzip = KCompressionDevice(QUrl(where.toString() + “/” + fileName + “.gz”).toLocalFile(), KCompressionDevice::GZip);
</div>
<div>
assert(kgzip.isOpen() == true);
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
kgzip.write(QString("hello World").toUtf8());
</div>
<div>
kgzip.close();
</div>
</blockquote>
<div>
Well the code above doesn't compile; you can't assign KCompressionDevice around.
</div>
<div>
<br>
</div>
<div>
Also if you don't open the device, it won't open itself.
</div>
<div>
<br>
</div>
<div>
So
</div>
<div>
<br>
</div>
<div>
#include <KCompressionDevice>
</div>
<div>
#include <QDebug>
</div>
<div>
<br>
</div>
<div>
int main(int argc, char *argv) {
</div>
<div>
KCompressionDevice kgzip("hola.gz", KCompressionDevice::GZip);
</div>
<div>
kgzip.open(QIODevice::WriteOnly);
</div>
<div>
qDebug() << kgzip.isOpen();
</div>
<div>
kgzip.write(QString("hello World").toUtf8());
</div>
<div>
kgzip.close();
</div>
<div>
}
</div>
<div>
<br>
</div>
<div>
This does compile and creates a hola.gz file with hello Worlds as its contents.
</div>
<div>
<br>
</div>
<div>
Cheers,
</div>
<div>
Albert
</div>
<div>
<br>
</div>
<blockquote type="cite">
<div>
<br>
</div>
<div>
El 02/11/2020 22:34 Albert Astals Cid <<a href="mailto:aacid@kde.org">aacid@kde.org</a>> escribió:
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
El dilluns, 2 de novembre de 2020, a les 22:23:44 CET, Gabriel Domínguez Camarero va escriure:
</div>
<div>
Hello I am gabridc,
</div>
<div>
Hello Gabriel, this KDE Frameworks devel is for discussion around development *of* KDE Frameworks not *with* KDE Frameworks, your question belongs to <a href="mailto:kde-devel@kde.org">kde-devel@kde.org</a>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
I am a developer for Index-fm and we are trying to integrate KArchive in the file explorer, I have tried to do this but there some error that block me to open a file. I dont know if i am using correctly the class KCompressionDevice.
</div>
<div>
Is this question related to the code down below? or different?
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
Also, I would to ask another question because I would like to write a file inside my file.gz but in this case I dont have the function writeFile like KTar or KZip classes.
</div>
<div>
You can't write a file *inside* a gz file, a gz is not multiple files, it's just one file (a .tar.gz is still just one gz file, it's the tar part that has multiple files).
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
Cheers,
</div>
<div>
Albert
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
auto kgzip = KCompressionDevice(QUrl(where.toString() + “/” + fileName + “.gz”).toLocalFile(), KCompressionDevice::GZip);
</div>
<div>
assert(kgzip.isOpen() == true);
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
<br>
</div>
<div>
kgzip.write(QString("hello World").toUtf8());
</div>
<div>
kgzip.close();
</div>
</blockquote>
</blockquote>
</body>
</html>