[utilities/kate] /: Addressed review comments

Christoph Cullmann null at kde.org
Sun Feb 18 15:05:13 GMT 2024


Git commit 22dbf413519ecdc76d968fd2401c157b01b43eaf by Christoph Cullmann, on behalf of Ben Gooding.
Committed on 18/02/2024 at 14:54.
Pushed by cullmann into branch 'master'.

Addressed review comments

M  +2    -22   apps/lib/autotests/kate_doc_manager_tests.cpp
M  +2    -4    apps/lib/autotests/kate_doc_manager_tests.h
M  +2    -2    apps/lib/katedocmanager.cpp
M  +4    -4    apps/lib/katemainwindow.cpp
M  +1    -1    doc/kate/fundamentals.docbook
M  +3    -3    doc/kate/menus.docbook

https://invent.kde.org/utilities/kate/-/commit/22dbf413519ecdc76d968fd2401c157b01b43eaf

diff --git a/apps/lib/autotests/kate_doc_manager_tests.cpp b/apps/lib/autotests/kate_doc_manager_tests.cpp
index 59322b7072..453d7c113f 100644
--- a/apps/lib/autotests/kate_doc_manager_tests.cpp
+++ b/apps/lib/autotests/kate_doc_manager_tests.cpp
@@ -53,7 +53,7 @@ KateDocManagerTests::KateDocManagerTests(QObject *)
     KLocalizedString::setApplicationDomain(QByteArrayLiteral("kate"));
 }
 
-void KateDocManagerTests::setUp()
+void KateDocManagerTests::init()
 {
     auto tempdir = new QTemporaryDir;
     QVERIFY(tempdir->isValid());
@@ -64,29 +64,23 @@ void KateDocManagerTests::setUp()
     app = std::make_unique<KateApp>(getParser(), KateApp::ApplicationKWrite, tempdir->path());
 }
 
-void KateDocManagerTests::tearDown()
+void KateDocManagerTests::cleanup()
 {
     app.reset(nullptr);
 }
 
 void KateDocManagerTests::canCreateDocument()
 {
-    setUp();
-
     auto documentManager = app->documentManager();
 
     QSignalSpy documentCreatedSpy(documentManager, &KateDocManager::documentCreated);
     const auto document = documentManager->createDoc(createMockDocument());
     Q_ASSERT(document != nullptr);
     Q_ASSERT(documentCreatedSpy.count() == 1);
-
-    tearDown();
 }
 
 void KateDocManagerTests::popRecentlyClosedUrlsClearsRecentlyClosedUrls()
 {
-    setUp();
-
     auto documentManager = app->documentManager();
     const auto createdDocuments = createTestDocumentsWithUrls(documentManager);
 
@@ -101,25 +95,17 @@ void KateDocManagerTests::popRecentlyClosedUrlsClearsRecentlyClosedUrls()
         const auto recentlyClosedUrls = documentManager->popRecentlyClosedUrls();
         Q_ASSERT(recentlyClosedUrls.size() == 0);
     }
-
-    tearDown();
 }
 
 void KateDocManagerTests::popRecentlyClosedUrlsReturnsNoneIfNoTabsClosedDuringSession()
 {
-    setUp();
-
     auto documentManager = app->documentManager();
 
     Q_ASSERT(documentManager->popRecentlyClosedUrls().empty());
-
-    tearDown();
 }
 
 void KateDocManagerTests::popRecentlyClosedUrlsReturnsUrlIfTabClosedDuringSession()
 {
-    setUp();
-
     auto documentManager = app->documentManager();
     const auto createdDocuments = createTestDocumentsWithUrls(documentManager);
 
@@ -129,14 +115,10 @@ void KateDocManagerTests::popRecentlyClosedUrlsReturnsUrlIfTabClosedDuringSessio
     const auto recentlyClosedUrls = documentManager->popRecentlyClosedUrls();
     Q_ASSERT(recentlyClosedUrls.contains(QUrl(i18n(FirstTestUrl))));
     Q_ASSERT(!recentlyClosedUrls.contains(QUrl(i18n(SecondTestUrl))));
-
-    tearDown();
 }
 
 void KateDocManagerTests::closedDocumentsWithEmptyUrlsAreNotRestorable()
 {
-    setUp();
-
     auto documentManager = app->documentManager();
     const auto createdDocuments = createTestDocumentsWithoutUrls(documentManager);
 
@@ -145,8 +127,6 @@ void KateDocManagerTests::closedDocumentsWithEmptyUrlsAreNotRestorable()
 
     const auto recentlyClosedUrls = documentManager->popRecentlyClosedUrls();
     Q_ASSERT(recentlyClosedUrls.isEmpty());
-
-    tearDown();
 }
 
 #include "moc_kate_doc_manager_tests.cpp"
