Hi everyone,
I'm having trouble using the KArchive class to list the files contained in an archive. For now, I'm only trying to get it to compile, nothing more. Now, the class is virtual so I have to build a class based on it, but the constructor is being a pain somehow, so here's my derived class called Arch:
Code:
//This is arch.h
#include <qiodevice.h>
#include <karchive.h>
class Arch : public KArchive
{
public:
Arch(QIODevice*);
virtual bool writeDir( const QString& name, const QString& user, const QString& group );
virtual bool prepareWriting( const QString& name, const QString& user, const QString& group, uint size );
virtual bool doneWriting( uint size );
virtual bool closeArchive();
virtual bool openArchive( int mode );
};
The constructor of KArchive looks like this in karchive.h, it is "protected":
Code:
KArchive( QIODevice * dev );
This is arch.c:
Code:
//This is arch.c
#include "arch.h"
Arch::Arch(QIODevice*)
{
}
And now the code where I'm trying to use it:
Code:
#include <qlabel.h>
#include <qfile.h>
#include "testkzipwidget.h"
#include "arch.h"
testKZipWidget::testKZipWidget(QWidget* parent, const char* name, WFlags fl)
: testKZipWidgetBase(parent,name,fl)
{}
testKZipWidget::~testKZipWidget()
{}
/*$SPECIALIZATION$*/
void testKZipWidget::button_clicked()
{
//I know, this is not an archive but an image
//Doesn't matter as I'm only trying to get it compile first
QFile *file = new QFile("/home/manu/06.jpg");
Arch *dummy = new Arch(file);
}
And finally the compiler / linker error messages:
Code:
/home/manu/projects/kdeprojects/testkzip/src/arch.cpp: In constructor ‘Arch::Arch(QIODevice*)’:
/home/manu/projects/kdeprojects/testkzip/src/arch.cpp:3: error: no matching function for call to ‘KArchive::KArchive()’
/opt/kde3/include/karchive.h:50: note: candidates are: KArchive::KArchive(QIODevice*)
/opt/kde3/include/karchive.h:43: note: KArchive::KArchive(const KArchive&)
gmake: *** [arch.o] Error 1
gmake: Target `testkzip' not remade because of errors.
*** Exited with status: 2 ***
Can anyone tell me what I'm doing wrong? I'd think my constructor looks OK since it seems to be the problem. Does anyone have a code sample on how to use that KArchive class?
Manu