Index: source/ikea/site.ui
===================================================================
--- source/ikea/site.ui	(revision 486)
+++ source/ikea/site.ui	(working copy)
@@ -130,39 +130,6 @@
                             <enum>Sunken</enum>
                         </property>
                     </widget>
-                    <widget class="QComboBox">
-                        <item>
-                            <property name="text">
-                                <string>disabled</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property name="text">
-                                <string>ike config pull</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property name="text">
-                                <string>ike config push</string>
-                            </property>
-                        </item>
-                        <item>
-                            <property name="text">
-                                <string>dhcp over ipsec</string>
-                            </property>
-                        </item>
-                        <property name="name">
-                            <cstring>comboBoxConfigMethod</cstring>
-                        </property>
-                        <property name="geometry">
-                            <rect>
-                                <x>121</x>
-                                <y>70</y>
-                                <width>130</width>
-                                <height>21</height>
-                            </rect>
-                        </property>
-                    </widget>
                     <widget class="QLabel">
                         <property name="name">
                             <cstring>textLabelConfigMethod</cstring>
@@ -198,6 +165,39 @@
                             <set>AlignRight</set>
                         </property>
                     </widget>
+                    <widget class="QComboBox">
+                        <item>
+                            <property name="text">
+                                <string>disabled</string>
+                            </property>
+                        </item>
+                        <item>
+                            <property name="text">
+                                <string>ike config pull</string>
+                            </property>
+                        </item>
+                        <item>
+                            <property name="text">
+                                <string>ike config push</string>
+                            </property>
+                        </item>
+                        <item>
+                            <property name="text">
+                                <string>dhcp over ipsec</string>
+                            </property>
+                        </item>
+                        <property name="name">
+                            <cstring>comboBoxConfigMethod</cstring>
+                        </property>
+                        <property name="geometry">
+                            <rect>
+                                <x>121</x>
+                                <y>70</y>
+                                <width>130</width>
+                                <height>21</height>
+                            </rect>
+                        </property>
+                    </widget>
                 </widget>
                 <widget class="QGroupBox">
                     <property name="name">
@@ -347,6 +347,25 @@
                             <set>AlignHCenter</set>
                         </property>
                     </widget>
+                    <widget class="QLineEdit">
+                        <property name="name">
+                            <cstring>lineEditMTU</cstring>
+                        </property>
+                        <property name="geometry">
+                            <rect>
+                                <x>10</x>
+                                <y>90</y>
+                                <width>41</width>
+                                <height>21</height>
+                            </rect>
+                        </property>
+                        <property name="text">
+                            <string>1380</string>
+                        </property>
+                        <property name="alignment">
+                            <set>AlignRight</set>
+                        </property>
+                    </widget>
                     <widget class="QComboBox">
                         <item>
                             <property name="text">
@@ -370,25 +389,6 @@
                             </rect>
                         </property>
                     </widget>
-                    <widget class="QLineEdit">
-                        <property name="name">
-                            <cstring>lineEditMTU</cstring>
-                        </property>
-                        <property name="geometry">
-                            <rect>
-                                <x>10</x>
-                                <y>90</y>
-                                <width>41</width>
-                                <height>21</height>
-                            </rect>
-                        </property>
-                        <property name="text">
-                            <string>1380</string>
-                        </property>
-                        <property name="alignment">
-                            <set>AlignRight</set>
-                        </property>
-                    </widget>
                 </widget>
             </widget>
             <widget class="QWidget">
@@ -1793,12 +1793,12 @@
                     <widget class="QComboBox">
                         <item>
                             <property name="text">
-                                <string>main</string>
+                                <string>aggressive</string>
                             </property>
                         </item>
                         <item>
                             <property name="text">
-                                <string>aggressive</string>
+                                <string>main</string>
                             </property>
                         </item>
                         <property name="name">
