Changeset 971

Show
Ignore:
Timestamp:
2008-06-05 02:31:46 (2 years ago)
Author:
MaierMan
Message:

#752: Manage offline status better

  • graying all test
  • Status = Offline for all queued/paused downloads.
  • Initially querying the status
  • Observing network:offline-status-changed
  • Don't start downloads when offline
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/chrome/content/dta/manager.js

    r969 r971  
    9090        ], 
    9191        _initialized: false, 
     92        _offline: false, 
     93        get offline() { 
     94                return this._offline; 
     95        }, 
     96        set offline(nv) { 
     97                this._offline = !!nv; 
     98                let de = $('downloads'); 
     99                 
     100                if (this._offline) { 
     101                        de.setAttribute('offline', true); 
     102                } 
     103                else if (de.hasAttribute('offline')) { 
     104                                de.removeAttribute('offline'); 
     105                }                
     106                Tree.invalidate(); 
     107        }, 
    92108        _wasRunning: false, 
    93109        _lastTime: Utils.getTimestamp(), 
     
    98114        init: function D_init() { 
    99115                Tree.init($("downloads")); 
     116                SessionManager.init(); 
     117 
     118                try { 
     119                        let ios2 = Serv('@mozilla.org/network/io-service;1', 'nsIIOService2'); 
     120                        this.offline = ios2.offline; 
     121                } 
     122                catch (ex) { 
     123                        Debug.log("Cannot get offline status", ex); 
     124                } 
     125                 
    100126                makeObserver(this); 
    101                  
    102127                this._observes.forEach( 
    103128                        function(topic) { 
     
    106131                        this 
    107132                ); 
    108          
     133                        
    109134                document.getElementById("dtaHelp").hidden = !("openHelp" in window); 
    110135         
    111                 SessionManager.init(); 
    112136         
    113137                if ("arguments" in window) { 
     
    143167                } 
    144168                else if (topic == 'network:offline-status-changed') { 
    145                          
     169                        this.offline = data == "offline"; 
    146170                } 
    147171        }, 
     
    256280                        this.refresh(); 
    257281                         
    258                         if (Prefs.autoClearComplete && this._autoClears.length) { 
    259                                 Tree.remove(this._autoClears); 
    260                                 this._autoClears = []; 
    261                         } 
    262                          
    263                         if (Prefs.autoRetryInterval) { 
    264                                 for (let d in Tree.all) { 
    265                                         d.autoRetry(); 
    266                                 } 
    267                         } 
    268                                          
    269282                        this._running.forEach( 
    270283                                function(i) { 
     
    284297                                } 
    285298                        ) 
    286                         this.startNext(); 
     299                         
     300                        if (Prefs.autoClearComplete && this._autoClears.length) { 
     301                                Tree.remove(this._autoClears); 
     302                                this._autoClears = []; 
     303                        } 
     304 
     305                        if (!this._offline) {                                    
     306                                if (Prefs.autoRetryInterval) { 
     307                                        for (let d in Tree.all) { 
     308                                                d.autoRetry(); 
     309                                        } 
     310                                } 
     311                                this.startNext(); 
     312                        } 
    287313                } 
    288314                catch(ex) { 
     
    11231149        _status : '', 
    11241150        get status() { 
     1151                if (Dialog.offline && this.is(QUEUED, PAUSED)) { 
     1152                        return _('offline'); 
     1153                } 
    11251154                return this._status + (this._autoRetryTime ? ' *' : ''); 
    11261155        }, 
  • trunk/chrome/locale/en-US/manager.properties

    r892 r971  
    1212paused=Paused 
    1313inqueue=Waiting 
     14offline=Offline 
    1415decompress=Decompressing... 
    1516prettyhash=%S [%S] 
  • trunk/chrome/skin/manager/style.css

    r969 r971  
    144144} 
    145145 
     146#downloads[offline]  { 
     147        color: gray !important; 
     148} 
     149 
    146150treechildren::-moz-tree-progressmeter(completed) { 
    147151  color: #008F00 !important;