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

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

GUI-Tools: EVFSGUI 2.5, SMBMON 2.5 yet another place to fix Ticket #202

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