]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add all the new stuff to persist accounts and sofia configs. Still not working, but...
authorJoão Mesquita <jmesquita@freeswitch.org>
Mon, 11 Jan 2010 04:40:39 +0000 (04:40 +0000)
committerJoão Mesquita <jmesquita@freeswitch.org>
Mon, 11 Jan 2010 04:40:39 +0000 (04:40 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16235 d0543943-73ff-0310-b7d9-9358b9ac24b2

14 files changed:
fscomm/FSComm.pro
fscomm/conf/sofia.conf.xml
fscomm/fshost.cpp
fscomm/fshost.h
fscomm/mod_qsettings/mod_qsettings.cpp
fscomm/mod_qsettings/mod_qsettings.h
fscomm/preferences/accountdialog.cpp
fscomm/preferences/accountdialog.h
fscomm/preferences/accountdialog.ui
fscomm/preferences/prefaccounts.cpp [new file with mode: 0644]
fscomm/preferences/prefaccounts.h [new file with mode: 0644]
fscomm/preferences/prefdialog.cpp
fscomm/preferences/prefdialog.h
fscomm/preferences/prefdialog.ui

index 47a3629ecdb5028ba3d2acb46a13b48e6b11ca7f..b5aa792ed8fc5cbcd27e9856b7088b02d9ec6c97 100644 (file)
@@ -29,7 +29,8 @@ SOURCES += main.cpp \
     preferences/prefdialog.cpp \
     preferences/prefportaudio.cpp \
     preferences/prefsofia.cpp \
-    preferences/accountdialog.cpp
+    preferences/accountdialog.cpp \
+    preferences/prefaccounts.cpp
 HEADERS += mainwindow.h \
     fshost.h \
     call.h \
index 67f7f5d95884795bc35dcb9037c13abcc74621d7..2dde03dacf29356143952b9705def7cd0a222649 100644 (file)
@@ -9,6 +9,8 @@
                        </global_settings>
                        <profiles>
                                <profile name="softphone">
+                                        <gateways>
+                                        </gateways>
                                        <settings>
                                          <param name="user-agent-string" value="${user-agent-string)"/>
                                          <param name="debug" value="${debug}"/>
index 6ddca285472c9d0067462d12f1615e2e52bcbe0a..5d58dae278a444eead8c02a98974762bedc5eb4d 100644 (file)
@@ -47,15 +47,10 @@ FSHost::FSHost(QObject *parent) :
 
 }
 
-void FSHost::run(void)
+void FSHost::createFolders()
 {
-    switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
-    const char *err = NULL;
-    switch_bool_t console = SWITCH_FALSE;
-    switch_status_t destroy_status;
-
     /* Create directory structure for softphone with default configs */
-    QDir conf_dir = QDir(QDir::home());
+    QDir conf_dir = QDir::home();
     if (!conf_dir.exists(".fscomm"))
     {
         conf_dir.mkpath(".fscomm/conf/accounts");
@@ -66,8 +61,8 @@ void FSHost::run(void)
         QString dest = QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath());
         rootXML.copy(dest);
 
-        QFile defaultAccount(":/confs/example.xml");
-        dest = QString("%1/.fscomm/conf/accounts/example.xml").arg(conf_dir.absolutePath());
+        QFile defaultAccount(":/confs/template.xml");
+        dest = QString("%1/.fscomm/conf/accounts/template.xml").arg(conf_dir.absolutePath());
         defaultAccount.copy(dest);
     }
 
@@ -110,6 +105,16 @@ void FSHost::run(void)
         }
         strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData());
     }
