[frameworks/kio] src/filewidgets: knewfilemenu: reorder execute functions to match the order they are called in slotActionTriggered

Méven Car <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit cc4cfadf12661e0d6bb2069a471479bf4b5ff98d by Méven Car, on behalf of Antti Savolainen.
Committed on 09/08/2026 at 06:37.
Pushed by meven into branch 'master'.

knewfilemenu: reorder execute functions to match the order they are called in slotActionTriggered

This should improve readability

M  +42   -42   src/filewidgets/knewfilemenu.cpp

https://invent.kde.org/frameworks/kio/-/commit/cc4cfadf12661e0d6bb2069a471479bf4b5ff98d

diff --git a/src/filewidgets/knewfilemenu.cpp b/src/filewidgets/knewfilemenu.cpp
index 48c97b62a9..202a89dfdc 100644
--- a/src/filewidgets/knewfilemenu.cpp
+++ b/src/filewidgets/knewfilemenu.cpp
@@ -312,29 +312,29 @@ public:
     bool checkSourceExists(const QString &src);
 
     /*
-     * The strategy used for other desktop files than Type=Link. Example: Application, Device.
+     * The strategy used when creating a symlink
      */
-    void executeOtherDesktopFile(const KNewFileMenuSingleton::Entry &entry);
+    void executeSymLink(const KNewFileMenuSingleton::Entry &entry);
 
     /*
-     * The strategy used for "real files or directories" (the common case)
+     * The strategy used for "url" desktop files
      */
-    void executeRealFileOrDir(const KNewFileMenuSingleton::Entry &entry);
+    void executeUrlDesktopFile(const KNewFileMenuSingleton::Entry &entry);
 
     /*
-     * Actually performs file handling. Reads in m_copyData for needed data, that has been collected by execute*() before
+     * The strategy used for other desktop files than Type=Link. Example: Application, Device.
      */
-    void executeStrategy();
+    void executeOtherDesktopFile(const KNewFileMenuSingleton::Entry &entry);
 
     /*
-     * The strategy used when creating a symlink
+     * The strategy used for "real files or directories" (the common case)
      */
-    void executeSymLink(const KNewFileMenuSingleton::Entry &entry);
+    void executeRealFileOrDir(const KNewFileMenuSingleton::Entry &entry);
 
     /*
-     * The strategy used for "url" desktop files
+     * Actually performs file handling. Reads in m_copyData for needed data, that has been collected by execute*() before
      */
-    void executeUrlDesktopFile(const KNewFileMenuSingleton::Entry &entry);
+    void executeStrategy();
 
     /*
      * Fills the menu from the templates list.
@@ -579,6 +579,38 @@ bool KNewFileMenuPrivate::checkSourceExists(const QString &src)
     return true;
 }
 
+void KNewFileMenuPrivate::executeSymLink(const KNewFileMenuSingleton::Entry &entry)
+{
+    auto targetUrl = m_menuWorkingDirectory;
+    if (!targetUrl.isLocalFile()) {
+        targetUrl = mostLocalUrl(targetUrl);
+    }
+
+    KNameAndUrlInputDialog *dlg = new KNameAndUrlInputDialog(i18n("Name for new link:"), entry.comment, targetUrl, m_parentWidget);
+    dlg->setModal(q->isModal());
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setWindowTitle(i18n("Create Symlink"));
+    m_fileDialog = dlg;
+    QObject::connect(dlg, &QDialog::accepted, q, [this]() {
+        slotSymLink();
+    });
+    dlg->show();
+}
+
+void KNewFileMenuPrivate::executeUrlDesktopFile(const KNewFileMenuSingleton::Entry &entry)
+{
+    KNameAndUrlInputDialog *dlg = new KNameAndUrlInputDialog(i18n("Name for new link:"), entry.comment, m_menuWorkingDirectory, m_parentWidget);
+    m_copyData.m_templatePath = entry.templatePath;
+    dlg->setModal(q->isModal());
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setWindowTitle(i18n("Create link to URL"));
+    m_fileDialog = dlg;
+    QObject::connect(dlg, &QDialog::accepted, q, [this]() {
+        slotUrlDesktopFile();
+    });
+    dlg->show();
+}
+
 void KNewFileMenuPrivate::executeOtherDesktopFile(const KNewFileMenuSingleton::Entry &entry)
 {
     if (!checkSourceExists(entry.templatePath)) {
@@ -680,24 +712,6 @@ void KNewFileMenuPrivate::executeRealFileOrDir(const KNewFileMenuSingleton::Entr
     m_lineEdit->setFocus();
 }
 
-void KNewFileMenuPrivate::executeSymLink(const KNewFileMenuSingleton::Entry &entry)
-{
-    auto targetUrl = m_menuWorkingDirectory;
-    if (!targetUrl.isLocalFile()) {
-        targetUrl = mostLocalUrl(targetUrl);
-    }
-
-    KNameAndUrlInputDialog *dlg = new KNameAndUrlInputDialog(i18n("Name for new link:"), entry.comment, targetUrl, m_parentWidget);
-    dlg->setModal(q->isModal());
-    dlg->setAttribute(Qt::WA_DeleteOnClose);
-    dlg->setWindowTitle(i18n("Create Symlink"));
-    m_fileDialog = dlg;
-    QObject::connect(dlg, &QDialog::accepted, q, [this]() {
-        slotSymLink();
-    });
-    dlg->show();
-}
-
 void KNewFileMenuPrivate::executeStrategy()
 {
     m_tempFileToDelete = m_copyData.tempFileToDelete();
@@ -746,20 +760,6 @@ void KNewFileMenuPrivate::executeStrategy()
     QObject::connect(kjob, &KJob::result, q, &KNewFileMenu::slotResult);
 }
 
-void KNewFileMenuPrivate::executeUrlDesktopFile(const KNewFileMenuSingleton::Entry &entry)
-{
-    KNameAndUrlInputDialog *dlg = new KNameAndUrlInputDialog(i18n("Name for new link:"), entry.comment, m_menuWorkingDirectory, m_parentWidget);
-    m_copyData.m_templatePath = entry.templatePath;
-    dlg->setModal(q->isModal());
-    dlg->setAttribute(Qt::WA_DeleteOnClose);
-    dlg->setWindowTitle(i18n("Create link to URL"));
-    m_fileDialog = dlg;
-    QObject::connect(dlg, &QDialog::accepted, q, [this]() {
-        slotUrlDesktopFile();
-    });
-    dlg->show();
-}
-
 void KNewFileMenuPrivate::fillMenu()
 {
     QMenu *menu = q->menu();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.