@@ -2544,73 +2544,73 @@
         <sender>comboBoxAddressMethod</sender>
         <signal>activated(int)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdateGeneral()</slot>
     </connection>
     <connection>
         <sender>checkBoxAddressAuto</sender>
         <signal>stateChanged(int)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdateGeneral()</slot>
     </connection>
     <connection>
         <sender>comboBoxNATTMode</sender>
         <signal>activated(int)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdateClient()</slot>
     </connection>
     <connection>
         <sender>comboBoxFragMode</sender>
         <signal>activated(int)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdateClient()</slot>
     </connection>
     <connection>
         <sender>checkBoxDNSEnable</sender>
         <signal>stateChanged(int)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdateNameResolution()</slot>
     </connection>
     <connection>
         <sender>checkBoxDNSAuto</sender>
         <signal>stateChanged(int)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdateNameResolution()</slot>
     </connection>
     <connection>
         <sender>checkBoxPolicyAuto</sender>
         <signal>stateChanged(int)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdatePolicy()</slot>
     </connection>
     <connection>
         <sender>comboBoxP1Exchange</sender>
         <signal>activated(int)</signal>
         <receiver>site</receiver>
-        <slot>UpdateExchange()</slot>
+        <slot>UpdatePhase1()</slot>
     </connection>
     <connection>
         <sender>comboBoxP1Cipher</sender>
         <signal>activated(int)</signal>
         <receiver>site</receiver>
-        <slot>UpdateCipher()</slot>
+        <slot>UpdatePhase1()</slot>
     </connection>
     <connection>
         <sender>comboBoxP2Transform</sender>
         <signal>activated(int)</signal>
         <receiver>site</receiver>
-        <slot>UpdateTransform()</slot>
+        <slot>UpdatePhase2()</slot>
     </connection>
     <connection>
         <sender>listViewPolicies</sender>
         <signal>selectionChanged()</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdatePolicy()</slot>
     </connection>
     <connection>
         <sender>comboBoxAuthMethod</sender>
         <signal>activated(int)</signal>
         <receiver>site</receiver>
-        <slot>UpdateAuth()</slot>
+        <slot>UpdateAuthentication()</slot>
     </connection>
     <connection>
         <sender>comboBoxLocalIDType</sender>
@@ -2664,7 +2664,7 @@
         <sender>comboBoxConfigMethod</sender>
         <signal>activated(const QString&amp;)</signal>
         <receiver>site</receiver>
-        <slot>Update()</slot>
+        <slot>UpdateGeneral()</slot>
     </connection>
 </connections>
 <tabstops>
@@ -2731,15 +2731,17 @@
     <slot access="private">init()</slot>
     <slot>ModPolicy()</slot>
     <slot>DelPolicy()</slot>
-    <slot>Update()</slot>
-    <slot>UpdateExchange()</slot>
-    <slot>UpdateCipher()</slot>
-    <slot>UpdateTransform()</slot>
-    <slot>UpdateAuth()</slot>
+    <slot>UpdateGeneral()</slot>
+    <slot>UpdateClient()</slot>
+    <slot>UpdateNameResolution()</slot>
+    <slot>UpdateAuthentication()</slot>
     <slot>UpdateLocalID()</slot>
     <slot>UpdateRemoteID()</slot>
     <slot>SelectLocalID()</slot>
     <slot>SelectRemoteID()</slot>
+    <slot>UpdatePhase1()</slot>
+    <slot>UpdatePhase2()</slot>
+    <slot>UpdatePolicy()</slot>
     <slot>InputCAFile()</slot>
     <slot>InputCertFile()</slot>
     <slot>InputPKeyFile()</slot>
Index: source/ikea/site.ui.h
===================================================================
--- source/ikea/site.ui.h	(revision 486)
+++ source/ikea/site.ui.h	(working copy)
@@ -41,6 +41,9 @@
 
 #include "ikea.h"
 
+#define EXCH_AGGR_MODE		0
+#define EXCH_MAIN_MODE		1
+
 #define AUTH_HYBRID_RSA_XAUTH	0
 #define AUTH_MUTUAL_RSA_XAUTH	1
 #define AUTH_MUTUAL_PSK_XAUTH	2
@@ -203,11 +206,11 @@
 
 	// update dialog
 
