mirror of
https://github.com/deskflow/deskflow.git
synced 2026-07-07 21:07:23 +08:00
SYNERGY-694 Prevent client duplication.
This commit is contained in:
parent
7fa08c51e3
commit
4bbe8108a2
@ -412,6 +412,23 @@ bool ServerConfig::isFull() const
|
||||
return isFull;
|
||||
}
|
||||
|
||||
bool ServerConfig::isScreenExists(const QString& screenName) const
|
||||
{
|
||||
bool isExists = false;
|
||||
|
||||
for (const auto& screen : screens())
|
||||
{
|
||||
if (!screen.isNull() &&
|
||||
screen.name() == screenName)
|
||||
{
|
||||
isExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isExists;
|
||||
}
|
||||
|
||||
void ServerConfig::setConfigFile(const QString& configFile)
|
||||
{
|
||||
m_pAppConfig->setConfigFile(configFile);
|
||||
|
||||
@ -85,6 +85,7 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
|
||||
const QString& getConfigFile() const;
|
||||
bool getUseExternalConfig() const;
|
||||
bool isFull() const;
|
||||
bool isScreenExists(const QString& screenName) const;
|
||||
|
||||
protected:
|
||||
QSettings& settings();
|
||||
|
||||
@ -59,10 +59,10 @@ bool ServerConnection::checkMainWindow()
|
||||
|
||||
void ServerConnection::addClient(const QString& clientName)
|
||||
{
|
||||
if (!m_parent.serverConfig().isFull() && checkMainWindow())
|
||||
if (!m_parent.serverConfig().isFull() &&
|
||||
!m_parent.serverConfig().isScreenExists(clientName) &&
|
||||
checkMainWindow())
|
||||
{
|
||||
m_parent.stopSynergy();
|
||||
|
||||
QMessageBox message(&m_parent);
|
||||
message.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole);
|
||||
message.addButton(QObject::tr("Accept and configure"), QMessageBox::AcceptRole);
|
||||
@ -76,8 +76,6 @@ void ServerConnection::addClient(const QString& clientName)
|
||||
{
|
||||
m_ignoredClients.append(clientName);
|
||||
}
|
||||
|
||||
m_parent.startSynergy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,4 +86,6 @@ void ServerConnection::configureClient(const QString& clientName)
|
||||
|
||||
ServerConfigDialog dlg(&m_parent, config);
|
||||
dlg.exec();
|
||||
|
||||
m_parent.restartSynergy();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user