palinek / nm-tray

NetworkManager tray icon -> simple front end (nm-applet)
GNU General Public License v2.0
57 stars 18 forks source link

[Request] VPN menu #3

Closed nbvcxz closed 7 years ago

nbvcxz commented 8 years ago

As nm-tray is great small piece of software, please keep in mind to add the vpn feature for this eg. start stop preconfigured vpn (as already in gtk version). (thumbsup) #

palinek commented 8 years ago

Fair request, but as you can see nm-tray is still in some kind of "proof of concept" phase and there are many other "core" things to do/polish. So I think the VPN stuff will not be added in soon future.

nbvcxz commented 8 years ago

In fact it's quite nice working as "proof of concept". I just started using it and it's ok. Know you have the schedule for features, but try to include VPN after most important features.

palinek commented 8 years ago

vpn feature for this eg. start stop preconfigured vpn (as already in gtk version)

@nbvcxz I don't use VPNs configured by NetworkManager... but do you have a preconfigured VPN connection? Did you try to activate it by (double)clicking on the treeview "All information" in "Debug information" dialog?

nbvcxz commented 8 years ago

I got preconfigured (with NetwokManager) and saved VPN connection setup. It is visible in Debug information → All information → connection(s), but double clicking at it has no action (single or any other too). When I am connected to VPN it is "connection list" (left click on tray icon) at the top of available wifi networks. Clicking it disconnects as supposed to be.

palinek commented 7 years ago

@nbvcxz can you try the same procedure as above with the ef92c06f102d04b00595085b01475261b9779543? Does it make any change?

palinek commented 7 years ago

I believe, this is fixed in current master. If not, please, reopen ...

nbvcxz commented 7 years ago

Sorry for very late answer. I just now have been able to compile and test the latest code. So now it is quite fine (not perfect, but enough to use it). The VPN connections are displayed in the list. The one drawback is: the connection list is wrapped into 2 columns and it is placed right-top of display. But the functionality is OK. Summarizing: confirmed VPN menu works !!

palinek commented 7 years ago

@nbvcxz Great...thanks for testing.

The one drawback is: the connection list is wrapped into 2 columns

All the "menu lists" (active connections, wifis, connections) show up to 10 (hardcoded) items... Is this too much? Or should we make that configurable?

nbvcxz commented 7 years ago

Looks a bit odd here, but works fine. ;) nm-tray_menu

nbvcxz commented 7 years ago

Seems it looks fine with lower number of Wifi items in menu. Here at another laptop: nm-tray_menu_breeze But also with another qt-theme (kvantum), gtk: breeze-gtk and LXQT Plasma theme. It can also make a difference. And last thing: great work - you created fully functional and nice replacement for network-manager-applet in pure QT5 !!

palinek commented 7 years ago

Huh... it seems like some Qt style engines (like kvantum here) aren't using/painting the text of menu separators.

@tsujan can you, please, have a look on this? Should/must the style engine use the text of "separator" QAction in QMenu?

tsujan commented 7 years ago

@palinek I haven't seen a Qt style engine that shows the text of a menu separator. Kvantum can draw a separator but just shows an empty space if the separator SVG element isn't present (that's the case in all themes that come with Kvantum -- menus are more elegant with spaces instead of separators, IMO).

All Qt styles show menu titles though (as in LXQt Panel right-click menu or some KDE menus).

tsujan commented 7 years ago

BTW, a menu title is a toolbutton whose parent is the menu. isDown() is true for it and its toolButtonStyle() is Qt::ToolButtonTextBesideIcon.

palinek commented 7 years ago

I haven't seen a Qt style engine that shows the text of a menu separator.

Funny...I just tested the fusion & breeze and both were painting the text.

palinek commented 7 years ago

Heh... my mistake.... I wrote about separator... but thought of a section QAction *QMenu::addSection(const QString &text)

But as the doc says The rendering of the hint is style and platform dependent. Widget styles can use the text information in the rendering for sections, or can choose to ignore it and render sections like simple separators. .... I need to use something else to force painting the text.

tsujan commented 7 years ago

I need to use something else to force painting the text.

There are various ways to do so. For example:

    QLabel *l = new QLabel("<center><b><i>A Title</i></b></center>");
    QWidgetAction *sep = new QWidgetAction(myMenu);
    sep->setDefaultWidget(l);
    myMenu->insertAction(thisItem, sep);

Which results in something like this:

menu_title

nbvcxz commented 7 years ago

Just to confirm - now r67.443b117-1 everything looks fine. Great work !! And IMO it's time for 1.00 release as it is fully functional now.

baptx commented 6 years ago

Is it normal that it is not possible to add a VPN using nm-tray (it is not listed in "Edit connections" when we click on "Add" so we have to use nm-connection-editor) and to connect to a VPN using nm-tray, the program nm-applet has to run in background? By the way, is there a Qt graphical interface planned to edit connections? At the moment when we click on "Edit connections", a terminal-based interface nmtui is called, which is less user-friendly. I tested on Lubuntu 18.10, it comes with nm-tray version 0.4.1.

palinek commented 6 years ago

it is not listed in "Edit connections" when we click on "Add" so we have to use nm-connection-editor

As you stated later, nm-tray doesn't have the ability to edit connections, it uses external program (the external command can be configured in $XDG_HOME/nm-tray/nm-tray.conf). So if you are lacking any functionality in the external tool, please, report it there.

the program nm-applet has to run in background?

No it doesn't need to be run.

By the way, is there a Qt graphical interface planned to edit connections?

There is an open issue about that -> #23

wxl commented 4 years ago

Just wanted to add a little note to that last comment that the external command can be configured in $XDG_CONFIG_{DIRS,HOME}/nm-tray/nm-tray.conf since QSettings is being used and since it uses these dirs by default.