diff --git a/comp/src/gb.form.dialog/.icon.png b/comp/src/gb.form.dialog/.icon.png index 8748600ba..4e185c57a 100644 Binary files a/comp/src/gb.form.dialog/.icon.png and b/comp/src/gb.form.dialog/.icon.png differ diff --git a/comp/src/gb.form.dialog/.lang/fr.mo b/comp/src/gb.form.dialog/.lang/fr.mo index 637deb55d..5440a4f37 100644 Binary files a/comp/src/gb.form.dialog/.lang/fr.mo and b/comp/src/gb.form.dialog/.lang/fr.mo differ diff --git a/comp/src/gb.form.dialog/.lang/fr.po b/comp/src/gb.form.dialog/.lang/fr.po index 2b154d25c..8496ef66f 100644 --- a/comp/src/gb.form.dialog/.lang/fr.po +++ b/comp/src/gb.form.dialog/.lang/fr.po @@ -2,7 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: gb.form.dialog 3.10.90\n" -"PO-Revision-Date: 2017-09-30 01:41 UTC\n" +"POT-Creation-Date: 2017-10-09 23:09 UTC\n" +"PO-Revision-Date: 2017-10-09 23:08 UTC\n" "Last-Translator: benoit \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -11,13 +12,31 @@ msgstr "" #: .project:1 msgid "Enhanced standard dialogs" -msgstr "" +msgstr "-" -#: FDirDialog.form:32 FFontDialog.form:35 FInputDate.form:41 +#: FAskPassword.form:22 +msgid "Authentication" +msgstr "Identification" + +#: FAskPassword.form:51 +msgid "User" +msgstr "Utilisateur" + +#: FAskPassword.form:65 +msgid "Password" +msgstr "Mot de passe" + +#: FAskPassword.form:78 +msgid "Remember password" +msgstr "Se souvenir du mot de passe" + +#: FAskPassword.form:98 FDirDialog.form:32 FFontDialog.form:35 +#: FInputDate.form:41 msgid "OK" msgstr "OK" -#: FDirDialog.form:38 FFileDialog.class:107 FFontDialog.form:41 FInputDate.form:47 +#: FAskPassword.form:104 FDirDialog.form:38 FFileDialog.class:107 +#: FFontDialog.form:41 FInputDate.form:47 msgid "Cancel" msgstr "Annuler" @@ -26,8 +45,14 @@ msgid "&Overwrite" msgstr "&Remplacer" #: FFileDialog.class:107 -msgid "This file already exists.\n\nDo you want to overwrite it?" -msgstr "Ce fichier existe déjà.\n\nDésirez-vous le remplacer ?" +msgid "" +"This file already exists.\n" +"\n" +"Do you want to overwrite it?" +msgstr "" +"Ce fichier existe déjà.\n" +"\n" +"Désirez-vous le remplacer ?" #: FFileDialog.form:22 msgid "Automatic extension" @@ -36,4 +61,3 @@ msgstr "Extension automatique" #: FFontDialog.form:12 msgid "Select a font" msgstr "Sélectionnez une police" - diff --git a/comp/src/gb.form.dialog/.project b/comp/src/gb.form.dialog/.project index f6f2fe39a..6ccebd516 100644 --- a/comp/src/gb.form.dialog/.project +++ b/comp/src/gb.form.dialog/.project @@ -7,9 +7,11 @@ VersionFile=1 Component=gb.image Component=gb.gui Component=gb.form +Component=gb.desktop.x11 +Component=gb.desktop Component=gb.settings Authors="Benoît Minisini\nDavid Villalobos Cambronero" -Environment="GB_GUI=gb.gtk3" +Environment="GB_GUI=gb.qt5" TabSize=2 Translate=1 Language=en diff --git a/comp/src/gb.form.dialog/.src/Dialog.class b/comp/src/gb.form.dialog/.src/Dialog.class index b8de89f2f..450b13526 100644 --- a/comp/src/gb.form.dialog/.src/Dialog.class +++ b/comp/src/gb.form.dialog/.src/Dialog.class @@ -11,6 +11,10 @@ Static Property FixedOnly As Boolean Static Property Key As String +Static Property User As String +Static Property Read Password As String +Static Property NoUser As Boolean + Static Private $sKey As String Static Public Function OpenFile(Optional Multi As Boolean) As Boolean @@ -100,3 +104,39 @@ Static Private Sub Key_Write(Value As String) $sKey = Value End + +Static Public Sub AskPassword() As Boolean + + Return FAskPassword.Run() + +End + +Static Private Function Password_Read() As String + + Return FAskPassword.Password + +End + +Static Private Function NoUser_Read() As Boolean + + Return FAskPassword.NoUser + +End + +Static Private Sub NoUser_Write(Value As Boolean) + + FAskPassword.NoUser = Value + +End + +Static Private Function User_Read() As String + + Return FAskPassword.User + +End + +Static Private Sub User_Write(Value As String) + + FAskPassword.User = Value + +End diff --git a/comp/src/gb.form.dialog/.src/FAskPassword.class b/comp/src/gb.form.dialog/.src/FAskPassword.class new file mode 100644 index 000000000..a403e6d0a --- /dev/null +++ b/comp/src/gb.form.dialog/.src/FAskPassword.class @@ -0,0 +1,103 @@ +' Gambas class file + +Class Desktop + +Static Public NoUser As Boolean +Static Public (User) As String +Static Public Password As String + +Private $bHasDesktop As Boolean +Private $bHasSettings As Boolean +Private $sKey As String + +Public Sub Run() As Boolean + + ' Dim hWindow As Window + Dim bRet As Integer + Dim iBusy As Integer + + ' hWindow = New Window + ' hWindow.Move(0, 0, Screen.Width, Screen.Height) + ' hWindow.Background = Color.Black + ' hWindow.Opacity = 40 + ' hWindow.Border = False + ' hWindow.SkipTaskbar = True + ' hWindow.Show + + iBusy = Application.Busy + Application.Busy = 0 + + bRet = Not Me.ShowModal() + + Application.Busy = iBusy + + ' hWindow.Close + + Return bRet + +End + +Public Sub btnOK_Click() + + {User} = txtUser.Text + Password = txtPassword.Text + + If $sKey Then + Settings[$sKey &/ "User"] = txtUser.Text + Settings[$sKey &/ "Remember"] = chkRemember.Value + If $bHasDesktop And If chkRemember.Value Then + Desktop.Passwords[$sKey] = txtPassword.Text + Endif + Endif + + Me.Close(True) + +End + +Public Sub btnCancel_Click() + + Me.Close + +End + + +Public Sub Form_Open() + + $bHasSettings = Component.IsLoaded("gb.settings") + $bHasDesktop = Component.IsLoaded("gb.desktop") + + If Dialog.Title Then Me.Title = Dialog.Title + + If $bHasSettings And If Dialog.Key Then $sKey = "gb.form.dialog/FAskPassword/" &/ Dialog.Key + + If NoUser Then + txtUser.Enabled = False + Else If $sKey Then + txtUser.Text = Settings[$sKey &/ "User"] + Else + txtUser.Text = {User} + Endif + + If $bHasDesktop And If $sKey Then + chkRemember.Show + chkRemember.Value = Settings[$sKey &/ "Remember", False] + If chkRemember.Value Then + txtPassword.Text = Desktop.Passwords[$sKey] + Endif + Else + panPassword.H -= chkRemember.H + Endif + + If txtUser.Length Or If NoUser Then + txtPassword.SetFocus + Else + txtUser.SetFocus + Endif + +End + +Public Sub Form_Close() + + NoUser = False + +End diff --git a/comp/src/gb.form.dialog/.src/FAskPassword.form b/comp/src/gb.form.dialog/.src/FAskPassword.form new file mode 100644 index 000000000..ea23cb123 --- /dev/null +++ b/comp/src/gb.form.dialog/.src/FAskPassword.form @@ -0,0 +1,76 @@ +# Gambas Form File 3.0 + +{ Form Form + MoveScaled(0,0,57,21) + Text = ("Authentication") + Icon = Picture["icon:/small/security"] + Resizable = False + Stacking = Window.Above + Arrangement = Arrange.Vertical + AutoResize = True + Spacing = True + Margin = True + { panPassword HBox + MoveScaled(1,1,52,13) + Spacing = True + { PictureBox1 PictureBox + MoveScaled(1,1,8,11) + Picture = Picture["icon:/huge/security"] + AutoResize = True + } + { Panel4 VBox + MoveScaled(9,0,41,13) + Expand = True + Spacing = True + { HBox2 HBox + MoveScaled(0,0,39,4) + { Label1 Label + MoveScaled(0,0,13,4) + Text = ("User") + } + { txtUser TextBox + MoveScaled(21,0,17,4) + Expand = True + } + } + { HBox3 HBox + MoveScaled(0,5,40,4) + { Label2 Label + MoveScaled(0,0,13,4) + Text = ("Password") + } + { txtPassword TextBox + MoveScaled(21,0,17,4) + Expand = True + Password = True + } + } + { chkRemember CheckBox + MoveScaled(0,9,23,4) + Visible = False + Text = ("Remember password") + } + } + } + { Panel2 Panel + MoveScaled(20,15,3,1) + } + { HBox1 HBox + MoveScaled(1,16,51,4) + Spacing = True + { Panel1 Panel + MoveScaled(3,0,2,4) + Expand = True + } + { btnOK Button + MoveScaled(11,0,16,4) + Text = ("OK") + Default = True + } + { btnCancel Button + MoveScaled(30,0,16,4) + Text = ("Cancel") + Cancel = True + } + } +} diff --git a/comp/src/gb.form.dialog/.src/Main.module b/comp/src/gb.form.dialog/.src/Main.module index 8cca0e35b..37ff46a83 100644 --- a/comp/src/gb.form.dialog/.src/Main.module +++ b/comp/src/gb.form.dialog/.src/Main.module @@ -2,12 +2,14 @@ Public Sub Main() - ' Dialog.Title = "Save document" - Dialog.Filter = ["*.tar.gz", "Archive files", "*.png", "PNG files", "*.jpg;*.jpeg", "JPEG files", "*.bmp", "BMP files"] + Dialog.Title = "Commit" + ' Dialog.Filter = ["*.tar.gz", "Archive files", "*.png", "PNG files", "*.jpg;*.jpeg", "JPEG files", "*.bmp", "BMP files"] ' Dialog.AutoExt = True ' If Dialog.SaveFile() Then Return ' Print Dialog.Path - Dialog.OpenFile(True) + Dialog.Key = "test" + Dialog.NoUser = True + Dialog.AskPassword() End