Commit 396f6c8e authored by Harald Hvaal's avatar Harald Hvaal
Browse files

Added path argument to addjob, to specify where in the archive the file is to be added

svn path=/trunk/KDE/kdeutils/ark/; revision=847704
parent 238b301a
......@@ -99,7 +99,7 @@ namespace Kerfuffle
AddJob* ArchiveBase::addFiles( const QStringList & files )
{
Q_ASSERT( !m_iface->isReadOnly() );
AddJob *newJob = new AddJob( files, static_cast<ReadWriteArchiveInterface*>( m_iface ), this );
AddJob *newJob = new AddJob(QString(), files, static_cast<ReadWriteArchiveInterface*>( m_iface ), this );
connect(m_iface, SIGNAL(userQuery(Query*)),
newJob, SIGNAL(userQuery(Query*)));
return newJob;
......
......@@ -82,7 +82,7 @@ namespace Kerfuffle
virtual bool isReadOnly() const;
virtual bool addFiles( const QStringList & files ) = 0;
virtual bool addFiles( const QString& path, const QStringList & files ) = 0;
virtual bool deleteFiles( const QList<QVariant> & files ) = 0;
};
......
......@@ -86,8 +86,8 @@ namespace Kerfuffle
m_archive->removeObserver( m_helper );
}
InternalAddJob::InternalAddJob( ReadWriteArchiveInterface *archive, const QStringList & files, QObject *parent )
: InternalJob( parent ), m_files( files ), m_archive( archive ), m_helper( 0 )
InternalAddJob::InternalAddJob( ReadWriteArchiveInterface *archive, const QString& path, const QStringList & files, QObject *parent )
: InternalJob( parent ), m_files( files ), m_path(path), m_archive( archive ), m_helper( 0 )
{
}
......@@ -109,7 +109,7 @@ namespace Kerfuffle
this, SIGNAL( error( const QString&, const QString& ) ) );
m_archive->registerObserver( m_helper );
setSuccess( m_archive->addFiles( m_files ) );
setSuccess( m_archive->addFiles( m_path, m_files ) );
m_archive->removeObserver( m_helper );
}
......
......@@ -101,7 +101,7 @@ namespace Kerfuffle
{
Q_OBJECT
public:
InternalAddJob( ReadWriteArchiveInterface *archive, const QStringList & files, QObject *parent = 0 );
InternalAddJob( ReadWriteArchiveInterface *archive, const QString& path, const QStringList & files, QObject *parent = 0 );
~InternalAddJob();
protected:
......@@ -114,6 +114,7 @@ namespace Kerfuffle
private:
QStringList m_files;
QString m_path;
ReadWriteArchiveInterface *m_archive;
ArchiveJobHelper *m_helper;
};
......
......@@ -140,8 +140,8 @@ namespace Kerfuffle
setPercent( static_cast<unsigned long>( 100.0*p ) );
}
AddJob::AddJob( const QStringList & files, ReadWriteArchiveInterface *interface, QObject *parent )
: KJob( parent ), m_files( files ), m_archive( interface )
AddJob::AddJob( const QString& path, const QStringList & files, ReadWriteArchiveInterface *interface, QObject *parent )
: KJob( parent ), m_files( files ), m_path(path), m_archive( interface )
{
}
......@@ -149,7 +149,7 @@ namespace Kerfuffle
{
emit description( this, i18np( "Adding a file", "Adding %1 files", m_files.count() ) );
InternalAddJob *job = new InternalAddJob( m_archive, m_files, this );
InternalAddJob *job = new InternalAddJob( m_archive, m_path, m_files, this );
connect( job, SIGNAL( done( ThreadWeaver::Job* ) ),
this, SLOT( done( ThreadWeaver::Job* ) ) );
......
......@@ -99,7 +99,7 @@ namespace Kerfuffle
{
Q_OBJECT
public:
AddJob( const QStringList & files, ReadWriteArchiveInterface *interface, QObject *parent = 0 );
AddJob(const QString& path, const QStringList & files, ReadWriteArchiveInterface *interface, QObject *parent = 0 );
void start();
......@@ -114,6 +114,7 @@ namespace Kerfuffle
private:
QStringList m_files;
QString m_path;
ReadWriteArchiveInterface *m_archive;
};
......
......@@ -118,7 +118,7 @@ bool BKInterface::browse( BkFileBase* base, const QString& prefix )
return true;
}
bool BKInterface::addFiles( const QStringList & files )
bool BKInterface::addFiles( const QString& path, const QStringList & files )
{
Q_UNUSED(files );
return false;
......
......@@ -36,7 +36,7 @@ class BKInterface: public ReadWriteArchiveInterface
bool list();
bool copyFiles( const QList<QVariant> & files, const QString & destinationDirectory, bool preservePaths );
bool addFiles( const QStringList & files );
bool addFiles( const QString& path, const QStringList & files );
bool deleteFiles( const QList<QVariant> & files );
private:
......
......@@ -275,7 +275,7 @@ void LibArchiveInterface::copyData( struct archive *source, struct archive *dest
}
}
bool LibArchiveInterface::addFiles( const QStringList & files )
bool LibArchiveInterface::addFiles(const QString& path, const QStringList & files )
{
struct archive *arch, *writer;
struct archive_entry *entry;
......
......@@ -40,7 +40,7 @@ class LibArchiveInterface: public ReadWriteArchiveInterface
bool list();
bool copyFiles( const QList<QVariant> & files, const QString & destinationDirectory, bool preservePaths );
bool addFiles( const QStringList & files );
bool addFiles(const QString& path, const QStringList & files );
bool deleteFiles( const QList<QVariant> & files );
private:
......
......@@ -260,7 +260,7 @@ class LibZipInterface: public ReadWriteArchiveInterface
return true;
}
bool addFiles( const QStringList & files )
bool addFiles( const QString& path, const QStringList & files )
{
kDebug( 1601 ) << "adding " << files.count() << " files";
progress( 0.0 );
......
......@@ -207,7 +207,7 @@ bool RARInterface::copyFiles( const QList<QVariant> & files, const QString & des
return true;
}
bool RARInterface::addFiles( const QStringList & files )
bool RARInterface::addFiles(const QString& path, const QStringList & files )
{
kDebug( 1601 ) << "Will try to add " << files << " to " << m_filename << " using " << m_rarpath;
......
......@@ -36,7 +36,7 @@ class RARInterface: public ReadWriteArchiveInterface
bool list();
bool copyFiles( const QList<QVariant> & files, const QString & destinationDirectory, bool preservePaths );
bool addFiles( const QStringList & files );
bool addFiles(const QString& path, const QStringList & files );
bool deleteFiles( const QList<QVariant> & files );
private:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment