Add account removed signal emission/handling in account core/model
This commit is contained in:
parent
08a822991b
commit
34f559b7d7
11 changed files with 16 additions and 19 deletions
|
|
@ -172,6 +172,8 @@ void AccountCore::setSelf(QSharedPointer<AccountCore> me) {
|
||||||
mAccountModelConnection->makeConnectToModel(&AccountModel::limeServerUrlChanged, [this](QString value) {
|
mAccountModelConnection->makeConnectToModel(&AccountModel::limeServerUrlChanged, [this](QString value) {
|
||||||
mAccountModelConnection->invokeToCore([this, value]() { onLimeServerUrlChanged(value); });
|
mAccountModelConnection->invokeToCore([this, value]() { onLimeServerUrlChanged(value); });
|
||||||
});
|
});
|
||||||
|
mAccountModelConnection->makeConnectToModel(
|
||||||
|
&AccountModel::removed, [this]() { mAccountModelConnection->invokeToCore([this]() { emit removed(); }); });
|
||||||
|
|
||||||
// From GUI
|
// From GUI
|
||||||
mAccountModelConnection->makeConnectToCore(&AccountCore::lSetPictureUri, [this](QString uri) {
|
mAccountModelConnection->makeConnectToCore(&AccountCore::lSetPictureUri, [this](QString uri) {
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@ signals:
|
||||||
void conferenceFactoryAddressChanged();
|
void conferenceFactoryAddressChanged();
|
||||||
void audioVideoConferenceFactoryAddressChanged();
|
void audioVideoConferenceFactoryAddressChanged();
|
||||||
void limeServerUrlChanged();
|
void limeServerUrlChanged();
|
||||||
|
void removed();
|
||||||
|
|
||||||
// Account requests
|
// Account requests
|
||||||
void lSetPictureUri(QString pictureUri);
|
void lSetPictureUri(QString pictureUri);
|
||||||
|
|
|
||||||
|
|
@ -84,17 +84,6 @@ void AccountList::setSelf(QSharedPointer<AccountList> me) {
|
||||||
mModelConnection->makeConnectToModel(&CoreModel::accountAdded, &AccountList::lUpdate);
|
mModelConnection->makeConnectToModel(&CoreModel::accountAdded, &AccountList::lUpdate);
|
||||||
|
|
||||||
lUpdate();
|
lUpdate();
|
||||||
|
|
||||||
mModelConnection->makeConnectToModel(
|
|
||||||
&CoreModel::accountRemoved,
|
|
||||||
[this](const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::Account> &account) {
|
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
|
||||||
bool wasLast = CoreModel::getInstance()->getCore()->getAccountList().size() == 0;
|
|
||||||
mModelConnection->invokeToCore([this, wasLast]() {
|
|
||||||
mustBeInMainThread(log().arg(Q_FUNC_INFO));
|
|
||||||
emit accountRemoved(wasLast);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<AccountCore> AccountList::getDefaultAccountCore() const {
|
QSharedPointer<AccountCore> AccountList::getDefaultAccountCore() const {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ signals:
|
||||||
void lUpdate();
|
void lUpdate();
|
||||||
void haveAccountChanged();
|
void haveAccountChanged();
|
||||||
void defaultAccountChanged();
|
void defaultAccountChanged();
|
||||||
void accountRemoved(bool wasLast);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mHaveAccount = false;
|
bool mHaveAccount = false;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ AccountProxy::AccountProxy(QObject *parent) : SortFilterProxy(parent) {
|
||||||
connect(mAccountList.get(), &AccountList::countChanged, this, &AccountProxy::resetDefaultAccount);
|
connect(mAccountList.get(), &AccountList::countChanged, this, &AccountProxy::resetDefaultAccount);
|
||||||
connect(mAccountList.get(), &AccountList::defaultAccountChanged, this, &AccountProxy::resetDefaultAccount);
|
connect(mAccountList.get(), &AccountList::defaultAccountChanged, this, &AccountProxy::resetDefaultAccount);
|
||||||
connect(mAccountList.get(), &AccountList::haveAccountChanged, this, &AccountProxy::haveAccountChanged);
|
connect(mAccountList.get(), &AccountList::haveAccountChanged, this, &AccountProxy::haveAccountChanged);
|
||||||
connect(mAccountList.get(), &AccountList::accountRemoved, this, &AccountProxy::accountRemoved);
|
|
||||||
setSourceModel(mAccountList.get());
|
setSourceModel(mAccountList.get());
|
||||||
sort(0);
|
sort(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ signals:
|
||||||
void filterTextChanged();
|
void filterTextChanged();
|
||||||
void defaultAccountChanged();
|
void defaultAccountChanged();
|
||||||
void haveAccountChanged();
|
void haveAccountChanged();
|
||||||
void accountRemoved(bool wasLast);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ void AccountModel::setDefault() {
|
||||||
|
|
||||||
void AccountModel::removeAccount() {
|
void AccountModel::removeAccount() {
|
||||||
CoreModel::getInstance()->getCore()->removeAccount(mMonitor);
|
CoreModel::getInstance()->getCore()->removeAccount(mMonitor);
|
||||||
|
emit removed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountModel::resetMissedCallsCount() {
|
void AccountModel::resetMissedCallsCount() {
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ signals:
|
||||||
void conferenceFactoryAddressChanged(QString value);
|
void conferenceFactoryAddressChanged(QString value);
|
||||||
void audioVideoConferenceFactoryAddressChanged(QString value);
|
void audioVideoConferenceFactoryAddressChanged(QString value);
|
||||||
void limeServerUrlChanged(QString value);
|
void limeServerUrlChanged(QString value);
|
||||||
|
void removed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_ABSTRACT_OBJECT
|
DECLARE_ABSTRACT_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ Item {
|
||||||
signal openNumPadRequest()
|
signal openNumPadRequest()
|
||||||
signal displayContactRequested(string contactAddress)
|
signal displayContactRequested(string contactAddress)
|
||||||
signal createContactRequested(string name, string address)
|
signal createContactRequested(string name, string address)
|
||||||
|
signal accountRemoved()
|
||||||
|
|
||||||
function goToNewCall() {
|
function goToNewCall() {
|
||||||
tabbar.currentIndex = 0
|
tabbar.currentIndex = 0
|
||||||
|
|
@ -570,6 +571,7 @@ Item {
|
||||||
id: accountSettingsPageComponent
|
id: accountSettingsPageComponent
|
||||||
AccountSettingsPage {
|
AccountSettingsPage {
|
||||||
onGoBack: closeContextualMenuComponent()
|
onGoBack: closeContextualMenuComponent()
|
||||||
|
onAccountRemoved: mainItem.accountRemoved()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
|
|
|
||||||
|
|
@ -49,10 +49,6 @@ AppWindow {
|
||||||
|
|
||||||
AccountProxy {
|
AccountProxy {
|
||||||
id: accountProxy
|
id: accountProxy
|
||||||
onAccountRemoved:function (wasLast) {
|
|
||||||
if (wasLast) mainWindowStackView.replace(loginPage, StackView.Immediate)
|
|
||||||
else mainWindowStackView.replace(mainPage, StackView.Immediate)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
StackView {
|
StackView {
|
||||||
id: mainWindowStackView
|
id: mainWindowStackView
|
||||||
|
|
@ -155,6 +151,9 @@ AppWindow {
|
||||||
id: mainPage
|
id: mainPage
|
||||||
MainLayout {
|
MainLayout {
|
||||||
onAddAccountRequest: mainWindowStackView.replace(loginPage)
|
onAddAccountRequest: mainWindowStackView.replace(loginPage)
|
||||||
|
onAccountRemoved: {
|
||||||
|
initStackViewItem()
|
||||||
|
}
|
||||||
// StackView.onActivated: connectionSecured(0) // TODO : connect to cpp part when ready
|
// StackView.onActivated: connectionSecured(0) // TODO : connect to cpp part when ready
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,13 @@ AbstractMasterDetailPage {
|
||||||
titleText: qsTr("Mon compte")
|
titleText: qsTr("Mon compte")
|
||||||
property AccountProxy accounts: AccountProxy{id: accountProxy}
|
property AccountProxy accounts: AccountProxy{id: accountProxy}
|
||||||
property AccountGui account: accountProxy.defaultAccount
|
property AccountGui account: accountProxy.defaultAccount
|
||||||
|
signal accountRemoved()
|
||||||
families: [
|
families: [
|
||||||
{title: qsTr("Général"), layout: "AccountSettingsGeneralLayout", model: account},
|
{title: qsTr("Général"), layout: "AccountSettingsGeneralLayout", model: account},
|
||||||
{title: qsTr("Paramètres de compte"), layout: "AccountSettingsParametersLayout", model: account}
|
{title: qsTr("Paramètres de compte"), layout: "AccountSettingsParametersLayout", model: account}
|
||||||
]
|
]
|
||||||
|
Connections {
|
||||||
|
target: account.core
|
||||||
|
onRemoved: accountRemoved()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue