Commit b0a1d202 authored by Bhushan Shah's avatar Bhushan Shah 📱 Committed by Bhushan Shah

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