[haiku-commits] haiku: hrev45295 - src/apps/webpositive

  • From: mattmadia@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 18 Feb 2013 00:47:11 +0100 (CET)

hrev45295 adds 2 changesets to branch 'master'
old head: 857bec6ff58d57a31258378e6756308ab1f4819b
new head: 900018fd210917405e8d699b9af784aa11c39a23
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=900018f+%5E857bec6

----------------------------------------------------------------------------

d097f67: Add optional username/password fields to Web+ proxy settings.
  
  Signed-off-by: Matt Madia <mattmadia@xxxxxxxxx>

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

900018f: Removed executable flag. No functional changes.

                                        [ Matt Madia <mattmadia@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 78 insertions(+), 2 deletions(-)
src/apps/webpositive/SettingsKeys.cpp   |  3 ++
src/apps/webpositive/SettingsKeys.h     |  3 ++
src/apps/webpositive/SettingsWindow.cpp | 71 ++++++++++++++++++++++++++++-
src/apps/webpositive/SettingsWindow.h   |  3 ++

############################################################################

Commit:      d097f67ceef4c7b4b79767fb0e3c7630e10e8621
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d097f67
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Mon Sep  3 07:04:45 2012 UTC
Committer:   Matt Madia <mattmadia@xxxxxxxxx>
Commit-Date: Sun Feb 17 23:46:51 2013 UTC

Add optional username/password fields to Web+ proxy settings.

Signed-off-by: Matt Madia <mattmadia@xxxxxxxxx>

----------------------------------------------------------------------------

diff --git a/src/apps/webpositive/SettingsKeys.cpp 
b/src/apps/webpositive/SettingsKeys.cpp
old mode 100644
new mode 100755
index b72166c..448fd33
--- a/src/apps/webpositive/SettingsKeys.cpp
+++ b/src/apps/webpositive/SettingsKeys.cpp
@@ -49,3 +49,6 @@ const char* kDefaultSearchPageURL = "http://www.google.com";;
 const char* kSettingsKeyUseProxy = "use http proxy";
 const char* kSettingsKeyProxyAddress = "http proxy address";
 const char* kSettingsKeyProxyPort = "http proxy port";
+const char* kSettingsKeyUseProxyAuth = "use http proxy authentication";
+const char* kSettingsKeyProxyUsername = "http proxy username";
+const char* kSettingsKeyProxyPassword = "http proxy password";
diff --git a/src/apps/webpositive/SettingsKeys.h 
b/src/apps/webpositive/SettingsKeys.h
old mode 100644
new mode 100755
index 1a95bbf..ebc38f2
--- a/src/apps/webpositive/SettingsKeys.h
+++ b/src/apps/webpositive/SettingsKeys.h
@@ -48,5 +48,8 @@ extern const char* kDefaultSearchPageURL;
 extern const char* kSettingsKeyUseProxy;
 extern const char* kSettingsKeyProxyAddress;
 extern const char* kSettingsKeyProxyPort;
+extern const char* kSettingsKeyUseProxyAuth;
+extern const char* kSettingsKeyProxyUsername;
+extern const char* kSettingsKeyProxyPassword;
 
 #endif // SETTINGS_KEYS_H
diff --git a/src/apps/webpositive/SettingsWindow.cpp 
b/src/apps/webpositive/SettingsWindow.cpp
old mode 100644
new mode 100755
index 48bedc3..1803542
--- a/src/apps/webpositive/SettingsWindow.cpp
+++ b/src/apps/webpositive/SettingsWindow.cpp
@@ -86,6 +86,9 @@ enum {
        MSG_USE_PROXY_CHANGED                                           = 
'upsc',
        MSG_PROXY_ADDRESS_CHANGED                                       = 
'psac',
        MSG_PROXY_PORT_CHANGED                                          = 
'pspc',
+       MSG_USE_PROXY_AUTH_CHANGED                                      = 
'upsa',
+       MSG_PROXY_USERNAME_CHANGED                                      = 
'psuc',
+       MSG_PROXY_PASSWORD_CHANGED                                      = 
'pswc',
 };
 
 static const int32 kDefaultFontSize = 14;
@@ -212,6 +215,9 @@ SettingsWindow::MessageReceived(BMessage* message)
                case MSG_USE_PROXY_CHANGED:
                case MSG_PROXY_ADDRESS_CHANGED:
                case MSG_PROXY_PORT_CHANGED:
+               case MSG_USE_PROXY_AUTH_CHANGED:
+               case MSG_PROXY_USERNAME_CHANGED:
+               case MSG_PROXY_PASSWORD_CHANGED:
                        // TODO: Some settings could change live, some others 
not?
                        _ValidateControlsEnabledStatus();
                        break;
@@ -465,6 +471,28 @@ SettingsWindow::_CreateProxyPage(float spacing)
        fProxyPortControl->SetText(
                fSettings->GetValue(kSettingsKeyProxyAddress, ""));
 
+       fUseProxyAuthCheckBox = new BCheckBox("use authentication",
+               B_TRANSLATE("Proxy server requires authentication"),
+               new BMessage(MSG_USE_PROXY_AUTH_CHANGED));
+       fUseProxyAuthCheckBox->SetValue(B_CONTROL_ON);
+
+       fProxyUsernameControl = new BTextControl("proxy username",
+               B_TRANSLATE("Proxy username:"), "",
+               new BMessage(MSG_PROXY_USERNAME_CHANGED));
+       fProxyUsernameControl->SetModificationMessage(
+               new BMessage(MSG_PROXY_USERNAME_CHANGED));
+       fProxyUsernameControl->SetText(
+               fSettings->GetValue(kSettingsKeyProxyUsername, ""));
+
+       fProxyPasswordControl = new BTextControl("proxy password",
+               B_TRANSLATE("Proxy password:"), "",
+               new BMessage(MSG_PROXY_PASSWORD_CHANGED));
+       fProxyPasswordControl->SetModificationMessage(
+               new BMessage(MSG_PROXY_PASSWORD_CHANGED));
+       fProxyPasswordControl->TextView()->HideTyping(true);
+       fProxyPasswordControl->SetText(
+               fSettings->GetValue(kSettingsKeyProxyPassword, ""));
+
        BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
                .Add(fUseProxyCheckBox)
                .Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
@@ -474,6 +502,14 @@ SettingsWindow::_CreateProxyPage(float spacing)
                        .Add(fProxyPortControl->CreateLabelLayoutItem(), 0, 1)
                        .Add(fProxyPortControl->CreateTextViewLayoutItem(), 1, 
1)
                )
