File indexing completed on 2024-03-24 03:55:25

0001 // -*- c-basic-offset:4; indent-tabs-mode:nil -*-
0002 /*
0003     This file is part of the KDE libraries
0004     SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
0005     SPDX-FileCopyrightText: 2003 Alexander Kellett <lypanov@kde.org>
0006     SPDX-FileCopyrightText: 2008 Norbert Frese <nf2@scheinwelt.at>
0007 
0008     SPDX-License-Identifier: LGPL-2.0-only
0009 */
0010 
0011 #include "kbookmarkowner.h"
0012 
0013 class Q_DECL_HIDDEN KBookmarkOwner::FutureBookmarkPrivate : public QSharedData
0014 {
0015 public:
0016     QString title;
0017     QUrl url;
0018     QString icon;
0019 };
0020 
0021 KBookmarkOwner::FutureBookmark::FutureBookmark(const QString &title, const QUrl &url, const QString &icon)
0022     : d(new FutureBookmarkPrivate)
0023 {
0024     d->title = title;
0025     d->url = url;
0026     d->icon = icon;
0027 }
0028 
0029 KBookmarkOwner::FutureBookmark::FutureBookmark(const FutureBookmark &other)
0030     : d(other.d)
0031 {
0032 }
0033 
0034 KBookmarkOwner::FutureBookmark &KBookmarkOwner::FutureBookmark::operator=(const FutureBookmark &other)
0035 {
0036     d = other.d;
0037     return *this;
0038 }
0039 
0040 KBookmarkOwner::FutureBookmark::~FutureBookmark()
0041 {
0042 }
0043 
0044 QString KBookmarkOwner::FutureBookmark::title() const
0045 {
0046     return d->title;
0047 }
0048 
0049 QUrl KBookmarkOwner::FutureBookmark::url() const
0050 {
0051     return d->url;
0052 }
0053 
0054 QString KBookmarkOwner::FutureBookmark::icon() const
0055 {
0056     return d->icon;
0057 }
0058 
0059 KBookmarkOwner::KBookmarkOwner()
0060     : d(nullptr)
0061 {
0062 }
0063 
0064 KBookmarkOwner::~KBookmarkOwner() = default;
0065 
0066 bool KBookmarkOwner::enableOption(BookmarkOption action) const
0067 {
0068     if (action == ShowAddBookmark) {
0069         return true;
0070     }
0071     if (action == ShowEditBookmark) {
0072         return true;
0073     }
0074     return false;
0075 }
0076 
0077 void KBookmarkOwner::openFolderinTabs(const KBookmarkGroup &)
0078 {
0079 }
0080 
0081 void KBookmarkOwner::openInNewTab(const KBookmark &bm)
0082 {
0083     // fallback
0084     openBookmark(bm, Qt::LeftButton, Qt::NoModifier);
0085 }
0086 
0087 void KBookmarkOwner::openInNewWindow(const KBookmark &bm)
0088 {
0089     // fallback
0090     openBookmark(bm, Qt::LeftButton, Qt::NoModifier);
0091 }