-	Update();
-	UpdateAuth();
-	UpdateExchange();
-	UpdateCipher();
-	UpdateTransform();
+	UpdateGeneral();
+	UpdateAuthentication();
+	UpdatePhase1();
+	UpdatePhase2();
+	UpdatePolicy();
 }
 
 void site::ModPolicy()
@@ -470,11 +473,11 @@
 	if( config.get_string( "phase1-exchange",
 		text, MAX_CONFSTRING, 0 ) )
 	{
+		if( !strcmp( text, "aggressive" ) )
+			comboBoxP1Exchange->setCurrentItem( EXCH_AGGR_MODE );
+
 		if( !strcmp( text, "main" ) )
-			comboBoxP1Exchange->setCurrentItem( 0 );
-
-		if( !strcmp( text, "aggressive" ) )
-			comboBoxP1Exchange->setCurrentItem( 1 );
+			comboBoxP1Exchange->setCurrentItem( EXCH_MAIN_MODE );
 	}
 
 	// authentication mode ( default hybrid rsa xauth )
@@ -498,8 +501,6 @@
 			comboBoxAuthMethod->setCurrentItem( 4 );
 	}
 
-	UpdateAuth();
-
 	// local identity type
 	//
 	// NOTE : Requires phase1 exchange type & authentication mode
@@ -714,10 +715,11 @@
 
 	// update dialog
 
-	Update();
-	UpdateExchange();
-	UpdateCipher();
-	UpdateTransform();
+	UpdateGeneral();
+	UpdateAuthentication();
+	UpdatePhase1();
+	UpdatePhase2();
+	UpdatePolicy();
 
 	return true;
 }
@@ -1060,22 +1062,13 @@
 
 	// phase1 exchange type
 
-	if( !comboBoxP1Exchange->currentItem() )
-	{
-		// main mode
-
+	if( comboBoxP1Exchange->currentItem() == EXCH_AGGR_MODE )
 		config.set_string( "phase1-exchange",
-			"main",
-			strlen( "main" ) );
-	}
-	else
-	{
-		// aggressive mode
+			"aggressive", strlen( "aggressive" ) );
 
+	if( comboBoxP1Exchange->currentItem() == EXCH_MAIN_MODE )
 		config.set_string( "phase1-exchange",
-			"aggressive",
-			strlen( "aggressive" ) );
-	}
+			"main",	strlen( "main" ) );
 
 	// phase1 dh group
 
@@ -1276,9 +1269,10 @@
 	return true;
 }
 
+void site::UpdateGeneral()
+{
+	QString addrmeth = comboBoxAddressMethod->currentText();
 
-void site::Update()
-{
 	// auto configuration
 
 	long aconf = comboBoxConfigMethod->currentItem();
@@ -1301,8 +1295,14 @@
 		comboBoxAddressMethod->insertItem( "Use existing adapter and current address" );
 	}
 
-	// local adapter mode
+	// adapter mode
 
+	combobox_setbytext( ( char * ) addrmeth.ascii(), comboBoxAddressMethod );
+
+	bool addrmeth_changed = false;
+	if( addrmeth != comboBoxAddressMethod->currentText() )
+		addrmeth_changed = true;
+
 	if( !comboBoxAddressMethod->currentItem() )
 	{
 		// virtual
@@ -1317,7 +1317,8 @@
 			case 1: // ike config push
 			case 2: // ike config pull
 				checkBoxAddressAuto->setEnabled( true );
-				checkBoxAddressAuto->setChecked( true );
+				if( addrmeth_changed )
+					checkBoxAddressAuto->setChecked( true );
 				break;
 
 			case 3:	// dhcp over ipsec
@@ -1352,6 +1353,14 @@
 		lineEditNetmask->setEnabled( false );
 	}
 
+	UpdateClient();
+	UpdateNameResolution();
+}
+
+void site::UpdateClient()
+{
+	long aconf = comboBoxConfigMethod->currentItem();
+
 	// nat traversal mode
 
 	if( !comboBoxNATTMode->currentItem() )
@@ -1394,7 +1403,7 @@
 		lineEditFragSize->setEnabled( true );
 	}
 
