Exemple #1
0
    def ButtonOK(self):
        logging.info("ButtonOK")
        error = False
        if self.rdpInputName.text() == "":
            common.messageDialog("configDialogErrorName")
            error = True
        elif " " in self.rdpInputName.text():
            common.messageDialog("configDialogErrorCharacter")
            error = True
        elif "[" in self.rdpInputName.text():
            common.messageDialog("configDialogErrorCharacter")
            error = True
        elif "]" in self.rdpInputName.text():
            common.messageDialog("configDialogErrorCharacter")
            error = True
        elif self.rdpInputAddress.text() == "":
            common.messageDialog("configDialogErrorAddress")
            error = True
        elif common.isNetworkAddress(self.rdpInputAddress.text()) is False:
            error = True

        name = self.rdpInputName.text()
        if common.existingConnection(name):
            common.messageDialog("configDialogErrorAddress")
            error = True

        if error is False:
            values = {}
            values["typ"] = "rdp"
            values["address"] = self.rdpInputAddress.text()
            values["resolution"] = self.rdpInputResolution.currentText()
            values["color"] = self.rdpInputColor.currentText()
            values["parameter"] = self.rdpInputParameter.text()
            if self.rdpInputAutostart.isChecked():
                values["autostart"] = "yes"
            else:
                values["autostart"] = "no"
            if self.rdpInputRepeat.isChecked():
                values["repeat"] = "yes"
            else:
                values["repeat"] = "no"
            if self.rdpInputSystemLogin.isChecked():
                values["systemlogin"] = "******"
            else:
                values["systemlogin"] = "******"

            values["alternative"] = str(self.rdpInputAlternative.currentText())

            # delete old connection
            if self.connectionname != "":
                common.deleteConnection(self.connectionname)
            # delete new connection
            common.deleteConnection(self.rdpInputName.text())
            # make new connection
            parameter = self.parameterRDP(self.rdpInputName.text(), values)
            common.newConnection(values, parameter, self.rdpInputName.text())
            self.close()
Exemple #2
0
    def ButtonOK(self):
        logging.info("ButtonOK")
        error = False
        if self.vncInputName.text() == "":
            common.messageDialog("configDialogErrorName")
            error = True
        elif " " in self.vncInputName.text():
            common.messageDialog("configDialogErrorCharacter")
            error = True
        elif "[" in self.vncInputName.text():
            common.messageDialog("configDialogErrorCharacter")
            error = True
        elif "]" in self.vncInputName.text():
            common.messageDialog("configDialogErrorCharacter")
            error = True
        elif self.vncInputAddress.text() == "":
            common.messageDialog("configDialogErrorAddress")
            error = True
        elif self.vncInputPort.text() == "":
            common.messageDialog("configDialogErrorPort")
            error = True
        elif common.isNetworkAddress(self.vncInputAddress.text()) == False:
            error = True
        elif self.vncInputIcon.isChecked() and self.vncInputIconName.text(
        ) == "":
            common.messageDialog("configDialogErrorIconName")
            error = True

        name = self.vncInputName.text()
        if common.existingConnection(name):
            common.messageDialog("configDialogErrorAddress")
            error = True

        if error == False:
            values = {}
            values["typ"] = "vnc"
            values["address"] = self.vncInputAddress.text()
            values["port"] = self.vncInputPort.text()
            values["password"] = self.vncInputPassword.text()
            values["resolution"] = self.vncInputResolution.currentText()
            values["color"] = self.vncInputColor.currentText()
            values["parameter"] = self.vncInputParameter.text()
            if self.vncInputAutostart.isChecked():
                values["autostart"] = "yes"
            else:
                values["autostart"] = "no"
            if self.vncInputRepeat.isChecked():
                values["repeat"] = "yes"
            else:
                values["repeat"] = "no"

            values["alternative"] = str(self.vncInputAlternative.currentText())

            if self.vncInputIcon.isChecked():
                values["icon"] = "yes"
            else:
                values["icon"] = "no"

            values["iconname"] = str(self.vncInputIconName.text())

            # delete old connection
            if self.connectionname != "":
                common.deleteConnection(self.connectionname)
                common.deletePasswordFile(self.connectionname)
            # delete new connection
            common.deleteConnection(self.vncInputName.text())
            common.deletePasswordFile(self.vncInputName.text())
            # make new connection
            parameter = self.parameterVNC(self.vncInputName.text(), values)
            common.newConnection(values, parameter, self.vncInputName.text())
            password = self.vncInputPassword.text()
            if password != "":
                self.newPasswordFile(self.vncInputName.text(), password)
            self.close()