File indexing completed on 2024-05-12 13:42:51
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 QString RemoteDesktopDialog::buildDescription(const QString &appName, RemoteDesktopPortal::DeviceTypes deviceTypes, bool screenSharingEnabled) 0030 { 0031 const QString applicationName = Utils::applicationName(appName); 0032 QString description = applicationName.isEmpty() ? i18nc("Unordered list with privileges granted to an external process", "Requested access to:\n") 0033 : i18nc("Unordered list with privileges granted to an external process, included the app's name", 0034 "%1 requested access to remotely control:\n", 0035 applicationName); 0036 if (screenSharingEnabled) { 0037 description += i18nc("Will allow the app to see what's on the outputs, in markdown", " - Screens\n"); 0038 } 0039 if (deviceTypes != RemoteDesktopPortal::None) { 0040 description += i18nc("Will allow the app to send input events, in markdown", " - Input devices\n"); 0041 } 0042 return description; 0043 }