Module: deluge
Branch: master
Commit: e0e2b1b3504c9286a0da01ecd526ce29fccaf07a

Author: Damien Churchill <[email protected]>
Date:   Tue Apr 27 22:05:15 2010 +0100

improve the page switching

---

 .../js/deluge-all/preferences/PreferencesWindow.js |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js 
b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js
index 066cfa4..1e96578 100644
--- a/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js
+++ b/deluge/ui/web/js/deluge-all/preferences/PreferencesWindow.js
@@ -160,6 +160,7 @@ Deluge.preferences.PreferencesWindow = 
Ext.extend(Ext.Window, {
                page['bodyStyle'] = 'padding: 5px';
                page.preferences = this;
                this.pages[name] = this.configPanel.add(page);
+               this.pages[name].index = -1;
                return this.pages[name];
        },
        
@@ -180,8 +181,18 @@ Deluge.preferences.PreferencesWindow = 
Ext.extend(Ext.Window, {
         * @param {String} page The page name to change to
         */
        selectPage: function(page) {
-               var index = this.configPanel.items.indexOf(this.pages[page]);
-               this.configPanel.getLayout().setActiveItem(index);
+               if (this.pages[page].index < 0) { 
+                       this.pages[page].index = 
this.configPanel.items.indexOf(this.pages[page]);
+               }
+               this.list.select(this.pages[page].index);
+       },
+
+       // private
+       doSelectPage: function(page) {
+               if (this.pages[page].index < 0) { 
+                       this.pages[page].index = 
this.configPanel.items.indexOf(this.pages[page]);
+               }
+               
this.configPanel.getLayout().setActiveItem(this.pages[page].index);
                this.currentPage = page;
        },
        
@@ -193,7 +204,7 @@ Deluge.preferences.PreferencesWindow = 
Ext.extend(Ext.Window, {
        // private
        onPageSelect: function(list, selections) {
                var r = list.getRecord(selections[0]);
-               this.selectPage(r.get('name'));
+               this.doSelectPage(r.get('name'));
        },
        
        // private

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to