Commit fcc86bb2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make sure that we don't cancel dialog

parent d954d015
Pipeline #70673 skipped
......@@ -202,14 +202,17 @@ void ThemeEditorPage::createZip(const QString &themeName, KZip *zip)
void ThemeEditorPage::addExtraPage()
{
QString filename = QInputDialog::getText(this, i18n("Filename of extra page"), i18n("Filename:"));
if (!filename.trimmed().isEmpty()) {
if (!filename.endsWith(QLatin1String(".html")) && !filename.endsWith(QLatin1String(".css")) && !filename.endsWith(QLatin1String(".js"))) {
filename += QLatin1String(".html");
bool ok = false;
QString filename = QInputDialog::getText(this, i18n("Filename of extra page"), i18n("Filename:"), {}, {}, &ok);
if (ok) {
if (!filename.trimmed().isEmpty()) {
if (!filename.endsWith(QLatin1String(".html")) && !filename.endsWith(QLatin1String(".css")) && !filename.endsWith(QLatin1String(".js"))) {
filename += QLatin1String(".html");
}
createExtraPage(filename);
mThemeSession->addExtraPage(filename);
setChanged(true);
}
createExtraPage(filename);
mThemeSession->addExtraPage(filename);
setChanged(true);
}
}
......
......@@ -205,14 +205,17 @@ void ContactEditorPage::createZip(const QString &themeName, KZip *zip)
void ContactEditorPage::addExtraPage()
{
QString filename = QInputDialog::getText(this, i18n("Filename of extra page"), i18n("Filename:"));
if (!filename.trimmed().isEmpty()) {
if (!filename.endsWith(QLatin1String(".html")) && !filename.endsWith(QLatin1String(".css")) && !filename.endsWith(QLatin1String(".js"))) {
filename += QLatin1String(".html");
bool ok = false;
QString filename = QInputDialog::getText(this, i18n("Filename of extra page"), i18n("Filename:"), {}, {}, &ok);
if (ok) {
if (!filename.trimmed().isEmpty()) {
if (!filename.endsWith(QLatin1String(".html")) && !filename.endsWith(QLatin1String(".css")) && !filename.endsWith(QLatin1String(".js"))) {
filename += QLatin1String(".html");
}
createExtraPage(filename);
mThemeSession->addExtraPage(filename);
setChanged(true);
}
createExtraPage(filename);
mThemeSession->addExtraPage(filename);
setChanged(true);
}
}
......
......@@ -227,14 +227,17 @@ void ThemeEditorPage::createZip(const QString &themeName, KZip *zip)
void ThemeEditorPage::addExtraPage()
{
QString filename = QInputDialog::getText(this, i18n("Filename of extra page"), i18n("Filename:"));
if (!filename.trimmed().isEmpty()) {
if (!filename.endsWith(QLatin1String(".html")) && !filename.endsWith(QLatin1String(".css")) && !filename.endsWith(QLatin1String(".js"))) {
filename += QLatin1String(".html");
bool ok = false;
QString filename = QInputDialog::getText(this, i18n("Filename of extra page"), i18n("Filename:"), {}, {}, &ok);
if (ok) {
if (!filename.trimmed().isEmpty()) {
if (!filename.endsWith(QLatin1String(".html")) && !filename.endsWith(QLatin1String(".css")) && !filename.endsWith(QLatin1String(".js"))) {
filename += QLatin1String(".html");
}
createExtraPage(filename);
mThemeSession->addExtraPage(filename);
setChanged(true);
}
createExtraPage(filename);
mThemeSession->addExtraPage(filename);
setChanged(true);
}
}
......
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