Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpcs
dfss
Commits
4c9fe6a3
Commit
4c9fe6a3
authored
Apr 23, 2016
by
Loïck Bonniot
Browse files
[gui] Create package common and add Help action
parent
446405a2
Pipeline
#875
passed with stage
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gui/about.go
View file @
4c9fe6a3
...
...
@@ -14,3 +14,7 @@ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIG
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.`
const
help
=
`Your configuration and authentication files are stored under your home directory, in a .dfss folder.
You may want to save this folder in a secure way in order to re-use your account on several computers.`
gui/authform/authform.go
View file @
4c9fe6a3
...
...
@@ -2,7 +2,7 @@ package authform
import
(
"dfss/dfssc/user"
"dfss/gui/co
nfig
"
"dfss/gui/co
mmon
"
"github.com/spf13/viper"
"github.com/visualfc/goqt/ui"
)
...
...
@@ -27,7 +27,7 @@ func NewWidget(onAuth func()) *Widget {
)
form
.
SetDisabled
(
false
)
if
err
!=
nil
{
co
nfig
.
ShowMsgBox
(
err
.
Error
(),
true
)
co
mmon
.
ShowMsgBox
(
err
.
Error
(),
true
)
tokenField
.
SetFocus
()
tokenField
.
SelectAll
()
}
else
{
...
...
gui/co
nfig
/dialog.go
→
gui/co
mmon
/dialog.go
View file @
4c9fe6a3
package
co
nfig
package
co
mmon
// This file handles basic feedback messages.
...
...
@@ -7,7 +7,6 @@ import (
"io/ioutil"
"dfss/auth"
"github.com/spf13/viper"
"github.com/visualfc/goqt/ui"
)
...
...
gui/contractform/contractform.go
View file @
4c9fe6a3
...
...
@@ -4,8 +4,8 @@ import (
"strings"
"dfss/dfssc/sign"
"dfss/gui/common"
"dfss/gui/config"
"github.com/spf13/viper"
"github.com/visualfc/goqt/ui"
)
...
...
@@ -42,7 +42,7 @@ func NewWidget() *Widget {
createButton
.
OnClicked
(
func
()
{
form
.
SetDisabled
(
true
)
co
nfig
.
PasswordDialog
(
func
(
err
error
,
pwd
string
)
{
co
mmon
.
PasswordDialog
(
func
(
err
error
,
pwd
string
)
{
if
err
!=
nil
{
form
.
SetDisabled
(
false
)
return
// wrong key or rejection, aborting
...
...
@@ -56,9 +56,9 @@ func NewWidget() *Widget {
)
if
err
!=
nil
{
co
nfig
.
ShowMsgBox
(
err
.
Error
(),
true
)
co
mmon
.
ShowMsgBox
(
err
.
Error
(),
true
)
}
else
{
co
nfig
.
ShowMsgBox
(
"Contract successfully sent to signers!"
,
false
)
co
mmon
.
ShowMsgBox
(
"Contract successfully sent to signers!"
,
false
)
fileField
.
SetText
(
""
)
}
form
.
SetDisabled
(
false
)
...
...
gui/main.go
View file @
4c9fe6a3
...
...
@@ -3,6 +3,7 @@ package main
import
(
"dfss"
"dfss/dfssp/contract"
"dfss/gui/common"
"dfss/gui/config"
"github.com/spf13/viper"
"github.com/visualfc/goqt/ui"
...
...
@@ -73,6 +74,11 @@ func (w *window) addActions() {
fetchAct
:=
ui
.
NewActionWithTextParent
(
"&Fetch"
,
w
)
fetchAct
.
OnTriggered
(
w
.
showFetchForm
)
helpAct
:=
ui
.
NewActionWithTextParent
(
"&Help"
,
w
)
helpAct
.
OnTriggered
(
func
()
{
common
.
ShowMsgBox
(
help
,
false
)
})
aboutAct
:=
ui
.
NewActionWithTextParent
(
"&About"
,
w
)
aboutAct
.
OnTriggered
(
func
()
{
ui
.
QMessageBoxAbout
(
w
,
"About DFSS Client"
,
about
)
...
...
@@ -93,6 +99,7 @@ func (w *window) addActions() {
fileMenu
.
AddAction
(
fetchAct
)
helpMenu
:=
w
.
MenuBar
()
.
AddMenuWithTitle
(
"&Help"
)
helpMenu
.
AddAction
(
helpAct
)
helpMenu
.
AddAction
(
aboutAct
)
helpMenu
.
AddSeparator
()
helpMenu
.
AddAction
(
aboutQtAct
)
...
...
gui/screens.go
View file @
4c9fe6a3
...
...
@@ -3,7 +3,7 @@ package main
import
(
"dfss/dfssc/sign"
"dfss/gui/authform"
"dfss/gui/co
nfig
"
"dfss/gui/co
mmon
"
"dfss/gui/contractform"
"dfss/gui/showcontract"
"dfss/gui/signform"
...
...
@@ -50,17 +50,17 @@ func (w *window) showShowContract(filename string) {
w
.
contract
=
showcontract
.
Load
(
filename
)
if
w
.
contract
==
nil
{
co
nfig
.
ShowMsgBox
(
"Unable to load file"
,
true
)
co
mmon
.
ShowMsgBox
(
"Unable to load file"
,
true
)
return
}
w
.
setScreen
(
showcontract
.
NewWidget
(
w
.
contract
,
w
.
showSignForm
))
}
func
(
w
*
window
)
showSignForm
()
{
co
nfig
.
PasswordDialog
(
func
(
err
error
,
pwd
string
)
{
co
mmon
.
PasswordDialog
(
func
(
err
error
,
pwd
string
)
{
widget
:=
signform
.
NewWidget
(
w
.
contract
,
pwd
)
if
widget
==
nil
{
co
nfig
.
ShowMsgBox
(
"Unable to start the signing procedure"
,
true
)
co
mmon
.
ShowMsgBox
(
"Unable to start the signing procedure"
,
true
)
return
}
w
.
setScreen
(
widget
)
...
...
@@ -69,7 +69,7 @@ func (w *window) showSignForm() {
func
(
w
*
window
)
showFetchForm
()
{
w
.
current
.
Q
()
.
SetDisabled
(
true
)
co
nfig
.
PasswordDialog
(
func
(
err
error
,
pwd
string
)
{
co
mmon
.
PasswordDialog
(
func
(
err
error
,
pwd
string
)
{
if
err
!=
nil
{
w
.
current
.
Q
()
.
SetDisabled
(
false
)
return
...
...
@@ -87,11 +87,11 @@ func (w *window) showFetchForm() {
err
:=
sign
.
FetchContract
(
pwd
,
uuid
,
path
)
if
err
!=
nil
{
co
nfig
.
ShowMsgBox
(
err
.
Error
(),
true
)
co
mmon
.
ShowMsgBox
(
err
.
Error
(),
true
)
return
}
w
.
showShowContract
(
path
)
co
nfig
.
ShowMsgBox
(
"Contract stored as "
+
path
,
false
)
co
mmon
.
ShowMsgBox
(
"Contract stored as "
+
path
,
false
)
})
dialog
.
OnFinished
(
func
(
_
int32
)
{
...
...
gui/userform/userform.go
View file @
4c9fe6a3
...
...
@@ -4,6 +4,7 @@ import (
"io/ioutil"
"dfss/dfssc/user"
"dfss/gui/common"
"dfss/gui/config"
"github.com/spf13/viper"
...
...
@@ -41,7 +42,7 @@ func NewWidget(onRegistered func(pw string)) *Widget {
""
,
""
,
""
,
emailField
.
Text
(),
2048
,
)
if
err
!=
nil
{
co
nfig
.
ShowMsgBox
(
err
.
Error
(),
true
)
co
mmon
.
ShowMsgBox
(
err
.
Error
(),
true
)
}
else
{
viper
.
Set
(
"email"
,
emailField
.
Text
())
onRegistered
(
passwordField
.
Text
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment