[pim/kdepim-runtime] agents/newmailnotifier: Minor optimization

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 793d305cb6493357372f20ec2cfc73ad8f507ea1 by Laurent Montel.
Committed on 16/08/2026 at 11:25.
Pushed by mlaurent into branch 'master'.

Minor optimization

M  +7    -4    agents/newmailnotifier/newmailnotificationhistorybrowsertext.cpp

https://invent.kde.org/pim/kdepim-runtime/-/commit/793d305cb6493357372f20ec2cfc73ad8f507ea1

diff --git a/agents/newmailnotifier/newmailnotificationhistorybrowsertext.cpp b/agents/newmailnotifier/newmailnotificationhistorybrowsertext.cpp
index 2b8cb338d..817d3df3c 100644
--- a/agents/newmailnotifier/newmailnotificationhistorybrowsertext.cpp
+++ b/agents/newmailnotifier/newmailnotificationhistorybrowsertext.cpp
@@ -25,14 +25,17 @@ NewMailNotificationHistoryBrowserText::~NewMailNotificationHistoryBrowserText()
 void NewMailNotificationHistoryBrowserText::doSetSource(const QUrl &url, QTextDocument::ResourceType type)
 {
     Q_UNUSED(type);
+    constexpr auto openMailScheme = "openmail:"_L1;
+    constexpr auto openFolderScheme = "openfolder:"_L1;
+
     QString uri = url.toString();
     qCDebug(NEWMAILNOTIFIER_LOG) << " uri " << uri;
-    if (uri.startsWith("openmail:"_L1)) {
-        uri.remove(QStringLiteral("openmail:"));
+    if (uri.startsWith(openMailScheme)) {
+        uri.remove(0, openMailScheme.size());
         qCDebug(NEWMAILNOTIFIER_LOG) << "openMail uri " << uri;
         Q_EMIT openMail(uri);
-    } else if (uri.startsWith("openfolder:"_L1)) {
-        uri.remove(QStringLiteral("openfolder:"));
+    } else if (uri.startsWith(openFolderScheme)) {
+        uri.remove(0, openFolderScheme.size());
         qCDebug(NEWMAILNOTIFIER_LOG) << "openFolder uri " << uri;
         Q_EMIT openFolder(uri);
     } else {
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.