Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask-vpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leap
bitmask-vpn
Commits
cae08421
Unverified
Commit
cae08421
authored
3 years ago
by
Kali Kaneko
Browse files
Options
Downloads
Patches
Plain Diff
[ui] systray actions
parent
79d25833
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gui/components/Systray.qml
+64
-0
64 additions, 0 deletions
gui/components/Systray.qml
gui/components/VPNState.qml
+3
-1
3 additions, 1 deletion
gui/components/VPNState.qml
gui/main.qml
+11
-2
11 additions, 2 deletions
gui/main.qml
with
78 additions
and
3 deletions
gui/components/Systray.qml
+
64
−
0
View file @
cae08421
...
...
@@ -17,6 +17,19 @@ Labs.SystemTrayIcon {
enabled
:
false
}
Labs.MenuItem
{
id
:
vpnSystrayToggle
text
:
getConnectionText
()
enabled
:
isConnectionTextEnabled
()
onTriggered
:
{
if
(
ctx
.
status
==
"
off
"
)
{
backend
.
switchOn
()
}
else
if
(
ctx
.
status
==
"
on
"
)
{
backend
.
switchOff
()
}
}
}
Labs.MenuSeparator
{}
Labs.MenuItem
{
...
...
@@ -27,8 +40,59 @@ Labs.SystemTrayIcon {
Labs.MenuSeparator
{}
Labs.MenuItem
{
id
:
showAppItem
//: Part of the systray menu; show or hide the main app window
text
:
isVisible
()
?
qsTr
(
"
Hide
"
)
:
qsTr
(
"
Show
"
)
onTriggered
:
{
if
(
isVisible
())
{
root
.
hide
()
}
else
{
root
.
bringToFront
()
}
}
}
Labs.MenuItem
{
//: Part of the systray menu; quits que application
text
:
qsTr
(
"
Quit
"
)
onTriggered
:
backend
.
quit
()
}
}
function
isVisible
()
{
return
root
.
visibility
!=
0
&&
root
.
visibility
!=
3
}
function
getConnectionText
()
{
if
(
!
ctx
)
{
return
""
}
else
if
(
ctx
.
status
==
"
off
"
)
{
// Not Turn on, because we will can later append "to <Location>"
if
(
ctx
.
locations
&&
ctx
.
bestLocation
)
{
return
qsTr
(
"
Connect to
"
)
+
"
"
+
getCanonicalLocation
(
ctx
.
bestLocation
)
}
else
{
return
qsTr
(
"
Connect
"
)
}
}
else
if
(
ctx
.
status
==
"
on
"
)
{
return
qsTr
(
"
Disconnect
"
)
}
return
""
}
function
isConnectionTextEnabled
()
{
if
(
!
ctx
)
{
return
false
}
return
ctx
.
status
==
"
off
"
||
ctx
.
status
==
"
on
"
}
// returns the composite of Location, CC
function
getCanonicalLocation
(
label
)
{
try
{
let
loc
=
ctx
.
locationLabels
[
label
]
return
loc
[
0
]
+
"
,
"
+
loc
[
1
]
}
catch
(
e
)
{
return
"
unknown
"
}
}
}
This diff is collapsed.
Click to expand it.
gui/components/VPNState.qml
+
3
−
1
View file @
cae08421
...
...
@@ -37,7 +37,9 @@ StateGroup {
PropertyChanges
{
target
:
toggleVPN
enabled
:
false
text
:
(
"
...
"
)
// XXX this is a fake cancel, won't do anything at this point. We need
// to queue this action for when the openvpn process becomes available.
text
:
(
"
Cancel
"
)
}
PropertyChanges
{
target
:
systray
...
...
This diff is collapsed.
Click to expand it.
gui/main.qml
+
11
−
2
View file @
cae08421
...
...
@@ -3,8 +3,6 @@
/*
TODO (ui rewrite)
See https://0xacab.org/leap/bitmask-vpn/-/issues/523
- [x] udp support
- [ ] minimize/hide from systray
- [ ] control actions from systray
- [ ] add gateway to systray
*/
...
...
@@ -144,6 +142,17 @@ ApplicationWindow {
return
Array
.
from
(
arr
,
(
k
,
_
)
=>
k
.
key
);
}
function
bringToFront
()
{
// FIXME does not work properly, at least on linux
if
(
visibility
==
3
)
{
showNormal
()
}
else
{
show
()
}
raise
()
requestActivate
()
}
onSceneGraphError
:
function
(
error
,
msg
)
{
console
.
debug
(
"
ERROR while initializing scene
"
)
console
.
debug
(
msg
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment