Commit 9c28c293 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix double insertion of image sequences.

Related to #768
parent 8df0d147
Pipeline #46874 passed with stage
in 10 minutes and 42 seconds
......@@ -461,27 +461,32 @@ void ClipCreationDialog::clipWidget(QDockWidget* m_DockClipWidget)
QString dialogFilter = allExtensions + QLatin1Char('|') + i18n("All Supported Files") + QStringLiteral("\n*|") + i18n("All Files");
QPushButton* importseq = new QPushButton(i18n("Import image sequence"));
// Make importseq checkable so that we can differentiate between a double click in filewidget and a click on the pushbutton
importseq->setCheckable(true);
fileWidget->setCustomWidget(importseq);
QObject::connect(fileWidget, &KFileWidget::accepted, fileWidget, [=] {
KFileItemList files = fileWidget->dirOperator()->selectedItems();
QList <QUrl> urls;
for (auto &f : files) {
urls << f.url();
// Required to only add file on double click and not on single click
fileWidget->setOperationMode(KFileWidget::Saving);
QObject::connect(fileWidget, &KFileWidget::accepted , [fileWidget, importseq]() {
if (importseq->isChecked()) {
// We are importing an image sequence, abort
return;
}
fileWidget->accept();
QList <QUrl> urls = fileWidget->selectedUrls();
pCore->bin()->droppedUrls(urls);
});
fileWidget->setFilter(dialogFilter);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, &KFileWidget::slotOk);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, &KFileWidget::accepted);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, &KFileWidget::accept);
QObject::connect(importseq, &QPushButton::clicked, fileWidget, [=]{
QUrl url;
url = fileWidget->selectedUrl();
fileWidget->slotOk();
fileWidget->accepted();
fileWidget->accept();
QUrl url = fileWidget->selectedUrl();
QStringList patternlist;
QString pattern = SlideshowClip::selectedPath(url, false, QString(), &patternlist);
int count = patternlist.size();
QString fileName = url.fileName().section(QLatin1Char('.'), 0, -2);
importseq->setChecked(false);
if (count >= 1) {
while (fileName.size() > 0 && fileName.at(fileName.size() - 1).isDigit()) {
fileName.chop(1);
......
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