source: trunk/guitools/evfsgui/evfsgui.vrx@ 641

Last change on this file since 641 was 641, checked in by Herwig Bauernfeind, 14 years ago

GUI-Tools: EVFSGUI 2.5.x: More work done

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