File indexing completed on 2024-05-19 05:19:20

0001 /*
0002     This file is part of KJots.
0003 
0004     SPDX-FileCopyrightText: 1997 Christoph Neerfeld <Christoph.Neerfeld@home.ivm.de>
0005                   2002, 2003 Aaron J. Seigo <aseigo@kde.org>
0006                   2003 Stanislav Kljuhhin <crz@hot.ee>
0007                   2005-2006 Jaison Lee <lee.jaison@gmail.com>
0008                   2020 Igor Poboiko <igor.poboiko@gmail.com>
0009 
0010     SPDX-License-Identifier: GPL-2.0-or-later
0011 */
0012 
0013 #ifndef KJOTSBROWSER_H
0014 #define KJOTSBROWSER_H
0015 
0016 #include <QTextBrowser>
0017 
0018 class QHelpEvent;
0019 class QAbstractItemModel;
0020 
0021 class KActionCollection;
0022 
0023 class KJotsBrowserWidgetPrivate;
0024 
0025 class KJotsBrowser : public QTextBrowser
0026 {
0027     Q_OBJECT
0028 public:
0029     explicit KJotsBrowser(KActionCollection *actionCollection, QWidget *parent = nullptr);
0030     /**
0031      * @brief set the ETM which will be used to display
0032      * additional information in tooltips
0033      */
0034     void setModel(QAbstractItemModel *model);
0035 protected:
0036     bool event(QEvent *event) override;
0037     void contextMenuEvent(QContextMenuEvent *event) override;
0038     void tooltipEvent(QHelpEvent *event);
0039 Q_SIGNALS:
0040     void linkClicked(const QUrl &);
0041     void say(const QString &text);
0042 private:
0043     QAbstractItemModel *m_model = nullptr;
0044     KActionCollection *m_actionCollection = nullptr;
0045 };
0046 
0047 /**
0048  * @brief A widget-wrapper around KJotsBrowser
0049  *
0050  * It also contains: find bar, text-to-speech widget.
0051  * @see KPIMTextEdit::RichTextEditorWidget
0052  */
0053 class KJotsBrowserWidget : public QWidget
0054 {
0055     Q_OBJECT
0056 public:
0057     explicit KJotsBrowserWidget(std::unique_ptr<KJotsBrowser> browser, QWidget *parent = nullptr);
0058     ~KJotsBrowserWidget();
0059 
0060     KJotsBrowser *browser();
0061 public Q_SLOTS:
0062     void slotFind();
0063     void slotFindNext();
0064 private:
0065     void slotHideFindBar();
0066     std::unique_ptr<KJotsBrowserWidgetPrivate> const d;
0067 };
0068 
0069 
0070 #endif
0071 /* ex: set tabstop=4 softtabstop=4 shiftwidth=4 expandtab: */