Commit 32bb5e92 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to update address

parent 0d271254
......@@ -37,10 +37,10 @@ public:
KContacts::Address::List addresses() const;
void setAddresses(const KContacts::Address::List &addresses);
void setReadOnly(bool readOnly);
void replaceAddress(const KContacts::Address &address, int index);
public Q_SLOTS:
void addAddress(const KContacts::Address &address);
void replaceAddress(const KContacts::Address &address, int index);
private Q_SLOTS:
void slotLinkClicked(const QUrl &url);
......
......@@ -38,6 +38,7 @@ AddressesLocationWidget::AddressesLocationWidget(QWidget *parent)
addWidget(mAddressesLocationViewer);
connect(mAddressesLocationViewer, &AddressesLocationViewer::modifyAddress, mAddressLocationWidget, &AddressLocationWidget::slotModifyAddress);
connect(mAddressLocationWidget, &AddressLocationWidget::addNewAddress, mAddressesLocationViewer, &AddressesLocationViewer::addAddress);
connect(mAddressLocationWidget, &AddressLocationWidget::updateAddress, mAddressesLocationViewer, &AddressesLocationViewer::replaceAddress);
}
AddressesLocationWidget::~AddressesLocationWidget()
......
......@@ -140,9 +140,11 @@ AddressLocationWidget::AddressLocationWidget(QWidget *parent)
mModifyAddress = new QPushButton(i18n("Update Address"), this);
mModifyAddress->setObjectName(QStringLiteral("modifybuttonaddress"));
modifyButtonWidgetLayout->addWidget(mModifyAddress);
connect(mModifyAddress, &QPushButton::clicked, this, &AddressLocationWidget::slotUpdateAddress);
mCancelAddress = new QPushButton(i18n("Cancel"), this);
mCancelAddress->setObjectName(QStringLiteral("cancelbuttonaddress"));
connect(mCancelAddress, &QPushButton::clicked, this, &AddressLocationWidget::slotCancelModifyAddress);
modifyButtonWidgetLayout->addWidget(mCancelAddress);
modifyButtonWidgetLayout->addStretch(1);
......@@ -269,3 +271,16 @@ void AddressLocationWidget::clear()
switchMode();
//TODO
}
void AddressLocationWidget::slotUpdateAddress()
{
if (mCurrentMode == ModifyAddress) {
Q_EMIT updateAddress(address(), mCurrentAddress);
clear();
}
}
void AddressLocationWidget::slotCancelModifyAddress()
{
clear();
}
......@@ -55,9 +55,12 @@ public:
Q_SIGNALS:
void addNewAddress(const KContacts::Address &address);
void updateAddress(const KContacts::Address &address, int index);
private Q_SLOTS:
void slotAddAddress();
void slotUpdateAddress();
void slotCancelModifyAddress();
private:
void fillCountryCombo();
......
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