Commit 426c7be8 authored by Andreas Traczyk's avatar Andreas Traczyk

accounts: connect voicemail signals to selected account

Change-Id: I3c3902bb4875a54e3de796565a374315e8f6425a
parent a0b4139c
......@@ -64,27 +64,14 @@ CurrentAccountComboBox::CurrentAccountComboBox(QWidget* parent)
});
// voicemail received
connect(LRCInstance::getCurrentCallModel(), &lrc::api::NewCallModel::voiceMailNotify,
[this] (const std::string& accountId, int newCount, int oldCount, int urgentCount) {
Q_UNUSED(urgentCount);
voicemailMap_[accountId] = std::make_pair(newCount, oldCount);
if (LRCInstance::accountModel().getAccountList()[currentIndex()] == accountId) {
if (newCount == 0 && oldCount == 0) {
voicemailButton_.setNeedToShowNotify(false);
voicemailButton_.setEnabled(false);
return;
}
if (newCount == 0) {
voicemailButton_.setNotifyNumber(oldCount);
voicemailButton_.setGreyStyleNotification(true);
} else {
voicemailButton_.setNotifyNumber(newCount);
voicemailButton_.setGreyStyleNotification(false);
if (LRCInstance::accountModel().getAccountList().size()) {
connectVoiceMail();
}
voicemailButton_.setNeedToShowNotify(true);
voicemailButton_.setEnabled(true);
}
});
connect(&LRCInstance::instance(),
&LRCInstance::accountListChanged,
this, &CurrentAccountComboBox::connectVoiceMail,
Qt::UniqueConnection);
connect(&voicemailButton_, &QAbstractButton::clicked,
[this] {
......@@ -230,6 +217,32 @@ CurrentAccountComboBox::setupVoicemailButton()
voicemailSize_ + 2 * voicemailBorder_);
}
void
CurrentAccountComboBox::connectVoiceMail()
{
connect(LRCInstance::getCurrentCallModel(), &lrc::api::NewCallModel::voiceMailNotify,
[this](const std::string& accountId, int newCount, int oldCount, int urgentCount) {
Q_UNUSED(urgentCount);
voicemailMap_[accountId] = std::make_pair(newCount, oldCount);
if (LRCInstance::accountModel().getAccountList()[currentIndex()] == accountId) {
if (newCount == 0 && oldCount == 0) {
voicemailButton_.setNeedToShowNotify(false);
voicemailButton_.setEnabled(false);
return;
}
if (newCount == 0) {
voicemailButton_.setNotifyNumber(oldCount);
voicemailButton_.setGreyStyleNotification(true);
} else {
voicemailButton_.setNotifyNumber(newCount);
voicemailButton_.setGreyStyleNotification(false);
}
voicemailButton_.setNeedToShowNotify(true);
voicemailButton_.setEnabled(true);
}
});
}
// import account background account pixmap and scale pixmap to fit in label
void
CurrentAccountComboBox::importLabelPhoto(int index)
......
......@@ -59,6 +59,7 @@ protected:
void hidePopup();
private:
void connectVoiceMail();
void importLabelPhoto(int index);
void setupSettingsButton();
void setupVoicemailButton();
......
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