QtPass
2.0.0
Developer documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
secrettextbrowser.cpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2026 Anne Jan Brouwer
2
// SPDX-License-Identifier: GPL-3.0-or-later
8
#include "
secrettextbrowser.h
"
9
#include "
clipboardmanager.h
"
10
#include <QTextDocumentFragment>
11
12
SecretTextBrowser::SecretTextBrowser
(QWidget *parent) : QTextBrowser(parent) {}
13
14
auto
SecretTextBrowser::createMimeDataFromSelection
() const -> QMimeData * {
15
// Plain text only: the default would also put the selection's HTML on the
16
// clipboard, without the hints.
17
const
QString text = textCursor().selection().toPlainText();
18
// copied() is a notification, not a change to this widget; the signal is
19
// declared non-const as all signals are.
20
emit
const_cast<
SecretTextBrowser
*
>
(
this
)->
copied
(text);
21
return
buildClipboardMimeData
(text);
22
}
SecretTextBrowser::SecretTextBrowser
SecretTextBrowser(QWidget *parent=nullptr)
Constructs the browser.
Definition
secrettextbrowser.cpp:12
SecretTextBrowser::createMimeDataFromSelection
auto createMimeDataFromSelection() const -> QMimeData *override
The selection as secret-marked plain text.
Definition
secrettextbrowser.cpp:14
SecretTextBrowser::copied
void copied(const QString &text)
Selected text was copied out of the browser.
buildClipboardMimeData
auto buildClipboardMimeData(const QString &text) -> QMimeData *
Build clipboard MIME data with platform-specific security hints.
Definition
clipboardmanager.cpp:190
clipboardmanager.h
ClipboardManager, which puts secrets on the clipboard and removes them again, and the MIME data that ...
secrettextbrowser.h
QTextBrowser for showing decrypted entry text that marks everything copied out of it as a secret.
src
secrettextbrowser.cpp
Generated by
1.18.0