+               .Add(fUseProxyAuthCheckBox)
+               .Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
+                       .Add(fProxyUsernameControl->CreateLabelLayoutItem(), 0, 
0)
+                       .Add(fProxyUsernameControl->CreateTextViewLayoutItem(), 
1, 0)
+
+                       .Add(fProxyPasswordControl->CreateLabelLayoutItem(), 0, 
1)
+                       .Add(fProxyPasswordControl->CreateTextViewLayoutItem(), 
1, 1)
+               )
                .Add(BSpaceLayoutItem::CreateGlue())
 
                .SetInsets(spacing, spacing, spacing, spacing)
@@ -601,6 +637,15 @@ SettingsWindow::_CanApplySettings() const
        canApply = canApply || (_ProxyPort()
                != fSettings->GetValue(kSettingsKeyProxyPort, (uint32)0));
 
+       canApply = canApply || ((fUseProxyAuthCheckBox->Value() == B_CONTROL_ON)
+               != fSettings->GetValue(kSettingsKeyUseProxyAuth, false));
+
+       canApply = canApply || (strcmp(fProxyUsernameControl->Text(),
+               fSettings->GetValue(kSettingsKeyProxyUsername, "")) != 0);
+
+       canApply = canApply || (strcmp(fProxyPasswordControl->Text(),
+               fSettings->GetValue(kSettingsKeyProxyPassword, "")) != 0);
+
        return canApply;
 }
 
@@ -649,6 +694,12 @@ SettingsWindow::_ApplySettings()
                fProxyAddressControl->Text());
        uint32 proxyPort = _ProxyPort();
        fSettings->SetValue(kSettingsKeyProxyPort, proxyPort);
+       fSettings->SetValue(kSettingsKeyUseProxyAuth,
+               fUseProxyAuthCheckBox->Value() == B_CONTROL_ON);
+       fSettings->SetValue(kSettingsKeyProxyUsername,
+               fProxyUsernameControl->Text());
+       fSettings->SetValue(kSettingsKeyProxyPassword,
+               fProxyPasswordControl->Text());
 
        fSettings->Save();
 
