Beispiel #1
0
        public static void Remote_Mailto(String[] arguments)
        {
            String  mailto        = arguments[0];
            Account mailtoAccount = Config.Current.Accounts.Where(o => o.HandlesMailto).FirstOrDefault();

            if (mailtoAccount == null)
            {
                return;
            }

            //Uri mailtoUri = new Uri(mailto);
            //System.Collections.Specialized.NameValueCollection queryString = System.Web.HttpUtility.ParseQueryString(mailtoUri.Query);
            Shellscape.Browser browser    = mailtoAccount.Browser ?? Shellscape.Utilities.BrowserHelper.DefaultBrowser;
            String             accountUrl = Utilities.UrlHelper.GetBaseUrl(mailtoAccount);

            //String to = String.Concat(mailtoUri.UserInfo, "@", mailtoUri.Host);
            //String parameters = String.Format("to={1}&su={2}&body={3}",  to, queryString["subject"], queryString["body"]);
            String url = String.Concat(accountUrl, "?extsrc=mailto&url=", System.Web.HttpUtility.UrlEncode(mailto));

            try {
                using (System.Diagnostics.Process process = new System.Diagnostics.Process()) {
                    process.StartInfo.Arguments = url;
                    process.StartInfo.FileName  = browser.Path;
                    process.Start();
                }
            }
            catch (Exception e) {
                Utilities.ErrorHelper.Report(e);
            }             // catch-all is fine here, not a critical function
        }
Beispiel #2
0
        private void RegisterMailto()
        {
            RegistryKey command = Registry.CurrentUser.OpenSubKey(@"Software\Classes\mailto\shell\open\command", true);
            String      value   = String.Empty;

            if (this.Account.HandlesMailto)
            {
                Shellscape.Browser browser = this.Account.Browser ?? Shellscape.Utilities.BrowserHelper.DefaultBrowser;

                value = String.Concat(browser.Path, " \"", Utilities.UrlHelper.GetBaseUrl(this.Account), "?extsrc=mailto&url=%1\"");
            }

            command.SetValue(null, value);
        }
Beispiel #3
0
        private void DataBind()
        {
            if (Account == null)
            {
                return;
            }

            _TextPassword.Text = _filler;
            _TextUsername.Text = Account.FullAddress;

            _CheckMailto.Enabled = false;
            _CheckMailto.Checked = this.Account.HandlesMailto;
            _CheckMailto.Enabled = true;

            _ButtonDefault.Enabled = !Account.Default;

            String    columnName  = "Name";
            String    columnValue = "Value";
            DataTable dt          = new DataTable();
            List <Shellscape.Browser> browsers = Shellscape.Utilities.BrowserHelper.Enumerate();

            dt.Columns.Add(columnName, typeof(String));
            dt.Columns.Add(columnValue, typeof(Shellscape.Browser));

            dt.Rows.Add(new object[] { "System Default", null });

            foreach (Shellscape.Browser browser in browsers)
            {
                dt.Rows.Add(new object[] { browser.Name, browser });
            }

            _ComboBrowser.DataSource    = dt;
            _ComboBrowser.DisplayMember = columnName;
            _ComboBrowser.ValueMember   = columnValue;

            if (this.Account.Browser != null)
            {
                Shellscape.Browser selectedBrowser = browsers.Where(o => o.Name == this.Account.Browser.Name).FirstOrDefault();
                _ComboBrowser.SelectedIndex = browsers.IndexOf(selectedBrowser) + 1;
            }
            else
            {
                _ComboBrowser.SelectedIndex = 0;
            }

            _ComboBrowser.SelectedValueChanged += _ComboBrowser_SelectedValueChanged;
        }
        public static String GetDefaultBrowserPath()
        {
            Account defaultAccount = Config.Current.Accounts.Default;

            if (defaultAccount == null)
            {
                return(String.Empty);
            }

            Shellscape.Browser browser = defaultAccount.Browser;

            if (browser == null)
            {
                return(String.Empty);
            }

            return(browser.Path);
        }
Beispiel #5
0
        private void ManageAccount(Account account)
        {
            this.HidePanels();

            if (account == null)               // new account time
            {
                _LabelAccount.Text        = Locale.Current.Preferences.Panels.Accounts.AddNew;
                _ButtonAccountAction.Text = Locale.Current.Preferences.Panels.Accounts.Account.AddAccount;

                _TextAddress.Text = _TextPassword.Text = String.Empty;

                _TextAddress.SetWatermark("Gmail address or username");
                _TextPassword.SetWatermark("Gmail password");

                _ComboBrowser.SelectedIndex  = 0;
                _CheckMailto.Checked         = false;
                _CheckDefaultAccount.Checked = false;

                int difference = _LabelAddress.Top;

                _PanelAccountControls.Padding = new Padding(3, 39 - _LabelAccount.Height, 3, 3);

                // why the textboxes and comboboxes arent responding to padding, i have no idea. huge bug.
                difference = _LabelAddress.Top - difference;

                _TextAddress.Top  += difference;
                _TextPassword.Top += difference;
                _ComboBrowser.Top += difference;
            }
            else
            {
                _currentAccount           = account;
                _LabelAccount.Text        = String.Format(Locale.Current.Preferences.Panels.Accounts.Account.Title, account.FullAddress);
                _ButtonAccountAction.Text = Locale.Current.Preferences.Panels.General.ApplyChanges;

                _TextAddress.Text = account.Login;

                _TextPassword.SetWatermark("Enter a new Password");
                _TextPassword.Text = String.Empty;

                if (account.Browser != null)
                {
                    List <Shellscape.Browser> browsers        = Shellscape.Utilities.BrowserHelper.Enumerate();
                    Shellscape.Browser        selectedBrowser = browsers.Where(o => o.Name == _currentAccount.Browser.Name).FirstOrDefault();
                    _ComboBrowser.SelectedIndex = browsers.IndexOf(selectedBrowser) + 1;
                    //_ComboBrowser.SelectedValue = account.Browser; - selectedvalue isn't playing nice.
                    //_ComboBrowser.SelectedText = account.Browser.Name; - inconsistent
                }
                else
                {
                    _ComboBrowser.SelectedIndex = 0;
                }

                _CheckMailto.Checked         = account.HandlesMailto;
                _CheckDefaultAccount.Checked = account.Default;

                _PanelAccountControls.Padding = new Padding(3);

                if (_TextAddress.Top != 0)
                {
                    // why the textboxes and comboboxes arent responding to padding, i have no idea. huge bug.
                    int difference = _TextAddress.Top;

                    _TextAddress.Top  -= difference;
                    _TextPassword.Top -= difference;
                    _ComboBrowser.Top -= difference;
                }
            }

            _PanelAccountGlyph.Visible = _LinkRemove.Visible = !(account == null);
            _ButtonAccountAction.Left  = _ButtonAccountCancel.Left - 3 - _ButtonAccountAction.Width;

            _ButtonAccountAction.Enabled = false;

            _PanelAccount.Show();
        }