Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: March 23, 2009 04:41AM

I've made a new bitmap since I didn't like the earlier one I've made. The difference compared to the old one is barely visible but I like this one better.



However this bitmat suits optically only the Klassic skin I'm using.
Just in case anybody else is also using the PBProxTog.kmm but with another skin and has problems making a suitable bitmap, I could try to make one. For sure it won't be perfect but more appropriate at least.

Somehow I have the feeling that I'm one of the very few (maybe only?) K-M user who uses a proxy on a regular basis grinning smiley



Edited 1 time(s). Last edit at 03/23/2009 04:44AM by Yogi.

Re: PrivacyBar toggling Proxy on/off
Posted by: desga2
Date: March 23, 2009 05:15AM

I made an Extension: Proxy2 Extension, based in JamesD code and Yogi requeriments.

I added next changes:
- Now really button Checked is used, not change button image to seems Checked.
- Button is added in new toolbar. (Isn't possible add to default existed bars, I opened bug # 1092 about this)
- Added all code in proxy.kmm file. (User not need add any code in any file)
- Added entries to Proxy menu to select button type: Toolbar button or Privacy button. (Need restart K-Meleon to Enable/Disable/Change the button)
- Added descriptions text in status bar.
- Added Proxy menu in button context menu (right click).
- Added some buttons bitmaps to user can select the better for his skin. (Need change bitmap index Proxy2.bmp[] code in Proxy2.kmm file)

This extension rename original "proxy.kmm" file to "proxy.bak" automatically when it's installed. "Proxy2.kmm" file replace all "proxy.kmm" functions and add the features described above.

Download link: Proxy2 Extension.

Note: This extension is for K-Meleon 1.5.X versions, macro use if(<condition>){} conditional statements not implemented in 1.1.X versions. If you like this extension work in 1.1.X version you must replaced if() sentences by old conditional statements (<condition>?<true>:<false>). Ask in this forum thread if you need help about it.

K-Meleon in Spanish



Edited 2 time(s). Last edit at 03/23/2009 05:22AM by desga2.

Re: PrivacyBar toggling Proxy on/off
Posted by: JamesD
Date: March 23, 2009 08:12AM

@ desga2

I ran a test and can confirm your bug # 1092. CPU at 99%, KM running, but no display.

Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: March 23, 2009 09:36AM

@ desga2

Great work desga2, very professional!
Your setup file is an easy go for everybody.
Besides, depending on what button gets used it suits optically to any skin.
Now I will have the pain to choose among the eventualities offered by you and JamesD smiling smiley
For the moment I'm sticking with JamesD's macros which I only added basic status bar description (direct/over proxy connection) and using an adaptation of your very professional bitmap:



However my requirements are now more than fulfilled smiling smiley
It's a great forum with nice and helpful people, nice to be part of this community.

Re: PrivacyBar toggling Proxy on/off
Posted by: soccerfan
Date: March 24, 2009 10:58PM

Quote
Yogi
Just in case anybody else is also using the PBProxTog.kmm but with another skin and has problems making a suitable bitmap, I could try to make one. For sure it won't be perfect but more appropriate at least.

Somehow I have the feeling that I'm one of the very few (maybe only?) K-M user who uses a proxy on a regular basis grinning smiley

I'd very much appreciate a bitmap for the Phoenity skin. Thanks.
And yes I too use proxo with kmeleon (and any other browsers) on a regular basis
(using sidki's latest Feb13,2009 config).

Edit: PS: The bmp is 64x13 in Phoenity (as opposed to 54x10)

soccerfan



Edited 1 time(s). Last edit at 03/25/2009 02:33AM by soccerfan.

Re: PrivacyBar toggling Proxy on/off
Posted by: soccerfan
Date: March 24, 2009 11:02PM

Quote
JamesD
@ Yogi

Finally got it working.

JamesD, could you possibly adapt PBProxyTog.kmm to km 1.1.x.
I'd like to try it on kmeleon 1.1.3 using the Phoenity skin
(for which I've just requested Yogi for a bitmap). Thanks.

soccerfan

Re: PrivacyBar toggling Proxy on/off
Posted by: JamesD
Date: March 25, 2009 01:01AM

Quote
soccerfan
JamesD, could you possibly adapt PBProxyTog.kmm to km 1.1.x.

PBProxTog.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- PBProxTog.kmm
# ---------- Icon for proxy on and proxy off as part of privacy bar
# ---------- Does not yet handle auto detect -- ver for KM 1.1.x & KM 1.5.x
#
# Dependencies        : main.kmm, proxy.kmm
# Resources           :  
# Preferences         : "network.proxy.type"
# Version             : 0.6  3/24/09 
# Author              : JamesD
# --------------------------------------------------------------------------------

_PBProxTog_Status{
$_PBProxTog_ToolbarName = "&Privacy Bar" ;
$_PBProxTog_Command = "macros(_PBProxTog_Button)" ;
getpref(INT,"network.proxy.type") == 0 ? &_PBProxTog_S_E_0 : 0;
}
_PBProxTog_S_E_0{
	$_PBProxTog_IconTag =  $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, PBProxyTog.bmp[2]" ;
	pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
}
_PBProxTog_Button{
getpref(INT,"network.proxy.type") != 0 ? &_PBProxTog_B_N_0 : &_PBProxTog_B_E_1; 
}
_PBProxTog_B_N_0{
	setpref(INT,"network.proxy.type",0);
	$_PBProxTog_IconTag =  $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, PBProxyTog.bmp[2]" ;
	pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);	
}
_PBProxTog_B_E_1{
	setpref(INT,"network.proxy.type",1);
	$_PBProxTog_IconTag =  $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, PBProxyTog.bmp[0]" ;
	pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
}
PBProxTog_ToolsAlert{
getpref(INT,"network.proxy.type")==1 ? &_PBProxTog_T_E_1 : &_PBProxTog_T_N_1 ;
}
_PBProxTog_T_E_1{
	$_PBProxTog_IconTag =  $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, PBProxyTog.bmp[0]" ;
	pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
}
_PBProxTog_T_N_1{
	$_PBProxTog_IconTag =  $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, PBProxyTog.bmp[2]" ;
	pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
}

$OnStartup=$OnStartup."_PBProxTog_Status;";
$macroModules=$macroModules."PBProxTog;";


Re: PrivacyBar toggling Proxy on/off
Posted by: soccerfan
Date: March 25, 2009 02:29AM

Thanks JamesD. I tried it and it seems to work. I face two problems though:
First: when proxy is on, I can see the green checkmark, but when I toggle it,
I only see the word 'Proxy' without the red x. Could it be because of the
different size (&Privacy Bar(64,13){) for the Phoenity skin?

Second: In order to pick up on changes from TOOLS - PROXY, I'm not sure where to place this line
&PBProxTog_ToolsAlert;
in two places in my proxy.kmm because it is so different from what you listed for km1.5.x.
The relevant portions for my proxy.kmm seem to be somewhere here:
Proxy_None{
menuchecked=(getpref(INT,$_Proxy_Active."type")==0);
setpref(INT,$_Proxy_Active."type",0); &_Proxy_Status;
}
Proxy_Auto{
menuchecked=(getpref(INT,$_Proxy_Active."type")==4);
setpref(INT,$_Proxy_Active."type",4); &_Proxy_Status;
}
Proxy_File{
menuchecked=(getpref(INT,$_Proxy_Active."type")==2);
getpref(STRING,$_Proxy_PACURL)==""?0: setpref(INT,$_Proxy_Active."type",2); &_Proxy_Status;
}
Proxy_Custom{
menuchecked=((getpref(INT,$_Proxy_Active."type")==1)*(getpref(STRING,$_Proxy_Custom.$ARG.".http")==getpref(STRING,$_Proxy_Active."http")));
$__srvr=getpref(STRING,$_Proxy_Custom.$ARG.".http");
$__port=getpref(INT,$_Proxy_Custom.$ARG.".http_port");
# When no server url is set, do not change anything!
$__srvr==""?0: setpref(STRING,$_Proxy_Active."http",$__srvr);
$__srvr==""?0: setpref(INT,$_Proxy_Active."http_port",$__port);
$__srvr==""?0: setpref(INT,$_Proxy_Active."type",1); &_Proxy_Status;
}
Any help appreciated. If needed, I could post the entire contents of proxy.kmm
NOTE: In the code above, there is no space between ':' and 'setpref' in four places.

EDIT: My first problem (not seeing checkmark) is solved, thanks to Yogi's new bmp
(see post below).

EDIT 2: Second Problem also solved. I added the line at the end of the
Proxy_None and Proxy_Custom sections and everything works as expected.

soccerfan



Edited 2 time(s). Last edit at 03/25/2009 03:25AM by soccerfan.

Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: March 25, 2009 02:40AM

@ soccerfan

PBProxyTog.bmp for Phoenity skin:



Re: PrivacyBar toggling Proxy on/off
Posted by: soccerfan
Date: March 25, 2009 03:03AM

Thanks Yogi. It is just PERFECT.
Blends in great with the items. Merci smiling smiley

And a big thank you to JamesD and desga2 for developing the macros smiling smiley

soccerfan



Edited 1 time(s). Last edit at 03/25/2009 03:39AM by soccerfan.

Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: March 25, 2009 05:42AM

Just in case someone will use the Klassic skin (W2K) with JamesD's macros:

PBProxyTog.bmp



The below bitmap would be the proper one but for some reason it doesn't work as it should:



It might be a more proper way to do it but I found out that by adding the below 2 lines the proxy status will be also displayed in the status bar.
_PBProxTog_B_N_0{
	setpref(INT,"network.proxy.type",0);
	$_PBProxTog_IconTag =  $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, PBProxyTog.bmp[2]" ;
	pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
        setpref(INT,$_Proxy_Type,0); statusbar(_("Connecting directly"));
}
_PBProxTog_B_E_1{
	setpref(INT,"network.proxy.type",1);
	$_PBProxTog_IconTag =  $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, PBProxyTog.bmp[0]" ;
	pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
        setpref(INT,$_Proxy_Type,1); statusbar(_("Connecting over proxy"));
}



Edited 2 time(s). Last edit at 03/25/2009 06:03AM by Yogi.

Re: PrivacyBar toggling Proxy on/off
Posted by: desga2
Date: March 25, 2009 05:52AM

@ Yogi:
Your code need a } at the end to close second macro function.

K-Meleon in Spanish

Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: March 25, 2009 05:57AM

@ desga2

Thx desga2 smiling smiley

Re: PrivacyBar toggling Proxy on/off
Posted by: soccerfan
Date: March 25, 2009 06:14AM

@Yogi
For your code work in kmeleon 1.1.x,
I replaced $_Proxy_Type by $_Proxy_Active."type" in your two bolded lines and it worked.
I hope I did it right.

soccerfan

Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: March 25, 2009 06:21AM

@ soccerfan

Sorry soccerfan I oversaw that you are using K-M 1.1.x.



Edited 1 time(s). Last edit at 03/25/2009 07:11AM by Yogi.

Re: PrivacyBar toggling Proxy on/off
Posted by: soccerfan
Date: March 25, 2009 06:28AM

Thanks Yogi, but proxy.kmm for kmeleon 1.1.x does not define $_Proxy_Type
as done in your posted code above (which, I guess, is for kmeleon 1.5.x).
Please, somebody correct me if I made a boo boo.

Edit: Yogi, I just saw your edited post above. No worries mate smiling smiley

soccerfan



Edited 1 time(s). Last edit at 03/25/2009 09:20PM by soccerfan.

Re: PrivacyBar toggling Proxy on/off
Posted by: JamesD
Date: March 25, 2009 08:26PM

@ soccerfan

Did you get the code to work in 1.1.x version? I have a 1.1.6 but I do not know how to set up a dummy proxy in that version. Much different from 1.5.2 I only changed the if statements to conditional statments. I have not gotten a test done in 1.1.6 I would suggest not to trust the button to change proxy until you check the condition with tools menu.

Re: PrivacyBar toggling Proxy on/off
Posted by: soccerfan
Date: March 25, 2009 09:19PM

Quote
JamesD
@ soccerfan

Did you get the code to work in 1.1.x version? I have a 1.1.6 but I do not know how to set up a dummy proxy in that version. Much different from 1.5.2 I only changed the if statements to conditional statments. I have not gotten a test done in 1.1.6 I would suggest not to trust the button to change proxy until you check the condition with tools menu.

Everything works just fine for me in km 1.1.3 (and 1.1.5). I use proxomitron
and have it set up to act as a local proxy (but only for http) on port 8080 via:
Edit -> Preferences -> Proxy -> Enable Manual Proxy Settings (127.0.0.1, port 8080).
Never tried 1.1.6. I do have 1.5.2 but have not tested your code in it (yet).

soccerfan

Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: May 11, 2009 01:22PM

Quote
desga2

- Button is added in new toolbar. (Isn't possible add to default existed bars, I opened bug # 1092 about this)

Thanks for raporting and many thanks to Dorian for fixing.



smiling smiley

Re: PrivacyBar toggling Proxy on/off
Posted by: MXB
Date: May 24, 2011 07:58AM

Thank you Yogi, JamesD and Desga2! Just what I needed. Thought it didn't work at first but it appears one must exit and reload K-M before any change takes effect. I'll try and remember that in future.

I appreciate the option to add it to toolbar instead of privacy bar (as I recently hid it because of Noscript) and the wonderful installer.

Watch out last.fm, I shall return! (I need proxy to listen to it ;) )

--
P2 400 MHz, 128 MB, Win 98 SE

Re: PrivacyBar toggling Proxy on/off
Posted by: Yogi
Date: May 27, 2011 09:59PM

Quote
MXB
Thought it didn't work at first but it appears one must exit and reload K-M before any change takes effect. I'll try and remember that in future.
Toggling Proxy on/off doesn't need to exit and reload K-M.
Changes take effect as soon as you hit the toggling button.
At least that's how it works with 1.5.4 here.
I can't tell for 1.6 beta which I didn't tested yet (shame on me) but I assume it will also work like 1.5.4 does.

Re: PrivacyBar toggling Proxy on/off
Posted by: MXB
Date: May 28, 2011 11:11PM

Quote
Yogi
Quote
MXB
Thought it didn't work at first but it appears one must exit and reload K-M before any change takes effect. I'll try and remember that in future.
Toggling Proxy on/off doesn't need to exit and reload K-M.
Changes take effect as soon as you hit the toggling button.
At least that's how it works with 1.5.4 here.
I can't tell for 1.6 beta which I didn't tested yet (shame on me) but I assume it will also work like 1.5.4 does.

No that's not what my problem was :) I meant that the macro didn't install until I reloaded. The button works perfectly once it appeared after the reloading. 8-D

--
P2 400 MHz, 128 MB, Win 98 SE

Re: PrivacyBar toggling Proxy on/off
Posted by: deadlock
Date: May 29, 2011 01:51AM

Quote
Yogi
Quote
MXB
Thought it didn't work at first but it appears one must exit and reload K-M before any change takes effect. I'll try and remember that in future.
Toggling Proxy on/off doesn't need to exit and reload K-M.
Changes take effect as soon as you hit the toggling button.
At least that's how it works with 1.5.4 here.
I can't tell for 1.6 beta which I didn't tested yet (shame on me) but I assume it will also work like 1.5.4 does.

For me, toggling Proxy on/off works without restart.
--

I found a related issue:

Tested KM 1.54 and 1.6b2 with two different
https-proxy settings.
Switching user-defined proxy configurations has no
effect until restart of browser.
(Not always reproducible.)

Steps to switch without restart:
- turn of proxy
- reload document
- turn on new proxy configuration
- reload document (force)


Tested FF4 with same result and found this:

manual proxy SOCKS configuration change doesn't have (immediate) effect
bugzilla.mozilla.org/show_bug.cgi?id=652928

Proxy: Changing socks needs restart
bugzilla.mozilla.org/show_bug.cgi?id=233811



Edited 3 time(s). Last edit at 06/03/2011 04:27AM by deadlock.

Re: PrivacyBar toggling Proxy on/off
Posted by: 13vyathan
Date: August 21, 2013 02:08AM

Hope someone reads this: I'm not getting the greyed out button with direct connect, though I have the hot proxy image. Any ideas?

Re: PrivacyBar toggling Proxy on/off
Posted by: levyathan
Date: August 21, 2013 02:22AM

this is the macros I used:

# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- PBProxTog.kmm
# ---------- Icon for proxy on and proxy off as part of privacy bar
# ---------- Does not yet handle auto detect
#
# Dependencies : main.kmm, proxy.kmm
# Resources :
# Preferences : "network.proxy.type"
# Version : 0.5 3/21/09
# Author : JamesD
# --------------------------------------------------------------------------------

_PBProxTog_Status{
$_PBProxTog_ToolbarName = "&Privacy Bar" ;
$_PBProxTog_Command = "macros(_PBProxTog_Button)" ;
if (getpref(INT,"network.proxy.type") == 0) {
$_PBProxTog_IconTag = $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, privhot.bmp[0]" ;
pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
}
}

_PBProxTog_Button{
$_PBProxTog_Status = getpref(INT,"network.proxy.type");
if ($_PBProxTog_Status != 0) {
setpref(INT,"network.proxy.type",0);
$_PBProxTog_IconTag = $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, privhot.bmp[0]" ;
pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
} else {
setpref(INT,"network.proxy.type",1);
$_PBProxTog_IconTag = $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, privcold.bmp[0]" ;
pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
}
}

PBProxTog_ToolsAlert{
if ( getpref(INT,"network.proxy.type") == 1) {
$_PBProxTog_IconTag = $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, privcold.bmp[0]" ;
pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
} else {
$_PBProxTog_IconTag = $_PBProxTog_ToolbarName.",".$_PBProxTog_Command.", COLD, privhot.bmp[0]" ;
pluginmsg(toolbars, "SetButtonImage", $_PBProxTog_IconTag);
}
}

$OnStartup=$OnStartup."_PBProxTog_Status;";
$macroModules=$macroModules."PBProxTog;";

Re: PrivacyBar toggling Proxy on/off
Posted by: JamesD
Date: August 21, 2013 07:52PM

That macro came from this thread: http://kmeleon.sourceforge.net/forum/read.php?4,90245,90445#msg-90445

I will try to have a look at it soon. but likely will not get it done today. I may need you to provide the icon file as I don't think that I still have it. I am old and it has been a long time since 2009.

Re: PrivacyBar toggling Proxy on/off
Posted by: levyathan
Date: August 21, 2013 09:08PM

Thank you so much, JamesD, I'm using a button that I created within the Phoenity privacy bar icons, not the PBProxyTog.bmp provided here (which is not accessible anymore):

Cold: Hot:

Here is what the browser looks like when connected directly to the internet:



I'm using portable k-meleon 1.5.4, will give a shot to the new beta version.

THX for the answer, sorry it took me that long to get back to you!

Re: PrivacyBar toggling Proxy on/off
Posted by: JamesD
Date: August 23, 2013 03:59AM

Did you make the change in toolbars.cfg that is mentioned in the thread that I posted earlier? The button must exist in toolbars.cfg before the macro can address it.

Ok, wait, I see that you did.

When you click on the button, do you get a color change? I don't seem to see any code for a "greyed out" button.



Edited 1 time(s). Last edit at 08/23/2013 04:02AM by JamesD.

Re: PrivacyBar toggling Proxy on/off
Posted by: levyathan
Date: August 23, 2013 11:28AM

You're right there not being any code for greying out buttons, I have no idea what I have to do to so that I get this:

1.

2.

The AdBock button behaves as expected, it gets greyed out (hope this is not just a silly mistake about how to appropriately call what I want there to happen);

the Proxy button just switches colors.

I got no problem with anything else, I can browse through a proxy and then switch to direct connection by pressing the button.

Just in case, this is what I put on the toolbars.cfg:

&Privacy Bar(64,13){

%ifplugin macros

Proxy{
macros(_PBProxTog_Button)
Toggle Proxy
privhot.bmp[0]
privcold.bmp[0]
}


AdBlock{
macros(KM_ToggleAdblock)|_Config_Appearance
Block Advertisement Banners
privhot.bmp[1]
privcold.bmp[1]
}


I appreciate the guidance, THX



Edited 1 time(s). Last edit at 08/23/2013 11:33AM by levyathan.

Re: PrivacyBar toggling Proxy on/off
Posted by: JamesD
Date: August 23, 2013 06:51PM

I think I fully understand your question now. It is all about how the button is to appear for each action. The way your buttons are designed is that the only change is that you have a green check and a red X for the buttons. Those are your only choices.

I don't remember how the original buttons for privhot.bmp appeared. There is no method to "gray out" a button in the macro. The macro only can show different buttons.

It looks to me like the macro that you posted is different from the one I had in the old thread. Your version is always showing the image at position zero. It should show a second position image for the alternate state. See all the "if - them" statements in the macro.

I have no skills at making images. That is why the original image came from Yogi.

I hope this helps. If you have more questions, just ask.

K-Meleon forum is powered by Phorum.