diff --git a/src/BookmarkMenu.cpp b/src/BookmarkMenu.cpp index 34c13c8e..5f01c560 100644 --- a/src/BookmarkMenu.cpp +++ b/src/BookmarkMenu.cpp @@ -1,54 +1,55 @@ /* This file was part of the KDE libraries Copyright 2019 by Tomaz Canabrava Copyright 2019 by Martin Sandsmark library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2 or ( at your option ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ // Own #include "BookmarkMenu.h" // KDE #include // Qt #include #include #include BookmarkMenu::BookmarkMenu (KBookmarkManager *mgr, KBookmarkOwner *owner, QMenu *parentMenu, KActionCollection *collec) : KBookmarkMenu (mgr, owner, parentMenu, collec) { // We need to hijack the action QAction *bookmarkAction = collec->action(QStringLiteral("add_bookmark")); disconnect(bookmarkAction, nullptr, this, nullptr); connect(bookmarkAction, &QAction::triggered, this, &BookmarkMenu::maybeAddBookmark); } void BookmarkMenu::maybeAddBookmark() { // Check for duplicates first + // This only catches duplicates in top-level (ie not sub-folders) const KBookmarkGroup rootGroup = manager()->root(); const QUrl currUrl = owner()->currentUrl(); for (const QUrl &url : rootGroup.groupUrlList()) { if (url == currUrl) { return; } } slotAddBookmark(); }