+}
+
+void FSHost::run(void)
+{
+    switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
+    const char *err = NULL;
+    switch_bool_t console = SWITCH_FALSE;
+    switch_status_t destroy_status;
+
+    createFolders();
 
     /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
     printf("Initializing core...\n");
index 46336bb8b011879a5d280ee096ad97a2daf4a33d..dff60e33ce50ef6fdd04f0e59f0d9f490bafae14 100644 (file)
@@ -45,6 +45,7 @@ class Call;
 #define FSCOMM_GW_STATE_EXPIRED 7
 #define FSCOMM_GW_STATE_NOREG 8
 
+
 static const char *fscomm_gw_state_names[] = {
     "TRYING",
     "REGISTER",
@@ -83,6 +84,7 @@ signals:
 private:
     switch_status_t processBlegEvent(switch_event_t *, QString);
     switch_status_t processAlegEvent(switch_event_t *, QString);
+    void createFolders();
     void printEventHeaders(switch_event_t *event);
     QHash<QString, Call*> _active_calls;
     QHash<QString, QString> _bleg_uuids;
index cef4720b4559b45747ac3172a48fd868f7275117..30e3fa5d175092b126e92dee5c2f614f35f0c8f7 100644 (file)
@@ -33,6 +33,8 @@
 #include <QString>
 #include <QtGui>
 #include <QDir>
+#include <QDomDocument>
+#include <QDomNodeList>
 #include "mod_qsettings/mod_qsettings.h"
 
 switch_xml_t XMLBinding::getConfigXML(QString tmpl)
@@ -79,9 +81,82 @@ switch_xml_t XMLBinding::getConfigXML(QString tmpl)
     char *res = switch_event_expand_headers(e, tmplContents.data());
     switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template %s as follows:\n%s", tmpl.toAscii().constData(), res);
     switch_safe_free(e);
+    if (tmpl == "sofia.conf")
+    {
+        return proccessAccounts(tmpl, res);
+    }
     return switch_xml_parse_str(res, strlen(res));
 }
 
+switch_xml_t XMLBinding::proccessAccounts(QString tmpl, QByteArray xml)
+{
+    char *res = NULL;
+
+    QDomDocument xmlDom;
+
+    /* Process sofia accounts */
+    if (tmpl == "sofia.conf")
+    {
+        int errorLine, errorColumn;
+        QString errorMsg;
+
+        if (!xmlDom.setContent(xml, &errorMsg, &errorLine, &errorColumn))
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not parse the xml template from sofia.conf.xml to add the accounts!\n");
+        }
+        QDomNodeList gatewaysNodeList = xmlDom.elementsByTagName("gateways");
+        if (gatewaysNodeList.isEmpty() || gatewaysNodeList.count() > 1)
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Where is my gateways tag? Or do we have more then one match?\n");
+        }
+
+        QDomNode gatewaysNode = gatewaysNodeList.at(0);
+
+        _settings->beginGroup("FreeSWITCH/conf/accounts");
+        foreach (QString account, _settings->childGroups())
+        {
+            switch_event_t *e;
+            switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS);
+            switch_assert(e);
+
+            _settings->beginGroup(account);
+            switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, "name", account.toAscii().data());
+            foreach (QString k, _settings->childKeys())
+            {
+                switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData());
+            }
+            _settings->endGroup();
+
+            /* Open template file and expand all strings based on QSettings */
+            QFile tmplFile(QString("%1/.fscomm/templates/account.conf.xml").arg(QDir::homePath()));
+            if (!tmplFile.open(QIODevice::ReadOnly | QIODevice::Text))
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template for accounts could not be read!\n");
+                return NULL;
+            }
+
+            QByteArray tmplContents(tmplFile.readAll());
+            tmplFile.close();
+
+            res = switch_event_expand_headers(e, tmplContents.data());
+
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template of account %s as follows:\n%s", account.toAscii().data(), res);
+
+            QDomDocument gatewayXML;
+            if (!gatewayXML.setContent(QByteArray(res), &errorMsg, &errorLine, &errorColumn))
+            {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "We could not parse the XML for the account!\n");
+            }
+
+            gatewaysNode.appendChild(gatewayXML);
+            switch_safe_free(e);
+        }
+        _settings->endGroup();
+    }
+
+    return switch_xml_parse_str(xmlDom.toByteArray().data(), strlen(xmlDom.toByteArray().data()));
+}
+
 static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
                                   void *user_data)
 {
index 91e1b401e2eca35c145abb1ee57cb5a18f5b24d4..e6947ac242c8eedc246a024c8cc587c08a6a8e2c 100644 (file)
@@ -43,6 +43,7 @@ public:
     QString getBinding(void) { return _binding; }
     switch_xml_t getConfigXML(QString);
 private:
+    switch_xml_t proccessAccounts(QString, QByteArray);
     QString _binding;
     QSettings* _settings;
 };
index 75e6d1df35e439e560549fdda96e0a17aa5007c6..a4095f7debe33e5efa62d4da985ab4fef470ace4 100644 (file)
@@ -1,4 +1,5 @@
 #include <QSettings>
+#include <QtGui>
 #include "accountdialog.h"
 #include "ui_accountdialog.h"
 
@@ -9,6 +10,8 @@ AccountDialog::AccountDialog(QWidget *parent) :
     ui->setupUi(this);
     _settings = new QSettings;
     connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
+    connect(ui->sofiaExtraParamAddBtn, SIGNAL(clicked()), this, SLOT(addExtraParam()));
+    connect(ui->sofiaExtraParamRemBtn, SIGNAL(clicked()), this, SLOT(remExtraParam()));
 }
 
 AccountDialog::~AccountDialog()
@@ -16,6 +19,42 @@ AccountDialog::~AccountDialog()
     delete ui;
 }
 
+void AccountDialog::remExtraParam()
+{
+    QList<QTableWidgetSelectionRange> sel = ui->sofiaExtraParamTable->selectedRanges();
+
+    foreach(QTableWidgetSelectionRange range, sel)
+    {
+        int offset =0;
+        for(int row = range.topRow(); row<=range.bottomRow(); row++)
+        {
+            ui->sofiaExtraParamTable->removeRow(row-offset);
+            offset++;
+        }
+    }
+}
+
+void AccountDialog::addExtraParam()
+{
+    bool ok;
+    QString paramName = QInputDialog::getText(this, tr("Add parameter."),
+                                         tr("New parameter name:"), QLineEdit::Normal,
+                                         NULL, &ok);
+    if (!ok)
+        return;
+    QString paramVal = QInputDialog::getText(this, tr("Add parameter."),
+                                         tr("New parameter value:"), QLineEdit::Normal,
+                                         NULL, &ok);
+    if (!ok)
+        return;
+
+    QTableWidgetItem* paramNameItem = new QTableWidgetItem(paramName);
+    QTableWidgetItem* paramValItem = new QTableWidgetItem(paramVal);
+    ui->sofiaExtraParamTable->setRowCount(ui->sofiaExtraParamTable->rowCount()+1);
+    ui->sofiaExtraParamTable->setItem(ui->sofiaExtraParamTable->rowCount()-1,0,paramNameItem);
+    ui->sofiaExtraParamTable->setItem(ui->sofiaExtraParamTable->rowCount()-1,1,paramValItem);
+}
+
 void AccountDialog::writeConfig()
 {
     _settings->beginGroup("FreeSWITCH/conf/accounts");
@@ -23,19 +62,21 @@ void AccountDialog::writeConfig()
     _settings->beginGroup(ui->sofiaGwNameEdit->text());
     _settings->setValue("username", ui->sofiaGwUsernameEdit->text());
     _settings->setValue("realm", ui->sofiaGwRealmEdit->text());
-    _settings->setValue("from-user", ui->sofiaGwFromUserEdit->text());
-    _settings->setValue("from-domain", ui->sofiaGwFromDomainEdit->text());
     _settings->setValue("password", ui->sofiaGwPasswordEdit->text());
     _settings->setValue("extension", ui->sofiaGwExtensionEdit->text());
-    _settings->setValue("proxy", ui->sofiaGwProxyEdit->text());
-    _settings->setValue("register-proxy", ui->sofiaGwRegisterProxyEdit->text());
     _settings->setValue("expire-seconds", ui->sofiaGwExpireSecondsSpin->value());
     _settings->setValue("register", ui->sofiaGwRegisterCombo->currentText());
     _settings->setValue("register-transport", ui->sofiaGwRegisterTransportCombo->currentText());
     _settings->setValue("retry-seconds", ui->sofiaGwRetrySecondsSpin->value());
-    _settings->setValue("caller-id-in-from", ui->sofiaGwCallerIdInFromCombo->currentText());
-    _settings->setValue("contact-params", ui->sofiaGwContactParamsEdit->text());
-    _settings->setValue("ping", ui->sofiaGwPingSpin->value());
+
+    _settings->beginGroup("customParams");
+    for (int i = 0; i< ui->sofiaExtraParamTable->rowCount(); i++)
+    {
+        _settings->setValue(ui->sofiaExtraParamTable->item(i, 0)->text(),
+                            ui->sofiaExtraParamTable->item(i, 1)->text());
+    }
+    _settings->endGroup();
+
     _settings->endGroup();
 
     _settings->endGroup();
index b7e408d7e1223dab31f7e2c1e040a2127b7288bf..f229a4459a0de40f499dd23535f20c35620edc59 100644 (file)
@@ -17,6 +17,8 @@ public:
 
 private slots:
     void writeConfig();
+    void addExtraParam();
+    void remExtraParam();
 
 protected:
     void changeEvent(QEvent *e);
index acddb9eb05b2d757aef506d18e0b3b5f5010fa59..bf29856d940083d80ab1a5af14f62375082d7895 100644 (file)
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>495</width>
-    <height>573</height>
+    <width>389</width>
+    <height>394</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Account</string>
   </property>
-  <layout class="QFormLayout" name="formLayout">
-   <item row="0" column="0">
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>name</string>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>1</number>
      </property>
+     <widget class="QWidget" name="tab">
+      <attribute name="title">
+       <string>Basic</string>
+      </attribute>
+      <layout class="QFormLayout" name="formLayout">
+       <property name="fieldGrowthPolicy">
+        <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+       </property>
+       <item row="0" column="0">
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>name</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QLineEdit" name="sofiaGwNameEdit"/>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_2">
+         <property name="text">
+          <string>username</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QLineEdit" name="sofiaGwUsernameEdit"/>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="label_3">
+         <property name="text">
+          <string>realm</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QLineEdit" name="sofiaGwRealmEdit"/>
+       </item>
+       <item row="3" column="0">
+        <widget class="QLabel" name="label_6">
+         <property name="text">
+          <string>password</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1">
+        <widget class="QLineEdit" name="sofiaGwPasswordEdit"/>
+       </item>
+       <item row="4" column="0">
+        <widget class="QLabel" name="label_7">
+         <property name="text">
+          <string>extension</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="1">
+        <widget class="QLineEdit" name="sofiaGwExtensionEdit"/>
+       </item>
+       <item row="5" column="0">
+        <widget class="QLabel" name="label_10">
+         <property name="text">
+          <string>expire-seconds</string>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="1">
+        <widget class="QSpinBox" name="sofiaGwExpireSecondsSpin">
+         <property name="value">
+          <number>60</number>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="0">
+        <widget class="QLabel" name="label_11">
+         <property name="text">
+          <string>register</string>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="1">
+        <widget class="QComboBox" name="sofiaGwRegisterCombo">
+         <item>
+          <property name="text">
+           <string>true</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>false</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="7" column="0">
+        <widget class="QLabel" name="label_12">
+         <property name="text">
+          <string>register-transport</string>
+         </property>
+        </widget>
+       </item>
+       <item row="7" column="1">
+        <widget class="QComboBox" name="sofiaGwRegisterTransportCombo">
+         <item>
+          <property name="text">
+           <string>udp</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>tcp</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="8" column="0">
+        <widget class="QLabel" name="label_13">
+         <property name="text">
+          <string>retry-seconds</string>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="1">
+        <widget class="QSpinBox" name="sofiaGwRetrySecondsSpin">
+         <property name="value">
+          <number>30</number>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_2">
+      <attribute name="title">
+       <string>Advanced</string>
+      </attribute>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QTableWidget" name="sofiaExtraParamTable">
+         <column>
+          <property name="text">
+           <string>Param Name</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Param Value</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_2">
+         <item>
+          <widget class="QPushButton" name="sofiaExtraParamAddBtn">
+           <property name="text">
+            <string>+</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="sofiaExtraParamRemBtn">
+           <property name="text">
+            <string>-</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
-   <item row="0" column="1">
-    <widget class="QLineEdit" name="sofiaGwNameEdit"/>
-   </item>
-   <item row="1" column="0">
-    <widget class="QLabel" name="label_2">
-     <property name="text">
-      <string>username</string>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1">
-    <widget class="QLineEdit" name="sofiaGwUsernameEdit"/>
-   </item>
-   <item row="2" column="0">
-    <widget class="QLabel" name="label_3">
-     <property name="text">
-      <string>realm</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1">
-    <widget class="QLineEdit" name="sofiaGwRealmEdit"/>
-   </item>
-   <item row="3" column="0">
-    <widget class="QLabel" name="label_4">
-     <property name="text">
-      <string>from-user</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="1">
-    <widget class="QLineEdit" name="sofiaGwFromUserEdit"/>
-   </item>
-   <item row="4" column="0">
-    <widget class="QLabel" name="label_5">
-     <property name="text">
-      <string>from-domain</string>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="1">
-    <widget class="QLineEdit" name="sofiaGwFromDomainEdit"/>
-   </item>
-   <item row="5" column="0">
-    <widget class="QLabel" name="label_6">
-     <property name="text">
-      <string>password</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="1">
-    <widget class="QLineEdit" name="sofiaGwPasswordEdit"/>
-   </item>
-   <item row="6" column="0">
-    <widget class="QLabel" name="label_7">
-     <property name="text">
-      <string>extension</string>
-     </property>
-    </widget>
-   </item>
-   <item row="6" column="1">
-    <widget class="QLineEdit" name="sofiaGwExtensionEdit"/>
-   </item>
-   <item row="7" column="0">
-    <widget class="QLabel" name="label_8">
-     <property name="text">
-      <string>proxy</string>
-     </property>
-    </widget>
-   </item>
-   <item row="7" column="1">
-    <widget class="QLineEdit" name="sofiaGwProxyEdit"/>
-   </item>
-   <item row="8" column="0">
-    <widget class="QLabel" name="label_9">
-     <property name="text">
-      <string>register-proxy</string>
-     </property>
-    </widget>
-   </item>
-   <item row="8" column="1">
-    <widget class="QLineEdit" name="sofiaGwRegisterProxyEdit"/>
-   </item>
-   <item row="9" column="0">
-    <widget class="QLabel" name="label_10">
-     <property name="text">
-      <string>expire-seconds</string>
-     </property>
-    </widget>
-   </item>
-   <item row="9" column="1">
-    <widget class="QSpinBox" name="sofiaGwExpireSecondsSpin">
-     <property name="value">
-      <number>60</number>
-     </property>
-    </widget>
-   </item>
-   <item row="10" column="0">
-    <widget class="QLabel" name="label_11">
-     <property name="text">
-      <string>register</string>
-     </property>
-    </widget>
-   </item>
-   <item row="10" column="1">
-    <widget class="QComboBox" name="sofiaGwRegisterCombo">
-     <item>
-      <property name="text">
-       <string>true</string>
-      </property>
-     </item>
-     <item>
-      <property name="text">
-       <string>false</string>
-      </property>
-     </item>
-    </widget>
-   </item>
-   <item row="11" column="0">
-    <widget class="QLabel" name="label_12">
-     <property name="text">
-      <string>register-transport</string>
-     </property>
-    </widget>
-   </item>
-   <item row="11" column="1">
-    <widget class="QComboBox" name="sofiaGwRegisterTransportCombo">
-     <item>
-      <property name="text">
-       <string>udp</string>
-      </property>
-     </item>
-     <item>
-      <property name="text">
-       <string>tcp</string>
-      </property>
-     </item>
-    </widget>
-   </item>
-   <item row="12" column="0">
-    <widget class="QLabel" name="label_13">
-     <property name="text">
-      <string>retry-seconds</string>
-     </property>
-    </widget>
-   </item>
-   <item row="12" column="1">
-    <widget class="QSpinBox" name="sofiaGwRetrySecondsSpin">
-     <property name="value">
-      <number>30</number>
-     </property>
-    </widget>
-   </item>
-   <item row="13" column="0">
-    <widget class="QLabel" name="label_15">
-     <property name="text">
-      <string>contact-params</string>
-     </property>
-    </widget>
-   </item>
-   <item row="13" column="1">
-    <widget class="QLineEdit" name="sofiaGwContactParamsEdit"/>
-   </item>
-   <item row="14" column="0">
-    <widget class="QLabel" name="label_14">
-     <property name="text">
-      <string>caller-id-in-from</string>
-     </property>
-    </widget>
-   </item>
-   <item row="15" column="0">
-    <widget class="QLabel" name="label_16">
-     <property name="text">
-      <string>ping</string>
-     </property>
-    </widget>
-   </item>
-   <item row="15" column="1">
-    <widget class="QSpinBox" name="sofiaGwPingSpin">
-     <property name="value">
-      <number>25</number>
-     </property>
-    </widget>
-   </item>
-   <item row="16" column="1">
+   <item>
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
-   <item row="14" column="1">
-    <widget class="QComboBox" name="sofiaGwCallerIdInFromCombo">
-     <item>
-      <property name="text">
-       <string>false</string>
-      </property>
-     </item>
-     <item>
-      <property name="text">
-       <string>true</string>
-      </property>
-     </item>
-    </widget>
-   </item>
   </layout>
  </widget>
  <resources/>
    <slot>accept()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>248</x>
-     <y>254</y>
+     <x>257</x>
+     <y>563</y>
     </hint>
     <hint type="destinationlabel">
      <x>157</x>
    <slot>reject()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>316</x>
-     <y>260</y>
+     <x>325</x>
+     <y>563</y>
     </hint>
     <hint type="destinationlabel">
      <x>286</x>
diff --git a/fscomm/preferences/prefaccounts.cpp b/fscomm/preferences/prefaccounts.cpp
new file mode 100644 (file)
index 0000000..d4695f0
--- /dev/null
@@ -0,0 +1,30 @@
+#include <QtGui>
+#include "prefaccounts.h"
+
+PrefAccounts::PrefAccounts(Ui::PrefDialog *ui) :
+        _ui(ui)
+{
+    _settings = new QSettings();
+}
+
+void PrefAccounts::writeConfig()
+{
+    return;
+}
+
+void PrefAccounts::readConfig()
+{
+    _settings->beginGroup("FreeSWITCH/conf/accounts");
+    foreach(QString accountName, _settings->childGroups())
+    {
+        _settings->beginGroup(accountName);
+        QTableWidgetItem *item0 = new QTableWidgetItem(accountName);
+        QTableWidgetItem *item1 = new QTableWidgetItem(_settings->value("username").toString());
+        _settings->endGroup();
+        _ui->accountsTable->setRowCount(_ui->accountsTable->rowCount()+1);
+        _ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 0, item0);
+        _ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 1, item1);
+    }
+
+    _settings->endGroup();
+}
diff --git a/fscomm/preferences/prefaccounts.h b/fscomm/preferences/prefaccounts.h
new file mode 100644 (file)
index 0000000..aa4206c
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef PREFACCOUNTS_H
+#define PREFACCOUNTS_H
+
+#include <QObject>
+#include "ui_prefdialog.h"
+
+class QSettings;
+
+class PrefAccounts
+{
+public:
+    explicit PrefAccounts(Ui::PrefDialog *ui);
+    void readConfig();
+    void writeConfig();
+
+private:
+    Ui::PrefDialog *_ui;
+    QSettings *_settings;
+};
+
+#endif // PREFACCOUNTS_H
index 05242f3f1f75a6e538a863ddec7512d8e4198e69..483377462b757a3530f447c6476974add072bd24 100644 (file)
@@ -4,6 +4,7 @@
 #include "prefportaudio.h"
 #include "prefsofia.h"
 #include "accountdialog.h"
+#include "prefaccounts.h"
 
 PrefDialog::PrefDialog(QWidget *parent) :
     QDialog(parent),
@@ -15,8 +16,9 @@ PrefDialog::PrefDialog(QWidget *parent) :
     connect(ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
 
     _accDlg = NULL;
+    /*_pref_accounts = new PrefAccounts(ui);*/
     _mod_portaudio = new PrefPortaudio(ui, this);
-    _mod_sofia = new PrefSofia(ui, this);
+    /*_mod_sofia = new PrefSofia(ui, this);*/
     readConfig();
 }
 
@@ -55,6 +57,7 @@ void PrefDialog::changeEvent(QEvent *e)
 
 void PrefDialog::readConfig()
 {
+    /*_pref_accounts->readConfig();*/
     _mod_portaudio->readConfig();
     /*_mod_sofia->readConfig();*/
 }
index 1c1ee66b046d4c455ba5f7bfd4173aa3677ee773..794131bb8939ec775edfc5279d710d94bc175f87 100644 (file)
@@ -8,6 +8,7 @@
 
 class PrefPortaudio;
 class PrefSofia;
+class PrefAccounts;
 class AccountDialog;
 
 namespace Ui {
@@ -31,9 +32,10 @@ private:
     void readConfig();
     QSettings *_settings;
     AccountDialog *_accDlg;
+/*    PrefAccounts *_pref_accounts;*/
     Ui::PrefDialog *ui;
     PrefPortaudio *_mod_portaudio;
-    PrefSofia *_mod_sofia;
+/*    PrefSofia *_mod_sofia;*/
 };
 
 
index 2d8c7c7a26cc7c92e9a411d213bd6f9871795428..8ac862430a7ff0ffb94634f59440f825abb07387 100644 (file)
@@ -72,6 +72,9 @@
        <iconset resource="../resources.qrc">
         <normaloff>:/images/pref_accounts.jpg</normaloff>:/images/pref_accounts.jpg</iconset>
       </property>
+      <property name="flags">
+       <set>ItemIsSelectable|ItemIsDragEnabled|ItemIsUserCheckable</set>
+      </property>
      </item>
      <item>
       <property name="text">
@@ -81,6 +84,9 @@
        <iconset resource="../resources.qrc">
         <normaloff>:/images/pref_sip.png</normaloff>:/images/pref_sip.png</iconset>
       </property>
+      <property name="flags">
+       <set>ItemIsSelectable|ItemIsDragEnabled|ItemIsUserCheckable</set>
+      </property>
      </item>
      <item>
       <property name="text">
      <widget class="QWidget" name="accountsPage">
       <layout class="QHBoxLayout" name="horizontalLayout_5">
        <item>
-        <widget class="QTableWidget" name="sofiaGwListWidget">
+        <widget class="QTableWidget" name="accountsTable">
          <property name="editTriggers">
           <set>QAbstractItemView::NoEditTriggers</set>
          </property>
-         <column>
-          <property name="text">
-           <string>Enabled</string>
-          </property>
-         </column>
          <column>
           <property name="text">
            <string>Name</string>