@@ -661,8 +712,14 @@ SettingsWindow::_ApplySettings()
        BWebSettings::Default()->SetDefaultFixedFontSize(fixedFontSize);
 
        if (fUseProxyCheckBox->Value() == B_CONTROL_ON) {
-               
BWebSettings::Default()->SetProxyInfo(fProxyAddressControl->Text(),
-                       proxyPort, B_PROXY_TYPE_HTTP, "", "");
+               if (fUseProxyAuthCheckBox->Value() == B_CONTROL_ON) {
+                       
BWebSettings::Default()->SetProxyInfo(fProxyAddressControl->Text(),
+                               proxyPort, B_PROXY_TYPE_HTTP, 
fProxyUsernameControl->Text(),
+                               fProxyPasswordControl->Text());
+               } else {
+                       
BWebSettings::Default()->SetProxyInfo(fProxyAddressControl->Text(),
+                               proxyPort, B_PROXY_TYPE_HTTP, "", "");
+               }
        } else
                BWebSettings::Default()->SetProxyInfo();
 
@@ -761,6 +818,12 @@ SettingsWindow::_RevertSettings()
        text = "";
        text << fSettings->GetValue(kSettingsKeyProxyPort, (uint32)0);
        fProxyPortControl->SetText(text.String());
+       
fUseProxyAuthCheckBox->SetValue(fSettings->GetValue(kSettingsKeyUseProxyAuth,
+               false));
+       
fProxyUsernameControl->SetText(fSettings->GetValue(kSettingsKeyProxyUsername,
+               ""));
+       
fProxyPasswordControl->SetText(fSettings->GetValue(kSettingsKeyProxyPassword,
+               ""));
 
        _ValidateControlsEnabledStatus();
 }
@@ -779,6 +842,10 @@ SettingsWindow::_ValidateControlsEnabledStatus()
        bool useProxy = fUseProxyCheckBox->Value() == B_CONTROL_ON;
        fProxyAddressControl->SetEnabled(useProxy);
        fProxyPortControl->SetEnabled(useProxy);
+       fUseProxyAuthCheckBox->SetEnabled(useProxy);
+       bool useProxyAuth = useProxy && fUseProxyAuthCheckBox->Value() == 
B_CONTROL_ON;
+       fProxyUsernameControl->SetEnabled(useProxyAuth);
+       fProxyPasswordControl->SetEnabled(useProxyAuth);
 }
 
 
diff --git a/src/apps/webpositive/SettingsWindow.h 
b/src/apps/webpositive/SettingsWindow.h
old mode 100644
new mode 100755
index 251d844..66b2289
--- a/src/apps/webpositive/SettingsWindow.h
+++ b/src/apps/webpositive/SettingsWindow.h
@@ -108,6 +108,9 @@ private:
                        BCheckBox*                      fUseProxyCheckBox;
                        BTextControl*           fProxyAddressControl;
                        BTextControl*           fProxyPortControl;
+                       BCheckBox*                      fUseProxyAuthCheckBox;
+                       BTextControl*           fProxyUsernameControl;
+                       BTextControl*           fProxyPasswordControl;
 
                        BButton*                        fApplyButton;
                        BButton*                        fCancelButton;

############################################################################

Revision:    hrev45295
Commit:      900018fd210917405e8d699b9af784aa11c39a23
URL:         http://cgit.haiku-os.org/haiku/commit/?id=900018f
Author:      Matt Madia <mattmadia@xxxxxxxxx>
Date:        Sun Feb 17 23:45:31 2013 UTC

Removed executable flag. No functional changes.

----------------------------------------------------------------------------

diff --git a/src/apps/webpositive/SettingsKeys.cpp 
b/src/apps/webpositive/SettingsKeys.cpp
old mode 100755
new mode 100644
diff --git a/src/apps/webpositive/SettingsKeys.h 
b/src/apps/webpositive/SettingsKeys.h
old mode 100755
new mode 100644
diff --git a/src/apps/webpositive/SettingsWindow.cpp 
b/src/apps/webpositive/SettingsWindow.cpp
old mode 100755
new mode 100644
diff --git a/src/apps/webpositive/SettingsWindow.h 
b/src/apps/webpositive/SettingsWindow.h
old mode 100755
new mode 100644


Other related posts:

  • » [haiku-commits] haiku: hrev45295 - src/apps/webpositive - mattmadia