diff --git a/src/filewidgets/knewfilemenu.cpp b/src/filewidgets/knewfilemenu.cpp --- a/src/filewidgets/knewfilemenu.cpp +++ b/src/filewidgets/knewfilemenu.cpp @@ -428,12 +428,23 @@ KGuiItem::assign(buttonBox->button(QDialogButtonBox::Ok), continueGuiItem); KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), cancelGuiItem); - KMessageBox::createKMessageBox(confirmDialog, buttonBox, QMessageBox::Warning, + if (name.startsWith(QLatin1Char('.'))) { + confirmDialog->setWindowTitle(i18n("Create hidden directory?")); + KMessageBox::createKMessageBox(confirmDialog, buttonBox, QMessageBox::Warning, i18n("The name \"%1\" starts with a dot, so the directory will be hidden by default.", name), QStringList(), i18n("Do not ask again"), nullptr, KMessageBox::NoExec); + } else if (name.operator==(QLatin1String("~"))) { + confirmDialog->setWindowTitle(i18n("Create directory named ~?")); + KMessageBox::createKMessageBox(confirmDialog, buttonBox, QMessageBox::Warning, + i18n("The name \"%1\" is unsafe to have, since sudo rm ~ may will remove the home directory instead.", name), + QStringList(), + i18n("Do not ask again"), + nullptr, + KMessageBox::NoExec); + } QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(_k_slotCreateHiddenDirectory())); QObject::connect(buttonBox, &QDialogButtonBox::rejected, q, &KNewFileMenu::createDirectory); @@ -856,7 +867,7 @@ QUrl url; QUrl baseUrl = m_popupFiles.first(); - QString name = expandTilde(m_text); + QString name = m_text; if (!name.isEmpty()) { if (QDir::isAbsolutePath(name)) { @@ -890,12 +901,14 @@ _k_slotAbortDialog(); return; } - if (!m_viewShowsHiddenFiles && name.startsWith(QLatin1Char('.'))) { + + if ((!m_viewShowsHiddenFiles && name.startsWith(QLatin1Char('.'))) || (name.operator==(QLatin1String("~")))) { if (!writeHiddenDir) { confirmCreatingHiddenDir(name); return; } } + url = baseUrl; url.setPath(concatPaths(url.path(), name)); }