Ignore:
Timestamp:
Jun 7, 2017, 5:17:03 PM (8 years ago)
Author:
Herwig Bauernfeind
Message:

Move browsing code to browse.vrs, add colors to smbtree.vrs statusbar messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/guitools/shared/smbtree.vrs

    r1023 r1030  
    2323    say time()' _RefreshTree() started'
    2424    FirstRun = 0
    25     if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", " Refreshing network")
     25    call _StatusBarWrapper "Refreshing network"
    2626    ok = SysFileDelete(samba.!msg)
    2727    parse var debuglevel .'='level
     
    7272    if errstat = "READY:" then do
    7373        if file2stem(samba.!error,"treeError.") > 1 then do
    74             ok = VRSet("DT_STATUSBAR","Caption", " "||treeError.2)
     74            call _StatusBarWrapper treeError.2
    7575        end
    7676    end
     
    7878    stat = stream(samba.!serverlist,'c','open read')
    7979    if stat <> "READY:" then do
    80         if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
     80        call _StatusBarWrapper '+.'
    8181        return
    8282    end
     
    280280    do I = 1 to smbmachine.0
    281281        call charout , '  Going for "'smbmachine.I'", got '
    282         if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
     282        call _StatusBarWrapper '+.'
    283283        stat = stream(smbmachine.I,'c','open read')
    284284        say '  Try to open "'smbmachine.I'" for reading: "'stat'"'
     
    476476    if UserCred = '-N' then UserCred = ''
    477477
    478     if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", " Ready.")
     478    call _StatusBarWrapper "Ready."
    479479    say time()' _AddSharesDisplay() loop end'
    480480return
     
    519519    address cmd 'detach 'samba.!smbtreeexe' 'BroadCast' -D 'UserCred' 'debuglevel' >'samba.!msg
    520520
    521     if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption"," Enumerating workgroups")
     521    call _StatusBarWrapper "Enumerating workgroups"
    522522    do while stream(samba.!msg,'c','open read') <> "READY:"
    523523        ok = SysSleep(1)
    524         if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
     524        call _StatusBarWrapper '+.'
    525525    end
    526526    call VRSet VRWindow(), 'Pointer', '<default>'
     
    581581    address cmd 'detach 'samba.!nmblookupexe' 'machine' 'debuglevel' >'samba.!msg
    582582
    583     if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption"," Obtaining IP from "machine)
     583    call _StatusBarWrapper "Obtaining IP from "machine
    584584    do while stream(samba.!msg,'c','open read') <> "READY:"
    585585        ok = SysSleep(0.33)
    586         if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
     586        call _StatusBarWrapper '+.'
    587587    end
    588588    call VRSet VRWindow(), 'Pointer', '<default>'
     
    608608    address cmd 'detach 'samba.!nmblookupexe' -A 'machine' 'debuglevel' >'samba.!msg
    609609
    610     if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption"," Obtaining capabilities from "machine)
     610    call _StatusBarWrapper "Obtaining capabilities from "machine
    611611    do while stream(samba.!msg,'c','open read') <> "READY:"
    612612        ok = SysSleep(0.33)
    613         if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
     613        call _StatusBarWrapper '+.'
    614614    end
    615615    call VRSet VRWindow(), 'Pointer', '<default>'
     
    643643    address cmd 'detach 'samba.!nmblookupexe' -S 'machine' 'debuglevel' >'samba.!msg
    644644
    645     if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption"," Querying "machine" for roles")
     645    call _StatusBarWrapper "Querying "machine" for roles"
    646646    do while stream(samba.!msg,'c','open read') <> "READY:"
    647647        ok = SysSleep(0.33)
    648         if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
     648        call _StatusBarWrapper '+.'
    649649    end
    650650    call VRSet VRWindow(), 'Pointer', '<default>'
     
    723723    say time()' file2stem() ['stemcount' added, 'skipped' skipped] done'   
    724724return stemcount
     725
     726_StatusBarWrapper:
     727    StatusWText = arg(1)
     728    if VRIsValidObject("DT_STATUSBAR") then do
     729        if left(StatusWText,1) = "+" then do
     730            ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||substr(StatusWText,2))
     731        end
     732        else do
     733            ok = VRSet("DT_STATUSBAR","Caption", " "||StatusWText)
     734
     735            if VRIsValidObject("TM_STATUSBAR") then do
     736                ok = VRSet("TM_STATUSBAR","DELAY", 4000)
     737                ok = VRSet("TM_STATUSBAR","Enabled", 1)
     738                trStWT = translate(StatusWText)
     739                select
     740                   when pos("LOGIN SUCCESSFUL",        trStWT) > 0 then ok = VRSet("DT_STATUSBAR","BACKCOLOR","GREEN")
     741                   when pos("NT_STATUS_OK",            trStWT) > 0 then ok = VRSet("DT_STATUSBAR","BACKCOLOR","GREEN")
     742                   when pos("NT_STATUS_ACCESS_DENIED", trStWT) > 0 then ok = VRSet("DT_STATUSBAR","BACKCOLOR","YELLOW")
     743                   when pos("ERROR",                   trStWT) > 0 then ok = VRSet("DT_STATUSBAR","BACKCOLOR","RED")
     744                   when pos("NT_STATUS_",              trStWT) > 0 then ok = VRSet("DT_STATUSBAR","BACKCOLOR","RED")
     745                   otherwise ok = VRSet("TM_STATUSBAR","Enabled", 0)
     746                end
     747            end
     748        end
     749    end
     750return
     751
     752_StatusBarReset:
     753    ok = VRSet("DT_STATUSBAR","BACKCOLOR","<default>")
     754    ok = VRSet("TM_STATUSBAR","Enabled", 0)
     755return
Note: See TracChangeset for help on using the changeset viewer.