Skip to content
Snippets Groups Projects
Commit 9b310ea1 authored by Jérémy Quentin's avatar Jérémy Quentin
Browse files

put account alias in AccountWidgetItem rather than in the item with " " before.

parent d1e1ac63
No related branches found
No related tags found
No related merge requests found
...@@ -49,14 +49,6 @@ Account::Account(QString & _accountId, MapStringString & _accountDetails, accoun ...@@ -49,14 +49,6 @@ Account::Account(QString & _accountId, MapStringString & _accountDetails, accoun
} }
*/ */
/**
* Sets text of the item associated with some spaces to avoid writing under checkbox.
* @param text the text to set in the item
*/
void Account::setItemText(QString text)
{
item->setText(" " + text);
}
void Account::initAccountItem() void Account::initAccountItem()
{ {
...@@ -65,9 +57,9 @@ void Account::initAccountItem() ...@@ -65,9 +57,9 @@ void Account::initAccountItem()
item->setSizeHint(QSize(140,25)); item->setSizeHint(QSize(140,25));
item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled); item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled);
bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE; bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE;
setItemText(getAccountDetail(ACCOUNT_ALIAS));
itemWidget = new AccountItemWidget(); itemWidget = new AccountItemWidget();
itemWidget->setEnabled(enabled); itemWidget->setEnabled(enabled);
itemWidget->setAccountText(getAccountDetail(ACCOUNT_ALIAS));
if(isNew() || !enabled) if(isNew() || !enabled)
{ {
itemWidget->setState(AccountItemWidget::Unregistered); itemWidget->setState(AccountItemWidget::Unregistered);
...@@ -153,8 +145,10 @@ AccountItemWidget * Account::getItemWidget() ...@@ -153,8 +145,10 @@ AccountItemWidget * Account::getItemWidget()
{ {
delete itemWidget; delete itemWidget;
bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE; bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE;
QString alias = getAccountDetail(ACCOUNT_ALIAS);
itemWidget = new AccountItemWidget(); itemWidget = new AccountItemWidget();
itemWidget->setEnabled(enabled); itemWidget->setEnabled(enabled);
itemWidget->setAccountText(alias);
if(isNew() || !enabled) if(isNew() || !enabled)
{ {
itemWidget->setState(AccountItemWidget::Unregistered); itemWidget->setState(AccountItemWidget::Unregistered);
......
...@@ -44,7 +44,6 @@ public: ...@@ -44,7 +44,6 @@ public:
QString getAlias(); QString getAlias();
//Setters //Setters
void setItemText(QString text);
void initAccountItem(); void initAccountItem();
void setAccountId(QString id); void setAccountId(QString id);
void setAccountDetails(MapStringString m); void setAccountDetails(MapStringString m);
......
...@@ -29,14 +29,16 @@ AccountItemWidget::AccountItemWidget(QWidget *parent) ...@@ -29,14 +29,16 @@ AccountItemWidget::AccountItemWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
checkBox = new QCheckBox(this); checkBox = new QCheckBox(this);
//checkbox->setObjectName(QString(ACCOUNT_ITEM_CHECKBOX));
led = new KLed(this); led = new KLed(this);
//led->setObjectName(QString(ACCOUNT_ITEM_LED));
led->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); led->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
textLabel = new QLabel();
QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum);
QHBoxLayout* hlayout = new QHBoxLayout(); QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0,0,0,0); hlayout->setContentsMargins(0,0,0,0);
hlayout->addWidget(checkBox); hlayout->addWidget(checkBox);
hlayout->addWidget(textLabel);
hlayout->addItem(horizontalSpacer);
hlayout->addWidget(led); hlayout->addWidget(led);
this->setLayout(hlayout); this->setLayout(hlayout);
state = Unregistered; state = Unregistered;
...@@ -96,6 +98,11 @@ void AccountItemWidget::setEnabled(bool enabled) ...@@ -96,6 +98,11 @@ void AccountItemWidget::setEnabled(bool enabled)
//emit enabledChanged; //emit enabledChanged;
} }
void AccountItemWidget::setAccountText(QString text)
{
this->textLabel->setText(text);
}
bool AccountItemWidget::getEnabled() bool AccountItemWidget::getEnabled()
{ {
return checkBox->checkState(); return checkBox->checkState();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <QWidget> #include <QWidget>
#include <QCheckBox> #include <QCheckBox>
#include <QLabel>
#include <kled.h> #include <kled.h>
/** /**
...@@ -38,6 +39,7 @@ private: ...@@ -38,6 +39,7 @@ private:
bool enabled; bool enabled;
KLed * led; KLed * led;
QCheckBox * checkBox; QCheckBox * checkBox;
QLabel * textLabel;
public: public:
...@@ -51,6 +53,8 @@ public: ...@@ -51,6 +53,8 @@ public:
void setEnabled(bool enabled); void setEnabled(bool enabled);
void setAccountText(QString text);
void updateStateDisplay(); void updateStateDisplay();
void updateEnabledDisplay(); void updateEnabledDisplay();
......
...@@ -419,7 +419,7 @@ void ConfigurationDialog::saveAccount(QListWidgetItem * item) ...@@ -419,7 +419,7 @@ void ConfigurationDialog::saveAccount(QListWidgetItem * item)
if(! item) { qDebug() << "Attempting to save details of an account from a NULL item"; return; } if(! item) { qDebug() << "Attempting to save details of an account from a NULL item"; return; }
Account * account = accountList->getAccountByItem(item); Account * account = accountList->getAccountByItem(item);
if(! account) { qDebug() << "Attempting to save details of an unexisting account : " << item->text() << " accounts are "<< accountList; return; } if(! account) { qDebug() << "Attempting to save details of an unexisting account : " << item->text(); return; }
account->setAccountDetail(ACCOUNT_ALIAS, edit1_alias->text()); account->setAccountDetail(ACCOUNT_ALIAS, edit1_alias->text());
QString protocolsTab[] = ACCOUNT_TYPES_TAB; QString protocolsTab[] = ACCOUNT_TYPES_TAB;
...@@ -429,7 +429,6 @@ void ConfigurationDialog::saveAccount(QListWidgetItem * item) ...@@ -429,7 +429,6 @@ void ConfigurationDialog::saveAccount(QListWidgetItem * item)
account->setAccountDetail(ACCOUNT_PASSWORD, edit5_password->text()); account->setAccountDetail(ACCOUNT_PASSWORD, edit5_password->text());
account->setAccountDetail(ACCOUNT_MAILBOX, edit6_mailbox->text()); account->setAccountDetail(ACCOUNT_MAILBOX, edit6_mailbox->text());
account->setAccountDetail(ACCOUNT_ENABLED, account->isChecked() ? ACCOUNT_ENABLED_TRUE : ACCOUNT_ENABLED_FALSE); account->setAccountDetail(ACCOUNT_ENABLED, account->isChecked() ? ACCOUNT_ENABLED_TRUE : ACCOUNT_ENABLED_FALSE);
account->setItemText(edit1_alias->text());
} }
void ConfigurationDialog::addAccountToAccountList(Account * account) void ConfigurationDialog::addAccountToAccountList(Account * account)
...@@ -557,8 +556,8 @@ void ConfigurationDialog::updateCodecListCommands() ...@@ -557,8 +556,8 @@ void ConfigurationDialog::updateCodecListCommands()
void ConfigurationDialog::on_edit1_alias_textChanged(const QString & text) void ConfigurationDialog::on_edit1_alias_textChanged(const QString & text)
{ {
qDebug() << "on_edit1_alias_textChanged"; qDebug() << "on_edit1_alias_textChanged";
Account * account = accountList->getAccountByItem(listWidget_accountList->currentItem()); AccountItemWidget * widget = (AccountItemWidget *) listWidget_accountList->itemWidget(listWidget_accountList->currentItem());
account->setItemText(text); widget->setAccountText(text);
} }
void ConfigurationDialog::on_spinBox_SIPPort_valueChanged ( int value ) void ConfigurationDialog::on_spinBox_SIPPort_valueChanged ( int value )
...@@ -667,8 +666,12 @@ void ConfigurationDialog::on_button_accountRemove_clicked() ...@@ -667,8 +666,12 @@ void ConfigurationDialog::on_button_accountRemove_clicked()
void ConfigurationDialog::on_toolButton_accountsApply_clicked() void ConfigurationDialog::on_toolButton_accountsApply_clicked()
{ {
qDebug() << "on_toolButton_accountsApply_clicked"; qDebug() << "on_toolButton_accountsApply_clicked";
toolButton_accountsApply->setEnabled(false);
saveAccountList(); saveAccountList();
loadAccountList(); loadAccountList();
qDebug() << "setEnabled1";
toolButton_accountsApply->setEnabled(true);
qDebug() << "setEnabled2";
} }
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Configuration Dialog</string> <string>Configuration Dialog</string>
</property> </property>
<property name="windowIcon">
<iconset resource="resources.qrc">
<normaloff>:/images/icons/sflphone.svg</normaloff>:/images/icons/sflphone.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="margin"> <property name="margin">
<number>1</number> <number>1</number>
...@@ -661,6 +665,9 @@ ...@@ -661,6 +665,9 @@
</item> </item>
<item> <item>
<widget class="QToolButton" name="toolButton_accountsApply"> <widget class="QToolButton" name="toolButton_accountsApply">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text"> <property name="text">
<string>Apply</string> <string>Apply</string>
</property> </property>
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "instance_interface_singleton.h" #include "instance_interface_singleton.h"
InstanceInterface * InstanceInterfaceSingleton::interface InstanceInterface * InstanceInterfaceSingleton::interface
= new InstanceInterface( = new InstanceInterface(
"org.sflphone.SFLphone", "org.sflphone.SFLphone",
......
...@@ -542,7 +542,7 @@ ...@@ -542,7 +542,7 @@
<action name="action_configureSflPhone"> <action name="action_configureSflPhone">
<property name="icon"> <property name="icon">
<iconset resource="resources.qrc"> <iconset resource="resources.qrc">
<normaloff>:/images/icons/sflphone.png</normaloff>:/images/icons/sflphone.png</iconset> <normaloff>:/images/icons/sflphone.svg</normaloff>:/images/icons/sflphone.svg</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Configure SFLPhone</string> <string>&amp;Configure SFLPhone</string>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment