hide all the preferences page upon the first page change and don't set the width/height

This commit is contained in:
Damien Churchill 2009-07-30 22:32:58 +00:00
commit 5998eea0bd

View file

@ -33,6 +33,9 @@ Copyright:
*/ */
Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, { Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
currentPage: null,
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply({
layout: 'border', layout: 'border',
@ -45,8 +48,7 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
plain: true, plain: true,
resizable: false, resizable: false,
title: _('Preferences'), title: _('Preferences'),
currentPage: false,
items: [{ items: [{
xtype: 'grid', xtype: 'grid',
region: 'west', region: 'west',
@ -113,8 +115,6 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
store.loadData([[name]], true); store.loadData([[name]], true);
page['bodyStyle'] = 'margin: 5px'; page['bodyStyle'] = 'margin: 5px';
this.pages[name] = this.configPanel.add(page); this.pages[name] = this.configPanel.add(page);
this.pages[name].setWidth(365);
this.pages[name].setHeight(410);
}, },
/** /**
@ -130,9 +130,14 @@ Ext.deluge.PreferencesWindow = Ext.extend(Ext.Window, {
}, },
onPageSelect: function(selModel, rowIndex, r) { onPageSelect: function(selModel, rowIndex, r) {
if (this.currentPage) { if (this.currentPage == null) {
for (var page in this.pages) {
this.pages[page].hide();
}
} else {
this.currentPage.hide(); this.currentPage.hide();
} }
var name = r.get('name'); var name = r.get('name');
this.pages[name].show(); this.pages[name].show();