File indexing completed on 2024-05-05 17:45:00

0001 /*
0002     SPDX-FileCopyrightText: 2007 Glenn Ergeerts <glenn.ergeerts@telenet.be>
0003     SPDX-FileCopyrightText: 2012 Marco Gulino <marco.gulino@xpeppers.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <KRunner/QueryMatch>
0011 #include <QIcon>
0012 #include <QList>
0013 #include <QString>
0014 
0015 class BookmarkMatch
0016 {
0017 public:
0018     BookmarkMatch(const QIcon &icon,
0019                   const QString &searchTerm,
0020                   const QString &bookmarkTitle,
0021                   const QString &bookmarkURL,
0022                   const QString &description = QString());
0023     void addTo(QList<BookmarkMatch> &listOfResults, bool addEvenOnNoMatch);
0024     Plasma::QueryMatch asQueryMatch(Plasma::AbstractRunner *runner);
0025 
0026     Q_REQUIRED_RESULT QString bookmarkTitle() const
0027     {
0028         return m_bookmarkTitle;
0029     }
0030 
0031     Q_REQUIRED_RESULT QString bookmarkUrl() const
0032     {
0033         return m_bookmarkURL;
0034     }
0035 
0036 private:
0037     bool matches(const QString &search, const QString &matchingField);
0038 
0039 private:
0040     QIcon m_icon;
0041     QString m_searchTerm;
0042     QString m_bookmarkTitle;
0043     QString m_bookmarkURL;
0044     QString m_description;
0045 };