\ No newline at end of file
diff --git a/apps/lib/autotests/kate_doc_manager_tests.h b/apps/lib/autotests/kate_doc_manager_tests.h
index fea73242b6..6cc4950da5 100644
--- a/apps/lib/autotests/kate_doc_manager_tests.h
+++ b/apps/lib/autotests/kate_doc_manager_tests.h
@@ -11,11 +11,9 @@ class KateDocManagerTests : public QObject
 public:
     KateDocManagerTests(QObject *parent = nullptr);
 
-private:
-    void setUp();
-    void tearDown();
-
 private Q_SLOTS:
+    void init();
+    void cleanup();
     void canCreateDocument();
     void popRecentlyClosedUrlsClearsRecentlyClosedUrls();
     void popRecentlyClosedUrlsReturnsNoneIfNoTabsClosedDuringSession();
diff --git a/apps/lib/katedocmanager.cpp b/apps/lib/katedocmanager.cpp
index 4efd953150..03a112c227 100644
--- a/apps/lib/katedocmanager.cpp
+++ b/apps/lib/katedocmanager.cpp
@@ -185,8 +185,8 @@ bool KateDocManager::closeDocuments(const QList<KTextEditor::Document *> documen
     }
 
     m_recentlyClosedUrls.clear();
-    for (const auto &document : documents) {
-        if (const auto &docInfoItr = m_docInfos.find(document); docInfoItr != m_docInfos.end()) {
+    for (const auto document : documents) {
+        if (const auto docInfoItr = m_docInfos.find(document); docInfoItr != m_docInfos.end()) {
             const auto &docInfo = docInfoItr->second;
 
             if (!docInfo.normalizedUrl.isEmpty()) {
diff --git a/apps/lib/katemainwindow.cpp b/apps/lib/katemainwindow.cpp
index aa9dfac37d..5f302c2683 100644
--- a/apps/lib/katemainwindow.cpp
+++ b/apps/lib/katemainwindow.cpp
@@ -417,12 +417,12 @@ void KateMainWindow::setupActions()
     connect(a, &QAction::triggered, this, &KateMainWindow::slotDocumentCloseAll);
     a->setWhatsThis(i18n("Close all open documents."));
 
-    a = actionCollection()->addAction(QStringLiteral("reopen_latest_closed_tab"));
-    a->setIcon(QIcon::fromTheme(QStringLiteral("reopentab")));
-    a->setText(i18n("&Reopen latest closed tab(s)."));
+    a = actionCollection()->addAction(QStringLiteral("reopen_latest_closed_document"));
+    a->setIcon(QIcon::fromTheme(QStringLiteral("reopendocument")));
+    a->setText(i18n("&Reopen latest closed document(s)."));
     actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_T));
     connect(a, &QAction::triggered, m_viewManager, &KateViewManager::slotRestoreLastClosedDocument);
-    a->setWhatsThis(i18n("Reopen the tab or tabs that were most recently closed"));
+    a->setWhatsThis(i18n("Reopen the document or documents that were most recently closed"));
 
     a = actionCollection()->addAction(KStandardAction::Quit, QStringLiteral("file_quit"));
     // Qt::QueuedConnection: delay real shutdown, as we are inside menu action handling (bug #185708)
diff --git a/doc/kate/fundamentals.docbook b/doc/kate/fundamentals.docbook
index eb26149661..fe4db9fa16 100644
--- a/doc/kate/fundamentals.docbook
+++ b/doc/kate/fundamentals.docbook
@@ -373,7 +373,7 @@ action="simul">&Ctrl;<keycap>W</keycap></keycombo> /
 </row>
 <row>
 <entry><para><keycombo action="simul">&Ctrl;&Shift;<keycap>T</keycap></keycombo></para></entry>
-<entry><para>Reopen Latest Closed Tab(s)</para></entry>
+<entry><para>Reopen Latest Closed Document(s)</para></entry>
 </row>
 
 </tbody>
diff --git a/doc/kate/menus.docbook b/doc/kate/menus.docbook
index 0a504e0b7f..555698e443 100644
--- a/doc/kate/menus.docbook
+++ b/doc/kate/menus.docbook
@@ -748,16 +748,16 @@ The new instance will be identical to your previous instance.
 </listitem>
 </varlistentry>
 
-<varlistentry id="reopen-latest-closed-tab">
+<varlistentry id="reopen-latest-closed-document">
 <term><menuchoice>
 <shortcut>
 <keycombo action="simul">&Ctrl;&Shift;<keycap>T</keycap></keycombo>
 </shortcut>
 <guimenu>View</guimenu>
-<guimenuitem>Reopen Latest Closed Tab</guimenuitem>
+<guimenuitem>Reopen Latest Closed Document</guimenuitem>
 </menuchoice></term>
 <listitem>
-<para>Reopens the latest closed tab or tabs.</para>
+<para>Reopens the latest closed document or documents.</para>
 </listitem>
 </varlistentry>
 



More information about the kde-doc-english mailing list