Пример #1
0
        public EditAccountDialog(AccountInfo accountInfo, QWidget parentWindow)
            : base(parentWindow)
        {
            SetupUi();

            m_AccountInfo = accountInfo;

            jidLineEdit.Text = String.Format("{0}@{1}", accountInfo.User, accountInfo.Domain);
            passwordLineEdit.Text = accountInfo.Password;
            resourceCombo.SetEditText(accountInfo.Resource);

            serverLineEdit.Text = accountInfo.ConnectServer;
            portSpinBox.Value = accountInfo.ConnectPort;

            autoConnectCheckBox.Checked = accountInfo.AutoConnect;

            switch (m_AccountInfo.ProxyType) {
            case ProxyType.System:
                comboBox.CurrentIndex = 0;
                ShowProxyWidgets(false);
                break;
            case ProxyType.None:
                comboBox.CurrentIndex = 1;
                ShowProxyWidgets(false);
                break;
            case ProxyType.HTTP:
                comboBox.CurrentIndex = 2;
                ShowProxyWidgets(true);
                break;
            case ProxyType.SOCKS4:
                comboBox.CurrentIndex = 3;
                ShowProxyWidgets(true);
                break;
            case ProxyType.SOCKS5:
                comboBox.CurrentIndex = 4;
                ShowProxyWidgets(true);
                break;
            }
            proxyHostLineEdit.Text = m_AccountInfo.ProxyHost;
            proxyPortSpinBox.Value = m_AccountInfo.ProxyPort;
            proxyUserLineEdit.Text = m_AccountInfo.ProxyUsername;
            proxyPassLineEdit.Text = m_AccountInfo.ProxyPassword;

            this.buttonBox.StandardButtons = (uint)QDialogButtonBox.StandardButton.Ok |
                                             (uint)QDialogButtonBox.StandardButton.Cancel;

            Gui.CenterWidgetOnScreen(this);
        }
Пример #2
0
        public void AddAccount(AccountInfo accountInfo)
        {
            var account = new Account(accountInfo);

            AddAccount(account, true);
        }
Пример #3
0
 public void AddAccount(AccountInfo accountInfo)
 {
     var account = new Account(accountInfo);
     AddAccount(account, true);
 }
Пример #4
0
        private void on_saveAccountButton_clicked()
        {
            JID jid = null;

            if (String.IsNullOrEmpty(m_LoginLineEdit.Text))
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Login may not be empty.");
            else if (!JID.TryParse(m_LoginLineEdit.Text, out jid))
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Login should look like 'user@server'.");
            else if (String.IsNullOrEmpty(new JID(m_LoginLineEdit.Text).User))
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Login should look like 'user@server'.");
            else if (String.IsNullOrEmpty(m_PasswordLineEdit.Text))
                QMessageBox.Critical(this.TopLevelWidget(), "Synapse", "Password may not be empty");
            else {
                var accountInfo = new AccountInfo(jid.User, jid.Server, m_PasswordLineEdit.Text, "Synapse");
                AccountService service = ServiceManager.Get<AccountService>();
                service.AddAccount(accountInfo);
            }
        }