diff --git a/linphone-app/src/app/providers/ExternalImageProvider.cpp b/linphone-app/src/app/providers/ExternalImageProvider.cpp index 76961e61c..12e33821e 100644 --- a/linphone-app/src/app/providers/ExternalImageProvider.cpp +++ b/linphone-app/src/app/providers/ExternalImageProvider.cpp @@ -36,14 +36,7 @@ ExternalImageProvider::ExternalImageProvider () : QQuickImageProvider( } QImage ExternalImageProvider::requestImage (const QString &id, QSize *size, const QSize &) { - QImage image(id); - if(image.isNull()){// Try to determine format from headers instead of using suffix - QImageReader reader(id); - reader.setDecideFormatFromContent(true); - QByteArray format = reader.format(); - if(!format.isEmpty()) - image = QImage(id, format); - } + QImage image(Utils::getImage(id)); *size = image.size(); return image; } diff --git a/linphone-app/src/components/notifier/Notifier.cpp b/linphone-app/src/components/notifier/Notifier.cpp index b3cb6458c..77fd6d4da 100644 --- a/linphone-app/src/components/notifier/Notifier.cpp +++ b/linphone-app/src/components/notifier/Notifier.cpp @@ -278,6 +278,10 @@ void Notifier::notifyReceivedMessage (const shared_ptr &m void Notifier::notifyReceivedFileMessage (const shared_ptr &message) { QVariantMap map; map["fileUri"] = Utils::coreStringToAppString(message->getFileTransferInformation()->getFilePath()); + if( Utils::getImage(map["fileUri"].toString()).isNull()) + map["imageUri"] = ""; + else + map["imageUri"] = map["fileUri"]; map["fileSize"] = quint64(message->getFileTransferInformation()->getSize() +message->getFileTransferInformation()->getFileSize()); CREATE_NOTIFICATION(Notifier::ReceivedFileMessage, map) } diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 6d4ae64e7..657ccbd79 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -69,7 +69,12 @@ shared_ptr AccountSettingsModel::getUsedSipAddress () c shared_ptr core = CoreManager::getInstance()->getCore(); shared_ptr proxyConfig = core->getDefaultProxyConfig(); - return proxyConfig ? proxyConfig->getIdentityAddress() : core->createPrimaryContactParsed(); + if( !proxyConfig){ + shared_ptr addr = core->createPrimaryContactParsed(); + addr->setPort(0); + return std::move(addr); + }else + return proxyConfig->getIdentityAddress(); } void AccountSettingsModel::setUsedSipAddress (const shared_ptr &address) { diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index 0a765e68d..817a97c38 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -304,10 +304,6 @@ void SipAddressesModel::handleCallStateChanged ( const shared_ptr &call, linphone::Call::State state ) { - // Ignore aborted calls. - if (call->getCallLog()->getStatus() == linphone::Call::Status::Aborted) - return; - if (state == linphone::Call::State::End || state == linphone::Call::State::Error) addOrUpdateSipAddress( Utils::coreStringToAppString(call->getRemoteAddress()->asStringUriOnly()), call diff --git a/linphone-app/src/utils/Utils.cpp b/linphone-app/src/utils/Utils.cpp index b8cc27fed..2a5c14085 100644 --- a/linphone-app/src/utils/Utils.cpp +++ b/linphone-app/src/utils/Utils.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "Utils.hpp" @@ -47,7 +48,17 @@ char *Utils::rstrstr (const char *a, const char *b) { } // ----------------------------------------------------------------------------- - +QImage Utils::getImage(const QString &pUri) { + QImage image(pUri); + if(image.isNull()){// Try to determine format from headers instead of using suffix + QImageReader reader(pUri); + reader.setDecideFormatFromContent(true); + QByteArray format = reader.format(); + if(!format.isEmpty()) + image = QImage(pUri, format); + } + return image; +} QString Utils::getSafeFilePath (const QString &filePath, bool *soFarSoGood) { if (soFarSoGood) *soFarSoGood = true; diff --git a/linphone-app/src/utils/Utils.hpp b/linphone-app/src/utils/Utils.hpp index cdc4b6044..299f01924 100644 --- a/linphone-app/src/utils/Utils.hpp +++ b/linphone-app/src/utils/Utils.hpp @@ -24,6 +24,8 @@ #include #include #include +#include + // ============================================================================= @@ -50,7 +52,8 @@ namespace Utils { // Reverse function of strstr. char *rstrstr (const char *a, const char *b); - + // Return the path if it is an image else an empty path. + QImage getImage(const QString &pUri); // Returns the same path given in parameter if `filePath` exists. // Otherwise returns a safe path with a unique number before the extension. QString getSafeFilePath (const QString &filePath, bool *soFarSoGood = nullptr); diff --git a/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml b/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml index 56dbe2af0..a35661038 100644 --- a/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml +++ b/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedFileMessage.qml @@ -16,6 +16,7 @@ Notification { // --------------------------------------------------------------------------- readonly property string fileUri: notificationData && notificationData.fileUri || '' + readonly property string imageUri: notificationData && notificationData.imageUri || '' // --------------------------------------------------------------------------- @@ -46,7 +47,7 @@ Notification { Layout.fillHeight: true Layout.fillWidth: true fillMode: Image.PreserveAspectFit - source: "image://external/"+notification.fileUri + source: (imageUri ?"image://external/"+notification.imageUri : '') visible: image.status == Image.Ready }