}
}
else total += items;
- parentItem->setText(0, files_list->topLevelItem(i)->text(0) + " " + i18np("(%1 item)", "(%1 items)", items));
+ parentItem->setText(0, files_list->topLevelItem(i)->text(0) + ' ' + i18np("(%1 item)", "(%1 items)", items));
}
}
if (m_name.isEmpty()) m_name = i18n("Untitled");
connect(this, SIGNAL(showMessage(const QString &, const QString &)), this, SLOT(slotDisplayMessage(const QString &, const QString &)));
compressed_archive->setHidden(true);
+ proxy_only->setHidden(true);
project_files->setHidden(true);
files_list->setHidden(true);
label->setText(i18n("Extract to"));
QString filter = slideUrl.fileName();
QString ext = filter.section('.', -1);
filter = filter.section('%', 0, -2);
- QString regexp = "^" + filter + "\\d+\\." + ext + "$";
+ QString regexp = '^' + filter + "\\d+\\." + ext + '$';
QRegExp rx(regexp);
QStringList slideImages;
QString directory = dir.absolutePath();
else if (filesList.contains(fileName)) {
// we have 2 files with same name
int ix = 0;
- QString newFileName = fileName.section('.', 0, -2) + "_" + QString::number(ix) + "." + fileName.section('.', -1);
+ QString newFileName = fileName.section('.', 0, -2) + '_' + QString::number(ix) + '.' + fileName.section('.', -1);
while (filesList.contains(newFileName)) {
ix ++;
- newFileName = fileName.section('.', 0, -2) + "_" + QString::number(ix) + "." + fileName.section('.', -1);
+ newFileName = fileName.section('.', 0, -2) + '_' + QString::number(ix) + '.' + fileName.section('.', -1);
}
fileName = newFileName;
item->setData(0, Qt::UserRole, fileName);
QString filter = slideUrl.fileName();
QString ext = filter.section('.', -1);
filter = filter.section('%', 0, -2);
- QString regexp = "^" + filter + "\\d+\\." + ext + "$";
+ QString regexp = '^' + filter + "\\d+\\." + ext + '$';
QRegExp rx(regexp);
QStringList slideImages;
qint64 totalSize = 0;
else if (filesList.contains(fileName)) {
// we have 2 files with same name
int ix = 0;
- QString newFileName = fileName.section('.', 0, -2) + "_" + QString::number(ix) + "." + fileName.section('.', -1);
+ QString newFileName = fileName.section('.', 0, -2) + '_' + QString::number(ix) + '.' + fileName.section('.', -1);
while (filesList.contains(newFileName)) {
ix ++;
newFileName = fileName.section('.', 0, -2) + "_" + QString::number(ix) + "." + fileName.section('.', -1);
QString destPath;
QTreeWidgetItem *parentItem;
bool isSlideshow = false;
+ int items = 0;
// We parse all files going into one folder, then start the copy job
-
for (int i = 0; i < files_list->topLevelItemCount(); i++) {
parentItem = files_list->topLevelItem(i);
if (parentItem->isDisabled()) {
else isSlideshow = false;
files_list->setCurrentItem(parentItem);
parentItem->setExpanded(true);
- destPath = parentItem->data(0, Qt::UserRole).toString() + "/";
+ destPath = parentItem->data(0, Qt::UserRole).toString() + '/';
destUrl = KUrl(archive_url->url().path(KUrl::AddTrailingSlash) + destPath);
QTreeWidgetItem *item;
for (int j = 0; j < parentItem->childCount(); j++) {
item = parentItem->child(j);
if (item->isDisabled()) continue;
// Special case: slideshows
+ items++;
if (isSlideshow) {
- destPath += item->data(0, Qt::UserRole).toString() + "/";
+ destPath += item->data(0, Qt::UserRole).toString() + '/';
destUrl = KUrl(archive_url->url().path(KUrl::AddTrailingSlash) + destPath);
QStringList srcFiles = item->data(0, Qt::UserRole + 1).toStringList();
for (int k = 0; k < srcFiles.count(); k++) {
}
}
+ if (items == 0) {
+ // No clips to archive
+ slotArchivingFinished(NULL, true);
+ return true;
+ }
+
if (destPath.isEmpty()) {
if (m_duplicateFiles.isEmpty()) return false;
QMapIterator<KUrl, KUrl> i(m_duplicateFiles);
return true;
}
-void ArchiveWidget::slotArchivingFinished(KJob *job)
+void ArchiveWidget::slotArchivingFinished(KJob *job, bool finished)
{
if (job == NULL || job->error() == 0) {
- if (slotStartArchiving(false)) {
+ if (!finished && slotStartArchiving(false)) {
// We still have files to archive
return;
}
KUrl src(item->text(0));
KUrl dest = destUrl;
if (isSlideshow) {
- dest = KUrl(destUrl.path(KUrl::AddTrailingSlash) + item->data(0, Qt::UserRole).toString() + "/" + src.fileName());
+ dest = KUrl(destUrl.path(KUrl::AddTrailingSlash) + item->data(0, Qt::UserRole).toString() + '/' + src.fileName());
}
else if (item->data(0, Qt::UserRole).isNull()) {
dest.addPath(src.fileName());
}
QDomElement mlt = m_doc.documentElement();
- QString root = mlt.attribute("root") + "/";
+ QString root = mlt.attribute("root") + '/';
// Adjust global settings
QString basePath;
QString endString("\"");
endString.append(basePath);
playList.replace(startString, endString);
- startString = ">" + archive_url->url().path(KUrl::RemoveTrailingSlash);
- endString = ">" + basePath;
+ startString = '>' + archive_url->url().path(KUrl::RemoveTrailingSlash);
+ endString = '>' + basePath;
playList.replace(startString, endString);
}
error = true;
}
else {
- QString playList = file.readAll();
+ QString playList = QString::fromUtf8(file.readAll());
file.close();
if (playList.isEmpty()) {
error = true;
itemsCount ++;
}
}
- parentItem->setText(0, parentItem->text(0).section("(", 0, 0) + i18np("(%1 item)", "(%1 items)", itemsCount));
+ parentItem->setText(0, parentItem->text(0).section('(', 0, 0) + i18np("(%1 item)", "(%1 items)", itemsCount));
}
project_files->setText(i18np("%1 file to archive, requires %2", "%1 files to archive, requires %2", total, KIO::convertSize(m_requestedSize)));
slotCheckSpace();