mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
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->invokeToCore([this, value]() { onLimeServerUrlChanged(value); });
|
||||
});
|
||||
mAccountModelConnection->makeConnectToModel(
|
||||
&AccountModel::removed, [this]() { mAccountModelConnection->invokeToCore([this]() { emit removed(); }); });
|
||||
|
||||
// From GUI
|
||||
mAccountModelConnection->makeConnectToCore(&AccountCore::lSetPictureUri, [this](QString uri) {
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ signals:
|
|||
void conferenceFactoryAddressChanged();
|
||||
void audioVideoConferenceFactoryAddressChanged();
|
||||
void limeServerUrlChanged();
|
||||
void removed();
|
||||
|
||||
// Account requests
|
||||
void lSetPictureUri(QString pictureUri);
|
||||
|
|
|
|||
|
|
@ -84,17 +84,6 @@ void AccountList::setSelf(QSharedPointer<AccountList> me) {
|
|||
mModelConnection->makeConnectToModel(&CoreModel::accountAdded, &AccountList::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 {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ signals:
|
|||
void lUpdate();
|
||||
void haveAccountChanged();
|
||||
void defaultAccountChanged();
|
||||
void accountRemoved(bool wasLast);
|
||||
|
||||
private:
|
||||
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::defaultAccountChanged, this, &AccountProxy::resetDefaultAccount);
|
||||
connect(mAccountList.get(), &AccountList::haveAccountChanged, this, &AccountProxy::haveAccountChanged);
|
||||
connect(mAccountList.get(), &AccountList::accountRemoved, this, &AccountProxy::accountRemoved);
|
||||
setSourceModel(mAccountList.get());
|
||||
sort(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ signals:
|
|||
void filterTextChanged();
|
||||
void defaultAccountChanged();
|
||||
void haveAccountChanged();
|
||||
void accountRemoved(bool wasLast);
|
||||
|
||||
protected:
|
||||
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ void AccountModel::setDefault() {
|
|||
|
||||
void AccountModel::removeAccount() {
|
||||
CoreModel::getInstance()->getCore()->removeAccount(mMonitor);
|
||||
emit removed();
|
||||
}
|
||||
|
||||
void AccountModel::resetMissedCallsCount() {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ signals:
|
|||
void conferenceFactoryAddressChanged(QString value);
|
||||
void audioVideoConferenceFactoryAddressChanged(QString value);
|
||||
void limeServerUrlChanged(QString value);
|
||||
void removed();
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ Item {
|
|||
signal openNumPadRequest()
|
||||
signal displayContactRequested(string contactAddress)
|
||||
signal createContactRequested(string name, string address)
|
||||
signal accountRemoved()
|
||||
|
||||
function goToNewCall() {
|
||||
tabbar.currentIndex = 0
|
||||
|
|
@ -570,6 +571,7 @@ Item {
|
|||
id: accountSettingsPageComponent
|
||||
AccountSettingsPage {
|
||||
onGoBack: closeContextualMenuComponent()
|
||||
onAccountRemoved: mainItem.accountRemoved()
|
||||
}
|
||||
}
|
||||
Component {
|
||||
|
|
|
|||
|
|
@ -49,10 +49,6 @@ AppWindow {
|
|||
|
||||
AccountProxy {
|
||||
id: accountProxy
|
||||
onAccountRemoved:function (wasLast) {
|
||||
if (wasLast) mainWindowStackView.replace(loginPage, StackView.Immediate)
|
||||
else mainWindowStackView.replace(mainPage, StackView.Immediate)
|
||||
}
|
||||
}
|
||||
StackView {
|
||||
id: mainWindowStackView
|
||||
|
|
@ -155,6 +151,9 @@ AppWindow {
|
|||
id: mainPage
|
||||
MainLayout {
|
||||
onAddAccountRequest: mainWindowStackView.replace(loginPage)
|
||||
onAccountRemoved: {
|
||||
initStackViewItem()
|
||||
}
|
||||
// StackView.onActivated: connectionSecured(0) // TODO : connect to cpp part when ready
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,13 @@ AbstractMasterDetailPage {
|
|||
titleText: qsTr("Mon compte")
|
||||
property AccountProxy accounts: AccountProxy{id: accountProxy}
|
||||
property AccountGui account: accountProxy.defaultAccount
|
||||
signal accountRemoved()
|
||||
families: [
|
||||
{title: qsTr("Général"), layout: "AccountSettingsGeneralLayout", model: account},
|
||||
{title: qsTr("Paramètres de compte"), layout: "AccountSettingsParametersLayout", model: account}
|
||||
]
|
||||
}
|
||||
Connections {
|
||||
target: account.core
|
||||
onRemoved: accountRemoved()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue