summaryrefslogtreecommitdiff
path: root/src/bookmarks/bookmarkstoolbar.cpp
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-09-14 15:21:28 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-09-14 15:21:28 +0300
commit6e158f3e228628caadd6997065eec6c00267524a (patch)
treeb767a4551bda665a47ea71e75ec09eb451e91483 /src/bookmarks/bookmarkstoolbar.cpp
parentRename BookmarkModel to BookmarksTreeModel (diff)
downloadrekonq-6e158f3e228628caadd6997065eec6c00267524a.tar.xz
Add Bookmarks toolbar
Diffstat (limited to 'src/bookmarks/bookmarkstoolbar.cpp')
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp93
1 files changed, 40 insertions, 53 deletions
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index 658aa0c0..353e61b9 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -1,70 +1,56 @@
/* ============================================================
- *
- * This file is a part of the rekonq project
- *
+ * The rekonq project
+ * ============================================================
+ * SPDX-License-Identifier: GPL-2.0-or-later
* Copyright (C) 2008-2013 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-License-Identifier: GPL-3.0-only
+ * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net>
* ============================================================ */
-// Self Includes
-#include "bookmarkstoolbar.h"
-#include "bookmarkstoolbar.moc"
+#include "bookmarkstoolbar.hpp"
+#include "bookmarkstreemodel.hpp"
+#include <QShowEvent>
-// Local Includes
-#include "bookmarkmanager.h"
-#include "bookmarkowner.h"
-#include "bookmarkscontextmenu.h"
+BookmarkToolBar::BookmarkToolBar(QWidget *parent) : QToolBar(parent)
+{
+ /*
+setContextMenuPolicy(Qt::CustomContextMenu);
-#include "iconmanager.h"
-#include "webwindow.h"
+connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
+connect(BookmarkManager::self()->manager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu()));
-// KDE Includes
-#include <KMenu>
+setAcceptDrops(true);
+installEventFilter(this);
+setShortcutEnabled(false);
-// Qt Includes
-#include <QActionEvent>
-#include <QApplication>
-#include <QFrame>
+if (isVisible()) {
+ BookmarkManager::self()->fillBookmarkBar(this);
+ m_filled = true;
+}
+*/
+}
-BookmarkToolBar::BookmarkToolBar(QWidget *parent)
- : KToolBar(parent, false, false), m_currentMenu(0), m_dragAction(0), m_dropAction(0), m_checkedAction(0),
- m_filled(false)
+void BookmarkToolBar::showEvent(QShowEvent *event)
{
- setContextMenuPolicy(Qt::CustomContextMenu);
-
- connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
- connect(BookmarkManager::self()->manager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu()));
-
- setAcceptDrops(true);
- installEventFilter(this);
- setShortcutEnabled(false);
-
- if (isVisible()) {
- BookmarkManager::self()->fillBookmarkBar(this);
- m_filled = true;
+ Q_CHECK_PTR(model);
+
+ clear();
+
+ const auto *root = model->item();
+ Q_CHECK_PTR(root);
+ for (int i = 0; i < root->childCount(); ++i) {
+ const auto *child = root->child(i);
+ if (child->type() != BookmarksTreeItem::Bookmark) continue;
+ auto *action = addAction(child->data(BookmarksTreeItem::Title).toString(), this, [this, child]() {
+ emit loadUrl(child->data(BookmarksTreeItem::Href).toUrl(), rekonq::CurrentTab);
+ });
}
-}
-BookmarkToolBar::~BookmarkToolBar() { clear(); }
+ event->accept();
+}
+/*
void BookmarkToolBar::contextMenu(const QPoint &point)
{
KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(actionAt(point));
@@ -402,3 +388,4 @@ void BookmarkToolBar::dragDestroyed()
delete m_dropAction;
m_dropAction = 0;
}
+*/