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

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

GUI-Tools: Changes in order to work around % issue

File size: 199.2 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. 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 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 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 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 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 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2087 p_server = SMBObj.resname
2088 p_share = ""
2089
2090 ShareLevel = 2
2091 end
2092 when SMBObj.udatatype = "DISK" then do
2093 say "Shared disk dragged!"
2094 p_workgroup = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.gparentrh, "Caption")
2095 p_server = VRMethod("CN_SMBTREE", "GetRecordAttr", SMBObj.parentrh, "Caption")
2096 parse var p_server p_server '0D0A'x .
2097 p_share = SMBObj.resname
2098
2099 ShareLevel = 1
2100 end
2101 otherwise nop /* Printer */
2102 end
2103 ok = VRSet("EF_NETWORK","Value",p_workgroup)
2104 call _UpdateObject "EF_SERVER", p_server
2105 ok = VRSet("EF_Share","Value", p_share)
2106 end /* Drag from CN_SMBTREE */
2107
2108 if options.!debug == 1 then do
2109 say 'p_workgroup = "'p_workgroup'"'
2110 say 'p_server = "'p_server'"'
2111 say 'p_share = "'p_share'"'
2112 end
2113
2114 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
2115
2116 settings.!network = VRGet("EF_NETWORK","Value")
2117 call CB_MOUNT_Change
2118
2119 if trgRec = "" then do
2120 ok = VRMethod("CB_DRIVES", "GetStringList", "freedrives.")
2121 if freedrives.0 > 0
2122 then ok = VRSet("CB_DRIVES","Value", freedrives.1)
2123 else ok = VRSet("CB_DRIVES","Value", "")
2124
2125 ok = VRSet("EF_DIRECTORY","Value", "")
2126 end
2127 else do
2128 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
2129
2130 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
2131
2132 do while parTrgRH <> ""
2133 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
2134 TargetString = partrgCapt||'\'||TargetString
2135 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
2136 end
2137 say 'TargetString = "'TargetString'"'
2138 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
2139 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
2140 end
2141
2142 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
2143 if VRGet("CB_DRIVES","Value") = "" then return
2144
2145 window = VRLoadSecondary( "SW_LOGIN", "W" )
2146 if credentials.!entered = 1 then call PB_MOUNT_CLICK
2147
2148 if VRGet(srcCtn,'Name') = "CN_CONDET" & VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
2149 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
2150 end
2151 if options.!debug == 1 then say time()' CN_CURRENT_DragDrop done'
2152return
2153/*:VRX CN_SMBTREE_Click
2154*/
2155CN_SMBTREE_Click:
2156 if options.!debug == 1 then say time()' CN_SMBTREE_Click started'
2157 /* ok = VRset("DT_StatusBar","Caption", VRGet("Main", "HintText")) */
2158
2159 call _dropdeprecated
2160 call _GetSmbObjectProperties VRInfo('Record')
2161 call _ContextMenuSelectedSet
2162
2163 ok = VRset("DT_Statusbar", "Caption", SMBObj.udatamsg)
2164
2165 if options.!debug == 1 then say time()' CN_SMBTREE_Click done'
2166return
2167/*:VRX CN_SMBTREE_ContextMenu
2168*/
2169CN_SMBTREE_ContextMenu:
2170 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu started'
2171
2172 call _dropdeprecated
2173 call _GetSmbObjectProperties VRInfo('Record')
2174
2175 call _ContextMenuSelectedSet
2176 ok = VRMethod( "Menu_Selected", "Popup", , , "", "" )
2177
2178 if options.!debug == 1 then say time()' CN_SMBTREE_ContextMenu done'
2179return
2180/*:VRX CN_SMBTREE_DoubleClick
2181*/
2182CN_SMBTREE_DoubleClick:
2183 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick started'
2184
2185 call _dropdeprecated
2186 call _GetSmbObjectProperties VRInfo('Record')
2187
2188/* if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2189return */
2190 /* Enable last 2 lines for 2.0.x (to disable on the fly browsing) */
2191
2192 if options.!debug == 1 then say ' Browsing "'SMBObj.udatatype'"'
2193
2194 If SMBObj.udatatype = "DIRECTORY" then do
2195 BrowsePath = _browsebuildpath(SMBObj.rh)
2196
2197 call _BrowseResetObject(SmbObj.rh)
2198
2199 parse var browsepath '\\'machine'\'sharename '\' browsepath
2200 browsepath = browsepath'\*'
2201
2202 call _BrowseDirectory
2203 end
2204
2205 If SMBObj.udatatype = "FILE" then do
2206 BrowsePath = _browsebuildpath(SMBObj.rh)
2207 call _BrowseResetObject(SmbObj.rh)
2208
2209 parse var browsepath '\\'machine'\'sharename '\' browsepath
2210
2211 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2212
2213 if \OpenOK then do
2214 say " Not connected - trying to connect"
2215 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", sharerh, "Selected", 1)
2216 call PB_SMBTREE_CONNECT_Click
2217 ok = VRMethod( "CN_SMBTREE", "SetRecordAttr", SMBObj.rh, "Selected", 1)
2218
2219 OpenOk = _browseobjectopen(machine,sharename,browsepath)
2220
2221 if \OpenOk then do
2222 say " Not connected - cannot open - aborting!"
2223 end
2224 end
2225 end
2226
2227 if SMBObj.udatatype = "DISK" then do
2228 machine = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentrh,"Caption")
2229 parse var machine machine '0D0A'x .
2230 machine = strip(machine)
2231
2232 call _BrowseResetObject(SmbObj.rh)
2233
2234 sharename = SMBObj.resname
2235 BrowsePath = ""
2236
2237 call _BrowseDirectory
2238 end
2239 if options.!debug == 1 then say time()' CN_SMBTREE_DoubleClick done'
2240return
2241/*:VRX CN_SMBTREE_DragFile
2242*/
2243CN_SMBTREE_DragFile:
2244 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile started'
2245
2246 obj = VRInfo( "object" )
2247
2248 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2249 if SelRH.0 = 0 then do
2250 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2251 return
2252 end
2253
2254 call _dropdeprecated
2255 call _GetSMBObjectProperties SelRH.1
2256
2257 select
2258 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2259 call VRMethod obj, 'StartDrag'
2260 end
2261 when SMBObj.udatatype = "PRINTER" then do
2262 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2263 end
2264 otherwise nop /* FILE DIRECTORY */
2265 end
2266
2267 if options.!debug == 1 then say time()' CN_SMBTREE_DragFile done'
2268return
2269
2270/*:VRX CN_SMBTREE_DragStart
2271*/
2272CN_SMBTREE_DragStart:
2273 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart started'
2274
2275 obj = VRInfo( "object" )
2276
2277 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
2278 if SelRH.0 = 0 then do
2279 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart aborted'
2280 return
2281 end
2282
2283 call _dropdeprecated
2284 call _GetSMBObjectProperties SelRH.1
2285
2286 select
2287 when SMBObj.udatatype = "WORKGROUP" | SMBObj.udatatype = "SERVER" | SMBObj.udatatype = "DISK" then do
2288 call VRMethod obj, 'StartDrag'
2289 end
2290 when SMBObj.udatatype = "PRINTER" then do
2291 CALL VRMessage 'Main', NLVGetMessage( 62 ), NLVGetMessage( 5 ), 'E'
2292 end
2293 otherwise nop /* FILE DIRECTORY */
2294 end
2295
2296 if options.!debug == 1 then say time()' CN_SMBTREE_DragStart done'
2297return
2298/*:VRX CreateObject
2299*/
2300CreateObject: procedure
2301 Parse Arg Class, Title, Location, Setup, Collision
2302 /* say 'Creating ['Title']' */
2303say Setup
2304 rc = SysCreateObject( Class, Title, Location, Setup, Collision )
2305 If rc <> 1 Then do
2306 Msg.Text = ' > failed to create ['Title' | 'Class'] at location ['Location']'
2307 Msg.Type = 'Error'
2308 say Msg.Text
2309 end
2310return rc
2311/*:VRX DT_STATUSBAR_ContextMenu
2312*/
2313DT_STATUSBAR_ContextMenu:
2314 ok = VRSet("DT_STATUSBAR","Caption", VRGet("Main", "HintText"))
2315return
2316
2317/*:VRX EF_PASSWORD1_KeyPress
2318*/
2319EF_PASSWORD1_KeyPress:
2320 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress started'
2321 obj = VRInfo( "Object" )
2322 keystr = VRGet( obj, "KeyString" )
2323/* say keystr */
2324 select
2325 when keystr = "{Enter}" then call PB_LOGIN_OK_Click
2326 when keystr = "{Newline}" then call PB_LOGIN_OK_Click
2327 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2328 otherwise nop
2329 end
2330 if options.!debug == 1 then say time()' EF_PASSWORD1_KeyPress done'
2331return
2332
2333/*:VRX EF_PASSWORD_Change
2334*/
2335EF_PASSWORD_Change:
2336 Now = VRGet("EF_PASSWORD","value")
2337 if Now = "" | Now = LastPassword then return
2338 ok = SysSleep(1)
2339 LastPassword = Now
2340 if Now <> VRGet("EF_PASSWORD","value") then return
2341 call _UserCredUpdate
2342return
2343
2344/*:VRX EF_SERVER_Change
2345*/
2346EF_SERVER_Change:
2347 if options.!debug == 1 then say time()' EF_SERVER_Change started'
2348 Now = VRGet("EF_SERVER","value")
2349
2350 if Now = "" | Now = LastServer then return
2351 ok = SysSleep(2)
2352 if Now <> VRGet("EF_SERVER","value") then return
2353
2354 IF options.!editmode = 1 then return
2355
2356 /* Do nothing for incomplete IP addresses */
2357 if strip(translate(VRGet("EF_SERVER","value"),copies(' ',11),'01234567890.')) = "" then do /* got an IP address */
2358 if \_IsValidIPAddress(VRGet("EF_SERVER","value")) then return /* it is invalid or incomplete */
2359 end
2360
2361 /* do nothing if a workgroup was mounted */
2362 if VRGet("EF_SERVER","value") = "*" then return
2363
2364 machine = VRGet("EF_SERVER","value")
2365 rh = _GetMachineHandle(machine)
2366
2367 if rh <> "" then do
2368 call _GetSMBObjectProperties rh
2369
2370 if SMBObj.parentrh = ""
2371 then ok = VRSet("EF_NETWORK","Value", "") /* The workgroup might be unknown at this moment */
2372 else ok = VRSet("EF_NETWORK","Value", VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.parentRH,"Caption"))
2373
2374 call _GetSMBObjectShares rh
2375
2376 ok = VRMethod("EF_SHARE", "Reset")
2377 if SMBObj.shares.0 > 0 then ok = VRMethod("EF_SHARE", "AddRecordList", "SMBObj.shares.")
2378 end
2379 else do
2380 call _RefreshWorkgroups
2381 smbtree.!machine = _AddSleepingMachine(machine,"","")
2382 call _UserCredUpdate
2383 call _RefreshShares
2384 ok = VRSet( "CN_smbtree", "Painting", 1 )
2385
2386 ok = VRSet("Main", 'Pointer', '<default>' )
2387 ok = VRSet("CN_smbtree","Enabled", 1)
2388 ok = VRSet("TM_Throbber","Enabled", 0)
2389 ok = VRSet("Pict_Throbber","Visible", 0)
2390 end
2391
2392 LastServer = VRGet("EF_SERVER","value")
2393 if options.!debug == 1 then say time()' EF_SERVER_Change done'
2394return
2395
2396/*:VRX EF_USER1_KeyPress
2397*/
2398EF_USER1_KeyPress:
2399 if options.!debug == 1 then say time()' EF_USER1_KeyPress started'
2400 obj = VRInfo( "Object" )
2401 keystr = VRGet( obj, "KeyString" )
2402 say keystr
2403 select
2404 when keystr = "{Enter}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2405 when keystr = "{Newline}" then ok = VRMethod( "EF_Password1", "SetFocus" )
2406 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
2407 otherwise nop
2408 end
2409 if options.!debug == 1 then say time()' EF_USER1_KeyPress done'
2410return
2411
2412/*:VRX EF_USER_Change
2413*/
2414EF_USER_Change:
2415 Now = VRGet("EF_USER","value")
2416 if Now = "" | Now = LastUser then return
2417 ok = SysSleep(1)
2418 LastUser = Now
2419 if Now <> VRGet("EF_USER","value") then return
2420 call _UserCredUpdate
2421return
2422
2423/*:VRX EF_WINS_SERVER_Change
2424*/
2425EF_WINS_SERVER_Change:
2426 advanced.!smbconfchanged = 1
2427return
2428
2429/*:VRX Fini
2430*/
2431Fini:
2432 window = VRWindow()
2433 call VRSet window, "Visible", 0
2434 drop window
2435return 0
2436
2437/*:VRX GetChildren
2438*/
2439GetChildren: PROCEDURE EXPOSE existrec. exc options. icons. fs. cd. samba.
2440 if options.!debug == 1 then say time()' GetChildren started'
2441 PARSE ARG node, parec
2442
2443 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2444
2445 IF info.2 > 0 THEN icon = icons.!active
2446 ELSE icon = icons.!passive
2447
2448 rh = VRMethod("CN_CURRENT", 'AddRecord', parec, 'Last', info.0, icon )
2449 IF rh == '' | datatype(res.0) <> "NUM" THEN RETURN
2450
2451 exc = exc + 1
2452 existrec.exc = rh
2453 userdata = node';'info.2
2454 DO i = 1 TO res.0
2455 userdata = ParseResourceData( userdata, res.i )
2456 END
2457 if userdata = "UNKNOWN" then ok = VRMethod("CN_CURRENT", 'RemoveRecord', rh)
2458 else do
2459 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata
2460 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2461 end
2462
2463 DO i = 1 TO points.0
2464 childnode = node || points.i || '\'
2465 CALL GetChildren childnode, rh
2466 END
2467 if options.!debug == 1 then say time()' GetChildren done'
2468RETURN
2469
2470/*:VRX GetMountPoints
2471*/
2472GetMountPoints: PROCEDURE EXPOSE existrec. options. icons. fs. cd. samba.
2473 if options.!debug == 1 then say time()' GetMountPoints started'
2474/* CALL VRSet "CN_CURRENT", 'Painting', 0 */
2475/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) started" */
2476 drvs = SysDriveMap('C:', 'USED') /* was "REMOTE" */
2477/* if options.!debug == 1 then say time()' '||"GetMountPoints: SysDriveMap(USED) done" */
2478 ac = 0
2479 DO i = 1 TO WORDS( drvs )
2480 fs = TRANSLATE( SysFileSystemType( WORD( drvs, i )))
2481 IF fs == fs.!fileSystemtype THEN DO
2482 ac = ac + 1
2483 attached.ac = WORD( drvs, i )
2484 END
2485 END
2486 attached.0 = ac
2487
2488 exc = 0
2489 DO i = 1 TO attached.0
2490 node = attached.i'\'
2491
2492 CALL VRMethod 'CB_DRIVES', 'AddString', attached.i
2493
2494 CALL _Dynamic "CALL "fs.!prefix"RxGetMount node, 'info.', 'points.', 'res.'"
2495
2496 IF info.2 > 0 THEN icon = icons.!drive
2497 ELSE icon = icons.!drive_inactive
2498
2499 rh = VRMethod("CN_CURRENT", 'AddRecord',, 'Last', attached.i, icon )
2500 IF rh == '' THEN ITERATE
2501
2502 exc = exc + 1
2503 existrec.exc = rh
2504 userdata = node';'info.2
2505 DO j = 1 TO res.0
2506 userdata = ParseResourceData( userdata, res.j )
2507 END
2508/* if options.!debug == 1 then say ' "'attached.i'" "'userdata'"' */
2509 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'UserData', userdata /* , 'FileName', 'TESTER.EVP' */
2510 if options.currentdata = userdata then ok = VRMethod("CN_CURRENT", 'SetRecordAttr', rh, 'Selected', 1)
2511
2512 CALL VRMethod "CN_CURRENT", 'SetRecordAttr', rh, 'Expanded', 1
2513
2514 DO j = 1 TO points.0
2515 childnode = node || points.j || '\'
2516 CALL GetChildren childnode, rh
2517 END
2518
2519 END
2520 existrec.0 = exc
2521/* CALL VRSet "CN_CURRENT", 'Painting', 1 */
2522 if options.!debug == 1 then say time()' '||"GetMountPoints done"
2523RETURN
2524
2525/*:VRX Halt
2526*/
2527Halt:
2528 signal _VREHalt
2529return
2530
2531/*:VRX Init
2532*/
2533Init:
2534/* Herwig */
2535/* CALL VRSet 'Console', 'WindowListTitle', '' */
2536
2537 window = VRWindow()
2538 call VRSet window, "Visible", 0
2539 call VRMethod window, "Activate"
2540 drop window
2541
2542RETURN
2543
2544/*:VRX LoadFileSysFuncs
2545*/
2546LoadFileSysFuncs:
2547 if options.!debug == 1 then say time()' LoadFileSysFuncs() started'
2548
2549 Fatal = 1
2550 RestartCount = 0
2551 FoundEVFS = 1
2552 FoundND = 1
2553
2554 program = VRGet("Application", "Program")
2555 if program = "" then parse source . . program
2556 say "Program = '"program"'"
2557 program = translate(VRParseFileName(Program,'N'))
2558 say "Program = '"program"'"
2559
2560 if SysSearchPath("PATH", "EVFSCTL.EXE") = "" | program = "SMBGUI" then do
2561 FoundEVFS = 0
2562 ForceNDFS = 1
2563 end
2564
2565CtlRestart:
2566 if \ForceNDFS then signal NoNetDrive
2567
2568ForceNDFS:
2569 if options.!debug == 1 then say ' NDFS check entered'
2570 call RxFuncAdd 'NdRxLoadFuncs', 'NDCALLS', 'NdRxLoadFuncs'
2571 SIGNAL ON SYNTAX NAME NoNetdrive
2572 call NdRxLoadFuncs
2573 FoundND = 1
2574 SIGNAL OFF SYNTAX
2575 fs.!prefix = 'ND'
2576 fs.!fileSystemtype = "NDFS32"
2577 fs.!profileext = "ndc"
2578 signal CommonToBothFS
2579NoNetdrive:
2580 if options.!debug == 1 then say ' NDFS not found'
2581 CALL RxFuncAdd 'EvfsRxLoadFuncs', 'EVFSCALL.DLL', 'EvfsRxLoadFuncs'
2582 SIGNAL ON SYNTAX NAME NoEVFSCALL
2583 CALL EvfsRxLoadFuncs
2584 FoundEVFS = 1
2585 SIGNAL OFF SYNTAX
2586 fs.!prefix = 'EVFS'
2587 fs.!fileSystemtype = "EVFS"
2588 fs.!profileext = "evp"
2589CommonToBothFS:
2590 if options.!debug == 1 then say ' Common version check'
2591 CALL _Dynamic "fsstat = "fs.!prefix"RxQueryIFS()"
2592 if fsstat = 252 then CALL _Dynamic "Found"fs.!prefix" = 0"
2593
2594 if word(fsstat,1) = '0' then do
2595 PARSE VAR fsstat '0 'fsname fsver fsctl .
2596 fs.!name = fsname
2597 fs.!version = fsver
2598
2599 if options.!debug == 1 then DO
2600 say ' fs.!prefix = 'fs.!prefix
2601 say ' fs.!name = 'fs.!Name
2602 say ' Version = 'fsver
2603 say ' fsctl = 'fsctl
2604 end
2605 end
2606 else do
2607 if FoundND = 0 & FoundEVFS = 0 then do
2608 CALL VRMessage 'Main', 'FATAL: Neither EVFS nor Netdrive found: 'fs.!prefix'RxQueryIFS()='fsstat, NLVGetMessage( 5 ), 'E'
2609 signal Halt
2610 end
2611 signal ForceNDFS
2612 end
2613 IF fsctl \= 1 THEN DO
2614 if ReStartCount = 0 then do
2615 'detach 'fs.!prefix'ctl.exe'
2616 RestartCount = 1
2617 ok = SysSleep(1)
2618 signal CtlRestart
2619 end
2620 else do
2621 CALL VRMessage 'Main', NLVGetMessage( 101 ), NLVGetMessage( 5 ), 'E'
2622 signal Halt
2623 end
2624 END
2625
2626 Fatal = 0
2627
2628 if options.!debug == 1 then say time()' LoadFileSysFuncs() done'
2629return
2630
2631/*:VRX Main_Close
2632*/
2633Main_Close:
2634 CALL Quit
2635RETURN
2636
2637/*:VRX Main_Create
2638*/
2639Main_Create:
2640 options.!debug = 0
2641 if options.!debug == 1 then do
2642 ok = VRRedirectStdIO("ON")
2643 say time()' Main_Create started'
2644 end
2645 else ok = VRRedirectStdIO("OFF")
2646
2647 call _LoadOtherFuncs
2648 call _InitTempDir
2649 call NLVSetup
2650 call _StemsInit
2651
2652 call _TabbedDialogSetup
2653 call _ContainersInit
2654 call _GUIInit
2655
2656 CALL _ParseCommandLine
2657
2658 CALL LoadFileSysFuncs
2659
2660 CALL _CltInit
2661
2662 CALL _INILoad
2663
2664 CALL Refresh
2665
2666 if advanced.!savepassive == 1 then CALL _PassiveLoad
2667
2668 IF options.!timesync == 1 THEN CALL _TimeSync
2669
2670 IF options.!autoload == 1 THEN CALL Menu_File_Load_Click
2671
2672 CALL VRSet "CB_MOUNT", "Selected", 1
2673 CALL VRSet "CB_DRIVES", "Selected", 1
2674 IF options.!autoclose == 1
2675 THEN CALL TM_AutoClose_Trigger
2676 ELSE do
2677 if advanced.!browseauth == 1 then do
2678 /* FIXME: unclear why we have to do the following 4 lines here */
2679 call SW_SETTINGS_Init
2680 call SW_SETTINGS_Init_Content
2681 call SW_ADVANCED_Init
2682 call SW_ADVANCED_Init_Content
2683
2684 window = VRLoadSecondary( "SW_LOGIN", "W" )
2685 call Main_Resize
2686 end
2687 if advanced.!browseimme == 1 then call PB_SMBTREE_REFRESH_Click
2688 end
2689
2690 if options.!debug == 1 then say time()' Main_Create done'
2691return
2692
2693/*:VRX Main_KeyPress
2694*/
2695Main_KeyPress:
2696 key = VRGet('Main', 'KeyString')
2697 IF key == '{F5}' THEN CALL Refresh
2698RETURN
2699
2700/*:VRX Main_Resize
2701*/
2702Main_Resize:
2703 if options.!debug == 1 then say time()' Main_Resize started'
2704 ok = VRset("Main","Painting", 0)
2705
2706 /* Basic measurements */
2707 main_iwidth = VRGet("Main","InteriorWidth") /* Width of window client-area */
2708 main_iheight = VRGet("Main","InteriorHeight") /* Height of window client-area */
2709
2710 if main_iheight < 6400 then ok = VRSet("Main","Height",7100)
2711 if main_iwidth < 8800 then ok = VRSet("Main","Width", 8900)
2712
2713 sbar_height = VRGet("GB_STATUSBAR","Height") /* Height of status-bar */
2714 split_left = VRGet("SPLIT_Main","Left") /* Position of the left edge of the split-bar */
2715 marginx2 = margin * 2 /* Common margin around controls */
2716 pbtn_height = 400 /* Height of the panels' internal button areas */
2717
2718 pane_height = main_iheight - sbar_height - (margin * 4) /* Height of a split-bar panel */
2719 lpane_width = split_left - margin /* Width of the left split-bar panel */
2720 rpane_width = main_iwidth - split_left - 60 - margin /* Width of the right split-bar panel */
2721
2722 /* Tabbed Dialog = right pane */
2723 ok = VRset("TDL_1", "Top", marginx2)
2724 ok = VRset("TDL_1", "Left", split_left + 60)
2725 ok = VRset("TDL_1", "Width", rpane_width )
2726 ok = VRset("TDL_1", "Height", pane_height )
2727
2728 /* Current Panel */
2729 ok = VRSet("GB_CURRENT", "Visible", 1 )
2730 ok = VRSet("GB_CURRENT", "Top", marginx2 )
2731 ok = VRSet("GB_CURRENT", "Left", margin )
2732 ok = VRSet("GB_CURRENT", "Width", lpane_width )
2733 ok = VRSet("GB_CURRENT", "Height", pane_height )
2734
2735 ok = VRset("GB_CURRENT3", "Top", margin )
2736 ok = VRset("GB_CURRENT3", "Left", margin )
2737 ok = VRset("GB_CURRENT3", "Height", 245 )
2738 ok = VRset("GB_CURRENT3", "Width", lpane_width - marginx2)
2739
2740 ok = VRset("DT_CURRENT", "Top", 8 )
2741 ok = VRset("DT_CURRENT", "Left", 8 )
2742 ok = VRset("DT_CURRENT", "Height", 213 )
2743 ok = VRset("DT_CURRENT", "Width", (lpane_width - marginx2) - 24 )
2744
2745 ok = VRset("GB_CURRENT2", "Left", margin )
2746 ok = VRset("GB_CURRENT2", "Top", 245 + marginx2 )
2747 ok = VRset("GB_CURRENT2", "Width", lpane_width - marginx2)
2748 ok = VRset("GB_CURRENT2", "Height", pane_height - (margin * 5) - pbtn_height - 245 )
2749
2750 ok = VRset("CN_CURRENT", "Top", margin )
2751 ok = VRset("CN_CURRENT", "Left", margin )
2752 ok = VRset("CN_CURRENT", "Width", VRGet("GB_CURRENT2","Width") - marginx2)
2753 ok = VRset("CN_CURRENT", "Height", VRGet("GB_CURRENT2","Height") - marginx2)
2754
2755 ok = VRset("PB_DETACH", "Left", margin )
2756 ok = VRset("PB_DETACH", "Top", pane_height - pbtn_height - marginx2 )
2757 ok = VRset("PB_DETACH", "Width", min((lpane_width-margin*3) % 2, 1313) )
2758 ok = VRset("PB_UNMOUNT", "Left", VRGet("PB_DETACH","Width") + marginx2)
2759 ok = VRset("PB_UNMOUNT", "Top", pane_height - pbtn_height - marginx2 )
2760 ok = VRset("PB_UNMOUNT", "Width", min((lpane_width-margin*3) % 2, 1313) )
2761
2762 /* Splitbar - reduced in size to make it more noticable */
2763 ok = VRset("SPLIT_Main", "Visible", 1 )
2764 ok = VRset("SPLIT_Main", "Top", marginx2 + (pane_height-1200)%2 )
2765 ok = VRset("SPLIT_Main", "Height", 1200 /* pane_height */ )
2766
2767 /* Statusbar */
2768 ok = VRSet("GB_STATUSBAR", "Left", margin )
2769 ok = VRSet("GB_STATUSBAR", "Top", main_iheight - sbar_height - margin )
2770 ok = VRSet("GB_STATUSBAR", "Width", lpane_width + 50 + rpane_width )
2771
2772 ok = VRset("DT_STATUSBAR", "Top", 12 )
2773 ok = VRset("DT_STATUSBAR", "Left", 12 )
2774 ok = VRset("DT_STATUSBAR", "Height", VRGet("GB_STATUSBAR","Height") -24 )
2775 ok = VRset("DT_STATUSBAR", "Width", (lpane_width + 50 + rpane_width) - 24 )
2776
2777 /* Modified for notebook pages */
2778 pane_height = marginx2 + pane_height -1020
2779 rpane_width = marginx2 + rpane_width -760
2780
2781 /* Dialog page */
2782 ok = VRSet("GB_DIALOG", "Top", margin /* marginx2 */ )
2783 ok = VRSet("GB_DIALOG", "Left", margin /* marginx2 */ /* split_left + 60 */ )
2784 ok = VRset("GB_DIALOG", "Height", pane_height )
2785 ok = VRset("GB_DIALOG", "Width", rpane_width )
2786
2787 ok = VRset("PB_MOUNT", "Left", margin )
2788 ok = VRset("PB_MOUNT", "Top", pane_height - pbtn_height - marginx2)
2789 ok = VRset("PB_EDIT_CANCEL", "Left", VRGet("PB_MOUNT","Width") + marginx2)
2790 ok = VRset("PB_EDIT_CANCEL", "Top", pane_height - pbtn_height - marginx2)
2791
2792 ok = VRset("PB_DIALOG_HELP", "Left", rpane_width - marginx2 - VRGet("PB_DIALOG_HELP","Width") + 24)
2793 ok = VRset("PB_DIALOG_HELP", "Top", pane_height - pbtn_height - marginx2)
2794
2795 ok = VRset("GB_SHARE", "Left", margin )
2796 ok = VRset("GB_SHARE", "Top", marginx2 /* 245 + marginx2 */ )
2797 ok = VRset("GB_SHARE", "Height", 2252 )
2798 ok = VRset("GB_SHARE", "Width", rpane_width - marginx2 )
2799
2800 ok = VRset("GB_AUTH", "Left", margin )
2801 ok = VRset("GB_AUTH", "Top", margin * 3 + VRGet("GB_SHARE","Height") /* 245 + (margin * 3) + VRGet("GB_SHARE","Height") */ )
2802 ok = VRset("GB_AUTH", "Width", rpane_width - marginx2 )
2803
2804 ok = VRset("GB_MPOINT","Left", margin )
2805 ok = VRset("GB_MPOINT","Top", /* 245 + */ (margin * 4) + VRGet("GB_SHARE","Height") + VRGet("GB_AUTH","Height"))
2806 ok = VRset("GB_MPOINT","Width", rpane_width - marginx2 )
2807
2808 /* Advanced page */
2809 ok = VRSet("GB_ADVANCED", "Top", margin /* marginx2 */ )
2810 ok = VRSet("GB_ADVANCED", "Left", margin /* marginx2 */ /* split_left + 60 */ )
2811 ok = VRset("GB_ADVANCED", "Height", pane_height )
2812 ok = VRset("GB_ADVANCED", "Width", rpane_width )
2813
2814 ok = VRset("GB_ADVANCED2", "Left", margin )
2815 ok = VRset("GB_ADVANCED2", "Top", /* 245 + */ marginx2)
2816 ok = VRset("GB_ADVANCED2", "Width", rpane_width - marginx2)
2817 ok = VRset("GB_ADVANCED2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2818
2819 ok = VRset("PB_ADVANCED_APPLY", "Left", margin )
2820 ok = VRset("PB_ADVANCED_APPLY", "Top", pane_height - pbtn_height - marginx2)
2821 ok = VRset("PB_ADVANCED_UNDO", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
2822 ok = VRset("PB_ADVANCED_UNDO", "Top", pane_height - pbtn_height - marginx2)
2823 ok = VRset("PB_ADVANCED_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
2824 ok = VRset("PB_ADVANCED_HELP", "Top", pane_height - pbtn_height - marginx2)
2825
2826 /* SMBTree page */
2827 ok = VRSet("GB_SMBTREE", "Top", margin /* x2 */ )
2828 ok = VRSet("GB_SMBTREE", "Left", margin /* x2 */ /* split_left + 60 */ )
2829 ok = VRset("GB_SMBTREE", "Height", pane_height )
2830 ok = VRset("GB_SMBTREE", "Width", rpane_width )
2831
2832 ok = VRset("GB_SMBTREE2","Left", margin )
2833 ok = VRset("GB_SMBTREE2","Top", /* 45 + */ marginx2 )
2834 ok = VRset("GB_SMBTREE2","Width", rpane_width - marginx2)
2835 ok = VRset("GB_SMBTREE2","Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2836
2837 ok = VRset("CN_SMBTREE", "Top", margin )
2838 ok = VRset("CN_SMBTREE", "Left", margin )
2839 ok = VRset("CN_SMBTREE", "Width", VRGet("GB_SMBTREE2","Width") - marginx2)
2840 ok = VRset("CN_SMBTREE", "Height", VRGet("GB_SMBTREE2","Height") - marginx2)
2841
2842 ok = VRset("PB_SMBTREE_CONNECT", "Left", margin )
2843 ok = VRset("PB_SMBTREE_CONNECT", "Top", pane_height - pbtn_height - marginx2)
2844 ok = VRset("PB_SMBTREE_REFRESH", "Left", VRGet("PB_SMBTREE_CONNECT","Width") + marginx2)
2845 ok = VRset("PB_SMBTREE_REFRESH", "Top", pane_height - pbtn_height - marginx2)
2846 ok = VRset("PB_SMBTREE_HELP", "Left", rpane_width - marginx2 - VRGet("PB_SMBTREE_HELP","Width") + 24)
2847 ok = VRset("PB_SMBTREE_HELP", "Top", pane_height - pbtn_height - marginx2)
2848
2849 ok = VRset("PICT_THROBBER", "Top", VRGet("CN_SMBTREE","Height") % 2 - 100 )
2850 ok = VRset("PICT_THROBBER", "Left", VRGet("CN_SMBTREE","Width") % 2 - 200 )
2851
2852 /* Connection details page */
2853 ok = VRSet("GB_CONDET", "Top", margin /* x2 */ )
2854 ok = VRSet("GB_CONDET", "Left", margin /* x2 */ /* split_left + 60 */ )
2855 ok = VRset("GB_CONDET", "Height", pane_height )
2856 ok = VRset("GB_CONDET", "Width", rpane_width )
2857
2858 ok = VRset("GB_CONDET2", "Left", margin )
2859 ok = VRset("GB_CONDET2", "Top", /* 245 + */ marginx2)
2860 ok = VRset("GB_CONDET2", "Width", rpane_width - marginx2)
2861 ok = VRset("GB_CONDET2", "Height", pane_height - (margin * 5) - pbtn_height /* - 245 */ )
2862
2863 ok = VRset("CN_CONDET", "Top", margin )
2864 ok = VRset("CN_CONDET", "Left", margin )
2865 ok = VRset("CN_CONDET", "Width", VRGet("GB_CONDET2","Width") - marginx2)
2866 ok = VRset("CN_CONDET", "Height", VRGet("GB_CONDET2","Height") - marginx2)
2867
2868 ok = VRset("PB_CONDET_SAVE", "Left", margin )
2869 ok = VRset("PB_CONDET_SAVE", "Top", pane_height - pbtn_height - marginx2 )
2870 ok = VRset("PB_CONDET_LOAD", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2871 ok = VRset("PB_CONDET_LOAD", "Top", pane_height - pbtn_height - marginx2 )
2872 ok = VRset("PB_CONDET_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
2873 ok = VRset("PB_CONDET_HELP", "Top", pane_height - pbtn_height - marginx2)
2874
2875 /* Global settings page */
2876 ok = VRSet("GB_GLOBAL", "Top", margin /* x2 */ )
2877 ok = VRSet("GB_GLOBAL", "Left", margin /* x2 */ /* split_left + 60 */ )
2878 ok = VRset("GB_GLOBAL", "Height", pane_height )
2879 ok = VRset("GB_GLOBAL", "Width", rpane_width )
2880
2881 ok = VRset("GB_GLOBAL2", "Left", margin )
2882 ok = VRset("GB_GLOBAL2", "Top", marginx2 /* 245 + marginx2 */ )
2883 ok = VRset("GB_GLOBAL2", "Width", rpane_width - marginx2 )
2884
2885 ok = VRset("GB_LOGGING", "Left", margin )
2886 ok = VRset("GB_LOGGING", "Top", margin * 3 + VRGet("GB_GLOBAL2","Height") /* 245 + (margin * 3) + VRGet("GB_GLOBAL2","Height") */ )
2887 ok = VRset("GB_LOGGING", "Width", rpane_width - marginx2 )
2888
2889 ok = VRset("GB_GUI","Left", margin )
2890 ok = VRset("GB_GUI","Top", /* 245 + */ (margin * 4) + VRGet("GB_GLOBAL2","Height") + VRGet("GB_LOGGING","Height"))
2891 ok = VRset("GB_GUI","Width", rpane_width - marginx2 )
2892
2893 ok = VRset("PB_SETTINGS_APPLY", "Left", margin )
2894 ok = VRset("PB_SETTINGS_APPLY", "Top", pane_height - pbtn_height - marginx2 )
2895 ok = VRset("PB_SETTINGS_APPLY", "Height", pbtn_height)
2896 ok = VRset("PB_SETTINGS_UNDO", "Left", VRGet("PB_CONDET_SAVE","Width") + marginx2)
2897 ok = VRset("PB_SETTINGS_UNDO", "Top", pane_height - pbtn_height - marginx2 )
2898 ok = VRset("PB_SETTINGS_UNDO", "Height", pbtn_height)
2899 ok = VRset("PB_SETTINGS_HELP", "Left", rpane_width - marginx2 - VRGet("PB_CONDET_HELP","Width") + 24)
2900 ok = VRset("PB_SETTINGS_HELP", "Top", pane_height - pbtn_height - marginx2)
2901 ok = VRset("PB_SETTINGS_HELP", "Height", pbtn_height)
2902
2903 /* DOne with pages */
2904 ok = VRset("Main","Painting", 1)
2905
2906 /* check and empty event queue, trash spurious resize events */
2907 EventString = ''
2908 TrashedResize = 0
2909
2910 do until EventString = 'nop'
2911 EventString = VREvent('N')
2912 if EventString <> 'nop' then do
2913 if EventString = 'CALL Main_Resize' then TrashedResize = 1
2914 else interpret eventString
2915 end
2916 end
2917 if TrashedResize then CALL Main_Resize
2918
2919 if options.!debug == 1 then say time()' Main_Resize done'
2920return
2921/*:VRX Menu_Context_ChangeView_Click
2922*/
2923Menu_Context_ChangeView_Click:
2924 ok = VRSet("Cn_Current","View","NameTree")
2925return
2926
2927/*:VRX Menu_Context_Detach_All_Click
2928*/
2929Menu_Context_Detach_All_Click:
2930 ok = VRMethod( "CN_CURRENT", "GetRecordList", "All", "umrh." )
2931 do um = 1 to umrh.0
2932 ok = VRMethod( "CN_CURRENT", "SetRecordAttr", umrh.um, "Selected", 1)
2933 call PB_DETACH_Click
2934 end
2935 drop um umrh.
2936return
2937
2938/*:VRX Menu_Context_Detach_Click
2939*/
2940Menu_Context_Detach_Click:
2941 call PB_DETACH_Click
2942return
2943
2944/*:VRX Menu_Context_Edit_Click
2945*/
2946Menu_Context_Edit_Click:
2947 if options.!debug == 1 then say time()' Menu_Context_Edit_Click started'
2948 /* call VRMethod "TDL_1", 'PostEvent', 'PageSelected', 'Page', 1 */
2949 ok = VRset("TDL_1", 'Selected', 1)
2950 options.!editmode = 1
2951 CALL VRSet "PB_EDIT_CANCEL","Visible", 1
2952 CALL VRSet "PB_UNMOUNT","Enabled", 0
2953
2954 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(33)" " )
2955/* CALL NLVSetText "DT_DIALOG","Caption",33 */
2956 CALL VRSet "GB_CURRENT", "ENABLED", 0
2957
2958 ok = VRSet("CB_MOUNT","Value","")
2959 ok = VRSet("CB_MOUNT","Selected",1)
2960 ok = VRSet("CB_MOUNT","Value",mtype.1)
2961
2962 parse var p_string p_workgroup':\\'p_server'\'p_share
2963
2964 /* if options.!debug == 1 then say time()' '||p_workgroup */
2965
2966 if options.!debug == 1 then say time()' data '||data
2967 if options.!debug == 1 then say time()' domain '||p_workgroup
2968 if options.!debug == 1 then say time()' server '||p_server
2969 if options.!debug == 1 then say time()' share '||p_share
2970 if options.!debug == 1 then say time()' string '||p_string
2971
2972
2973 CALL VRSet "EF_SHARE", "VALUE", p_share
2974 CALL VRSet "EF_SERVER", "VALUE", p_server
2975 CALL VRSet "EF_NETWORK","VALUE", p_workgroup
2976
2977 /* if options.!debug == 1 then say time()' '||p_node */
2978 parse var p_node p_drive'\'p_directory'\'
2979 CALL VRSet "CB_DRIVES", "Value", p_drive
2980 CALL VRSet "EF_DIRECTORY", "Value", p_directory
2981 if options.!debug == 1 then say time()' Menu_Context_Edit_Click done'
2982return
2983
2984/*:VRX Menu_Context_Open_Click
2985*/
2986Menu_Context_Open_Click:
2987 ok = VRSet("Menu_Context_Open_Default","Visible",0)
2988return
2989
2990/*:VRX Menu_Context_Open_Default_Click
2991*/
2992Menu_Context_Open_Default_Click:
2993 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click started"
2994 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
2995 PARSE VAR userdata mountpoint ';' mounts ';' .
2996
2997 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
2998
2999 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DEFAULT" )
3000
3001 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Click done"
3002return
3003
3004/*:VRX Menu_Context_Open_Detail_Click
3005*/
3006Menu_Context_Open_Detail_Click:
3007 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click started"
3008 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3009 PARSE VAR userdata mountpoint ';' mounts ';' .
3010
3011 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3012
3013 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "DETAILS" )
3014
3015 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click done"
3016return
3017
3018/*:VRX Menu_Context_Open_Icon_Click
3019*/
3020Menu_Context_Open_Icon_Click:
3021 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click started"
3022 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3023 PARSE VAR userdata mountpoint ';' mounts ';' .
3024
3025 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3026
3027 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "ICON" )
3028
3029 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Icon_Click done"
3030return
3031
3032/*:VRX Menu_Context_Open_Settings_Click
3033*/
3034Menu_Context_Open_Settings_Click:
3035 if options.!debug == 1 then say time()' '||"Menu_Context_Open_DetailsClick started"
3036 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3037 PARSE VAR userdata mountpoint ';' mounts ';' .
3038
3039 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3040
3041 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SETTINGS" )
3042
3043 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Details_Click done"
3044return
3045
3046/*:VRX Menu_Context_Open_Splitview_Click
3047*/
3048Menu_Context_Open_Splitview_Click:
3049 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click started"
3050 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3051 PARSE VAR userdata mountpoint ';' mounts ';' .
3052
3053 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3054
3055 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "SPLITVIEW" )
3056
3057 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Splitview_Click done"
3058return
3059
3060/*:VRX Menu_Context_Open_Tree_Click
3061*/
3062Menu_Context_Open_Tree_Click:
3063 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click started"
3064 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', rh, 'UserData')
3065 PARSE VAR userdata mountpoint ';' mounts ';' .
3066
3067 if length(mountpoint) > 3 then mountpoint = strip(mountpoint,'T','\')
3068
3069 ID = VRMethod( "Application", "StartThread", "wps_open", mountpoint, "TREE" )
3070
3071 if options.!debug == 1 then say time()' '||"Menu_Context_Open_Tree_Click done"
3072return
3073
3074/*:VRX Menu_Context_Refresh_Click
3075*/
3076Menu_Context_Refresh_Click:
3077 CALL Refresh
3078return
3079
3080/*:VRX Menu_Context_Unmount_Click
3081*/
3082Menu_Context_Unmount_Click:
3083 call PB_UNMOUNT_Click
3084return
3085
3086/*:VRX Menu_File_Autostart_Activate_Click
3087*/
3088Menu_File_Autostart_Activate_Click:
3089 options.!autostart = 1
3090
3091 Profile = VRParseFilename(settings.!ini,'DPN')'.'fs.!profileext
3092 ExeName = VRParseFileName(VRget("Application","Program"),'DPNE')
3093 if ExeName = "" then do
3094 parse source . . script
3095 ExeName = VRParseFilename(script,'DP')'\EVFSGUI.EXE'
3096 end
3097 StartupDir = VRParseFileName(VRget("Application","Program"),'DP')
3098 if StartupDir = "" then do
3099 parse source . . script
3100 StartUpDir = VRParseFilename(script,'DP')
3101 end
3102
3103 ObjTitle = NLVGetMessage( 59 )
3104 if ObjTitle = "" then ObjTitle = '[EVFS LAN-Connections]'
3105
3106 CALL PB_CONDET_SAVE_Click
3107
3108 rc = CreateObject( 'WPProgram', ObjTitle,'<WP_START>',,
3109 'EXENAME='||ExeName||';'||,
3110 'PROGTYPE=PM;'||,
3111 'TITLE='ObjTitle';'||,
3112 'PARAMETERS='Profile' -AUTOCLOSE -NOGUI;'||,
3113 'STARTUPDIR='StartupDir';'||,
3114 'NOPRINT=YES;'||,
3115 'HIDEBUTTON=DEFAULT;'||,
3116 'MINWIN=DEFAULT;'||,
3117 'CCVIEW=DEFAULT;'||,
3118 'DEFAULTVIEW=DEFAULT;'||,
3119 'OBJECTID=<EVFSGUI_AUTOSTART>',,
3120 'REPLACE' )
3121
3122 IF rc == 1 THEN do
3123 Text = NLVGetMessage( 60 )
3124 if Text = "" then Text = '[Created object in Autostart-Folder]'
3125 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3126 end
3127 ELSE do
3128 Text = NLVGetMessage( 61 )
3129 if Text = "" then Text = '[Could not create object in Autostart-Folder]'
3130 Title = NLVGetMessage( 5 )
3131 if Title = "" then Title = '[Error]'
3132 CALL VRMessage 'Main', Text, Title, 'E'
3133 end
3134
3135 options.!autostart = 0
3136return
3137/*:VRX Menu_File_Autostart_Click
3138*/
3139Menu_File_Autostart_Click:
3140
3141return
3142
3143/*:VRX Menu_File_Autostart_Deactivate_Click
3144*/
3145Menu_File_Autostart_Deactivate_Click:
3146 ok = SysDestroyObject("<EVFSGUI_AUTOSTART>")
3147 IF ok == 1 THEN do
3148 Text = NLVGetMessage( 79 )
3149 if Text = "" then Text = '[Autostart object created successfully]'
3150 CALL VRMessage 'Main', Text, VRGet("Main", "Caption")
3151 end
3152 ELSE do
3153 Text = NLVGetMessage( 78 )
3154 if Text = "" then Text = '[Could find Autostart object]'
3155 Title = NLVGetMessage( 5 )
3156 if Title = "" then Title = '[Error]'
3157 CALL VRMessage 'Main', Text, Title, 'E'
3158 end
3159return
3160
3161/*:VRX Menu_File_Close_Click
3162*/
3163Menu_File_Close_Click:
3164 call Quit
3165return
3166
3167/*:VRX Menu_File_Daemon_Start_Click
3168*/
3169Menu_File_Daemon_Start_Click:
3170 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click started'
3171 if VRFileExists(SysBootDrive()"\ndpsmb.dbg") then do
3172 btns.0 = 2
3173 btns.1 = NLVGetMessage( 6 )
3174 btns.2 = NLVGetMessage( 7 )
3175 confirm = VRMessage('Main', NLVGetMessage( 119 ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3176 IF confirm == 1 THEN do
3177 logFiles = value("LOGFILES",,"OS2ENVIRONMENT")
3178 ok1 = SysFileDelete(Logfiles||'\log.smbc')
3179 ok2 = SysFileDelete(Logfiles||'\log.ndpsmb')
3180 if ok1 <> 0 | ok2 <> 0 then do
3181 ok = VRMessage('Main', NLVGetMessage(5)' 'Logfiles||'\log.smbc RC='ok1||'0D0A'x||NLVGetMessage(5)' 'Logfiles||'\log.ndpsmb RC='ok2, NLVGetMessage( 5 ), 'E')
3182 end
3183 drop ok1 ok2
3184 end
3185 end
3186 address cmd 'detach 'fs.!prefix'CTL.EXE'
3187 ok = VRset("GB_CURRENT","Enabled", 1)
3188 ok = VRset("TDL_1","Enabled", 1)
3189 CALL REFRESH
3190 ok = VRSet("Menu_File_Daemon_Start","Enabled",0)
3191 ok = VRSet("Menu_File_Daemon_Stop","Enabled",1)
3192 if options.!debug == 1 then say time()' Menu_File_Daemon_Start_Click done'
3193return
3194
3195/*:VRX Menu_File_Daemon_Stop_Click
3196*/
3197Menu_File_Daemon_Stop_Click:
3198 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click started'
3199 ok = PRProcessList(proc)
3200 do I = 1 to proc.0
3201 CurProc = VRParseFileName(proc.i.name,'NE')
3202 if CurProc = fs.!prefix"CTL.EXE" then do
3203 call charout , ' 'CurProc' RC='
3204 ok = PRKillProcess(1,proc.i.pid)
3205 say ok
3206 end
3207 end
3208 ok = VRset("GB_CURRENT","Enabled", 0)
3209 ok = VRset("TDL_1","Enabled", 0)
3210 ok = VRSet("Menu_File_Daemon_Start","Enabled",1)
3211 ok = VRSet("Menu_File_Daemon_Stop","Enabled",0)
3212 if options.!debug == 1 then say time()' Menu_File_Daemon_Stop_Click stopped'
3213return
3214/*:VRX Menu_File_LMHosts_Reset_Click
3215*/
3216Menu_File_LMHosts_Reset_Click:
3217 ok = SysFileDelete(samba.!lmhosts)
3218 /* FIXME: Add a message box here */
3219return
3220
3221/*:VRX Menu_File_Load_Click
3222*/
3223Menu_File_Load_Click: PROCEDURE EXPOSE settings. options. icons. advanced. vfs. Profile fs. cd. samba.
3224 IF options.!autoload == 1 then filename = Profile
3225 else filename = VRFileDialog('Main', NLVGetMessage( 55 ), 'L', '*.'fs.!profileext)
3226 IF filename == '' THEN RETURN
3227 IF STREAM( filename, 'C', 'QUERY EXISTS') == '' THEN DO
3228 CALL VRMessage 'Main', NLVGetMessage( 56, filename ), NLVGetMessage( 5 ), 'E'
3229 RETURN
3230 END
3231
3232 CALL LINEIN filename, 1, 0
3233 DO WHILE LINES( filename )
3234 /* Fix Ticket #202 in order to allow blanks in sharenames */
3235 resline = LINEIN( filename )
3236 nodelen = pos('\\',resline)-2
3237 node = left(resline,nodelen)
3238 rwFlag = word(resline,words(resline))
3239 resource = substr(resline,nodelen+2,length(resline)-(nodelen+2)-(length(rwFlag)+1)+1)
3240 drop resline
3241 drop nodelen
3242
3243 vfs.!drive = FILESPEC('DRIVE', node )
3244 vfs.!mountpoint = STRIP( node, 'T', '\')
3245
3246 /* In case we only have a volume we reattach the backslash, otherwise restore will fail */
3247 if vfs.!drive = vfs.!mountpoint then vfs.!mountpoint = vfs.!mountpoint||'\'
3248
3249 call ParseResParmString
3250
3251 options.!workgroup = p_workgroup
3252 options.!server = p_server
3253 options.!share = p_share
3254 options.!user = p_user
3255 options.!password = p_password
3256 options.!spassword = p_spassword
3257 options.!master = p_master
3258 options.!mastertype = p_mtype
3259/* options.!memlen = p_memlen
3260 options.!logfile = p_logfile
3261 options.!loglevel = p_loglevel */
3262 options.!cachetimeout = p_cachetimeout
3263 options.!cachelistings = p_cachelistings
3264 options.!easupport = p_easupport
3265
3266 IF rwFlag == 'R' THEN
3267 options.!readonly = 1
3268 ELSE
3269 options.!readonly = 0
3270
3271 CALL Mount
3272
3273 END
3274 CALL STREAM filename, 'C', 'CLOSE'
3275
3276 options.!autoload = 0
3277
3278 CALL Refresh
3279RETURN
3280/*:VRX Menu_File_Save_Click
3281*/
3282Menu_File_Save_Click:
3283 call PB_CONDET_SAVE_Click
3284return
3285
3286/*:VRX Menu_File_ucCred_Reset_Click
3287*/
3288Menu_File_ucCred_Reset_Click:
3289 if _ucChkUc() then ok = _ucDelUc()
3290 ok = VRSet("Pict_PWINMEM","PicturePath","#37")
3291 ok = VRSet("EF_USER", "Value","")
3292 ok = VRSet("EF_PASSWORD","Value","")
3293 call _UserCredUpdate
3294return
3295
3296/*:VRX Menu_Help_About_Click
3297*/
3298Menu_Help_About_Click:
3299 ok = VRLoadSecondary("SW_ABOUT", "W")
3300return
3301
3302/*:VRX Menu_Help_Extended_Click
3303*/
3304Menu_Help_Extended_Click:
3305 ok = VRMethod( "Main", "InvokeHelp" )
3306return
3307
3308/*:VRX Menu_Selected_Connect_Click
3309*/
3310Menu_Selected_Connect_Click:
3311 call PB_SMBTREE_CONNECT_Click
3312return
3313
3314/*:VRX Menu_Selected_Default_Workgroup_Click
3315*/
3316Menu_Selected_Default_Workgroup_Click:
3317 workgroupname = VRMethod("CN_SMBTREE","GetRecordAttr",SMBObj.rh,"Caption")
3318 /* FIXME: switch over to REXXIni calls */
3319 ok = TRSetIni("[global]","workgroup", workgroupname, samba.!smbconf)
3320return
3321
3322/*:VRX Menu_Selected_DetailsView_Click
3323*/
3324Menu_Selected_DetailsView_Click:
3325 ok = VRSet("CN_smbtree", "View", "Detail")
3326return
3327
3328/*:VRX Menu_Selected_Info_Click
3329*/
3330Menu_Selected_Info_Click:
3331 if options.!debug == 1 then say time()' Menu_Selected_Info_Click started'
3332
3333 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3334 if SelRH.0 = 0 then do
3335 if options.!debug == 1 then say time()' Menu_Selected_Info_Click aborted'
3336 return
3337 end
3338
3339 call _GetSMBObjectProperties SelRH.1
3340
3341 window = VRLoadSecondary( "SW_INFO", "W" )
3342 if options.!debug == 1 then say time()' Menu_Selected_Info_Click done'
3343return
3344
3345/*:VRX Menu_Selected_Refresh_Click
3346*/
3347Menu_Selected_Refresh_Click:
3348 ok = VRMethod( "CN_smbtree", "SetRecordAttr", SMBObj.rh, "Icon","#61:PMWP.DLL")
3349 call _DelSMBObjectShares SMBObj.rh
3350 machine = SMBObj.resname
3351 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
3352 call _RefreshShares
3353return
3354
3355/*:VRX Menu_Selected_Remove_Click
3356*/
3357Menu_Selected_Remove_Click:
3358 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "selrec." )
3359 if selrec.0 = 0 then return
3360
3361 do I = 1 to selrec.0
3362 if VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.statusfh) = icons.!passive then do
3363 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3364 end
3365 else do
3366 mountpoint = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpointfh)
3367 mpidx = VRMethod("CN_CONDET", "GetFieldData", selrec.I, cd.mpidxfh)
3368 if mpidx = 1 then do
3369 btns.0 = 2
3370 btns.1 = NLVGetMessage( 6 )
3371 btns.2 = NLVGetMessage( 7 )
3372 confirm = VRMessage('Main', NLVGetMessage( 72, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3373 IF confirm \= 1 THEN RETURN
3374
3375 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "mpidx")"
3376 CALL VRMethod "CN_CONDET", 'RemoveRecord', selrec.I
3377 CALL Refresh
3378 end
3379 else do
3380 CALL VRMessage 'Main', NLVGetMessage( 71 ) , NLVGetMessage( 89 )||" "||mountpoint , 'E'
3381 end
3382 end
3383 end
3384return
3385
3386/*:VRX Menu_Selected_Retry_Click
3387*/
3388Menu_Selected_Retry_Click: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba. mtype.
3389
3390 ok = VRMethod( "CN_CONDET", "GetRecordList", "SourceOrSelected", "srcrec." )
3391 if srcrec.0 = 0 then return
3392
3393 srcrec = srcrec.1
3394
3395 p_mpoint = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.MpointFH)
3396
3397 p_workgroup = VRMethod("CN_CONDET", "GetFieldData", srcrec, cd.workgrpFH )
3398 p_server = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ServerFH)
3399 p_share = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.ShareFH)
3400 p_user = VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.UserFH)
3401 p_password = x2c(VRMethod("CN_CONDET", "GetFieldData", srcrec, CD.SpasswordFH))
3402
3403 ShareLevel = 1
3404 if p_share = "" then ShareLevel = 2
3405 if p_server = "" then ShareLevel = 3
3406 if p_workgroup = "" then ShareLevel = 4
3407
3408 ok = VRSet("CB_MOUNT", "Selected", Sharelevel )
3409 ok = VRset("CB_MOUNT", "Value", mtype.sharelevel)
3410
3411 call _UpdateObject "EF_SERVER", p_server
3412 ok = VRset("EF_SHARE" , "Value", p_share)
3413 ok = VRset("EF_NETWORK", "Value", p_workgroup)
3414 ok = VRset("EF_USER" , "Value", p_user)
3415 ok = VRset("EF_PASSWORD", "Value", p_password)
3416
3417 parse var p_mpoint p_drv '\' p_dir
3418
3419 p_dir = strip(p_dir,'T','\')
3420
3421 ok = VRset("CB_DRIVES" , "Value", p_drv)
3422 ok = VRset("EF_DIRECTORY" , "Value", p_dir)
3423
3424 CALL PB_MOUNT_Click
3425
3426/* if VRMethod( "CN_CONDET", "ValidateRecord", srcRec) = 1 then do
3427 if VRMethod("CN_CONDET", "GetRecordAttr", srcRec, "Icon") = icons.!passive then ok = VRMethod( "CN_CONDET", "RemoveRecord", srcRec)
3428 end */
3429return
3430
3431/*:VRX Menu_Selected_TimeSync_Click
3432*/
3433Menu_Selected_TimeSync_Click:
3434 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click started'
3435
3436 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
3437 if SelRH.0 = 0 then do
3438 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click aborted'
3439 return
3440 end
3441
3442 call _GetSMBObjectProperties SelRH.1
3443
3444 options.!timesrv = SMBObj.resname
3445 call _TimeSync
3446
3447 if options.!debug == 1 then say time()' Menu_Selected_TimeSync_Click done'
3448return
3449
3450/*:VRX Menu_Selected_TreeView_Click
3451*/
3452Menu_Selected_TreeView_Click:
3453 ok = VRSet("CN_smbtree", "View", "IconTree")
3454return
3455
3456/*:VRX Mount
3457*/
3458Mount: PROCEDURE EXPOSE settings. options. icons. vfs. fs. advanced. cd. samba.
3459 if options.!debug == 1 then say time()' Mount procedure started'
3460 /* Set mouse pointer to wait - this operation might take a few seconds */
3461 call VRSet VRWindow(), 'Pointer', 'Wait'
3462
3463/* Disabled, because we merge profile now - in earlier revisions
3464 we replaced it but only for preexisting drives - this made only
3465 sense as long as we were unable to detect double connections -
3466 this could be made an option!
3467
3468 IF options.!autoload then do
3469 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"vfs.!drive"')"
3470 if options.!debug == 1 then say time()' '||'Autoload Detach "'vfs.!drive'" =' ok
3471 end */
3472
3473 /* Attach the virtual drive - only if drive is not already attached */
3474 if pos(vfs.!drive,MyFreeDriveMap("C:","FREE")) > 0 then do
3475 CALL _Dynamic "ok = "fs.!prefix"RxAttach('"vfs.!drive"')"
3476
3477 if options.!debug == 1 then say time()' '||'Attach "'vfs.!drive'" =' ok
3478 end
3479
3480 /* Create the mount point and store whether it was created or already existed */
3481 CALL _Dynamic "CreateMP = "fs.!prefix"RxCreateMountPoint('"vfs.!mountpoint"')"
3482
3483 if options.!debug == 1 then say time()' '||'Create "'vfs.!mountpoint'" = 'CreateMP
3484
3485
3486 /* Build the resource parameter string */
3487 src = ''
3488 IF options.!workgroup \= '' THEN src = src';WORKGROUP='options.!workgroup
3489 IF options.!server \= '' THEN src = src';SERVER='options.!server
3490 IF options.!share \= '' THEN src = src';SHARE='options.!share
3491 IF options.!user \= '' THEN src = src';USER='options.!user
3492 IF options.!password \= '' THEN src = src';PASSWORD='options.!password
3493 IF options.!spassword \= '' THEN src = src';SPASSWORD='options.!spassword
3494 IF options.!master \= '' THEN src = src';MASTER='options.!master
3495 IF options.!mastertype \= '' THEN src = src';MASTERTYPE='options.!mastertype
3496/* IF options.!memlen \= '' THEN src = src';MEMLEN='options.!memlen
3497 IF options.!logfile \= '' THEN src = src';LOGFILE='options.!logfile
3498 IF options.!loglevel \= '' THEN src = src';LOGLEVEL='options.!loglevel */
3499 IF options.!cachetimeout \= '' THEN src = src';CTO='options.!cachetimeout
3500 IF options.!cachelistings \= '' THEN src = src';CLD='options.!cachelistings
3501 IF options.!easupport \= '' THEN src = src';EASUPPORT='options.!easupport
3502
3503 IF options.!readonly = 1 then rwFlag = 'R'; else rwFlag = 'W'
3504
3505 parse var vfs.!mountpoint mpoint ';' .
3506 mpoint = strip(mpoint,'T','\')||'\'
3507
3508 if options.!master = "" then options.!master = "WORKGROUP"
3509 if options.!mtype = "" then options.!mtype = "1"
3510 if options.!loglevel = "" then options.!loglevel = "0"
3511 if options.!memlen = "" then options.!memlen = "2"
3512 if options.!cachetimeout = "" then options.!cachetimeout = "10"
3513 if options.!cachelistings = "" then options.!cachelistings = "32"
3514 if options.!easupport= "" | options.!easupport= " " then options.!easupport = strip(options.!easupport)
3515 if options.!password <> "" & options.!spassword = "" then do
3516 options.!spassword = c2x(options.!password)
3517 options.!password = ""
3518 end
3519
3520 hashstr = mpoint' 'translate(options.!workgroup)' 'translate(options.!server)' 'translate(options.!share)' 'options.!user' 'options.!spassword' 'options.!easupport' 'rwFlag
3521
3522 md5 = rexx_md5(hashstr)
3523
3524 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3525 DO i = 1 TO records.0
3526 hash = VRMethod("CN_CONDET","GetFieldData", records.i, cd.hashfh)
3527
3528 if options.!debug == 1 then say VRMethod("CN_CONDET","GetFieldData", records.i, CD.mpointFH)'->'hash
3529 if options.!debug == 1 then say mpoint'->'md5
3530
3531 if hash = md5 then do
3532 If VRMethod("CN_CONDET","GetFieldData", records.i, cd.statusfh) = icons.!active then do /* Same hash, status active */
3533 say "Double connection detected!!"
3534 if options.!spassword <> "" then upw = ":********"
3535 else upw = ""
3536 buttons.0 = 2
3537 buttons.1 = NLVGetMessage(9)
3538 buttons.2 = NLVGetMessage(3)
3539 Answer = VRMessage('Main',NLVGetMessage(64) , NLVGetMessage( 36,options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3540 if Answer = 2 then do
3541 call VRSet VRWindow(), 'Pointer', '<default>'
3542 say "Double connection - do not mount!!"
3543 return
3544 end
3545 end
3546 else do /* Same hash, status passive - we have to remove it */
3547 ok = VRMethod("CN_CONDET", "RemoveRecord", records.i )
3548 end
3549 end
3550 end
3551
3552 cd.lastrh = ""
3553 ok = ParseResourceData(vfs.!mountpoint,'SMBFS SMBFS64 \\'options.!workgroup':'options.!server'\'options.!share'@'options.!user||src' 'rwFlag)
3554
3555 /* Now mount the resource */
3556 CALL _Dynamic "ok = "fs.!prefix"RxMount('SMBFS','"vfs.!mountpoint"', '"src"', '"rwFlag"')"
3557
3558 if options.!debug == 1 then say time()' '||'Mount "'vfs.!mountpoint'" =' ok
3559 if ok <> 0 then do
3560 if options.!password <> "" then upw = ":********"
3561 else upw = ""
3562 buttons.0 = 2
3563 buttons.1 = NLVGetMessage(2)
3564 buttons.2 = NLVGetMessage(37)
3565 Answer = VRMessage('Main', SysGetMessage(ok), NLVGetMessage( 36, options.!user||upw'@'options.!workgroup'\\'options.!server'\'options.!share, vfs.!mountpoint ), 'W','buttons.')
3566 if Answer = 2 then do /* Show explanation */
3567 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')
3568 end
3569 if cd.lastrh <> '' then do
3570 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!passive) /* Passive Connection icon */
3571 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!passive) /* Passive Connection icon */
3572 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, '') /* remove pain text password */
3573 end
3574
3575 /* In case the mountpoint was created for this failed operation, it is (optionally) removed again */
3576 if CreateMP = 0 & advanced.!alwaysmp <> 1 then do
3577 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"vfs.!mountpoint"')"
3578 if options.!debug == 1 then say time()' '||'Remove "'vfs.!mountpoint'" = 'ok
3579 end
3580 end
3581 else do
3582 if options.!storecreds = 1 then do
3583 ok = VRSet("EF_User", "Value",options.!user)
3584 ok = VRSet("EF_Password","Value",x2c(options.!spassword))
3585 end
3586 end
3587 drop CreateMP /* not required anymore */
3588
3589/* Obsolete - the IOCtl will not be implemented this way in the plugin
3590 The REXX function is present, but is has no counterpart in the plugin
3591 ok = EvfsRxIoctl( 100 , vfs.!mountpoint, outstring)
3592 if options.!debug == 1 then say time()' '||'RxIoctl "'vfs.!mountpoint'" = 'ok', 'outstring
3593 */
3594 /* Set mouse pointer to default again */
3595 call VRSet VRWindow(), 'Pointer', '<default>'
3596 if options.!debug == 1 then say time()' Mount procedure done'
3597RETURN ok
3598
3599/*:VRX MyFreeDriveMap
3600*/
3601MyFreeDriveMap: procedure expose options. icons. fs. samba.
3602 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) started'
3603 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:"
3604/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) started" */
3605 useddrives= SysDriveMap("C:","USED")
3606/* if options.!debug == 1 then say time()' '||"SysDriveMap(USED) done" */
3607
3608 Alldr = words(alldrives)
3609 FreeDriveMap = ""
3610 do I = 1 to AllDr
3611 if word(alldrives,1) = word(useddrives,1) then do
3612 Useddrives = subword(useddrives,2)
3613 Alldrives = subword(Alldrives,2)
3614 end
3615 else do
3616 FreeDriveMap = FreeDriveMap||word(alldrives,1)||' '
3617 Alldrives = subword(Alldrives,2)
3618 end
3619 end
3620 if options.!debug == 1 then say time()' MyFreeDriveMap(proc) done, result "'FreeDriveMap'"'
3621return FreeDriveMap
3622/*:VRX NoEVFSCALL
3623*/
3624NoEVFSCALL:
3625 CALL VRMessage 'Main', NLVGetMessage( 100 ), NLVGetMessage( 5 ), 'E'
3626 signal Halt
3627RETURN
3628
3629/*:VRX ParseResourceData
3630*/
3631ParseResourceData: PROCEDURE EXPOSE userdata options. icons. advanced. fs. cd. samba.
3632 PARSE ARG userdata, resource
3633 if options.!debug == 1 then say time()' ParseResourceData started'
3634 if options.!debug == 1 then say ' receiving "'userdata'" "'resource'" length ('length(resource)')'
3635
3636/* WARNING! resource has a maximal length of 255 and is truncated otherwise */
3637
3638/* PARSE VAR resource . ';WORKGROUP='p_workgroup';SERVER='p_server';SHARE='p_share';' . */
3639
3640 if left(word(resource,1),5) <> "SMBFS" then do
3641 /* Support for other filesystems would come here! */
3642 userData = "UNKNOWN"
3643 end
3644 else do
3645 cd.lastrh = VRMethod("CN_CONDET","AddRecord")
3646 PARSE VAR userdata p_mpoint ';' p_mpidx ';' .
3647
3648 p_mpoint = strip(p_mpoint,'T','\')||'\'
3649 p_rw = word(resource, words(resource))
3650
3651 /* Workaround for truncated resource string */
3652 if length(p_rw) > 1 then do
3653 /* The resource string must have been truncated
3654 p_rw is already wrong and
3655 p_easupport will most likely be also wrong (look below for workaround!) */
3656 p_rw ="W" /* this is guessed only!!! */
3657 if options.!debug == 1 then say ' WARNING! Detected truncated resource string - shorten workgroup name, server name, share name until this message goes away!'
3658 end
3659 /* this should be done unconditionally if the resource string is never truncated */
3660 else resource = left(resource,length(resource)-length(p_rw))
3661
3662 call ParseResParmString
3663
3664 if p_master = "" then p_master = "WORKGROUP"
3665 if p_mtype = "" then p_mtype = "1"
3666 if p_loglevel = "" then p_loglevel = "0"
3667 if p_memlen = "" then p_memlen = "2"
3668
3669 /* Also works around for a truncated resource string! */
3670 if p_easupport= "" | p_easupport= " " then p_easupport = strip(options.!easupport)
3671
3672 if p_password <> "" & p_spassword = "" then do
3673 p_spassword = c2x(p_password)
3674 p_password = ""
3675 end
3676
3677 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)
3678 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.passwordfh, p_password, cd.spasswordfh, p_spassword, cd.masterfh, p_master, cd.mtypefh, p_mtype)
3679 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.ctoFH, p_cachetimeout, cd.cldFH, p_cachelistings)
3680 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)
3681 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.statusfh, icons.!active) /* Active */
3682 ok = VRMethod("CN_CONDET", "SetRecordAttr", cd.lastrh, "Icon", icons.!active) /* Active */
3683
3684 hashstr = p_mpoint' 'translate(p_workgroup)' 'translate(p_server)' 'translate(p_share)' 'p_user' 'p_spassword' 'p_easupport' 'p_rw
3685
3686 md5 = rexx_md5(hashstr)
3687
3688 ok = VRMethod("CN_CONDET", "SetFieldData", cd.lastrh, cd.hashfh,md5)
3689
3690 SELECT
3691 WHEN p_share == '' & p_server \= '' THEN DO /* all shares on server */
3692 IF p_workgroup == '' THEN
3693 userdata = userdata';\\'p_server'\*'
3694 ELSE
3695 userdata = userdata';'p_workgroup':\\'p_server'\*'
3696 END
3697 WHEN p_server == '' & p_workgroup \= '' THEN /* all servers in workgroup */
3698 userdata = userdata';'p_workgroup':\\*'
3699 WHEN p_server == '' & p_workgroup == '' THEN /* all workgroups */
3700 userdata = userdata';*:\\*'
3701 OTHERWISE DO
3702 IF p_workgroup == '' THEN
3703 userdata = userdata';\\'p_server'\'p_share
3704 ELSE
3705 userdata = userdata';'p_workgroup':\\'p_server'\'p_share
3706 END
3707 END
3708 end
3709
3710 if options.!debug == 1 then say ' returning "'userdata'"'
3711 if options.!debug == 1 then say time()' ParseResourceData done'
3712RETURN userdata
3713
3714/*:VRX ParseResParmString
3715*/
3716ParseResParmString:
3717 PARSE VAR resource . ';WORKGROUP=' p_workgroup ';' .
3718 PARSE VAR resource . ';SERVER=' p_server ';' .
3719 PARSE VAR resource . ';SHARE=' p_share ';' .
3720 PARSE VAR resource . ';USER=' p_user ';' .
3721 PARSE VAR resource . ';PASSWORD=' p_password ';' .
3722 PARSE VAR resource . ';SPASSWORD=' p_spassword ';' .
3723 PARSE VAR resource . ';MASTER=' p_master ';' .
3724 PARSE VAR resource . ';MASTERTYPE=' p_mtype ';' .
3725 PARSE VAR resource . ';MEMLEN=' p_memlen ';' .
3726 PARSE VAR resource . ';LOGFILE=' p_logfile ';' .
3727 PARSE VAR resource . ';LOGLEVEL=' p_loglevel ';' .
3728 PARSE VAR resource . ';CTO=' p_cachetimeout ';' .
3729 PARSE VAR resource . ';CLD=' p_cachelistings ';' .
3730 PARSE VAR resource . ';EASUPPORT=' p_easupport ' '
3731return
3732/*:VRX PB_ABOUT_CLOSE_Click
3733*/
3734PB_ABOUT_CLOSE_Click:
3735 CALL SW_ABOUT_Close
3736return
3737
3738/*:VRX PB_ABOUT_COPY_Click
3739*/
3740PB_ABOUT_COPY_Click:
3741 ok = VRMethod( "Application", "PutClipboard", AboutStr )
3742 if options.!debug == 1 then call beep 880*2,10
3743 CALL SW_ABOUT_Close
3744return
3745
3746/*:VRX PB_ADVANCED_APPLY_Click
3747*/
3748PB_ADVANCED_APPLY_Click:
3749 advanced.!easupport = VRGet( "CB_EAS", "Set" )
3750 advanced.!readonly = VRGet( "CB_READONLY", "Set" )
3751 advanced.!alwaysmp = VRGet( "CB_ALWAYSMP", "Set" )
3752 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT", "Value" )
3753 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS", "Value" )
3754
3755 /* Obsolete */
3756 advanced.!memlen = VRGet( "SPB_MEMLEN", "Value" )
3757return
3758
3759/*:VRX PB_ADVANCED_HELP_Click
3760*/
3761PB_ADVANCED_HELP_Click:
3762 CALL VRMethod 'SW_ADVANCED', 'InvokeHelp'
3763return
3764
3765/*:VRX PB_ADVANCED_UNDO_Click
3766*/
3767PB_ADVANCED_UNDO_Click:
3768 CALL SW_ADVANCED_Init_Content
3769RETURN
3770
3771/*:VRX PB_ClearCred_Click
3772*/
3773PB_ClearCred_Click:
3774 call Menu_File_ucCred_Reset_Click
3775return
3776
3777/*:VRX PB_CONDET_HELP_Click
3778*/
3779PB_CONDET_HELP_Click:
3780 CALL VRMethod 'GB_CONDET', 'InvokeHelp'
3781return
3782
3783/*:VRX PB_CONDET_LOAD_Click
3784*/
3785PB_CONDET_LOAD_Click:
3786 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click started"
3787 call Menu_File_Load_Click
3788 if options.!debug == 1 then say time()' '||"PB_CONDET_LOAD_Click done"
3789RETURN
3790
3791/*:VRX PB_CONDET_SAVE_Click
3792*/
3793PB_CONDET_SAVE_Click: PROCEDURE EXPOSE settings. options. icons. Profile fs. cd. advanced. samba.
3794 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click started"
3795
3796 if options.!autostart == 0 THEN filename = VRFileDialog('Main', NLVGetMessage( 50 ), 'S', '*.'fs.!profileext)
3797 ELSE filename = Profile
3798
3799 IF filename == '' THEN RETURN
3800
3801 IF STREAM( filename, 'C', 'QUERY EXISTS') \= '' THEN DO
3802 btns.0 = 2
3803 btns.1 = NLVGetMessage( 6 )
3804 if btns.1 = "" then btns.1 = '[Yes]'
3805 btns.2 = NLVGetMessage( 7 )
3806 if btns.2 = "" then btns.2 = '[No]'
3807 Title = NLVGetMessage( 53 )
3808 if Title = "" then Title = "[File exists]"
3809 Text = NLVGetMessage( 54, filename )
3810 if Text = "" then Text = "[File "filename" exists? Overwrite?]"
3811
3812 confirm = VRMessage('Main', Text, Title, 'W', 'btns.', 1, 2 )
3813 IF confirm \= 1 THEN RETURN
3814 CALL VRChAttr filename,, 'HSR'
3815 CALL VRDeleteFile filename
3816 END
3817
3818 CALL VRMethod "CN_CONDET", 'GetRecordList', 'All', 'records.'
3819 DO i = 1 TO records.0
3820 resource = ""
3821 resource = resource||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mpointfh)||" "
3822 resource = resource||'\\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
3823 resource = resource||':'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3824 resource = resource||'\'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3825 resource = resource||'@'||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3826 resource = resource||';WORKGROUP='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.workgrpFH )
3827 resource = resource||';SERVER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.serverfh)
3828 resource = resource||';SHARE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.sharefh)
3829 resource = resource||';USER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.userfh)
3830 resource = resource||';PASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.passwordfh)
3831 resource = resource||';SPASSWORD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.spasswordfh)
3832 resource = resource||';MASTER='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.masterfh)
3833 resource = resource||';MASTERTYPE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.mtypefh)
3834 resource = resource||';CTO='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.ctoFH)
3835 resource = resource||';CLD='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.cldFH)
3836/* resource = resource||';MEMLEN='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.memlenfh)
3837 resource = resource||';LOGFILE='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.logfilefh)
3838 resource = resource||';LOGLEVEL='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.loglevelfh) */
3839 resource = resource||';EASUPPORT='||VRMethod("CN_CONDET","GetFieldData", records.i, cd.easupportfh)
3840 resource = resource||' '||VRMethod("CN_CONDET","GetFieldData", records.i, cd.rwfh)
3841 call lineout filename, resource
3842 END
3843 CALL STREAM filename, 'C', 'CLOSE'
3844
3845 if options.!autostart == 0 THEN do
3846 Title = NLVGetMessage( 51 )
3847 if Title = "" then Title = "[Profile saved]"
3848 Text = NLVGetMessage( 52, filename )
3849 if Text = "" then Text = "[Profile saved to "filename"!]"
3850 CALL VRMessage 'Main', Text , Title, 'I'
3851 end
3852
3853 if options.!debug == 1 then say time()' '||"PB_CONDET_SAVE_Click done"
3854RETURN
3855
3856/*:VRX PB_DETACH_Click
3857*/
3858PB_DETACH_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
3859 if options.!debug == 1 then say time()' '||"PB_DETACH_Click started"
3860 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
3861 IF select.0 < 1 THEN RETURN
3862
3863 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
3864 PARSE VAR userdata mountpoint ';' mounts ';' .
3865 drive = STRIP( mountpoint, 'T', '\')
3866
3867 btns.0 = 2
3868 btns.1 = NLVGetMessage( 6 )
3869 btns.2 = NLVGetMessage( 7 )
3870 confirm = VRMessage('Main', NLVGetMessage( 58, drive ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
3871 IF confirm \= 1 THEN RETURN
3872
3873 /* TODO: ?? Unmount & delete all child mountpoints? - Do we need this? */
3874 /* FIXME: This is potentially dangerous on Netdrive - what happens with unknown mount types? */
3875 /* FIXME: Unclear under which circumstances we have an alpha value here (which crahed EVFSGUI) */
3876 if datatype(mounts) = 'NUM' then do
3877 /* Unmount any resources */
3878 DO i = 1 TO mounts
3879 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
3880 END
3881 end
3882 else if options.!debug == 1 then say ' '||"mounts = "mounts
3883
3884 CALL _Dynamic "ok = "fs.!prefix"RxDetach('"drive"')"
3885
3886 CALL Refresh
3887 if options.!debug == 1 then say time()' '||"PB_DETACH_Click done"
3888RETURN
3889
3890/*:VRX PB_DIALOG_HELP_Click
3891*/
3892PB_DIALOG_HELP_Click:
3893 CALL VRMethod 'GB_DIALOG', 'InvokeHelp'
3894return
3895
3896/*:VRX PB_EDIT_CANCEL_Click
3897*/
3898PB_EDIT_CANCEL_Click:
3899 options.!editmode = 0
3900 CALL VRSet "PB_UNMOUNT","Enabled", 1
3901 CALL VRSet "GB_CURRENT", "ENABLED", 1
3902 ok = VRSet("PB_EDIT_CANCEL","Visible", 0)
3903 ok = VRMethod( "TDL_1", "SetTabText", 1, " "NLVGetMessage(13)" " )
3904/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
3905RETURN 0
3906
3907/*:VRX PB_INFO_OK_Click
3908*/
3909PB_INFO_OK_Click:
3910 call SW_INFO_Close
3911RETURN
3912
3913/*:VRX PB_LOGIN_CANCEL_Click
3914*/
3915PB_LOGIN_CANCEL_Click:
3916 credentials.!entered = 0
3917 call SW_LOGIN_Close
3918RETURN
3919
3920/*:VRX PB_LOGIN_OK_Click
3921*/
3922PB_LOGIN_OK_Click:
3923 ok = VRSet("EF_USER","Value",VRGet("EF_USER1","Value"))
3924 ok = VRSet("EF_PASSWORD","Value",VRGet("EF_PASSWORD1","Value"))
3925 options.!storecreds = VRGet("CB_STORECREDS1","Set")
3926 credentials.!entered = 1
3927
3928 if p_server <> "" then do
3929 ok = _rpcqueryuser(p_server, VRGet("EF_USER1","Value"), VRGet("EF_PASSWORD1","Value"), VRGet("EF_USER1","Value"))
3930
3931 if word(ok,1) = "1" then do
3932 ok = VRSet("DT_STATUSBAR","Caption", NLVGetMessage(107, rpc.queryuser.FULL_NAME))
3933 say 'rpc.queryuser.DIR_DRIVE = "'rpc.queryuser.DIR_DRIVE'"'
3934 say 'rpc.queryuser.LOGON_SCRIPT = "'rpc.queryuser.LOGON_SCRIPT'"'
3935 end
3936 else do
3937 CALL VRMessage 'Main', VRGet("EF_USER1","Value")" \\"p_server": "rpc.queryuser.LOGONSTATUS, NLVGetMessage(5), "E"
3938 end
3939 end
3940
3941 call SW_LOGIN_Close
3942RETURN
3943
3944/*:VRX PB_MOUNT_Click
3945*/
3946PB_MOUNT_Click:
3947 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click started"
3948 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 0)
3949 say " network = "network
3950 if options.!editmode = 1 then do
3951 CALL PB_UNMOUNT_Click
3952 options.!editmode = 0
3953 ok = VRMethod("TDL_1","SetTabText", " "strip(NLVGetMessage(13))" ")
3954/* CALL NLVSetText 'DT_DIALOG', "Caption", 13 */
3955
3956 CALL VRSet "PB_UNMOUNT","Enabled", 1
3957 CALL VRSet "GB_CURRENT", "ENABLED", 1
3958 end
3959
3960 options.!workgroup = ''
3961 options.!server = ''
3962 options.!share = ''
3963 options.!user = ''
3964 options.!password = ''
3965 options.!master = ''
3966 options.!mastertype = ''
3967 options.!memlen = advanced.!memlen
3968 options.!easupport = advanced.!easupport
3969 options.!readonly = advanced.!readonly
3970 options.!loglevel = advanced.!loglevel
3971 options.!logfile = advanced.!logfile
3972 options.!cachetimeout = advanced.!cachetimeout
3973 options.!cachelistings = advanced.!cachelistings
3974
3975 vfs.!drive = ''
3976 vfs.!mountpoint = ''
3977
3978 stype = VRGet( "CB_MOUNT", "Selected" )
3979 share = STRIP( VRGet( "EF_SHARE", "Value" ))
3980 server = STRIP( VRGet( "EF_SERVER", "Value" ))
3981 network = STRIP( VRGet( "EF_NETWORK", "Value" ))
3982 mtype = VRGet( "CHK_MTYPE", "Set" )
3983 userid = STRIP( VRGet( "EF_USER", "Value" ))
3984 password = STRIP( VRGet( "EF_PASSWORD", "Value" ))
3985 mdrive = VRGet( "CB_DRIVES", "SelectedText" )
3986 if mdrive = "" then mdrive = VRGet( "CB_DRIVES", "Value" )
3987 mpath = STRIP( VRGet( "EF_DIRECTORY", "Value" ))
3988
3989 IF ( stype < 1 | stype > 4 ) THEN stype = 1
3990
3991 /* The required/optional/ignored parameters depend on the type of mount
3992 * requested. (Note, however, that the user, password, easupport and
3993 * memlen parameters are always optional.)
3994 */
3995 SELECT
3996 /* Scenario 1: Mount a single share.
3997 * Required: share, server
3998 * Optional: workgroup
3999 * Unused: master, mastertype
4000 */
4001 WHEN stype = 1 THEN DO
4002 IF server == '' | share == '' THEN DO
4003 /* error */
4004 RETURN 1
4005 END
4006 options.!server = server
4007 options.!share = share
4008 options.!workgroup = network
4009 END
4010
4011 /* Scenario 2: Mount all shares on a server.
4012 * Required: server
4013 * Optional: workgroup
4014 * Unused: share, master, mastertype
4015 */
4016 WHEN stype = 2 THEN DO
4017 IF server == '' THEN DO
4018 /* error */
4019 RETURN 1
4020 END
4021 options.!server = server
4022 options.!workgroup = network
4023 END
4024
4025 /* Scenario 3: Mount all servers in a workgroup.
4026 * Required: workgroup
4027 * Optional: -
4028 * Unused: share, server, master, mastertype
4029 */
4030 WHEN stype = 3 THEN DO
4031 IF workgroup == '' THEN DO
4032 /* error */
4033 RETURN 1
4034 END
4035 options.!workgroup = network
4036 END
4037
4038 /* Scenario 4: Mount all workgroups known to a master.
4039 * Required: master, mastertype
4040 * Optional: -
4041 * Unused: share, server, workgroup
4042 */
4043 WHEN stype = 4 THEN DO
4044 IF master == '' | mastertype == '' THEN DO
4045 /* error */
4046 RETURN 1
4047 END
4048 options.!master = network
4049 options.!mastertype = mtype
4050 END
4051 END
4052
4053 options.!user = userid
4054 options.!password = password
4055
4056 vfs.!drive = mdrive
4057 vfs.!mountpoint = mdrive'\'mpath
4058
4059 CALL Mount
4060 CALL Refresh
4061 ok = VRSet("TM_RefreshCurrentDisplay","Enabled", 1)
4062 if options.!debug == 1 then say time()' '||"PB_MOUNT_Click done"
4063RETURN 0
4064
4065/*:VRX PB_NEWMOUNTPOINTCANCEL_Click
4066*/
4067PB_NEWMOUNTPOINTCANCEL_Click:
4068 ok = VRSet("CB_DRIVES","Value","")
4069 ok = VRSet("EF_DIRECTORY","Value","")
4070 call SW_MOUNTPOINT_Close
4071RETURN 0
4072
4073/*:VRX PB_NEWMOUNTPOINTOK_Click
4074*/
4075PB_NEWMOUNTPOINTOK_Click:
4076 ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4077 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4078
4079 advanced.!readonly = VRGet("CB_READONLY1","Set")
4080 advanced.!easupport = VRGet("CB_EAS1","Set")
4081 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4082 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4083 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4084
4085 call SW_MOUNTPOINT_Close
4086RETURN
4087
4088/*:VRX PB_NEWPORTCANCEL_Click
4089*/
4090PB_NEWPORTCANCEL_Click:
4091/* ok = VRSet("CB_DRIVES","Value","")
4092 ok = VRSet("EF_DIRECTORY","Value","")
4093 call SW_MOUNTPOINT_Close */
4094RETURN 0
4095
4096/*:VRX PB_NEWPORTCONNECT_Click
4097*/
4098PB_NEWPORTCONNECT_Click:
4099/* ok = VRSet("CB_DRIVES","Value",VRGet("CB_DRIVES1","Value"))
4100 ok = VRSet("EF_DIRECTORY","Value",VRGet("EF_DIRECTORY1","Value"))
4101
4102 advanced.!readonly = VRGet("CB_READONLY1","Set")
4103 advanced.!easupport = VRGet("CB_EAS1","Set")
4104 advanced.!alwaysmp = VRGet("CB_ALWAYSMP1","Set")
4105 advanced.!cachetimeout = VRGet( "SPIN_CACHETIMEOUT1", "Value" )
4106 advanced.!cachelistings = VRGet( "SPIN_CACHELISTINGS1", "Value" )
4107
4108 call SW_MOUNTPOINT_Close */
4109RETURN
4110
4111/*:VRX PB_PROGRESS_ABORT_Click
4112*/
4113PB_PROGRESS_ABORT_Click:
4114 options.!delay = 0
4115 options.!autoload = 0
4116 options.!autoclose = 0
4117 call SW_PROGRESS_Close
4118return
4119
4120/*:VRX PB_SETTINGS_APPLY_Click
4121*/
4122PB_SETTINGS_APPLY_Click:
4123 advanced.!loglevel = VRGet("SPIN_LOGLEVEL", "Value" )
4124 advanced.!logfile = VRGet("EF_LOGFILE", "Value" )
4125 advanced.!browseauth = VRGet("CB_BROWSEAUTH", "Set" )
4126 advanced.!browseimme = VRGet("CB_BROWSEIMME", "Set" )
4127 advanced.!special = VRGet("CB_SPECIAL", "Set" )
4128 advanced.!savepassive = VRGet("CB_SAVEPASSIVE","Set" )
4129 advanced.!lmhosts = VRGet("CB_LMHOSTS", "Set" )
4130 advanced.!broadcast = VRGet("CB_BROADCAST", "Set" )
4131 advanced.!miniicons = VRGet("CB_MINIICONS", "Set" )
4132
4133 /* Note: CB_LOGGING has its own event tied to the click */
4134 options.!storecreds = VRGet("CB_STORECREDS", "Set" )
4135 options.!debug = VRGet("CB_DEBUG", "Set" )
4136
4137 if options.!debug == 1 then do /* Turn on additional columns in connection details view */
4138 ok = VRRedirectStdio("ON")
4139 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 1)
4140 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 1)
4141 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 1)
4142 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 1)
4143 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 1)
4144 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 1)
4145 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 1)
4146 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 1)
4147 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 1)
4148 end
4149 else do /* Turn on additional columns in connection details view */
4150 ok = VRRedirectStdio("OFF")
4151 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mpidxfh , "Visible", 0)
4152 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.passwordfh , "Visible", 0)
4153 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.spasswordfh , "Visible", 0)
4154 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.masterFH , "Visible", 0)
4155 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.mtypeFH , "Visible", 0)
4156 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.memlenfh , "Visible", 0)
4157 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.logfilefh , "Visible", 0)
4158 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.loglevelfh , "Visible", 0)
4159 ok = VRMethod("CN_CONDET", "SetFieldAttr", cd.hashfh , "Visible", 0)
4160 end
4161
4162 ok = VRset("CN_CURRENT", "MiniIcons", advanced.!miniicons)
4163 ok = VRset("CN_SMBTREE", "MiniIcons", advanced.!miniicons)
4164 ok = VRset("CN_CONDET", "MiniIcons", advanced.!miniicons)
4165
4166 if advanced.!lmhosts = 1 then do
4167 call _LMHostsRead
4168 call _LMHostsUpdate
4169 end
4170 if advanced.!smbconfchanged = 1 then do
4171 name_resolve_order = VRGet("SPIN_NRO1","value")' 'VRGet("SPIN_NRO2","value")' 'VRGet("SPIN_NRO3","value")' 'VRGet("SPIN_NRO4","value")
4172 handle = IniOpen('global', samba.!smbconf)
4173 call IniSet 'name resolve order', name_resolve_order, handle
4174 /* FIXME: Throw an error in this case */
4175 if \_IsValidIPAddress(VRGet("EF_WINS_SERVER","Value")) then ok = VRSet("EF_WINS_SERVER","Value","")
4176 call IniSet 'wins server', VRGet("EF_WINS_SERVER","Value"), handle
4177 call IniSave handle
4178 call IniClose handle
4179 advanced.!smbconfchanged = 0
4180 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 0)
4181 end
4182 if options.!storecreds = 0 then call Menu_File_ucCred_Reset_Click
4183return
4184
4185/*:VRX PB_SETTINGS_HELP_Click
4186*/
4187PB_SETTINGS_HELP_Click:
4188 CALL VRMethod 'SW_SETTINGS', 'InvokeHelp'
4189return
4190
4191/*:VRX PB_SETTINGS_UNDO_Click
4192*/
4193PB_SETTINGS_UNDO_Click:
4194 call SW_SETTINGS_Init_Content
4195return
4196
4197/*:VRX PB_SMBTREE_CONNECT_Click
4198*/
4199PB_SMBTREE_CONNECT_Click: PROCEDURE EXPOSE settings. options. icons. fs. advanced. cd. samba. mtype.
4200 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click started"
4201
4202 ok = VRMethod( "CN_SMBTREE", "GetRecordList", "SourceOrSelected", "SelRH." )
4203
4204 if SelRH.0 = 0 then do
4205 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click aborted"
4206 return
4207 end
4208
4209 p_workgroup = ''
4210 p_server = ''
4211 p_share = ''
4212
4213 srcFile = ""
4214 srcCtn = VRGet("CN_SMBTREE","Self")
4215 srcRec = SelRH.1
4216 trgCtn = VRGet("CN_CURRENT","Self")
4217 trgRec = ""
4218
4219 if options.!debug == 1 then do
4220 say ' srcCtn = "'srcCtn'"'
4221 if srcCtn <> "" then say ' srcCtn name = "'VRGet(srcCtn,'Name')'"'
4222 say ' srcRec = "'srcRec'"'
4223 say ' trgCtn = "'trgCtn'"'
4224 if trgCtn <> "" then say ' trgCtn name = "'VRGet(trgCtn,'Name')'"'
4225 say ' trgRec = "'trgRec'"'
4226 end
4227
4228 ok = VRMethod("CB_MOUNT", "GetStringList", "ShareLevels." )
4229
4230 DragCapt = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Caption")
4231 ParentRH = VRMethod(srcCtn, "GetRecordAttr", srcRec, "Parent")
4232
4233 if ParentRH = "" then do /* A workgroup was dragged */
4234 say "Workgroup dragged!"
4235 parse var DragCapt p_workgroup '0D0A'x .
4236 p_workgroup = strip(p_workgroup)
4237 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4238 call _UpdateObject "EF_SERVER", ""
4239 ok = VRSet("EF_SHARE","Value","")
4240
4241 ShareLevel = 3
4242 end
4243 else do
4244 ParDragCapt = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Caption")
4245 GParentRH = VRMethod(srcCtn, "GetRecordAttr", ParentRH, "Parent")
4246
4247 if GParentRH = "" then do /* A server was dragged */
4248 say "Server dragged!"
4249 parse var ParDragCapt p_workgroup '0D0A'x .
4250 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4251 p_workgroup = strip(p_workgroup)
4252
4253 parse var DragCapt p_server '0D0A'x .
4254 p_server = strip(p_server)
4255 call _UpdateObject "EF_SERVER", p_server
4256 ok = VRSet("EF_Share","Value","")
4257
4258 ShareLevel = 2
4259 end
4260 else do /* A share was dragged */
4261 say "Share dragged!"
4262 GParDragCapt = VRMethod(srcCtn, "GetRecordAttr", GParentRH, "Caption")
4263
4264 parse var GParDragCapt p_workgroup '0D0A'x .
4265 p_workgroup = strip(p_workgroup)
4266 ok = VRSet("EF_NETWORK","Value",strip(p_workgroup))
4267
4268 parse var ParDragCapt p_server '0D0A'x .
4269 p_server = strip(p_server)
4270 call _UpdateObject "EF_SERVER", p_server
4271
4272 parse var DragCapt p_share '0D0A'x .
4273 p_share = strip(p_share)
4274 ok = VRSet("EF_Share","Value",strip(p_share))
4275
4276 ShareLevel = 1
4277 end
4278 end
4279
4280 say 'p_workgroup = "'p_workgroup'"'
4281 say 'p_server = "'p_server'"'
4282 say 'p_share = "'p_share'"'
4283
4284 ok = VRSet( "CB_MOUNT", "Selected", Sharelevel )
4285 call CB_MOUNT_Change
4286
4287 if trgRec = "" then do
4288 window = VRLoadSecondary( "SW_MOUNTPOINT", "W" )
4289 if VRGet("CB_DRIVES","Value") = "" then return
4290 end
4291 else do
4292
4293 TargetString = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Caption")
4294
4295 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", trgRec, "Parent")
4296
4297 do while parTrgRH <> ""
4298 partrgCapt = VRMethod(trgCtn, "GetRecordAttr", partrgRH, "Caption")
4299 TargetString = partrgCapt||'\'||TargetString
4300 parTrgRH = VRMethod(trgCtn, "GetRecordAttr", partrgRH , "Parent")
4301 end
4302 say 'TargetString = "'TargetString'"'
4303 ok = VRSet("CB_DRIVES","Value", left(TargetString,2))
4304 ok = VRSet("EF_DIRECTORY","Value", substr(TargetString,4))
4305 end
4306
4307 window = VRLoadSecondary( "SW_LOGIN", "W" )
4308 if credentials.!entered = 1 then call PB_MOUNT_CLICK
4309
4310 if options.!debug == 1 then say time()' '||"PB_CONNECT_Click done"
4311RETURN
4312
4313/*:VRX PB_SMBTREE_HELP_Click
4314*/
4315PB_SMBTREE_HELP_Click:
4316 CALL VRMethod 'GB_SMBTREE', 'InvokeHelp'
4317return
4318
4319/*:VRX PB_SMBTREE_REFRESH_Click
4320*/
4321PB_SMBTREE_REFRESH_Click: /* PROCEDURE EXPOSE settings. options. icons. fs. samba. debuglevel advanced. UserCred Refreshmode Tempdir */
4322 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click started"
4323
4324 if advanced.!browseauth = 1 & (UserCred = "--user=%" | UserCred = "" ) then do
4325 window = VRLoadSecondary( "SW_LOGIN", "W" )
4326 end
4327
4328 call _UserCredUpdate
4329 ok = VRset("Pict_Throbber", "Visible", 1)
4330 ok = VRset("Menu_Selected_Connect", "Visible", 0)
4331 ok = VRset("TM_Throbber", "Enabled", 1)
4332 ShowHidden = advanced.!special
4333 BroadCast = advanced.!broadcast
4334 ok = VRSet("TM_RefreshTreeDisplay", "Delay", 1000)
4335 ok = time('R')
4336 call _RefreshTree
4337 if options.!debug == 1 then say time()' '||"PB_REFRESH_Click done"
4338RETURN
4339
4340/*:VRX PB_UNMOUNT_Click
4341*/
4342PB_UNMOUNT_Click: PROCEDURE EXPOSE settings. options. icons. fs. cd. samba.
4343 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click started"
4344 if options.!debug == 1 then say time()' '||'options.!editmode = 'options.!editmode
4345 CALL VRMethod "CN_CURRENT", 'GetRecordList', 'Selected', 'select.'
4346 IF select.0 < 1 THEN RETURN
4347
4348 userdata = VRMethod( "CN_CURRENT", 'GetRecordAttr', select.1, 'UserData')
4349 PARSE VAR userdata mountpoint ';' mounts ';' .
4350say 'userdata="'userdata'"'
4351 IF mounts > 0 & options.!editmode = 0 THEN DO
4352 btns.0 = 2
4353 btns.1 = NLVGetMessage( 6 )
4354 btns.2 = NLVGetMessage( 7 )
4355 confirm = VRMessage('Main', NLVGetMessage( 57, mountpoint ), NLVGetMessage( 8 ), 'Q', 'btns.', 1, 2 )
4356 IF confirm \= 1 THEN RETURN
4357 END
4358
4359 /* Unmount any resources */
4360 DO i = 1 TO mounts
4361 CALL _Dynamic "ok = "fs.!prefix"RxUnmount('"mountpoint"', "i-1")"
4362 END
4363
4364 /* Delete mountpoint */
4365 parent = VRMethod("CN_CURRENT", 'GetRecordAttr', select.1, 'Parent')
4366 IF parent \= '' THEN DO
4367 CALL _Dynamic "ok = "fs.!prefix"RxDeleteMountPoint('"mountpoint"')"
4368 END
4369
4370 CALL Refresh
4371 if options.!debug == 1 then say time()' '||"PB_UNMOUNT_Click done"
4372RETURN 0
4373
4374/*:VRX Pict_PWINMEM_Click
4375*/
4376Pict_PWINMEM_Click:
4377 if VRGet("Pict_PWINMEM","PicturePath") = "#36" then do
4378 call Menu_File_ucCred_Reset_Click
4379 end
4380return
4381
4382/*:VRX Quit
4383*/
4384Quit:
4385 if Fatal <> 1 then CALL _INISave
4386 /* ok = VRREdirectSTdio("OFF") */
4387 window = VRWindow()
4388 call VRSet window, "Shutdown", 1
4389 drop window
4390RETURN
4391
4392/*:VRX Refresh
4393*/
4394Refresh:
4395 if options.!debug == 1 then say time()' Refresh started'
4396 CALL VRSet "CN_CURRENT", 'Painting', 0
4397
4398 CALL VRMethod "CN_CURRENT", 'RemoveRecord', 'All'
4399
4400 /* Remove Active connections from details view */
4401 ok = VRMethod( "CN_CONDET", "GetRecordList", 'All', "rh." )
4402
4403 do I = 1 to rh.0
4404 /* This catches the bug we observed exactly once and were unable to reproduce! */
4405 if cd.statusfh = 'CD.STATUSFH' then do
4406 if options.!debug == 1 then call beep 880, 50
4407 if options.!debug == 1 then call beep 880, 50
4408 if options.!debug == 1 then say " cd.statusfh is undefined - check why!!!!!!"
4409 leave
4410 end
4411 if options.!debug == 1 then say ' Icon.'i' = "'||VRMethod( "CN_CONDET", "GetFieldData", rh.i, cd.statusfh)'"'
4412 if VRMethod("CN_CONDET","GetFieldData", rh.i, cd.statusfh) = icons.!active then CALL VRMethod "CN_CONDET", 'RemoveRecord', rh.i
4413 end
4414
4415/* call _AddTemplates */
4416 CALL VRSet "PB_DETACH", "Enabled", 0
4417 CALL VRSet "PB_UNMOUNT", "Enabled", 0
4418
4419 ok = VRSet("MENU_CONTEXT_OPEN", "Visible", 0)
4420/* ok = VRSet("MENU_CONTEXT_SEP1", "Visible", 0) */
4421 ok = VRSet("MENU_CONTEXT_DETACH", "Visible", 0)
4422 ok = VRSet("MENU_CONTEXT_UNMOUNT", "Visible", 0)
4423 ok = VRSet("MENU_CONTEXT_EDIT", "Visible", 0)
4424
4425 ok = VRSet("MENU_SELECTED_REMOVE", "Visible", 0)
4426 ok = VRSet("MENU_SELECTED_RETRY", "Visible", 0)
4427
4428 if options.!debug == 1 then say ' Remove records, disable buttons done.'
4429
4430 CALL VRMethod 'CB_DRIVES', 'Clear'
4431
4432 CALL VRSet "CN_CURRENT", "Caption", fs.!Name' 'fs.!version
4433
4434 /* Herwig B.: Attention! The SysDrivemap function with the "free" parameter causes hangs in case it is called repeatedly! */
4435 drvs = MyFreeDriveMap('C:', 'FREE')
4436
4437 DO i = 1 TO WORDS( drvs )
4438 drvstem.i = WORD( drvs, i )
4439 END
4440
4441 drvstem.0 = WORDS( drvs )
4442
4443 /* Add any existing EVFS drives */
4444 CALL GetMountPoints
4445
4446 CALL VRMethod "CB_DRIVES", "AddStringList", "drvstem."
4447 CALL VRSet "CN_CURRENT", 'Painting', 1
4448 if options.!debug == 1 then say time()' '||"Refresh done"
4449RETURN 0
4450
4451/*:VRX SPIN_NRO1_Change
4452*/
4453SPIN_NRO1_Change:
4454 advanced.!smbconfchanged = 1
4455return
4456
4457/*:VRX SPIN_NRO2_Change
4458*/
4459SPIN_NRO2_Change:
4460 advanced.!smbconfchanged = 1
4461return
4462
4463/*:VRX SPIN_NRO3_Change
4464*/
4465SPIN_NRO3_Change:
4466 advanced.!smbconfchanged = 1
4467return
4468
4469/*:VRX SPIN_NRO4_Change
4470*/
4471SPIN_NRO4_Change:
4472 advanced.!smbconfchanged = 1
4473return
4474
4475/*:VRX SPLIT_Main_Move
4476*/
4477SPLIT_Main_Move:
4478 ok = VRset("Main", "Painting", 0)
4479 NewPos = VRInfo("Left")
4480 OldPos = VRGet("SPLIT_Main","Left")
4481 ok = VRSet("SPLIT_Main","Left", NewPos)
4482 ok = VRset("GB_SMBTREE","Left", NewPos+60)
4483 call Main_Resize
4484 ok = VRset("Main", "Painting", 1)
4485return
4486
4487/*:VRX SW_ABOUT_Close
4488*/
4489SW_ABOUT_Close:
4490 call SW_ABOUT_Fini
4491return
4492
4493/*:VRX SW_ABOUT_Create
4494*/
4495SW_ABOUT_Create:
4496 call SW_ABOUT_Init
4497
4498 CALL NLVSetText 'SW_ABOUT', "Caption", 1
4499 CALL NLVSetText 'PB_ABOUT_CLOSE', "Caption", 29
4500 CALL NLVSetText 'PB_ABOUT_COPY', "Caption", 121
4501 CALL NLVSetText 'CB_TRAC', "Caption", 134
4502
4503 ok = VRSet("DT_About","Caption", Program' (c) 2007-2013 Alexander Taylor'||'0D0A'x||'and Herwig Bauernfeind for bww bitwise works GmbH.')
4504
4505 About.DscFH = VRMethod( "CN_ABOUT", "AddField", "String", "Component" )
4506 About.ValFH = VRMethod( "CN_ABOUT", "AddField", "String", "Version" )
4507
4508 call _AboutSambaClientGetInfo
4509
4510return
4511/*:VRX SW_ABOUT_Fini
4512*/
4513SW_ABOUT_Fini:
4514 window = VRInfo( "Window" )
4515 call VRDestroy window
4516 drop window
4517return
4518/*:VRX SW_ABOUT_Init
4519*/
4520SW_ABOUT_Init:
4521 window = VRInfo( "Object" )
4522 if( \VRIsChildOf( window, "Notebook" ) ) then do
4523 call VRMethod window, "CenterWindow"
4524 call VRSet window, "Visible", 1
4525 call VRMethod window, "Activate"
4526 end
4527 drop window
4528return
4529
4530/*:VRX SW_ADVANCED_Close
4531*/
4532SW_ADVANCED_Close:
4533 call SW_ADVANCED_Fini
4534return
4535
4536/*:VRX SW_ADVANCED_Create
4537*/
4538SW_ADVANCED_Create:
4539 call SW_ADVANCED_Init
4540return
4541
4542/*:VRX SW_ADVANCED_Fini
4543*/
4544SW_ADVANCED_Fini:
4545 window = VRInfo( "Window" )
4546 call VRDestroy window
4547 drop window
4548return
4549/*:VRX SW_ADVANCED_Init
4550*/
4551SW_ADVANCED_Init:
4552 /* Title bar */
4553 CALL NLVSetText "SW_ADVANCED", "Caption", 40
4554
4555 /* Options */
4556 CALL NLVSetText "GB_ADVANCED", "Caption", 43
4557 CALL NLVSetText "CB_EAS", "Caption", 44
4558 CALL NLVSetText "CB_READONLY", "Caption", 45
4559 CALL NLVSetText "CB_ALWAYSMP", "Caption", 65
4560 CALL NLVSetText "DT_CACHETIMEOUT", "Caption", 130
4561 CALL NLVSetText "DT_CACHELISTINGS", "Caption", 131
4562
4563 /* Buttons */
4564 CALL NLVSetText "PB_ADVANCED_APPLY", "Caption", 122
4565 CALL NLVSetText "PB_ADVANCED_UNDO", "Caption", 123
4566 CALL NLVSetText "PB_ADVANCED_HELP", "Caption", 4
4567
4568 CALL VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40)
4569
4570/* call VRMethod "SW_ADVANCED", "CenterWindow" */
4571 ok = VRSet("SW_ADVANCED", "Visible", 1)
4572/* call VRMethod "SW_ADVANCED", "Activate" */
4573return
4574
4575/*:VRX SW_ADVANCED_Init_Content
4576*/
4577SW_ADVANCED_Init_Content:
4578 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS", "Set", advanced.!easupport)
4579 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY","Set", advanced.!readonly)
4580 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP","Set", advanced.!alwaysmp)
4581 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT", "Value", advanced.!cachetimeout)
4582 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS", "Value", advanced.!cachelistings)
4583
4584 /* Obsolete */
4585 IF advanced.!memlen \= "" THEN ok = VRSet("SPB_MEMLEN", "Value", advanced.!memlen)
4586return
4587
4588/*:VRX SW_CONDET_Close
4589*/
4590SW_CONDET_Close:
4591 call SW_CONDET_Fini
4592return
4593
4594/*:VRX SW_CONDET_Create
4595*/
4596SW_CONDET_Create:
4597 call SW_CONDET_Init
4598return
4599
4600/*:VRX SW_CONDET_Fini
4601*/
4602SW_CONDET_Fini:
4603 window = VRInfo( "Window" )
4604 call VRDestroy window
4605 drop window
4606return
4607/*:VRX SW_CONDET_Init
4608*/
4609SW_CONDET_Init:
4610
4611return
4612
4613/*:VRX SW_CONDET_Init_Content
4614*/
4615SW_CONDET_Init_Content:
4616 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4617
4618 /* Hide any "foreign" menu entries */
4619 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4620return
4621
4622/*:VRX SW_DIALOG_Close
4623*/
4624SW_DIALOG_Close:
4625 call SW_DIALOG_Fini
4626return
4627
4628/*:VRX SW_DIALOG_Create
4629*/
4630SW_DIALOG_Create:
4631 call SW_DIALOG_Init
4632return
4633
4634/*:VRX SW_DIALOG_Fini
4635*/
4636SW_DIALOG_Fini:
4637 window = VRInfo( "Window" )
4638 call VRDestroy window
4639 drop window
4640return
4641/*:VRX SW_DIALOG_Init
4642*/
4643SW_DIALOG_Init:
4644 LEDSize = VRMethod( "Screen", "PixelsToTwips", 16 )
4645
4646 ok = VRSet("Pict_PWINMEM","Top", VRGet("EF_USER","Top")+(VRGet("EF_USER","Height")-LEDSize)%2)
4647 ok = VRSet("Pict_PWINMEM","Width", LEDSize)
4648 ok = VRSet("Pict_PWINMEM","Height", LEDSize)
4649return
4650
4651/*:VRX SW_DIALOG_Init_Content
4652*/
4653SW_DIALOG_Init_Content:
4654 /* obsolete */
4655 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 0)
4656
4657 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
4658 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
4659 ok = VRSet("Menu_Selected_Connect", "Visible", 0)
4660
4661 call _DialogPopulate
4662return
4663
4664/*:VRX SW_INFO_Close
4665*/
4666SW_INFO_Close:
4667 call SW_INFO_Fini
4668return
4669
4670/*:VRX SW_INFO_Create
4671*/
4672SW_INFO_Create:
4673 if options.!debug == 1 then say time()' SW_INFO_Create started'
4674 call SW_INFO_Init
4675 CALL NLVSetText 'SW_INFO', "Caption", 92
4676 CALL NLVSetText 'PB_INFO_OK', "Caption", 2
4677 Info.TypeFH = VRMethod( "CN_INFO", "AddField", "String", "Type" )
4678 Info.ValueFH = VRMethod( "CN_INFO", "AddField", "String", "Value" )
4679
4680 if options.!debug == 1 then do
4681 say ' Handle: "'SMBObj.rh'"'
4682 say ' Resource: "'SMBObj.resname'"'
4683 say ' Comment: "'SMBObj.comment'"'
4684 say ' Type: "'SMBObj.udatatype'"'
4685 say ' Message: "'SMBObj.udatamsg'"'
4686 say ' Icon: "'SMBObj.icon'"'
4687 end
4688say "Vorher:"rpc.srvinfo.OS_VERSION
4689 drop rpc.
4690say "Vorher:"rpc.srvinfo.OS_VERSION
4691 rpc_success = _rpcsrvinfo(SMBObj.resname,credentials.!username,credentials.!password)
4692
4693 Info.!nbname = VRMethod( "CN_INFO", "AddRecord")
4694 Info.!comment = VRMethod( "CN_INFO", "AddRecord")
4695 Info.!domain = VRMethod( "CN_INFO", "AddRecord")
4696 Info.!DMBLMB = VRMethod( "CN_INFO", "AddRecord")
4697 if rpc_success = 1 then Info.!capabilities = VRMethod( "CN_INFO", "AddRecord")
4698 Info.!os = VRMethod( "CN_INFO", "AddRecord")
4699 Info.!server = VRMethod( "CN_INFO", "AddRecord")
4700 if rpc_success = 1 then Info.!version = VRMethod( "CN_INFO", "AddRecord")
4701 Info.!status = VRMethod( "CN_INFO", "AddRecord")
4702 Info.!IP = VRMethod( "CN_INFO", "AddRecord")
4703 Info.!MAC = VRMethod( "CN_INFO", "AddRecord")
4704
4705 if rpc_success = 1 then do
4706 if rpc.srvinfo.OS_VERSION = 'RPC.SRVINFO.OS_VERSION' then rpc.srvinfo.OS_VERSION = ''
4707 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, rpc.srvinfo.NETBIOSNAME)
4708 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, rpc.srvinfo.SERVERSTRING)
4709 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!capabilities, Info.TypeFH, strip(NLVGetMessage(138),'T',':'),Info.ValueFH, rpc.srvinfo.CAPABILITIES)
4710 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!version,Info.TypeFH, strip(NLVGetMessage(139),'T',':'),Info.ValueFH, rpc.srvinfo.OS_VERSION)
4711 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'),Info.ValueFH, rpc.srvinfo.LOGONSTATUS )
4712 /* we did not get these, but we know them anyway */
4713 if rpc.srvinfo.NETBIOSNAME = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
4714 if rpc.srvinfo.SERVERSTRING = "" then ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
4715 end
4716 else do
4717 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!nbname, Info.TypeFH, strip(NLVGetMessage(137),'T',':'),Info.ValueFH, SMBObj.resname)
4718 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!comment,Info.TypeFH, strip(NLVGetMessage(125),'T',':'),Info.ValueFH, SMBObj.comment)
4719 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!status, Info.TypeFH, strip(NLVGetMessage(67),'T',':'), Info.ValueFH, SMBObj.udatamsg)
4720 end
4721
4722 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!domain, Info.TypeFH, strip(NLVGetMessage(21), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, WorkGroupFH ))
4723 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!os, Info.TypeFH, strip(NLVGetMessage(93), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, OSFH ))
4724 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!server, Info.TypeFH, strip(NLVGetMessage(19), 'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, VersionFH ))
4725 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!DMBLMB, Info.TypeFH, strip(NLVGetMessage(124),'T',':'),Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MBFH ))
4726 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!IP, Info.TypeFH, "IP" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, IPFH ))
4727 ok = VRMethod( "CN_INFO", "SetFieldData", Info.!MAC, Info.TypeFH, "MAC" ,Info.ValueFH, VRMethod("CN_SMBTREE", "GetFieldData", SMBObj.RH, MacFH ))
4728
4729 if options.!debug == 1 then say time()' SW_INFO_Create done'
4730return
4731
4732/*:VRX SW_INFO_Fini
4733*/
4734SW_INFO_Fini:
4735 window = VRInfo( "Window" )
4736 call VRDestroy window
4737 drop window
4738return
4739/*:VRX SW_INFO_Init
4740*/
4741SW_INFO_Init:
4742 window = VRInfo( "Object" )
4743 if( \VRIsChildOf( window, "Notebook" ) ) then do
4744 call VRMethod window, "CenterWindow"
4745 call VRSet window, "Visible", 1
4746 call VRMethod window, "Activate"
4747 end
4748 drop window
4749return
4750
4751/*:VRX SW_LOGIN_Close
4752*/
4753SW_LOGIN_Close:
4754 call SW_LOGIN_Fini
4755return
4756
4757/*:VRX SW_LOGIN_Create
4758*/
4759SW_LOGIN_Create:
4760 call SW_LOGIN_Init
4761 ok = VRSet("SW_LOGIN","Caption",NLVGetMessage(136)' 'strip(p_workgroup' \\'p_server'\'p_share,'T','\'))
4762 CALL NLVSetText 'DT_USER1', "Caption", 25
4763 CALL NLVSetText 'DT_PASSWORD1', "Caption", 26
4764 CALL NLVSetText 'CB_STORECREDS1', "Caption", 135
4765 CALL NLVSetText 'PB_LOGIN_OK', "Caption", 2
4766 CALL NLVSetText 'PB_LOGIN_CANCEL',"Caption", 3
4767
4768 if VRIsValidObject(SMBObj.rh) then do
4769 select
4770 when pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.rh, MBFH)) > 0 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4771 when SMBObj.udatatype = "WORKGROUP" then LoginIcon = SMBObj.Icon
4772 when SMBObj.udatatype = "SERVER" then LoginIcon = SMBObj.Icon
4773 when SMBObj.udatatype = "DISK" then do
4774 if pos("PDC",VRMethod("CN_smbtree", "GetFieldData", SMBObj.parentrh, MBFH)) > 0
4775 then LoginIcon = "#63:PMWP.DLL" /* icons.!pdc */
4776 else LoginIcon = "#35:PMWP.DLL" /* icons.!pdc */
4777 end
4778 otherwise LoginIcon = "#35:PMWP.DLL" /* icons.!machine_awake */
4779 end
4780 say loginicon
4781 ok = VRSet("Pict_Login","PicturePath", LoginIcon)
4782 end
4783 ok = VRSet("EF_USER1","Value",VRGet("EF_USER","Value"))
4784 ok = VRSet("EF_PASSWORD1","Value",VRGet("EF_PASSWORD","Value"))
4785 ok = VRSet("CB_STORECREDS1","Set",options.!storecreds)
4786return
4787
4788/*:VRX SW_LOGIN_Fini
4789*/
4790SW_LOGIN_Fini:
4791 window = VRInfo( "Window" )
4792 call VRDestroy window
4793 drop window
4794return
4795/*:VRX SW_LOGIN_Init
4796*/
4797SW_LOGIN_Init:
4798 window = VRInfo( "Object" )
4799 if( \VRIsChildOf( window, "Notebook" ) ) then do
4800 call VRMethod window, "CenterWindow"
4801 call VRSet window, "Visible", 1
4802 call VRMethod window, "Activate"
4803 end
4804 drop window
4805return
4806
4807/*:VRX SW_LOGIN_KeyPress
4808*/
4809SW_LOGIN_KeyPress:
4810 obj = VRInfo( "Object" )
4811 keystr = VRGet( obj, "KeyString" )
4812/* say keystr */
4813 select
4814 when keystr = "{Enter}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4815 when keystr = "{Newline}" then ok = VRMethod( "EF_LoginPassword", "SetFocus" )
4816 when keystr = "{Esc}" then call PB_LOGIN_CANCEL_Click
4817 otherwise nop
4818 end
4819return
4820
4821/*:VRX SW_MOUNTPOINT_Close
4822*/
4823SW_MOUNTPOINT_Close:
4824 call SW_MOUNTPOINT_Fini
4825return
4826
4827/*:VRX SW_MOUNTPOINT_Create
4828*/
4829SW_MOUNTPOINT_Create:
4830 call SW_MOUNTPOINT_Init
4831
4832 ok = VRSet("SW_MOUNTPOINT","Caption",strip(p_workgroup' \\'p_server'\'p_share,'T','\')) /* NLVGetMessage(14)' ' */
4833 CALL NLVSetText 'DT_MPOINT1', "Caption", 27
4834 CALL NLVSetText 'PB_NEWMOUNTPOINTOK', "Caption", 2
4835 CALL NLVSetText 'PB_NEWMOUNTPOINTCANCEL',"Caption", 3
4836 CALL NLVSetText 'CB_EAS1', "Caption", 44
4837 CALL NLVSetText 'CB_READONLY1', "Caption", 45
4838 CALL NLVSetText 'CB_ALWAYSMP1', "Caption", 65
4839 CALL NLVSetText "DT_CACHETIMEOUT1", "Caption", 130
4840 CALL NLVSetText "DT_CACHELISTINGS1", "Caption", 131
4841
4842 ok = VRMethod( "CB_DRIVES", "GetStringList", "freedrives." )
4843 ok = VRMethod( "CB_DRIVES1", "AddStringList", "freedrives." )
4844 ok = VRSet("CB_DRIVES1", "Value", VRGet("CB_Drives","Value"))
4845
4846 if VRGet("EF_Directory","Value") = "" then ok = VRSet("EF_DIRECTORY1", "Value", VRGet("EF_Directory","Value"))
4847
4848 ok = VRMethod("EF_DIRECTORY1","AddString",p_share)
4849
4850 IF advanced.!easupport \= "" THEN ok = VRSet("CB_EAS1", "Set", advanced.!easupport)
4851 IF advanced.!readonly \= "" THEN ok = VRSet("CB_READONLY1", "Set", advanced.!readonly)
4852 IF advanced.!alwaysmp \= "" THEN ok = VRSet("CB_ALWAYSMP1", "Set", advanced.!alwaysmp)
4853 IF advanced.!cachetimeout \= "" THEN ok = VRSet("SPIN_CACHETIMEOUT1", "Value", advanced.!cachetimeout)
4854 IF advanced.!cachelistings \= "" THEN ok = VRSet("SPIN_CACHELISTINGS1","Value", advanced.!cachelistings)
4855return
4856
4857/*:VRX SW_MOUNTPOINT_Fini
4858*/
4859SW_MOUNTPOINT_Fini:
4860 window = VRInfo( "Window" )
4861 call VRDestroy window
4862 drop window
4863return
4864/*:VRX SW_MOUNTPOINT_Init
4865*/
4866SW_MOUNTPOINT_Init:
4867 window = VRInfo( "Object" )
4868 if( \VRIsChildOf( window, "Notebook" ) ) then do
4869 call VRMethod window, "CenterWindow"
4870 call VRSet window, "Visible", 1
4871 call VRMethod window, "Activate"
4872 end
4873 drop window
4874return
4875
4876/*:VRX SW_PORTCONNECT_Close
4877*/
4878SW_PORTCONNECT_Close:
4879 call SW_PORTCONNECT_Fini
4880return
4881
4882/*:VRX SW_PORTCONNECT_Create
4883*/
4884SW_PORTCONNECT_Create:
4885 call SW_PORTCONNECT_Init
4886
4887 ok = VRGetINI("PM_PORT_DRIVER","SMB","SYSTEM")
4888
4889 if ok = "" then do
4890
4891 end
4892 else do
4893 say "Samba Spooler Port driver installed!"
4894 ok = SysINI("SYSTEM","PM_SPOOLER_PORT","ALL:","ports")
4895 smbport.0 = 0
4896 do I = 1 to ports.0
4897 if left(ports.I,3) = "SMB" then do
4898 X = smbport.0
4899 X = X + 1
4900 smbport.0 = X
4901 smbport.X = ports.I
4902 end
4903 end
4904 do I = 1 to smbport.0
4905 say smbport.I
4906 end
4907 end
4908
4909return
4910
4911/*:VRX SW_PORTCONNECT_Fini
4912*/
4913SW_PORTCONNECT_Fini:
4914 window = VRInfo( "Window" )
4915 call VRDestroy window
4916 drop window
4917return
4918/*:VRX SW_PORTCONNECT_Init
4919*/
4920SW_PORTCONNECT_Init:
4921 window = VRInfo( "Object" )
4922 if( \VRIsChildOf( window, "Notebook" ) ) then do
4923 call VRMethod window, "CenterWindow"
4924 call VRSet window, "Visible", 1
4925 call VRMethod window, "Activate"
4926 end
4927 drop window
4928return
4929
4930/*:VRX SW_PROGRESS_Close
4931*/
4932SW_PROGRESS_Close:
4933 options.!delay = 0
4934 call Main_Resize
4935 call VRSet 'Main', 'Visible', 1
4936 call SW_PROGRESS_Fini
4937return
4938
4939/*:VRX SW_PROGRESS_Create
4940*/
4941SW_PROGRESS_Create:
4942 call SW_PROGRESS_Init
4943 CALL NLVSetText 'SW_PROGRESS', "Caption", 1
4944 CALL NLVSetText 'DT_PROGRESS', "Caption", 34
4945 CALL NLVSetText 'PB_PROGRESS_ABORT', "Caption", 3
4946
4947 if options.!delay > 0 then ok = VRSet("TM_TheCloser","Delay", options.!delay*1000)
4948
4949 CALL VRSet "TM_Progress_Throbber","Enabled", 1
4950 CALL VRSet "TM_TheCloser","Enabled", 1
4951return
4952
4953/*:VRX SW_PROGRESS_Fini
4954*/
4955SW_PROGRESS_Fini:
4956 call VRDestroy "SW_PROGRESS"
4957return
4958/*:VRX SW_PROGRESS_Init
4959*/
4960SW_PROGRESS_Init:
4961 call VRMethod "SW_PROGRESS", "CenterWindow", "Parent"
4962 call VRSet "SW_PROGRESS", "Visible", 1
4963 call VRMethod "SW_PROGRESS", "Activate"
4964return
4965
4966/*:VRX SW_SETTINGS_Close
4967*/
4968SW_SETTINGS_Close:
4969 call SW_SETTINGS_Fini
4970return
4971
4972/*:VRX SW_SETTINGS_Create
4973*/
4974SW_SETTINGS_Create:
4975 call SW_SETTINGS_Init
4976return
4977
4978/*:VRX SW_SETTINGS_Fini
4979*/
4980SW_SETTINGS_Fini:
4981 window = VRInfo( "Window" )
4982 call VRDestroy window
4983 drop window
4984return
4985/*:VRX SW_SETTINGS_Init
4986*/
4987SW_SETTINGS_Init:
4988 /* Title bar */
4989 call NLVSetText "SW_SETTINGS", "Caption", 47
4990
4991 /* Options */
4992 call NLVSetText "GB_GLOBAL", "Caption", 47
4993 call NLVSetText "CB_DEBUG", "Caption", 42
4994 call NLVSetText "CB_LOGGING", "Caption", 46
4995 call NLVSetText "CB_BROWSEIMME", "Caption", 48
4996 call NLVSetText "CB_BROWSEAUTH", "Caption", 49
4997 call NLVSetText "CB_SPECIAL", "Caption", 66
4998 call NLVSetText "CB_SAVEPASSIVE", "Caption", 73
4999 call NLVSetText "CB_LMHOSTS", "Caption", 133
5000 call NLVSetText "CB_BROADCAST", "Caption", 74
5001 call NLVSetText "CB_MINIICONS", "Caption", 70
5002 call NLVSetText "CB_STORECREDS", "Caption", 135
5003
5004 /* Buttons */
5005 call NLVSetText "PB_SETTINGS_APPLY", "Caption", 122
5006 call NLVSetText "PB_SETTINGS_UNDO", "Caption", 123
5007 call NLVSetText "PB_SETTINGS_HELP", "Caption", 4
5008
5009/* call VRSet "SW_ADVANCED", "HelpTag", NLVGetMessage(40) */
5010
5011/* call VRMethod "SW_SETTINGS", "CenterWindow" */
5012 ok = VRSet("SW_SETTINGS", "Visible", 1)
5013/* call VRMethod "SW_SETTINGS", "Activate" */
5014return
5015
5016/*:VRX SW_SETTINGS_Init_Content
5017*/
5018SW_SETTINGS_Init_Content:
5019 ok = VRSet("PB_SETTINGS_UNDO","Enabled", 1)
5020
5021 if advanced.!browseauth \= "" then ok = VRSet("CB_BROWSEAUTH", "Set", advanced.!browseauth)
5022 if advanced.!browseimme \= "" then ok = VRSet("CB_BROWSEIMME", "Set", advanced.!browseimme)
5023 if advanced.!broadcast \= "" then ok = VRSet("CB_BROADCAST", "Set", advanced.!broadcast)
5024 if advanced.!special \= "" then ok = VRSet("CB_SPECIAL", "Set", advanced.!special)
5025 if advanced.!savepassive \= "" then ok = VRSet("CB_SAVEPASSIVE","Set", advanced.!savepassive)
5026 if advanced.!lmhosts \= "" then ok = VRSet("CB_LMHOSTS", "Set", advanced.!lmhosts)
5027
5028 call VRSet "CB_LOGGING", "Set", VRFileExists(SysBootDrive()"\ndpsmb.dbg")
5029 if options.!debug \= "" then ok = VRSet("CB_debug", "Set", options.!debug)
5030 if options.!storecreds \= "" then ok = VRSet("CB_STORECREDS", "Set", options.!storecreds)
5031
5032 if advanced.!miniicons \= "" then ok = VRSet("CB_MINIICONS", "Set", advanced.!miniicons)
5033
5034 /* Obsolete */
5035 if advanced.!logfile \= "" then ok = VRSet("EF_LOGFILE", "Value", advanced.!logfile)
5036 if advanced.!loglevel \= "0" then ok = VRSet("SPIN_LOGLEVEL", "Value", advanced.!loglevel)
5037
5038 call _SmbConfCreateShadowCopy
5039
5040 wins_support = translate(IniGet('wins support', 'global', samba.!shadowsmbconf))
5041
5042 if wins_support = "YES" then do /* we are a WINS server ourself */
5043 ok = VRSet("DT_WINS_SERVER","Enabled", 0)
5044 ok = VRSet("EF_WINS_SERVER","BackColor", "PaleGray")
5045 ok = VRSet("EF_WINS_SERVER","Value", "")
5046 ok = VRSet("EF_WINS_SERVER","Enabled", 0)
5047 end
5048 else do
5049 ok = VRSet("EF_WINS_SERVER","Value", IniGet('wins server', 'global', samba.!shadowsmbconf))
5050 end
5051
5052 name_resolve_order = IniGet('name resolve order', 'global', samba.!shadowsmbconf)
5053
5054 do I = 1 to words(name_resolve_order)
5055 ok = VRSet("SPIN_NRO"||I, "value", word(name_resolve_order,I))
5056 end
5057
5058 advanced.!smbconfchanged = 0
5059return
5060
5061/*:VRX SW_SMBTREE_Close
5062*/
5063SW_SMBTREE_Close:
5064 call SW_SMBTREE_Fini
5065return
5066
5067/*:VRX SW_SMBTREE_Create
5068*/
5069SW_SMBTREE_Create:
5070 call SW_SMBTREE_Init
5071return
5072
5073/*:VRX SW_SMBTREE_Fini
5074*/
5075SW_SMBTREE_Fini:
5076 window = VRInfo( "Window" )
5077 call VRDestroy window
5078 drop window
5079return
5080/*:VRX SW_SMBTREE_Init
5081*/
5082SW_SMBTREE_Init:
5083
5084return
5085
5086/*:VRX SW_SMBTREE_Init_Content
5087*/
5088SW_SMBTREE_Init_Content:
5089 if VRGet("TM_Throbber","Enabled") = 1 then ok = VRset("Pict_Throbber", "Visible", 1)
5090
5091 /* Hide any "foreign" menu entries */
5092 ok = VRSet("Menu_Selected_Remove", "Visible", 0)
5093 ok = VRSet("Menu_Selected_Retry", "Visible", 0)
5094return
5095
5096/*:VRX TDL_1_PageSelected
5097*/
5098TDL_1_PageSelected:
5099 page = VRInfo("Page")
5100
5101 /* call _TabsStrip */
5102 select
5103 when page = 1 then do /* dialog */
5104 call _TabFix 1
5105 end
5106 when page = 2 then do /* advanced */
5107 call SW_ADVANCED_Init_Content
5108 end
5109 when page = 3 then do /* smbtree */
5110 call SW_SMBTREE_Init_Content
5111 end
5112 when page = 4 then do /* condet */
5113 call SW_CONDET_Init_Content
5114 end
5115 when page = 5 then do /* Settings */
5116 call SW_SETTINGS_Init_Content
5117 end
5118 otherwise nop
5119 end
5120return
5121
5122/*:VRX TM_AutoClose_Trigger
5123*/
5124TM_AutoClose_Trigger:
5125 call Quit
5126return
5127
5128/*:VRX TM_Progress_Throbber_Trigger
5129*/
5130TM_Progress_Throbber_Trigger:
5131 pIdx = VRGet("Pict_Progress_Throbber","PicturePath")
5132 parse var pIdx '#' pidx
5133 pidx = pidx + 1
5134 if pidx = 36 then pidx = 11
5135 ok = VRSet("Pict_Progress_Throbber","PicturePath","#"pidx)
5136return
5137
5138/*:VRX TM_RefreshCurrentDisplay_Trigger
5139*/
5140TM_RefreshCurrentDisplay_Trigger:
5141 if RefreshMode <> "" then return
5142 if _DaemonRunning() = 0 then do
5143 say " Daemon not running - disable GUI"
5144 ok = VRset("GB_CURRENT", "Enabled", 0)
5145 ok = VRset("TDL_1", "Enabled", 0)
5146 ok = VRSet("Menu_File_Daemon_Start","Enabled", 1)
5147 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 0)
5148 end
5149 else do
5150 say " Daemon running - enable GUI"
5151 ok = VRset("GB_CURRENT", "Enabled", 1)
5152 ok = VRset("TDL_1", "Enabled", 1)
5153 ok = VRSet("Menu_File_Daemon_Start","Enabled", 0)
5154 ok = VRSet("Menu_File_Daemon_Stop", "Enabled", 1)
5155 end
5156 CALL REFRESH
5157return
5158
5159/*:VRX TM_RefreshTreeDisplay_Trigger
5160*/
5161TM_RefreshTreeDisplay_Trigger:
5162 ShowHidden = advanced.!special
5163 BroadCast = advanced.!broadcast
5164 DoLMHosts = advanced.!lmhosts
5165
5166 select
5167 when RefreshMode = "TREE" then do
5168 call _RefreshTreeDisplay
5169
5170 if smbtree.!workgroup <> 'SMBTREE.!WORKGROUP' then do
5171 ok = VRset("Menu_Selected_Connect", "Visible", VRMethod("CN_SMBTREE", "ValidateRecord", smbtree.!workgroup ) )
5172 end
5173 end
5174 when RefreshMode = "SHARE" then do
5175 call _AddSharesDisplay
5176 end
5177 otherwise say "RefreshMode = "RefreshMode
5178 end
5179 call _DialogPopulate
5180return
5181
5182/*:VRX TM_TheCloser_Trigger
5183*/
5184TM_TheCloser_Trigger:
5185 call SW_PROGRESS_Close
5186return
5187
5188/*:VRX TM_Throbber_Trigger
5189*/
5190TM_Throbber_Trigger:
5191 pIdx = VRGet("Pict_Throbber","PicturePath")
5192 parse var pIdx '#' pidx
5193 pidx = pidx + 1
5194 if pidx = 36 then pidx = 11
5195 ok = VRSet("Pict_Throbber","PicturePath","#"pidx)
5196return
5197
Note: See TracBrowser for help on using the repository browser.