Commit e27e5c39 authored by Emmanuel Lepage's avatar Emmanuel Lepage

Should fix many KDE issues

parent cac23d80
......@@ -195,6 +195,11 @@ bool ManagerImpl::outgoingCall (const std::string& account_id,
_debug ("Manager: New outgoing call abbort, missing callid");
return false;
}
if (account_id.empty()) {
_debug ("Manager: New outgoing call abbort, missing account");
return false;
}
// Call ID must be unique
if (not getAccountFromCall (call_id).empty()) {
......@@ -254,7 +259,7 @@ bool ManagerImpl::outgoingCall (const std::string& account_id,
try {
Call *call = getAccountLink(account_id)->newOutgoingCall (call_id, to_cleaned);
switchCall (call_id);
call->setConfId(conf_id);
} catch (const VoipLinkException &e) {
......
......@@ -622,19 +622,20 @@ SIPVoIPLink::answer (Call *c)
_debug ("UserAgent: Answering call");
SIPCall *call = dynamic_cast<SIPCall*>(c);
if (call != NULL) {
pjsip_inv_session *inv_session = call->inv;
pjsip_inv_session *inv_session = call->inv;
_debug ("UserAgent: SDP negotiation success! : call %s ", call->getCallId().c_str());
// Create and send a 200(OK) response
if (pjsip_inv_answer (inv_session, PJSIP_SC_OK, NULL, NULL, &tdata) != PJ_SUCCESS)
throw VoipLinkException("Could not init invite request answer (200 OK)");
if (pjsip_inv_send_msg (inv_session, tdata) != PJ_SUCCESS)
throw VoipLinkException("Could not send invite request answer (200 OK)");
_debug ("UserAgent: SDP negotiation success! : call %s ", call->getCallId().c_str());
// Create and send a 200(OK) response
if (pjsip_inv_answer (inv_session, PJSIP_SC_OK, NULL, NULL, &tdata) != PJ_SUCCESS)
throw VoipLinkException("Could not init invite request answer (200 OK)");
if (pjsip_inv_send_msg (inv_session, tdata) != PJ_SUCCESS)
throw VoipLinkException("Could not send invite request answer (200 OK)");
call->setConnectionState (Call::Connected);
call->setState (Call::Active);
call->setConnectionState (Call::Connected);
call->setState (Call::Active);
}
}
void
......
......@@ -26,7 +26,7 @@
Codec::Codec(int payload, bool enabled)
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
QStringList details = configurationManager.getCodecDetails(payload);
QStringList details = configurationManager.getAudioCodecDetails(payload);
this->payload = QString::number(payload);
this->enabled = enabled;
this->name = details[CODEC_NAME];
......
......@@ -83,9 +83,9 @@ bool SFLPhone::initialize()
view->loadWindow();
move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2);
if( ! configurationManager.isStartHidden()) {
show();
}
//if( ! configurationManager.isStartHidden()) {
show();
//}
if(configurationManager.getAccountList().value().isEmpty()) {
(new AccountWizard())->show();
......@@ -146,8 +146,8 @@ void SFLPhone::setupActions()
action_displayDialpad->setCheckable(true);
action_displayVolumeControls->setCheckable(true);
action_displayVolumeControls->setChecked(configurationManager.getVolumeControls());
action_displayDialpad->setChecked(configurationManager.getDialpad());
action_displayVolumeControls->setChecked(/*configurationManager.getVolumeControls()*/true);
action_displayDialpad->setChecked(/*configurationManager.getDialpad()*/true);
action_accountCreationWizard = new KAction(i18n("Account creation wizard"), this);
connect(action_accept, SIGNAL(triggered()), view, SLOT(accept()));
......@@ -347,9 +347,9 @@ void SFLPhone::on_view_incomingCall(const Call * call)
{
putForeground();
}*/
if(configurationManager.getNotify()) {
sendNotif(call->getPeerName().isEmpty() ? call->getPeerPhoneNumber() : call->getPeerName());
}
//if(configurationManager.getNotify()) {
sendNotif(call->getPeerName().isEmpty() ? call->getPeerPhoneNumber() : call->getPeerName());
//}
}
void SFLPhone::on_view_addressBookEnableAsked(bool enabled)
......
......@@ -163,7 +163,7 @@ SFLPhoneView::~SFLPhoneView()
void SFLPhoneView::saveState()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
configurationManager.setHistory(callTreeModel.getHistoryMap());
configurationManager.setHistory(callTreeModel.getHistory());
}
void SFLPhoneView::loadWindow()
......@@ -739,8 +739,8 @@ void SFLPhoneView::updateVolumeControls()
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
int display = 0;
if(configurationManager.getAudioManager() == ConfigurationSkeleton::EnumInterface::ALSA) {
display = configurationManager.getVolumeControls();
if(QString(configurationManager.getAudioManager()) == "alsa") {
display = true;
((SFLPhone*)parent())->action_displayVolumeControls->setEnabled(true);
}
......@@ -763,7 +763,7 @@ void SFLPhoneView::updateVolumeControls()
void SFLPhoneView::updateDialpad()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
int display = configurationManager.getDialpad();
int display = true;
qDebug() << "updateDialpad " << display;
......@@ -795,17 +795,17 @@ void SFLPhoneView::updateStatusMessage()
void SFLPhoneView::displayVolumeControls()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
int display = configurationManager.getVolumeControls();
configurationManager.setVolumeControls(!display);
int display = true;//configurationManager.getVolumeControls();
//configurationManager.setVolumeControls(!display);
updateVolumeControls();
}
void SFLPhoneView::displayDialpad()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
int display = configurationManager.getDialpad();
int display = true;// configurationManager.getDialpad();
configurationManager.setDialpad(!display);
//configurationManager.setDialpad(!display);
updateDialpad();
}
......
......@@ -61,20 +61,20 @@ void ConfigurationSkeleton::readConfig()
////////////////////////
//Call history settings
setEnableHistory(QVariant(configurationManager.getHistoryEnabled()).toBool());
setHistoryMax(configurationManager.getHistoryLimit());
//setEnableHistory(true);
setHistoryMax(1000);//configurationManager.getHistoryLimit());
////////////////////////
////Display settings////
////////////////////////
//Notification settings
setNotifOnCalls(configurationManager.getNotify());
setNotifOnMessages(configurationManager.getMailNotify());
setNotifOnCalls(true);
setNotifOnMessages(true);//configurationManager.getMailNotify());
//Window display settings
setDisplayOnStart(! configurationManager.isStartHidden());
setDisplayOnCalls(configurationManager.popupMode());
setDisplayOnStart(true);
setDisplayOnCalls(true);
/////////////////////////
////Accounts settings////
......@@ -88,13 +88,13 @@ void ConfigurationSkeleton::readConfig()
//////////////////////
//Audio Interface settings
int audioManager = configurationManager.getAudioManager();
QString audioManager = configurationManager.getAudioManager();
qDebug() << "audioManager = " << audioManager;
setInterface(audioManager);
//setInterface(audioManager); //TODO
//ringtones settings
setEnableRingtones(configurationManager.isRingtoneEnabled());
QString ringtone = configurationManager.getRingtoneChoice();
setEnableRingtones(true);
QString ringtone = "";
if(ringtone.isEmpty()) {
setRingtone(QString(SHARE_INSTALL_PREFIX) + "sflphone/ringtones/konga.ul");
}
......@@ -122,10 +122,10 @@ void ConfigurationSkeleton::readConfig()
setAlsaInputDevice(inputDevice);
qDebug() << "outputDevice = " << devices[0];
int outputDevice = devices[0].toInt(& ok);
if(!ok) qDebug() << "outputDevice is not a number";
setAlsaOutputDevice(outputDevice);
//qDebug() << "outputDevice = " << devices[0];
//int outputDevice = devices[0].toInt(& ok);
//if(!ok) qDebug() << "outputDevice is not a number";
//setAlsaOutputDevice(outputDevice);
///////////////////////
////Record settings////
......@@ -173,7 +173,7 @@ void ConfigurationSkeleton::readConfig()
void ConfigurationSkeleton::writeConfig()
{
qDebug() << "\nWriting config";
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
/*ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
////////////////////////
......@@ -183,9 +183,9 @@ void ConfigurationSkeleton::writeConfig()
qDebug() << "Writing General settings";
//Call history settings
if(enableHistory() != QVariant(configurationManager.getHistoryEnabled()).toBool() ) {
configurationManager.setHistoryEnabled();
}
//if(enableHistory() != QVariant(configurationManager.getHistoryEnabled()).toBool() ) {
//configurationManager.setHistoryEnabled();
//}
configurationManager.setHistoryLimit(historyMax());
......@@ -196,13 +196,13 @@ void ConfigurationSkeleton::writeConfig()
qDebug() << "Writing Display settings";
//Notification settings
if(notifOnCalls() != configurationManager.getNotify()) configurationManager.setNotify();
if(notifOnMessages() != configurationManager.getMailNotify()) configurationManager.setMailNotify();
//if(notifOnCalls() != configurationManager.getNotify()) configurationManager.setNotify();
//if(notifOnMessages() != configurationManager.getMailNotify()) configurationManager.setMailNotify();
//Window display settings
//WARNING états inversés
if(displayOnStart() == configurationManager.isStartHidden()) configurationManager.startHidden();
if(displayOnCalls() != configurationManager.popupMode()) configurationManager.switchPopupMode();
//if(displayOnStart() == configurationManager.isStartHidden()) configurationManager.startHidden();
//if(displayOnCalls() != configurationManager.popupMode()) configurationManager.switchPopupMode();
/////////////////////////
////Accounts settings////
......@@ -283,7 +283,7 @@ void ConfigurationSkeleton::writeConfig()
hooksSettings[HOOKS_COMMAND] = hooksCommand();
configurationManager.setHookSettings(hooksSettings);
qDebug() << "Finished to write config\n";
qDebug() << "Finished to write config\n";*/
readConfig();
}
......
......@@ -262,7 +262,7 @@ void DlgAccounts::saveAccount(QListWidgetItem * item)
}
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
configurationManager.setActiveCodecList(_codecList, account->getAccountDetail(ACCOUNT_ID));
configurationManager.setActiveAudioCodecList(_codecList, account->getAccountDetail(ACCOUNT_ID));
qDebug() << "Account codec have been saved" << _codecList << account->getAccountDetail(ACCOUNT_ID);
saveCredential(account->getAccountDetail(ACCOUNT_ID));
......@@ -367,7 +367,7 @@ void DlgAccounts::loadAccount(QListWidgetItem * item)
keditlistbox_codec->clear();
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
QStringList activeCodecList = configurationManager.getActiveCodecList(account->getAccountDetail(ACCOUNT_ID));
QStringList activeCodecList = configurationManager.getActiveAudioCodecList(account->getAccountDetail(ACCOUNT_ID));
foreach (QString aCodec, activeCodecList) {
foreach (StringHash _aCodec, codecList) {
if (_aCodec["id"] == aCodec)
......@@ -613,16 +613,16 @@ void DlgAccounts::updateWidgets()
void DlgAccounts::loadCodecList()
{
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
QStringList codecIdList = configurationManager.getCodecList();
QStringList codecIdList = configurationManager.getAudioCodecList();
QStringList tmpNameList;
foreach (QString aCodec, codecIdList) {
QStringList codec = configurationManager.getCodecDetails(aCodec.toInt());
QStringList codec = configurationManager.getAudioCodecDetails(aCodec.toInt());
QHash<QString, QString> _codec;
_codec["name"] = codec[0];
_codec["name"] = codec[0];
_codec["frequency"] = codec[1];
_codec["bitrate"] = codec[2];
_codec["bandwidth"] = codec[3];
_codec["bitrate"] = codec[2];
_codec["bandwidth"] = ""; //TODO remove
_codec["id"] = aCodec;
tmpNameList << _codec["name"];
......@@ -711,24 +711,30 @@ void DlgAccounts::updateCombo(int value)
}
}
void DlgAccounts::loadCredentails(QString accountId) {
credentialInfo.clear();
list_credential->clear();
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
int credentialCount = configurationManager.getNumberOfCredential(accountId);
for (int i=0; i < credentialCount; i++) {
QMap<QString, QString> credentialData = configurationManager.getCredential(accountId,i);
qDebug() << "Credential: " << credentialData;
ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
VectorMapStringString credentials = configurationManager.getCredentials(accountId);
for (int i=0; i < credentials.size(); i++) {
qDebug() << "Credential: " << credentials[i];
QListWidgetItem* newItem = new QListWidgetItem();
newItem->setText(credentialData["username"]);
credentialInfo[newItem] = {newItem, credentialData["username"], credentialData["password"],credentialData["realm"]};
newItem->setText(credentials[i]["username"]);
CredentialData data;
data.pointer = newItem;
data.name = credentials[i]["username"];
data.password =credentials[i]["password"] ;
data.realm = credentials[i]["realm"];
credentialInfo[newItem] = data;
list_credential->addItem(newItem);
}
}
void DlgAccounts::saveCredential(QString accountId) {
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
configurationManager.setNumberOfCredential(accountId, list_credential->count());
//configurationManager.setNumberOfCredential(accountId, list_credential->count()); //TODO
VectorMapStringString toReturn;
for (int i=0; i < list_credential->count();i++) {
QListWidgetItem* currentItem = list_credential->item(i);
......@@ -736,8 +742,9 @@ void DlgAccounts::saveCredential(QString accountId) {
credentialData["username"] = credentialInfo[currentItem].name;
credentialData["password"] = credentialInfo[currentItem].password;
credentialData["realm"] = credentialInfo[currentItem].realm;
configurationManager.setCredential(accountId, i,credentialData);
toReturn << credentialData;
}
configurationManager.setCredentials(accountId,toReturn);
}
void DlgAccounts::addCredential() {
......
......@@ -97,10 +97,10 @@ void DlgAudio::loadAlsaSettings()
{
qDebug() << "DlgAudio::loadAlsaSettings";
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
if(configurationManager.getAudioManager() == ConfigurationSkeleton::EnumInterface::ALSA) {
if(QString(configurationManager.getAudioManager()) == "alsa") {
ConfigurationSkeleton * skeleton = ConfigurationSkeleton::self();
QStringList pluginList = configurationManager.getOutputAudioPluginList();
QStringList pluginList = configurationManager.getAudioPluginList();
box_alsaPlugin->clear();
box_alsaPlugin->addItems(pluginList);
int index = box_alsaPlugin->findText(skeleton->alsaPlugin());
......
......@@ -56,7 +56,7 @@ const QString account_state_name(QString & s)
Account::Account():accountId(NULL),accountDetails(NULL)
{
}
#include <unistd.h>
Account* Account::buildExistingAccountFromId(QString _accountId)
{
qDebug() << "Building an account from id: " << _accountId;
......
......@@ -499,7 +499,7 @@ void Call::acceptTransf()
CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
qDebug() << "Accepting call and transfering it to number : " << transferNumber << ". callId : " << callId;
callManager.accept(callId);
callManager.transfert(callId, transferNumber);
callManager.transfer(callId, transferNumber);
// historyState = TRANSFERED;
}
......@@ -563,7 +563,7 @@ void Call::transfer()
{
CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
qDebug() << "Transfering call to number : " << transferNumber << ". callId : " << callId;
callManager.transfert(callId, transferNumber);
callManager.transfer(callId, transferNumber);
this->stopTime = new QDateTime(QDateTime::currentDateTime());
}
......@@ -700,7 +700,7 @@ void Call::setConfId(QString value) {
QString Call::getCurrentCodecName() {
CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance();
return callManager.getCurrentCodecName(callId);
return callManager.getCurrentAudioCodecName(callId);
}
//This function could also be called mayBeSecure or haveChancesToBeEncryptedButWeCantTell.
......
......@@ -91,7 +91,7 @@ class LIB_EXPORT CallModel {
void removeConference(Call* call);
void removeCall(Call* call);
MapStringString getHistoryMap();
QStringList getHistory();
//Account related members
static Account* getCurrentAccount();
......
......@@ -72,21 +72,21 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
{
if (!historyInit) {
ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
MapStringString historyMap = configurationManager.getHistory().value();
QStringList historyMap = configurationManager.getHistory().value();
qDebug() << "Call History = " << historyMap;
QMapIterator<QString, QString> i(historyMap);
while (i.hasNext()) {
i.next();
uint startTimeStamp = i.key().toUInt();
QStringList param = i.value().split("|");
QString type2 = param[0];
QString number = param[1];
QString name = param[2];
uint stopTimeStamp = param[3].toUInt();
QString account = param[4];
historyCalls[QString::number(startTimeStamp)] = Call::buildHistoryCall(generateCallId(), startTimeStamp, stopTimeStamp, account, name, number, type2);
addCall(historyCalls[QString::number(startTimeStamp)]);
}
// QMapIterator<QString, QString> i(historyMap);
// while (i.hasNext()) {
// i.next();
// uint startTimeStamp = i.key().toUInt();
// QStringList param = i.value().split("|");
// QString type2 = param[0];
// QString number = param[1];
// QString name = param[2];
// uint stopTimeStamp = param[3].toUInt();
// QString account = param[4];
// historyCalls[QString::number(startTimeStamp)] = Call::buildHistoryCall(generateCallId(), startTimeStamp, stopTimeStamp, account, name, number, type2);
// addCall(historyCalls[QString::number(startTimeStamp)]);
// }
}
historyInit = true;
return true;
......@@ -333,11 +333,11 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
****************************************************************************/
///Return a list of all previous calls
template<typename CallWidget, typename Index> MapStringString CallModel<CallWidget,Index>::getHistoryMap()
template<typename CallWidget, typename Index> QStringList CallModel<CallWidget,Index>::getHistory()
{
MapStringString toReturn;
QStringList toReturn;
foreach(Call* call, historyCalls) {
toReturn[historyCalls.key(call)] = Call::getTypeFromHistoryState(call->getHistoryState()) + "|" + call->getPeerPhoneNumber() + "|" + call->getPeerName() + "|" + call->getStopTimeStamp() + "|" + call->getAccountId();
toReturn << call->getCallId();
}
return toReturn;
}
......
......@@ -89,7 +89,7 @@
<tp:docstring>
</tp:docstring>
</arg>
<annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="MapStringString"/>
<annotation name="com.trolltech.QtDBus.QtTypeName.In1" value="VectorMapStringString"/>
<arg type="aa{ss}" name="credentialInformation" direction="in" tp:type="String_String_Map">
<tp:docstring>
</tp:docstring>
......@@ -140,7 +140,7 @@
<tp:docstring>
</tp:docstring>
</arg>
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/>
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
<arg type="aa{ss}" name="credentialInformation" direction="out">
<tp:docstring>
</tp:docstring>
......@@ -605,7 +605,6 @@
<method name="getHistory" tp:name-for-bindings="getHistory">
<tp:docstring>
</tp:docstring>
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/>
<arg type="as" name="entries" direction="out">
<tp:docstring>
</tp:docstring>
......
......@@ -3,19 +3,23 @@
#include <QtCore/QMetaType>
#include <QtCore/QMap>
#include <QVector>
#include <QtCore/QString>
#include <QtDBus/QtDBus>
typedef QMap<QString, QString> MapStringString;
typedef QMap<QString, int> MapStringInt;
typedef QVector< QMap<QString, QString> > VectorMapStringString;
Q_DECLARE_METATYPE(MapStringString)
Q_DECLARE_METATYPE(MapStringInt)
Q_DECLARE_METATYPE(VectorMapStringString)
inline void registerCommTypes() {
qDBusRegisterMetaType<MapStringString>();
qDBusRegisterMetaType<MapStringInt>();
qDBusRegisterMetaType<VectorMapStringString>();
}
#endif
\ No newline at end of file
......@@ -3,9 +3,11 @@
#include <QtCore/QMetaType>
#include <QtCore/QMap>
#include <QVector>
#include <QtCore/QString>
typedef QMap<QString, QString> MapStringString;
typedef QVector< QMap<QString, QString> > VectorMapStringString;
typedef QMap<QString, int> MapStringInt;
//Mixe from LIB and GCC website
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment