Edit gateway works too. Now we need to start parsing events right.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16301 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
João Mesquita 2010-01-14 04:54:03 +00:00
parent b88a016962
commit bc835175ba
5 changed files with 69 additions and 6 deletions

View File

@ -139,9 +139,6 @@
</global_settings>
<profiles>
<profile name="softphone">
<gateways>
<X-PRE-PROCESS cmd="include" data="accounts/*.xml"/>
</gateways>
<settings>
<!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
<param name="user-agent-string" value="FreeSWITCH/FSComm"/>

View File

@ -57,6 +57,45 @@ void AccountDialog::addExtraParam()
ui->sofiaExtraParamTable->setItem(ui->sofiaExtraParamTable->rowCount()-1,1,paramValItem);
}
void AccountDialog::readConfig()
{
_settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
_settings->beginGroup(_accId);
_settings->beginGroup("gateway/attrs");
ui->sofiaGwNameEdit->setText(_settings->value("name").toString());
_settings->endGroup();
_settings->beginGroup("gateway/params");
ui->sofiaGwUsernameEdit->setText(_settings->value("username").toString());
ui->sofiaGwRealmEdit->setText(_settings->value("realm").toString());
ui->sofiaGwPasswordEdit->setText(_settings->value("password").toString());
ui->sofiaGwExtensionEdit->setText(_settings->value("extension").toString());
ui->sofiaGwExpireSecondsSpin->setValue(_settings->value("expire-seconds").toInt());
ui->sofiaGwRegisterCombo->setCurrentIndex(ui->sofiaGwRegisterCombo->findText(_settings->value("register").toString(),
Qt::MatchExactly));
ui->sofiaGwRegisterTransportCombo->setCurrentIndex(ui->sofiaGwRegisterTransportCombo->findText(_settings->value("register-transport").toString(),
Qt::MatchExactly));
ui->sofiaGwRetrySecondsSpin->setValue(_settings->value("retry-seconds").toInt());
_settings->endGroup();
_settings->beginGroup("gateway/customParams");
int row = 0;
foreach(QString k, _settings->childKeys())
{
row++;
ui->sofiaExtraParamTable->setRowCount(row);
QTableWidgetItem *varName = new QTableWidgetItem(k);
QTableWidgetItem *varVal = new QTableWidgetItem(_settings->value(k).toString());
ui->sofiaExtraParamTable->setItem(row-1, 0,varName);
ui->sofiaExtraParamTable->setItem(row-1, 1,varVal);
}
_settings->endGroup();
_settings->endGroup();
_settings->endGroup();
}
void AccountDialog::writeConfig()
{
_settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
@ -91,8 +130,6 @@ void AccountDialog::writeConfig()
_settings->endGroup();
_settings->endGroup();
QString res;
if (g_FSHost.sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
{

View File

@ -16,6 +16,7 @@ public:
~AccountDialog();
void clear();
void setAccId(QString);
void readConfig();
signals:
void gwAdded();

View File

@ -10,6 +10,7 @@ PrefAccounts::PrefAccounts(Ui::PrefDialog *ui) :
_accDlg = NULL;
connect(_ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
connect(_ui->sofiaGwRemBtn, SIGNAL(clicked()), this, SLOT(remAccountBtnClicked()));
connect(_ui->sofiaGwEditBtn, SIGNAL(clicked()), this, SLOT(editAccountBtnClicked()));
}
void PrefAccounts::addAccountBtnClicked()
@ -42,6 +43,33 @@ void PrefAccounts::addAccountBtnClicked()
_accDlg->activateWindow();
}
void PrefAccounts::editAccountBtnClicked()
{
QList<QTableWidgetSelectionRange> selList = _ui->accountsTable->selectedRanges();
if (selList.isEmpty())
return;
QTableWidgetSelectionRange range = selList[0];
QString uuid = _ui->accountsTable->item(range.topRow(),0)->data(Qt::UserRole).toString();
if (!_accDlg)
{
_accDlg = new AccountDialog(uuid);
connect(_accDlg, SIGNAL(gwAdded()), this, SLOT(readConfig()));
}
else
{
_accDlg->setAccId(uuid);
}
_accDlg->readConfig();
_accDlg->show();
_accDlg->raise();
_accDlg->activateWindow();
}
void PrefAccounts::remAccountBtnClicked()
{
QList<QTableWidgetSelectionRange> sel = _ui->accountsTable->selectedRanges();

View File

@ -169,7 +169,7 @@
<item>
<widget class="QPushButton" name="sofiaGwEditBtn">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Edit</string>