-	// client long banner
+	// login banner
 
 	if( aconf == 0 )
 	{
@@ -1403,7 +1412,12 @@
 	}
 	else
 		checkBoxBanner->setEnabled( true );
+}
 
+void site::UpdateNameResolution()
+{
+	long aconf = comboBoxConfigMethod->currentItem();
+
 	// dns enabled
 
 	if( checkBoxDNSEnable->isChecked() )
@@ -1444,175 +1458,10 @@
 		textLabelDNSSuffix->setEnabled( false );
 		lineEditDNSSuffix->setEnabled( false );
 	}
-
-	// policy configuration
-
-	if( checkBoxPolicyAuto->isChecked() )
-	{
-		// automatic
-
-		listViewPolicies->setEnabled( false );
-
-		pushButtonPolicyAdd->setEnabled( false );
-		pushButtonPolicyMod->setEnabled( false );
-		pushButtonPolicyDel->setEnabled( false );
-	}
-	else
-	{
-		// manual
-
-		listViewPolicies->setEnabled( true );
-
-		pushButtonPolicyAdd->setEnabled( true );
-
-		// policy item selection
-
-		if( listViewPolicies->selectedItem() != NULL )
-		{
-			// have selection
-
-			pushButtonPolicyMod->setEnabled( true );
-			pushButtonPolicyDel->setEnabled( true );
-		}
-		else
-		{
-			// no selection
-
-			pushButtonPolicyMod->setEnabled( false );
-			pushButtonPolicyDel->setEnabled( false );
-		}
-	}
 }
 
