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

Last change on this file since 651 was 643, checked in by Herwig Bauernfeind, 14 years ago

GUI-Tools: EVFSGUI 2.5.x: More work done

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