From 45865de3e83a024408abce9c2aa364f935ccaab4 Mon Sep 17 00:00:00 2001 From: tanyulong2021 Date: Fri, 16 Jul 2021 14:27:17 +0800 Subject: [PATCH] fix failed to view remote desktop --- 0013-fix-failed-to-view-remote-desktop.patch | 238 +++++++++++++++++++ ukui-control-center.spec | 7 +- 2 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 0013-fix-failed-to-view-remote-desktop.patch diff --git a/0013-fix-failed-to-view-remote-desktop.patch b/0013-fix-failed-to-view-remote-desktop.patch new file mode 100644 index 0000000..9b00d17 --- /dev/null +++ b/0013-fix-failed-to-view-remote-desktop.patch @@ -0,0 +1,238 @@ +From bd8712c40eedb0e5fa065f2619a52afc77885d42 Mon Sep 17 00:00:00 2001 +From: tanyulong +Date: Fri, 16 Jul 2021 14:17:00 +0800 +Subject: [PATCH] fix failed to view remote desktop + +--- + plugins/network/vino/sharemain.cpp | 71 ++++++++++++++++++++++++++---- + plugins/network/vino/sharemain.h | 6 +++ + plugins/network/vino/vino.cpp | 15 ++++--- + plugins/network/vino/vino.h | 1 + + 4 files changed, 79 insertions(+), 14 deletions(-) + +diff --git a/plugins/network/vino/sharemain.cpp b/plugins/network/vino/sharemain.cpp +index c80b9ec..5579c77 100755 +--- a/plugins/network/vino/sharemain.cpp ++++ b/plugins/network/vino/sharemain.cpp +@@ -18,6 +18,7 @@ + * + */ + #include "sharemain.h" ++#include + + #include + #include +@@ -41,6 +42,22 @@ void ShareMain::initUI() { + mShareTitleLabel = new QLabel(tr("Share"), this); + mShareTitleLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}"); + ++ mEnableFrame = new QFrame(this); ++ mEnableFrame->setFrameShape(QFrame::Shape::Box); ++ mEnableFrame->setMinimumSize(550, 50); ++ mEnableFrame->setMaximumSize(960, 50); ++ ++ QHBoxLayout * enableHLayout = new QHBoxLayout(); ++ ++ mEnableBox = new QCheckBox(this); ++ mEnableLabel = new QLabel(tr("Allow others to view your desktop"), this); ++ enableHLayout->addWidget(mEnableBox); ++ enableHLayout->addWidget(mEnableLabel); ++ enableHLayout->addStretch(); ++ ++ mEnableFrame->setLayout(enableHLayout); ++ ++ + mViewFrame = new QFrame(this); + mViewFrame->setFrameShape(QFrame::Shape::Box); + mViewFrame->setMinimumSize(550, 50); +@@ -49,7 +66,8 @@ void ShareMain::initUI() { + QHBoxLayout * viewHLayout = new QHBoxLayout(); + + mViewBox = new QCheckBox(this); +- mViewLabel = new QLabel(tr("Allow others to view your desktop"), this); ++ mViewLabel = new QLabel(tr("Allow connection to control screen"), this); ++ + viewHLayout->addWidget(mViewBox); + viewHLayout->addWidget(mViewLabel); + viewHLayout->addStretch(); +@@ -90,6 +108,7 @@ void ShareMain::initUI() { + mSecurityPwdFrame->setLayout(pwdHLayout); + + mVlayout->addWidget(mShareTitleLabel); ++ mVlayout->addWidget(mEnableFrame); + mVlayout->addWidget(mViewFrame); + + mVlayout->addWidget(mSecurityTitleLabel); +@@ -109,7 +128,14 @@ void ShareMain::initConnection() { + QByteArray id(kVinoSchemas); + if (QGSettings::isSchemaInstalled(id)) { + mVinoGsetting = new QGSettings(kVinoSchemas, QByteArray(), this); ++ ++ bool isShared = mVinoGsetting->get(kVinoViewOnlyKey).toBool(); ++ bool secPwd = mVinoGsetting->get(kVinoPromptKey).toBool(); + ++ initShareStatus(!isShared, secPwd); ++ initEnableStatus(); ++ ++ connect(mEnableBox, &QCheckBox::clicked, this, &ShareMain::enableSlot); + connect(mViewBox, &QCheckBox::clicked, this, &ShareMain::viewBoxSlot); + connect(mPwdLineEdit, &QLineEdit::textChanged, this, &ShareMain::pwdInputSlot); + connect(mBtnGroup, QOverload::of(&QButtonGroup::buttonClicked), +@@ -117,9 +143,6 @@ void ShareMain::initConnection() { + accessSlot(index); + }); + +- bool isShared = mVinoGsetting->get(kVinoViewOnlyKey).toBool(); +- bool secPwd = mVinoGsetting->get(kVinoPromptKey).toBool(); +- initShareStatus(!isShared, secPwd); + } + } + +@@ -132,11 +155,41 @@ void ShareMain::initShareStatus(bool isConnnect, bool isPwd) { + } + } + +-void ShareMain::viewBoxSlot(bool status) { +- Q_UNUSED(status); +- if (status) { +- mVinoGsetting->set(kVinoViewOnlyKey, status); ++void ShareMain::initEnableStatus() { ++ QProcess *process = new QProcess; ++ ++ process->start("systemctl", QStringList() << "--user" << "is-active" << "vino-server.service"); ++ process->waitForFinished(); ++ setFrameVisible((process->readAllStandardOutput().replace("\n","") == "active")); ++ ++ process->close(); ++} ++ ++void ShareMain::setFrameVisible(bool visible) { ++ mEnableBox->setChecked(visible); ++ ++ mViewFrame->setVisible(visible); ++ mSecurityFrame->setVisible(visible); ++ mSecurityPwdFrame->setVisible(visible); ++ mSecurityTitleLabel->setVisible(visible); ++} ++ ++void ShareMain::enableSlot(bool status) { ++ QProcess process; ++ QString cmd; ++ ++ if(status) { ++ cmd = "start"; ++ } else { ++ cmd = "stop"; + } ++ process.startDetached("systemctl", QStringList() << "--user" << cmd << "vino-server.service"); ++ ++ setFrameVisible(status); ++} ++ ++void ShareMain::viewBoxSlot(bool status) { ++ mVinoGsetting->set(kVinoViewOnlyKey, !status); + } + + void ShareMain::accessSlot(int index) { +@@ -151,7 +204,7 @@ void ShareMain::accessSlot(int index) { + mPwdsLabel->setEnabled(true); + mPwdLineEdit->setEnabled(true); + mVinoGsetting->set(kVinoPromptKey, false); +- mVinoGsetting->reset(kAuthenticationKey), 'vnc'; ++ mVinoGsetting->reset(kAuthenticationKey); + } + } + +diff --git a/plugins/network/vino/sharemain.h b/plugins/network/vino/sharemain.h +index e7681c9..49697c4 100755 +--- a/plugins/network/vino/sharemain.h ++++ b/plugins/network/vino/sharemain.h +@@ -51,6 +51,7 @@ public: + ~ShareMain(); + + private: ++ QFrame * mEnableFrame; + QFrame * mViewFrame; + QFrame * mSecurityFrame; + QFrame * mSecurityPwdFrame; +@@ -58,6 +59,7 @@ private: + QFrame * mNoticeOFrame; + QFrame * mNoticeNFrame; + ++ QCheckBox * mEnableBox; + QCheckBox * mViewBox; + QRadioButton * mAccessBox; + QRadioButton * mPwdBox; +@@ -67,6 +69,7 @@ private: + QRadioButton * mNoticeNBtn; + + QLabel * mShareTitleLabel; ++ QLabel * mEnableLabel; + QLabel * mViewLabel; + QLabel * mSecurityTitleLabel; + QLabel * mAccessLabel; +@@ -87,8 +90,11 @@ private: + void initUI(); + void initConnection(); + void initShareStatus(bool isConnnect, bool isPwd); ++ void initEnableStatus(); ++ void setFrameVisible(bool visible); + + private slots: ++ void enableSlot(bool status); + void viewBoxSlot(bool status); + void accessSlot(int index); + void pwdInputSlot(QString pwd); +diff --git a/plugins/network/vino/vino.cpp b/plugins/network/vino/vino.cpp +index 504b6e0..dc16312 100755 +--- a/plugins/network/vino/vino.cpp ++++ b/plugins/network/vino/vino.cpp +@@ -20,16 +20,15 @@ + #include "vino.h" + #include "ui_vino.h" + +-Vino::Vino() : ui(new Ui::Vino) { +- pluginWidget = new ShareMain; +- ui->setupUi(pluginWidget); +- ++Vino::Vino() : ui(new Ui::Vino), mFirstLoad(true) { + pluginName = tr("Vino"); + pluginType = NETWORK; + } + + Vino::~Vino() { +- delete ui; ++ if (!mFirstLoad) { ++ delete ui; ++ } + } + + QString Vino::get_plugin_name() { +@@ -41,6 +40,12 @@ int Vino::get_plugin_type() { + } + + QWidget *Vino::get_plugin_ui() { ++ if (mFirstLoad) { ++ mFirstLoad = false; ++ pluginWidget = new ShareMain; ++ ui->setupUi(pluginWidget); ++ } ++ + return pluginWidget; + } + +diff --git a/plugins/network/vino/vino.h b/plugins/network/vino/vino.h +index 272fa0d..6ea603f 100755 +--- a/plugins/network/vino/vino.h ++++ b/plugins/network/vino/vino.h +@@ -52,6 +52,7 @@ private: + QString pluginName; + int pluginType; + ShareMain* pluginWidget; ++ bool mFirstLoad; + + }; + #endif // VINO_H +-- +2.23.0 + diff --git a/ukui-control-center.spec b/ukui-control-center.spec index 1f26180..1d051d8 100644 --- a/ukui-control-center.spec +++ b/ukui-control-center.spec @@ -1,7 +1,7 @@ %define debug_package %{nil} Name: ukui-control-center Version: 3.0.1 -Release: 12 +Release: 13 Summary: utilities to configure the UKUI desktop License: GPL-2+ URL: http://www.ukui.org @@ -82,6 +82,7 @@ patch9: 0009-fix-layout-optimization.patch patch10:0010-Added-translation-using-Weblate-Tibetan.patch patch11:0011-power-add-sleep-function.patch patch12:0012-window-add-title-icon.patch +patch13:0013-fix-failed-to-view-remote-desktop.patch Recommends: qt5-qtquickcontrols @@ -115,6 +116,7 @@ Suggests: ukui-settings-daemon %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 %build qmake-qt5 @@ -158,6 +160,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy %changelog +* Fri Jul 16 2021 tanyulong - 3.0.1-13 +- fix failed to view remote desktop + * Tue Jul 13 2021 tanyulong - 3.0.1-12 - window add title icon