-void site::UpdateExchange()
+void site::UpdateAuthentication()
 {
-	// exchange mode
-
-	if( !comboBoxP1Exchange->currentItem() )
-	{
-		// main mode ( auto allowed )
-
-		QString text = comboBoxP1DHGroup->currentText();
-
-		comboBoxP1DHGroup->clear();
-		comboBoxP1DHGroup->insertItem( "auto" );
-		comboBoxP1DHGroup->insertItem( "group 1" );
-		comboBoxP1DHGroup->insertItem( "group 2" );
-		comboBoxP1DHGroup->insertItem( "group 5" );
-		comboBoxP1DHGroup->insertItem( "group 14" );
-		comboBoxP1DHGroup->insertItem( "group 15" );
-
-		combobox_setbytext( ( char * ) text.ascii(), comboBoxP1DHGroup );
-	}
-	else
-	{
-		// aggressive mode ( auto not allowed )
-
-		QString text = comboBoxP1DHGroup->currentText();
-
-		comboBoxP1DHGroup->clear();
-		comboBoxP1DHGroup->insertItem( "group 1" );
-		comboBoxP1DHGroup->insertItem( "group 2" );
-		comboBoxP1DHGroup->insertItem( "group 5" );
-		comboBoxP1DHGroup->insertItem( "group 14" );
-		comboBoxP1DHGroup->insertItem( "group 15" );
-
-		combobox_setbytext( ( char * ) text.ascii(), comboBoxP1DHGroup );
-	}
-
-	UpdateAuth();
-}
-
-void site::UpdateCipher()
-{
-	// chipher type
-
-	QString text = comboBoxP1Keylen->currentText();
-
-	switch( comboBoxP1Cipher->currentItem() )
-	{
-		case 1: // aes
-		{
-			comboBoxP1Keylen->setEnabled( true );
-			comboBoxP1Keylen->clear();
-			comboBoxP1Keylen->insertItem( "auto" );
-			comboBoxP1Keylen->insertItem( "128" );
-			comboBoxP1Keylen->insertItem( "192" );
-			comboBoxP1Keylen->insertItem( "256" );
-			break;
-		}
-
-		case 2: // blowfish
-		{
-			comboBoxP1Keylen->setEnabled( true );
-			comboBoxP1Keylen->clear();
-			comboBoxP1Keylen->insertItem( "auto" );
-			for( long b = 128; b <= 256; b += 8 )
-				comboBoxP1Keylen->insertItem(
-					QString::number( b, 10 ) );
-			break;
-		}
-
-		default: // all others
-		{
-			comboBoxP1Keylen->setCurrentItem( 0 );
-			comboBoxP1Keylen->setEnabled( false );
-			break;
-		}
-	}
-
-	if( !comboBoxP1Cipher->currentItem() )
-		comboBoxP1Keylen->setCurrentItem( 0 );
-	else
-		combobox_setbytext( ( char * ) text.ascii(), comboBoxP1Keylen );
-}
-         
-void site::UpdateTransform()
-{
-	// chipher type
-
-	QString text = comboBoxP2Keylen->currentText();
-
-	switch( comboBoxP2Transform->currentItem() )
-	{
-		case 1: // aes
-		{
-			comboBoxP2Keylen->setEnabled( true );
-			comboBoxP2Keylen->clear();
-			comboBoxP2Keylen->insertItem( "auto" );
-			comboBoxP2Keylen->insertItem( "128" );
-			comboBoxP2Keylen->insertItem( "192" );
-			comboBoxP2Keylen->insertItem( "256" );
-			break;
-		}
-
-		case 2: // blowfish
-		{
-			comboBoxP2Keylen->setEnabled( true );
-			comboBoxP2Keylen->clear();
-			comboBoxP2Keylen->insertItem( "auto" );
-			for( long b = 128; b <= 256; b += 8 )
-				comboBoxP2Keylen->insertItem(
-					QString::number( b, 10 ) );
-			break;
-		}
-
-		default: // all others
-		{
-			comboBoxP2Keylen->setCurrentItem( 0 );
-			comboBoxP2Keylen->setEnabled( false );
-			break;
-		}
-	}
-
-	if( !comboBoxP2Transform->currentItem() )
-		comboBoxP2Keylen->setCurrentItem( 0 );
-	else
-		combobox_setbytext( ( char * ) text.ascii(), comboBoxP2Keylen );
-}
-
-void site::UpdateAuth()
-{
 	// authentication method
 
 	long auth = comboBoxAuthMethod->currentItem();
@@ -1643,22 +1492,23 @@
 		{
 			comboBoxLocalIDType->clear();
 
-			if( !comboBoxP1Exchange->currentItem() )
+			if( comboBoxP1Exchange->currentItem() == EXCH_AGGR_MODE )
 			{
-				// main mode
+				// aggressive mode
 
 				comboBoxLocalIDType->insertItem( IDTXT_ASN1 );
+				comboBoxLocalIDType->insertItem( IDTXT_FQDN );
+				comboBoxLocalIDType->insertItem( IDTXT_UFQDN );
 				comboBoxLocalIDType->insertItem( IDTXT_ADDR );
+				comboBoxLocalIDType->insertItem( IDTXT_KEYID );
 			}
-			else
+
+			if( comboBoxP1Exchange->currentItem() == EXCH_MAIN_MODE )
 			{
-				// aggressive mode
+				// main mode
 
 				comboBoxLocalIDType->insertItem( IDTXT_ASN1 );
-				comboBoxLocalIDType->insertItem( IDTXT_FQDN );
-				comboBoxLocalIDType->insertItem( IDTXT_UFQDN );
 				comboBoxLocalIDType->insertItem( IDTXT_ADDR );
-				comboBoxLocalIDType->insertItem( IDTXT_KEYID );
 			}
 
 			break;
@@ -1669,14 +1519,8 @@
 		{
 			comboBoxLocalIDType->clear();
 
-			if( !comboBoxP1Exchange->currentItem() )
+			if( comboBoxP1Exchange->currentItem() == EXCH_AGGR_MODE )
 			{
-				// main mode
-
-				comboBoxLocalIDType->insertItem( IDTXT_ADDR );
-			}
-			else
-			{
 				// aggressive mode
 
 				comboBoxLocalIDType->insertItem( IDTXT_FQDN );
@@ -1685,6 +1529,13 @@
 				comboBoxLocalIDType->insertItem( IDTXT_KEYID );
 			}
 
+			if( comboBoxP1Exchange->currentItem() == EXCH_MAIN_MODE )
+			{
+				// main mode
+
+				comboBoxLocalIDType->insertItem( IDTXT_ADDR );
+			}
+
 			break;
 		}
 	}
@@ -1709,22 +1560,23 @@
 		{
 			comboBoxRemoteIDType->clear();
 
-			if( !comboBoxP1Exchange->currentItem() )
+			if( comboBoxP1Exchange->currentItem() == EXCH_AGGR_MODE )
 			{
-				// main mode
+				// aggressive mode
 
 				comboBoxRemoteIDType->insertItem( IDTXT_ASN1 );
+				comboBoxRemoteIDType->insertItem( IDTXT_FQDN );
+				comboBoxRemoteIDType->insertItem( IDTXT_UFQDN );
 				comboBoxRemoteIDType->insertItem( IDTXT_ADDR );
+				comboBoxRemoteIDType->insertItem( IDTXT_KEYID );
 			}
-			else
+
+			if( comboBoxP1Exchange->currentItem() == EXCH_MAIN_MODE )
 			{
-				// aggressive mode
+				// main mode
 
 				comboBoxRemoteIDType->insertItem( IDTXT_ASN1 );
-				comboBoxRemoteIDType->insertItem( IDTXT_FQDN );
-				comboBoxRemoteIDType->insertItem( IDTXT_UFQDN );
 				comboBoxRemoteIDType->insertItem( IDTXT_ADDR );
-				comboBoxRemoteIDType->insertItem( IDTXT_KEYID );
 			}
 
 			break;
@@ -1735,14 +1587,8 @@
 		{
 			comboBoxRemoteIDType->clear();
 
-			if( !comboBoxP1Exchange->currentItem() )
+			if( comboBoxP1Exchange->currentItem() == EXCH_AGGR_MODE )
 			{
-				// main mode
-
-				comboBoxRemoteIDType->insertItem( IDTXT_ADDR );
-			}
-			else
-			{
 				// aggressive mode
 
 				comboBoxRemoteIDType->insertItem( IDTXT_FQDN );
@@ -1751,6 +1597,13 @@
 				comboBoxRemoteIDType->insertItem( IDTXT_KEYID );
 			}
 
+			if( comboBoxP1Exchange->currentItem() == EXCH_MAIN_MODE )
+			{
+				// main mode
+
+				comboBoxRemoteIDType->insertItem( IDTXT_ADDR );
+			}
+
 			break;
 		}
 	}
@@ -1930,7 +1783,172 @@
 	UpdateRemoteID();
 }
 
