Commit 469c0476 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Desktop.Passwords: Fix KDE support. Use the 'Desktop.Type' property.

[GB.DESKTOP]
* BUG: Desktop.Passwords: Fix KDE support.
* NEW: Use the 'Desktop.Type' property.
parent dc0d0ccb
Pipeline #361214574 passed with stage
in 26 minutes and 6 seconds
......@@ -15,7 +15,6 @@ Static Property Read RootWindow As Integer
Static Property Showing As Boolean
Static Property Read Passwords As _Desktop_Passwords
Static Property Read Path As String
Static Property Read Types As String[]
Static Property Read DataDir As String
Static Property Read ConfigDir As String
......@@ -30,7 +29,6 @@ Static Private $cExt As Collection
Static Private $aImgExt As String[]
Static Private $bRemoteDisplay As Boolean
Static Private $bRemoteDisplayChecked As Boolean
Static Private $aDesktopType As String[]
Static Private $bPlatformLoaded As Boolean
Static Private Sub LoadPlatform() As String
......@@ -144,7 +142,7 @@ Static Public Sub OpenTerminal(Optional {Dir} As String) ', Optional Command As
Dim sProg As String
Dim sDesktop As String
sDesktop = Main.GetDesktop()
sDesktop = Desktop.Type
Select Case sDesktop
......@@ -348,7 +346,7 @@ Static Public Sub RunAsRoot(Command As String)
Dim sExec As String
Select Case Main.GetDesktop()
Select Case Desktop.Type
Case "KDE", "KDE4", "KDE5"
sExec = "kdesudo"
......@@ -574,21 +572,3 @@ Static Private Function RemoteDisplay_Read() As Boolean
Return $bRemoteDisplay
End
Static Private Function Types_Read() As String[]
If Not $aDesktopType Then
$aDesktopType = Split(Desktop.Type, ":")
$aDesktopType.ReadOnly = True
Endif
Return $aDesktopType
End
Static Public Sub Is(Type As String) As Boolean
Return Types_Read().Exist(Type, gb.IgnoreCase)
End
......@@ -9,7 +9,6 @@ Private $cTool As New Collection
'Private _NET_CLIENT_LIST As Integer
Private $aDataDir As String[]
Private $sDesktop As String
Private $cSearchPath As New Collection
Public Sub RunXdgUtil(sProg As String, aArg As String[], Optional bWait As Boolean)
......@@ -132,62 +131,6 @@ Private Function SearchPathVariable(sFileConfig As String, sDirectory As String)
End
Public Sub GetDesktop() As String
If Not $sDesktop Then
If Application.Env["KDE_FULL_SESSION"] Then
If Application.Env["KDE_SESSION_VERSION"] = "4" Then
$sDesktop = "KDE4"
Else If Application.Env["KDE_SESSION_VERSION"] = "5" Then
$sDesktop = "KDE5"
Else
$sDesktop = "KDE"
Endif
Else
Select Case UCase(Application.Env["XDG_CURRENT_DESKTOP"])
Case "LXDE"
$sDesktop = "LXDE"
Case "UNITY"
$sDesktop = "UNITY"
Default
$sDesktop = UCase(Application.Env["XDG_CURRENT_DESKTOP"])
If $sDesktop Begins "X-" Then $sDesktop = Mid$($sDesktop, 3)
End Select
Endif
If Not $sDesktop Then
If Application.Env["GNOME_DESKTOP_SESSION_ID"] Then
$sDesktop = "GNOME"
Else If Application.Env["MATE_DESKTOP_SESSION_ID"] Or If Application.Env["MATECORBA_SOCKETDIR"] Then
$sDesktop = "MATE"
Else If Application.Env["E_BIN_DIR"] And If Application.Env["E_LIB_DIR"] Then
$sDesktop = "ENLIGHTENMENT"
Else If Application.Env["WMAKER_BIN_NAME"] Then
$sDesktop = "WINDOWMAKER"
Else If Application.Env["DESKTOP_SESSION"] = "LXDE" Then
$sDesktop = "LXDE"
Else If UCase(Env["DESKTOP_SESSION"]) = "XCFE" Then
$sDesktop = "XFCE"
Else If UCase(Env["XDG_MENU_PREFIX"]) Begins "XCFE" Then
$sDesktop = "XFCE"
Else If InStr(Env["XDG_DATA_DIR"], "/xfce") Then
$sDesktop = "XFCE"
Endif
Endif
Endif
Return $sDesktop
End
Public Sub GetDesktopPath(Optional sType As String = "DESKTOP") As String
Dim sDir, sXdgConfigHome, sXdgConfigDirs, sFileConfig As String
......@@ -305,7 +248,7 @@ Public Sub MakeSearchPath(sKey As String, aList As String[]) As String[]
Endif
sDir = Replace(sDir, "$desktop", LCase(GetDesktop()))
sDir = Replace(sDir, "$desktop", LCase(Desktop.Type))
If Exist(sDir) Then aResult.Add(sDir)
Wend
......
......@@ -27,15 +27,7 @@ Private Sub OpenWallet()
$iType = TYPE_NONE
If Desktop.Is("KDE") Then
Shell "dcop kded kwalletd localWallet" To sResult
sWallet = Trim(Split(sResult, "\n")[0])
Shell Subst("dcop kded kwalletd open &1 0", Shell(sWallet)) To sResult
$sKDEWalletId = Trim(sResult)
$iType = TYPE_KDE
Else If Desktop.Is("GNOME") Or If Desktop.Is("LXDE") Or If Desktop.Is("MATE") Or If Desktop.Is("XFCE") Or If Desktop.Is("UNITY") Or If Desktop.Is("CYGWIN") Then
If Desktop.Is("GNOME") Or If Desktop.Is("LXDE") Or If Desktop.Is("MATE") Or If Desktop.Is("XFCE") Or If Desktop.Is("UNITY") Or If Desktop.Is("CYGWIN") Then
$sSecretTool = System.Find("secret-tool")
If Not $sSecretTool Then Error.Raise("'secret-tool' is not found. Did you install it?")
......@@ -59,7 +51,15 @@ Private Sub OpenWallet()
$sKDEWalletId = Trim(sResult)
If Not $sKDEWalletId Then Error.Raise("No wallet found")
$iType = TYPE_KDE5
Else If Desktop.Is("KDE") And System.Exist("dcop") Then ' KDE 3?
Shell "dcop kded kwalletd localWallet" To sResult
sWallet = Trim(Split(sResult, "\n")[0])
Shell Subst("dcop kded kwalletd open &1 0", Shell(sWallet)) To sResult
$sKDEWalletId = Trim(sResult)
$iType = TYPE_KDE
Else
Error.Raise("desktop is not supported")
......@@ -68,7 +68,7 @@ Private Sub OpenWallet()
Catch
Error.Raise("Cannot store passwords on desktop '" & Desktop.Type & "' : " & Error.Text)
Error.Raise("Cannot store passwords on desktop '" & Desktop.Type & "' : " & Error.Where & ": " & Error.Text)
End
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment