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

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

GUI-Tools: EVFSGUI: Do not run more than 32 smbclient.exe at the same time

File size: 155.4 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 == '' | datatype(res.0) <> "NUM" 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 RxFuncAdd 'PRLoadFuncs',  'PR1UTIL', 'PRLoadFuncs'
1882    call PRLoadFuncs
1883
1884
1885    CALL _InitTempDir
1886
1887    CALL NLVSetup
1888
1889    CALL StemsInit
1890
1891    CALL _ContainersInit
1892
1893    CALL _GUIInit
1894
1895    CALL ParseCommandLine
1896
1897    CALL LoadFileSysFuncs
1898
1899    CALL _CltInit
1900
1901    CALL LoadSettings
1902
1903    CALL Refresh
1904
1905    if advanced.!savepassive == 1 then CALL _PassiveLoad
1906
1907    IF options.!autoload == 1 THEN CALL PB_LOAD_Click
1908
1909    CALL VRSet "CB_MOUNT",  "Selected", 1
1910    CALL VRSet "CB_DRIVES", "Selected", 1
1911    IF options.!autoclose == 1 THEN CALL TM_AutoClose_Trigger
1912    /* For whatever reason the timer is not triggered anymore....
1913    CALL VRSet "TM_AUTOCLOSE", "ENABLED", 1 */
1914    ELSE do
1915        if advanced.!browseauth == 1 then do
1916            window = VRLoadSecondary( "SW_LOGIN", "W" )
1917            call Main_Resize
1918        end
1919        if advanced.!browseimme == 1 then call PB_REFRESH_Click
1920    end
1921
1922    IF options.!debug == 1 THEN SAY time()' Main_Create done'
1923return
1924
1925/*:VRX         Main_KeyPress
1926*/
1927Main_KeyPress:
1928    key = VRGet('Main', 'KeyString')
1929    IF key == '{F5}' THEN CALL Refresh
1930RETURN
1931
1932/*:VRX         Main_Resize
1933*/
1934Main_Resize:
1935    if datatype(options.!buttondelta) = 'CHAR' then return
1936
1937    IF options.!debug == 1 THEN SAY time()' Main_Resize started'
1938    ok = VRset("Main","Painting", 0)
1939
1940    /* Basic measurements */
1941    main_iwidth  = VRGet("Main","InteriorWidth")                /* Width of window client-area */
1942    main_iheight = VRGet("Main","InteriorHeight")               /* Height of window client-area */
1943    sbar_height  = VRGet("GB_STATUSBAR","Height")               /* Height of status-bar */
1944    split_left   = VRGet("SPLIT_Main","Left")                   /* Position of the left edge of the split-bar */
1945    marginx2     = margin * 2                                   /* Common margin around controls */
1946    pbtn_height  = 400                                          /* Height of the panels' internal button areas */
1947    buttons_top  = main_iheight - sbar_height - margin - options.!buttondelta         /* Top of the common button area */
1948    pane_height  = buttons_top - (margin * 3)                                         /* Height of a split-bar panel */
1949    lpane_width  = split_left - margin                                                /* Width of the left split-bar panel */
1950    rpane_width  = main_iwidth - split_left - 60 - margin                             /* Width of the right split-bar panel */
1951
1952    /* Button bar */
1953    ok = VRSet("GB_BUTTONS",  "Top",   buttons_top )
1954    ok = VRSet("GB_BUTTONS",  "Left",  main_iwidth - VRGet("GB_Buttons","Width") - margin )
1955
1956    /* Current Panel */
1957    ok = VRSet("GB_CURRENT",  "Visible", 1           )
1958    ok = VRSet("GB_CURRENT",  "Top",     marginx2  )
1959    ok = VRSet("GB_CURRENT",  "Left",    margin      )
1960    ok = VRSet("GB_CURRENT",  "Width",   lpane_width )
1961    ok = VRSet("GB_CURRENT",  "Height",  pane_height )
1962
1963    ok = VRset("GB_CURRENT3", "Top",     margin )
1964    ok = VRset("GB_CURRENT3", "Left",    margin )
1965    ok = VRset("GB_CURRENT3", "Height",  245    )
1966    ok = VRset("GB_CURRENT3", "Width",   lpane_width - marginx2)
1967
1968    ok = VRset("DT_CURRENT", "Top",      8   )
1969    ok = VRset("DT_CURRENT", "Left",     8   )
1970    ok = VRset("DT_CURRENT", "Height",   213 )
1971    ok = VRset("DT_CURRENT", "Width",    (lpane_width - marginx2) - 24 )
1972
1973    ok = VRset("GB_CURRENT2", "Left",   margin                )
1974    ok = VRset("GB_CURRENT2", "Top",    245 + marginx2        )
1975    ok = VRset("GB_CURRENT2", "Width",  lpane_width - marginx2)
1976    ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
1977
1978    ok = VRset("CN_CURRENT", "Top",     margin )
1979    ok = VRset("CN_CURRENT", "Left",    margin )
1980    ok = VRset("CN_CURRENT", "Width",   VRGet("GB_CURRENT2","Width")  - marginx2)
1981    ok = VRset("CN_CURRENT", "Height",  VRGet("GB_CURRENT2","Height") - marginx2)
1982
1983    ok = VRset("PB_DETACH",  "Left",   margin )
1984    ok = VRset("PB_DETACH",  "Top",    pane_height - pbtn_height - marginx2 )
1985    ok = VRset("PB_DETACH",  "Width",  min((lpane_width-margin*3) % 2, 1313)    )
1986    ok = VRset("PB_UNMOUNT", "Left",   VRGet("PB_DETACH","Width") + marginx2)
1987    ok = VRset("PB_UNMOUNT", "Top",    pane_height - pbtn_height - marginx2 )
1988    ok = VRset("PB_UNMOUNT", "Width",  min((lpane_width-margin*3) % 2, 1313)    )
1989
1990    /* SMBTree stuff */
1991    ok = VRSet("GB_SMBTREE", "Top",     marginx2      )
1992    ok = VRSet("GB_SMBTREE", "Left",    split_left + 60 )
1993    ok = VRset("GB_SMBTREE", "Height",  pane_height     )
1994    ok = VRset("GB_SMBTREE", "Width",   rpane_width     )
1995
1996    ok = VRset("GB_SMBTREE3","Top",     margin )
1997    ok = VRset("GB_SMBTREE3","Left",    margin )
1998    ok = VRset("GB_SMBTREE3","Height",  245    )
1999    ok = VRset("GB_SMBTREE3","Width",   rpane_width - marginx2)
2000
2001    ok = VRset("DT_SMBTREE", "Top",     8 )
2002    ok = VRset("DT_SMBTREE", "Left",    8 )
2003    ok = VRset("DT_SMBTREE", "Width",   (rpane_width - marginx2) - 24 )
2004
2005    ok = VRset("GB_SMBTREE2","Left",    margin                    )
2006    ok = VRset("GB_SMBTREE2","Top",     245 + marginx2        )
2007    ok = VRset("GB_SMBTREE2","Width",   rpane_width - marginx2)
2008    ok = VRset("GB_SMBTREE2","Height",  pane_height - (margin * 5) - pbtn_height - 245 )
2009
2010    ok = VRset("CN_SMBTREE",  "Top",    margin )
2011    ok = VRset("CN_SMBTREE",  "Left",   margin )
2012    ok = VRset("CN_SMBTREE",  "Width",  VRGet("GB_SMBTREE2","Width")  - marginx2)
2013    ok = VRset("CN_SMBTREE",  "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
2014
2015    ok = VRset("PB_CONNECT", "Left",   margin)
2016    ok = VRset("PB_CONNECT", "Top",    pane_height - pbtn_height   - marginx2)
2017    ok = VRset("PB_REFRESH", "Left",   VRGet("PB_CONNECT","Width") + marginx2)
2018    ok = VRset("PB_REFRESH", "Top",    pane_height - pbtn_height   - marginx2)
2019
2020    ok = VRset("PICT_THROBBER", "Top",  VRGet("CN_SMBTREE","Height") % 2 + 100 )
2021    ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width")  % 2 - 200 )
2022
2023    /* Connection details stuff */
2024    ok = VRSet("GB_CONDET", "Top",     marginx2      )
2025    ok = VRSet("GB_CONDET", "Left",    split_left + 60 )
2026    ok = VRset("GB_CONDET", "Height",  pane_height     )
2027    ok = VRset("GB_CONDET", "Width",   rpane_width     )
2028
2029    ok = VRset("GB_CONDET3","Top",     margin )
2030    ok = VRset("GB_CONDET3","Left",    margin )
2031    ok = VRset("GB_CONDET3","Height",  245    )
2032    ok = VRset("GB_CONDET3","Width",   rpane_width - marginx2)
2033
2034    ok = VRset("DT_CONDET", "Top",     8 )
2035    ok = VRset("DT_CONDET", "Left",    8 )
2036    ok = VRset("DT_CONDET", "Width",   (rpane_width - marginx2) - 24 )
2037
2038    ok = VRset("GB_CONDET2", "Left",   margin )
2039    ok = VRset("GB_CONDET2", "Top",    245 + marginx2)
2040    ok = VRset("GB_CONDET2", "Width",  rpane_width - marginx2)
2041    ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
2042
2043    ok = VRset("CN_CONDET",  "Top",    margin )
2044    ok = VRset("CN_CONDET",  "Left",   margin )
2045    ok = VRset("CN_CONDET",  "Width",  VRGet("GB_CONDET2","Width")  - marginx2)
2046    ok = VRset("CN_CONDET",  "Height", VRGet("GB_CONDET2","Height") - marginx2)
2047
2048    ok = VRset("PB_CONDET_SAVE", "Left", margin )
2049    ok = VRset("PB_CONDET_SAVE", "Top",  pane_height - pbtn_height - marginx2      )
2050    ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2051    ok = VRset("PB_CONDET_LOAD", "Top",  pane_height - pbtn_height - marginx2      )
2052
2053    /* Dialog stuff */
2054    ok = VRSet("GB_DIALOG", "Top",    marginx2      )
2055    ok = VRSet("GB_DIALOG", "Left",   split_left + 60 )
2056    ok = VRset("GB_DIALOG", "Height", pane_height     )
2057    ok = VRset("GB_DIALOG", "Width",  rpane_width     )
2058
2059    ok = VRset("GB_DIALOG3", "Top",    margin )
2060    ok = VRset("GB_DIALOG3", "Left",   margin )
2061    ok = VRset("GB_DIALOG3", "Height", 245    )
2062    ok = VRset("GB_DIALOG3", "Width",  rpane_width - marginx2)
2063
2064    ok = VRset("DT_DIALOG", "Top",   8 )
2065    ok = VRset("DT_DIALOG", "Left",  8 )
2066    ok = VRset("DT_DIALOG", "Width", (rpane_width - marginx2) - 24 )
2067
2068    ok = VRset("PB_MOUNT",      "Left", margin )
2069    ok = VRset("PB_MOUNT",      "Top",  pane_height - pbtn_height - marginx2)
2070    ok = VRset("PB_EDITCANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
2071    ok = VRset("PB_EDITCANCEL", "Top",  pane_height - pbtn_height - marginx2)
2072
2073    ok = VRset("GB_SHARE", "Left",  margin )
2074    ok = VRset("GB_SHARE", "Top",   245 + marginx2)
2075    ok = VRset("GB_SHARE", "Width", rpane_width - marginx2)
2076
2077    ok = VRset("GB_AUTH", "Left",  margin )
2078    ok = VRset("GB_AUTH", "Top",   245 + (margin * 3) + VRGet("GB_SHARE","Height"))
2079    ok = VRset("GB_AUTH", "Width", rpane_width - marginx2)
2080
2081    ok = VRset("GB_MPOINT","Left",   margin )
2082    ok = VRset("GB_MPOINT","Top",    245 + (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
2083    ok = VRset("GB_MPOINT","Width",  rpane_width - marginx2)
2084
2085    ok = VRset("SPLIT_Main", "Visible", 1           )
2086    ok = VRset("SPLIT_Main", "Top",     marginx2  )
2087    ok = VRset("SPLIT_Main", "Height",  pane_height )
2088
2089    ok = VRSet("GB_STATUSBAR", "Left",  margin )
2090    ok = VRSet("GB_STATUSBAR", "Top",   main_iheight - sbar_height - margin )
2091    ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width      )
2092
2093    ok = VRset("DT_STATUSBAR", "Top",   12 )
2094    ok = VRset("DT_STATUSBAR", "Left",  12 )
2095    ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
2096    ok = VRset("Main","Painting", 1)
2097
2098    /* check and empty event queue, trash spurious resize events */
2099    EventString = ''
2100    TrashedResize = 0
2101
2102    do until EventString = 'nop'
2103        EventString = VREvent('N')
2104        if EventString <> 'nop' then do
2105            if EventString = 'CALL Main_Resize' then TrashedResize = 1
2106                                                else interpret eventString
2107        end
2108    end
2109    if TrashedResize then CALL Main_Resize
2110
2111    IF options.!debug == 1 THEN SAY time()' Main_Resize done'
2112return
2113/*:VRX         Menu_Context_ChangeView_Click
2114*/
2115Menu_Context_ChangeView_Click:
2116    ok = VRSet("Cn_Current","View","NameTree")
2117return
2118
2119/*:VRX         Menu_Context_Detach_All_Click
2120*/
2121Menu_Context_Detach_All_Click:
2122    ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
2123    do um = 1 to umrh.0
2124        ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
2125        call PB_DETACH_Click
2126    end
2127    drop um umrh.
2128return
2129
2130/*:VRX         Menu_Context_Detach_Click
2131*/
2132Menu_Context_Detach_Click:
2133    call PB_DETACH_Click
2134return
2135
2136/*:VRX         Menu_Context_Edit_Click
2137*/
2138Menu_Context_Edit_Click:
2139    IF options.!debug == 1 THEN SAY time()' Menu_Context_Edit_Click started'
2140    options.!editmode = 1
2141    if \VRGet("Menu_View_Dialog","Checked") then call Menu_View_Dialog_Click
2142    CALL VRSet "PB_EDITCANCEL","Visible", 1
2143    CALL VRSet "PB_UNMOUNT","Enabled", 0
2144    CALL VRSet "PB_SAVE","Enabled", 0
2145    CALL VRSet "PB_LOAD","Enabled", 0
2146    CALL NLVSetText "DT_DIALOG","Caption",33
2147    CALL VRSet "GB_CURRENT", "ENABLED", 0
2148
2149    ok = VRSet("CB_MOUNT","Value","")
2150    ok = VRSet("CB_MOUNT","Selected",1)
2151    ok = VRSet("CB_MOUNT","Value",mtype.1)
2152
2153    parse var p_string p_domain':\\'p_server'\'p_share
2154
2155    /* IF options.!debug == 1 THEN SAY time()' '||p_domain */
2156
2157    IF options.!debug == 1 THEN SAY time()' data   '||data
2158    IF options.!debug == 1 THEN SAY time()' domain '||p_domain
2159    IF options.!debug == 1 THEN SAY time()' server '||p_server
2160    IF options.!debug == 1 THEN SAY time()' share  '||p_share
2161    IF options.!debug == 1 THEN SAY time()' string '||p_string
2162
2163
2164    CALL VRSet "EF_SHARE",  "VALUE", p_share
2165    CALL VRSet "EF_SERVER", "VALUE", p_server
2166    CALL VRSet "EF_NETWORK","VALUE", p_domain
2167
2168    /* IF options.!debug == 1 THEN SAY time()' '||p_node */
2169    parse var p_node p_drive'\'p_directory'\'
2170    CALL VRSet "CB_DRIVES", "Value", p_drive
2171    CALL VRSet "EF_DIRECTORY", "Value", p_directory
2172    IF options.!debug == 1 THEN SAY time()' Menu_Context_Edit_Click done'
2173return
2174
2175/*:VRX         Menu_Context_Open_Click
2176*/
2177Menu_Context_Open_Click:
2178    ok = VRSet("Menu_Context_Open_Default","Visible",0)
2179return
2180
2181/*:VRX         Menu_Context_Open_Default_Click
2182*/
2183Menu_Context_Open_Default_Click:
2184    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Click started"
2185    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2186    PARSE VAR userdata mountpoint ';' mounts ';' .
2187
2188    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2189
2190    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
2191
2192    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Click done"
2193return
2194
2195/*:VRX         Menu_Context_Open_Detail_Click
2196*/
2197Menu_Context_Open_Detail_Click:
2198    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click started"
2199    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2200    PARSE VAR userdata mountpoint ';' mounts ';' .
2201
2202    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2203
2204    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
2205
2206    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click done"
2207return
2208
2209/*:VRX         Menu_Context_Open_Icon_Click
2210*/
2211Menu_Context_Open_Icon_Click:
2212    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Icon_Click started"
2213    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2214    PARSE VAR userdata mountpoint ';' mounts ';' .
2215
2216    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2217
2218    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
2219
2220    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Icon_Click done"
2221return
2222
2223/*:VRX         Menu_Context_Open_Settings_Click
2224*/
2225Menu_Context_Open_Settings_Click:
2226    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_DetailsClick started"
2227    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2228    PARSE VAR userdata mountpoint ';' mounts ';' .
2229
2230    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2231
2232    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
2233
2234    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Details_Click done"
2235return
2236
2237/*:VRX         Menu_Context_Open_Splitview_Click
2238*/
2239Menu_Context_Open_Splitview_Click:
2240    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Splitview_Click started"
2241    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2242    PARSE VAR userdata mountpoint ';' mounts ';' .
2243
2244    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2245
2246    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
2247
2248    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Splitview_Click done"
2249return
2250
2251/*:VRX         Menu_Context_Open_Tree_Click
2252*/
2253Menu_Context_Open_Tree_Click:
2254    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Tree_Click started"
2255    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', rh, 'UserData')
2256    PARSE VAR userdata mountpoint ';' mounts ';' .
2257
2258    if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2259
2260    ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
2261
2262    IF options.!debug == 1 THEN SAY time()' '||"Menu_Context_Open_Tree_Click done"
2263return
2264
2265/*:VRX         Menu_Context_Refresh_Click
2266*/
2267Menu_Context_Refresh_Click:
2268    CALL Refresh
2269return
2270
2271/*:VRX         Menu_Context_Unmount_Click
2272*/
2273Menu_Context_Unmount_Click:
2274    call PB_UNMOUNT_Click
2275return
2276
2277/*:VRX         Menu_File_Advanced_Click
2278*/
2279Menu_File_Advanced_Click:
2280    call PB_ADVANCED_Click
2281return
2282
2283/*:VRX         Menu_File_Autostart_Activate_Click
2284*/
2285Menu_File_Autostart_Activate_Click:
2286    call PB_AUTOSTART_Click
2287return
2288
2289/*:VRX         Menu_File_Autostart_Click
2290*/
2291Menu_File_Autostart_Click:
2292
2293return
2294
2295/*:VRX         Menu_File_Autostart_Deactivate_Click
2296*/
2297Menu_File_Autostart_Deactivate_Click:
2298    ok = SysDestroyObject("<EVFSGUI_AUTOSTART>")
2299    IF ok == 1 THEN do
2300        Text = NLVGetMessage( 79 )
2301        if Text = "" then Text = '[Autostart object created successfully]'
2302        CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
2303    end
2304    ELSE do
2305        Text = NLVGetMessage( 78 )
2306        if Text = "" then Text = '[Could find Autostart object]'
2307        Title = NLVGetMessage( 5 )
2308        if Title = "" then Title = '[Error]'
2309        CALL VRMessage 'Main', Text, Title, 'E'
2310    end
2311return
2312
2313/*:VRX         Menu_File_Close_Click
2314*/
2315Menu_File_Close_Click:
2316    call PB_CLOSE_Click
2317return
2318
2319/*:VRX         Menu_File_Load_Click
2320*/
2321Menu_File_Load_Click:
2322    call PB_LOAD_Click
2323return
2324
2325/*:VRX         Menu_File_Save_Click
2326*/
2327Menu_File_Save_Click:
2328    call PB_CONDET_SAVE_Click
2329return
2330
2331/*:VRX         Menu_File_Settings_Click
2332*/
2333Menu_File_Settings_Click:
2334    adv_changed = 0
2335    CALL VRLoadSecondary "SW_SETTINGS", "W"
2336    IF adv_changed == 1 THEN DO
2337        advanced.!logfile   = adv_logfile
2338        advanced.!loglevel  = adv_loglevel
2339        advanced.!browseauth= adv_browseauth
2340        advanced.!browseimme= adv_browseimme
2341        advanced.!debug     = adv_debug
2342        advanced.!special   = adv_special
2343        advanced.!savepassive=adv_savepassive
2344        advanced.!broadcast  =adv_broadcast
2345    END
2346return
2347
2348/*:VRX         Menu_Help_About_Click
2349*/
2350Menu_Help_About_Click:
2351    CALL VRMessage 'Main', VRGet("Main", "HintText")||'0D0A'x||'(c) 2007-2010 Alex Taylor and Herwig Bauernfeind',NLVGetMessage( 1 ), 'I'
2352return
2353
2354/*:VRX         Menu_Help_Extended_Click
2355*/
2356Menu_Help_Extended_Click:
2357    call PB_HELP_Click
2358return
2359
2360/*:VRX         Menu_Selected_Connect_Click
2361*/
2362Menu_Selected_Connect_Click:
2363    call PB_CONNECT_Click
2364return
2365
2366/*:VRX         Menu_Selected_Default_Workgroup_Click
2367*/
2368Menu_Selected_Default_Workgroup_Click:
2369    workgroupname = VRMethod("CN_smbtree","GetRecordAttr",SMBObj.rh,"Caption")
2370    ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
2371return
2372
2373/*:VRX         Menu_Selected_Info_Click
2374*/
2375Menu_Selected_Info_Click:
2376    IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click started'
2377
2378    ok = VRMethod( "CN_smbtree", "GetRecordList", "SourceOrSelected", "SelRH." )
2379    if SelRH.0 = 0 then do
2380        IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click aborted'
2381        return
2382    end
2383
2384    call _GetSMBObjectProperties SelRH.1
2385   
2386    IF options.!debug == 1 THEN say '  'samba.!smbclientexe' -L "'SMBObj.resname'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
2387    address cmd samba.!smbclientexe' -L "'SMBObj.resname'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
2388    infoline = linein(samba.!msg)
2389    if word(infoline,1) = "creating" then do /* upcase tables are missing */
2390        say "Missing upcase tables detected!"
2391        infoline = linein(samba.!msg)
2392        infoline = linein(samba.!msg)
2393    end
2394    IF options.!debug == 1 THEN say '  Response = "'Infoline'"'
2395    ok = stream(samba.!msg,'c','close')
2396    ok = SysFileDelete(samba.!msg)
2397
2398    window = VRLoadSecondary( "SW_INFO", "W" )
2399    IF options.!debug == 1 THEN SAY time()' Menu_Selected_Info_Click done'
2400return
2401
2402/*:VRX         Menu_Selected_Remove_Click
2403*/
2404Menu_Selected_Remove_Click:
2405    ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
2406    if selrec.0 = 0 then return
2407
2408    do I = 1 to selrec.0
2409        if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = '#68:PMWP.DLL' then do
2410            CALL VRMethod 'CN_CONDET', 'RemoveRecord', selrec.I
2411        end
2412        else do
2413            mountpoint = VRMethod('CN_CONDET', "GetFieldData", selrec.I, cd.mpointfh)
2414            mpidx = VRMethod('CN_CONDET', "GetFieldData", selrec.I, cd.mpidxfh)
2415            if mpidx = 1 then do
2416                btns.0 = 2
2417                btns.1 = NLVGetMessage( 6 )
2418                btns.2 = NLVGetMessage( 7 )
2419                confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
2420                IF confirm \= 1 THEN RETURN
2421
2422                dyn ="ok = "fs.!prefix"RxUnmount( mountpoint, mpidx )"
2423                IF options.!debug == 1 THEN SAY time()' '||dyn
2424                interpret dyn; drop dyn
2425                CALL VRMethod 'CN_CONDET', 'RemoveRecord', selrec.I
2426                CALL Refresh
2427            end
2428            else do
2429                CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
2430            end
2431        end
2432    end
2433return
2434
2435/*:VRX         Menu_Selected_Retry_Click
2436*/
2437Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. vfs. fs. advanced. cd. samba.
2438
2439    ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
2440    if srcrec.0 = 0 then return
2441
2442    srcrec = srcrec.1
2443
2444    p_mpoint    = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
2445
2446    p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.WorkgroupFH)
2447    p_server    = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
2448    p_share     = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
2449    p_user      = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
2450    p_password  = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
2451
2452    ShareLevel = 1
2453    if p_share     = "" then ShareLevel = 2
2454    if p_server    = "" then ShareLevel = 3
2455    if p_workgroup = "" then ShareLevel = 4
2456
2457    ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
2458    ok = VRset("CB_MOUNT"  , "Value", mtype.sharelevel)
2459
2460    ok = VRset("EF_SERVER" ,  "Value", p_server)
2461    ok = VRset("EF_SHARE"  ,  "Value", p_share)
2462    ok = VRset("EF_NETWORK",  "Value", p_workgroup)
2463    ok = VRset("EF_USER"   ,  "Value", p_user)
2464    ok = VRset("EF_PASSWORD", "Value", p_password)
2465
2466    parse var p_mpoint p_drv '\' p_dir
2467
2468    p_dir = strip(p_dir,'T','\')
2469
2470    ok = VRset("CB_DRIVES"      ,  "Value", p_drv)
2471    ok = VRset("EF_DIRECTORY"   ,  "Value", p_dir)
2472
2473    CALL PB_MOUNT_Click
2474
2475    if VRMethod( 'CN_CONDET', "ValidateRecord", srcRec) = 1 then do
2476        if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = '#68:PMWP.DLL' then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
2477    end
2478return
2479
2480/*:VRX         Menu_View_Buttons_Click
2481*/
2482Menu_View_Buttons_Click:
2483    current_height = VRGet("Main", "Height")
2484    buttons_height = margin * 2 + 400
2485    if settings.!buttonson = 1 then do
2486        ok = VRSet("Menu_View_Buttons","Checked",0)
2487        ok = VRset("GB_Buttons","Visible", 0)
2488        options.!buttondelta = 0
2489        settings.!buttonson = 0
2490        new_height = current_height - buttons_height
2491    end
2492    else do
2493        ok = VRSet("GB_Buttons","Visible", 1)
2494        ok = VRSet("Menu_View_Buttons","Checked",1)
2495        options.!buttondelta = buttons_height
2496        settings.!buttonson = 1
2497        new_height = current_height + buttons_height
2498    end
2499
2500    ok = VRSet("Main", "Height", new_height )
2501return
2502
2503/*:VRX         Menu_View_ConDet_Click
2504*/
2505Menu_View_ConDet_Click:
2506    if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
2507
2508    ok = VRset("GB_SMBTREE","Visible",  0)
2509    ok = VRset("GB_SMBTREE","Painting", 0)
2510    ok = VRset("GB_Dialog", "Visible",  0)
2511    ok = VRset("GB_Dialog", "Painting", 0)
2512    ok = VRset("GB_CONDET", "Visible",  1)
2513    ok = VRset("GB_CONDET", "Painting", 1)
2514
2515    ok = VRSet("Menu_View_SmbTree","Checked",  0)
2516    ok = VRSet("Menu_View_Dialog", "Checked",  0)
2517    ok = VRSet("Menu_View_ConDet", "Checked",  1)
2518
2519    /* Hide any "foreign" menu entries */
2520    ok = VRSet("Menu_Selected_Connect", "Visible", 0)
2521return
2522
2523/*:VRX         Menu_View_Dialog_Click
2524*/
2525Menu_View_Dialog_Click:
2526    if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
2527
2528    ok = VRset("GB_SMBTREE","Visible", 0)
2529    ok = VRset("GB_SMBTREE","Painting", 0)
2530    ok = VRset("GB_CONDET", "Visible",  0)
2531    ok = VRset("GB_CONDET", "Painting", 0)
2532    ok = VRset("GB_Dialog", "Visible", 1)
2533    ok = VRset("GB_Dialog", "Painting", 1)
2534
2535    ok = VRSet("Menu_View_SmbTree","Checked", 0)
2536    ok = VRSet("Menu_View_ConDet", "Checked", 0)
2537    ok = VRSet("Menu_View_Dialog", "Checked", 1)
2538
2539    ok = VRSet("Menu_Selected_Remove", "Visible",  0)
2540    ok = VRSet("Menu_Selected_Retry",  "Visible",  0)
2541
2542    ok = VRSet("Menu_Selected_Connect", "Visible",  0)
2543
2544    call _DialogPopulate
2545return
2546
2547/*:VRX         Menu_View_MiniIcons_Click
2548*/
2549Menu_View_MiniIcons_Click:
2550    advanced.!bigicons = \advanced.!bigicons
2551    ok = VRset("CN_CURRENT", "MiniIcons", \advanced.!bigicons)
2552    ok = VRset("CN_SMBTREE", "MiniIcons", \advanced.!bigicons)
2553    ok = VRset("CN_CONDET",  "MiniIcons", \advanced.!bigicons)
2554    ok = VRset("Menu_View_MiniIcons",  "Checked", \advanced.!bigicons)
2555return
2556
2557/*:VRX         Menu_View_SmbTree_Click
2558*/
2559Menu_View_SmbTree_Click:
2560    if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
2561
2562    ok = VRset("GB_Dialog",  "Visible", 0)
2563    ok = VRset("GB_Dialog", "Painting", 0)
2564    ok = VRset("GB_CONDET", "Visible",  0)
2565    ok = VRset("GB_CONDET", "Painting", 0)
2566    ok = VRset("GB_SMBTREE","Painting", 1)
2567    ok = VRset("GB_SMBTREE","Visible",  1)
2568
2569    ok = VRSet("Menu_View_Dialog","Checked",  0)
2570    ok = VRSet("Menu_View_ConDet","Checked",  0)
2571    ok = VRSet("Menu_View_SmbTree","Checked", 1)
2572
2573    /* Hide any "foreign" menu entries */
2574    ok = VRSet("Menu_Selected_Remove", "Visible", 0)
2575    ok = VRSet("Menu_Selected_Retry",  "Visible", 0)
2576return
2577
2578/*:VRX         Mount
2579*/
2580Mount: PROCEDURE EXPOSE settings. options. vfs. fs. advanced. cd. samba.
2581    IF options.!debug == 1 THEN SAY time()' Mount procedure started'
2582    /* Set mouse pointer to wait - this operation might take a few seconds */
2583    call VRSet VRWindow(), 'Pointer', 'Wait'
2584
2585/*  Disabled because we merge profile now - in earlier revisions
2586    we replaced it but only for preexisting drives - this made only
2587    as long as we were unabled to detect double connections - this could be made an option!
2588    IF options.!autoload then do
2589        dyn = "ok = "fs.!prefix"RxDetach(vfs.!drive)"
2590        IF options.!debug == 1 THEN SAY time()' '||dyn
2591            interpret dyn; drop dyn
2592
2593        IF options.!debug == 1 THEN SAY time()' '||'Autoload Detach "'vfs.!drive'" =' ok
2594    end */
2595
2596    /* Attach the virtual drive - only if drive is not already attached */
2597    if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
2598        dyn = "ok = "fs.!prefix"RxAttach( vfs.!drive )"
2599        IF options.!debug == 1 THEN SAY time()' '||dyn
2600
2601        interpret dyn; drop dyn
2602
2603        IF options.!debug == 1 THEN SAY time()' '||'Attach "'vfs.!drive'" =' ok
2604    end
2605
2606    /* Create the mount point and store whether it was created or already existed */
2607    dyn = "CreateMP = "fs.!prefix"RxCreateMountPoint( vfs.!mountpoint )"
2608    IF options.!debug == 1 THEN SAY time()' '||dyn
2609    interpret dyn; drop dyn
2610
2611    IF options.!debug == 1 THEN SAY time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
2612
2613
2614    /* Build the resource parameter string */
2615    src = ''
2616    IF options.!workgroup  \= '' THEN src = src';WORKGROUP='options.!workgroup
2617    IF options.!server     \= '' THEN src = src';SERVER='options.!server
2618    IF options.!share      \= '' THEN src = src';SHARE='options.!share
2619    IF options.!user       \= '' THEN src = src';USER='options.!user
2620    IF options.!password   \= '' THEN src = src';PASSWORD='options.!password
2621    IF options.!spassword  \= '' THEN src = src';SPASSWORD='options.!spassword
2622    IF options.!master     \= '' THEN src = src';MASTER='options.!master
2623    IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
2624/*  IF options.!memlen     \= '' THEN src = src';MEMLEN='options.!memlen
2625    IF options.!logfile    \= '' THEN src = src';LOGFILE='options.!logfile
2626    IF options.!loglevel   \= '' THEN src = src';LOGLEVEL='options.!loglevel */
2627    IF options.!easupport  \= '' THEN src = src';EASUPPORT='options.!easupport
2628
2629    IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
2630
2631    parse var vfs.!mountpoint mpoint ';' .
2632    mpoint = strip(mpoint,'T','\')||'\'
2633
2634    if options.!master   = "" then options.!master   = "WORKGROUP"
2635    if options.!mtype    = "" then options.!mtype    = "1"
2636    if options.!loglevel = "" then options.!loglevel = "0"
2637    if options.!memlen   = "" then options.!memlen   = "2"
2638    if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
2639    if options.!password <> "" & options.!spassword = "" then do
2640        options.!spassword = c2x(options.!password)
2641        options.!password = ""
2642    end
2643
2644    hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
2645
2646    md5 = rexx_md5(hashstr)
2647
2648    CALL VRMethod 'CN_CONDET', 'GetRecordList', 'All', 'records.'
2649    DO i = 1 TO records.0
2650        hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
2651
2652        IF options.!debug == 1 THEN say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
2653        IF options.!debug == 1 THEN say mpoint'->'md5
2654
2655        if hash = md5 then do
2656            If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = '#64:PMWP.DLL' then do /* Same hash, status active */
2657                say "Double connection detected!!"
2658                if options.!spassword <> "" then upw = ":********"
2659                else upw = ""
2660                buttons.0 = 2
2661                buttons.1 = NLVGetMessage(9)
2662                buttons.2 = NLVGetMessage(3)
2663                Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
2664                if Answer = 2 then do
2665                    call VRSet VRWindow(), 'Pointer', '<default>'
2666                    say "Double connection - do not mount!!"
2667                    return
2668                end
2669            end
2670            else do /* Same hash, status passive - we have to remove it */
2671                ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
2672            end
2673        end
2674    end
2675
2676    cd.lastrh = ""
2677    ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
2678
2679    /* Now mount the resource */
2680    dyn ="ok = "fs.!prefix"RxMount('smbfs', vfs.!mountpoint, src, rwFlag)"
2681    IF options.!debug == 1 THEN SAY time()' '||dyn
2682    interpret dyn; drop dyn
2683
2684    IF options.!debug == 1 THEN SAY time()' '||'Mount "'vfs.!mountpoint'" =' ok
2685    if ok <> 0 then do
2686        if options.!password <> "" then upw = ":********"
2687            else upw = ""
2688        buttons.0 = 2
2689        buttons.1 = NLVGetMessage(2)
2690        buttons.2 = NLVGetMessage(37)
2691        Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36,  options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
2692        if Answer = 2 then do /* Show explanation */
2693            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')
2694        end
2695        if cd.lastrh <> '' then do
2696            ok = VRMethod("CN_CONDET", "SetFieldData",  cd.lastrh, cd.statusfh, '#68:PMWP.DLL') /* Passive Connection icon */
2697            ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", '#68:PMWP.DLL') /* Passive Connection icon */
2698            ok = VRMethod("CN_CONDET", "SetFieldData",  cd.lastrh, cd.passwordfh, '') /* remove pain text password */
2699        end
2700
2701        /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
2702        if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
2703            dyn ="ok = "fs.!prefix"RxDeleteMountPoint( vfs.!mountpoint )"
2704            interpret dyn
2705            IF options.!debug == 1 THEN SAY time()' '||'Remove "'vfs.!mountpoint'" = 'ok
2706        end
2707    end
2708    drop CreateMP /* not required anymore */
2709
2710/*  Obsolete - the IOCtl will not be implemented this way in the plugin
2711    The REXX function is present, but is has no counterpart in the plugin
2712    ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
2713    IF options.!debug == 1 THEN SAY time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
2714 */
2715    /* Set mouse pointer to default again */
2716    call VRSet VRWindow(), 'Pointer', '<default>'
2717    IF options.!debug == 1 THEN SAY time()' Mount procedure done'
2718RETURN ok
2719
2720/*:VRX         MyFreeDriveMap
2721*/
2722MyFreeDriveMap: procedure expose options. fs. samba.
2723    IF options.!debug == 1 THEN SAY time()' MyFreeDriveMap(proc) started'
2724    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:"
2725/*  IF options.!debug == 1 THEN SAY time()' '||"SysDriveMap(USED) started" */
2726    useddrives= SysDriveMap("C:","USED")
2727/*  IF options.!debug == 1 THEN SAY time()' '||"SysDriveMap(USED) done" */
2728
2729    Alldr = words(alldrives)
2730    FreeDriveMap = ""
2731    do I = 1 to AllDr
2732        if word(alldrives,1) = word(useddrives,1) then do
2733            Useddrives = subword(useddrives,2)
2734            Alldrives = subword(Alldrives,2)
2735        end
2736        else do
2737            FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
2738            Alldrives = subword(Alldrives,2)
2739        end
2740    end
2741    IF options.!debug == 1 THEN SAY time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
2742return FreeDriveMap
2743/*:VRX         NoEVFSCALL
2744*/
2745NoEVFSCALL:
2746    CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
2747    signal Halt
2748RETURN
2749
2750/*:VRX         ParseCommandLine
2751*/
2752ParseCommandLine:
2753    IF options.!debug == 1 THEN SAY time()' ParseCommandLine() started'
2754    CmdLine = VRGet("Application","Commandline")
2755    upCmdLine = translate(CmdLine)
2756    IF options.!debug == 1 THEN SAY '  Commandline = "'CmdLine'"'
2757
2758    ForceNDFS = 0
2759    if wordpos('-NDFS',upCmdLine) > 0 then do
2760        IF options.!debug == 1 THEN SAY "  NDFS switch detected"
2761        CmdLine = delWord(CmdLine,wordpos('-NDFS',upCmdLine),1)
2762        upCmdLine = translate(CmdLine)
2763        ForceNDFS = 1
2764        CALL VRSet "PB_AutoStart","Visible", 0
2765    end
2766
2767    if wordpos('-AUTOCLOSE',upCmdLine) > 0 then do
2768        options.!autoclose = 1
2769        IF options.!debug == 1 THEN SAY "  AutoClose switch detected"
2770        CmdLine = delWord(CmdLine,wordpos('-AUTOCLOSE',upCmdLine),1)
2771        upCmdLine = translate(CmdLine)
2772    end
2773    if wordpos('-NOGUI',upCmdLine) > 0 then do
2774        options.!nogui = 1
2775        options.!autoclose = 1
2776        IF options.!debug == 1 THEN SAY "  -NOGUI switch detected"
2777        CmdLine = delWord(CmdLine,wordpos('-NOGUI',upCmdLine),1)
2778        upCmdLine = translate(CmdLine)
2779    end
2780
2781    Profile = strip(CmdLine,,'"')
2782    if Profile <> "" then do
2783        Profile = strip(VRParseFilename(Profile,"DPNE"))
2784        options.!autoload   = 1
2785        IF options.!debug == 1 THEN SAY '  Profile = "'Profile'"'
2786        if \VRFileExists(Profile) then do
2787            CALL VRMessage 'Main', NLVGetMessage( 102, Profile ), NLVGetMessage( 1 ), 'E'
2788            /* Disable all switches in case of an error */
2789            options.!autoload  = 0
2790            options.!autoclose = 0
2791            options.!nogui     = 0
2792        end
2793    end
2794    IF options.!debug == 1 THEN SAY time()' ParseCommandLine done'
2795return
2796
2797/*:VRX         ParseResourceData
2798*/
2799ParseResourceData: PROCEDURE EXPOSE userdata options. advanced. fs. cd. samba.
2800    PARSE ARG userdata, resdata
2801    IF options.!debug == 1 THEN SAY time()' ParseResourceData started'
2802    IF options.!debug == 1 THEN SAY '  receiving "'userdata'" "'resdata'" length ('length(resdata)')'
2803
2804/* WARNING! resdata has a maximal length of 255 and is truncated otherwise */
2805
2806/*  PARSE VAR resdata . ';WORKGROUP='p_domain';SERVER='p_server';SHARE='p_share';' . */
2807
2808    if left(word(resdata,1),5) <> "SMBFS" then do
2809        /* Support for other filesystems would come here! */
2810        userData = "UNKNOWN"
2811    end
2812    else do
2813        cd.lastrh = VRMethod("CN_CONDET","AddRecord")
2814        PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
2815
2816        p_mpoint = strip(p_mpoint,'T','\')||'\'
2817        p_rw     = word(resdata, words(resdata))
2818
2819        /* Workaround for truncated resdata string */
2820        if length(p_rw) > 1 then do
2821            /* The resdata string must have been truncated
2822               p_rw is already wrong and
2823               p_easupport will most likely be also wrong (look below for workaround!) */
2824            p_rw ="W" /* this is guessed only!!! */
2825            IF options.!debug == 1 THEN SAY '  WARNING! Detected truncated resdata string - shorten workgroup name, server name, share name until this message goes away!'
2826        end
2827        /* this should be done unconditionally if the resdata string is never truncated */
2828        else resdata  = left(resdata,length(resdata)-length(p_rw))
2829
2830        PARSE VAR resdata . 'WORKGROUP=' p_domain ';' .
2831        PARSE VAR resdata . 'SERVER=' p_server ';' .
2832        PARSE VAR resdata . 'SHARE=' p_share ';' .
2833        PARSE VAR resdata . 'USER=' p_user ';' .
2834        PARSE VAR resdata . ';PASSWORD=' p_password ';' .
2835        PARSE VAR resdata . 'SPASSWORD=' p_spassword ';' .
2836        PARSE VAR resdata . 'MASTER=' p_master ';' .
2837        PARSE VAR resdata . 'MASTERTYPE=' p_mtype ';' .
2838        PARSE VAR resdata . 'MEMLEN=' p_memlen ';' .
2839        PARSE VAR resdata . 'LOGFILE=' p_logfile ';' .
2840        PARSE VAR resdata . 'LOGLEVEL=' p_loglevel ';' .
2841        PARSE VAR resdata . 'EASUPPORT=' p_easupport ' '
2842
2843        if p_master   = "" then p_master   = "WORKGROUP"
2844        if p_mtype    = "" then p_mtype    = "1"
2845        if p_loglevel = "" then p_loglevel = "0"
2846        if p_memlen   = "" then p_memlen   = "2"
2847
2848        /* Also works around for a truncated resdata string! */
2849        if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
2850
2851        if p_password <> "" & p_spassword = "" then do
2852            p_spassword = c2x(p_password)
2853            p_password = ""
2854        end
2855
2856        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)
2857        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
2858        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)
2859        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, '#64:PMWP.DLL') /* Active */
2860        ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", '#64:PMWP.DLL') /* Active */
2861
2862        hashstr = p_mpoint' 'translate(p_domain)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
2863
2864        md5 = rexx_md5(hashstr)
2865
2866        ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
2867
2868        SELECT
2869            WHEN p_share  == '' & p_server \= '' THEN DO   /* all shares on server */
2870                IF p_domain == '' THEN
2871                    userdata = userdata';\\'p_server'\*'
2872                ELSE
2873                    userdata = userdata';'p_domain':\\'p_server'\*'
2874            END
2875            WHEN p_server == '' & p_domain \= '' THEN    /* all servers in workgroup */
2876                userdata = userdata';'p_domain':\\*'
2877            WHEN p_server == '' & p_domain == '' THEN    /* all workgroups */
2878                userdata = userdata';*:\\*'
2879            OTHERWISE DO
2880                IF p_domain == '' THEN
2881                    userdata = userdata';\\'p_server'\'p_share
2882                ELSE
2883                    userdata = userdata';'p_domain':\\'p_server'\'p_share
2884            END
2885        END
2886    end
2887
2888    IF options.!debug == 1 THEN SAY '  returning "'userdata'"'
2889    IF options.!debug == 1 THEN SAY time()' ParseresdataData done'
2890RETURN userdata
2891
2892/*:VRX         PB_ADVANCED_Click
2893*/
2894PB_ADVANCED_Click:
2895    adv_changed = 0
2896    CALL VRLoadSecondary "SW_ADVANCED", "W"
2897    IF adv_changed == 1 THEN DO
2898        advanced.!memlen    = adv_memlen
2899        advanced.!easupport = adv_eas
2900        advanced.!readonly  = adv_readonly
2901        advanced.!alwaysmp  = adv_alwaysmp
2902    END
2903RETURN
2904
2905/*:VRX         PB_ADVCANCEL_Click
2906*/
2907PB_ADVCANCEL_Click:
2908
2909    adv_changed = 0
2910    CALL SW_ADVANCED_Close
2911
2912RETURN
2913
2914/*:VRX         PB_ADVHELP_Click
2915*/
2916PB_ADVHELP_Click:
2917    CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
2918return
2919
2920/*:VRX         PB_ADVOK_Click
2921*/
2922PB_ADVOK_Click:
2923
2924    adv_memlen     = VRGet( "SPB_MEMLEN",    "Value" )
2925    adv_eas        = VRGet( "CB_EAS",        "Set" )
2926    adv_readonly   = VRGet( "CB_READONLY",   "Set" )
2927    adv_alwaysmp   = VRGet( "CB_ALWAYSMP",   "Set" )
2928
2929    CALL SW_ADVANCED_Close
2930
2931return
2932
2933/*:VRX         PB_AUTOSTART_Click
2934*/
2935PB_AUTOSTART_Click: /* PROCEDURE EXPOSE settings. options. Profile fs. cd. advanced. samba. */
2936    options.!autostart = 1
2937
2938    Profile    = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
2939    ExeName    = VRParseFileName(VRget("Application","Program"),'DPNE')
2940    if ExeName = "" then do
2941        parse source . . script
2942        ExeName = VRParseFilename(script,'DP')'\EVFSGUI.EXE'
2943    end
2944    StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
2945    if StartupDir = "" then do
2946        parse source . . script
2947        StartUpDir = VRParseFilename(script,'DP')
2948    end
2949   
2950    ObjTitle   = NLVGetMessage( 59 )
2951    if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
2952
2953    CALL PB_SAVE_Click
2954
2955    rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
2956            'EXENAME='||ExeName||';'||,
2957            'PROGTYPE=PM;'||,
2958            'TITLE='ObjTitle';'||,
2959            'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
2960            'STARTUPDIR='StartupDir';'||,
2961            'NOPRINT=YES;'||,
2962            'HIDEBUTTON=DEFAULT;'||,
2963            'MINWIN=DEFAULT;'||,
2964            'CCVIEW=DEFAULT;'||,
2965            'DEFAULTVIEW=DEFAULT;'||,
2966            'OBJECTID=<EVFSGUI_AUTOSTART>',,
2967        'REPLACE' )
2968
2969    IF rc == 1 THEN do
2970        Text = NLVGetMessage( 60 )
2971        if Text = "" then Text = '[Created object in Autostart-Folder]'
2972        CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
2973    end
2974    ELSE do
2975        Text = NLVGetMessage( 61 )
2976        if Text = "" then Text = '[Could not create object in Autostart-Folder]'
2977        Title = NLVGetMessage( 5 )
2978        if Title = "" then Title = '[Error]'
2979        CALL VRMessage 'Main', Text, Title, 'E'
2980    end
2981
2982    options.!autostart = 0
2983RETURN
2984
2985/*:VRX         PB_CLOSE_Click
2986*/
2987PB_CLOSE_Click:
2988    CALL Quit
2989return
2990
2991/*:VRX         PB_CONDET_LOAD_Click
2992*/
2993PB_CONDET_LOAD_Click:
2994    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click started"
2995    call PB_LOAD_CLICK
2996    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click done"
2997RETURN
2998
2999/*:VRX         PB_CONDET_SAVE_Click
3000*/
3001PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. Profile fs.  cd. advanced. samba.
3002    IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_SAVE_Click started"
3003
3004    if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3005    ELSE filename = Profile
3006
3007    IF filename == '' THEN RETURN
3008
3009    IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3010        btns.0 = 2
3011        btns.1 = NLVGetMessage( 6 )
3012        if btns.1 = "" then btns.1 = '[Yes]'
3013        btns.2 = NLVGetMessage( 7 )
3014        if btns.2 = "" then btns.2 = '[No]'
3015        Title = NLVGetMessage( 53 )
3016        if Title = "" then Title = "[File exists]"
3017        Text = NLVGetMessage( 54, filename )
3018        if Text = "" then Text = "[File "filename" exists? Overwrite?]"
3019
3020        confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
3021        IF confirm \= 1 THEN RETURN
3022        CALL VRChAttr filename,, 'HSR'
3023        CALL VRDeleteFile filename
3024    END
3025
3026    CALL VRMethod 'CN_CONDET', 'GetRecordList', 'All', 'records.'
3027    DO i = 1 TO records.0
3028        resdata = ""
3029        resdata = resdata||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
3030        resdata = resdata||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
3031        resdata = resdata||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3032        resdata = resdata||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3033        resdata = resdata||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3034        resdata = resdata||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgroupfh)
3035        resdata = resdata||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3036        resdata = resdata||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3037        resdata = resdata||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3038        resdata = resdata||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
3039        resdata = resdata||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
3040        resdata = resdata||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
3041        resdata = resdata||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
3042/*      resdata = resdata||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
3043        resdata = resdata||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
3044        resdata = resdata||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
3045        resdata = resdata||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
3046        resdata = resdata||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
3047        call lineout filename, resdata
3048    END
3049    CALL STREAM filename, 'C', 'CLOSE'
3050
3051    if options.!autostart == 0 THEN do
3052        Title = NLVGetMessage( 51 )
3053        if Title = "" then Title = "[Profile saved]"
3054        Text = NLVGetMessage( 52, filename )
3055        if Text = "" then Text = "[Profile saved to "filename"!]"
3056        CALL VRMessage 'Main', Text , Title, 'I'
3057    end
3058
3059    IF options.!debug == 1 THEN SAY time()' '||"PB_CONDET_SAVE_Click done"
3060RETURN
3061
3062/*:VRX         PB_CONNECT_Click
3063*/
3064PB_CONNECT_Click: PROCEDURE EXPOSE settings. options. fs. advanced. cd. samba.
3065    IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click started"
3066
3067    ok = VRMethod( "CN_SMBTREE", "GetRecordList", "Selected", "SelRH." )
3068
3069    if SelRH.0 = 0 then do
3070        IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click aborted"
3071        return
3072    end
3073
3074    p_workgroup = ''
3075    p_server    = ''
3076    p_share     = ''
3077
3078    srcFile = ""
3079    srcCtn  = VRGet("CN_SMBTREE","Self")
3080    srcRec  = SelRH.1
3081    trgCtn  = VRGet("CN_CURRENT","Self")
3082    trgRec  = ""
3083
3084    IF options.!debug == 1 THEN do
3085        say '  srcCtn      = "'srcCtn'"'
3086        if srcCtn <> "" then say '  srcCtn name = "'VRGet(srcCtn,'Name')'"'
3087        say '  srcRec      = "'srcRec'"'
3088        say '  trgCtn      = "'trgCtn'"'
3089        if trgCtn <> "" then say '  trgCtn name = "'VRGet(trgCtn,'Name')'"'
3090        say '  trgRec      = "'trgRec'"'
3091    end
3092
3093    ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
3094
3095    DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
3096    ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
3097
3098    if ParentRH = "" then do /* A workgroup was dragged */
3099        say "Workgroup dragged!"
3100        parse var DragCapt p_workgroup '0D0A'x .
3101        p_workgroup = strip(p_workgroup)
3102        ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
3103        ok = VRSet("EF_SERVER","Value","")
3104        ok = VRSet("EF_SHARE","Value","")
3105
3106        ShareLevel = 3
3107    end
3108    else do
3109        ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
3110        GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
3111
3112        if GParentRH = "" then do /* A server was dragged */
3113            say "Server dragged!"
3114            parse var ParDragCapt p_workgroup '0D0A'x .
3115            ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
3116            p_workgroup = strip(p_workgroup)
3117
3118            parse var DragCapt p_server '0D0A'x .
3119            p_server = strip(p_server)
3120            ok = VRSet("EF_SERVER","Value",strip(p_server))
3121            ok = VRSet("EF_Share","Value","")
3122
3123            ShareLevel = 2
3124        end
3125        else do /* A share was dragged */
3126            say "Share dragged!"
3127            GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
3128
3129            parse var GParDragCapt p_workgroup '0D0A'x .
3130            p_workgroup = strip(p_workgroup)
3131            ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
3132
3133            parse var ParDragCapt p_server '0D0A'x .
3134            p_server = strip(p_server)
3135            ok = VRSet("EF_SERVER","Value",strip(p_server))
3136
3137            parse var DragCapt p_share '0D0A'x .
3138            p_share = strip(p_share)
3139            ok = VRSet("EF_Share","Value",strip(p_share))
3140
3141            ShareLevel = 1
3142        end
3143    end
3144
3145    say 'p_workgroup = "'p_workgroup'"'
3146    say 'p_server   = "'p_server'"'
3147    say 'p_share = "'p_share'"'
3148
3149    ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
3150    call CB_MOUNT_Change
3151
3152    if trgRec = "" then do
3153        window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
3154        if VRGet("CB_DRIVES","Value") = "" then return
3155    end
3156    else do
3157
3158        TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
3159
3160        parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
3161
3162        do while parTrgRH <> ""
3163            partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
3164            TargetString = partrgCapt||'\'||TargetString
3165            parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
3166        end
3167        say 'TargetString = "'TargetString'"'
3168        ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
3169        ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
3170    end
3171
3172    window = VRLoadSecondary( "SW_LOGIN", "W" )
3173
3174    call PB_MOUNT_CLICK
3175
3176    IF options.!debug == 1 THEN SAY time()' '||"PB_CONNECT_Click done"
3177RETURN
3178
3179/*:VRX         PB_DETACH_Click
3180*/
3181PB_DETACH_Click: PROCEDURE EXPOSE settings. options. fs. cd. samba.
3182    IF options.!debug == 1 THEN SAY time()' '||"PB_DETACH_Click started"
3183    CALL VRMethod 'CN_CURRENT', 'GetRecordList', 'Selected', 'select.'
3184    IF select.0 < 1 THEN RETURN
3185
3186    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', select.1, 'UserData')
3187    PARSE VAR userdata mountpoint ';' mounts ';' .
3188    drive = STRIP( mountpoint, 'T', '\')
3189
3190    btns.0 = 2
3191    btns.1 = NLVGetMessage( 6 )
3192    btns.2 = NLVGetMessage( 7 )
3193    confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3194    IF confirm \= 1 THEN RETURN
3195
3196    /* TODO: ??  Unmount & delete all child mountpoints? */
3197
3198    /* Unmount any resources */
3199    DO i = 1 TO mounts
3200        dyn ="ok = "fs.!prefix"RxUnmount( mountpoint, i-1 )"
3201        IF options.!debug == 1 THEN SAY time()' '||dyn
3202        interpret dyn; drop dyn
3203/* IF options.!debug == 1 THEN SAY time()' '||'Unmount resource' i-1 '=' ok */
3204    END
3205
3206    dyn ="ok = "fs.!prefix"RxDetach( drive )"
3207    IF options.!debug == 1 THEN SAY time()' '||dyn
3208    interpret dyn; drop dyn
3209/* IF options.!debug == 1 THEN SAY time()' '||'Detach' drive '=' ok */
3210
3211    CALL Refresh
3212    IF options.!debug == 1 THEN SAY time()' '||"PB_DETACH_Click done"
3213RETURN
3214
3215/*:VRX         PB_EDITCANCEL_Click
3216*/
3217PB_EDITCANCEL_Click:
3218    options.!editmode = 0
3219    CALL VRSet "PB_UNMOUNT","Enabled", 1
3220    CALL VRSet "PB_SAVE","Enabled", 1
3221    CALL VRSet "PB_LOAD","Enabled", 1
3222    CALL VRSet "GB_CURRENT", "ENABLED", 1
3223    ok = VRSet("PB_EDITCANCEL","Visible", 0)
3224    CALL NLVSetText 'DT_DIALOG',        'Caption', 13
3225RETURN 0
3226
3227/*:VRX         PB_HELP_Click
3228*/
3229PB_HELP_Click:
3230    CALL VRMethod 'Main', 'InvokeHelp'
3231return
3232
3233/*:VRX         PB_INFO_OK_Click
3234*/
3235PB_INFO_OK_Click:
3236    call SW_INFO_Close
3237RETURN
3238
3239/*:VRX         PB_LOAD_Click
3240*/
3241PB_LOAD_Click: PROCEDURE EXPOSE settings. options. advanced. vfs. Profile fs. cd. samba.
3242    IF options.!autoload == 1 then filename = Profile
3243    else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3244    IF filename == '' THEN RETURN
3245    IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3246        CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3247        RETURN
3248    END
3249
3250    CALL LINEIN filename, 1, 0
3251    DO WHILE LINES( filename )
3252        PARSE VALUE LINEIN( filename ) WITH node resource rwFlag
3253
3254        vfs.!drive      = FILESPEC('DRIVE', node )
3255        vfs.!mountpoint = STRIP( node, 'T', '\')
3256
3257        /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3258        if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3259
3260
3261        PARSE VAR resource . 'WORKGROUP=' workgroup ';' .
3262        PARSE VAR resource . 'SERVER=' server ';' .
3263        PARSE VAR resource . 'SHARE=' share ';' .
3264        PARSE VAR resource . 'USER=' user ';' .
3265        PARSE VAR resource . 'PASSWORD=' password ';' .
3266        PARSE VAR resource . 'SPASSWORD=' spassword ';' .
3267        PARSE VAR resource . 'MASTER=' master ';' .
3268        PARSE VAR resource . 'MASTERTYPE=' mtype ';' .
3269/*      PARSE VAR resource . 'MEMLEN=' memlen ';' .
3270        PARSE VAR resource . 'LOGFILE=' logfile ';'.
3271        PARSE VAR resource . 'LOGLEVEL=' loglevel ';' . */
3272        PARSE VAR resource . 'EASUPPORT=' easupport .
3273
3274        options.!workgroup  = workgroup
3275        options.!server     = server
3276        options.!share      = share
3277        options.!user       = user
3278        options.!password   = password
3279        options.!spassword  = spassword
3280        options.!master     = master
3281        options.!mastertype = mtype
3282/*      options.!memlen     = memlen
3283        options.!logfile    = logfile
3284        options.!loglevel   = loglevel */
3285        options.!easupport  = easupport
3286
3287        IF rwFlag == 'R' THEN
3288            options.!readonly = 1
3289        ELSE
3290            options.!readonly = 0
3291
3292        CALL Mount
3293
3294    END
3295    CALL STREAM filename, 'C', 'CLOSE'
3296
3297    options.!autoload = 0
3298
3299    CALL Refresh
3300RETURN
3301
3302/*:VRX         PB_LOGIN_CANCEL_Click
3303*/
3304PB_LOGIN_CANCEL_Click:
3305    call SW_LOGIN_Close
3306RETURN 0
3307
3308/*:VRX         PB_LOGIN_OK_Click
3309*/
3310PB_LOGIN_OK_Click:
3311    ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
3312    ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
3313
3314    call SW_LOGIN_Close
3315RETURN
3316
3317/*:VRX         PB_MOUNT_Click
3318*/
3319PB_MOUNT_Click:
3320    IF options.!debug == 1 THEN SAY time()' '||"PB_MOUNT_Click started"
3321    ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
3322say "network = "network
3323    if options.!editmode = 1 then do
3324        CALL PB_UNMOUNT_Click
3325        options.!editmode = 0
3326        CALL NLVSetText 'DT_DIALOG',        'Caption', 13
3327        CALL VRSet "PB_UNMOUNT","Enabled", 1
3328        CALL VRSet "PB_SAVE","Enabled", 1
3329        CALL VRSet "PB_LOAD","Enabled", 1
3330        CALL VRSet "GB_CURRENT", "ENABLED", 1
3331    end
3332
3333    options.!workgroup  = ''
3334    options.!server     = ''
3335    options.!share      = ''
3336    options.!user       = ''
3337    options.!password   = ''
3338    options.!master     = ''
3339    options.!mastertype = ''
3340    options.!memlen     = advanced.!memlen
3341    options.!easupport  = advanced.!easupport
3342    options.!readonly   = advanced.!readonly
3343    options.!loglevel   = advanced.!loglevel
3344    options.!logfile    = advanced.!logfile
3345
3346    vfs.!drive      = ''
3347    vfs.!mountpoint = ''
3348
3349    stype    = VRGet( "CB_MOUNT",            "Selected" )
3350    share    = STRIP( VRGet( "EF_SHARE",     "Value" ))
3351    server   = STRIP( VRGet( "EF_SERVER",    "Value" ))
3352    network  = STRIP( VRGet( "EF_NETWORK",   "Value" ))
3353    mtype    = VRGet( "CHK_MTYPE",           "Set" )
3354    userid   = STRIP( VRGet( "EF_USER",      "Value" ))
3355    password = STRIP( VRGet( "EF_PASSWORD",  "Value" ))
3356    mdrive   = VRGet( "CB_DRIVES",           "SelectedText" )
3357    if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
3358    mpath    = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
3359
3360    IF ( stype < 1 | stype > 4 ) THEN stype = 1
3361
3362    /* The required/optional/ignored parameters depend on the type of mount
3363     * requested.  (Note, however, that the user, password, easupport and
3364     * memlen parameters are always optional.)
3365     */
3366    SELECT
3367        /* Scenario 1: Mount a single share.
3368         *             Required: share, server
3369         *             Optional: workgroup
3370         *             Unused:   master, mastertype
3371         */
3372        WHEN stype = 1 THEN DO
3373            IF server == '' | share == '' THEN DO
3374                /* error */
3375                RETURN 1
3376            END
3377            options.!server    = server
3378            options.!share     = share
3379            options.!workgroup = network
3380        END
3381
3382        /* Scenario 2: Mount all shares on a server.
3383         *             Required: server
3384         *             Optional: workgroup
3385         *             Unused:   share, master, mastertype
3386         */
3387        WHEN stype = 2 THEN DO
3388            IF server == '' THEN DO
3389                /* error */
3390                RETURN 1
3391            END
3392            options.!server = server
3393            options.!workgroup = network
3394        END
3395
3396        /* Scenario 3: Mount all servers in a workgroup.
3397         *             Required: workgroup
3398         *             Optional: -
3399         *             Unused:   share, server, master, mastertype
3400         */
3401        WHEN stype = 3 THEN DO
3402            IF workgroup == '' THEN DO
3403                /* error */
3404                RETURN 1
3405            END
3406            options.!workgroup  = network
3407        END
3408
3409        /* Scenario 4: Mount all workgroups known to a master.
3410         *             Required: master, mastertype
3411         *             Optional: -
3412         *             Unused:   share, server, workgroup
3413         */
3414        WHEN stype = 4 THEN DO
3415            IF master == '' | mastertype == '' THEN DO
3416                /* error */
3417                RETURN 1
3418            END
3419            options.!master     = network
3420            options.!mastertype = mtype
3421        END
3422    END
3423
3424    options.!user     = userid
3425    options.!password = password
3426
3427    vfs.!drive      = mdrive
3428    vfs.!mountpoint = mdrive'\'mpath
3429
3430    CALL Mount
3431    CALL Refresh
3432    ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
3433    IF options.!debug == 1 THEN SAY time()' '||"PB_MOUNT_Click done"
3434RETURN 0
3435
3436/*:VRX         PB_NEWMOUNTPOINTCANCEL_Click
3437*/
3438PB_NEWMOUNTPOINTCANCEL_Click:
3439    ok = VRSet("CB_DRIVES","Value","")
3440    ok = VRSet("EF_DIRECTORY","Value","")
3441    call SW_MOUNTPOINT_Close
3442RETURN 0
3443
3444/*:VRX         PB_NEWMOUNTPOINTOK_Click
3445*/
3446PB_NEWMOUNTPOINTOK_Click:
3447    ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
3448    ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
3449    advanced.!readonly  = VRGet("CB_READONLY1","Set")
3450    advanced.!easupport = VRGet("CB_EAS1","Set")
3451    advanced.!alwaysmp  = VRGet("CB_ALWAYSMP1","Set")
3452say "advanced.!readonly = "advanced.!readonly
3453say "options.!readonly  = "options.!readonly
3454    call SW_MOUNTPOINT_Close
3455RETURN
3456
3457/*:VRX         PB_PROGRESS_ABORT_Click
3458*/
3459PB_PROGRESS_ABORT_Click:
3460    options.!autoload = 0
3461    options.!autoclose = 0
3462    call VRSet 'Main',    'Visible', 1
3463    call SW_PROGRESS_Close
3464return
3465
3466/*:VRX         PB_REFRESH_Click
3467*/
3468PB_REFRESH_Click: PROCEDURE EXPOSE settings. options. fs. samba. debuglevel advanced. UserCred Refreshmode
3469    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click started"
3470    call _UserCredUpdate
3471    ok = VRset("Pict_Throbber", "Visible", 1)
3472    ok = VRset("Menu_Selected_Connect", "Visible", 0)
3473    ok = VRset("TM_Throbber", "Enabled", 1)
3474    ShowHidden = advanced.!special
3475    BroadCast = advanced.!broadcast
3476    ok = time('R')
3477    call _RefreshTree
3478    IF options.!debug == 1 THEN SAY time()' '||"PB_REFRESH_Click done"
3479RETURN
3480
3481/*:VRX         PB_SAVE_Click
3482*/
3483PB_SAVE_Click: PROCEDURE EXPOSE settings. options. Profile fs. cd. advanced. samba.
3484    call PB_CONDET_SAVE_Click
3485
3486/*  if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3487    ELSE filename = Profile
3488
3489    IF filename == '' THEN RETURN
3490
3491    IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3492        btns.0 = 2
3493        btns.1 = NLVGetMessage( 6 )
3494        btns.2 = NLVGetMessage( 7 )
3495        confirm = VRMessage('Main', NLVGetMessage( 54, filename ), NLVGetMessage( 53 ), 'W', 'btns.', 1, 2 )
3496        IF confirm \= 1 THEN RETURN
3497        CALL VRChAttr filename,, 'HSR'
3498        CALL VRDeleteFile filename
3499    END
3500
3501    CALL VRMethod 'CN_CURRENT', 'GetRecordList', 'All', 'records.'
3502    DO i = 1 TO records.0
3503        data = VRMethod('CN_CURRENT', 'GetRecordAttr', records.i, 'UserData')
3504        IF data == '' THEN ITERATE
3505        PARSE VAR data node ';' mounts ';' .
3506        dyn = "ok = "fs.!prefix"RxGetMount( node, 'info.', 'mounts.', 'resource.')"
3507        IF options.!debug == 1 THEN SAY time()' '||dyn
3508        interpret dyn; drop dyn
3509
3510        IF ok \= 0 THEN ITERATE
3511
3512        DO j = 1 TO resource.0
3513            CALL LINEOUT filename, node SUBWORD( resource.j, 3 )
3514        END
3515
3516    END
3517    CALL STREAM filename, 'C', 'CLOSE'
3518
3519    if options.!autostart == 0 THEN CALL VRMessage 'Main', NLVGetMessage( 52, filename ), NLVGetMessage( 51 ), 'I'
3520*/
3521RETURN
3522
3523/*:VRX         PB_SETTINGS_CANCEL_Click
3524*/
3525PB_SETTINGS_CANCEL_Click:
3526
3527    adv_changed = 0
3528    CALL SW_SETTINGS_Close
3529
3530return
3531
3532/*:VRX         PB_SETTINGS_HELP_Click
3533*/
3534PB_SETTINGS_HELP_Click:
3535    CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
3536return
3537
3538/*:VRX         PB_SETTINGS_OK_Click
3539*/
3540PB_SETTINGS_OK_Click:
3541
3542    adv_loglevel   = VRGet( "SPIN_LOGLEVEL", "Value" )
3543    adv_logfile    = VRGet( "EF_LOGFILE",    "Value" )
3544    adv_browseauth = VRGet( "CB_BROWSEAUTH", "Set" )
3545    adv_browseimme = VRGet( "CB_BROWSEIMME", "Set" )
3546    adv_debug      = VRGet( "CB_DEBUG",      "Set" )
3547    adv_special    = VRGet( "CB_SPECIAL",    "Set" )
3548    adv_savepassive= VRGet( "CB_SAVEPASSIVE","Set" )
3549    adv_broadcast  = VRGet( "CB_BROADCAST",  "Set" )
3550
3551    adv_changed  = 1
3552    if adv_debug == 1 then do
3553        ok = VRRedirectStdio("ON")
3554        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh ,       "Visible", 1)
3555        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh ,    "Visible", 1)
3556        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh ,   "Visible", 1)
3557        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH ,      "Visible", 1)
3558        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH ,       "Visible", 1)
3559        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh ,      "Visible", 1)
3560        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh ,     "Visible", 1)
3561        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh ,    "Visible", 1)
3562        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh ,        "Visible", 1)
3563    end
3564    else do
3565        ok = VRRedirectStdio("OFF")
3566        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh ,       "Visible", 0)
3567        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh ,    "Visible", 0)
3568        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh ,   "Visible", 0)
3569        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH ,      "Visible", 0)
3570        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH ,       "Visible", 0)
3571        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh ,      "Visible", 0)
3572        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh ,     "Visible", 0)
3573        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh ,    "Visible", 0)
3574        ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh ,        "Visible", 0)
3575    end
3576
3577    CALL SW_SETTINGS_Close
3578
3579return
3580
3581/*:VRX         PB_UNMOUNT_Click
3582*/
3583PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. fs. cd. samba.
3584    IF options.!debug == 1 THEN SAY time()' '||"PB_UNMOUNT_Click started"
3585    IF options.!debug == 1 THEN SAY time()' '||'options.!editmode = 'options.!editmode
3586    CALL VRMethod 'CN_CURRENT', 'GetRecordList', 'Selected', 'select.'
3587    IF select.0 < 1 THEN RETURN
3588
3589    userdata = VRMethod( 'CN_CURRENT', 'GetRecordAttr', select.1, 'UserData')
3590    PARSE VAR userdata mountpoint ';' mounts ';' .
3591say 'userdata="'userdata'"'
3592    IF mounts > 0 & options.!editmode = 0 THEN DO
3593        btns.0 = 2
3594        btns.1 = NLVGetMessage( 6 )
3595        btns.2 = NLVGetMessage( 7 )
3596        confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3597        IF confirm \= 1 THEN RETURN
3598    END
3599
3600    /* Unmount any resources */
3601    DO i = 1 TO mounts
3602        dyn ="ok = "fs.!prefix"RxUnmount( mountpoint, i-1 )"
3603        IF options.!debug == 1 THEN SAY time()' '||dyn
3604        interpret dyn; drop dyn
3605
3606/* IF options.!debug == 1 THEN SAY time()' '||'Unmount resource' i-1 '=' ok */
3607    END
3608
3609    /* Delete mountpoint */
3610    parent = VRMethod('CN_CURRENT', 'GetRecordAttr', select.1, 'Parent')
3611    IF parent \= '' THEN DO
3612        dyn ="ok = "fs.!prefix"RxDeleteMountPoint( mountpoint )"
3613        IF options.!debug == 1 THEN SAY time()' '||dyn
3614        interpret dyn; drop dyn
3615
3616/* IF options.!debug == 1 THEN SAY time()' '||'Delete mountpoint' mountpoint '=' ok */
3617    END
3618
3619    CALL Refresh
3620    IF options.!debug == 1 THEN SAY time()' '||"PB_UNMOUNT_Click done"
3621RETURN 0
3622
3623/*:VRX         Quit
3624*/
3625Quit:
3626    if Fatal <> 1 then CALL SaveSettings
3627    ok = VRREdirectSTdio("OFF")
3628    window = VRWindow()
3629    call VRSet window, "Shutdown", 1
3630    drop window
3631
3632RETURN
3633
3634/*:VRX         Refresh
3635*/
3636Refresh:
3637    IF options.!debug == 1 THEN SAY time()' Refresh started'
3638    CALL VRSet 'CN_CURRENT', 'Painting', 0
3639
3640    CALL VRMethod 'CN_CURRENT', 'RemoveRecord', 'All'
3641
3642    /* Remove Active connections from details view */
3643    ok = VRMethod( 'CN_CONDET', "GetRecordList", 'All', "rh." )
3644
3645    do I = 1 to rh.0
3646        /* This catches the bug we observed exactly once and were unable to reproduce! */
3647        if cd.statusfh = 'CD.STATUSFH' then do
3648            call beep 880, 50
3649            call beep 880, 50
3650            IF options.!debug == 1 THEN say "  cd.statusfh is undefined - check why!!!!!!"
3651            leave
3652        end
3653        IF options.!debug == 1 THEN say '  Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
3654        if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = '#64:PMWP.DLL' then CALL VRMethod 'CN_CONDET', 'RemoveRecord', rh.i
3655    end
3656
3657/*  call _AddTemplates */
3658    CALL VRSet "PB_DETACH",  "Enabled", 0
3659    CALL VRSet "PB_UNMOUNT", "Enabled", 0
3660
3661    ok = VRSet("MENU_CONTEXT_OPEN",    "Visible",  0)
3662    ok = VRSet("MENU_CONTEXT_SEP1",    "Visible",  0)
3663    ok = VRSet("MENU_CONTEXT_DETACH",  "Visible",  0)
3664    ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible",  0)
3665    ok = VRSet("MENU_CONTEXT_EDIT",    "Visible",  0)
3666
3667    ok = VRSet("MENU_SELECTED_REMOVE", "Visible",  0)
3668    ok = VRSet("MENU_SELECTED_RETRY",  "Visible",  0)
3669
3670    IF options.!debug == 1 THEN SAY '  Remove records, disable buttons done.'
3671
3672    CALL VRMethod 'CB_DRIVES', 'Clear'
3673
3674/* Herwig B.
3675    CALL VRSet 'Main', 'StatusText', ' ' */
3676    CALL VRSet 'CN_CURRENT', 'Caption', ' '
3677/* Herwig B. */
3678
3679/* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
3680    drvs = MyFreeDriveMap('C:', 'FREE')
3681
3682    DO i = 1 TO WORDS( drvs )
3683        drvstem.i = WORD( drvs, i )
3684    END
3685
3686    drvstem.0 = WORDS( drvs )
3687
3688    /* Add any existing EVFS drives */
3689    CALL GetMountPoints
3690
3691    CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
3692    CALL VRSet 'CN_CURRENT', 'Painting', 1
3693    IF options.!debug == 1 THEN SAY time()' '||"Refresh done"
3694RETURN 0
3695
3696/*:VRX         SaveSettings
3697*/
3698SaveSettings: PROCEDURE EXPOSE settings. options. fs. advanced. cd. samba.
3699    IF options.!debug == 1 THEN SAY time()' '||"SaveSettings started"
3700
3701    if advanced.!savepassive then call _PassiveSave
3702
3703/* This does not make sense anymore
3704    settings.!network = VRGet("EF_NETWORK","Value")
3705    CALL VRSetIni 'Settings', 'Network', settings.!network, settings.!ini, 'NoClose'
3706 */
3707
3708    font = VRGet('CN_CURRENT', 'Font')
3709    CALL VRSetIni 'Settings', 'ContainerFont', font, settings.!ini, 'NoClose'
3710
3711    font = VRGet('Main', 'Font')
3712    CALL VRSetIni 'Settings', 'WindowFont', font, settings.!ini, 'NoClose'
3713
3714    settings.!curbcolor = VRGet("DT_CURRENT","BackColor")
3715    CALL VRSetIni 'Settings', 'TitleBarBackground', settings.!curbcolor, settings.!ini, 'NoClose'
3716
3717    settings.!curfcolor = VRGet("DT_CURRENT","ForeColor")
3718    CALL VRSetIni 'Settings', 'TitleBarForeground', settings.!curfcolor, settings.!ini, 'NoClose'
3719
3720    settings.!buttonson = VRGet("Menu_View_Buttons","Checked")
3721    CALL VRSetIni 'Settings', 'ButtonsOn', settings.!buttonson, settings.!ini, 'NoClose'
3722
3723    settings.!smbtreeon = VRGet("Menu_View_Smbtree","Checked")
3724    CALL VRSetIni 'Settings', 'SmbtreeOn', settings.!smbtreeon, settings.!ini, 'NoClose'
3725
3726    settings.!dialogon = VRGet("Menu_View_Dialog","Checked")
3727    CALL VRSetIni 'Settings', 'DialogOn', settings.!dialogon, settings.!ini, 'NoClose'
3728
3729    settings.!condeton = VRGet("Menu_View_ConDet","Checked")
3730    CALL VRSetIni 'Settings', 'ConDetOn', settings.!condeton, settings.!ini, 'NoClose'
3731
3732    CALL VRSetIni 'Settings', 'BrowseAuth',    advanced.!browseauth , settings.!ini, 'NoClose'
3733    CALL VRSetIni 'Settings', 'BrowseImme',    advanced.!browseimme , settings.!ini, 'NoClose'
3734    CALL VRSetIni 'Settings', 'Debug',         advanced.!debug      , settings.!ini, 'NoClose'
3735    CALL VRSetIni 'Settings', 'AlwaysMP',      advanced.!alwaysmp   , settings.!ini, 'NoClose'
3736    CALL VRSetIni 'Settings', 'SpecialShares', advanced.!special    , settings.!ini, 'NoClose'
3737    CALL VRSetIni 'Settings', 'BigIcons',      advanced.!bigicons   , settings.!ini, 'NoClose'
3738    CALL VRSetIni 'Settings', 'SavePassive',   advanced.!savepassive, settings.!ini, 'NoClose'
3739    CALL VRSetIni 'Settings', 'Broadcast',     advanced.!broadcast  , settings.!ini, 'NoClose'
3740
3741    /* Save position and size */
3742    settings.!l = VRGet("Main",       'Left'  )
3743    settings.!t = VRGet("Main",       'Top'   )
3744    settings.!h = VRGet("Main",       'Height')
3745    settings.!w = VRGet("Main",       'Width' )
3746    settings.!s = VRGet("SPLIT_Main", 'Left'  )
3747
3748    CALL VRSetIni 'Settings', 'X', settings.!l, settings.!ini, 'NoClose'
3749    CALL VRSetIni 'Settings', 'Y', settings.!t, settings.!ini, 'NoClose'
3750    CALL VRSetIni 'Settings', 'H', settings.!h, settings.!ini, 'NoClose'
3751    CALL VRSetIni 'Settings', 'W', settings.!w, settings.!ini, 'NoClose'
3752    CALL VRSetIni 'Settings', 'S', settings.!s, settings.!ini
3753
3754    IF options.!debug == 1 THEN SAY time()' '||"SaveSettings done"
3755RETURN
3756
3757/*:VRX         SPLIT_Main_Move
3758*/
3759SPLIT_Main_Move:
3760    ok = VRset("Main", "Painting", 0)
3761    NewPos = VRInfo("Left")
3762    OldPos = VRGet("SPLIT_Main","Left")
3763    ok = VRSet("SPLIT_Main","Left", NewPos)
3764    ok = VRset("GB_SMBTREE","Left",NewPos+60)
3765    call Main_Resize
3766    ok = VRset("Main", "Painting", 1)
3767return
3768
3769/*:VRX         StemsInit
3770*/
3771StemsInit:
3772    options.!workgroup  = ''
3773    options.!server     = ''
3774    options.!share      = ''
3775    options.!user       = ''
3776    options.!password   = ''
3777    options.!spassword  = ''
3778    options.!master     = ''
3779    options.!mastertype = ''
3780    options.!memlen     = '2'
3781    options.!easupport  = '1'
3782    options.!readonly   = ''
3783    options.!loglevel   = 0
3784    options.!logfile    = ''
3785
3786    options.!autoload   = 0
3787    options.!autoclose  = 0
3788    options.!nogui      = 0
3789    options.!autostart  = 0
3790    options.!editmode   = 0
3791
3792    vfs.!drive      = ''
3793    vfs.!mountpoint = ''
3794
3795    advanced.!memlen     = ''
3796    advanced.!easupport  = '1'
3797    advanced.!readonly   = ''
3798    advanced.!loglevel   = '0'
3799    advanced.!logfile    = ''
3800    advanced.!browseauth = ''
3801    advanced.!browseimme = ''
3802    advanced.!savepassive= ''
3803    advanced.!broadcast  = ''
3804    advanced.!debug      = ''
3805    advanced.!alwaysmp   = ''
3806    advanced.!special    = ''
3807    advanced.!bigicons   = ''
3808
3809    credentials.!username = ""
3810    credentials.!password = ""
3811    UserCred = ""
3812    RefreshMode = ""
3813return
3814
3815/*:VRX         SW_ADVANCED_Close
3816*/
3817SW_ADVANCED_Close:
3818    call SW_ADVANCED_Fini
3819return
3820
3821/*:VRX         SW_ADVANCED_Create
3822*/
3823SW_ADVANCED_Create:
3824    call SW_ADVANCED_Init
3825return
3826
3827/*:VRX         SW_ADVANCED_Fini
3828*/
3829SW_ADVANCED_Fini:
3830    window = VRInfo( "Window" )
3831    call VRDestroy window
3832    drop window
3833return
3834/*:VRX         SW_ADVANCED_Init
3835*/
3836SW_ADVANCED_Init:
3837
3838    CALL NLVSetText 'SW_ADVANCED',  'Caption', 40
3839    CALL NLVSetText 'GB_MISC',      'Caption', 43
3840
3841    CALL NLVSetText 'CB_EAS',       'Caption', 44
3842    CALL NLVSetText 'CB_READONLY',  'Caption', 45
3843    CALL NLVSetText 'CB_ALWAYSMP',  'Caption', 65
3844
3845    CALL NLVSetText 'PB_ADVOK',     'Caption', 2
3846    CALL NLVSetText 'PB_ADVCANCEL', 'Caption', 3
3847    CALL NLVSetText 'PB_ADVHELP',   'Caption', 4
3848
3849    CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
3850
3851    /* Obsolete */
3852    CALL NLVSetText 'GB_MEM',       'Caption', 41
3853
3854    IF advanced.!memlen \= '' THEN
3855        CALL VRSet 'SPB_MEMLEN', 'Value', advanced.!memlen
3856    IF advanced.!easupport \= '' THEN
3857        CALL VRSet 'CB_EAS', 'Set', advanced.!easupport
3858    IF advanced.!readonly \= '' THEN
3859        CALL VRSet 'CB_READONLY', 'Set', advanced.!readonly
3860    IF advanced.!alwaysmp \= '' THEN
3861        CALL VRSet 'CB_alwaysmp', 'Set', advanced.!alwaysmp
3862
3863    window = VRInfo( "Object" )
3864    if( \VRIsChildOf( window, "Notebook" ) ) then do
3865        call VRMethod window, "CenterWindow"
3866        call VRSet window, "Visible", 1
3867        call VRMethod window, "Activate"
3868    end
3869    drop window
3870return
3871
3872/*:VRX         SW_INFO_Close
3873*/
3874SW_INFO_Close:
3875    call SW_INFO_Fini
3876return
3877
3878/*:VRX         SW_INFO_Create
3879*/
3880SW_INFO_Create:
3881    call SW_INFO_Init
3882    CALL NLVSetText 'SW_INFO',    'Caption', 92
3883    CALL NLVSetText 'PB_INFO_OK',    'Caption', 2
3884
3885    Info.TypeFH    = VRMethod( "CN_INFO", "AddField", "String", "Type" )
3886    Info.ValueFH   = VRMethod( "CN_INFO", "AddField", "String", "Value" )
3887
3888    parse var infoline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
3889    Info.!domain = VRMethod( "CN_INFO", "AddRecord")
3890    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21),'T',':'),Info.ValueFH, Workgroup )
3891    Info.!os = VRMethod( "CN_INFO", "AddRecord")
3892    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93),'T',':'),Info.ValueFH, OS )
3893    Info.!server = VRMethod( "CN_INFO", "AddRecord")
3894    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19),'T',':'),Info.ValueFH, Server )
3895
3896    Info.!status = VRMethod( "CN_INFO", "AddRecord")
3897    ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, SMBObj.udatamsg )
3898
3899return
3900
3901/*:VRX         SW_INFO_Fini
3902*/
3903SW_INFO_Fini:
3904    window = VRInfo( "Window" )
3905    call VRDestroy window
3906    drop window
3907return
3908/*:VRX         SW_INFO_Init
3909*/
3910SW_INFO_Init:
3911    window = VRInfo( "Object" )
3912    if( \VRIsChildOf( window, "Notebook" ) ) then do
3913        call VRMethod window, "CenterWindow"
3914        call VRSet window, "Visible", 1
3915        call VRMethod window, "Activate"
3916    end
3917    drop window
3918return
3919
3920/*:VRX         SW_LOGIN_Close
3921*/
3922SW_LOGIN_Close:
3923    call SW_LOGIN_Fini
3924return
3925
3926/*:VRX         SW_LOGIN_Create
3927*/
3928SW_LOGIN_Create:
3929    call SW_LOGIN_Init
3930    CALL NLVSetText 'DT_USER1',      'Caption', 25
3931    CALL NLVSetText 'DT_PASSWORD1',  'Caption', 26
3932    CALL NLVSetText 'PB_LOGIN_OK',    'Caption', 2
3933    CALL NLVSetText 'PB_LOGIN_CANCEL','Caption', 3
3934    ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
3935    ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
3936return
3937
3938/*:VRX         SW_LOGIN_Fini
3939*/
3940SW_LOGIN_Fini:
3941    window = VRInfo( "Window" )
3942    call VRDestroy window
3943    drop window
3944return
3945/*:VRX         SW_LOGIN_Init
3946*/
3947SW_LOGIN_Init:
3948    window = VRInfo( "Object" )
3949    if( \VRIsChildOf( window, "Notebook" ) ) then do
3950        call VRMethod window, "CenterWindow"
3951        call VRSet window, "Visible", 1
3952        call VRMethod window, "Activate"
3953    end
3954    drop window
3955return
3956
3957/*:VRX         SW_LOGIN_KeyPress
3958*/
3959SW_LOGIN_KeyPress:
3960    obj = VRInfo( "Object" )
3961    keystr = VRGet( obj, "KeyString" )
3962/*  say keystr */
3963    select
3964        when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
3965        when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
3966        when keystr  = "{Esc}" then call PB_LOGIN_CANCEL_Click
3967        otherwise nop
3968    end
3969return
3970
3971/*:VRX         SW_MOUNTPOINT_Close
3972*/
3973SW_MOUNTPOINT_Close:
3974    call SW_MOUNTPOINT_Fini
3975return
3976
3977/*:VRX         SW_MOUNTPOINT_Create
3978*/
3979SW_MOUNTPOINT_Create:
3980    call SW_MOUNTPOINT_Init
3981/* NLVGetMessage(14)' ' */
3982    ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
3983    CALL NLVSetText 'DT_MPOINT1',   'Caption', 27
3984    CALL NLVSetText 'PB_NEWMOUNTPOINTOK',    'Caption', 2
3985    CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL','Caption', 3
3986    CALL NLVSetText 'CB_EAS1',       'Caption', 44
3987    CALL NLVSetText 'CB_READONLY1',  'Caption', 45
3988    CALL NLVSetText 'CB_ALWAYSMP1',  'Caption', 65
3989    ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
3990    ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
3991    ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
3992    ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
3993    ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
3994    ok = VRSet("CB_ALWAYSMP1","set",advanced.!alwaysmp)
3995return
3996
3997/*:VRX         SW_MOUNTPOINT_Fini
3998*/
3999SW_MOUNTPOINT_Fini:
4000    window = VRInfo( "Window" )
4001    call VRDestroy window
4002    drop window
4003return
4004/*:VRX         SW_MOUNTPOINT_Init
4005*/
4006SW_MOUNTPOINT_Init:
4007    window = VRInfo( "Object" )
4008    if( \VRIsChildOf( window, "Notebook" ) ) then do
4009        call VRMethod window, "CenterWindow"
4010        call VRSet window, "Visible", 1
4011        call VRMethod window, "Activate"
4012    end
4013    drop window
4014return
4015
4016/*:VRX         SW_PROGRESS_Close
4017*/
4018SW_PROGRESS_Close:
4019    call SW_PROGRESS_Fini
4020return
4021
4022/*:VRX         SW_PROGRESS_Create
4023*/
4024SW_PROGRESS_Create:
4025    call SW_PROGRESS_Init
4026    CALL NLVSetText 'SW_PROGRESS',  'Caption', 1
4027    CALL NLVSetText 'DT_PROGRESS',  'Caption', 34
4028    CALL NLVSetText 'PB_PROGRESS_ABORT',  'Caption', 3
4029    CALL VRSet "TM_TheCloser","Enabled", 1
4030return
4031
4032/*:VRX         SW_PROGRESS_Fini
4033*/
4034SW_PROGRESS_Fini:
4035    window = VRInfo( "Window" )
4036    call VRDestroy window
4037    drop window
4038return
4039/*:VRX         SW_PROGRESS_Init
4040*/
4041SW_PROGRESS_Init:
4042    window = VRInfo( "Object" )
4043    if( \VRIsChildOf( window, "Notebook" ) ) then do
4044        call VRMethod window, "CenterWindow"
4045        call VRSet window, "Visible", 1
4046        call VRMethod window, "Activate"
4047    end
4048    drop window
4049return
4050
4051/*:VRX         SW_SETTINGS_Close
4052*/
4053SW_SETTINGS_Close:
4054    call SW_SETTINGS_Fini
4055return
4056
4057/*:VRX         SW_SETTINGS_Create
4058*/
4059SW_SETTINGS_Create:
4060    call SW_SETTINGS_Init
4061return
4062
4063/*:VRX         SW_SETTINGS_Fini
4064*/
4065SW_SETTINGS_Fini:
4066    window = VRInfo( "Window" )
4067    call VRDestroy window
4068    drop window
4069return
4070/*:VRX         SW_SETTINGS_Init
4071*/
4072SW_SETTINGS_Init:
4073
4074    CALL NLVSetText 'SW_SETTINGS',  'Caption', 47
4075
4076    CALL NLVSetText 'GB_GLOBAL',     'Caption', 47
4077    CALL NLVSetText 'CB_DEBUG',      'Caption', 42
4078    CALL NLVSetText 'CB_LOGGING',    'Caption', 46
4079    CALL NLVSetText 'CB_BROWSEIMME', 'Caption', 48
4080    CALL NLVSetText 'CB_BROWSEAUTH', 'Caption', 49
4081    CALL NLVSetText 'CB_SPECIAL',    'Caption', 66
4082    CALL NLVSetText 'CB_SAVEPASSIVE','Caption', 73
4083    CALL NLVSetText 'CB_BROADCAST',  'Caption', 74
4084
4085    CALL NLVSetText 'PB_SETTINGS_OK',     'Caption', 2
4086    CALL NLVSetText 'PB_SETTINGS_CANCEL', 'Caption', 3
4087    CALL NLVSetText 'PB_SETTINGS_HELP',   'Caption', 4
4088
4089/*  CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
4090
4091    IF advanced.!logfile \= '' THEN
4092        CALL VRSet 'EF_LOGFILE',    'Value', advanced.!logfile
4093    IF advanced.!loglevel \= '0' THEN
4094        CALL VRSet 'SPIN_LOGLEVEL', 'Value', advanced.!loglevel
4095    CALL VRSet 'CB_LOGGING', 'Set', VRFileExists(SysBootDrive()'\ndpsmb.dbg')
4096    IF advanced.!browseauth \= '' THEN
4097        CALL VRSet 'CB_BROWSEAUTH', 'Set', advanced.!browseauth
4098    IF advanced.!browseimme \= '' THEN
4099        CALL VRSet 'CB_BROWSEimme', 'Set', advanced.!browseimme
4100    IF advanced.!debug \= '' THEN
4101        CALL VRSet 'CB_debug',      'Set', advanced.!debug
4102    IF advanced.!special \= '' THEN
4103        CALL VRSet 'CB_SPECIAL',    'Set', advanced.!special
4104    IF advanced.!savepassive \= '' THEN
4105        CALL VRSet 'CB_SAVEPASSIVE',    'Set', advanced.!savepassive
4106    IF advanced.!broadcast \= '' THEN
4107        CALL VRSet 'CB_BROADCAST',    'Set', advanced.!broadcast
4108
4109    window = VRInfo( "Object" )
4110    if( \VRIsChildOf( window, "Notebook" ) ) then do
4111        call VRMethod window, "CenterWindow"
4112        call VRSet window, "Visible", 1
4113        call VRMethod window, "Activate"
4114    end
4115    drop window
4116return
4117
4118/*:VRX         TM_AutoClose_Trigger
4119*/
4120TM_AutoClose_Trigger:
4121    call PB_CLOSE_Click
4122return
4123
4124/*:VRX         TM_RefreshCurrentDisplay_Trigger
4125*/
4126TM_RefreshCurrentDisplay_Trigger:
4127    CALL REFRESH
4128return
4129
4130/*:VRX         TM_RefreshTreeDisplay_Trigger
4131*/
4132TM_RefreshTreeDisplay_Trigger:
4133    ShowHidden = advanced.!special
4134    BroadCast = advanced.!broadcast
4135
4136    select
4137        when RefreshMode = "TREE" then do
4138            call _RefreshTreeDisplay
4139
4140            if VRget("Menu_View_SmbTree", "Checked") then do
4141                if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
4142                    ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SmbTree", "ValidateRecord", smbtree.!workgroup ) )
4143                end
4144            end
4145        end
4146        when RefreshMode = "SHARE" then do
4147            call _AddSharesDisplay
4148        end
4149        otherwise say "RefreshMode = "RefreshMode
4150    end
4151    call _DialogPopulate
4152return
4153
4154/*:VRX         TM_TheCloser_Trigger
4155*/
4156TM_TheCloser_Trigger:
4157    call SW_PROGRESS_Close
4158return
4159
4160/*:VRX         TM_Throbber_Trigger
4161*/
4162TM_Throbber_Trigger:
4163    pIdx = VRGet("Pict_Throbber","PicturePath")
4164    parse var pIdx '#' pidx
4165    pidx = pidx + 1
4166    if pidx = 36 then pidx = 11
4167    ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
4168return
Note: See TracBrowser for help on using the repository browser.