+void site::UpdatePhase1()
+{
+	// exchange mode
 
+	if( comboBoxP1Exchange->currentItem() == EXCH_AGGR_MODE )
+	{
+		// aggressive mode ( auto not allowed )
+
+		QString text = comboBoxP1DHGroup->currentText();
+
+		comboBoxP1DHGroup->clear();
+		comboBoxP1DHGroup->insertItem( "group 1" );
+		comboBoxP1DHGroup->insertItem( "group 2" );
+		comboBoxP1DHGroup->insertItem( "group 5" );
+		comboBoxP1DHGroup->insertItem( "group 14" );
+		comboBoxP1DHGroup->insertItem( "group 15" );
+
+		combobox_setbytext( ( char * ) text.ascii(), comboBoxP1DHGroup );
+	}
+
+	if( comboBoxP1Exchange->currentItem() == EXCH_MAIN_MODE )
+	{
+		// main mode ( auto allowed )
+
+		QString text = comboBoxP1DHGroup->currentText();
+
+		comboBoxP1DHGroup->clear();
+		comboBoxP1DHGroup->insertItem( "auto" );
+		comboBoxP1DHGroup->insertItem( "group 1" );
+		comboBoxP1DHGroup->insertItem( "group 2" );
+		comboBoxP1DHGroup->insertItem( "group 5" );
+		comboBoxP1DHGroup->insertItem( "group 14" );
+		comboBoxP1DHGroup->insertItem( "group 15" );
+
+		combobox_setbytext( ( char * ) text.ascii(), comboBoxP1DHGroup );
+	}
+
+	// chipher type
+
+	QString text = comboBoxP1Keylen->currentText();
+
+	switch( comboBoxP1Cipher->currentItem() )
+	{
+		case 1: // aes
+		{
+			comboBoxP1Keylen->setEnabled( true );
+			comboBoxP1Keylen->clear();
+			comboBoxP1Keylen->insertItem( "auto" );
+			comboBoxP1Keylen->insertItem( "128" );
+			comboBoxP1Keylen->insertItem( "192" );
+			comboBoxP1Keylen->insertItem( "256" );
+			break;
+		}
+
+		case 2: // blowfish
+		{
+			comboBoxP1Keylen->setEnabled( true );
+			comboBoxP1Keylen->clear();
+			comboBoxP1Keylen->insertItem( "auto" );
+			for( long b = 128; b <= 256; b += 8 )
+				comboBoxP1Keylen->insertItem(
+					QString::number( b, 10 ) );
+			break;
+		}
+
+		default: // all others
+		{
+			comboBoxP1Keylen->setCurrentItem( 0 );
+			comboBoxP1Keylen->setEnabled( false );
+			break;
+		}
+	}
+
+	if( !comboBoxP1Cipher->currentItem() )
+		comboBoxP1Keylen->setCurrentItem( 0 );
+	else
+		combobox_setbytext( ( char * ) text.ascii(), comboBoxP1Keylen );
+
+	UpdateAuthentication();
+}
+
+void site::UpdatePhase2()
+{
+	// transform type
+
+	QString text = comboBoxP2Keylen->currentText();
+
+	switch( comboBoxP2Transform->currentItem() )
+	{
+		case 1: // aes
+		{
+			comboBoxP2Keylen->setEnabled( true );
+			comboBoxP2Keylen->clear();
+			comboBoxP2Keylen->insertItem( "auto" );
+			comboBoxP2Keylen->insertItem( "128" );
+			comboBoxP2Keylen->insertItem( "192" );
+			comboBoxP2Keylen->insertItem( "256" );
+			break;
+		}
+
+		case 2: // blowfish
+		{
+			comboBoxP2Keylen->setEnabled( true );
+			comboBoxP2Keylen->clear();
+			comboBoxP2Keylen->insertItem( "auto" );
+			for( long b = 128; b <= 256; b += 8 )
+				comboBoxP2Keylen->insertItem(
+					QString::number( b, 10 ) );
+			break;
+		}
+
+		default: // all others
+		{
+			comboBoxP2Keylen->setCurrentItem( 0 );
+			comboBoxP2Keylen->setEnabled( false );
+			break;
+		}
+	}
+
+	if( !comboBoxP2Transform->currentItem() )
+		comboBoxP2Keylen->setCurrentItem( 0 );
+	else
+		combobox_setbytext( ( char * ) text.ascii(), comboBoxP2Keylen );
+}
+
+void site::UpdatePolicy()
+{
+	// policy configuration
+
+	if( checkBoxPolicyAuto->isChecked() )
+	{
+		// automatic
+
+		listViewPolicies->setEnabled( false );
+
+		pushButtonPolicyAdd->setEnabled( false );
+		pushButtonPolicyMod->setEnabled( false );
+		pushButtonPolicyDel->setEnabled( false );
+	}
+	else
+	{
+		// manual
+
+		listViewPolicies->setEnabled( true );
+
+		pushButtonPolicyAdd->setEnabled( true );
+
+		// policy item selection
+
+		if( listViewPolicies->selectedItem() != NULL )
+		{
+			// have selection
+
+			pushButtonPolicyMod->setEnabled( true );
+			pushButtonPolicyDel->setEnabled( true );
+		}
+		else
+		{
+			// no selection
+
+			pushButtonPolicyMod->setEnabled( false );
+			pushButtonPolicyDel->setEnabled( false );
+		}
+	}
+}
+
 void site::InputCAFile()
 {
 	QString types(
@@ -1986,3 +2004,4 @@
 
 	return;
 }
+
