diff --git a/krusader/Panel/listpanelactions.cpp b/krusader/Panel/listpanelactions.cpp --- a/krusader/Panel/listpanelactions.cpp +++ b/krusader/Panel/listpanelactions.cpp @@ -76,7 +76,7 @@ actRenameF2 = action(i18n("Rename"), "edit-rename", Qt::Key_F2, _func, SLOT(rename()) , "F2_Rename"); actViewFileF3 = action(i18n("View File"), nullptr, Qt::Key_F3, _func, SLOT(view()), "F3_View"); actEditFileF4 = action(i18n("Edit File"), nullptr, Qt::Key_F4, _func, SLOT(editFile()), "F4_Edit"); - actNewFileShiftF4 = action(i18n("&New Text File..."), "document-new", Qt::SHIFT + Qt::Key_F4, _func, SLOT(editNewFile()), "edit_new_file"); + actNewFileShiftF4 = action(i18n("&New Text File..."), "document-new", Qt::SHIFT + Qt::Key_F4, _func, SLOT(askEditFile()), "edit_new_file"); actCopyF5 = action(i18n("Copy to other panel"), nullptr, Qt::Key_F5, _func, SLOT(copyFiles()) , "F5_Copy"); actMoveF6 = action(i18n("Move to other panel"), nullptr, Qt::Key_F6, _func, SLOT(moveFiles()) , "F6_Move"); actCopyDelayedF5 = action(i18n("Copy delayed..."), nullptr, Qt::SHIFT + Qt::Key_F5, _func, SLOT(copyFilesDelayed()) , "F5_Copy_Queue"); diff --git a/krusader/Panel/panelfunc.h b/krusader/Panel/panelfunc.h --- a/krusader/Panel/panelfunc.h +++ b/krusader/Panel/panelfunc.h @@ -65,9 +65,9 @@ void terminal(); void view(); void viewDlg(); - void editFile(const QUrl &fileToCreate = QUrl()); - /** Create a new textfile and edit it. */ - void editNewFile(); + void editFile(const QUrl &filePath = QUrl()); + /** Ask for a filename; if it doesn't exist, create it; edit it */ + void askEditFile(); void moveFilesDelayed() { moveFiles(true); } void copyFilesDelayed() { copyFiles(true); } void moveFiles(bool enqueue = false) { copyFiles(enqueue, true); } @@ -131,7 +131,7 @@ protected slots: // Load the current url from history and refresh filesystem and panel to it void doRefresh(); - void slotFileCreated(KJob *job, const QUrl filePath); // a file has been created by editNewFile() + void slotFileCreated(KJob *job, const QUrl filePath); // a file has been created by askEditFile() or slotStatEdit() void historyGotoPos(int pos); void clipboardChanged(QClipboard::Mode mode); // Update the directory size in view diff --git a/krusader/Panel/panelfunc.cpp b/krusader/Panel/panelfunc.cpp --- a/krusader/Panel/panelfunc.cpp +++ b/krusader/Panel/panelfunc.cpp @@ -472,21 +472,21 @@ SLOTS->runTerminal(panel->lastLocalPath()); } -void ListPanelFunc::editFile(const QUrl &newFilePath) +void ListPanelFunc::editFile(const QUrl &filePath) { panel->searchBar->hideBarIfSearching(); QUrl editPath; - if (!newFilePath.isEmpty()) { - editPath = newFilePath; + if (!filePath.isEmpty()) { + editPath = filePath; } else { const QString name = panel->getCurrentName(); if (name.isNull()) return; editPath = files()->getUrl(name); } - const KFileItem fileToEdit = KFileItem(newFilePath); + const KFileItem fileToEdit = KFileItem(filePath); if (fileToEdit.isDir()) { KMessageBox::sorry(krMainWindow, i18n("You cannot edit a folder")); @@ -501,7 +501,7 @@ KrViewer::edit(editPath); } -void ListPanelFunc::editNewFile() +void ListPanelFunc::askEditFile() { // ask the user for the filename to edit const QUrl filePath = KChooseDir::getFile(i18n("Enter the filename to edit:"),