1/*
2 SPDX-FileCopyrightText: 2022 Eric Armbruster <eric1@armbruster-online.de>
3 SPDX-FileCopyrightText: 2022 Waqar Ahmed <waqar.17a@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef CLIPBOARD_HISTORY_DIALOG_H
9#define CLIPBOARD_HISTORY_DIALOG_H
10
11#include "kateglobal.h"
12
13#include <QLabel>
14#include <QLineEdit>
15#include <QMenu>
16#include <QPointer>
17#include <QTreeView>
18
19class ClipboardHistoryModel;
20class ClipboardHistoryFilterModel;
21
22namespace KTextEditor
23{
24class DocumentPrivate;
25class ViewPrivate;
26}
27
28class ClipboardHistoryDialog : public QMenu
29{
30public:
31 ClipboardHistoryDialog(QWidget *mainwindow, KTextEditor::ViewPrivate *mainWindow);
32
33 void resetValues();
34 void openDialog(const QList<KTextEditor::EditorPrivate::ClipboardEntry> &clipboardHistory);
35
36private:
37 void slotReturnPressed();
38
39private:
40 bool eventFilter(QObject *obj, QEvent *event) override;
41 void updateViewGeometry();
42 void clearLineEdit();
43 void showSelectedText(const QModelIndex &idx);
44 void showEmptyPlaceholder();
45
46private:
47 QTreeView m_treeView;
48 QLineEdit m_lineEdit;
49 QPointer<QWidget> m_mainWindow;
50
51 /*
52 * View containing the currently open document
53 */
54 KTextEditor::ViewPrivate *m_viewPrivate;
55
56 ClipboardHistoryModel *m_model;
57 ClipboardHistoryFilterModel *m_proxyModel;
58
59 /*
60 * Document for the selected text to paste
61 */
62 KTextEditor::DocumentPrivate *m_selectedDoc;
63
64 /*
65 * View containing the selected text to paste
66 */
67 KTextEditor::ViewPrivate *m_selectedView;
68
69 QLabel *m_noEntries;
70};
71
72#endif
73

source code of ktexteditor/src/dialogs/clipboardhistorydialog.h