예제 #1
0
void ControlTrayIcon::onConfigurationMenuItemClick()
{
  ControlApplication::removeModelessDialog(m_configDialog->getControl()->getWindow());

  bool isConnectedToService = false;

  try {
    isConnectedToService = m_serverControl->getServerInfo().m_serviceFlag;
  } catch (...) {
    return;
  }

  Configurator::getInstance()->setServiceFlag(isConnectedToService);

  {
    UpdateLocalConfigCommand updateLocalConfigCommand(m_serverControl);

    ControlCommand safeCommand(&updateLocalConfigCommand, m_appControl);

    safeCommand.execute();

    if (!safeCommand.executionResultOk()) {
      return;
    }
  }

  m_configDialog->setServiceFlag(isConnectedToService);
  m_configDialog->show();

  ControlApplication::addModelessDialog(m_configDialog->getControl()->getWindow());
}
예제 #2
0
void ControlTrayIcon::onDisconnectAllClientsMenuItemClick()
{
  DisconnectAllCommand unsafeCommand(m_serverControl);

  ControlCommand safeCommand(&unsafeCommand, m_notificator);

  safeCommand.execute();
}
예제 #3
0
void ControlTrayIcon::onOutgoingConnectionMenuItemClick()
{
  OutgoingConnectionDialog connDialog;

  if (connDialog.showModal() == IDOK) {
    MakeRfbConnectionCommand unsafeCommand(
      m_serverControl,
      connDialog.getConnectString(),
      connDialog.isViewOnly());

    ControlCommand safeCommand(&unsafeCommand, m_notificator);

    safeCommand.execute();
  }
}
예제 #4
0
void ControlTrayIcon::onAttachToDispatcher()
{
  TcpDispatcherConnectionDialog connDialog;

  if (connDialog.showModal() == IDOK) {
    MakeTcpDispatcherConnCommand unsafeCommand(m_serverControl,
                                               connDialog.getConnectString(),
                                               connDialog.getDispatcherName(),
                                               connDialog.getKeyword(),
                                               connDialog.getConnectionId());

    ControlCommand safeCommand(&unsafeCommand, m_notificator);

    safeCommand.execute();
  }
}
예제 #5
0
void ControlTrayIcon::onShutdownServerMenuItemClick()
{
  // Promt user if any client is connected to rfb server.

  // FIXME: Bad way to determinate connected clients.
  bool someoneConnected = (getIcon() == m_iconWorking);

  if (someoneConnected) {
    TvnServerInfo serverInfo = {0};

    {
      AutoLock l(&m_serverInfoMutex);

      serverInfo = m_lastKnownServerInfo;
    }

    StringStorage userMessage;

    UINT stringId = serverInfo.m_serviceFlag ? IDS_TVNSERVER_SERVICE : IDS_TVNSERVER_APP;

    userMessage.format(
      StringTable::getString(IDS_SHUTDOWN_NOTIFICATION_FORMAT),
      StringTable::getString(stringId));

    if (MessageBox(
      getWindow(),
      userMessage.getString(),
      StringTable::getString(IDS_MBC_TVNCONTROL),
      MB_YESNO | MB_ICONQUESTION) == IDNO) {
        return;
    }
  }

  // Shutdown TightVNC server.

  ShutdownCommand unsafeCommand(m_serverControl);

  ControlCommand safeCommand(&unsafeCommand, m_notificator);

  safeCommand.execute();
}