Exemplo n.º 1
0
        public override void ShowPane()
        {
            _ini = ICore.Instance.SettingStore;
            _chkGreetingInReplies.Checked = _ini.ReadBool("MailFormat", "GreetingInReplies", true);
            _chkPrefixInitials.Checked    = _ini.ReadBool("MailFormat", "PrefixInitials", false);
            _boxPrefix.Text = _ini.ReadString("MailFormat", "GreetingString", "Hello");

            /**
             * signatures
             */
            _chkUseSignature.Checked = _ini.ReadBool("MailFormat", "UseSignature", false);
            _signatureBox.Enabled    = _chkUseSignature.Checked;
            if (_signatureBox.Enabled)
            {
                _signatureBox.Text = _ini.ReadString("MailFormat", "Signature");
            }

            switch (_ini.ReadInt("MailFormat", "SignatureInReplies", 1))
            {
            case 0: _radReplySignatureNone.Checked = true; break;

            case 1: _radSignatureBeforeQuoting.Checked = true; break;

            case 2: _radSignatureAfterQuoting.Checked = true; break;
            }
        }
Exemplo n.º 2
0
            public AttachmentType(ISettingStore settings, int index)
            {
                _name = settings.ReadString("Attachments", "Attachment" + index + "Name");

                string exts = settings.ReadString("Attachments", "Attachment" + index + "Exts");

                _exts = exts.Split(',');
            }
Exemplo n.º 3
0
        public override void ShowPane()
        {
            ISettingStore ini = Core.SettingStore;

            _address.Text = ini.ReadString("HttpProxy", "Address");
            int port = ini.ReadInt("HttpProxy", "Port", 3128);

            if (port < (int)_port.Minimum)
            {
                port = (int)_port.Minimum;
            }
            else if (port > (int)_port.Maximum)
            {
                port = (int)_port.Maximum;
            }
            _port.Value          = port;
            _user.Text           = ini.ReadString("HttpProxy", "User");
            _password.Text       = ini.ReadString("HttpProxy", "Password");
            _bypassLocal.Checked = ini.ReadBool("HttpProxy", "BypassLocal", true);
            _bypassList.Text     = ini.ReadString("HttpProxy", "BypassList");

            if (_address.Text.Length > 0)
            {
                _configureProxyButton.Checked = true;
            }
            else
            {
                _defaultProxyButton.Checked = true;
            }

            if (IsDefaultProxyAutoconfigured())
            {
                _lblDefaultSetting.Text = "Autoconfigure script not supported, please specify proxy settings manually";
            }
            else if (WebProxy.GetDefaultProxy().Address != null)
            {
                _lblDefaultSetting.Text = "Default proxy setting: " + WebProxy.GetDefaultProxy().Address;
            }
            else
            {
                _lblDefaultSetting.Text = "Default proxy setting: No proxy specified";
            }
        }
Exemplo n.º 4
0
        public static void SetBackupDefaults()
        {
            ISettingStore ini = Core.SettingStore;

            if (ini.ReadString("ResourceStore", "EnableBackup").Length == 0)
            {
                ini.WriteBool("ResourceStore", "EnableBackup", true);
                ini.WriteString("ResourceStore", "BackupPath", GetDefaultBackupPath(OMEnv.WorkDir));
            }
        }
Exemplo n.º 5
0
        public override void ShowPane()
        {
            ISettingStore ini = Core.SettingStore;

            string curProfile = ini.ReadString("Miranda", "ProfileToIndex");

            _lbxProfiles.Items.Add("<none>");
            foreach (string profile in ProfileManager.GetProfileList())
            {
                _lbxProfiles.Items.Add(profile);
                if (curProfile == profile)
                {
                    _lbxProfiles.SelectedIndex = _lbxProfiles.Items.Count - 1;
                }
            }
            if (_lbxProfiles.SelectedIndex < 0)
            {
                // if we're running in Startup Wizard, select the first profile by default;
                // otherwise, the user selected None and we must keep the selection
                if (IsStartupPane && _lbxProfiles.Items.Count > 1)
                {
                    _lbxProfiles.SelectedIndex = 1;
                }
                else
                {
                    _lbxProfiles.SelectedIndex = 0;
                }
            }
            _chkCreateCategories.Checked = IniSettings.CreateCategories;
            _chkLatestOnTop.Checked      = IniSettings.LatestOnTop;

            if (IniSettings.SyncImmediate)
            {
                _radSyncImmediate.Checked = true;
            }
            else
            {
                _radSyncStartup.Checked = true;
            }

            _udConversationPeriod.Value = IniSettings.ConversationPeriod / 60;

            if (IsStartupPane)
            {
                groupBox1.Visible             = false;
                _chkLatestOnTop.Visible       = false;
                label4.Visible                = false;
                label5.Visible                = false;
                _udConversationPeriod.Visible = false;
                _chkCreateCategories.Top      = _lbxProfiles.Bottom + 8;
            }
        }
Exemplo n.º 6
0
        public override void ShowPane()
        {
            ISettingStore settings = Core.SettingStore;
            string        exts     = settings.ReadString("FilePlugin", "PlainTextExts");

            if (exts.Length == 0)
            {
                exts = ".txt";
            }
            _textExtsList.Text           = exts;
            _indexHiddenCheckBox.Checked = settings.ReadBool("FilePlugin", "IndexHidden", false);
            _viewHiddenCheckBox.Checked  = settings.ReadBool("FilePlugin", "ViewHidden", false);
        }
Exemplo n.º 7
0
        public void LoadSettings()
        {
            _edtDbPath.Text = OMEnv.WorkDir;
            LoadLogPath();
            ISettingStore ini = Core.SettingStore;

            if (ini == null)
            {
                _enableBackupBox.Visible = false;
                _backupGroup.Visible     = false;
            }
            else
            {
                _backupPath.Text         = ini.ReadString("ResourceStore", "BackupPath", string.Empty);
                _enableBackupBox.Checked = ini.ReadBool("ResourceStore", "EnableBackup", false);
                _backupGroup.Enabled     = _enableBackupBox.Checked;
            }
        }
Exemplo n.º 8
0
        private static WebProxy LoadDefaultProxy()
        {
            WebProxy      proxy;
            ISettingStore ini       = Core.SettingStore;
            string        address   = ini.ReadString("HttpProxy", "Address");
            bool          haveProxy = false;

            if (address.Length == 0)
            {
                proxy             = WebProxy.GetDefaultProxy();
                proxy.Credentials = CredentialCache.DefaultCredentials;
                if (proxy.Address != null)
                {
                    Trace.WriteLine("Using proxy settings from IE: address " + proxy.Address +
                                    ", bypass on local addresses " + proxy.BypassProxyOnLocal);
                    haveProxy = true;
                }
                else
                {
                    Trace.WriteLine("No proxy configured in IE");
                }
            }
            else
            {
                do
                {
                    int port = ini.ReadInt("HttpProxy", "Port", 3128);
                    try
                    {
                        proxy = new WebProxy(address, port);
                    }
                    catch
                    {
                        proxy = WebProxy.GetDefaultProxy();
                    }
                    string user = ini.ReadString("HttpProxy", "User");
                    if (user.Length == 0)
                    {
                        proxy.Credentials = CredentialCache.DefaultCredentials;
                    }
                    else
                    {
                        string   password  = ini.ReadString("HttpProxy", "Password");
                        string[] userParts = user.Split('\\', '/');
                        if (userParts.Length == 2)
                        {
                            proxy.Credentials = new NetworkCredential(userParts[1], password, userParts[0]);
                        }
                        else
                        {
                            proxy.Credentials = new NetworkCredential(user, password);
                        }
                    }
                    proxy.BypassProxyOnLocal = ini.ReadBool("HttpProxy", "BypassLocal", true);

                    string bypassList = ini.ReadString("HttpProxy", "BypassList");
                    if (bypassList.Trim().Length > 0)
                    {
                        try
                        {
                            proxy.BypassList = bypassList.Split(';');
                        }
                        catch {}
                    }

                    if (proxy.Address != null)
                    {
                        Trace.WriteLine("Using proxy settings specified by user: address " + proxy.Address +
                                        ", bypass on local addresses " + proxy.BypassProxyOnLocal);
                        haveProxy = true;
                    }
                    else
                    {
                        Trace.WriteLine("No proxy configured by user");
                    }
                } while(false);
            }

            if (haveProxy)
            {
                ServicePointManager.DefaultConnectionLimit = 5;
            }

            return(proxy);
        }
