From 60f0f1cb03d7cfbc7efb9443833e1c64afd08e23 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Thu, 1 Nov 2012 09:40:34 -0400
Subject: [PATCH] #17159: Make call using the AccountSelected in the
 AccountSelectionButton

---
 src/com/savoirfairelinux/sflphone/client/CallElementList.java | 4 ++++
 src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java    | 3 ++-
 .../sflphone/utils/AccountDetailsHandler.java                 | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/com/savoirfairelinux/sflphone/client/CallElementList.java b/src/com/savoirfairelinux/sflphone/client/CallElementList.java
index 58c669d30..e36882b80 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallElementList.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallElementList.java
@@ -89,6 +89,10 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
     static final String[] CONTACTS_PHONES_PROJECTION = new String[] { Phone.NUMBER, Phone.TYPE };
     static final String[] CONTACTS_SIP_PROJECTION = new String[] { SipAddress.SIP_ADDRESS, SipAddress.TYPE };
 
+    public String getSelectedAccount() {
+        return mAccountSelectionButton.getText().toString();
+    }
+
     /**
      * Runnable that fill information in a contact card asynchroniously.
      */
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
index d3bd1ae85..a3ead4b0a 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
@@ -451,7 +451,8 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC
     }
 
     public void processingNewCallAction() {
-        String accountID = mAccountList.currentAccountID;
+        // String accountID = mAccountList.currentAccountID;
+        String accountID = mCallElementList.getSelectedAccount();
         EditText editText = (EditText) findViewById(R.id.phoneNumberTextEntry);
         String to = editText.getText().toString();
 
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
index 5fd0272d1..5496471d3 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
@@ -234,6 +234,7 @@ public class AccountDetailsHandler {
         nativemap.put(ServiceConstants.CONFIG_ACCOUNT_ALIAS, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
         nativemap.put(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME));
         nativemap.put(ServiceConstants.CONFIG_ACCOUNT_USERNAME, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_USERNAME));
+        nativemap.put(ServiceConstants.CONFIG_ACCOUNT_PASSWORD, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_USERNAME));
         nativemap.put(ServiceConstants.CONFIG_ACCOUNT_ROUTESET, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_ROUTESET));
         nativemap.put(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE));
             
-- 
GitLab