dialer: don't fail when SIM account is not present

While dial functions are not working when SIM account is not present it
is perfectly valid to open dialer to check e.g. Call history.
This commit is contained in:
Bhushan Shah 2020-03-12 13:00:27 +05:30 committed by Bhushan Shah
parent e055052bf3
commit b0a1d2029a
2 changed files with 15 additions and 8 deletions

View file

@ -38,6 +38,10 @@ DialerUtils::DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent)
m_callDuration(0),
m_callContactAlias(QString())
{
if (!m_simAccount) {
return;
}
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
connect(op, &Tp::PendingOperation::finished, [=](){
@ -56,13 +60,17 @@ void DialerUtils::dial(const QString &number)
{
// FIXME: this should be replaced by kpeople thing
qDebug() << "Starting call...";
Tp::PendingChannelRequest *pendingChannel = m_simAccount->ensureAudioCall(number);
connect(pendingChannel, &Tp::PendingChannelRequest::finished, pendingChannel, [=](){
if (pendingChannel->isError()) {
qWarning() << "Error when requesting channel" << pendingChannel->errorMessage();
setCallState("failed");
}
});
if (m_simAccount) {
Tp::PendingChannelRequest *pendingChannel = m_simAccount->ensureAudioCall(number);
connect(pendingChannel, &Tp::PendingChannelRequest::finished, pendingChannel, [=](){
if (pendingChannel->isError()) {
qWarning() << "Error when requesting channel" << pendingChannel->errorMessage();
setCallState("failed");
}
});
} else {
setCallState("failed");
}
}
QString DialerUtils::callState() const

View file

@ -165,7 +165,6 @@ int main(int argc, char **argv)
if (simAccount.isNull()) {
qCritical() << "Unable to get SIM account";
return -1;
}
QQmlApplicationEngine engine;