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

Last change on this file since 811 was 786, checked in by Herwig Bauernfeind, 12 years ago

EVFSGUI 2.5: Fix rpc bug, filter more debug messages

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