Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/knewfilemenu.cpp
Show First 20 Lines • Show All 852 Lines • ▼ Show 20 Line(s) | 850 | { | |||
---|---|---|---|---|---|
853 | 853 | | |||
854 | QString name = expandTilde(m_text); | 854 | QString name = expandTilde(m_text); | ||
855 | 855 | | |||
856 | if (!name.isEmpty()) { | 856 | if (!name.isEmpty()) { | ||
857 | if (QDir::isAbsolutePath(name)) { | 857 | if (QDir::isAbsolutePath(name)) { | ||
858 | url = QUrl::fromLocalFile(name); | 858 | url = QUrl::fromLocalFile(name); | ||
859 | } else { | 859 | } else { | ||
860 | if (name == QLatin1String(".") || name == QLatin1String("..")) { | 860 | if (name == QLatin1String(".") || name == QLatin1String("..")) { | ||
861 | KGuiItem cancelGuiItem(KStandardGuiItem::cancel()); | 861 | KGuiItem enterNewNameGuiItem(KStandardGuiItem::ok()); | ||
862 | cancelGuiItem.setText(i18nc("@action:button", "Enter a Different Name")); | 862 | enterNewNameGuiItem.setText(i18nc("@action:button", "Enter a Different Name")); | ||
863 | cancelGuiItem.setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); | 863 | enterNewNameGuiItem.setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); | ||
864 | 864 | | |||
865 | QDialog *confirmDialog = new QDialog(m_parentWidget); | 865 | QDialog *confirmDialog = new QDialog(m_parentWidget); | ||
866 | confirmDialog->setWindowTitle(i18n("Invalid Directory Name")); | 866 | confirmDialog->setWindowTitle(i18n("Invalid Directory Name")); | ||
867 | confirmDialog->setModal(m_modal); | 867 | confirmDialog->setModal(m_modal); | ||
868 | confirmDialog->setAttribute(Qt::WA_DeleteOnClose); | 868 | confirmDialog->setAttribute(Qt::WA_DeleteOnClose); | ||
869 | 869 | | |||
870 | QDialogButtonBox *buttonBox = new QDialogButtonBox(confirmDialog); | 870 | QDialogButtonBox *buttonBox = new QDialogButtonBox(confirmDialog); | ||
871 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel); | 871 | buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); | ||
872 | KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), cancelGuiItem); | 872 | KGuiItem::assign(buttonBox->button(QDialogButtonBox::Ok), enterNewNameGuiItem); | ||
873 | 873 | | |||
874 | KMessageBox::createKMessageBox(confirmDialog, buttonBox, QMessageBox::Critical, | 874 | KMessageBox::createKMessageBox(confirmDialog, buttonBox, QMessageBox::Critical, | ||
875 | xi18n("Could not create a folder with the name <filename>%1</filename><nl/>because it is reserved for use by the operating system.", name), | 875 | xi18n("Could not create a folder with the name <filename>%1</filename><nl/>because it is reserved for use by the operating system.", name), | ||
876 | QStringList(), | 876 | QStringList(), | ||
877 | QString(), | 877 | QString(), | ||
878 | nullptr, | 878 | nullptr, | ||
879 | KMessageBox::NoExec, | 879 | KMessageBox::NoExec, | ||
880 | QString()); | 880 | QString()); | ||
881 | 881 | | |||
882 | QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(createDirectory())); | 882 | QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(createDirectory())); | ||
883 | m_fileDialog = confirmDialog; | 883 | m_fileDialog = confirmDialog; | ||
884 | confirmDialog->show(); | 884 | confirmDialog->show(); | ||
885 | _k_slotAbortDialog(); | 885 | _k_slotAbortDialog(); | ||
886 | return; | 886 | return; | ||
887 | } | 887 | } | ||
888 | if (!m_viewShowsHiddenFiles && name.startsWith('.')) { | 888 | if (!m_viewShowsHiddenFiles && name.startsWith('.')) { | ||
889 | if (!writeHiddenDir) { | 889 | if (!writeHiddenDir) { | ||
890 | confirmCreatingHiddenDir(name); | 890 | confirmCreatingHiddenDir(name); | ||
▲ Show 20 Lines • Show All 437 Lines • Show Last 20 Lines |