Changeset View
Changeset View
Standalone View
Standalone View
src/views/renamedialog.cpp
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 46 | { | |||
---|---|---|---|---|---|
57 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); | 57 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); | ||
58 | QVBoxLayout *mainLayout = new QVBoxLayout; | 58 | QVBoxLayout *mainLayout = new QVBoxLayout; | ||
59 | setLayout(mainLayout); | 59 | setLayout(mainLayout); | ||
60 | m_okButton = buttonBox->button(QDialogButtonBox::Ok); | 60 | m_okButton = buttonBox->button(QDialogButtonBox::Ok); | ||
61 | m_okButton->setDefault(true); | 61 | m_okButton->setDefault(true); | ||
62 | m_okButton->setShortcut(Qt::CTRL + Qt::Key_Return); | 62 | m_okButton->setShortcut(Qt::CTRL + Qt::Key_Return); | ||
63 | connect(buttonBox, &QDialogButtonBox::accepted, this, &RenameDialog::slotAccepted); | 63 | connect(buttonBox, &QDialogButtonBox::accepted, this, &RenameDialog::slotAccepted); | ||
64 | connect(buttonBox, &QDialogButtonBox::rejected, this, &RenameDialog::reject); | 64 | connect(buttonBox, &QDialogButtonBox::rejected, this, &RenameDialog::reject); | ||
65 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QObject::deleteLater); | ||||
65 | m_okButton->setDefault(true); | 66 | m_okButton->setDefault(true); | ||
66 | 67 | | |||
67 | KGuiItem::assign(m_okButton, KGuiItem(i18nc("@action:button", "&Rename"), QStringLiteral("dialog-ok-apply"))); | 68 | KGuiItem::assign(m_okButton, KGuiItem(i18nc("@action:button", "&Rename"), QStringLiteral("dialog-ok-apply"))); | ||
68 | 69 | | |||
69 | QWidget* page = new QWidget(this); | 70 | QWidget* page = new QWidget(this); | ||
70 | mainLayout->addWidget(page); | 71 | mainLayout->addWidget(page); | ||
71 | mainLayout->addWidget(buttonBox); | 72 | mainLayout->addWidget(buttonBox); | ||
72 | 73 | | |||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 171 | } else { | |||
173 | connect(qobject_cast<KIO::BatchRenameJob*>(job), &KIO::BatchRenameJob::fileRenamed, this, &RenameDialog::slotFileRenamed); | 174 | connect(qobject_cast<KIO::BatchRenameJob*>(job), &KIO::BatchRenameJob::fileRenamed, this, &RenameDialog::slotFileRenamed); | ||
174 | } | 175 | } | ||
175 | 176 | | |||
176 | KJobWidgets::setWindow(job, widget); | 177 | KJobWidgets::setWindow(job, widget); | ||
177 | const QUrl parentUrl = srcList.first().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); | 178 | const QUrl parentUrl = srcList.first().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash); | ||
178 | KIO::FileUndoManager::self()->recordJob(cmdType, srcList, parentUrl, job); | 179 | KIO::FileUndoManager::self()->recordJob(cmdType, srcList, parentUrl, job); | ||
179 | 180 | | |||
180 | connect(job, &KJob::result, this, &RenameDialog::slotResult); | 181 | connect(job, &KJob::result, this, &RenameDialog::slotResult); | ||
182 | connect(job, &KJob::result, this, &QObject::deleteLater); | ||||
181 | 183 | | |||
182 | job->uiDelegate()->setAutoErrorHandlingEnabled(true); | 184 | job->uiDelegate()->setAutoErrorHandlingEnabled(true); | ||
183 | 185 | | |||
184 | accept(); | 186 | accept(); | ||
185 | } | 187 | } | ||
186 | 188 | | |||
187 | void RenameDialog::slotTextChanged(const QString& newName) | 189 | void RenameDialog::slotTextChanged(const QString& newName) | ||
188 | { | 190 | { | ||
Show All 35 Lines |