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
Branches
Tags
No related merge requests found
......@@ -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()
{
......@@ -65,9 +57,9 @@ void Account::initAccountItem()
item->setSizeHint(QSize(140,25));
item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled);
bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE;
setItemText(getAccountDetail(ACCOUNT_ALIAS));
itemWidget = new AccountItemWidget();
itemWidget->setEnabled(enabled);
itemWidget->setAccountText(getAccountDetail(ACCOUNT_ALIAS));
if(isNew() || !enabled)
{
itemWidget->setState(AccountItemWidget::Unregistered);
......@@ -153,8 +145,10 @@ AccountItemWidget * Account::getItemWidget()
{
delete itemWidget;
bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE;
QString alias = getAccountDetail(ACCOUNT_ALIAS);
itemWidget = new AccountItemWidget();
itemWidget->setEnabled(enabled);
itemWidget->setAccountText(alias);
if(isNew() || !enabled)
{
itemWidget->setState(AccountItemWidget::Unregistered);
......
......@@ -44,7 +44,6 @@ public:
QString getAlias();
//Setters
void setItemText(QString text);
void initAccountItem();
void setAccountId(QString id);
void setAccountDetails(MapStringString m);
......
......@@ -29,14 +29,16 @@ AccountItemWidget::AccountItemWidget(QWidget *parent)
: QWidget(parent)
{
checkBox = new QCheckBox(this);
//checkbox->setObjectName(QString(ACCOUNT_ITEM_CHECKBOX));
led = new KLed(this);
//led->setObjectName(QString(ACCOUNT_ITEM_LED));
led->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
textLabel = new QLabel();
QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum);
QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0,0,0,0);
hlayout->addWidget(checkBox);
hlayout->addWidget(textLabel);
hlayout->addItem(horizontalSpacer);
hlayout->addWidget(led);
this->setLayout(hlayout);
state = Unregistered;
......@@ -96,6 +98,11 @@ void AccountItemWidget::setEnabled(bool enabled)
//emit enabledChanged;
}
void AccountItemWidget::setAccountText(QString text)
{
this->textLabel->setText(text);
}
bool AccountItemWidget::getEnabled()
{
return checkBox->checkState();
......
......@@ -23,6 +23,7 @@
#include <QWidget>
#include <QCheckBox>
#include <QLabel>
#include <kled.h>
/**
......@@ -38,6 +39,7 @@ private:
bool enabled;
KLed * led;
QCheckBox * checkBox;
QLabel * textLabel;
public:
......@@ -51,6 +53,8 @@ public:
void setEnabled(bool enabled);
void setAccountText(QString text);
void updateStateDisplay();
void updateEnabledDisplay();
......
......@@ -419,7 +419,7 @@ void ConfigurationDialog::saveAccount(QListWidgetItem * item)
if(! item) { qDebug() << "Attempting to save details of an account from a NULL item"; return; }
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());
QString protocolsTab[] = ACCOUNT_TYPES_TAB;
......@@ -429,7 +429,6 @@ void ConfigurationDialog::saveAccount(QListWidgetItem * item)
account->setAccountDetail(ACCOUNT_PASSWORD, edit5_password->text());
account->setAccountDetail(ACCOUNT_MAILBOX, edit6_mailbox->text());
account->setAccountDetail(ACCOUNT_ENABLED, account->isChecked() ? ACCOUNT_ENABLED_TRUE : ACCOUNT_ENABLED_FALSE);
account->setItemText(edit1_alias->text());
}
void ConfigurationDialog::addAccountToAccountList(Account * account)
......@@ -557,8 +556,8 @@ void ConfigurationDialog::updateCodecListCommands()
void ConfigurationDialog::on_edit1_alias_textChanged(const QString & text)
{
qDebug() << "on_edit1_alias_textChanged";
Account * account = accountList->getAccountByItem(listWidget_accountList->currentItem());
account->setItemText(text);
AccountItemWidget * widget = (AccountItemWidget *) listWidget_accountList->itemWidget(listWidget_accountList->currentItem());
widget->setAccountText(text);
}
void ConfigurationDialog::on_spinBox_SIPPort_valueChanged ( int value )
......@@ -667,8 +666,12 @@ void ConfigurationDialog::on_button_accountRemove_clicked()
void ConfigurationDialog::on_toolButton_accountsApply_clicked()
{
qDebug() << "on_toolButton_accountsApply_clicked";
toolButton_accountsApply->setEnabled(false);
saveAccountList();
loadAccountList();
qDebug() << "setEnabled1";
toolButton_accountsApply->setEnabled(true);
qDebug() << "setEnabled2";
}
......
......@@ -20,6 +20,10 @@
<property name="windowTitle">
<string>Configuration Dialog</string>
</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">
<property name="margin">
<number>1</number>
......@@ -661,6 +665,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButton_accountsApply">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Apply</string>
</property>
......
......@@ -21,7 +21,6 @@
#include "instance_interface_singleton.h"
InstanceInterface * InstanceInterfaceSingleton::interface
= new InstanceInterface(
"org.sflphone.SFLphone",
......
......@@ -542,7 +542,7 @@
<action name="action_configureSflPhone">
<property name="icon">
<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 name="text">
<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