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

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

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

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