Commit a3dc41ec authored by Ronan's avatar Ronan

fix(app): avoid crash if calls window is disabled

parent 927b1e10
Pipeline #217 failed with stage
in 0 seconds
......@@ -125,8 +125,11 @@ static void cliInitiateConference (QHash<QString, QString> &args) {
const QString id = args["conference-id"];
auto updateCallsWindow = []() {
// TODO: Set the view to the "waiting call view".
QQuickWindow *callsWindow = App::getInstance()->getCallsWindow();
if (!callsWindow)
return;
// TODO: Set the view to the "waiting call view".
if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
......
......@@ -339,12 +339,13 @@ void CallModel::accept (bool withVideo) {
setRecordFile(params);
QQuickWindow *callsWindow = App::getInstance()->getCallsWindow();
if (coreManager->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
if (callsWindow) {
if (coreManager->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
}
mCall->acceptWithParams(params);
}
......
......@@ -230,11 +230,13 @@ bool CallsListModel::removeRows (int row, int count, const QModelIndex &parent)
void CallsListModel::addCall (const shared_ptr<linphone::Call> &call) {
if (call->getDir() == linphone::CallDirOutgoing) {
QQuickWindow *callsWindow = App::getInstance()->getCallsWindow();
if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
if (callsWindow) {
if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
}
}
CallModel *callModel = new CallModel(call);
......
......@@ -69,9 +69,12 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent)
QObject::connect(app->getMainWindow(), &QWindow::activeChanged, this, [this]() {
handleIsActiveChanged(App::getInstance()->getMainWindow());
});
QObject::connect(app->getCallsWindow(), &QWindow::activeChanged, this, [this]() {
handleIsActiveChanged(App::getInstance()->getCallsWindow());
});
QQuickWindow *callsWindow = app->getCallsWindow();
if (callsWindow)
QObject::connect(callsWindow, &QWindow::activeChanged, this, [this, callsWindow]() {
handleIsActiveChanged(callsWindow);
});
}
// -----------------------------------------------------------------------------
......
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