diff -ur 2/invitationsrfbserver.cpp 1/invitationsrfbserver.cpp --- 2/invitationsrfbserver.cpp 2016-01-19 12:32:36.000000000 +0300 +++ 1/invitationsrfbserver.cpp 2016-10-20 04:29:35.000000000 +0300 @@ -80,6 +80,11 @@ m_unattendedPassword = password; } +bool InvitationsRfbServer::enableSharing() const +{ + return m_enableSharing; +} + bool InvitationsRfbServer::allowUnattendedAccess() const { return m_allowUnattendedAccess; @@ -102,6 +107,11 @@ RfbServer::stop(disconnectClients); } +void InvitationsRfbServer::toggleSharing(bool allow) +{ + m_enableSharing = allow; +} + void InvitationsRfbServer::toggleUnattendedAccess(bool allow) { m_allowUnattendedAccess = allow; @@ -113,6 +123,8 @@ m_unattendedPassword = readableRandomString(4)+"-"+readableRandomString(3); KSharedConfigPtr config = KGlobal::config(); KConfigGroup krfbConfig(config,"Security"); + m_enableSharing = krfbConfig.readEntry( + "enableSharing", QVariant(false)).toBool(); m_allowUnattendedAccess = krfbConfig.readEntry( "allowUnattendedAccess", QVariant(false)).toBool(); } @@ -122,6 +134,7 @@ stop(); KSharedConfigPtr config = KGlobal::config(); KConfigGroup krfbConfig(config,"Security"); + krfbConfig.writeEntry("enableSharing",m_enableSharing); krfbConfig.writeEntry("allowUnattendedAccess",m_allowUnattendedAccess); if(m_wallet && m_wallet->isOpen()) { @@ -138,6 +151,8 @@ KStringHandler::obscure(m_desktopPassword)); krfbConfig.writeEntry("unattendedPassword", KStringHandler::obscure(m_unattendedPassword)); + krfbConfig.writeEntry("enableSharing", + m_enableSharing); krfbConfig.writeEntry("allowUnattendedAccess", m_allowUnattendedAccess); } diff -ur 2/invitationsrfbserver.h 1/invitationsrfbserver.h --- 2/invitationsrfbserver.h 2016-01-19 12:32:36.000000000 +0300 +++ 1/invitationsrfbserver.h 2016-10-20 04:30:11.000000000 +0300 @@ -42,6 +42,7 @@ const QString& unattendedPassword() const; void setUnattendedPassword(const QString&); bool allowUnattendedAccess() const; + bool enableSharing() const; Q_SIGNALS: void passwordChanged(const QString&); @@ -50,6 +51,7 @@ bool start(); void stop(bool disconnectClients=true); void toggleUnattendedAccess(bool allow=true); + void toggleSharing(bool allow=true); protected: InvitationsRfbServer(); @@ -62,6 +64,7 @@ private: DNSSD::PublicService *m_publicService; bool m_allowUnattendedAccess; + bool m_enableSharing; QString m_desktopPassword; QString m_unattendedPassword; KWallet::Wallet *m_wallet; diff -ur 2/krfb.kcfg 1/krfb.kcfg --- 2/krfb.kcfg 2016-01-19 12:32:36.000000000 +0300 +++ 1/krfb.kcfg 2016-10-20 04:47:01.000000000 +0300 @@ -18,6 +18,10 @@ + + + false + true diff -ur 2/mainwindow.cpp 1/mainwindow.cpp --- 2/mainwindow.cpp 2016-01-19 12:32:36.000000000 +0300 +++ 1/mainwindow.cpp 2016-10-20 06:24:24.000000000 +0300 @@ -70,6 +70,9 @@ QWidget *mainWidget = new QWidget; m_ui.setupUi(mainWidget); m_ui.krfbIconLabel->setPixmap(KIcon("krfb").pixmap(128)); + m_ui.enableSharingCheckBox->setChecked( + InvitationsRfbServer::instance->enableSharing()); + toggleDesktopSharing(InvitationsRfbServer::instance->enableSharing()); m_ui.enableUnattendedCheckBox->setChecked( InvitationsRfbServer::instance->allowUnattendedAccess());