~ubuntu-branches/ubuntu/maverick/kdeutils/maverick-proposed

« back to all changes in this revision

Viewing changes to ark/kerfuffle/jobs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-07-09 04:21:43 UTC
  • mfrom: (1.2.47 upstream)
  • Revision ID: james.westby@ubuntu.com-20100709042143-g7b98oq44qrc35cf
Tags: 4:4.4.92-0ubuntu1
* New upstream release
  - Bump kde-sc-dev-latest to 4.4.92

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (c) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
3
3
 * Copyright (c) 2008-2009 Harald Hvaal <haraldhv@stud.ntnu.no>
4
 
 * Copyright (c) 2009 Raphael Kubo da Costa <kubito@gmail.com>
 
4
 * Copyright (c) 2009-2010 Raphael Kubo da Costa <kubito@gmail.com>
5
5
 *
6
6
 * Redistribution and use in source and binary forms, with or without
7
7
 * modification, are permitted provided that the following conditions
37
37
 
38
38
namespace Kerfuffle
39
39
{
 
40
 
40
41
Job::Job(ReadOnlyArchiveInterface *interface, QObject *parent)
41
 
        : KJob(parent)
42
 
        , m_interface(interface)
43
 
        , m_workerThread(0)
 
42
    : KJob(parent)
 
43
    , m_interface(interface)
 
44
    , m_workerThread(0)
44
45
{
45
46
    static bool onlyOnce = false;
46
47
    if (!onlyOnce) {
120
121
}
121
122
 
122
123
ListJob::ListJob(ReadOnlyArchiveInterface *interface, QObject *parent)
123
 
        : Job(interface, parent),
124
 
        m_isSingleFolderArchive(true),
125
 
        m_isPasswordProtected(false),
126
 
        m_extractedFilesSize(0)
 
124
    : Job(interface, parent)
 
125
    , m_isSingleFolderArchive(true)
 
126
    , m_isPasswordProtected(false)
 
127
    , m_extractedFilesSize(0)
127
128
{
128
129
    connect(this, SIGNAL(newEntry(const ArchiveEntry&)),
129
130
            this, SLOT(onNewEntry(const ArchiveEntry&)));
140
141
    }
141
142
}
142
143
 
143
 
qlonglong ListJob::extractedFilesSize()
 
144
qlonglong ListJob::extractedFilesSize() const
144
145
{
145
146
    return m_extractedFilesSize;
146
147
}
147
148
 
148
 
bool ListJob::isPasswordProtected()
 
149
bool ListJob::isPasswordProtected() const
149
150
{
150
151
    return m_isPasswordProtected;
151
152
}
152
153
 
153
 
bool ListJob::isSingleFolderArchive()
 
154
bool ListJob::isSingleFolderArchive() const
154
155
{
155
156
    return m_isSingleFolderArchive;
156
157
}
176
177
    }
177
178
}
178
179
 
179
 
QString ListJob::subfolderName()
 
180
QString ListJob::subfolderName() const
180
181
{
181
182
    return m_subfolderName;
182
183
}
183
184
 
184
 
ExtractJob::ExtractJob(const QList<QVariant>& files, const QString& destinationDir,
185
 
                       ExtractionOptions options, ReadOnlyArchiveInterface *interface, QObject *parent)
186
 
        : Job(interface,  parent), m_files(files), m_destinationDir(destinationDir), m_options(options)
 
185
ExtractJob::ExtractJob(const QVariantList& files, const QString& destinationDir, ExtractionOptions options, ReadOnlyArchiveInterface *interface, QObject *parent)
 
186
    : Job(interface, parent)
 
187
    , m_files(files)
 
188
    , m_destinationDir(destinationDir)
 
189
    , m_options(options)
187
190
{
188
191
}
189
192
 
221
224
}
222
225
 
223
226
AddJob::AddJob(const QStringList& files, const CompressionOptions& options , ReadWriteArchiveInterface *interface, QObject *parent)
224
 
        : Job(interface, parent), m_files(files), m_options(options)
 
227
    : Job(interface, parent)
 
228
    , m_files(files)
 
229
    , m_options(options)
225
230
{
226
 
    kDebug();
227
231
}
228
232
 
229
233
void AddJob::doWork()
231
235
    emit description(this, i18np("Adding a file", "Adding %1 files", m_files.count()));
232
236
 
233
237
    ReadWriteArchiveInterface *m_writeInterface =
234
 
        qobject_cast<ReadWriteArchiveInterface*>
235
 
        (m_interface);
 
238
        qobject_cast<ReadWriteArchiveInterface*>(m_interface);
236
239
 
237
240
    Q_ASSERT(m_writeInterface);
238
241
 
244
247
    }
245
248
}
246
249
 
247
 
DeleteJob::DeleteJob(const QList<QVariant>& files, ReadWriteArchiveInterface *interface, QObject *parent)
248
 
        : Job(interface, parent), m_files(files)
 
250
DeleteJob::DeleteJob(const QVariantList& files, ReadWriteArchiveInterface *interface, QObject *parent)
 
251
    : Job(interface, parent)
 
252
    , m_files(files)
249
253
{
250
254
}
251
255
 
254
258
    emit description(this, i18np("Deleting a file from the archive", "Deleting %1 files", m_files.count()));
255
259
 
256
260
    ReadWriteArchiveInterface *m_writeInterface =
257
 
        qobject_cast<ReadWriteArchiveInterface*>
258
 
        (m_interface);
 
261
        qobject_cast<ReadWriteArchiveInterface*>(m_interface);
259
262
 
260
263
    Q_ASSERT(m_writeInterface);
261
264
 
266
269
        m_interface->finished(ret);
267
270
    }
268
271
}
 
272
 
269
273
} // namespace Kerfuffle
270
274
 
271
275
#include "jobs.moc"