mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
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:
parent
e055052bf3
commit
b0a1d2029a
2 changed files with 15 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue