QDialog(parent),
m_renameOneItem(false),
m_newName(),
- m_lineEdit(0),
+ m_lineEdit(nullptr),
m_items(items),
m_allExtensionsDifferent(true),
- m_spinBox(0)
+ m_spinBox(nullptr)
{
const QSize minSize = minimumSize();
setMinimumSize(QSize(320, minSize.height()));
m_okButton = buttonBox->button(QDialogButtonBox::Ok);
m_okButton->setDefault(true);
m_okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccepted()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &RenameDialog::slotAccepted);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &RenameDialog::reject);
m_okButton->setDefault(true);
- KGuiItem::assign(m_okButton, KGuiItem(i18nc("@action:button", "&Rename"), "dialog-ok-apply"));
+ KGuiItem::assign(m_okButton, KGuiItem(i18nc("@action:button", "&Rename"), QStringLiteral("dialog-ok-apply")));
QWidget* page = new QWidget(this);
mainLayout->addWidget(page);
QVBoxLayout* topLayout = new QVBoxLayout(page);
- QLabel* editLabel = 0;
+ QLabel* editLabel = nullptr;
if (m_renameOneItem) {
m_newName = items.first().name();
editLabel = new QLabel(xi18nc("@label:textbox", "Rename the item <filename>%1</filename> to:", m_newName),
widget = this;
}
- KIO::Job * job = KIO::moveAs(oldUrl, newUrl);
+ KIO::Job * job = KIO::moveAs(oldUrl, newUrl, KIO::HideProgressInfo);
KJobWidgets::setWindow(job, widget);
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job);
- job->ui()->setAutoErrorHandlingEnabled(true);
+
+ if (!job->error()) {
+ m_renamedItems << newUrl;
+ }
+
+ job->uiDelegate()->setAutoErrorHandlingEnabled(true);
}
void RenameDialog::slotAccepted()
renameItem(item, newName);
}
}
+
+ if (!m_items.empty()) {
+ emit renamingFinished(m_renamedItems);
+ }
}
QString RenameDialog::indexedName(const QString& name, int index, const QChar& indexPlaceHolder)