File indexing completed on 2024-04-14 14:18:02

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 #include "kbookmarkdialog.h"
0013 
0014 class Q_DECL_HIDDEN KBookmarkOwner::FutureBookmarkPrivate : public QSharedData
0015 {
0016 public:
0017     QString title;
0018     QUrl url;
0019     QString icon;
0020 };
0021 
0022 KBookmarkOwner::FutureBookmark::FutureBookmark(const QString &title, const QUrl &url, const QString &icon)
0023     : d(new FutureBookmarkPrivate)
0024 {
0025     d->title = title;
0026     d->url = url;
0027     d->icon = icon;
0028 }
0029 
0030 KBookmarkOwner::FutureBookmark::FutureBookmark(const FutureBookmark &other)
0031     : d(other.d)
0032 {
0033 }
0034 
0035 KBookmarkOwner::FutureBookmark &KBookmarkOwner::FutureBookmark::operator=(const FutureBookmark &other)
0036 {
0037     d = other.d;
0038     return *this;
0039 }
0040 
0041 KBookmarkOwner::FutureBookmark::~FutureBookmark()
0042 {
0043 }
0044 
0045 QString KBookmarkOwner::FutureBookmark::title() const
0046 {
0047     return d->title;
0048 }
0049 
0050 QUrl KBookmarkOwner::FutureBookmark::url() const
0051 {
0052     return d->url;
0053 }
0054 
0055 QString KBookmarkOwner::FutureBookmark::icon() const
0056 {
0057     return d->icon;
0058 }
0059 
0060 bool KBookmarkOwner::enableOption(BookmarkOption action) const
0061 {
0062     if (action == ShowAddBookmark) {
0063         return true;
0064     }
0065     if (action == ShowEditBookmark) {
0066         return true;
0067     }
0068     return false;
0069 }
0070 
0071 KBookmarkDialog *KBookmarkOwner::bookmarkDialog(KBookmarkManager *mgr, QWidget *parent)
0072 {
0073     return new KBookmarkDialog(mgr, parent);
0074 }
0075 
0076 void KBookmarkOwner::openFolderinTabs(const KBookmarkGroup &)
0077 {
0078 }
0079 
0080 void KBookmarkOwner::openInNewTab(const KBookmark &bm)
0081 {
0082     // fallback
0083     openBookmark(bm, Qt::LeftButton, Qt::NoModifier);
0084 }
0085 
0086 void KBookmarkOwner::openInNewWindow(const KBookmark &bm)
0087 {
0088     // fallback
0089     openBookmark(bm, Qt::LeftButton, Qt::NoModifier);
0090 }