File indexing completed on 2024-04-28 05:36:52
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Red Hat Inc 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 * 0006 * SPDX-FileCopyrightText: 2018 Jan Grulich <jgrulich@redhat.com> 0007 */ 0008 0009 #include "remotedesktopdialog.h" 0010 #include "remotedesktopdialog_debug.h" 0011 #include "utils.h" 0012 0013 #include <KLocalizedString> 0014 #include <QPushButton> 0015 #include <QSettings> 0016 #include <QStandardPaths> 0017 #include <QWindow> 0018 0019 RemoteDesktopDialog::RemoteDesktopDialog(const QString &appName, RemoteDesktopPortal::DeviceTypes deviceTypes, bool screenSharingEnabled, QObject *parent) 0020 : QuickDialog(parent) 0021 { 0022 const QVariantMap props = { 0023 {QStringLiteral("title"), i18nc("Title of the dialog that requests remote input privileges", "Remote control requested")}, 0024 {QStringLiteral("description"), buildDescription(appName, deviceTypes, screenSharingEnabled)}, 0025 }; 0026 create(QStringLiteral("qrc:/RemoteDesktopDialog.qml"), props); 0027 } 0028 0029 bool RemoteDesktopDialog::allowRestore() const 0030 { 0031 return m_theDialog->property("allowRestore").toBool(); 0032 } 0033 0034 QString RemoteDesktopDialog::buildDescription(const QString &appName, RemoteDesktopPortal::DeviceTypes deviceTypes, bool screenSharingEnabled) 0035 { 0036 const QString applicationName = Utils::applicationName(appName); 0037 QString description = applicationName.isEmpty() ? i18nc("Unordered list with privileges granted to an external process", "Requested access to:\n") 0038 : i18nc("Unordered list with privileges granted to an external process, included the app's name", 0039 "%1 requested access to remotely control:\n", 0040 applicationName); 0041 if (screenSharingEnabled) { 0042 description += i18nc("Will allow the app to see what's on the outputs, in markdown", " - Screens\n"); 0043 } 0044 if (deviceTypes != RemoteDesktopPortal::None) { 0045 description += i18nc("Will allow the app to send input events, in markdown", " - Input devices\n"); 0046 } 0047 return description; 0048 }