File indexing completed on 2024-04-21 07:27:57

0001 /*
0002     This file is part of Kiten, a KDE Japanese Reference Tool...
0003     SPDX-FileCopyrightText: 2001 Jason Katz-Brown <jason@katzbrown.com>
0004     SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com>
0005     SPDX-FileCopyrightText: 2006 Eric Kjeldergaard <kjelderg@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef RESULTSVIEW_H
0011 #define RESULTSVIEW_H
0012 
0013 #include <QAction>
0014 #include <QTextBrowser>
0015 
0016 #include "entry.h"
0017 
0018 class KActionCollection;
0019 class KActionMenu;
0020 
0021 class ResultsView : public QTextBrowser
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit ResultsView(QWidget *parent = nullptr, const char *name = nullptr);
0027 
0028     void addResult(Entry *result, bool common = false);
0029     void addKanjiResult(Entry *, bool common = false);
0030     void setLaterScrollValue(int scrollValue);
0031 
0032 public Q_SLOTS:
0033     void append(const QString &text);
0034     void clear();
0035     void flush();
0036     void print(const QString &title);
0037     void setBasicMode(bool yes);
0038     void setContents(const QString &text);
0039 
0040 Q_SIGNALS:
0041     void entrySpecifiedForExport(int index);
0042     void urlClicked(const QString &);
0043 
0044 protected:
0045     QString generateCSS();
0046 
0047 private Q_SLOTS:
0048     void doScroll();
0049 
0050 private:
0051     QAction *_addToExportListAction = nullptr;
0052     bool _basicMode;
0053     KActionCollection *_popupActions = nullptr;
0054     KActionMenu *_popupMenu = nullptr;
0055     QString _printText;
0056     int _scrollValue;
0057 };
0058 
0059 #endif