diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1574,6 +1574,35 @@ QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename); newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName)); +#ifndef Q_OS_WIN + //Confirm hiding file/folder by renaming inline + if (newName.startsWith(QChar('.')) && !oldItem.name().startsWith(QChar('.')) && !hiddenFilesShown()) { + KGuiItem yesGuiItem(KStandardGuiItem::yes()); + yesGuiItem.setText(i18nc("@action:button", "Rename and Hide")); + + const int code = KMessageBox::questionYesNo(nullptr, + oldItem.isFile() ? xi18nc("@info", "Adding a dot to the beginning of this file's name will hide it from view." + "Do you still want to rename it?To show hidden files or directories, " + "go to View->Hidden Files or type " + "alt+period." + ) + : xi18nc("@info", "Adding a dot to the beginning of this directory's name will hide it from " + "view.Do you still want to rename it?To show hidden files or " "directories, go to View->Hidden Files or type " + "alt+period." + ), + oldItem.isFile() ? i18n("Hide this file?") : i18n("Hide this directory?"), + yesGuiItem, + KStandardGuiItem::no(), + i18n(":Do not ask again"), + KMessageBox::Notify + ); + + if (code == KMessageBox::No) { + return; + } + } +#endif + const bool newNameExistsAlready = (m_model->index(newUrl) >= 0); if (!newNameExistsAlready) { // Only change the data in the model if no item with the new name