Modify

Opened 3 years ago

Last modified 2 years ago

#13765 new enhancement

[patch needs rework] adding a button to test the proxy settings

Reported by: alno Owned by: team
Priority: trivial Milestone:
Component: Core Version: latest
Keywords: preferences, connection settings, proxy settings Cc:

Description

Hello,

I would like to submit the following patch to enhance a little bit the proxy settings panel in the preferences.

It just adds a button that saves the current proxy settings and tests the connection against the startup page of the wiki.

A label below the button shows the test result, enabling the user to know immediately if the entered settings are working or not.

I hope this helps! :)

Attachments (2)

josm-testing-proxy-button.patch (5.7 KB) - added by alno 3 years ago.
patch file generated with NetBeans 8 subversion client
josm-testing-proxy-button-v2.patch (5.1 KB) - added by simon04 3 years ago.

Download all attachments as: .zip

Change History (5)

Changed 3 years ago by alno

patch file generated with NetBeans 8 subversion client

Changed 3 years ago by simon04

comment:1 Changed 3 years ago by simon04

attachment:josm-testing-proxy-button-v2.patch​ contains little modifications. The patch works nicely. What I find counter intuitive (as a user) is that I have to save the not-yet-known-to-be-working settings to test them. That is, if the test fails, I don't want to have the proxy settings saved. Would you consider the following pseudocode feasible?

OldSettings oldSettings = saveToPreferences();
try {
    testConnection();
    // show test result
} finally {
    restore(oldSettings);
}

comment:2 Changed 3 years ago by alno

Hi, thanks a lot for your remarks!

As the proxy settings really need to be stored before thay are used (either in real case or for testing purposes), I had to save the user inputs before trying to test them. I don't know if in other popular applications the things are done in the same way, i.e. in Firefox, when you change the proxy settings with invalid ones, it is not clear wether the old settings are restored or kept until the user changes them again for valid ones.

I've been looking around in the code in order to find how I could implement some sort of backup of the settings before saving the settings that are about to be tested. Unfortunately, it appears more difficult to achieve this than what I expected, as there is no already existing object that represents the proxy settings as they are stored on disk. I think I'll need more time to find a solution for that.

I hope that more people will bring their opinion about my proposal :)

comment:3 Changed 2 years ago by bastiK

Summary: [patch] adding a button to test the proxy settings[patch needs rework] adding a button to test the proxy settings

I agree with Simon. There doesn't seem to be a particularly elegant way to store the settings. You kind of need to follow initFromPreferences and save all those values. Later on re-apply the saved values similar to saveToPreferences().

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to alno
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.