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

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

GUI-Tools: EVFSGUI 2.5 remove double % in user credential string for now, some polishing

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