Exemplo n.º 9
0
        public AnnotationForm()
        {
            Settings = Core.SettingStore;
            InitializeComponent();

            //-----------------------------------------------------------------
            int xPos   = Settings.ReadInt("Annotations", "LocationX", -1),
                yPos   = Settings.ReadInt("Annotations", "LocationY", -1);
            int width  = Settings.ReadInt("Annotations", "Width", -1),
                height = Settings.ReadInt("Annotations", "Height", -1);

            if (xPos != -1 && yPos != -1)
            {
                Location         = new Point(xPos, yPos);
                _defaultPosition = false;
            }
            else
            {
                _defaultPosition = true;
            }
            if (width != -1 && height != -1)
            {
                this.Size = new Size(width, height);
            }

            if (IsOutsideScreen(Location))
            {
                this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Right / 2,
                                          Screen.PrimaryScreen.WorkingArea.Bottom / 2);
            }

            //-----------------------------------------------------------------
            int opacity = Settings.ReadInt("Annotations", "Opacity", -1);

            if (opacity != -1)
            {
                SavedOpacity = Opacity;
                try
                {
                    Opacity = ((double)opacity) / 100.0;
                }
                catch (Exception)
                {
                    // ignore
                }
            }

            string color = Settings.ReadString("Annotations", "BackColor");

            if (!String.IsNullOrEmpty(color))
            {
                if (IsValidColor(color))
                {
                    richText.BackColor = Color.FromName(color);
                }
                else
                {
                    MessageBox.Show(this, "Color name for the Annotation background is illegal", "Illegal Color Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.WriteString("Annotations", "BackColor", "Info");
                }
            }
            color = Settings.ReadString("Annotations", "ForeColor");
            if (!String.IsNullOrEmpty(color))
            {
                if (IsValidColor(color))
                {
                    richText.ForeColor = Color.FromName(color);
                }
                else
                {
                    MessageBox.Show(this, "Color name for the Annotation foreground is illegal", "Illegal Color Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Settings.WriteString("Annotations", "ForeColor", "Black");
                }
            }

            Hide();
        }
Exemplo n.º 10
0
        private void ShowExceptionDialog()
        {
            if (_exceptionDialogVisible)
            {
                return;
            }

            _exceptionDialogVisible = true;
            bool exceptionFatal = false;

            try
            {
                while (true)
                {
                    QueuedException qex = null;
                    lock ( _exceptionQueue )
                    {
                        if (_exceptionQueue.Count > 0)
                        {
                            qex = (QueuedException)_exceptionQueue.Dequeue();
                        }
                    }
                    if (qex == null)
                    {
                        break;
                    }

                    if ((qex.Flags & ExceptionReportFlags.Fatal) != 0)
                    {
                        exceptionFatal = true;
                    }

                    Exception ex = qex.Exception;
                    if (ex is AsyncProcessorException)
                    {
                        ex = ex.InnerException;
                    }
                    if (ex is TargetInvocationException)
                    {
                        ex = ex.InnerException;
                    }

                    ISettingStore ini = Core.SettingStore;
                    using (ExceptionReportForm dlg = new ExceptionReportForm())
                    {
                        ProxySettings proxySettings = new ProxySettings();
                        try
                        {
                            string address = ini.ReadString("HttpProxy", "Address");
                            proxySettings.CustomProxy = address.Length > 0;
                            if (proxySettings.CustomProxy)
                            {
                                proxySettings.Host     = address;
                                proxySettings.Port     = ini.ReadInt("HttpProxy", "Port", 3128);
                                proxySettings.Login    = ini.ReadString("HttpProxy", "User");
                                proxySettings.Password = ini.ReadString("HttpProxy", "Password");
                            }
                            dlg.SetProxy(proxySettings);
                        }
                        catch (Exception pex)
                        {
                            Trace.WriteLine("Failed to set exception reporter proxy: " + pex.ToString());
                        }
                        // Setup our submitter
                        dlg.Submitter  = new RPCExceptionSubmitter();
                        dlg.ProjectKey = "OM";
                        dlg.DisplaySubmissionResult = true;
                        string userName = ini.ReadString("ErrorReport", "UserName");
                        string password = ini.ReadString("ErrorReport", "Password");
                        if (userName.Length > 0 && password.Length > 0)
                        {
                            dlg.SetITNLogin(userName, password);
                        }
                        else
                        {
                            dlg.SetDefaultLogin("om_anonymous", "guest");
                        }

                        if ((qex.Flags & ExceptionReportFlags.AttachLog) != 0)
                        {
                            dlg.AttachLog = true;
                        }

                        dlg.SetBuildNumber(Assembly.GetExecutingAssembly().GetName().Version.Build);

                        IWin32Window ownerWindow = (_ownerControl == null || _ownerControl.IsDisposed) ? null : _ownerControl;

                        if (dlg.ReportException(ownerWindow, ex, GetExceptionDescription()) == DialogResult.OK)
                        {
                            if (dlg.ITNUserName != "om_anonymous")
                            {
                                ini.WriteString("ErrorReport", "UserName", dlg.ITNUserName);
                                ini.WriteString("ErrorReport", "Password", dlg.ITNPassword);
                            }

                            if (dlg.AttachLog)
                            {
                                LogManager.SubmitErrorLog();
                            }
                            proxySettings = dlg.ProxySettings;
                            if (!proxySettings.CustomProxy)
                            {
                                ini.WriteString("HttpProxy", "Address", string.Empty);
                            }
                            else
                            {
                                ini.WriteString("HttpProxy", "Address", proxySettings.Host);
                                ini.WriteInt("HttpProxy", "Port", proxySettings.Port);
                                ini.WriteString("HttpProxy", "User", proxySettings.Login);
                                ini.WriteString("HttpProxy", "Password", proxySettings.Password);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(null, "An exception has occured in the application, and the exception reporter failed to present it.\n\n" + ex.Message + "\n\nThe application will now be terminated.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                exceptionFatal = true;
            }
            _exceptionDialogVisible = false;

            if (exceptionFatal)
            {
                (Core.MainWindow as MainFrame).ForceClose();
            }
        }