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

Last change on this file since 754 was 744, checked in by Herwig Bauernfeind, 13 years ago

GUI-Tools: EVFSGUI 2.5 fix a bunch of bugs

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