source: branches/guitools-2.0/evfsgui/evfsgui.VRX @ 455

Last change on this file since 455 was 455, checked in by Herwig Bauernfeind, 10 years ago

GUI-Tools: EVFSGUI: Fix Ticket #137

File size: 155.3 KB
Line 
1/*:VRX         Main
2*/
3/*  Main
4*/
5Main:
6/*  Process the arguments.
7    Get the parent window.
8*/
9    parse source . calledAs .
10    parent = ""
11    argCount = arg()
12    argOff = 0
13    if( calledAs \= "COMMAND" )then do
14        if argCount >= 1 then do
15            parent = arg(1)
16            argCount = argCount - 1
17            argOff = 1
18        end
19    end; else do
20        call VROptions 'ImplicitNames'
21        call VROptions 'NoEchoQuit'
22    end
23    InitArgs.0 = argCount
24    if( argCount > 0 )then do i = 1 to argCount
25        InitArgs.i = arg( i + argOff )
26    end
27    drop calledAs argCount argOff
28
29/*  Load the windows
30*/
31    call VRInit
32    parse source . . spec
33    _VREPrimaryWindowPath = ,
34        VRParseFileName( spec, "dpn" ) || ".VRW"
35    _VREPrimaryWindow = ,
36        VRLoad( parent, _VREPrimaryWindowPath )
37    drop parent spec
38    if( _VREPrimaryWindow == "" )then do
39        call VRMessage "", "Cannot load window:" VRError(), ,
40            "Error!"
41        _VREReturnValue = 32000
42        signal _VRELeaveMain
43    end
44
45/*  Process events
46*/
47    call Init
48    signal on halt
49    do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
50        _VREEvent = VREvent()
51        interpret _VREEvent
52    end
53_VREHalt:
54    _VREReturnValue = Fini()
55    call VRDestroy _VREPrimaryWindow
56_VRELeaveMain:
57    call VRFini
58exit _VREReturnValue
59
60VRLoadSecondary:
61    __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
62    if __vrlsWait then do
63        call VRFlush
64    end
65    __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
66    if __vrlsHWnd = '' then signal __vrlsDone
67    if __vrlsWait \= 1 then signal __vrlsDone
68    call VRSet __vrlsHWnd, 'WindowMode', 'Modal'
69    __vrlsTmp = __vrlsWindows.0
70    if( DataType(__vrlsTmp) \= 'NUM' ) then do
71        __vrlsTmp = 1
72    end
73    else do
74        __vrlsTmp = __vrlsTmp + 1
75    end
76    __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
77    __vrlsWindows.0 = __vrlsTmp
78    do while( VRIsValidObject( VRWindow() ) = 1 )
79        __vrlsEvent = VREvent()
80        interpret __vrlsEvent
81    end
82    __vrlsTmp = __vrlsWindows.0
83    __vrlsWindows.0 = __vrlsTmp - 1
84    call VRWindow __vrlsWindows.__vrlsTmp
85    __vrlsHWnd = ''
86__vrlsDone:
87return __vrlsHWnd
88
89/*:VRX         __VXREXX____APPENDS__
90*/
91__VXREXX____APPENDS__:
92/*
93#append U:\Develop\Samba\guitools-2.0\shared\cltinit.vrs
94#append U:\Develop\Samba\guitools-2.0\shared\inittempdir.vrs
95#append U:\Develop\Samba\guitools-2.0\shared\nlv.vrs
96#append U:\Develop\Samba\guitools-2.0\shared\rexx_md5.vrs
97#append U:\Develop\Samba\guitools-2.0\shared\smbtree.vrs
98#append U:\Develop\Samba\guitools-2.0\shared\textini.vrs
99*/
100return
101/*:VRX         _AddTemplates
102*/
103_AddTemplates:
104
105    VolTplRH = VRMethod('CN_CURRENT', 'AddRecord', , 'First', 'Volume template', '#10:PMWP.DLL' )
106    MpTplRH = VRMethod('CN_CURRENT', 'AddRecord', VolTplRH, 'First', 'Mountpoint template', '#10:PMWP.DLL'  )
107return
108
109/*:VRX         _BrowseBuildPath
110*/
111_BrowseBuildPath: procedure expose options. sharerh
112    IF options.!debug == 1 THEN SAY time()' _BrowseBuildPath started'
113    rh = arg(1)
114
115    finished = 0
116    BrowsePathStr = ''
117   
118    do while \finished
119        parentrh = VRMethod("CN_smbtree","GetRecordAttr",rh,"Parent")
120        resname = VRMethod("CN_smbtree","GetRecordAttr",rh,"caption")
121        userdata = VRMethod("CN_smbtree","GetRecordAttr",rh,"userdata")
122        parse var userdata udatatype '|' udatamsg
123        parse var resname resname '0D0A'x .
124        resname = strip(resname)
125        /* say "  Not connected - cannot open!" */
126        select
127            when udatatype = "SERVER" then do
128                BrowsePathStr = '\\'resname'\'BrowsePathStr
129                finished = 1
130            end
131            when udatatype = "DISK" then do
132                BrowsePathStr = resname'\'BrowsePathStr
133                sharerh =rh
134                rh = parentrh
135            end
136            otherwise do
137                BrowsePathStr = resname'\'BrowsePathStr
138                rh = parentrh
139            end
140        end
141        /* say '  BrowsePathStr = "'BrowsePathStr'"' */
142    end
143    BrowsePathStr = strip(BrowsePathStr,'T','\')
144    IF options.!debug == 1 THEN SAY time()' _BrowseBuildPath done, returning "'BrowsePathStr'"'
145return BrowsePathStr
146
147/*:VRX         _BrowseDirectory
148*/
149_BrowseDirectory: /* This must not be a procedure */
150    IF options.!debug == 1 THEN SAY time()' _BrowseDirectory started'
151
152    /* Turn off painting */
153    ok = VRSet("CN_SMBTREE","Painting", 0 )
154    call VRSet VRWindow(), 'Pointer', 'Wait'
155
156    /* Make sure credentials are usable */
157    if UserCred   = 'USERCRED'   | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'   
158
159    say '  'samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'"'
160    address cmd samba.!smbclientexe' \\'machine'\'sharename' 'UserCred' --command="dir 'browsepath'" 'debuglevel' 2>NUL 1>'samba.!msg
161
162    if UserCred   = '-N' then UserCred = ''   
163
164    I = 0
165    ok = VRSet("DT_STATUSBAR","Caption", "")
166    do until lines(samba.!msg) = 0
167        infoline = linein(samba.!msg)
168        select
169            when pos('blocks',infoline) > 0 then do /* Last line */
170                /* we should handle size information here */
171                iterate
172            end
173            when I = 0 & length(infoline) > 0 & left(infoline,2) <> "  " then do /* Login message */
174                say '  Login message "'Infoline'"'
175                ok = VRMethod("CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Userdata", SMBObj.udatatype'|'infoline )
176                ok = VRSet("DT_STATUSBAR","Caption", infoline)
177            end
178            when left(infoline,2) = "  " & length(infoline) > 0 then do /* file or DIR */
179                wn       = words(infoline)
180                fyear    = word(infoline,wn)
181                ftime    = word(infoline,wn-1)
182                fday     = word(infoline,wn-2)
183                fmonth   = word(infoline,wn-3)
184                fwday    = word(infoline,wn-4)
185                pos_attr = pos(fwday,infoline)-16
186                fsize    = word(infoline,wn-5)
187                fattr    = substr(infoline,pos_attr,6)
188                fname    = strip( substr(infoline,3,pos_attr-3))
189                if fname = '.' | fname = '..' then iterate /* we do not display these */
190                if pos('H',fattr) > 0  then iterate /* we do not display hidden files */
191                if pos('S',fattr) > 0  then iterate /* we do not display system files */
192                I = I + 1
193                fh.I = VRMethod( "CN_SMBTREE", "AddRecord", SMBObj.rh, , fname)
194                if pos('D',fattr) = 0 then do
195                    Ext = translate(VRParseFIleName(fname,'E'))
196                    select
197                        when Ext = 'EXE' then ficon = '#3:PMWP.DLL' /* executable */
198                        when Ext = 'CMD' then ficon = '#2:PMWP.DLL' /* OS/2 or NT batch */
199                        when Ext = 'BAT' then ficon = '#1:PMWP.DLL' /* DOS batch */
200                        when Ext = 'PDF' then ficon = '#80' /* PDF document */
201                        when wordpos(Ext, 'XLS SXC ODS') > 0         then ficon = '#82' /* spreadsheet */
202                        when wordpos(Ext, 'DOC SXW ODT') > 0         then ficon = '#86' /* text document */
203                        when wordpos(Ext, 'FW2 FW3 FW4') > 0         then ficon = '#87' /* framework */
204                        when wordpos(Ext, 'JPG BMP PNG GIF TIF') > 0 then ficon = '#88' /* image */
205                        when wordpos(Ext, 'AVI MPG FLV WMV') > 0     then ficon = '#89' /* image */
206                        when wordpos(Ext, 'WAV MP3 OGG MID') > 0     then ficon = '#90' /* sound */
207                        when wordpos(Ext, 'WPI') > 0                 then ficon = '#91' /* warpin */
208                        when wordpos(Ext, 'ZIP') > 0                 then ficon = '#92' /* zip */
209                        when wordpos(Ext, 'INF HLP') > 0             then ficon = '#93' /* View */
210                        when wordpos(Ext, 'TXT') > 0                 then ficon = '#94' /* View */
211                        otherwise ficon = '#24:PMWP.DLL' /* default file icon */
212                    end
213                    ftype = 'FILE'
214                end
215                else do
216                    ficon = '#26:PMWP.DLL' /* dir */
217                    ftype = 'DIRECTORY'
218                end
219
220                ok = VRmethod("CN_SMBTREE", "SetRecordAttr", fh.I, "userdata", ftype'|'fsize' Bytes 'fday'-'fmonth'-'fyear' 'ftime,'icon',Ficon)
221           
222            end
223            otherwise nop /* no other line type */
224        end
225    end
226    if I > 0 then ok = VRMethod("CN_SMBTREE","SetRecordAttr",SMBObj.rh, "Icon", "#34:PMWP.DLL") /* open folder */
227    ok = stream(samba.!msg,'c','close')
228    ok = SysFileDelete(samba.!msg)
229
230    ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh,"Collapsed", 0)
231    /* Turn on painting */
232    call VRSet VRWindow(), 'Pointer', '<default>'
233    ok = VRSet("CN_SMBTREE","Painting", 1 )
234    IF options.!debug == 1 THEN SAY time()' _BrowseDirectory done'
235return
236
237/*:VRX         _BrowseObjectOpen
238*/
239_BrowseObjectOpen: procedure expose options. cd.
240    machine    = arg(1)
241    sharename  = arg(2)
242    browsepath = arg(3)
243
244    CALL VRMethod 'CN_CONDET', 'GetRecordList', 'All', 'records.'
245
246    OpenOk = 0
247
248    DO i = 1 TO records.0
249        if VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.StatusFH) = "#64:PMWP.DLL" then do
250            IF options.!debug == 1 THEN SAY '  'VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.StatusFH)' 'VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.MPointFH)' 'VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.ServerFH)' 'VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.ShareFH)
251            if machine = VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.ServerFH) &,
252               sharename = VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.ShareFH) then do
253                Object = strip(VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.MPointFH),'T','\')'\'browsepath
254                IF options.!debug == 1 THEN SAY '  Non UNC object: "'Object'"'
255                ID = VRMethod( "Application", "StartThread", "wps_open", Object, "DEFAULT" )
256                OpenOK = 1
257            end
258        end
259        if OpenOK = 1 then leave
260    end
261return OpenOK
262
263/*:VRX         _BrowseResetObject
264*/
265_BrowseResetObject: procedure
266    ok = VRSet("CN_SMBTREE","Painting", 0 )
267    rh = arg(1)
268
269    /* Remove all files and directories whose parent is our share */
270    ok = VRMethod( "CN_SMBTREE", "GetRecordList", "All", "AllRH." )
271    do I = 1 to AllRH.0
272        AllParentRH  = VRMethod("CN_smbtree","GetRecordAttr",AllRH.I,"Parent")
273        if AllParentRH = rh then ok = VRMethod( "CN_SMBTREE", "RemoveRecord", AllRH.I )
274    end
275    ok = VRSet("CN_SMBTREE","Painting", 1 )
276return
277
278/*:VRX         _ContainersInit
279*/
280_ContainersInit:
281
282    /* Connection details */
283    CD.StatusFH    = VRMethod( "CN_CONDET", "AddField", "Icon", "Status" )
284    CD.mpointFH    = VRMethod( "CN_CONDET", "AddField", "String", "mpoint" )
285    CD.mpidxFH     = VRMethod( "CN_CONDET", "AddField", "String", "index" )
286    CD.workgroupFH = VRMethod( "CN_CONDET", "AddField", "String", "workgroup" )
287    CD.serverFH    = VRMethod( "CN_CONDET", "AddField", "String", "server" )
288    CD.shareFH     = VRMethod( "CN_CONDET", "AddField", "String", "share" )
289    CD.userFH      = VRMethod( "CN_CONDET", "AddField", "String", "user" )
290    CD.passwordFH  = VRMethod( "CN_CONDET", "AddField", "String", "password" )
291    CD.spasswordFH = VRMethod( "CN_CONDET", "AddField", "String", "spassword" )
292    CD.masterFH    = VRMethod( "CN_CONDET", "AddField", "String", "master" )
293    CD.mtypeFH     = VRMethod( "CN_CONDET", "AddField", "String", "mastertype" )
294    CD.memlenFH    = VRMethod( "CN_CONDET", "AddField", "String", "memlen" )
295    CD.easupportFH = VRMethod( "CN_CONDET", "AddField", "String", "easupport" )
296    CD.logfileFH   = VRMethod( "CN_CONDET", "AddField", "String", "logfile" )
297    CD.loglevelFH  = VRMethod( "CN_CONDET", "AddField", "String", "loglevel" )
298    CD.rwFH        = VRMethod( "CN_CONDET", "AddField", "String", "readonly" )
299    CD.hashFH      = VRMethod( "CN_CONDET", "AddField", "String", "hash" )
300
301    /* Connection details */
302    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh ,       "Visible", 0)
303    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh ,    "Visible", 0)
304    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh ,   "Visible", 0)
305    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH ,      "Visible", 0)
306    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH ,       "Visible", 0)
307    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh ,      "Visible", 0)
308    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh ,     "Visible", 0)
309    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh ,    "Visible", 0)
310    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh ,        "Visible", 0)
311
312    ok = VRSet("CN_CONDET", "DetailSort", cd.mpointfh )
313
314    /* NLV columns */
315    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.statusfh ,      "Title", strip(NLVGetMessage(67),"T",":"))
316    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpointfh ,      "Title", strip(NLVGetMessage(27),"T",":"))
317    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.workgroupfh ,   "Title", strip(NLVGetMessage(21),"T",":"))
318    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.serverFH ,      "Title", strip(NLVGetMessage(19),"T",":"))
319    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.shareFH ,       "Title", strip(NLVGetMessage(20),"T",":"))
320    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.userfh ,        "Title", strip(NLVGetMessage(25),"T",":"))
321    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.easupportfh ,   "Title", strip(NLVGetMessage(68),"T",":"))
322    ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.rwfh ,          "Title", strip(NLVGetMessage(69),"T",":"))
323return
324/*:VRX         _CreateSmbConf
325*/
326_CreateSmbConf:
327    IF options.!debug == 1 THEN SAY time()' '||"_CreateSmbConf started"
328    call lineout samba.!smbconf, '# Samba config file created using EVFSGUI ver. 'word(VRGet("Main","Hinttext"),2)
329    call lineout samba.!smbconf, '# from 'value("USER",,'OS2ENVIRONMENT')'@'value("HOSTNAME",,'OS2ENVIRONMENT')
330    call lineout samba.!smbconf, '# Date: 'date()' 'time()
331    call lineout samba.!smbconf, '[global]'
332    if settings.!network <> '' then do
333        call lineout samba.!smbconf, '09'x||'workgroup = 'settings.!network
334    end
335    else do
336        call lineout samba.!smbconf, '09'x||'workgroup = WORKGROUP'
337    end
338    call lineout samba.!smbconf, '09'x||'log level = 0'
339    ok = stream(samba.!smbconf,'c','close')
340    IF options.!debug == 1 THEN SAY time()' '||"_CreateSmbConf done"
341return
342
343/*:VRX         _DialogPopulate
344*/
345_DialogPopulate:
346
347    ok = VRMethod( "CN_smbtree", "GetRecordList", "Visible", "rh." )
348
349    ok = VRMethod("EF_SHARE",   "Reset")
350    ok = VRMethod("EF_SERVER",  "Reset")
351    ok = VRMethod("EF_NETWORK", "Reset")
352
353    do I = 1 to rh.0
354
355        Userdata = VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Userdata")
356        ResName  = VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Caption")
357
358        parse var ResName  ResName '0D0A'x .
359        ResName = strip(ResName)
360        parse var userdata ResType  '|' .
361
362        select
363            when ResType = "WORKGROUP" then ok = VRMethod("EF_NETWORK","AddString", ResName)
364            when ResType = "SERVER"    then ok = VRMethod("EF_SERVER", "AddString", ResName)
365            when ResType = "DISK"      then ok = VRMethod("EF_SHARE",  "AddString", ResName)
366            otherwise nop
367        end
368    end
369
370return
371
372/*:VRX         _dropdeprecated
373*/
374_dropdeprecated:
375    drop rh     
376    drop parentrh     
377    drop icon     
378    drop resname   
379    drop udatatype
380    drop udatamsg 
381return
382
383/*:VRX         _GetSMBObjectProperties
384*/
385_GetSMBObjectProperties: procedure expose options. SMBObj. rh icon resname udatatype udatamsg parentrh
386    IF options.!debug == 1 THEN SAY time()' _GetSMBObjectProperties started'
387
388    /* Purpose of this subroutine:
389       The current SMB object's frequently used properties should be stored in a stem
390       SMBObj.rh        = recordhandle of the object
391       SMBObj.resname   = resourcename of the object
392       SMBObj.icon      = icon of the object
393       SMBObj.udatatype = type of object (WORKGROUP, SERVER, DISK, PRINTER, FILE, DIRECTORY)
394       SMBObj.udatamsg  = arbitrary object related data (Login message, file properties)
395       SMBObj.parentrh  = recordhandle of the object's parent
396
397       The stem-less counterparts of these variables are considered deprecated and should be removed wherever possible
398       This routine will drop any value in order to make sure the stem actually works
399     */
400    call _dropdeprecated
401
402    SMBObj. = ""
403    SMBObj.rh = arg(1)
404
405    if VRMethod( 'CN_SMBTREE', "ValidateRecord", SMBObj.rh) <> 1 | SMBObj.rh = "" then do
406        SMBObj. = ""
407        IF options.!debug == 1 THEN SAY time()' _GetSMBObjectProperties aborted'
408        return
409    end
410
411    SMBObj.Icon = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Icon")
412
413    SMBObj.parentrh = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.rh, "Parent")
414
415    SMBObj.resname  = VRMethod("CN_smbtree", "GetRecordAttr", SMBObj.rh, "Caption")
416    parse var SMBObj.resname SMBObj.resname '0D0A'x .
417    SMBObj.resname = strip(SMBObj.resname)
418
419    Userdata = VRMethod("CN_smbtree", "GetRecordAttr", SMBObj.rh, "Userdata")
420    parse var userdata SMBObj.udatatype '|' SMBObj.udatamsg
421    SMBObj.udatatype = strip(SMBObj.udatatype)
422    SMBObj.udatamsg  = strip(SMBObj.udatamsg)
423
424    IF options.!debug == 1 THEN do
425        SAY '  Handle:   "'SMBObj.rh'"'
426        SAY '  Resource: "'SMBObj.resname'"'
427        SAY '  Type:     "'SMBObj.udatatype'"'
428        SAY '  Message:  "'SMBObj.udatamsg'"'
429        SAY '  Icon:     "'SMBObj.icon'"'
430    end
431
432    IF options.!debug == 1 THEN SAY time()' _GetSMBObjectProperties done'
433return
434
435/*:VRX         _GUIInit
436*/
437_GUIInit:
438    CALL VRSet 'Main', 'HelpFile', settings.!helpfile
439
440    CALL NLVSetText 'Main',        'Caption', 1
441    CALL NLVSetText 'DT_CURRENT',  'Caption', 10
442    CALL NLVSetText 'PB_DETACH',   'Caption', 11
443    CALL NLVSetText 'PB_UNMOUNT',  'Caption', 12
444    CALL NLVSetText 'DT_DIALOG',   'Caption', 13
445    CALL NLVSetText 'DT_MOUNT',    'Caption', 14
446
447    CALL NLVSetText 'DT_SERVER',   'Caption', 19
448    CALL NLVSetText 'DT_SHARE',    'Caption', 20
449    CALL NLVSetText 'CHK_MTYPE',   'Caption', 23
450    CALL NLVSetText 'PB_ADVANCED', 'Caption', 24
451    CALL NLVSetText 'DT_USER',     'Caption', 25
452    CALL NLVSetText 'DT_PASSWORD', 'Caption', 26
453    CALL NLVSetText 'DT_MPOINT',   'Caption', 27
454    CALL NLVSetText 'PB_MOUNT',    'Caption', 28
455    CALL NLVSetText 'PB_EDITCANCEL','Caption', 3
456
457    CALL NLVSetText 'PB_AUTOSTART','Caption', 35
458    CALL NLVSetText 'PB_CLOSE',    'Caption', 29
459    CALL NLVSetText 'PB_SAVE',     'Caption', 30
460    CALL NLVSetText 'PB_LOAD',     'Caption', 31
461    CALL NLVSetText 'PB_HELP',     'Caption', 4
462
463    CALL NLVSetText 'MENU_CONTEXT_DETACH',        'Caption', 11
464    CALL NLVSetText 'MENU_CONTEXT_DETACH_ALL',    'Caption', 120
465    CALL NLVSetText 'MENU_CONTEXT_REFRESH',       'Caption', 38
466    CALL NLVSetText 'MENU_CONTEXT_UNMOUNT',       'Caption', 12
467    CALL NLVSetText 'MENU_CONTEXT_EDIT',          'Caption', 32
468    CALL NLVSetText 'MENU_CONTEXT_OPEN',          'Caption', 94
469    CALL NLVSetText 'MENU_CONTEXT_OPEN_ICON',     'Caption', 95
470    CALL NLVSetText 'MENU_CONTEXT_OPEN_TREE',     'Caption', 96
471    CALL NLVSetText 'MENU_CONTEXT_OPEN_DETAIL',   'Caption', 97
472    CALL NLVSetText 'MENU_CONTEXT_OPEN_SETTINGS', 'Caption', 98
473    CALL NLVSetText 'MENU_CONTEXT_OPEN_SPLITVIEW','Caption', 99
474
475    CALL NLVSetText 'Menu_File',                  'Caption', 80
476    CALL NLVSetText 'Menu_Context',               'Caption', 81
477    CALL NLVSetText 'Menu_View',                  'Caption', 82
478    CALL NLVSetText 'Menu_Selected',              'Caption', 83
479    CALL NLVSetText 'Menu_Help',                  'Caption', 84
480
481    CALL NLVSetText 'Menu_View_Dialog',   'Caption', 85
482    CALL NLVSetText 'Menu_View_SmbTree',  'Caption', 86
483    CALL NLVSetText 'Menu_View_Buttons',  'Caption', 87
484    CALL NLVSetText 'Menu_View_ConDet',   'Caption', 88
485    CALL NLVSetText 'Menu_View_MiniIcons','Caption', 70
486
487    CALL NLVSetText 'Menu_File_Autostart',           'Caption', 35
488    CALL NLVSetText 'Menu_File_Autostart_Activate',  'Caption', 76
489    CALL NLVSetText 'Menu_File_Autostart_Deactivate','Caption', 77
490    CALL NLVSetText 'Menu_File_CLOSE',               'Caption', 29
491    CALL NLVSetText 'Menu_File_SAVE',                'Caption', 30
492    CALL NLVSetText 'Menu_File_LOAD',                'Caption', 31
493    CALL NLVSetText 'Menu_File_SETTINGS',            'Caption', 47
494    CALL NLVSetText 'Menu_File_ADVANCED',            'Caption', 40
495
496    CALL NLVSetText 'Menu_Selected_Connect', 'Caption', 28
497    CALL NLVSetText 'Menu_Selected_Remove',  'Caption', 12
498    CALL NLVSetText 'Menu_Selected_Retry',   'Caption', 90
499    CALL NLVSetText 'Menu_Selected_Info',    'Caption', 92
500    CALL NLVSetText 'Menu_Selected_Default_Workgroup','Caption',75
501
502    CALL NLVSetText 'Menu_Help_Extended', 'Caption', 4
503    CALL NLVSetText 'Menu_Help_About', 'Caption', 91
504
505    CALL NLVSetText 'DT_SMBTREE',          'Caption', 39
506    CALL NLVSetText 'PB_CONNECT',          'Caption', 28
507    CALL NLVSetText 'PB_REFRESH',          'Caption', 38
508
509    CALL NLVSetText 'DT_CONDET',          'Caption', 63
510    CALL NLVSetText 'PB_CONDET_SAVE',     'Caption', 30
511    CALL NLVSetText 'PB_CONDET_LOAD',     'Caption', 31
512
513
514    mtype.0 = 4
515    mtype.1 = NLVGetMessage( 15 )
516    mtype.2 = NLVGetMessage( 16 )
517    mtype.3 = NLVGetMessage( 17 )
518    mtype.4 = NLVGetMessage( 18 )
519    IF (mtype.1 \= '' & mtype.2 \= '' & mtype.3 \= '' & mtype.4 \= '') THEN DO
520        CALL VRMethod CB_MOUNT, 'Clear'
521        CALL VRMethod CB_MOUNT, 'AddStringList', 'mtype.'
522    END
523
524    ok = VRSet("Main","Width", 8200)
525    ok = VRseT("Pict_Throbber","Width",  VRMethod( "Screen", "PixelsToTwips", 32 ))
526    ok = VRseT("Pict_Throbber","Height", VRMethod( "Screen", "PixelsToTwips", 32 ))
527
528    /* Setup SmbTree View */
529    ok = VRset("GB_SMBTREE","Painting", 0)
530
531    /* Common margin around controls */
532    margin = ((VRGet("Main", "InteriorLeft") / 3) * 2) + 2
533
534    ok = VRSet("DT_STATUSBAR", "Caption", VRGet("Main", "HintText"))
535    call Main_Resize
536return
537
538/*:VRX         _PassiveLoad
539*/
540_PassiveLoad:
541    IF options.!debug == 1 THEN SAY time()' '||"_PassiveLoad started"
542
543    do cnt = 1 to 255
544        resdata = VRGetIni( "PassiveConnections", cnt, settings.!ini )
545        if resdata = "" then leave
546
547        PARSE Var resdata p_mpoint resource rwFlag
548        IF options.!debug == 1 THEN do
549            say "  resdata  ="resdata
550            say "  p_mpoint ="p_mpoint
551            say "  resource ="resource
552            say "  rwFlag   ="rwFlag
553        end
554
555/*      vfs.!drive      = FILESPEC('DRIVE', node )
556        vfs.!mountpoint = STRIP( node, 'T', '\') */
557
558        /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
559        if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
560
561        p_mpidx = ""
562
563        PARSE VAR resource . 'WORKGROUP=' p_workgroup ';' .
564        PARSE VAR resource . 'SERVER=' p_server ';' .
565        PARSE VAR resource . 'SHARE=' p_share ';' .
566        PARSE VAR resource . 'USER=' p_user ';' .
567        PARSE VAR resource . 'PASSWORD=' p_password ';' .
568        PARSE VAR resource . 'SPASSWORD=' p_spassword ';' .
569        PARSE VAR resource . 'MASTER=' p_master ';' .
570        PARSE VAR resource . 'MASTERTYPE=' p_mtype ';' .
571/*      PARSE VAR resource . 'MEMLEN=' p_memlen ';' .
572        PARSE VAR resource . 'LOGFILE=' p_logfile ';'.
573        PARSE VAR resource . 'LOGLEVEL=' p_loglevel ';' . */
574        PARSE VAR resource . 'EASUPPORT=' p_easupport .
575
576        p_rw = rwFlag
577
578        cd.lastrh = VRMethod("CN_CONDET","AddRecord")
579        IF options.!debug == 1 THEN say "  cd.lastrh = "cd.lastrh
580
581        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint, cd.mpidxfh, p_mpidx)
582        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.workgroupfh, p_workgroup, cd.serverfh, p_server, cd.sharefh, p_share)
583        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.userfh, p_user, cd.passwordfh, p_password, cd.spasswordfh, p_spassword)
584        ok = VRMethod("CN_CONDET", "SetFieldData", cd.masterfh, p_master, cd.mtypefh, p_mtype, cd.lastrh, cd.easupportfh, p_easupport, cd.rwfh, p_rw)
585/*      ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen, cd.logfilefh, p_logfile, cd.loglevelfh, p_loglevel ) */
586        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, '#68:PMWP.DLL') /* Passive */
587        ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", '#68:PMWP.DLL') /* Active */
588
589        hashstr = p_mpoint' 'translate(p_domain)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
590
591        md5 = rexx_md5(hashstr)
592
593        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
594
595    end
596    IF options.!debug == 1 THEN SAY time()' '||"_PassiveLoad done"
597return
598/*:VRX         _PassiveSave
599*/
600_PassiveSave:
601    IF options.!debug == 1 THEN SAY time()' '||"_PassiveSave started"
602    ok = VRDelIni( "PassiveConnections", "ALL", settings.!ini )
603
604    ok = SysIni(settings.!ini, 'PassiveConnections', 'DELETE:')
605
606    CALL VRMethod 'CN_CONDET', 'GetRecordList', 'All', 'records.'
607    cnt = 0
608    DO i = 1 TO records.0
609
610        if VRMethod( 'CN_CONDET', "GetFieldData", records.i, CD.StatusFH) = '#68:PMWP.DLL' then do
611            cnt = cnt + 1
612            resdata = ""
613            resdata = resdata||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
614            resdata = resdata||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
615            resdata = resdata||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
616            resdata = resdata||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
617            resdata = resdata||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
618            resdata = resdata||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
619            resdata = resdata||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
620            resdata = resdata||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
621            resdata = resdata||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
622            resdata = resdata||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
623            resdata = resdata||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
624            resdata = resdata||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
625            resdata = resdata||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
626/*          resdata = resdata||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
627            resdata = resdata||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
628            resdata = resdata||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
629            resdata = resdata||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
630            resdata = resdata||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
631            ok = VRSetIni( "PassiveConnections", cnt, resdata, settings.!ini )
632        END
633        else iterate
634    end
635    IF options.!debug == 1 THEN SAY time()' '||"_PassiveSave done"
636return
637
638/*:VRX         _PrinterInfo
639*/
640_PrinterInfo:
641    /* rh = currently selected record handle */
642    capt = VRMethod("CN_SMBTREE", "GetRecordAttr", rh, "Caption")
643    parse var Capt p_printer '0D0A'x .
644    parRH = VRMethod("CN_SMBTREE", "GetRecordAttr", rh, "Parent")
645    capt = VRMethod("CN_SMBTREE", "GetRecordAttr", Parrh, "Caption")
646    parse var Capt p_prtsrv '0D0A'x .
647    p_prtsrv = strip(p_prtsrv)
648    GparRH = VRMethod("CN_SMBTREE", "GetRecordAttr", Parrh, "Parent")
649    capt = VRMethod("CN_SMBTREE", "GetRecordAttr", GParrh, "Caption")
650    parse var Capt p_workgroup '0D0A'x .
651    DescStr = translate(p_prtsrv'#'p_printer'#'p_workgroup'#')
652say '"'DescStr'"'
653    LDescStr = length(DescStr)
654    ok = SysIni('SYSTEM','PM_SPOOLER_PORT',"All:",'ports')
655
656    FoundPort = 0
657    do I = 1 to ports.0
658        if left(ports.i,3) = 'SMB' then do
659            say ports.I
660            say translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr))
661            say DescStr
662            if translate(left(SysIni('SYSTEM','PM_'ports.I,'INITIALIZATION'),LDescStr)) = DescStr then do
663                OurPort = ports.I
664                FoundPort = 1
665                leave
666            end
667        end
668    end
669
670    if Foundport then do
671        ok = SysIni('SYSTEM','PM_SPOOLER_PRINTER',"All:",'printer')
672
673        do I = 1 to printer.0
674            say printer.I
675            prtsummary = SysINi('SYSTEM','PM_SPOOLER_PRINTER',printer.i)
676            parse var prtsummary port ';'PrinterDriver';'PrinterQueue';' .
677            if port = ourPort then do
678                PrinterName = SysINi('SYSTEM','PM_SPOOLER_PRINTER_DESCR',printer.i)
679                parse var Printername Printername ';' .
680                leave
681            end
682
683        end
684        CALL VRMessage 'Main', PrinterName' ('PrinterQueue') prints to port ' Port' connected to \\'p_workgroup'\'p_prtsrv'\'p_printer, NLVGetMessage( 1 ), 'I'
685    end
686    else do
687        CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
688    end
689return
690
691/*:VRX         _ShowMsg
692*/
693_ShowMsg:
694    /* preliminary implementation - we just do not ignore it anymore -
695       - ShowMsg from smbmon/smbusers shoule become a shared library */
696    ok = VRSet("DT_StatusBar", "Caption", Msg.Text)
697return
698
699/*:VRX         _UserCredUpdate
700*/
701_UserCredUpdate:
702    credentials.!username = VRGet("EF_USER","Value")
703    credentials.!password = VRGet("EF_PASSWORD","Value")
704
705    if pos("4OS2", value("COMSPEC",,"OS2ENVIRONMENT")) = 0
706        then UserCred = '--user='Credentials.!username'%'Credentials.!password
707        else UserCred = '--user='Credentials.!username'%%'Credentials.!password
708return
709
710/*:VRX         CB_DEBUG_Click
711*/
712CB_DEBUG_Click:
713
714return
715
716/*:VRX         CB_LOGGING_Click
717*/
718CB_LOGGING_Click:
719    if VRFileExists(SysBootDrive()'\ndpsmb.dbg') then
720        ok = SysFileDelete(SysBootDrive()'\ndpsmb.dbg')
721    else do
722        call lineout SysBootDrive()'\ndpsmb.dbg','EVFS debug flag file'
723        ok = stream(SysBootDrive()'\ndpsmb.dbg','c','close')
724    end
725
726    CALL VRSet 'CB_LOGGING', 'Set', VRFileExists(SysBootDrive()'\ndpsmb.dbg')
727return
728
729/*:VRX         CB_MOUNT_Change
730*/
731CB_MOUNT_Change:
732    IF options.!debug == 1 THEN SAY time()' '||"CB_MOUNT_Change started"
733
734    mount = VRGet("CB_MOUNT", "Selected")
735
736    SELECT
737        WHEN mount == 1 THEN DO
738            CALL VRSet "DT_SHARE",   "Visible", 1
739            CALL VRSet "EF_SHARE",   "Visible", 1
740            CALL VRSet "DT_SERVER",  "Visible", 1
741            CALL VRSet "EF_SERVER",  "Visible", 1
742            CALL VRSet "CHK_MTYPE",  "Visible", 0
743            CALL NLVSetText "DT_NETWORK", "Caption", 21
744            /* Does not make sense anymore
745            if options.!editmode = 0 Then CALL VRSet "EF_NETWORK",  "Value", settings.!network
746             */
747        END
748        WHEN mount == 2 THEN DO
749            CALL VRSet "DT_SHARE",   "Visible", 0
750            CALL VRSet "EF_SHARE",   "Visible", 0
751            CALL VRSet "DT_SERVER",  "Visible", 1
752            CALL VRSet "EF_SERVER",  "Visible", 1
753            CALL VRSet "CHK_MTYPE",  "Visible", 0
754            CALL NLVSetText "DT_NETWORK", "Caption", 21
755            /* Does not make sense anymore
756            CALL VRSet "EF_NETWORK",  "Value", settings.!network
757             */
758        END
759        WHEN mount == 3 THEN DO
760            CALL VRSet "DT_SHARE",   "Visible", 0
761            CALL VRSet "EF_SHARE",   "Visible", 0
762            CALL VRSet "DT_SERVER",  "Visible", 0
763            CALL VRSet "EF_SERVER",  "Visible", 0
764            CALL VRSet "CHK_MTYPE",  "Visible", 0
765            CALL NLVSetText "DT_NETWORK", "Caption", 21
766            /* Does not make sense anymore
767            CALL VRSet "EF_NETWORK",  "Value", settings.!network
768             */
769        END
770        WHEN mount == 4 THEN DO
771            CALL VRSet "DT_SHARE",   "Visible", 0
772            CALL VRSet "EF_SHARE",   "Visible", 0
773            CALL VRSet "DT_SERVER",  "Visible", 0
774            CALL VRSet "EF_SERVER",  "Visible", 0
775            CALL VRSet "CHK_MTYPE",  "Visible", 1
776            CALL NLVSetText "DT_NETWORK", "Caption", 22
777            /* Does not make sense anymore
778            CALL VRSet "EF_NETWORK",  "Value", ""
779             */
780        END
781    END
782    IF options.!debug == 1 THEN SAY time()' '||"CB_MOUNT_Change done"
783
784RETURN
785
786/*:VRX         CN_CONDET_Click
787*/
788CN_CONDET_Click:
789    ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText"))
790return
791
792/*:VRX         CN_CONDET_ContextMenu
793*/
794CN_CONDET_ContextMenu:
795    rh = VRInfo('Record')
796    if VRMethod( 'CN_CONDET', "ValidateRecord", rh) <> 1 then return
797
798    /* This is the place to enable specific context menu entries */
799    ok = VRMethod( "CN_CONDET", "GetRecordList", "All", "records." )
800    ok = VRSet("Menu_Selected_Remove", "Visible",  (records.0 <> 0))
801    ok = VRSet("Menu_Selected_Retry",  "Visible",  (records.0 <> 0))
802
803    if VRMethod( 'CN_CONDET', "GetFieldData", rh, CD.StatusFH) = '#68:PMWP.DLL' then do
804        ok = VRSet("Menu_Selected_Retry",  "Enabled",1)
805        ok = VRSet("Menu_Selected_Remove", "Enabled",1)
806    end
807    ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
808return
809/*:VRX         CN_CONDET_DragStart
810*/
811CN_CONDET_DragStart:
812
813    obj = VRInfo( "object" )
814    ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
815    if selrec.0 = 0 then return
816
817    Icon = VRMethod("CN_CONDET", "GetRecordAttr", selrec.1, "Icon")
818
819    if Icon = "#65:PMWP.DLL" then do /* Printers not supported at the moment */
820        CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
821    end
822    else call VRMethod obj, 'StartDrag'
823return
824
825/*:VRX         CN_CURRENT_Click
826*/
827CN_CURRENT_Click:
828    IF options.!debug == 1 THEN SAY time()' CN_CURRENT_Click started'
829    ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText"))
830
831    /* Herwig B. */
832    CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
833
834    rh = VRInfo('Record')
835    if VRMethod( 'CN_CURRENT', "ValidateRecord", rh) <> 1 then return
836
837    data = VRMethod('CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
838    options.currentdata = data
839
840    ok = VRset("DT_StatusBar","Caption", data' - 'VRGet("Main", "HintText"))
841
842    PARSE VAR data p_node ';' p_mounts ';' p_string
843
844    IF options.!debug == 1 THEN do
845        SAY '  data     = "'data'"'
846        SAY '  p_node   = "'p_node'"'
847        SAY '  p_mounts = "'p_mounts'"'
848        SAY '  p_string = "'p_string'"'
849    end
850/*
851    infotext = p_node
852    DO i = 1 TO p_mounts
853        infotext = infotext ' ['p_string']'
854    END
855*/
856    if p_string = "" then
857        infotext = fs.!name' 'fs.!version
858    else
859        infotext = p_string
860
861/* Herwig B.
862    CALL VRSet 'Main', 'StatusText', infotext */
863    if infotext = "" then infotext = " "
864    CALL VRSet 'CN_CURRENT', 'Caption', infotext
865    CALL VRSet 'CN_CURRENT', 'HintText',infotext
866/* Herwig B. */
867
868    IF p_mounts > 0 THEN DO
869        CALL VRSet 'PB_UNMOUNT',               'Enabled', 1
870        CALL VRSet 'MENU_CONTEXT_UNMOUNT',     'Visible', 1
871       
872        if pos("*",p_string) > 0 | pos(";",p_string) > 0 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
873                                 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
874    END
875    ELSE DO
876        CALL VRSet 'PB_UNMOUNT',               'Enabled', 0
877        CALL VRSet 'MENU_CONTEXT_UNMOUNT',     'Visible', 0
878        CALL VRSet 'MENU_CONTEXT_EDIT',        'Visible', 0
879    END
880
881    parent = VRMethod('CN_CURRENT', 'GetRecordAttr', rh, 'Parent')
882
883    IF parent == '' THEN DO
884        CALL VRSet 'PB_DETACH',               'Enabled', 1
885        CALL VRSet 'MENU_CONTEXT_DETACH',     'Visible', 1
886        CALL VRSet 'MENU_CONTEXT_OPEN',       'Visible', 1
887        CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 1
888        CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
889        CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 1
890       
891    END
892    ELSE DO
893        CALL VRSet 'PB_DETACH',               'Enabled', 0
894        CALL VRSet 'MENU_CONTEXT_DETACH',     'Visible', 0
895        CALL VRSet 'MENU_CONTEXT_OPEN',       'Visible', 0
896        CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 0
897        CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
898        CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 0
899       
900    END
901    parse var p_string p_domain':\\'p_server'\'p_share
902
903    ok = VRSet("EF_Server","Value", p_server)
904
905    IF options.!debug == 1 THEN SAY time()' CN_CURRENT_Click done'
906RETURN
907
908/*:VRX         CN_CURRENT_ContextMenu
909*/
910CN_CURRENT_ContextMenu: /* PROCEDURE EXPOSE existrec. options. fs. */
911    IF options.!debug == 1 THEN SAY time()' '||"CN_CURRENT_ContextMenu started"
912
913    CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
914
915    rh = VRInfo('Record')
916
917    /* we have to check whether the record still exists because under certain
918       circumstances the event routine is executed after the record was already
919       removed */
920    if VRMethod( 'CN_CURRENT', "ValidateRecord", rh) <> 1 then do
921        IF options.!debug == 1 THEN SAY time()' '||"CN_CURRENT_ContextMenu aborted"
922        return
923    end
924
925    data = VRMethod('CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
926    PARSE VAR data p_node ';' p_mounts ';' p_string
927
928    IF options.!debug == 1 THEN do
929        SAY '  data =     "'data'"'
930        SAY '  p_node =   "'p_node'"'
931        SAY '  p_mounts = "'p_mounts'"'
932        SAY '  p_string = "'p_string'"'
933    end
934/*
935    infotext = p_node
936    DO i = 1 TO p_mounts
937        infotext = infotext ' ['p_string']'
938    END
939*/
940    if p_string = "" then
941        infotext = fs.!name' 'fs.!version
942    else
943        infotext = p_string
944
945/* Herwig B.
946    CALL VRSet 'Main', 'StatusText', infotext */
947    if infotext = "" then infotext = " "
948    CALL VRSet 'CN_CURRENT', 'Caption', infotext
949    CALL VRSet 'CN_CURRENT', 'HintText',infotext
950/* Herwig B. */
951
952    CALL VRSet 'MENU_CONTEXT_OPEN', 'Visible', 1
953    CALL VRSet 'MENU_CONTEXT_SEP1', 'Visible', 1
954    CALL VRSet 'MENU_CONTEXT_SEP2', 'Visible', 1
955    CALL VRSet 'MENU_CONTEXT_SEP3', 'Visible', 1
956    CALL VRSet 'Menu_Context_Open_Default', "Visible", 1
957
958    IF p_mounts > 0 THEN DO
959        CALL VRSet 'PB_UNMOUNT',               'Enabled', 1
960        CALL VRSet 'MENU_CONTEXT_UNMOUNT',     'Visible', 1
961       
962        if pos("*",p_string) > 0 | pos(";",p_string) > 0 then CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 0
963                                 else CALL VRSet 'MENU_CONTEXT_EDIT', 'Visible', 1
964    END
965    ELSE DO
966        CALL VRSet 'PB_UNMOUNT',               'Enabled', 0
967        CALL VRSet 'MENU_CONTEXT_UNMOUNT',     'Visible', 0
968        CALL VRSet 'MENU_CONTEXT_EDIT',        'Visible', 0
969    END
970
971    parent = VRMethod('CN_CURRENT', 'GetRecordAttr', rh, 'Parent')
972
973    IF parent == '' THEN DO
974        CALL VRSet 'PB_DETACH',               'Enabled', 1
975        CALL VRSet 'MENU_CONTEXT_DETACH',     'Visible', 1
976        CALL VRSet 'MENU_CONTEXT_OPEN',       'Visible', 1
977        CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 1
978        CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 1
979        CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 1
980        CALL VRSet 'MENU_CONTEXT_SEP3',       'Visible', 1
981    END
982    ELSE DO
983        CALL VRSet 'PB_DETACH',               'Enabled', 0
984        CALL VRSet 'MENU_CONTEXT_DETACH',     'Visible', 0
985        CALL VRSet 'MENU_CONTEXT_OPEN',       'Visible', 0
986        CALL VRSet 'MENU_CONTEXT_SEP1',       'Visible', 0
987        CALL VRSet 'MENU_CONTEXT_DETACH_ALL', 'Visible', 0
988        CALL VRSet 'MENU_CONTEXT_SEP2',       'Visible', 0
989        CALL VRSet 'MENU_CONTEXT_SEP3',       'Visible', 0
990    END
991
992    ok = VRMethod( "Menu_Context", "Popup", , , "", "" )
993    IF options.!debug == 1 THEN SAY time()' '||"CN_CURRENT_ContextMenu done"
994return
995
996/*:VRX         CN_CURRENT_DoubleClick
997*/
998CN_CURRENT_DoubleClick:
999    IF options.!debug == 1 THEN SAY time()' '||"CN_CURRENT_DoubleClick started"
1000
1001    CALL VRSet "TM_AUTOCLOSE", "ENABLED", 0
1002
1003    rh = VRInfo('Record')
1004
1005    /* we have to check whether the record still exists because under certain
1006       circumstances the event routine is executed after the record was already
1007       removed */
1008    if VRMethod( 'CN_CURRENT', "ValidateRecord", rh) <> 1 then do
1009        IF options.!debug == 1 THEN SAY time()' '||"CN_CURRENT_DoubleClick aborted"
1010        return
1011    end
1012
1013    data = VRMethod('CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
1014    PARSE VAR data p_node ';' p_mounts ';' p_string
1015
1016    IF options.!debug == 1 THEN do
1017        SAY '  data =     "'data'"'
1018        SAY '  p_node =   "'p_node'"'
1019        SAY '  p_mounts = "'p_mounts'"'
1020        SAY '  p_string = "'p_string'"'
1021    end
1022    call Menu_Context_Open_Default_Click
1023
1024    IF options.!debug == 1 THEN SAY time()' '||"CN_CURRENT_DoubleClick done"
1025return
1026
1027/*:VRX         CN_CURRENT_DragDrop
1028*/
1029CN_CURRENT_DragDrop:
1030    IF options.!debug == 1 THEN SAY time()' CN_CURRENT_DragDrop started'
1031    ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
1032    IF options.!debug == 1 THEN say "  settings.!network = "settings.!network
1033
1034    p_workgroup = ''
1035    p_server    = ''
1036    p_share     = ''
1037
1038    srcFile = VRInfo( "SourceFile" )
1039    srcCtn  = VRInfo( "SourceObject" )
1040    srcRec  = VRInfo( "SourceRecord" )
1041    trgCtn  = VRInfo( "TargetObject" )
1042    trgRec  = VRInfo( "TargetRecord" )
1043
1044    IF options.!debug == 1 THEN do
1045        say '  srcFile     = "'srcFile'"'
1046        say '  srcCtn      = "'srcCtn'"'
1047        if srcCtn <> "" then say '  srcCtn name = "'VRGet(srcCtn,'Name')'"'
1048        say '  srcRec      = "'srcRec'"'
1049        say '  trgCtn      = "'trgCtn'"'
1050        if trgCtn <> "" then say '  trgCtn name = "'VRGet(trgCtn,'Name')'"'
1051        say '  trgRec      = "'trgRec'"'
1052    end
1053
1054    if srcFile <> "" then do /* A file was dropped onto the container - attempt to load it */
1055        IF options.!debug == 1 THEN say '  Possible profile dropped: "'srcFile'"'
1056
1057        /* was it really a profile ? */
1058        if translate(VRParseFileName(srcFile,'E')) = translate(fs.!profileext) then do /* Yes - load it! */
1059            options.!autoload = 1
1060            Profile = srcFile
1061            call PB_LOAD_Click
1062        end
1063        else do /* No - barf! */
1064            buttons.0 = 1
1065            buttons.1 = NLVGetMessage(9)
1066            ok = VRMessage('Main', NLVGetMessage(103,srcFile ), NLVGetMessage(5), 'E','buttons.')
1067        end
1068        IF options.!debug == 1 THEN SAY time()' CN_CURRENT_DragDrop done (load profile)'
1069        return
1070    end
1071
1072    ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
1073
1074    if VRGet(srcCtn,'Name') = "CN_CONDET" then do
1075        p_mpoint    = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.MpointFH)
1076
1077        p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.WorkgroupFH)
1078        p_server    = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ServerFH)
1079        p_share     = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.ShareFH)
1080        p_user      = VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.UserFH)
1081        p_password  = x2c(VRMethod("CN_CONDET", "GetFieldData", srcRec, CD.SpasswordFH))
1082
1083        ShareLevel = 1
1084        if p_share     = "" then ShareLevel = 2
1085        if p_server    = "" then ShareLevel = 3
1086        if p_workgroup = "" then ShareLevel = 4
1087
1088        ok = VRSet("CB_MOUNT",  "Selected", Sharelevel )
1089        ok = VRset("CB_MOUNT",  "Value",    mtype.sharelevel)
1090
1091        ok = VRset("EF_SERVER",   "Value", p_server)
1092        ok = VRset("EF_SHARE",    "Value", p_share)
1093        ok = VRset("EF_NETWORK",  "Value", p_workgroup)
1094        ok = VRset("EF_USER",     "Value", p_user)
1095        ok = VRset("EF_PASSWORD", "Value", p_password)
1096
1097        parse var p_mpoint p_drv '\' p_dir
1098
1099        p_dir = strip(p_dir,'T','\')
1100
1101        ok = VRset("CB_DRIVES",    "Value", p_drv)
1102        ok = VRset("EF_DIRECTORY", "Value", p_dir)
1103    end
1104    else do /* SmbTree */
1105        DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
1106        ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
1107
1108        if ParentRH = "" then do /* A workgroup was dragged */
1109            say "Workgroup dragged!"
1110            parse var DragCapt p_workgroup '0D0A'x .
1111            p_workgroup = strip(p_workgroup)
1112            ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
1113            ok = VRSet("EF_SERVER","Value","")
1114            ok = VRSet("EF_SHARE","Value","")
1115
1116            ShareLevel = 3
1117        end
1118        else do
1119            ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
1120            GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
1121
1122            if GParentRH = "" then do /* A server was dragged */
1123                say "Server dragged!"
1124                parse var ParDragCapt p_workgroup '0D0A'x .
1125                ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
1126                p_workgroup = strip(p_workgroup)
1127
1128                parse var DragCapt p_server '0D0A'x .
1129                p_server = strip(p_server)
1130                ok = VRSet("EF_SERVER","Value",strip(p_server))
1131                ok = VRSet("EF_Share","Value","")
1132
1133                ShareLevel = 2
1134            end
1135            else do /* A share was dragged */
1136                say "Share dragged!"
1137                GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
1138
1139                parse var GParDragCapt p_workgroup '0D0A'x .
1140                p_workgroup = strip(p_workgroup)
1141                ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
1142
1143                parse var ParDragCapt p_server '0D0A'x .
1144                p_server = strip(p_server)
1145                ok = VRSet("EF_SERVER","Value",strip(p_server))
1146
1147                parse var DragCapt p_share '0D0A'x .
1148                p_share = strip(p_share)
1149                ok = VRSet("EF_Share","Value",strip(p_share))
1150
1151                ShareLevel = 1
1152            end
1153        end
1154    end
1155
1156    IF options.!debug == 1 THEN do
1157        say 'p_workgroup = "'p_workgroup'"'
1158        say 'p_server    = "'p_server'"'
1159        say 'p_share     = "'p_share'"'
1160    end
1161
1162    ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
1163
1164    settings.!network = VRGet("EF_NETWORK","Value")
1165    call CB_MOUNT_Change
1166
1167    if trgRec = "" then do
1168        ok = VRSet("CB_DRIVES","Value", "")
1169        ok = VRSet("EF_DIRECTORY","Value", "")
1170
1171        window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
1172
1173        if VRGet("CB_DRIVES","Value") = "" then return
1174    end
1175    else do
1176
1177        TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
1178
1179        parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
1180
1181        do while parTrgRH <> ""
1182            partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
1183            TargetString = partrgCapt||'\'||TargetString
1184            parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
1185        end
1186        say 'TargetString = "'TargetString'"'
1187        ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
1188        ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
1189        window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
1190        if VRGet("CB_DRIVES","Value") = "" then return
1191    end
1192    window = VRLoadSecondary( "SW_LOGIN", "W" )
1193    call PB_MOUNT_CLICK
1194
1195    if VRGet(srcCtn,'Name') = "CN_CONDET" & VRMethod( 'CN_CONDET', "ValidateRecord", srcRec) = 1 then do
1196        if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = '#68:PMWP.DLL' then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
1197    end
1198    IF options.!debug == 1 THEN SAY time()' CN_CURRENT_DragDrop done'
1199return
1200
1201/*:VRX         CN_SMBTREE_Click
1202*/
1203CN_SMBTREE_Click:
1204    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_Click started'
1205    ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText"))
1206
1207    call _dropdeprecated
1208    call _GetSmbObjectProperties VRInfo('Record')
1209
1210    ok = VRset("DT_Statusbar", "Caption", SMBObj.udatamsg)
1211
1212    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_Click done'
1213return
1214/*:VRX         CN_SMBTREE_ContextMenu
1215*/
1216CN_SMBTREE_ContextMenu:
1217    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_ContextMenu started'
1218
1219    call _dropdeprecated
1220    call _GetSmbObjectProperties VRInfo('Record')
1221
1222    /* Hide all context menu entries */
1223    ok = VRSet("Menu_Selected_Remove",           "Visible", 0) /* CN_CONDET */
1224    ok = VRSet("Menu_Selected_Retry",            "Visible", 0) /* CN_CONDET */
1225    ok = VRSet("Menu_Selected_Connect",          "Visible", 0) /* CN_SMBTREE */
1226    ok = VRSet("Menu_Selected_Sep1",             "Visible", 0) /* CN_SMBTREE */
1227    ok = VRSet("Menu_Selected_Info",             "Visible", 0) /* CN_SMBTREE */
1228    ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 0) /* CN_SMBTREE */
1229
1230    select
1231        when SMBObj.udatatype = "DISK" then do
1232            ok = VRSet("Menu_Selected_Connect", "Visible", 1)
1233            ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
1234        end
1235        when SMBObj.udatatype = "SERVER" then do
1236            ok = VRSet("Menu_Selected_Connect",          "Visible", 1)
1237            ok = VRSet("Menu_Selected_Sep1",             "Visible", 1)
1238            ok = VRSet("Menu_Selected_Info",             "Visible", 1)
1239            ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
1240        end
1241        when SMBObj.udatatype = "WORKGROUP" then do
1242            ok = VRSet("Menu_Selected_Connect",          "Visible", 1)
1243            ok = VRSet("Menu_Selected_Sep1",             "Visible", 1)
1244            ok = VRSet("Menu_Selected_Default_Workgroup","Visible", 1)
1245            ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
1246        end
1247        when SMBObj.udatatype = "PRINTER" then do
1248            CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
1249        end
1250        otherwise nop /* FILE DIRECTORY */
1251    end
1252
1253    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_ContextMenu done'
1254return
1255/*:VRX         CN_SMBTREE_DoubleClick
1256*/
1257CN_SMBTREE_DoubleClick:
1258    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_DoubleClick started'
1259
1260    call _dropdeprecated
1261    call _GetSmbObjectProperties VRInfo('Record')
1262
1263/*  IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_DoubleClick done'
1264return */
1265    /* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
1266
1267    IF options.!debug == 1 THEN SAY '  Browsing "'SMBObj.udatatype'"'
1268
1269    If SMBObj.udatatype = "DIRECTORY" then do
1270        BrowsePath = _browsebuildpath(SMBObj.rh)
1271
1272        call _BrowseResetObject(SmbObj.rh)
1273
1274        parse var browsepath '\\'machine'\'sharename '\' browsepath
1275        browsepath = browsepath'\*'
1276
1277        call _BrowseDirectory       
1278    end
1279
1280    If SMBObj.udatatype = "FILE" then do
1281        BrowsePath = _browsebuildpath(SMBObj.rh)
1282        call _BrowseResetObject(SmbObj.rh)
1283       
1284        parse var browsepath '\\'machine'\'sharename '\' browsepath
1285
1286        OpenOk = _browseobjectopen(machine,sharename,browsepath)
1287
1288        if \OpenOK then do
1289            say "  Not connected - trying to connect"
1290            ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
1291            call PB_CONNECT_Click
1292            ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
1293
1294            OpenOk = _browseobjectopen(machine,sharename,browsepath)
1295
1296            if \OpenOk then do
1297                say "  Not connected - cannot open - aborting!"
1298            end
1299        end
1300    end
1301
1302    if SMBObj.udatatype = "DISK" then do
1303        machine  = VRMethod("CN_smbtree","GetRecordAttr",SMBObj.parentrh,"Caption")
1304        parse var machine machine '0D0A'x .
1305        machine = strip(machine)
1306
1307        call _BrowseResetObject(SmbObj.rh)
1308
1309        sharename = SMBObj.resname
1310        BrowsePath = ""
1311
1312        call _BrowseDirectory
1313    end       
1314    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_DoubleClick done'
1315return
1316/*:VRX         CN_SMBTREE_DragStart
1317*/
1318CN_SMBTREE_DragStart:
1319    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_DragStart started'
1320
1321    obj = VRInfo( "object" )
1322
1323    ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
1324    if SelRH.0 = 0 then do
1325        IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_DragStart aborted'
1326        return
1327    end
1328
1329    call _dropdeprecated
1330    call _GetSMBObjectProperties SelRH.1
1331
1332    select
1333        when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
1334            call VRMethod obj, 'StartDrag'
1335        end
1336        when SMBObj.udatatype = "PRINTER" then do
1337            CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
1338        end
1339        otherwise nop /* FILE DIRECTORY */
1340    end
1341
1342    IF options.!debug == 1 THEN SAY time()' CN_SMBTREE_DragStart done'
1343return
1344/*:VRX         CreateObject
1345*/
1346CreateObject: procedure
1347    Parse Arg Class, Title, Location, Setup, Collision
1348    /* Say 'Creating ['Title']' */
1349say Setup
1350    rc = SysCreateObject( Class, Title, Location, Setup, Collision )
1351    If rc <> 1 Then do
1352        Msg.Text = ' > failed to create ['Title' | 'Class'] at location ['Location']'
1353        Msg.Type = 'Error'
1354        say Msg.Text
1355    end
1356return rc
1357/*:VRX         DT_STATUSBAR_ContextMenu
1358*/
1359DT_STATUSBAR_ContextMenu:
1360    ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
1361return
1362
1363/*:VRX         EF_PASSWORD1_KeyPress
1364*/
1365EF_PASSWORD1_KeyPress:
1366    obj = VRInfo( "Object" )
1367    keystr = VRGet( obj, "KeyString" )
1368/*  say keystr */
1369    select
1370        when keystr = "{Enter}" then call PB_LOGIN_OK_Click
1371        when keystr = "{Newline}" then call PB_LOGIN_OK_Click
1372        when keystr  = "{Esc}" then call PB_LOGIN_CANCEL_Click
1373        otherwise nop
1374    end
1375return
1376
1377/*:VRX         EF_PASSWORD_Change
1378*/
1379EF_PASSWORD_Change:
1380    call _UserCredUpdate
1381return
1382
1383/*:VRX         EF_SERVER_Change
1384*/
1385EF_SERVER_Change:
1386    Now = VRGet("EF_SERVER","value")
1387    if Now = "" then return
1388    ok = SysSleep(1)
1389    if Now <> VRGet("EF_SERVER","value") then return
1390
1391    /* Do nothing for incomplete IP addresses */
1392    if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" & length(VRGet("EF_SERVER","value")) < 7 then return
1393
1394    ok = VRMethod( "CN_smbtree", "GetRecordList", "Visible", "rh." )
1395
1396    FoundServer = 0
1397
1398    do I = 1 to rh.0
1399
1400        Userdata = VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Userdata")
1401        ResName  = VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Caption")
1402        ParentRH = VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Parent")
1403
1404        parse var ResName  ResName '0D0A'x .
1405        ResName = strip(ResName)
1406        parse var userdata ResType  '|' .
1407
1408        if VRGet("EF_SERVER","value") = ResName then do /* we found the server the field was changed to */
1409            /* Workgroup properly */
1410            if ParentRH = "" then do
1411                ok = VRSet("EF_NETWORK", "Value", "") /* The workgroup might be unknown at this moment */
1412            end
1413            else do
1414                ok = VRSet("EF_NETWORK", "Value", VRMethod("CN_smbtree","GetRecordAttr",ParentRH,"Caption"))
1415            end
1416
1417            /* clear shares */
1418            ok = VRMethod("EF_SHARE",   "Reset")
1419            ok = VRset("EF_SHARE","Value", "")
1420
1421            do J = 1 to rh.0 /* populate shares with valid entries */
1422
1423                Userdata = VRMethod("CN_smbtree","GetRecordAttr",rh.J,"Userdata")
1424                ResName  = VRMethod("CN_smbtree","GetRecordAttr",rh.J,"Caption")
1425                ParentRH = VRMethod("CN_smbtree","GetRecordAttr",rh.J,"Parent")
1426
1427                parse var ResName  ResName '0D0A'x .
1428                ResName = strip(ResName)
1429                parse var userdata ResType  '|' .
1430
1431                if ParentRH = rh.I then do /* we found a share belonging to our server */
1432                    if ResType = "DISK" then ok = VRMethod("EF_SHARE","AddString", ResName)
1433                end
1434            end
1435            FoundServer = 1
1436            leave
1437        end
1438    end
1439    if Foundserver = 0 then do
1440        machine = VRGet("EF_SERVER","value")
1441        smbtree.!machine = VRMethod( "CN_smbtree", "AddRecord",,, machine)
1442        /* We make any machine as sleeping initially */
1443        ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#61:PMWP.DLL")
1444        ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "ReadOnly", 1)
1445        ok = VRMethod( "CN_smbtree", "SetFieldData",  smbtree.!machine, NBFH, machine)
1446        call _UserCredUpdate
1447        call _RefreshShares
1448    end
1449return
1450
1451/*:VRX         EF_USER1_KeyPress
1452*/
1453EF_USER1_KeyPress:
1454    obj = VRInfo( "Object" )
1455    keystr = VRGet( obj, "KeyString" )
1456/*  say keystr */
1457    select
1458        when keystr = "{Enter}" then ok = VRMethod( "EF_Password1", "SetFocus" )
1459        when keystr = "{Newline}" then ok = VRMethod( "EF_Password1", "SetFocus" )
1460        when keystr  = "{Esc}" then call PB_LOGIN_CANCEL_Click
1461        otherwise nop
1462    end
1463return
1464
1465/*:VRX         EF_USER_Change
1466*/
1467EF_USER_Change:
1468    call _UserCredUpdate
1469return
1470
1471/*:VRX         Fini
1472*/
1473Fini:
1474    window = VRWindow()
1475    call VRSet window, "Visible", 0
1476    drop window
1477return 0
1478
1479/*:VRX         GetChildren
1480*/
1481GetChildren: PROCEDURE EXPOSE existrec. exc options. fs. cd. samba.
1482    IF options.!debug == 1 THEN SAY time()' GetChildren started'
1483    PARSE ARG node, parec
1484
1485    dyn = "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
1486    IF options.!debug == 1 THEN SAY '  Dyn code: 'dyn
1487    interpret dyn; drop dyn
1488
1489
1490    IF info.2 > 0 THEN icon = '#64:PMWP.DLL'
1491    ELSE               icon = '#68:PMWP.DLL'
1492    rh = VRMethod('CN_CURRENT', 'AddRecord', parec, 'Last', info.0, icon )
1493    IF rh == '' THEN RETURN
1494
1495    exc = exc + 1
1496    existrec.exc = rh
1497    userdata = node';'info.2
1498    DO i = 1 TO res.0
1499        userdata = ParseResourceData( userdata, res.i )
1500    END
1501    if userdata = "UNKNOWN" then ok = VRMethod('CN_CURRENT', 'RemoveRecord', rh)
1502    else do
1503        CALL VRMethod 'CN_CURRENT', 'SetRecordAttr', rh, 'UserData', userdata
1504        if options.currentdata = userdata then ok = VRMethod('CN_CURRENT', 'SetRecordAttr', rh, 'Selected', 1)
1505    end
1506
1507    DO i = 1 TO points.0
1508        childnode = node || points.i || '\'
1509        CALL GetChildren childnode, rh
1510    END
1511    IF options.!debug == 1 THEN SAY time()' GetChildren done'
1512RETURN
1513
1514/*:VRX         GetMountPoints
1515*/
1516GetMountPoints: PROCEDURE EXPOSE existrec. options. fs. cd. samba.
1517    IF options.!debug == 1 THEN SAY time()' GetMountPoints started'
1518/*  CALL VRSet 'CN_CURRENT', 'Painting', 0 */
1519/*  IF options.!debug == 1 THEN SAY time()' '||"GetMountPoints: SysDriveMap(USED) started"  */
1520    drvs = SysDriveMap('C:', 'USED') /* was "REMOTE" */
1521/*  IF options.!debug == 1 THEN SAY time()' '||"GetMountPoints: SysDriveMap(USED) done" */
1522    ac = 0
1523    DO i = 1 TO WORDS( drvs )
1524        fs = TRANSLATE( SysFileSystemType( WORD( drvs, i )))
1525        IF fs == fs.!fileSystemtype THEN DO
1526            ac = ac + 1
1527            attached.ac = WORD( drvs, i )
1528        END
1529    END
1530    attached.0 = ac
1531
1532    exc = 0
1533    DO i = 1 TO attached.0
1534        node = attached.i'\'
1535
1536        CALL VRMethod 'CB_DRIVES',  'AddString', attached.i
1537
1538        dyn = "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
1539        IF options.!debug == 1 THEN SAY '  Dyn code: 'dyn
1540        interpret dyn; drop dyn
1541
1542        IF info.2 > 0 THEN icon = '#16:PMWP.DLL'
1543        ELSE               icon = '#70:PMWP.DLL'
1544
1545        rh = VRMethod('CN_CURRENT', 'AddRecord',, 'Last', attached.i, icon )
1546        IF rh == '' THEN ITERATE
1547
1548        exc = exc + 1
1549        existrec.exc = rh
1550        userdata = node';'info.2
1551        DO j = 1 TO res.0
1552            userdata = ParseResourceData( userdata, res.j )
1553        END
1554/*      IF options.!debug == 1 THEN say '  "'attached.i'" "'userdata'"' */
1555        CALL VRMethod 'CN_CURRENT', 'SetRecordAttr', rh, 'UserData', userdata
1556        if options.currentdata = userdata then ok = VRMethod('CN_CURRENT', 'SetRecordAttr', rh, 'Selected', 1)
1557
1558        CALL VRMethod 'CN_CURRENT', 'SetRecordAttr', rh, 'Expanded', 1
1559
1560        DO j = 1 TO points.0
1561            childnode = node || points.j || '\'
1562            CALL GetChildren childnode, rh
1563        END
1564
1565    END
1566    existrec.0 = exc
1567/*  CALL VRSet 'CN_CURRENT', 'Painting', 1 */
1568    IF options.!debug == 1 THEN SAY time()' '||"GetMountPoints done"
1569RETURN
1570
1571/*:VRX         Halt
1572*/
1573Halt:
1574    signal _VREHalt
1575return
1576
1577/*:VRX         Init
1578*/
1579Init:
1580/* Herwig */
1581/*  CALL VRSet 'Console', 'WindowListTitle', ''  */
1582
1583    window = VRWindow()
1584    call VRSet window,    "Visible", 0
1585    call VRMethod window, "Activate"
1586    drop window
1587
1588RETURN
1589
1590/*:VRX         LoadFileSysFuncs
1591*/
1592LoadFileSysFuncs:
1593    IF options.!debug == 1 THEN SAY time()' LoadFileSysFuncs() started'
1594    Fatal = 1
1595    RestartCount = 0
1596    FoundEVFS = 1
1597    FoundND = 1
1598
1599    if SysSearchPath("PATH", "EVFSCTL.EXE") = "" then do
1600        FoundEVFS = 0
1601        ForceNDFS = 1
1602    end
1603
1604CtlRestart:
1605    if \ForceNDFS then signal NoNetDrive
1606
1607ForceNDFS:
1608    IF options.!debug == 1 THEN SAY '  NDFS check entered'
1609    call RxFuncAdd 'NdRxLoadFuncs', 'NDCALLS', 'NdRxLoadFuncs'
1610    SIGNAL ON SYNTAX NAME NoNetdrive
1611    call NdRxLoadFuncs
1612    FoundND = 1
1613    SIGNAL OFF SYNTAX
1614    fs.!prefix         = 'ND'
1615    fs.!fileSystemtype = "NDFS32"
1616    fs.!profileext     = "ndc"
1617    signal CommonToBothFS
1618NoNetdrive:
1619    IF options.!debug == 1 THEN SAY '  NDFS not found'
1620    CALL RxFuncAdd 'EvfsRxLoadFuncs', 'EVFSCALL.DLL', 'EvfsRxLoadFuncs'
1621    SIGNAL ON SYNTAX NAME NoEVFSCALL
1622    CALL EvfsRxLoadFuncs
1623    FoundEVFS = 1
1624    SIGNAL OFF SYNTAX
1625    fs.!prefix         = 'EVFS'
1626    fs.!fileSystemtype = "EVFS"
1627    fs.!profileext     = "evp"
1628CommonToBothFS:
1629    IF options.!debug == 1 THEN SAY '  Common version check'
1630    dyn = "fsstat = "fs.!prefix"RxQueryIFS()"
1631    IF options.!debug == 1 THEN SAY '  Dyn code:        '||dyn
1632    interpret dyn; drop dyn
1633    IF options.!debug == 1 THEN SAY '  Dyn res fsstat = '||fsstat
1634    if fsstat = 252 then do
1635        dyn = "Found"fs.!prefix" = 0"
1636        interpret dyn
1637    end
1638    if word(fsstat,1) = '0' then do
1639        PARSE VAR fsstat '0 'fsname fsver fsctl .
1640        fs.!name = fsname
1641        fs.!version = fsver
1642
1643        IF options.!debug == 1 THEN DO
1644            say '  fs.!prefix = 'fs.!prefix
1645            say '  fs.!name   = 'fs.!Name
1646            say '  Version    = 'fsver
1647            say '  fsctl      = 'fsctl
1648        end
1649    end
1650    else do
1651        if FoundND = 0 & FoundEVFS = 0 then do
1652            CALL VRMessage 'Main', 'FATAL: Neither EVFS nor Netdrive found: 'fs.!prefix'RxQueryIFS()='fsstat, NLVGetMessage( 5 ), 'E'
1653            signal Halt
1654        end
1655        signal ForceNDFS
1656    end
1657    IF fsctl \= 1 THEN DO
1658        if ReStartCount = 0 then do
1659            'detach 'fs.!prefix'ctl.exe'
1660            RestartCount = 1
1661            ok = SysSleep(1)
1662            signal CtlRestart
1663        end
1664        else do
1665            CALL VRMessage 'Main', NLVGetMessage( 101 ), NLVGetMessage( 5 ), 'E'
1666            signal Halt
1667        end
1668    END
1669
1670    Fatal = 0
1671    IF options.!debug == 1 THEN SAY time()' LoadFileSysFuncs() done'
1672return
1673
1674/*:VRX         LoadSettings
1675*/
1676LoadSettings: PROCEDURE EXPOSE settings. options. fs. advanced. samba. ShowHidden margin
1677    IF options.!debug == 1 THEN SAY time()' LoadSettings started'
1678
1679    /* Locate the profile.
1680     */
1681    os2_ini = VALUE('USER_INI',,'OS2ENVIRONMENT')
1682    inipath = VRParseFilePath( os2_ini, 'DP')
1683    IF inipath == '' THEN inipath = SysBootDrive() || '\OS2'
1684
1685    settings.!ini = inipath'\evfsgui.ini'
1686    IF options.!debug == 1 THEN SAY '  EVFSGUI INIfile = "'settings.!ini'"'
1687
1688    IF STREAM( settings.!ini, 'C', 'QUERY EXISTS') == '' THEN DO
1689        IF options.!debug == 1 THEN say "  First start!"
1690        settings.!network = ""
1691        settings.!buttonson = 1
1692        settings.!smbtreeon = 1
1693        advanced.!browseimme = 1
1694        advanced.!savepassive = 0
1695        advanced.!broadcast = 0
1696        advanced.!bigicons = 1
1697
1698        ShowHidden = 0
1699
1700        CALL VRSet VRWindow(), 'Height', 7576
1701        CALL VRSet VRWindow(), 'Width',  8200
1702        CALL VRSet "SPLIT_MAIN", 'Left',  2915
1703        CALL VRMethod VRWindow(), 'CenterWindow'
1704        call Menu_View_Buttons_Click
1705        call Menu_View_SmbTree_Click
1706        ok = VRset("GB_SMBTREE","Painting", 1)
1707        ok = VRset("GB_SMBTREE","Visible", 1)
1708
1709        call VRSet 'Main',    'Visible', 1
1710        call Main_Resize
1711    END
1712    ELSE DO
1713
1714        /* Load window position settings.
1715         */
1716        settings.!x = VRGetIni('Settings', 'X', settings.!ini, 'NoClose')
1717        settings.!y = VRGetIni('Settings', 'Y', settings.!ini, 'NoClose')
1718        IF settings.!x == '' THEN settings.!x = -1
1719        IF settings.!y == '' THEN settings.!y = -1
1720
1721        settings.!h = VRGetIni('Settings', 'H', settings.!ini, 'NoClose')
1722        settings.!w = VRGetIni('Settings', 'W', settings.!ini, 'NoClose')
1723        IF settings.!h == '' THEN settings.!h = -1
1724        IF settings.!w == '' THEN settings.!w = -1
1725
1726        settings.!s = VRGetIni('Settings', 'S', settings.!ini, 'NoClose')
1727        IF settings.!s == '' THEN settings.!s = -1
1728
1729        /* Herwig B. */
1730        settings.!curbcolor = VRGetIni('Settings', 'TitleBarBackground', settings.!ini, 'NoClose')
1731        settings.!curfcolor = VRGetIni('Settings', 'TitleBarForeground', settings.!ini, 'NoClose')
1732        IF (settings.!curbcolor = '' | settings.!curbcolor = '<default>') THEN settings.!curbcolor = 'SystemActiveTitle'
1733        IF (settings.!curfcolor = '' | settings.!curfcolor = '<default>') THEN settings.!curfcolor = 'SystemActiveTitleText'
1734
1735        settings.!buttonson = VRGetIni('Settings', 'ButtonsOn', settings.!ini, 'NoClose')
1736        IF settings.!buttonson = "" then settings.!buttonson = 1
1737
1738        settings.!smbtreeon = VRGetIni('Settings', 'SmbtreeOn', settings.!ini, 'NoClose')
1739        IF settings.!smbtreeon = "" then settings.!smbtreeon = 0
1740
1741        settings.!dialogon = VRGetIni('Settings', 'DialogOn', settings.!ini, 'NoClose')
1742        IF settings.!dialogon = "" then settings.!dialogon = 1
1743
1744        settings.!condeton = VRGetIni('Settings', 'ConDetOn', settings.!ini, 'NoClose')
1745        IF settings.!condeton = "" then settings.!condeton = 1
1746
1747        /* Load network - does not make sense anymore
1748        settings.!network = VRGetIni('Settings', 'Network', settings.!ini, 'NoClose')
1749        IF settings.!network == '' THEN settings.!network = '' */
1750        settings.!network = ''
1751
1752        if \VRFileExists( samba.!smbconf ) then call _CreateSmbConf
1753
1754        /* Load font settings.
1755         */
1756        IF VRFileExists( SysBootDrive() || '\OS2DBCS') == 1 THEN
1757            default_font = '9.WarpSans Combined'
1758        ELSE
1759            default_font = '9.WarpSans'
1760        settings.!cfont = VRGetIni('Settings', 'ContainerFont', settings.!ini, 'NoClose')
1761        settings.!wfont = VRGetIni('Settings', 'WindowFont',    settings.!ini, 'NoClose' )
1762        IF settings.!cfont  == '' THEN settings.!cfont  = default_font
1763        IF settings.!wfont  == '' THEN settings.!wfont  = default_font
1764
1765        advanced.!browseauth = VRGetIni('Settings', 'BrowseAuth', settings.!ini, 'NoClose')
1766        IF advanced.!browseauth == '' THEN advanced.!browseauth = 0
1767
1768        advanced.!browseimme = VRGetIni('Settings', 'BrowseImme', settings.!ini)
1769        IF advanced.!browseimme == '' THEN advanced.!browseimme = 1
1770
1771        advanced.!debug = VRGetIni('Settings', 'Debug', settings.!ini)
1772        IF advanced.!debug == '' THEN advanced.!debug = 0       /* Turn off debug by default for release builds */
1773
1774        /* This is a hack and should be reworked! - using several variables for debug is bad! */
1775        options.!debug = advanced.!debug
1776        IF options.!debug <> 1 THEN ok = VRRedirectStdIO("OFF")
1777
1778        advanced.!alwaysmp = VRGetIni('Settings', 'AlwaysMP', settings.!ini)
1779        IF advanced.!alwaysmp == '' THEN advanced.!alwaysmp = 1
1780
1781        advanced.!special = VRGetIni('Settings', 'SpecialShares', settings.!ini)
1782        IF advanced.!special == '' THEN advanced.!special = 0
1783
1784        advanced.!bigicons = VRGetIni('Settings', 'BigIcons', settings.!ini)
1785        IF advanced.!bigicons == '' THEN advanced.!bigicons = 1
1786
1787        advanced.!savepassive = VRGetIni('Settings', 'SavePassive', settings.!ini)
1788        IF advanced.!savepassive == '' THEN advanced.!savepassive = 0
1789
1790        advanced.!broadcast = VRGetIni('Settings', 'Broadcast', settings.!ini)
1791        IF advanced.!broadcast == '' THEN advanced.!broadcast = 0
1792
1793        /* Apply the settings
1794         */
1795        /* Does not make sense anymore
1796        ok = VRSet("EF_NETWORK","Value", settings.!network)
1797         */
1798        ok = VRSet("DT_CURRENT","BACKCOLOR", settings.!curbcolor )
1799        ok = VRSet("DT_CURRENT","FORECOLOR", settings.!curfcolor )
1800        ok = VRSet("DT_DIALOG","BACKCOLOR",  settings.!curbcolor )
1801        ok = VRSet("DT_DIALOG","FORECOLOR",  settings.!curfcolor )
1802        ok = VRSet("DT_SMBTREE","BACKCOLOR", settings.!curbcolor )
1803        ok = VRSet("DT_SMBTREE","FORECOLOR", settings.!curfcolor )
1804        ok = VRSet("DT_CONDET","BACKCOLOR", settings.!curbcolor )
1805        ok = VRSet("DT_CONDET","FORECOLOR", settings.!curfcolor )
1806
1807        ok = VRset("CN_CURRENT", "MiniIcons", \advanced.!bigicons)
1808        ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
1809        ok = VRset("CN_CONDET",  "MiniIcons", \advanced.!bigicons)
1810        ok = VRset("Menu_View_MiniIcons",  "Checked", \advanced.!bigicons)
1811
1812        ok = VRSet("Menu_View_Buttons","Checked", settings.!buttonson)
1813        ok = VRset("GB_Buttons","Visible", settings.!buttonson)
1814        options.!buttondelta = 440 * settings.!buttonson
1815
1816        ok = VRSet("Menu_View_Dialog","Checked", settings.!dialogon)
1817        if settings.!dialogon then call Menu_View_Dialog_Click
1818
1819        ok = VRSet("Menu_View_ConDet","Checked", settings.!condeton)
1820        if settings.!condeton then do
1821            call Menu_View_ConDet_Click
1822            ok = VRset("GB_CONDET","Painting", 1)
1823            ok = VRset("GB_CONDET","Visible", 1)
1824        end
1825
1826
1827        ok = VRSet("Menu_View_Smbtree","Checked", settings.!smbtreeon)
1828        if settings.!smbtreeon then do
1829            call Menu_View_SmbTree_Click
1830            ok = VRset("GB_SMBTREE","Painting", 1)
1831            ok = VRset("GB_SMBTREE","Visible", 1)
1832        end
1833
1834        if advanced.!debug == 1 then ok = VRRedirectStdio("ON")
1835
1836        IF ( settings.!x >= 0 ) & ( settings.!y >= 0 ) & ( settings.!l >= 0 ) & ( settings.!w >= 0 ) & ( settings.!s >= 0 ) THEN DO
1837            CALL VRSet VRWindow(), 'Left',   settings.!x
1838            CALL VRSet VRWindow(), 'Top',    settings.!y
1839            CALL VRSet VRWindow(), 'Height', settings.!h
1840            CALL VRSet VRWindow(), 'Width',  settings.!w
1841            CALL VRSet "SPLIT_MAIN", 'Left',  settings.!s
1842        END
1843        ELSE
1844            CALL VRMethod VRWindow(), 'CenterWindow'
1845
1846        CALL VRSet 'CN_CURRENT', 'Font',       settings.!cfont
1847        CALL VRSet 'Main',       'Font',       settings.!wfont
1848        CALL VRSet 'Main',       'StatusFont', settings.!wfont
1849
1850    END
1851
1852    if options.!nogui == 1 then CALL VRLoadSecondary "SW_PROGRESS","W"
1853    /* This is too early if a profile was loaded and Main_Resize does it anyway */
1854    /* else call VRSet 'Main',    'Visible', 1 */
1855
1856    /* in non debug versions this is normally not visible */
1857    IF options.!debug == 1 THEN SAY '  NLV MessageFile = "'settings.!messages'"'
1858    IF options.!debug == 1 THEN SAY '  NLV HelpFile    = "'settings.!helpfile'"'
1859
1860    IF options.!debug == 1 THEN SAY time()' LoadSettings done'
1861RETURN
1862
1863/*:VRX         Main_Close
1864*/
1865Main_Close:
1866    CALL Quit
1867RETURN
1868
1869/*:VRX         Main_Create
1870*/
1871Main_Create:
1872    ok = VRRedirectStdIO("OFF")
1873    options.!debug    = 0
1874
1875    IF options.!debug == 1 THEN ok = VRREdirectStdIO("ON")
1876    IF options.!debug == 1 THEN SAY time()' Main_Create started'
1877
1878    CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
1879    CALL SysLoadFuncs
1880
1881    CALL _InitTempDir
1882
1883    CALL NLVSetup
1884
1885    CALL StemsInit
1886
1887    CALL _ContainersInit
1888
1889    CALL _GUIInit
1890
1891    CALL ParseCommandLine
1892
1893    CALL LoadFileSysFuncs
1894
1895    CALL _CltInit
1896
1897    CALL LoadSettings
1898
1899    CALL Refresh
1900
1901    if advanced.!savepassive == 1 then CALL _PassiveLoad
1902
1903    IF options.!autoload == 1 THEN CALL PB_LOAD_Click
1904
1905    CALL VRSet "CB_MOUNT",  "Selected", 1
1906    CALL VRSet "CB_DRIVES", "Selected", 1
1907    IF options.!autoclose == 1 THEN CALL TM_AutoClose_Trigger
1908    /* For whatever reason the timer is not triggered anymore....
1909    CALL VRSet "TM_AUTOCLOSE", "ENABLED", 1 */
1910    ELSE do
1911        if advanced.!browseauth == 1 then do
1912            window = VRLoadSecondary( "SW_LOGIN", "W" )
1913            call Main_Resize
1914        end
1915        if advanced.!browseimme == 1 then call PB_REFRESH_Click
1916    end
1917
1918    IF options.!debug == 1 THEN SAY time()' Main_Create done'
1919return
1920
1921/*:VRX         Main_KeyPress
1922*/
1923Main_KeyPress:
1924    key = VRGet('Main', 'KeyString')
1925    IF key == '{F5}' THEN CALL Refresh
1926RETURN
1927
1928/*:VRX         Main_Resize
1929*/
1930Main_Resize:
1931    if datatype(options.!buttondelta) = 'CHAR' then return
1932
1933    IF options.!debug == 1 THEN SAY time()' Main_Resize started'
1934    ok = VRset("Main","Painting", 0)
1935
1936    /* Basic measurements */
1937    main_iwidth  = VRGet("Main","InteriorWidth")                /* Width of window client-area */
1938    main_iheight = VRGet("Main","InteriorHeight")               /* Height of window client-area */
1939    sbar_height  = VRGet("GB_STATUSBAR","Height")               /* Height of status-bar */
1940    split_left   = VRGet("SPLIT_Main","Left")                   /* Position of the left edge of the split-bar */
1941    marginx2     = margin * 2                                   /* Common margin around controls */
1942    pbtn_height  = 400                                          /* Height of the panels' internal button areas */
1943    buttons_top  = main_iheight - sbar_height - margin - options.!buttondelta         /* Top of the common button area */
1944    pane_height  = buttons_top - (margin * 3)                                         /* Height of a split-bar panel */
1945    lpane_width  = split_left - margin                                                /* Width of the left split-bar panel */
1946    rpane_width  = main_iwidth - split_left - 60 - margin                             /* Width of the right split-bar panel */
1947
1948    /* Button bar */
1949    ok = VRSet("GB_BUTTONS",  "Top",   buttons_top )
1950    ok = VRSet("GB_BUTTONS",  "Left",  main_iwidth - VRGet("GB_Buttons","Width") - margin )
1951
1952    /* Current Panel */
1953    ok = VRSet("GB_CURRENT",  "Visible", 1           )
1954    ok = VRSet("GB_CURRENT",  "Top",     marginx2  )
1955    ok = VRSet("GB_CURRENT",  "Left",    margin      )
1956    ok = VRSet("GB_CURRENT",  "Width",   lpane_width )
1957    ok = VRSet("GB_CURRENT",  "Height",  pane_height )
1958
1959    ok = VRset("GB_CURRENT3", "Top",     margin )
1960    ok = VRset("GB_CURRENT3", "Left",    margin )
1961    ok = VRset("GB_CURRENT3", "Height",  245    )
1962    ok = VRset("GB_CURRENT3", "Width",   lpane_width - marginx2)
1963
1964    ok = VRset("DT_CURRENT", "Top",      8   )
1965    ok = VRset("DT_CURRENT", "Left",     8   )
1966    ok = VRset("DT_CURRENT", "Height",   213 )
1967    ok = VRset("DT_CURRENT", "Width",    (lpane_width - marginx2) - 24 )
1968
1969    ok = VRset("GB_CURRENT2", "Left",   margin                )
1970    ok = VRset("GB_CURRENT2", "Top",    245 + marginx2        )
1971    ok = VRset("GB_CURRENT2", "Width",  lpane_width - marginx2)
1972    ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
1973
1974    ok = VRset("CN_CURRENT", "Top",     margin )
1975    ok = VRset("CN_CURRENT", "Left",    margin )
1976    ok = VRset("CN_CURRENT", "Width",   VRGet("GB_CURRENT2","Width")  - marginx2)
1977    ok = VRset("CN_CURRENT", "Height",  VRGet("GB_CURRENT2","Height") - marginx2)
1978
1979    ok = VRset("PB_DETACH",  "Left",   margin )
1980    ok = VRset("PB_DETACH",  "Top",    pane_height - pbtn_height - marginx2 )
1981    ok = VRset("PB_DETACH",  "Width",  min((lpane_width-margin*3) % 2, 1313)    )
1982    ok = VRset("PB_UNMOUNT", "Left",   VRGet("PB_DETACH","Width") + marginx2)
1983    ok = VRset("PB_UNMOUNT", "Top",    pane_height - pbtn_height - marginx2 )
1984    ok = VRset("PB_UNMOUNT", "Width",  min((lpane_width-margin*3) % 2, 1313)    )
1985
1986    /* SMBTree stuff */
1987    ok = VRSet("GB_SMBTREE", "Top",     marginx2      )
1988    ok = VRSet("GB_SMBTREE", "Left",    split_left + 60 )
1989    ok = VRset("GB_SMBTREE", "Height",  pane_height     )
1990    ok = VRset("GB_SMBTREE", "Width",   rpane_width     )
1991
1992    ok = VRset("GB_SMBTREE3","Top",     margin )
1993    ok = VRset("GB_SMBTREE3","Left",    margin )
1994    ok = VRset("GB_SMBTREE3","Height",  245    )
1995    ok = VRset("GB_SMBTREE3","Width",   rpane_width - marginx2)
1996
1997    ok = VRset("DT_SMBTREE", "Top",     8 )
1998    ok = VRset("DT_SMBTREE", "Left",    8 )
1999    ok = VRset("DT_SMBTREE", "Width",   (rpane_width - marginx2) - 24 )
2000
2001    ok = VRset("GB_SMBTREE2","Left",    margin                    )
2002    ok = VRset("GB_SMBTREE2","Top",     245 + marginx2        )
2003    ok = VRset("GB_SMBTREE2","Width",   rpane_width - marginx2)
2004    ok = VRset("GB_SMBTREE2","Height",  pane_height - (margin * 5) - pbtn_height - 245 )
2005
2006    ok = VRset("CN_SMBTREE",  "Top",    margin )
2007    ok = VRset("CN_SMBTREE",  "Left",   margin )
2008    ok = VRset("CN_SMBTREE",  "Width",  VRGet("GB_SMBTREE2","Width")  - marginx2)
2009    ok = VRset("CN_SMBTREE",  "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
2010
2011    ok = VRset("PB_CONNECT", "Left",   margin)
2012    ok = VRset("PB_CONNECT", "Top",    pane_height - pbtn_height   - marginx2)
2013    ok = VRset("PB_REFRESH", "Left",   VRGet("PB_CONNECT","Width") + marginx2)
2014    ok = VRset("PB_REFRESH", "Top",    pane_height - pbtn_height   - marginx2)
2015
2016    ok = VRset("PICT_THROBBER", "Top",  VRGet("CN_SMBTREE","Height") % 2 + 100 )
2017    ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width")  % 2 - 200 )
2018
2019    /* Connection details stuff */
2020    ok = VRSet("GB_CONDET", "Top",     marginx2      )
2021    ok = VRSet("GB_CONDET", "Left",    split_left + 60 )
2022    ok = VRset("GB_CONDET", "Height",  pane_height     )
2023    ok = VRset("GB_CONDET", "Width",   rpane_width     )
2024
2025    ok = VRset("GB_CONDET3","Top",     margin )
2026    ok = VRset("GB_CONDET3","Left",    margin )
2027    ok = VRset("GB_CONDET3","Height",  245    )
2028    ok = VRset("GB_CONDET3","Width",   rpane_width - marginx2)
2029
2030    ok = VRset("DT_CONDET", "Top",     8 )
2031    ok = VRset("DT_CONDET", "Left",    8 )
2032    ok = VRset("DT_CONDET", "Width",   (rpane_width - marginx2) - 24 )
2033
2034    ok = VRset("GB_CONDET2", "Left",   margin )
2035    ok = VRset("GB_CONDET2", "Top",    245 + marginx2)
2036    ok = VRset("GB_CONDET2", "Width",  rpane_width - marginx2)
2037    ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
2038
2039    ok = VRset("CN_CONDET",  "Top",    margin )
2040    ok = VRset("CN_CONDET",  "Left",   margin )
2041    ok = VRset("CN_CONDET",  "Width",  VRGet("GB_CONDET2","Width")  - marginx2)
2042    ok = VRset("CN_CONDET",  "Height", VRGet("GB_CONDET2","Height") - marginx2)
2043
2044    ok = VRset("PB_CONDET_SAVE", "Left", margin )
2045    ok = VRset("PB_CONDET_SAVE", "Top",  pane_height - pbtn_height - marginx2      )
2046    ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2047    ok = VRset("PB_CONDET_LOAD", "Top",  pane_height - pbtn_height - marginx2      )
2048
2049    /* Dialog stuff */
2050    ok = VRSet("GB_DIALOG", "Top",    marginx2      )
2051    ok = VRSet("GB_DIALOG", "Left",   split_left + 60 )
2052    ok = VRset("GB_DIALOG", "Height", pane_height     )
2053    ok = VRset("GB_DIALOG", "Width",  rpane_width     )
2054
2055    ok = VRset("GB_DIALOG3", "Top",    margin )
2056    ok = VRset("GB_DIALOG3", "Left",   margin )
2057    ok = VRset("GB_DIALOG3", "Height", 245    )
2058    ok = VRset("GB_DIALOG3", "Width",  rpane_width - marginx2)
2059
2060    ok = VRset("DT_DIALOG", "Top",   8 )
2061    ok = VRset("DT_DIALOG", "Left",  8 )
2062    ok = VRset("DT_DIALOG", "Width", (rpane_width - marginx2) - 24 )
2063
2064    ok = VRset("PB_MOUNT",      "Left", margin )
2065    ok = VRset("PB_MOUNT",      "Top",  pane_height - pbtn_height - marginx2)
2066    ok = VRset("PB_EDITCANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
2067    ok = VRset("PB_EDITCANCEL", "Top",  pane_height - pbtn_height - marginx2)
2068
2069    ok = VRset("GB_SHARE", "Left",  margin )
2070    ok = VRset("GB_SHARE", "Top",   245 + marginx2)
2071    ok = VRset("GB_SHARE", "Width", rpane_width - marginx2)
2072
2073    ok = VRset("GB_AUTH", "Left",  margin )
2074    ok = VRset("GB_AUTH", "Top",   245 + (margin * 3) + VRGet("GB_SHARE","Height"))
2075    ok = VRset("GB_AUTH", "Width", rpane_width - marginx2)
2076
2077    ok = VRset("GB_MPOINT","Left",   margin )
2078    ok = VRset("GB_MPOINT","Top",    245 + (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
2079    ok = VRset("GB_MPOINT","Width",  rpane_width - marginx2)
2080
2081    ok = VRset("SPLIT_Main", "Visible", 1           )
2082    ok = VRset("SPLIT_Main", "Top",     marginx2  )
2083    ok = VRset("SPLIT_Main", "Height",  pane_height )
2084
2085    ok = VRSet("GB_STATUSBAR", "Left",  margin )
2086    ok = VRSet("GB_STATUSBAR", "Top",   main_iheight - sbar_height - margin )
2087    ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width      )
2088
2089    ok = VRset("DT_STATUSBAR", "Top",   12 )
2090    ok = VRset("DT_STATUSBAR", "Left",  12 )
2091    ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
2092    ok = VRset("Main","Painting", 1)
2093
2094    /* check and empty event queue, trash spurious resize events */
2095    EventString = ''
2096    TrashedResize = 0
2097
2098    do until EventString = 'nop'
2099        EventString = VREvent('N')
2100        if EventString <> 'nop' then do
2101            if EventString = 'CALL Main_Resize' then TrashedResize = 1
2102                                                else interpret eventString
2103        end
2104    end
2105    if TrashedResize then CALL Main_Resize
2106
2107    IF options.!debug == 1 THEN SAY time()' Main_Resize done'
2108return
2109/*:VRX         Menu_Context_ChangeView_Click
2110*/
2111Menu_Context_ChangeView_Click:
2112    ok = VRSet("Cn_Current","View","NameTree")
2113return
2114
2115/*:VRX         Menu_Context_Detach_All_Click
2116*/
2117Menu_Context_Detach_All_Click:
2118    ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
2119    do um = 1 to umrh.0
2120        ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
2121        call PB_DETACH_Click
2122    end
2123    drop um umrh.
2124return
2125
2126/*:VRX         Menu_Context_Detach_Click
2127*/
2128Menu_Context_Detach_Click:
2129    call PB_DETACH_Click
2130return
2131
2132/*:VRX         Menu_Context_Edit_Click
2133*/
2134Menu_Context_Edit_Click:
2135    IF options.!debug == 1 THEN SAY time()' Menu_Context_Edit_Click started'
2136    options.!editmode = 1
2137    if \VRGet("Menu_View_Dialog","Checked") then call Menu_View_Dialog_Click
2138    CALL VRSet "PB_EDITCANCEL","Visible", 1
2139    CALL VRSet "PB_UNMOUNT","Enabled", 0
2140    CALL VRSet "PB_SAVE","Enabled", 0
2141    CALL VRSet "PB_LOAD","Enabled", 0
2142    CALL NLVSetText "DT_DIALOG","Caption",33
2143    CALL VRSet "GB_CURRENT", "ENABLED", 0
2144
2145    ok = VRSet("CB_MOUNT","Value","")
2146    ok = VRSet("CB_MOUNT","Selected",1)
2147    ok = VRSet("CB_MOUNT","Value",mtype.1)
2148
2149    parse var p_string p_domain':\\'p_server'\'p_share
2150
2151    /* IF options.!debug == 1 THEN SAY time()' '||p_domain */
2152
2153    IF options.!debug == 1 THEN SAY time()' data   '||data
2154    IF options.!debug == 1 THEN SAY time()' domain '||p_domain
2155    IF options.!debug == 1 THEN SAY time()' server '||p_server
2156    IF options.!debug == 1 THEN SAY time()' share  '||p_share
2157    IF options.!debug == 1 THEN SAY time()' string '||p_string
2158
2159
2160    CALL VRSet "EF_SHARE",  "VALUE", p_share
2161    CALL VRSet "EF_SERVER", "VALUE", p_server
2162    CALL VRSet "EF_NETWORK","VALUE", p_domain
2163
2164    /* IF options.!debug == 1 THEN SAY time()' '||p_node */
2165    parse var p_node p_drive'\'p_directory'\'
2166    CALL VRSet "CB_DRIVES", "Value", p_drive
2167    CALL VRSet "EF_DIRECTORY", "Value", p_directory
2168    IF options.!debug == 1 THEN SAY time()' Menu_Context_Edit_Click done'
2169return
2170
2171/*:VRX         Menu_Context_Open_Click
2172*/
2173Menu_Context_Open_Click:
2174    ok = VRSet("Menu_Context_Open_Default","Visible",0)
2175return
2176
2177/*:VRX         Menu_Context_Open_Default_Click
2178*/
2179Menu_Context_Open_Default_Click:
2180    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Click started"
2181    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2182    PARSE VAR userdata mountpoint ';' mounts ';' .
2183
2184    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2185
2186    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
2187
2188    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Click done"
2189return
2190
2191/*:VRX         Menu_Context_Open_Detail_Click
2192*/
2193Menu_Context_Open_Detail_Click:
2194    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click started"
2195    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2196    PARSE VAR userdata mountpoint ';' mounts ';' .
2197
2198    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2199
2200    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
2201
2202    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click done"
2203return
2204
2205/*:VRX         Menu_Context_Open_Icon_Click
2206*/
2207Menu_Context_Open_Icon_Click:
2208    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Icon_Click started"
2209    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2210    PARSE VAR userdata mountpoint ';' mounts ';' .
2211
2212    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2213
2214    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
2215
2216    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Icon_Click done"
2217return
2218
2219/*:VRX         Menu_Context_Open_Settings_Click
2220*/
2221Menu_Context_Open_Settings_Click:
2222    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_DetailsClick started"
2223    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2224    PARSE VAR userdata mountpoint ';' mounts ';' .
2225
2226    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2227
2228    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
2229
2230    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click done"
2231return
2232
2233/*:VRX         Menu_Context_Open_Splitview_Click
2234*/
2235Menu_Context_Open_Splitview_Click:
2236    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Splitview_Click started"
2237    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2238    PARSE VAR userdata mountpoint ';' mounts ';' .
2239
2240    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2241
2242    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
2243
2244    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Splitview_Click done"
2245return
2246
2247/*:VRX         Menu_Context_Open_Tree_Click
2248*/
2249Menu_Context_Open_Tree_Click:
2250    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Tree_Click started"
2251    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2252    PARSE VAR userdata mountpoint ';' mounts ';' .
2253
2254    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2255
2256    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
2257
2258    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Tree_Click done"
2259return
2260
2261/*:VRX         Menu_Context_Refresh_Click
2262*/
2263Menu_Context_Refresh_Click:
2264    CALL Refresh
2265return
2266
2267/*:VRX         Menu_Context_Unmount_Click
2268*/
2269Menu_Context_Unmount_Click:
2270    call PB_UNMOUNT_Click
2271return
2272
2273/*:VRX         Menu_File_Advanced_Click
2274*/
2275Menu_File_Advanced_Click:
2276    call PB_ADVANCED_Click
2277return
2278
2279/*:VRX         Menu_File_Autostart_Activate_Click
2280*/
2281Menu_File_Autostart_Activate_Click:
2282    call PB_AUTOSTART_Click
2283return
2284
2285/*:VRX         Menu_File_Autostart_Click
2286*/
2287Menu_File_Autostart_Click:
2288
2289return
2290
2291/*:VRX         Menu_File_Autostart_Deactivate_Click
2292*/
2293Menu_File_Autostart_Deactivate_Click:
2294    ok = SysDestroyObject("<EVFSGUI_AUTOSTART>")
2295    IF ok == 1 THEN do
2296        Text = NLVGetMessage( 79 )
2297        if Text = "" then Text = '[Autostart object created successfully]'
2298        CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
2299    end
2300    ELSE do
2301        Text = NLVGetMessage( 78 )
2302        if Text = "" then Text = '[Could find Autostart object]'
2303        Title = NLVGetMessage( 5 )
2304        if Title = "" then Title = '[Error]'
2305        CALL VRMessage 'Main', Text, Title, 'E'
2306    end
2307return
2308
2309/*:VRX         Menu_File_Close_Click
2310*/
2311Menu_File_Close_Click:
2312    call PB_CLOSE_Click
2313return
2314
2315/*:VRX         Menu_File_Load_Click
2316*/
2317Menu_File_Load_Click:
2318    call PB_LOAD_Click
2319return
2320
2321/*:VRX         Menu_File_Save_Click
2322*/
2323Menu_File_Save_Click:
2324    call PB_CONDET_SAVE_Click
2325return
2326
2327/*:VRX         Menu_File_Settings_Click
2328*/
2329Menu_File_Settings_Click:
2330    adv_changed = 0
2331    CALL VRLoadSecondary "SW_SETTINGS", "W"
2332    IF adv_changed == 1 THEN DO
2333        advanced.!logfile   = adv_logfile
2334        advanced.!loglevel  = adv_loglevel
2335        advanced.!browseauth= adv_browseauth
2336        advanced.!browseimme= adv_browseimme
2337        advanced.!debug     = adv_debug
2338        advanced.!special   = adv_special
2339        advanced.!savepassive=adv_savepassive
2340        advanced.!broadcast  =adv_broadcast
2341    END
2342return
2343
2344/*:VRX         Menu_Help_About_Click
2345*/
2346Menu_Help_About_Click:
2347    CALL VRMessage 'Main', VRGet("Main", "HintText")||'0D0A'x||'(c) 2007-2010 Alex Taylor and Herwig Bauernfeind',NLVGetMessage( 1 ), 'I'
2348return
2349
2350/*:VRX         Menu_Help_Extended_Click
2351*/
2352Menu_Help_Extended_Click:
2353    call PB_HELP_Click
2354return
2355
2356/*:VRX         Menu_Selected_Connect_Click
2357*/
2358Menu_Selected_Connect_Click:
2359    call PB_CONNECT_Click
2360return
2361
2362/*:VRX         Menu_Selected_Default_Workgroup_Click
2363*/
2364Menu_Selected_Default_Workgroup_Click:
2365    workgroupname = VRMethod("CN_smbtree","GetRecordAttr",SMBObj.rh,"Caption")
2366    ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
2367return
2368
2369/*:VRX         Menu_Selected_Info_Click
2370*/
2371Menu_Selected_Info_Click:
2372    IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click started'
2373
2374    ok = VRMethod( "CN_smbtree", "GetRecordList", "SourceOrSelected", "SelRH." )
2375    if SelRH.0 = 0 then do
2376        IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click aborted'
2377        return
2378    end
2379
2380    call _GetSMBObjectProperties SelRH.1
2381   
2382    IF options.!debug == 1 THEN say '  'samba.!smbclientexe' -L "'SMBObj.resname'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
2383    address cmd samba.!smbclientexe' -L "'SMBObj.resname'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
2384    infoline = linein(samba.!msg)
2385    if word(infoline,1) = "creating" then do /* upcase tables are missing */
2386        say "Missing upcase tables detected!"
2387        infoline = linein(samba.!msg)
2388        infoline = linein(samba.!msg)
2389    end
2390    IF options.!debug == 1 THEN say '  Response = "'Infoline'"'
2391    ok = stream(samba.!msg,'c','close')
2392    ok = SysFileDelete(samba.!msg)
2393
2394    window = VRLoadSecondary( "SW_INFO", "W" )
2395    IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click done'
2396return
2397
2398/*:VRX         Menu_Selected_Remove_Click
2399*/
2400Menu_Selected_Remove_Click:
2401    ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
2402    if selrec.0 = 0 then return
2403
2404    do I = 1 to selrec.0
2405        if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = '#68:PMWP.DLL' then do
2406            CALL VRMethod 'CN_CONDET', 'RemoveRecord', selrec.I
2407        end
2408        else do
2409            mountpoint = VRMethod('CN_CONDET', "GetFieldData", selrec.I, cd.mpointfh)
2410            mpidx = VRMethod('CN_CONDET', "GetFieldData", selrec.I, cd.mpidxfh)
2411            if mpidx = 1 then do
2412                btns.0 = 2
2413                btns.1 = NLVGetMessage( 6 )
2414                btns.2 = NLVGetMessage( 7 )
2415                confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
2416                IF confirm \= 1 THEN RETURN
2417
2418                dyn ="ok = "fs.!prefix"RxUnmount( mountpoint, mpidx )"
2419                IF options.!debug == 1 THEN SAY time()' '||dyn
2420                interpret dyn; drop dyn
2421                CALL VRMethod 'CN_CONDET', 'RemoveRecord', selrec.I
2422                CALL Refresh
2423            end
2424            else do
2425                CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
2426            end
2427        end
2428    end
2429return
2430
2431/*:VRX         Menu_Selected_Retry_Click
2432*/
2433Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. vfs. fs. advanced. cd. samba.
2434
2435    ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
2436    if srcrec.0 = 0 then return
2437
2438    srcrec = srcrec.1
2439
2440    p_mpoint    = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
2441
2442    p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.WorkgroupFH)
2443    p_server    = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
2444    p_share     = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
2445    p_user      = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
2446    p_password  = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
2447
2448    ShareLevel = 1
2449    if p_share     = "" then ShareLevel = 2
2450    if p_server    = "" then ShareLevel = 3
2451    if p_workgroup = "" then ShareLevel = 4
2452
2453    ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
2454    ok = VRset("CB_MOUNT"  , "Value", mtype.sharelevel)
2455
2456    ok = VRset("EF_SERVER" ,  "Value", p_server)
2457    ok = VRset("EF_SHARE"  ,  "Value", p_share)
2458    ok = VRset("EF_NETWORK",  "Value", p_workgroup)
2459    ok = VRset("EF_USER"   ,  "Value", p_user)
2460    ok = VRset("EF_PASSWORD", "Value", p_password)
2461
2462    parse var p_mpoint p_drv '\' p_dir
2463
2464    p_dir = strip(p_dir,'T','\')
2465
2466    ok = VRset("CB_DRIVES"      ,  "Value", p_drv)
2467    ok = VRset("EF_DIRECTORY"   ,  "Value", p_dir)
2468
2469    CALL PB_MOUNT_Click
2470
2471    if VRMethod( 'CN_CONDET', "ValidateRecord", srcRec) = 1 then do
2472        if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = '#68:PMWP.DLL' then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
2473    end
2474return
2475
2476/*:VRX         Menu_View_Buttons_Click
2477*/
2478Menu_View_Buttons_Click:
2479    current_height = VRGet("Main", "Height")
2480    buttons_height = margin * 2 + 400
2481    if settings.!buttonson = 1 then do
2482        ok = VRSet("Menu_View_Buttons","Checked",0)
2483        ok = VRset("GB_Buttons","Visible", 0)
2484        options.!buttondelta = 0
2485        settings.!buttonson = 0
2486        new_height = current_height - buttons_height
2487    end
2488    else do
2489        ok = VRSet("GB_Buttons","Visible", 1)
2490        ok = VRSet("Menu_View_Buttons","Checked",1)
2491        options.!buttondelta = buttons_height
2492        settings.!buttonson = 1
2493        new_height = current_height + buttons_height
2494    end
2495
2496    ok = VRSet("Main", "Height", new_height )
2497return
2498
2499/*:VRX         Menu_View_ConDet_Click
2500*/
2501Menu_View_ConDet_Click:
2502    if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
2503
2504    ok = VRset("GB_SMBTREE","Visible",  0)
2505    ok = VRset("GB_SMBTREE","Painting", 0)
2506    ok = VRset("GB_Dialog", "Visible",  0)
2507    ok = VRset("GB_Dialog", "Painting", 0)
2508    ok = VRset("GB_CONDET", "Visible",  1)
2509    ok = VRset("GB_CONDET", "Painting", 1)
2510
2511    ok = VRSet("Menu_View_SmbTree","Checked",  0)
2512    ok = VRSet("Menu_View_Dialog", "Checked",  0)
2513    ok = VRSet("Menu_View_ConDet", "Checked",  1)
2514
2515    /* Hide any "foreign" menu entries */
2516    ok = VRSet("Menu_Selected_Connect", "Visible", 0)
2517return
2518
2519/*:VRX         Menu_View_Dialog_Click
2520*/
2521Menu_View_Dialog_Click:
2522    if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
2523
2524    ok = VRset("GB_SMBTREE","Visible", 0)
2525    ok = VRset("GB_SMBTREE","Painting", 0)
2526    ok = VRset("GB_CONDET", "Visible",  0)
2527    ok = VRset("GB_CONDET", "Painting", 0)
2528    ok = VRset("GB_Dialog", "Visible", 1)
2529    ok = VRset("GB_Dialog", "Painting", 1)
2530
2531    ok = VRSet("Menu_View_SmbTree","Checked", 0)
2532    ok = VRSet("Menu_View_ConDet", "Checked", 0)
2533    ok = VRSet("Menu_View_Dialog", "Checked", 1)
2534
2535    ok = VRSet("Menu_Selected_Remove", "Visible",  0)
2536    ok = VRSet("Menu_Selected_Retry",  "Visible",  0)
2537
2538    ok = VRSet("Menu_Selected_Connect", "Visible",  0)
2539
2540    call _DialogPopulate
2541return
2542
2543/*:VRX         Menu_View_MiniIcons_Click
2544*/
2545Menu_View_MiniIcons_Click:
2546    advanced.!bigicons = \advanced.!bigicons
2547    ok = VRset("CN_CURRENT", "MiniIcons", \advanced.!bigicons)
2548    ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
2549    ok = VRset("CN_CONDET",  "MiniIcons", \advanced.!bigicons)
2550    ok = VRset("Menu_View_MiniIcons",  "Checked", \advanced.!bigicons)
2551return
2552
2553/*:VRX         Menu_View_SmbTree_Click
2554*/
2555Menu_View_SmbTree_Click:
2556    if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
2557
2558    ok = VRset("GB_Dialog",  "Visible", 0)
2559    ok = VRset("GB_Dialog", "Painting", 0)
2560    ok = VRset("GB_CONDET", "Visible",  0)
2561    ok = VRset("GB_CONDET", "Painting", 0)
2562    ok = VRset("GB_SMBTREE","Painting", 1)
2563    ok = VRset("GB_SMBTREE","Visible",  1)
2564
2565    ok = VRSet("Menu_View_Dialog","Checked",  0)
2566    ok = VRSet("Menu_View_ConDet","Checked",  0)
2567    ok = VRSet("Menu_View_SmbTree","Checked", 1)
2568
2569    /* Hide any "foreign" menu entries */
2570    ok = VRSet("Menu_Selected_Remove", "Visible", 0)
2571    ok = VRSet("Menu_Selected_Retry",  "Visible", 0)
2572return
2573
2574/*:VRX         Mount
2575*/
2576Mount: PROCEDURE EXPOSE settings. options. vfs. fs. advanced. cd. samba.
2577    IF options.!debug == 1 THEN SAY time()' Mount procedure started'
2578    /* Set mouse pointer to wait - this operation might take a few seconds */
2579    call VRSet VRWindow(), 'Pointer', 'Wait'
2580
2581/*  Disabled because we merge profile now - in earlier revisions
2582    we replaced it but only for preexisting drives - this made only
2583    as long as we were unabled to detect double connections - this could be made an option!
2584    IF options.!autoload then do
2585        dyn = "ok = "fs.!prefix"RxDetach(vfs.!drive)"
2586        IF options.!debug == 1 THEN SAY time()' '||dyn
2587            interpret dyn; drop dyn
2588
2589        IF options.!debug == 1 THEN SAY time()' '||'Autoload Detach "'vfs.!drive'" =' ok
2590    end */
2591
2592    /* Attach the virtual drive - only if drive is not already attached */
2593    if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
2594        dyn = "ok = "fs.!prefix"RxAttach( vfs.!drive )"
2595        IF options.!debug == 1 THEN SAY time()' '||dyn
2596
2597        interpret dyn; drop dyn
2598
2599        IF options.!debug == 1 THEN SAY time()' '||'Attach "'vfs.!drive'" =' ok
2600    end
2601
2602    /* Create the mount point and store whether it was created or already existed */
2603    dyn = "CreateMP = "fs.!prefix"RxCreateMountPoint( vfs.!mountpoint )"
2604    IF options.!debug == 1 THEN SAY time()' '||dyn
2605    interpret dyn; drop dyn
2606
2607    IF options.!debug == 1 THEN SAY time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
2608
2609
2610    /* Build the resource parameter string */
2611    src = ''
2612    IF options.!workgroup  \= '' THEN src = src';WORKGROUP='options.!workgroup
2613    IF options.!server     \= '' THEN src = src';SERVER='options.!server
2614    IF options.!share      \= '' THEN src = src';SHARE='options.!share
2615    IF options.!user       \= '' THEN src = src';USER='options.!user
2616    IF options.!password   \= '' THEN src = src';PASSWORD='options.!password
2617    IF options.!spassword  \= '' THEN src = src';SPASSWORD='options.!spassword
2618    IF options.!master     \= '' THEN src = src';MASTER='options.!master
2619    IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
2620/*  IF options.!memlen     \= '' THEN src = src';MEMLEN='options.!memlen
2621    IF options.!logfile    \= '' THEN src = src';LOGFILE='options.!logfile
2622    IF options.!loglevel   \= '' THEN src = src';LOGLEVEL='options.!loglevel */
2623    IF options.!easupport  \= '' THEN src = src';EASUPPORT='options.!easupport
2624
2625    IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
2626
2627    parse var vfs.!mountpoint mpoint ';' .
2628    mpoint = strip(mpoint,'T','\')||'\'
2629
2630    if options.!master   = "" then options.!master   = "WORKGROUP"
2631    if options.!mtype    = "" then options.!mtype    = "1"
2632    if options.!loglevel = "" then options.!loglevel = "0"
2633    if options.!memlen   = "" then options.!memlen   = "2"
2634    if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
2635    if options.!password <> "" & options.!spassword = "" then do
2636        options.!spassword = c2x(options.!password)
2637        options.!password = ""
2638    end
2639
2640    hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
2641
2642    md5 = rexx_md5(hashstr)
2643
2644    CALL VRMethod 'CN_CONDET', 'GetRecordList', 'All', 'records.'
2645    DO i = 1 TO records.0
2646        hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
2647
2648        IF options.!debug == 1 THEN say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
2649        IF options.!debug == 1 THEN say mpoint'->'md5
2650
2651        if hash = md5 then do
2652            If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = '#64:PMWP.DLL' then do /* Same hash, status active */
2653                say "Double connection detected!!"
2654                if options.!spassword <> "" then upw = ":********"
2655                else upw = ""
2656                buttons.0 = 2
2657                buttons.1 = NLVGetMessage(9)
2658                buttons.2 = NLVGetMessage(3)
2659                Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
2660                if Answer = 2 then do
2661                    call VRSet VRWindow(), 'Pointer', '<default>'
2662                    say "Double connection - do not mount!!"
2663                    return
2664                end
2665            end
2666            else do /* Same hash, status passive - we have to remove it */
2667                ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
2668            end
2669        end
2670    end
2671
2672    cd.lastrh = ""
2673    ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
2674
2675    /* Now mount the resource */
2676    dyn ="ok = "fs.!prefix"RxMount('smbfs', vfs.!mountpoint, src, rwFlag)"
2677    IF options.!debug == 1 THEN SAY time()' '||dyn
2678    interpret dyn; drop dyn
2679
2680    IF options.!debug == 1 THEN SAY time()' '||'Mount "'vfs.!mountpoint'" =' ok
2681    if ok <> 0 then do
2682        if options.!password <> "" then upw = ":********"
2683            else upw = ""
2684        buttons.0 = 2
2685        buttons.1 = NLVGetMessage(2)
2686        buttons.2 = NLVGetMessage(37)
2687        Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36,  options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
2688        if Answer = 2 then do /* Show explanation */
2689            xx = VRMessage('Main', NLVGetMessage( 36,  options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint )||'0D0A'x||'0D0A'x||SysGetMessage(ok)||'0D0A'x||'0D0A'x||SysGetMessage(ok, 'OSO001H.MSG'), NLVGetMessage(37), 'W')
2690        end
2691        if cd.lastrh <> '' then do
2692            ok = VRMethod("CN_CONDET", "SetFieldData",  cd.lastrh, cd.statusfh, '#68:PMWP.DLL') /* Passive Connection icon */
2693            ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", '#68:PMWP.DLL') /* Passive Connection icon */
2694            ok = VRMethod("CN_CONDET", "SetFieldData",  cd.lastrh, cd.passwordfh, '') /* remove pain text password */
2695        end
2696
2697        /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
2698        if CreateMP = 0 & \advanced.!alwaysmp then do
2699            dyn ="ok = "fs.!prefix"RxDeleteMountPoint( vfs.!mountpoint )"
2700            interpret dyn
2701            IF options.!debug == 1 THEN SAY time()' '||'Remove "'vfs.!mountpoint'" = 'ok
2702        end
2703    end
2704    drop CreateMP /* not required anymore */
2705
2706/*  Obsolete - the IOCtl will not be implemented this way in the plugin
2707    The REXX function is present, but is has no counterpart in the plugin
2708    ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
2709    IF options.!debug == 1 THEN SAY time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
2710 */
2711    /* Set mouse pointer to default again */
2712    call VRSet VRWindow(), 'Pointer', '<default>'
2713    IF options.!debug == 1 THEN SAY time()' Mount procedure done'
2714RETURN ok
2715
2716/*:VRX         MyFreeDriveMap
2717*/
2718MyFreeDriveMap: procedure expose options. fs. samba.
2719    IF options.!debug == 1 THEN SAY time()' MyFreeDriveMap(proc) started'
2720    alldrives = "C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:"
2721/*  IF options.!debug == 1 THEN SAY time()' '||"SysDriveMap(USED) started" */
2722    useddrives= SysDriveMap("C:","USED")
2723/*  IF options.!debug == 1 THEN SAY time()' '||"SysDriveMap(USED) done" */
2724
2725    Alldr = words(alldrives)
2726    FreeDriveMap = ""
2727    do I = 1 to AllDr
2728        if word(alldrives,1) = word(useddrives,1) then do
2729            Useddrives = subword(useddrives,2)
2730            Alldrives = subword(Alldrives,2)
2731        end
2732        else do
2733            FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
2734            Alldrives = subword(Alldrives,2)
2735        end
2736    end
2737    IF options.!debug == 1 THEN SAY time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
2738return FreeDriveMap
2739/*:VRX         NoEVFSCALL
2740*/
2741NoEVFSCALL:
2742    CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
2743    signal Halt
2744RETURN
2745
2746/*:VRX         ParseCommandLine
2747*/
2748ParseCommandLine:
2749    IF options.!debug == 1 THEN SAY time()' ParseCommandLine() started'
2750    CmdLine = VRGet("Application","Commandline")
2751    upCmdLine = translate(CmdLine)
2752    IF options.!debug == 1 THEN SAY '  Commandline = "'CmdLine'"'
2753
2754    ForceNDFS = 0
2755    if wordpos('-NDFS',upCmdLine) > 0 then do
2756        IF options.!debug == 1 THEN SAY "  NDFS switch detected"
2757        CmdLine = delWord(CmdLine,wordpos('-NDFS',upCmdLine),1)
2758        upCmdLine = translate(CmdLine)
2759        ForceNDFS = 1
2760        CALL VRSet "PB_AutoStart","Visible", 0
2761    end
2762
2763    if wordpos('-AUTOCLOSE',upCmdLine) > 0 then do
2764        options.!autoclose = 1
2765        IF options.!debug == 1 THEN SAY "  AutoClose switch detected"
2766        CmdLine = delWord(CmdLine,wordpos('-AUTOCLOSE',upCmdLine),1)
2767        upCmdLine = translate(CmdLine)
2768    end
2769    if wordpos('-NOGUI',upCmdLine) > 0 then do
2770        options.!nogui = 1
2771        options.!autoclose = 1
2772        IF options.!debug == 1 THEN SAY "  -NOGUI switch detected"
2773        CmdLine = delWord(CmdLine,wordpos('-NOGUI',upCmdLine),1)
2774        upCmdLine = translate(CmdLine)
2775    end
2776
2777    Profile = strip(CmdLine,,'"')
2778    if Profile <> "" then do
2779        Profile = strip(VRParseFilename(Profile,"DPNE"))
2780        options.!autoload   = 1
2781        IF options.!debug == 1 THEN SAY '  Profile = "'Profile'"'
2782        if \VRFileExists(Profile) then do
2783            CALL VRMessage 'Main', NLVGetMessage( 102, Profile ), NLVGetMessage( 1 ), 'E'
2784            /* Disable all switches in case of an error */
2785            options.!autoload  = 0
2786            options.!autoclose = 0
2787            options.!nogui     = 0
2788        end
2789    end
2790    IF options.!debug == 1 THEN SAY time()' ParseCommandLine done'
2791return
2792
2793/*:VRX         ParseResourceData
2794*/
2795ParseResourceData: PROCEDURE EXPOSE userdata options. advanced. fs. cd. samba.
2796    PARSE ARG userdata, resdata
2797    IF options.!debug == 1 THEN SAY time()' ParseResourceData started'
2798    IF options.!debug == 1 THEN SAY '  receiving "'userdata'" "'resdata'" length ('length(resdata)')'
2799
2800/* WARNING! resdata has a maximal length of 255 and is truncated otherwise */
2801
2802/*  PARSE VAR resdata . ';WORKGROUP='p_domain';SERVER='p_server';SHARE='p_share';' . */
2803
2804    if left(word(resdata,1),5) <> "SMBFS" then do
2805        /* Support for other filesystems would come here! */
2806        userData = "UNKNOWN"
2807    end
2808    else do
2809        cd.lastrh = VRMethod("CN_CONDET","AddRecord")
2810        PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
2811
2812        p_mpoint = strip(p_mpoint,'T','\')||'\'
2813        p_rw     = word(resdata, words(resdata))
2814
2815        /* Workaround for truncated resdata string */
2816        if length(p_rw) > 1 then do
2817            /* The resdata string must have been truncated
2818               p_rw is already wrong and
2819               p_easupport will most likely be also wrong (look below for workaround!) */
2820            p_rw ="W" /* this is guessed only!!! */
2821            IF options.!debug == 1 THEN SAY '  WARNING! Detected truncated resdata string - shorten workgroup name, server name, share name until this message goes away!'
2822        end
2823        /* this should be done unconditionally if the resdata string is never truncated */
2824        else resdata  = left(resdata,length(resdata)-length(p_rw))
2825
2826        PARSE VAR resdata . 'WORKGROUP=' p_domain ';' .
2827        PARSE VAR resdata . 'SERVER=' p_server ';' .
2828        PARSE VAR resdata . 'SHARE=' p_share ';' .
2829        PARSE VAR resdata . 'USER=' p_user ';' .
2830        PARSE VAR resdata . ';PASSWORD=' p_password ';' .
2831        PARSE VAR resdata . 'SPASSWORD=' p_spassword ';' .
2832        PARSE VAR resdata . 'MASTER=' p_master ';' .
2833        PARSE VAR resdata . 'MASTERTYPE=' p_mtype ';' .
2834        PARSE VAR resdata . 'MEMLEN=' p_memlen ';' .
2835        PARSE VAR resdata . 'LOGFILE=' p_logfile ';' .
2836        PARSE VAR resdata . 'LOGLEVEL=' p_loglevel ';' .
2837        PARSE VAR resdata . 'EASUPPORT=' p_easupport ' '
2838
2839        if p_master   = "" then p_master   = "WORKGROUP"
2840        if p_mtype    = "" then p_mtype    = "1"
2841        if p_loglevel = "" then p_loglevel = "0"
2842        if p_memlen   = "" then p_memlen   = "2"
2843
2844        /* Also works around for a truncated resdata string! */
2845        if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
2846
2847        if p_password <> "" & p_spassword = "" then do
2848            p_spassword = c2x(p_password)
2849            p_password = ""
2850        end
2851
2852        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.mpointFH, p_mpoint, cd.mpidxfh, p_mpidx, cd.workgroupfh, p_domain, cd.serverfh, p_server, cd.sharefh, p_share, cd.userfh, p_user)
2853        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
2854        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.memlenfh, p_memlen, cd.easupportfh, p_easupport, cd.logfilefh, p_logfile, cd.loglevelfh, p_loglevel, cd.rwfh, p_rw)
2855        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, '#64:PMWP.DLL') /* Active */
2856        ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", '#64:PMWP.DLL') /* Active */
2857
2858        hashstr = p_mpoint' 'translate(p_domain)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
2859
2860        md5 = rexx_md5(hashstr)
2861
2862        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
2863
2864        SELECT
2865            WHEN p_share  == '' & p_server \= '' THEN DO   /* all shares on server */
2866                IF p_domain == '' THEN
2867                    userdata = userdata';\\'p_server'\*'
2868                ELSE
2869                    userdata = userdata';'p_domain':\\'p_server'\*'
2870            END
2871            WHEN p_server == '' & p_domain \= '' THEN    /* all servers in workgroup */
2872                userdata = userdata';'p_domain':\\*'
2873            WHEN p_server == '' & p_domain == '' THEN    /* all workgroups */
2874                userdata = userdata';*:\\*'
2875            OTHERWISE DO
2876                IF p_domain == '' THEN
2877                    userdata = userdata';\\'p_server'\'p_share
2878                ELSE
2879                    userdata = userdata';'p_domain':\\'p_server'\'p_share
2880            END
2881        END
2882    end
2883
2884    IF options.!debug == 1 THEN SAY '  returning "'userdata'"'
2885    IF options.!debug == 1 THEN SAY time()' ParseresdataData done'
2886RETURN userdata
2887
2888/*:VRX         PB_ADVANCED_Click
2889*/
2890PB_ADVANCED_Click:
2891    adv_changed = 0
2892    CALL VRLoadSecondary "SW_ADVANCED", "W"
2893    IF adv_changed == 1 THEN DO
2894        advanced.!memlen    = adv_memlen
2895        advanced.!easupport = adv_eas
2896        advanced.!readonly  = adv_readonly
2897        advanced.!alwaysmp  = adv_alwaysmp
2898    END
2899RETURN
2900
2901/*:VRX         PB_ADVCANCEL_Click
2902*/
2903PB_ADVCANCEL_Click:
2904
2905    adv_changed = 0
2906    CALL SW_ADVANCED_Close
2907
2908RETURN
2909
2910/*:VRX         PB_ADVHELP_Click
2911*/
2912PB_ADVHELP_Click:
2913    CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
2914return
2915
2916/*:VRX         PB_ADVOK_Click
2917*/
2918PB_ADVOK_Click:
2919
2920    adv_memlen     = VRGet( "SPB_MEMLEN",    "Value" )
2921    adv_eas        = VRGet( "CB_EAS",        "Set" )
2922    adv_readonly   = VRGet( "CB_READONLY",   "Set" )
2923    adv_alwaysmp   = VRGet( "CB_ALWAYSMP",   "Set" )
2924
2925    CALL SW_ADVANCED_Close
2926
2927return
2928
2929/*:VRX         PB_AUTOSTART_Click
2930*/
2931PB_AUTOSTART_Click: /* PROCEDURE EXPOSE settings. options. Profile fs. cd. advanced. samba. */
2932    options.!autostart = 1
2933
2934    Profile    = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
2935    ExeName    = VRParseFileName(VRget("Application","Program"),'DPNE')
2936    if ExeName = "" then do
2937        parse source . . script
2938        ExeName = VRParseFilename(script,'DP')'\EVFSGUI.EXE'
2939    end
2940    StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
2941    if StartupDir = "" then do
2942        parse source . . script
2943        StartUpDir = VRParseFilename(script,'DP')
2944    end
2945   
2946    ObjTitle   = NLVGetMessage( 59 )
2947    if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
2948
2949    CALL PB_SAVE_Click
2950
2951    rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
2952            'EXENAME='||ExeName||';'||,
2953            'PROGTYPE=PM;'||,
2954            'TITLE='ObjTitle';'||,
2955            'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
2956            'STARTUPDIR='StartupDir';'||,
2957            'NOPRINT=YES;'||,
2958            'HIDEBUTTON=DEFAULT;'||,
2959            'MINWIN=DEFAULT;'||,
2960            'CCVIEW=DEFAULT;'||,
2961            'DEFAULTVIEW=DEFAULT;'||,
2962            'OBJECTID=<EVFSGUI_AUTOSTART>',,
2963        'REPLACE' )
2964
2965    IF rc == 1 THEN do
2966        Text = NLVGetMessage( 60 )
2967        if Text = "" then Text = '[Created object in Autostart-Folder]'
2968        CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
2969    end
2970    ELSE do
2971        Text = NLVGetMessage( 61 )
2972        if Text = "" then Text = '[Could not create object in Autostart-Folder]'
2973        Title = NLVGetMessage( 5 )
2974        if Title = "" then Title = '[Error]'
2975        CALL VRMessage 'Main', Text, Title, 'E'
2976    end
2977
2978    options.!autostart = 0
2979RETURN
2980
2981/*:VRX         PB_CLOSE_Click
2982*/
2983PB_CLOSE_Click:
2984    CALL Quit
2985return
2986
2987/*:VRX         PB_CONDET_LOAD_Click
2988*/
2989PB_CONDET_LOAD_Click:
2990    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click started"
2991    call PB_LOAD_CLICK
2992    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click done"
2993RETURN
2994
2995/*:VRX         PB_CONDET_SAVE_Click
2996*/
2997PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. Profile fs.  cd. advanced. samba.
2998    IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_SAVE_Click started"
2999
3000    if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3001    ELSE filename = Profile
3002
3003    IF filename == '' THEN RETURN
3004
3005    IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3006        btns.0 = 2
3007        btns.1 = NLVGetMessage( 6 )
3008        if btns.1 = "" then btns.1 = '[Yes]'
3009        btns.2 = NLVGetMessage( 7 )
3010        if btns.2 = "" then btns.2 = '[No]'
3011        Title = NLVGetMessage( 53 )
3012        if Title = "" then Title = "[File exists]"
3013        Text = NLVGetMessage( 54, filename )
3014        if Text = "" then Text = "[File "filename" exists? Overwrite?]"
3015
3016        confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
3017        IF confirm \= 1 THEN RETURN
3018        CALL VRChAttr filename,, 'HSR'
3019        CALL VRDeleteFile filename
3020    END
3021
3022    CALL VRMethod 'CN_CONDET', 'GetRecordList', 'All', 'records.'
3023    DO i = 1 TO records.0
3024        resdata = ""
3025        resdata = resdata||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
3026        resdata = resdata||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
3027        resdata = resdata||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3028        resdata = resdata||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3029        resdata = resdata||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3030        resdata = resdata||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
3031        resdata = resdata||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3032        resdata = resdata||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3033        resdata = resdata||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3034        resdata = resdata||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
3035        resdata = resdata||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
3036        resdata = resdata||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
3037        resdata = resdata||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
3038/*      resdata = resdata||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
3039        resdata = resdata||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
3040        resdata = resdata||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
3041        resdata = resdata||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
3042        resdata = resdata||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
3043        call lineout filename, resdata
3044    END
3045    CALL STREAM filename, 'C', 'CLOSE'
3046
3047    if options.!autostart == 0 THEN do
3048        Title = NLVGetMessage( 51 )
3049        if Title = "" then Title = "[Profile saved]"
3050        Text = NLVGetMessage( 52, filename )
3051        if Text = "" then Text = "[Profile saved to "filename"!]"
3052        CALL VRMessage 'Main', Text , Title, 'I'
3053    end
3054
3055    IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_SAVE_Click done"
3056RETURN
3057
3058/*:VRX         PB_CONNECT_Click
3059*/
3060PB_CONNECT_Click: PROCEDURE EXPOSE settings. options. fs. advanced. cd. samba.
3061    IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click started"
3062
3063    ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Selected", "SelRH." )
3064
3065    if SelRH.0 = 0 then do
3066        IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click aborted"
3067        return
3068    end
3069
3070    p_workgroup = ''
3071    p_server    = ''
3072    p_share     = ''
3073
3074    srcFile = ""
3075    srcCtn  = VRGet("CN_SMBTREE","Self")
3076    srcRec  = SelRH.1
3077    trgCtn  = VRGet("CN_CURRENT","Self")
3078    trgRec  = ""
3079
3080    IF options.!debug == 1 THEN do
3081        say '  srcCtn      = "'srcCtn'"'
3082        if srcCtn <> "" then say '  srcCtn name = "'VRGet(srcCtn,'Name')'"'
3083        say '  srcRec      = "'srcRec'"'
3084        say '  trgCtn      = "'trgCtn'"'
3085        if trgCtn <> "" then say '  trgCtn name = "'VRGet(trgCtn,'Name')'"'
3086        say '  trgRec      = "'trgRec'"'
3087    end
3088
3089    ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
3090
3091    DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
3092    ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
3093
3094    if ParentRH = "" then do /* A workgroup was dragged */
3095        say "Workgroup dragged!"
3096        parse var DragCapt p_workgroup '0D0A'x .
3097        p_workgroup = strip(p_workgroup)
3098        ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
3099        ok = VRSet("EF_SERVER","Value","")
3100        ok = VRSet("EF_SHARE","Value","")
3101
3102        ShareLevel = 3
3103    end
3104    else do
3105        ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
3106        GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
3107
3108        if GParentRH = "" then do /* A server was dragged */
3109            say "Server dragged!"
3110            parse var ParDragCapt p_workgroup '0D0A'x .
3111            ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
3112            p_workgroup = strip(p_workgroup)
3113
3114            parse var DragCapt p_server '0D0A'x .
3115            p_server = strip(p_server)
3116            ok = VRSet("EF_SERVER","Value",strip(p_server))
3117            ok = VRSet("EF_Share","Value","")
3118
3119            ShareLevel = 2
3120        end
3121        else do /* A share was dragged */
3122            say "Share dragged!"
3123            GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
3124
3125            parse var GParDragCapt p_workgroup '0D0A'x .
3126            p_workgroup = strip(p_workgroup)
3127            ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
3128
3129            parse var ParDragCapt p_server '0D0A'x .
3130            p_server = strip(p_server)
3131            ok = VRSet("EF_SERVER","Value",strip(p_server))
3132
3133            parse var DragCapt p_share '0D0A'x .
3134            p_share = strip(p_share)
3135            ok = VRSet("EF_Share","Value",strip(p_share))
3136
3137            ShareLevel = 1
3138        end
3139    end
3140
3141    say 'p_workgroup = "'p_workgroup'"'
3142    say 'p_server   = "'p_server'"'
3143    say 'p_share = "'p_share'"'
3144
3145    ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
3146    call CB_MOUNT_Change
3147
3148    if trgRec = "" then do
3149        window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
3150        if VRGet("CB_DRIVES","Value") = "" then return
3151    end
3152    else do
3153
3154        TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
3155
3156        parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
3157
3158        do while parTrgRH <> ""
3159            partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
3160            TargetString = partrgCapt||'\'||TargetString
3161            parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
3162        end
3163        say 'TargetString = "'TargetString'"'
3164        ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
3165        ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
3166    end
3167
3168    window = VRLoadSecondary( "SW_LOGIN", "W" )
3169
3170    call PB_MOUNT_CLICK
3171
3172    IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click done"
3173RETURN
3174
3175/*:VRX         PB_DETACH_Click
3176*/
3177PB_DETACH_Click: PROCEDURE EXPOSE settings. options. fs. cd. samba.
3178    IF options.!debug == 1 THEN SAY time()' '||"PB_DETACH_Click started"
3179    CALL VRMethod 'CN_CURRENT', 'GetRecordList', 'Selected', 'select.'
3180    IF select.0 < 1 THEN RETURN
3181
3182    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', select.1, 'UserData')
3183    PARSE VAR userdata mountpoint ';' mounts ';' .
3184    drive = STRIP( mountpoint, 'T', '\')
3185
3186    btns.0 = 2
3187    btns.1 = NLVGetMessage( 6 )
3188    btns.2 = NLVGetMessage( 7 )
3189    confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3190    IF confirm \= 1 THEN RETURN
3191
3192    /* TODO: ??  Unmount & delete all child mountpoints? */
3193
3194    /* Unmount any resources */
3195    DO i = 1 TO mounts
3196        dyn ="ok = "fs.!prefix"RxUnmount( mountpoint, i-1 )"
3197        IF options.!debug == 1 THEN SAY time()' '||dyn
3198        interpret dyn; drop dyn
3199/* IF options.!debug == 1 THEN SAY time()' '||'Unmount resource' i-1 '=' ok */
3200    END
3201
3202    dyn ="ok = "fs.!prefix"RxDetach( drive )"
3203    IF options.!debug == 1 THEN SAY time()' '||dyn
3204    interpret dyn; drop dyn
3205/* IF options.!debug == 1 THEN SAY time()' '||'Detach' drive '=' ok */
3206
3207    CALL Refresh
3208    IF options.!debug == 1 THEN SAY time()' '||"PB_DETACH_Click done"
3209RETURN
3210
3211/*:VRX         PB_EDITCANCEL_Click
3212*/
3213PB_EDITCANCEL_Click:
3214    options.!editmode = 0
3215    CALL VRSet "PB_UNMOUNT","Enabled", 1
3216    CALL VRSet "PB_SAVE","Enabled", 1
3217    CALL VRSet "PB_LOAD","Enabled", 1
3218    CALL VRSet "GB_CURRENT", "ENABLED", 1
3219    ok = VRSet("PB_EDITCANCEL","Visible", 0)
3220    CALL NLVSetText 'DT_DIALOG',        'Caption', 13
3221RETURN 0
3222
3223/*:VRX         PB_HELP_Click
3224*/
3225PB_HELP_Click:
3226    CALL VRMethod 'Main', 'InvokeHelp'
3227return
3228
3229/*:VRX         PB_INFO_OK_Click
3230*/
3231PB_INFO_OK_Click:
3232    call SW_INFO_Close
3233RETURN
3234
3235/*:VRX         PB_LOAD_Click
3236*/
3237PB_LOAD_Click: PROCEDURE EXPOSE settings. options. advanced. vfs. Profile fs. cd. samba.
3238    IF options.!autoload == 1 then filename = Profile
3239    else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3240    IF filename == '' THEN RETURN
3241    IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3242        CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3243        RETURN
3244    END
3245
3246    CALL LINEIN filename, 1, 0
3247    DO WHILE LINES( filename )
3248        PARSE VALUE LINEIN( filename ) WITH node resource rwFlag
3249
3250        vfs.!drive      = FILESPEC('DRIVE', node )
3251        vfs.!mountpoint = STRIP( node, 'T', '\')
3252
3253        /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3254        if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3255
3256
3257        PARSE VAR resource . 'WORKGROUP=' workgroup ';' .
3258        PARSE VAR resource . 'SERVER=' server ';' .
3259        PARSE VAR resource . 'SHARE=' share ';' .
3260        PARSE VAR resource . 'USER=' user ';' .
3261        PARSE VAR resource . 'PASSWORD=' password ';' .
3262        PARSE VAR resource . 'SPASSWORD=' spassword ';' .
3263        PARSE VAR resource . 'MASTER=' master ';' .
3264        PARSE VAR resource . 'MASTERTYPE=' mtype ';' .
3265/*      PARSE VAR resource . 'MEMLEN=' memlen ';' .
3266        PARSE VAR resource . 'LOGFILE=' logfile ';'.
3267        PARSE VAR resource . 'LOGLEVEL=' loglevel ';' . */
3268        PARSE VAR resource . 'EASUPPORT=' easupport .
3269
3270        options.!workgroup  = workgroup
3271        options.!server     = server
3272        options.!share      = share
3273        options.!user       = user
3274        options.!password   = password
3275        options.!spassword  = spassword
3276        options.!master     = master
3277        options.!mastertype = mtype
3278/*      options.!memlen     = memlen
3279        options.!logfile    = logfile
3280        options.!loglevel   = loglevel */
3281        options.!easupport  = easupport
3282
3283        IF rwFlag == 'R' THEN
3284            options.!readonly = 1
3285        ELSE
3286            options.!readonly = 0
3287
3288        CALL Mount
3289
3290    END
3291    CALL STREAM filename, 'C', 'CLOSE'
3292
3293    options.!autoload = 0
3294
3295    CALL Refresh
3296RETURN
3297
3298/*:VRX         PB_LOGIN_CANCEL_Click
3299*/
3300PB_LOGIN_CANCEL_Click:
3301    call SW_LOGIN_Close
3302RETURN 0
3303
3304/*:VRX         PB_LOGIN_OK_Click
3305*/
3306PB_LOGIN_OK_Click:
3307    ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
3308    ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
3309
3310    call SW_LOGIN_Close
3311RETURN
3312
3313/*:VRX         PB_MOUNT_Click
3314*/
3315PB_MOUNT_Click:
3316    IF options.!debug == 1 THEN SAY time()' '||"PB_MOUNT_Click started"
3317    ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
3318say "network = "network
3319    if options.!editmode = 1 then do
3320        CALL PB_UNMOUNT_Click
3321        options.!editmode = 0
3322        CALL NLVSetText 'DT_DIALOG',        'Caption', 13
3323        CALL VRSet "PB_UNMOUNT","Enabled", 1
3324        CALL VRSet "PB_SAVE","Enabled", 1
3325        CALL VRSet "PB_LOAD","Enabled", 1
3326        CALL VRSet "GB_CURRENT", "ENABLED", 1
3327    end
3328
3329    options.!workgroup  = ''
3330    options.!server     = ''
3331    options.!share      = ''
3332    options.!user       = ''
3333    options.!password   = ''
3334    options.!master     = ''
3335    options.!mastertype = ''
3336    options.!memlen     = advanced.!memlen
3337    options.!easupport  = advanced.!easupport
3338    options.!readonly   = advanced.!readonly
3339    options.!loglevel   = advanced.!loglevel
3340    options.!logfile    = advanced.!logfile
3341
3342    vfs.!drive      = ''
3343    vfs.!mountpoint = ''
3344
3345    stype    = VRGet( "CB_MOUNT",            "Selected" )
3346    share    = STRIP( VRGet( "EF_SHARE",     "Value" ))
3347    server   = STRIP( VRGet( "EF_SERVER",    "Value" ))
3348    network  = STRIP( VRGet( "EF_NETWORK",   "Value" ))
3349    mtype    = VRGet( "CHK_MTYPE",           "Set" )
3350    userid   = STRIP( VRGet( "EF_USER",      "Value" ))
3351    password = STRIP( VRGet( "EF_PASSWORD",  "Value" ))
3352    mdrive   = VRGet( "CB_DRIVES",           "SelectedText" )
3353    if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
3354    mpath    = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
3355
3356    IF ( stype < 1 | stype > 4 ) THEN stype = 1
3357
3358    /* The required/optional/ignored parameters depend on the type of mount
3359     * requested.  (Note, however, that the user, password, easupport and
3360     * memlen parameters are always optional.)
3361     */
3362    SELECT
3363        /* Scenario 1: Mount a single share.
3364         *             Required: share, server
3365         *             Optional: workgroup
3366         *             Unused:   master, mastertype
3367         */
3368        WHEN stype = 1 THEN DO
3369            IF server == '' | share == '' THEN DO
3370                /* error */
3371                RETURN 1
3372            END
3373            options.!server    = server
3374            options.!share     = share
3375            options.!workgroup = network
3376        END
3377
3378        /* Scenario 2: Mount all shares on a server.
3379         *             Required: server
3380         *             Optional: workgroup
3381         *             Unused:   share, master, mastertype
3382         */
3383        WHEN stype = 2 THEN DO
3384            IF server == '' THEN DO
3385                /* error */
3386                RETURN 1
3387            END
3388            options.!server = server
3389            options.!workgroup = network
3390        END
3391
3392        /* Scenario 3: Mount all servers in a workgroup.
3393         *             Required: workgroup
3394         *             Optional: -
3395         *             Unused:   share, server, master, mastertype
3396         */
3397        WHEN stype = 3 THEN DO
3398            IF workgroup == '' THEN DO
3399                /* error */
3400                RETURN 1
3401            END
3402            options.!workgroup  = network
3403        END
3404
3405        /* Scenario 4: Mount all workgroups known to a master.
3406         *             Required: master, mastertype
3407         *             Optional: -
3408         *             Unused:   share, server, workgroup
3409         */
3410        WHEN stype = 4 THEN DO
3411            IF master == '' | mastertype == '' THEN DO
3412                /* error */
3413                RETURN 1
3414            END
3415            options.!master     = network
3416            options.!mastertype = mtype
3417        END
3418    END
3419
3420    options.!user     = userid
3421    options.!password = password
3422
3423    vfs.!drive      = mdrive
3424    vfs.!mountpoint = mdrive'\'mpath
3425
3426    CALL Mount
3427    CALL Refresh
3428    ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
3429    IF options.!debug == 1 THEN SAY time()' '||"PB_MOUNT_Click done"
3430RETURN 0
3431
3432/*:VRX         PB_NEWMOUNTPOINTCANCEL_Click
3433*/
3434PB_NEWMOUNTPOINTCANCEL_Click:
3435    ok = VRSet("CB_DRIVES","Value","")
3436    ok = VRSet("EF_DIRECTORY","Value","")
3437    call SW_MOUNTPOINT_Close
3438RETURN 0
3439
3440/*:VRX         PB_NEWMOUNTPOINTOK_Click
3441*/
3442PB_NEWMOUNTPOINTOK_Click:
3443    ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
3444    ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
3445    advanced.!readonly  = VRGet("CB_READONLY1","Set")
3446    advanced.!easupport = VRGet("CB_EAS1","Set")
3447    advanced.!alwaysmp  = VRGet("CB_ALWAYSMP1","Set")
3448say "advanced.!readonly = "advanced.!readonly
3449say "options.!readonly  = "options.!readonly
3450    call SW_MOUNTPOINT_Close
3451RETURN
3452
3453/*:VRX         PB_PROGRESS_ABORT_Click
3454*/
3455PB_PROGRESS_ABORT_Click:
3456    options.!autoload = 0
3457    options.!autoclose = 0
3458    call VRSet 'Main',    'Visible', 1
3459    call SW_PROGRESS_Close
3460return
3461
3462/*:VRX         PB_REFRESH_Click
3463*/
3464PB_REFRESH_Click: PROCEDURE EXPOSE settings. options. fs. samba. debuglevel advanced. UserCred Refreshmode
3465    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click started"
3466    call _UserCredUpdate
3467    ok = VRset("Pict_Throbber", "Visible", 1)
3468    ok = VRset("Menu_Selected_Connect", "Visible", 0)
3469    ok = VRset("TM_Throbber", "Enabled", 1)
3470    ShowHidden = advanced.!special
3471    BroadCast = advanced.!broadcast
3472    ok = time('R')
3473    call _RefreshTree
3474    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click done"
3475RETURN
3476
3477/*:VRX         PB_SAVE_Click
3478*/
3479PB_SAVE_Click: PROCEDURE EXPOSE settings. options. Profile fs. cd. advanced. samba.
3480    call PB_CONDET_SAVE_Click
3481
3482/*  if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3483    ELSE filename = Profile
3484
3485    IF filename == '' THEN RETURN
3486
3487    IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3488        btns.0 = 2
3489        btns.1 = NLVGetMessage( 6 )
3490        btns.2 = NLVGetMessage( 7 )
3491        confirm = VRMessage('Main', NLVGetMessage( 54, filename ), NLVGetMessage( 53 ), 'W', 'btns.', 1, 2 )
3492        IF confirm \= 1 THEN RETURN
3493        CALL VRChAttr filename,, 'HSR'
3494        CALL VRDeleteFile filename
3495    END
3496
3497    CALL VRMethod 'CN_CURRENT', 'GetRecordList', 'All', 'records.'
3498    DO i = 1 TO records.0
3499        data = VRMethod('CN_CURRENT', 'GetRecordAttr', records.i, 'UserData')
3500        IF data == '' THEN ITERATE
3501        PARSE VAR data node ';' mounts ';' .
3502        dyn = "ok = "fs.!prefix"RxGetMount( node, 'info.', 'mounts.', 'resource.')"
3503        IF options.!debug == 1 THEN SAY time()' '||dyn
3504        interpret dyn; drop dyn
3505
3506        IF ok \= 0 THEN ITERATE
3507
3508        DO j = 1 TO resource.0
3509            CALL LINEOUT filename, node SUBWORD( resource.j, 3 )
3510        END
3511
3512    END
3513    CALL STREAM filename, 'C', 'CLOSE'
3514
3515    if options.!autostart == 0 THEN CALL VRMessage 'Main', NLVGetMessage( 52, filename ), NLVGetMessage( 51 ), 'I'
3516*/
3517RETURN
3518
3519/*:VRX         PB_SETTINGS_CANCEL_Click
3520*/
3521PB_SETTINGS_CANCEL_Click:
3522
3523    adv_changed = 0
3524    CALL SW_SETTINGS_Close
3525
3526return
3527
3528/*:VRX         PB_SETTINGS_HELP_Click
3529*/
3530PB_SETTINGS_HELP_Click:
3531    CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
3532return
3533
3534/*:VRX         PB_SETTINGS_OK_Click
3535*/
3536PB_SETTINGS_OK_Click:
3537
3538    adv_loglevel   = VRGet( "SPIN_LOGLEVEL", "Value" )
3539    adv_logfile    = VRGet( "EF_LOGFILE",    "Value" )
3540    adv_browseauth = VRGet( "CB_BROWSEAUTH", "Set" )
3541    adv_browseimme = VRGet( "CB_BROWSEIMME", "Set" )
3542    adv_debug      = VRGet( "CB_DEBUG",      "Set" )
3543    adv_special    = VRGet( "CB_SPECIAL",    "Set" )
3544    adv_savepassive= VRGet( "CB_SAVEPASSIVE","Set" )
3545    adv_broadcast  = VRGet( "CB_BROADCAST",  "Set" )
3546
3547    adv_changed  = 1
3548    if adv_debug == 1 then do
3549        ok = VRRedirectStdio("ON")
3550        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh ,       "Visible", 1)
3551        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh ,    "Visible", 1)
3552        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh ,   "Visible", 1)
3553        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH ,      "Visible", 1)
3554        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH ,       "Visible", 1)
3555        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh ,      "Visible", 1)
3556        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh ,     "Visible", 1)
3557        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh ,    "Visible", 1)
3558        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh ,        "Visible", 1)
3559    end
3560    else do
3561        ok = VRRedirectStdio("OFF")
3562        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh ,       "Visible", 0)
3563        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh ,    "Visible", 0)
3564        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh ,   "Visible", 0)
3565        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH ,      "Visible", 0)
3566        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH ,       "Visible", 0)
3567        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh ,      "Visible", 0)
3568        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh ,     "Visible", 0)
3569        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh ,    "Visible", 0)
3570        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh ,        "Visible", 0)
3571    end
3572
3573    CALL SW_SETTINGS_Close
3574
3575return
3576
3577/*:VRX         PB_UNMOUNT_Click
3578*/
3579PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. fs. cd. samba.
3580    IF options.!debug == 1 THEN SAY time()' '||"PB_UNMOUNT_Click started"
3581    IF options.!debug == 1 THEN SAY time()' '||'options.!editmode = 'options.!editmode
3582    CALL VRMethod 'CN_CURRENT', 'GetRecordList', 'Selected', 'select.'
3583    IF select.0 < 1 THEN RETURN
3584
3585    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', select.1, 'UserData')
3586    PARSE VAR userdata mountpoint ';' mounts ';' .
3587say 'userdata="'userdata'"'
3588    IF mounts > 0 & options.!editmode = 0 THEN DO
3589        btns.0 = 2
3590        btns.1 = NLVGetMessage( 6 )
3591        btns.2 = NLVGetMessage( 7 )
3592        confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3593        IF confirm \= 1 THEN RETURN
3594    END
3595
3596    /* Unmount any resources */
3597    DO i = 1 TO mounts
3598        dyn ="ok = "fs.!prefix"RxUnmount( mountpoint, i-1 )"
3599        IF options.!debug == 1 THEN SAY time()' '||dyn
3600        interpret dyn; drop dyn
3601
3602/* IF options.!debug == 1 THEN SAY time()' '||'Unmount resource' i-1 '=' ok */
3603    END
3604
3605    /* Delete mountpoint */
3606    parent = VRMethod('CN_CURRENT', 'GetRecordAttr', select.1, 'Parent')
3607    IF parent \= '' THEN DO
3608        dyn ="ok = "fs.!prefix"RxDeleteMountPoint( mountpoint )"
3609        IF options.!debug == 1 THEN SAY time()' '||dyn
3610        interpret dyn; drop dyn
3611
3612/* IF options.!debug == 1 THEN SAY time()' '||'Delete mountpoint' mountpoint '=' ok */
3613    END
3614
3615    CALL Refresh
3616    IF options.!debug == 1 THEN SAY time()' '||"PB_UNMOUNT_Click done"
3617RETURN 0
3618
3619/*:VRX         Quit
3620*/
3621Quit:
3622    if Fatal <> 1 then CALL SaveSettings
3623    ok = VRREdirectSTdio("OFF")
3624    window = VRWindow()
3625    call VRSet window, "Shutdown", 1
3626    drop window
3627
3628RETURN
3629
3630/*:VRX         Refresh
3631*/
3632Refresh:
3633    IF options.!debug == 1 THEN SAY time()' Refresh started'
3634    CALL VRSet 'CN_CURRENT', 'Painting', 0
3635
3636    CALL VRMethod 'CN_CURRENT', 'RemoveRecord', 'All'
3637
3638    /* Remove Active connections from details view */
3639    ok = VRMethod( 'CN_CONDET', "GetRecordList", 'All', "rh." )
3640
3641    do I = 1 to rh.0
3642        /* This catches the bug we observed exactly once and were unable to reproduce! */
3643        if cd.statusfh = 'CD.STATUSFH' then do
3644            call beep 880, 50
3645            call beep 880, 50
3646            IF options.!debug == 1 THEN say "  cd.statusfh is undefined - check why!!!!!!"
3647            leave
3648        end
3649        IF options.!debug == 1 THEN say '  Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
3650        if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = '#64:PMWP.DLL' then CALL VRMethod 'CN_CONDET', 'RemoveRecord', rh.i
3651    end
3652
3653/*  call _AddTemplates */
3654    CALL VRSet "PB_DETACH",  "Enabled", 0
3655    CALL VRSet "PB_UNMOUNT", "Enabled", 0
3656
3657    ok = VRSet("MENU_CONTEXT_OPEN",    "Visible",  0)
3658    ok = VRSet("MENU_CONTEXT_SEP1",    "Visible",  0)
3659    ok = VRSet("MENU_CONTEXT_DETACH",  "Visible",  0)
3660    ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible",  0)
3661    ok = VRSet("MENU_CONTEXT_EDIT",    "Visible",  0)
3662
3663    ok = VRSet("MENU_SELECTED_REMOVE", "Visible",  0)
3664    ok = VRSet("MENU_SELECTED_RETRY",  "Visible",  0)
3665
3666    IF options.!debug == 1 THEN SAY '  Remove records, disable buttons done.'
3667
3668    CALL VRMethod 'CB_DRIVES', 'Clear'
3669
3670/* Herwig B.
3671    CALL VRSet 'Main', 'StatusText', ' ' */
3672    CALL VRSet 'CN_CURRENT', 'Caption', ' '
3673/* Herwig B. */
3674
3675/* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
3676    drvs = MyFreeDriveMap('C:', 'FREE')
3677
3678    DO i = 1 TO WORDS( drvs )
3679        drvstem.i = WORD( drvs, i )
3680    END
3681
3682    drvstem.0 = WORDS( drvs )
3683
3684    /* Add any existing EVFS drives */
3685    CALL GetMountPoints
3686
3687    CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
3688    CALL VRSet 'CN_CURRENT', 'Painting', 1
3689    IF options.!debug == 1 THEN SAY time()' '||"Refresh done"
3690RETURN 0
3691
3692/*:VRX         SaveSettings
3693*/
3694SaveSettings: PROCEDURE EXPOSE settings. options. fs. advanced. cd. samba.
3695    IF options.!debug == 1 THEN SAY time()' '||"SaveSettings started"
3696
3697    if advanced.!savepassive then call _PassiveSave
3698
3699/* This does not make sense anymore
3700    settings.!network = VRGet("EF_NETWORK","Value")
3701    CALL VRSetIni 'Settings', 'Network', settings.!network, settings.!ini, 'NoClose'
3702 */
3703
3704    font = VRGet('CN_CURRENT', 'Font')
3705    CALL VRSetIni 'Settings', 'ContainerFont', font, settings.!ini, 'NoClose'
3706
3707    font = VRGet('Main', 'Font')
3708    CALL VRSetIni 'Settings', 'WindowFont', font, settings.!ini, 'NoClose'
3709
3710    settings.!curbcolor = VRGet("DT_CURRENT","BackColor")
3711    CALL VRSetIni 'Settings', 'TitleBarBackground', settings.!curbcolor, settings.!ini, 'NoClose'
3712
3713    settings.!curfcolor = VRGet("DT_CURRENT","ForeColor")
3714    CALL VRSetIni 'Settings', 'TitleBarForeground', settings.!curfcolor, settings.!ini, 'NoClose'
3715
3716    settings.!buttonson = VRGet("Menu_View_Buttons","Checked")
3717    CALL VRSetIni 'Settings', 'ButtonsOn', settings.!buttonson, settings.!ini, 'NoClose'
3718
3719    settings.!smbtreeon = VRGet("Menu_View_Smbtree","Checked")
3720    CALL VRSetIni 'Settings', 'SmbtreeOn', settings.!smbtreeon, settings.!ini, 'NoClose'
3721
3722    settings.!dialogon = VRGet("Menu_View_Dialog","Checked")
3723    CALL VRSetIni 'Settings', 'DialogOn', settings.!dialogon, settings.!ini, 'NoClose'
3724
3725    settings.!condeton = VRGet("Menu_View_ConDet","Checked")
3726    CALL VRSetIni 'Settings', 'ConDetOn', settings.!condeton, settings.!ini, 'NoClose'
3727
3728    CALL VRSetIni 'Settings', 'BrowseAuth',    advanced.!browseauth , settings.!ini, 'NoClose'
3729    CALL VRSetIni 'Settings', 'BrowseImme',    advanced.!browseimme , settings.!ini, 'NoClose'
3730    CALL VRSetIni 'Settings', 'Debug',         advanced.!debug      , settings.!ini, 'NoClose'
3731    CALL VRSetIni 'Settings', 'AlwaysMP',      advanced.!alwaysmp   , settings.!ini, 'NoClose'
3732    CALL VRSetIni 'Settings', 'SpecialShares', advanced.!special    , settings.!ini, 'NoClose'
3733    CALL VRSetIni 'Settings', 'BigIcons',      advanced.!bigicons   , settings.!ini, 'NoClose'
3734    CALL VRSetIni 'Settings', 'SavePassive',   advanced.!savepassive, settings.!ini, 'NoClose'
3735    CALL VRSetIni 'Settings', 'Broadcast',     advanced.!broadcast  , settings.!ini, 'NoClose'
3736
3737    /* Save position and size */
3738    settings.!l = VRGet("Main",       'Left'  )
3739    settings.!t = VRGet("Main",       'Top'   )
3740    settings.!h = VRGet("Main",       'Height')
3741    settings.!w = VRGet("Main",       'Width' )
3742    settings.!s = VRGet("SPLIT_Main", 'Left'  )
3743
3744    CALL VRSetIni 'Settings', 'X', settings.!l, settings.!ini, 'NoClose'
3745    CALL VRSetIni 'Settings', 'Y', settings.!t, settings.!ini, 'NoClose'
3746    CALL VRSetIni 'Settings', 'H', settings.!h, settings.!ini, 'NoClose'
3747    CALL VRSetIni 'Settings', 'W', settings.!w, settings.!ini, 'NoClose'
3748    CALL VRSetIni 'Settings', 'S', settings.!s, settings.!ini
3749
3750    IF options.!debug == 1 THEN SAY time()' '||"SaveSettings done"
3751RETURN
3752
3753/*:VRX         SPLIT_Main_Move
3754*/
3755SPLIT_Main_Move:
3756    ok = VRset("Main", "Painting", 0)
3757    NewPos = VRInfo("Left")
3758    OldPos = VRGet("SPLIT_Main","Left")
3759    ok = VRSet("SPLIT_Main","Left", NewPos)
3760    ok = VRset("GB_SMBTREE","Left",NewPos+60)
3761    call Main_Resize
3762    ok = VRset("Main", "Painting", 1)
3763return
3764
3765/*:VRX         StemsInit
3766*/
3767StemsInit:
3768    options.!workgroup  = ''
3769    options.!server     = ''
3770    options.!share      = ''
3771    options.!user       = ''
3772    options.!password   = ''
3773    options.!spassword  = ''
3774    options.!master     = ''
3775    options.!mastertype = ''
3776    options.!memlen     = '2'
3777    options.!easupport  = '1'
3778    options.!readonly   = ''
3779    options.!loglevel   = 0
3780    options.!logfile    = ''
3781
3782    options.!autoload   = 0
3783    options.!autoclose  = 0
3784    options.!nogui      = 0
3785    options.!autostart  = 0
3786    options.!editmode   = 0
3787
3788    vfs.!drive      = ''
3789    vfs.!mountpoint = ''
3790
3791    advanced.!memlen     = ''
3792    advanced.!easupport  = '1'
3793    advanced.!readonly   = ''
3794    advanced.!loglevel   = '0'
3795    advanced.!logfile    = ''
3796    advanced.!browseauth = ''
3797    advanced.!browseimme = ''
3798    advanced.!savepassive= ''
3799    advanced.!broadcast  = ''
3800    advanced.!debug      = ''
3801    advanced.!alwaysmp   = ''
3802    advanced.!special    = ''
3803    advanced.!bigicons   = ''
3804
3805    credentials.!username = ""
3806    credentials.!password = ""
3807    UserCred = ""
3808    RefreshMode = ""
3809return
3810
3811/*:VRX         SW_ADVANCED_Close
3812*/
3813SW_ADVANCED_Close:
3814    call SW_ADVANCED_Fini
3815return
3816
3817/*:VRX         SW_ADVANCED_Create
3818*/
3819SW_ADVANCED_Create:
3820    call SW_ADVANCED_Init
3821return
3822
3823/*:VRX         SW_ADVANCED_Fini
3824*/
3825SW_ADVANCED_Fini:
3826    window = VRInfo( "Window" )
3827    call VRDestroy window
3828    drop window
3829return
3830/*:VRX         SW_ADVANCED_Init
3831*/
3832SW_ADVANCED_Init:
3833
3834    CALL NLVSetText 'SW_ADVANCED',  'Caption', 40
3835    CALL NLVSetText 'GB_MISC',      'Caption', 43
3836
3837    CALL NLVSetText 'CB_EAS',       'Caption', 44
3838    CALL NLVSetText 'CB_READONLY',  'Caption', 45
3839    CALL NLVSetText 'CB_ALWAYSMP',  'Caption', 65
3840
3841    CALL NLVSetText 'PB_ADVOK',     'Caption', 2
3842    CALL NLVSetText 'PB_ADVCANCEL', 'Caption', 3
3843    CALL NLVSetText 'PB_ADVHELP',   'Caption', 4
3844
3845    CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
3846
3847    /* Obsolete */
3848    CALL NLVSetText 'GB_MEM',       'Caption', 41
3849
3850    IF advanced.!memlen \= '' THEN
3851        CALL VRSet 'SPB_MEMLEN', 'Value', advanced.!memlen
3852    IF advanced.!easupport \= '' THEN
3853        CALL VRSet 'CB_EAS', 'Set', advanced.!easupport
3854    IF advanced.!readonly \= '' THEN
3855        CALL VRSet 'CB_READONLY', 'Set', advanced.!readonly
3856    IF advanced.!alwaysmp \= '' THEN
3857        CALL VRSet 'CB_alwaysmp', 'Set', advanced.!alwaysmp
3858
3859    window = VRInfo( "Object" )
3860    if( \VRIsChildOf( window, "Notebook" ) ) then do
3861        call VRMethod window, "CenterWindow"
3862        call VRSet window, "Visible", 1
3863        call VRMethod window, "Activate"
3864    end
3865    drop window
3866return
3867
3868/*:VRX         SW_INFO_Close
3869*/
3870SW_INFO_Close:
3871    call SW_INFO_Fini
3872return
3873
3874/*:VRX         SW_INFO_Create
3875*/
3876SW_INFO_Create:
3877    call SW_INFO_Init
3878    CALL NLVSetText 'SW_INFO',    'Caption', 92
3879    CALL NLVSetText 'PB_INFO_OK',    'Caption', 2
3880
3881    Info.TypeFH    = VRMethod( "CN_INFO", "AddField", "String", "Type" )
3882    Info.ValueFH   = VRMethod( "CN_INFO", "AddField", "String", "Value" )
3883
3884    parse var infoline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
3885    Info.!domain = VRMethod( "CN_INFO", "AddRecord")
3886    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21),'T',':'),Info.ValueFH, Workgroup )
3887    Info.!os = VRMethod( "CN_INFO", "AddRecord")
3888    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93),'T',':'),Info.ValueFH, OS )
3889    Info.!server = VRMethod( "CN_INFO", "AddRecord")
3890    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19),'T',':'),Info.ValueFH, Server )
3891
3892    Info.!status = VRMethod( "CN_INFO", "AddRecord")
3893    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, SMBObj.udatamsg )
3894
3895return
3896
3897/*:VRX         SW_INFO_Fini
3898*/
3899SW_INFO_Fini:
3900    window = VRInfo( "Window" )
3901    call VRDestroy window
3902    drop window
3903return
3904/*:VRX         SW_INFO_Init
3905*/
3906SW_INFO_Init:
3907    window = VRInfo( "Object" )
3908    if( \VRIsChildOf( window, "Notebook" ) ) then do
3909        call VRMethod window, "CenterWindow"
3910        call VRSet window, "Visible", 1
3911        call VRMethod window, "Activate"
3912    end
3913    drop window
3914return
3915
3916/*:VRX         SW_LOGIN_Close
3917*/
3918SW_LOGIN_Close:
3919    call SW_LOGIN_Fini
3920return
3921
3922/*:VRX         SW_LOGIN_Create
3923*/
3924SW_LOGIN_Create:
3925    call SW_LOGIN_Init
3926    CALL NLVSetText 'DT_USER1',      'Caption', 25
3927    CALL NLVSetText 'DT_PASSWORD1',  'Caption', 26
3928    CALL NLVSetText 'PB_LOGIN_OK',    'Caption', 2
3929    CALL NLVSetText 'PB_LOGIN_CANCEL','Caption', 3
3930    ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
3931    ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
3932return
3933
3934/*:VRX         SW_LOGIN_Fini
3935*/
3936SW_LOGIN_Fini:
3937    window = VRInfo( "Window" )
3938    call VRDestroy window
3939    drop window
3940return
3941/*:VRX         SW_LOGIN_Init
3942*/
3943SW_LOGIN_Init:
3944    window = VRInfo( "Object" )
3945    if( \VRIsChildOf( window, "Notebook" ) ) then do
3946        call VRMethod window, "CenterWindow"
3947        call VRSet window, "Visible", 1
3948        call VRMethod window, "Activate"
3949    end
3950    drop window
3951return
3952
3953/*:VRX         SW_LOGIN_KeyPress
3954*/
3955SW_LOGIN_KeyPress:
3956    obj = VRInfo( "Object" )
3957    keystr = VRGet( obj, "KeyString" )
3958/*  say keystr */
3959    select
3960        when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
3961        when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
3962        when keystr  = "{Esc}" then call PB_LOGIN_CANCEL_Click
3963        otherwise nop
3964    end
3965return
3966
3967/*:VRX         SW_MOUNTPOINT_Close
3968*/
3969SW_MOUNTPOINT_Close:
3970    call SW_MOUNTPOINT_Fini
3971return
3972
3973/*:VRX         SW_MOUNTPOINT_Create
3974*/
3975SW_MOUNTPOINT_Create:
3976    call SW_MOUNTPOINT_Init
3977/* NLVGetMessage(14)' ' */
3978    ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
3979    CALL NLVSetText 'DT_MPOINT1',   'Caption', 27
3980    CALL NLVSetText 'PB_NEWMOUNTPOINTOK',    'Caption', 2
3981    CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL','Caption', 3
3982    CALL NLVSetText 'CB_EAS1',       'Caption', 44
3983    CALL NLVSetText 'CB_READONLY1',  'Caption', 45
3984    CALL NLVSetText 'CB_ALWAYSMP1',  'Caption', 65
3985    ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
3986    ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
3987    ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
3988    ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
3989    ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
3990    ok = VRSet("CB_ALWAYSMP1","set",advanced.!alwaysmp)
3991return
3992
3993/*:VRX         SW_MOUNTPOINT_Fini
3994*/
3995SW_MOUNTPOINT_Fini:
3996    window = VRInfo( "Window" )
3997    call VRDestroy window
3998    drop window
3999return
4000/*:VRX         SW_MOUNTPOINT_Init
4001*/
4002SW_MOUNTPOINT_Init:
4003    window = VRInfo( "Object" )
4004    if( \VRIsChildOf( window, "Notebook" ) ) then do
4005        call VRMethod window, "CenterWindow"
4006        call VRSet window, "Visible", 1
4007        call VRMethod window, "Activate"
4008    end
4009    drop window
4010return
4011
4012/*:VRX         SW_PROGRESS_Close
4013*/
4014SW_PROGRESS_Close:
4015    call SW_PROGRESS_Fini
4016return
4017
4018/*:VRX         SW_PROGRESS_Create
4019*/
4020SW_PROGRESS_Create:
4021    call SW_PROGRESS_Init
4022    CALL NLVSetText 'SW_PROGRESS',  'Caption', 1
4023    CALL NLVSetText 'DT_PROGRESS',  'Caption', 34
4024    CALL NLVSetText 'PB_PROGRESS_ABORT',  'Caption', 3
4025    CALL VRSet "TM_TheCloser","Enabled", 1
4026return
4027
4028/*:VRX         SW_PROGRESS_Fini
4029*/
4030SW_PROGRESS_Fini:
4031    window = VRInfo( "Window" )
4032    call VRDestroy window
4033    drop window
4034return
4035/*:VRX         SW_PROGRESS_Init
4036*/
4037SW_PROGRESS_Init:
4038    window = VRInfo( "Object" )
4039    if( \VRIsChildOf( window, "Notebook" ) ) then do
4040        call VRMethod window, "CenterWindow"
4041        call VRSet window, "Visible", 1
4042        call VRMethod window, "Activate"
4043    end
4044    drop window
4045return
4046
4047/*:VRX         SW_SETTINGS_Close
4048*/
4049SW_SETTINGS_Close:
4050    call SW_SETTINGS_Fini
4051return
4052
4053/*:VRX         SW_SETTINGS_Create
4054*/
4055SW_SETTINGS_Create:
4056    call SW_SETTINGS_Init
4057return
4058
4059/*:VRX         SW_SETTINGS_Fini
4060*/
4061SW_SETTINGS_Fini:
4062    window = VRInfo( "Window" )
4063    call VRDestroy window
4064    drop window
4065return
4066/*:VRX         SW_SETTINGS_Init
4067*/
4068SW_SETTINGS_Init:
4069
4070    CALL NLVSetText 'SW_SETTINGS',  'Caption', 47
4071
4072    CALL NLVSetText 'GB_GLOBAL',     'Caption', 47
4073    CALL NLVSetText 'CB_DEBUG',      'Caption', 42
4074    CALL NLVSetText 'CB_LOGGING',    'Caption', 46
4075    CALL NLVSetText 'CB_BROWSEIMME', 'Caption', 48
4076    CALL NLVSetText 'CB_BROWSEAUTH', 'Caption', 49
4077    CALL NLVSetText 'CB_SPECIAL',    'Caption', 66
4078    CALL NLVSetText 'CB_SAVEPASSIVE','Caption', 73
4079    CALL NLVSetText 'CB_BROADCAST',  'Caption', 74
4080
4081    CALL NLVSetText 'PB_SETTINGS_OK',     'Caption', 2
4082    CALL NLVSetText 'PB_SETTINGS_CANCEL', 'Caption', 3
4083    CALL NLVSetText 'PB_SETTINGS_HELP',   'Caption', 4
4084
4085/*  CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
4086
4087    IF advanced.!logfile \= '' THEN
4088        CALL VRSet 'EF_LOGFILE',    'Value', advanced.!logfile
4089    IF advanced.!loglevel \= '0' THEN
4090        CALL VRSet 'SPIN_LOGLEVEL', 'Value', advanced.!loglevel
4091    CALL VRSet 'CB_LOGGING', 'Set', VRFileExists(SysBootDrive()'\ndpsmb.dbg')
4092    IF advanced.!browseauth \= '' THEN
4093        CALL VRSet 'CB_BROWSEAUTH', 'Set', advanced.!browseauth
4094    IF advanced.!browseimme \= '' THEN
4095        CALL VRSet 'CB_BROWSEimme', 'Set', advanced.!browseimme
4096    IF advanced.!debug \= '' THEN
4097        CALL VRSet 'CB_debug',      'Set', advanced.!debug
4098    IF advanced.!special \= '' THEN
4099        CALL VRSet 'CB_SPECIAL',    'Set', advanced.!special
4100    IF advanced.!savepassive \= '' THEN
4101        CALL VRSet 'CB_SAVEPASSIVE',    'Set', advanced.!savepassive
4102    IF advanced.!broadcast \= '' THEN
4103        CALL VRSet 'CB_BROADCAST',    'Set', advanced.!broadcast
4104
4105    window = VRInfo( "Object" )
4106    if( \VRIsChildOf( window, "Notebook" ) ) then do
4107        call VRMethod window, "CenterWindow"
4108        call VRSet window, "Visible", 1
4109        call VRMethod window, "Activate"
4110    end
4111    drop window
4112return
4113
4114/*:VRX         TM_AutoClose_Trigger
4115*/
4116TM_AutoClose_Trigger:
4117    call PB_CLOSE_Click
4118return
4119
4120/*:VRX         TM_RefreshCurrentDisplay_Trigger
4121*/
4122TM_RefreshCurrentDisplay_Trigger:
4123    CALL REFRESH
4124return
4125
4126/*:VRX         TM_RefreshTreeDisplay_Trigger
4127*/
4128TM_RefreshTreeDisplay_Trigger:
4129    ShowHidden = advanced.!special
4130    BroadCast = advanced.!broadcast
4131
4132    select
4133        when RefreshMode = "TREE" then do
4134            call _RefreshTreeDisplay
4135
4136            if VRget("Menu_View_SmbTree", "Checked") then do
4137                if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
4138                    ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SmbTree", "ValidateRecord", smbtree.!workgroup ) )
4139                end
4140            end
4141        end
4142        when RefreshMode = "SHARE" then do
4143            call _AddSharesDisplay
4144        end
4145        otherwise say "RefreshMode = "RefreshMode
4146    end
4147    call _DialogPopulate
4148return
4149
4150/*:VRX         TM_TheCloser_Trigger
4151*/
4152TM_TheCloser_Trigger:
4153    call SW_PROGRESS_Close
4154return
4155
4156/*:VRX         TM_Throbber_Trigger
4157*/
4158TM_Throbber_Trigger:
4159    pIdx = VRGet("Pict_Throbber","PicturePath")
4160    parse var pIdx '#' pidx
4161    pidx = pidx + 1
4162    if pidx = 36 then pidx = 11
4163    ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
4164return
Note: See TracBrowser for help on using the repository browser.