|
From: <dos...@us...> - 2012-09-09 20:42:49
|
Revision: 4510
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4510&view=rev
Author: doskabouter
Date: 2012-09-09 20:42:42 +0000 (Sun, 09 Sep 2012)
Log Message:
-----------
Added option to change default useragent
Modified Paths:
--------------
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs
trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-08-12 17:51:38 UTC (rev 4509)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-09-09 20:42:42 UTC (rev 4510)
@@ -177,6 +177,9 @@
#endregion
TrySetProxy();
+ if (!String.IsNullOrEmpty(settings.UserAgent))
+ GeckoPreferences.User["general.useragent.override"] = settings.UserAgent;
+
BookmarkXml.AddFolder(Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) +
"\\bookmarks.xml", "Saved by MP");
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs 2012-08-12 17:51:38 UTC (rev 4509)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Settings.cs 2012-09-09 20:42:42 UTC (rev 4510)
@@ -48,6 +48,7 @@
public string Server { get; set; }
public int Port { get; set; }
public GUIFacadeControl.Layout View { get; set; }
+ public string UserAgent { get; set; }
private const string section = "btWeb";
@@ -98,6 +99,7 @@
Remote_PageDown = GetActionFromString(xmlreader, "remote_pagedown", Default_Remote_PageDown);
LastUrl = xmlreader.GetValueAsString(section, "lastUrl", string.Empty);
+ UserAgent = xmlreader.GetValueAsString(section, "useragent", string.Empty);
UseProxy = xmlreader.GetValueAsBool(section, "proxy", false);
Server = xmlreader.GetValueAsString(section, "proxy_server", "127.0.0.1");
@@ -160,6 +162,7 @@
xmlwriter.SetValue(section, "remote_pagedown", Remote_PageDown);
xmlwriter.SetValue(section, "bookmark", View);
+ xmlwriter.SetValue(section, "useragent", UserAgent);
xmlwriter.SetValueAsBool(section, "proxy", UseProxy);
xmlwriter.SetValue(section, "proxy_server", Server);
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs 2012-08-12 17:51:38 UTC (rev 4509)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.Designer.cs 2012-09-09 20:42:42 UTC (rev 4510)
@@ -85,6 +85,9 @@
this.label3 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.tabPage5 = new System.Windows.Forms.TabPage();
+ this.groupBox13 = new System.Windows.Forms.GroupBox();
+ this.cbOverrideUserAgent = new System.Windows.Forms.CheckBox();
+ this.cmbUserAgent = new System.Windows.Forms.ComboBox();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.txtHttpPort = new System.Windows.Forms.TextBox();
this.txtHttpServer = new System.Windows.Forms.TextBox();
@@ -156,6 +159,7 @@
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.tabPage5.SuspendLayout();
+ this.groupBox13.SuspendLayout();
this.groupBox8.SuspendLayout();
this.tabPage4.SuspendLayout();
this.groupBox11.SuspendLayout();
@@ -731,14 +735,57 @@
// tabPage5
//
this.tabPage5.BackColor = System.Drawing.SystemColors.Control;
+ this.tabPage5.Controls.Add(this.groupBox13);
this.tabPage5.Controls.Add(this.groupBox8);
this.tabPage5.Location = new System.Drawing.Point(4, 25);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
this.tabPage5.Size = new System.Drawing.Size(562, 476);
this.tabPage5.TabIndex = 4;
- this.tabPage5.Text = "Proxy";
+ this.tabPage5.Text = "Proxy/UserAgent";
//
+ // groupBox13
+ //
+ this.groupBox13.Controls.Add(this.cbOverrideUserAgent);
+ this.groupBox13.Controls.Add(this.cmbUserAgent);
+ this.groupBox13.Location = new System.Drawing.Point(6, 157);
+ this.groupBox13.Name = "groupBox13";
+ this.groupBox13.Size = new System.Drawing.Size(550, 100);
+ this.groupBox13.TabIndex = 2;
+ this.groupBox13.TabStop = false;
+ this.groupBox13.Text = "UserAgent";
+ //
+ // cbOverrideUserAgent
+ //
+ this.cbOverrideUserAgent.AutoSize = true;
+ this.cbOverrideUserAgent.Location = new System.Drawing.Point(6, 21);
+ this.cbOverrideUserAgent.Name = "cbOverrideUserAgent";
+ this.cbOverrideUserAgent.Size = new System.Drawing.Size(146, 20);
+ this.cbOverrideUserAgent.TabIndex = 1;
+ this.cbOverrideUserAgent.Text = "Override UserAgent";
+ this.cbOverrideUserAgent.UseVisualStyleBackColor = true;
+ this.cbOverrideUserAgent.CheckedChanged += new System.EventHandler(this.cbOverrideUserAgent_CheckedChanged);
+ //
+ // cmbUserAgent
+ //
+ this.cmbUserAgent.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.cmbUserAgent.FormattingEnabled = true;
+ this.cmbUserAgent.Items.AddRange(new object[] {
+ "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2" +
+ ".0.50727; Media Center PC 5.0; .NET CLR 3.0.30729; .NET CLR 3.5.30729; .NET4.0C;" +
+ " .NET4.0E)",
+ "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.19) Gecko",
+ "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0",
+ "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3" +
+ ".5.3",
+ "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHT" +
+ "ML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10"});
+ this.cmbUserAgent.Location = new System.Drawing.Point(6, 46);
+ this.cmbUserAgent.Name = "cmbUserAgent";
+ this.cmbUserAgent.Size = new System.Drawing.Size(538, 24);
+ this.cmbUserAgent.TabIndex = 0;
+ //
// groupBox8
//
this.groupBox8.Controls.Add(this.txtHttpPort);
@@ -1313,6 +1360,8 @@
this.tabPage3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.tabPage5.ResumeLayout(false);
+ this.groupBox13.ResumeLayout(false);
+ this.groupBox13.PerformLayout();
this.groupBox8.ResumeLayout(false);
this.groupBox8.PerformLayout();
this.tabPage4.ResumeLayout(false);
@@ -1437,5 +1486,8 @@
private System.Windows.Forms.ComboBox cmbPageUp;
private System.Windows.Forms.Label label37;
private System.Windows.Forms.Label label36;
+ private System.Windows.Forms.GroupBox groupBox13;
+ private System.Windows.Forms.ComboBox cmbUserAgent;
+ private System.Windows.Forms.CheckBox cbOverrideUserAgent;
}
}
\ No newline at end of file
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2012-08-12 17:51:38 UTC (rev 4509)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.cs 2012-09-09 20:42:42 UTC (rev 4510)
@@ -643,6 +643,9 @@
cmbPageDown.SelectedItem = settings.Remote_PageDown;
cmbBookmarkView.SelectedItem = settings.View;
+ cmbUserAgent.Text = settings.UserAgent;
+ cbOverrideUserAgent.Checked = !String.IsNullOrEmpty(cmbUserAgent.Text);
+
chkProxy.Checked = settings.UseProxy;
txtHttpServer.Text = settings.Server;
txtHttpPort.Text = settings.Port.ToString();
@@ -678,6 +681,10 @@
settings.Remote_Status = (Action.ActionType)cmbStatusBar.SelectedItem;
settings.View = (GUIFacadeControl.Layout)cmbBookmarkView.SelectedItem;
+ if (cbOverrideUserAgent.Checked)
+ settings.UserAgent = cmbUserAgent.Text;
+ else
+ settings.UserAgent = String.Empty;
settings.UseProxy = chkProxy.Checked;
settings.Server = txtHttpServer.Text;
@@ -733,8 +740,7 @@
// http://geckofx.org/viewtopic.php?id=832
GeckoPreferences.User["network.proxy.http"] = Server;
GeckoPreferences.User["network.proxy.http_port"] = Port;
- int ena = 0; if (useProxy) ena = 1;
- GeckoPreferences.User["network.proxy.type"] = ena;
+ GeckoPreferences.User["network.proxy.type"] = useProxy ? 1 : 0;
// maybe possible... not sure...
// network.proxy.login
@@ -835,5 +841,10 @@
cmbPageDown.SelectedItem = Settings.Default_Remote_PageDown;
}
+ private void cbOverrideUserAgent_CheckedChanged(object sender, EventArgs e)
+ {
+ cmbUserAgent.Enabled = cbOverrideUserAgent.Checked;
+ }
+
}
}
Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx
===================================================================
--- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx 2012-08-12 17:51:38 UTC (rev 4509)
+++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/Setup.resx 2012-09-09 20:42:42 UTC (rev 4510)
@@ -176,6 +176,6 @@
<value>26, 16</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
- <value>47</value>
+ <value>46</value>
</metadata>
</root>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|