[Gambas-user] Drag & drop files
Jussi Lahtinen
jussi.lahtinen at ...626...
Fri Dec 2 19:23:12 CET 2011
gvfs 1.10.0-0ubuntu1
On Fri, Dec 2, 2011 at 20:21, Jussi Lahtinen <jussi.lahtinen at ...626...>wrote:
> It seems to be in gvfs package in debian/ubuntu.
>
> Jussi
>
>
>
>
> On Fri, Dec 2, 2011 at 19:54, Maria <geaplanet at ...397...> wrote:
>
>> Thanks, Pham
>>
>> I can't find libgvfscommon in debian, is it an old library pearhaps?
>>
>>
>> In gambas-es comunity, jguardon, resolved the problem using a function
>> for automatic conversion:
>> http://www.gambas-es.org/viewtopic.php?f=1&t=2054&postdays=0&postorder=asc&start=10
>>
>>
>> Here it is the code of jguardon:
>>
>> ' Gambas class file
>>
>> Public Sub Form_Open()
>>
>> End
>>
>> Public Sub boton_Drop()
>>
>> Dim a As String
>> Dim b As String[]
>>
>> a = Drag.Paste("text/uri-list") ' limitamos el tipo de los datos pegados
>> b = Split(a, gb.CrLf, "", True) ' cargamos la lista de rutas en un
>> array b
>> ' escapando las terminaciones de línea
>> a = Null ' reutilizamos la variable "a"
>>
>> For Each a In b
>> a = Right$(a, -7) ' quitamos "file://"
>> a = URLDecode(a) ' descodificamos las cadenas
>> Print a
>> Desktop.Open(a) ' para probar, abrimos cada tipo de
>> ' fichero con la aplicacion correspondiente
>> Next
>>
>> End
>>
>> Static Private Function URLDecode(txt As String) As String
>> ''' Descodifica los caracteres hexadecimales en las URI's recorriendo
>> la cadena dada
>> ''' Params: txt la URI a descodificar
>> ''' Return: la URI descodificada
>>
>> Dim txt_len As Integer
>> Dim i As Integer
>> Dim ch As String
>> Dim digits As String
>> Dim resultado As String
>>
>> resultado = ""
>> txt_len = Len(txt)
>> i = 1
>> Do While i <= txt_len
>> ' Examinar el siguiente caracter
>> ch = Mid$(txt, i, 1)
>> If ch = "+" Then
>> ' Convertir a espacio
>> resultado = resultado & " "
>> Else If ch <> "%" Then
>> ' Normal, no cambiar
>> resultado = resultado & ch
>> Else If i > txt_len - 2 Then
>> resultado = resultado & ch
>> Else
>> ' Obtener los siguientes caracteres hex.
>> digits = Mid$(txt, i + 1, 2)
>> ' Debug digits
>> ' aquí convertimos el valor hexadecimal a entero y
>> ' se lo pasamos a Chr que devuelve el carácter correcto.
>> resultado = resultado & Chr$(CInt(Val("&" & digits)))
>> i = i + 2
>> Endif
>> i = i + 1
>> Loop
>>
>> Return resultado
>>
>> End
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
More information about the User
mailing list