mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-01 09:18:07 +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_callDuration(0),
|
||||||
m_callContactAlias(QString())
|
m_callContactAlias(QString())
|
||||||
{
|
{
|
||||||
|
if (!m_simAccount) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
|
Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore);
|
||||||
|
|
||||||
connect(op, &Tp::PendingOperation::finished, [=](){
|
connect(op, &Tp::PendingOperation::finished, [=](){
|
||||||
|
|
@ -56,13 +60,17 @@ void DialerUtils::dial(const QString &number)
|
||||||
{
|
{
|
||||||
// FIXME: this should be replaced by kpeople thing
|
// FIXME: this should be replaced by kpeople thing
|
||||||
qDebug() << "Starting call...";
|
qDebug() << "Starting call...";
|
||||||
Tp::PendingChannelRequest *pendingChannel = m_simAccount->ensureAudioCall(number);
|
if (m_simAccount) {
|
||||||
connect(pendingChannel, &Tp::PendingChannelRequest::finished, pendingChannel, [=](){
|
Tp::PendingChannelRequest *pendingChannel = m_simAccount->ensureAudioCall(number);
|
||||||
if (pendingChannel->isError()) {
|
connect(pendingChannel, &Tp::PendingChannelRequest::finished, pendingChannel, [=](){
|
||||||
qWarning() << "Error when requesting channel" << pendingChannel->errorMessage();
|
if (pendingChannel->isError()) {
|
||||||
setCallState("failed");
|
qWarning() << "Error when requesting channel" << pendingChannel->errorMessage();
|
||||||
}
|
setCallState("failed");
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setCallState("failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DialerUtils::callState() const
|
QString DialerUtils::callState() const
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,6 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (simAccount.isNull()) {
|
if (simAccount.isNull()) {
|
||||||
qCritical() << "Unable to get SIM account";
|
qCritical() << "Unable to get SIM account";
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue