Fix UTF8 for Windows on file transfert

This commit is contained in:
Julien Wadel 2021-09-01 18:34:54 +02:00
parent 67c75e4595
commit 776987c0e0
8 changed files with 14 additions and 14 deletions

View file

@ -75,7 +75,7 @@ quint64 ContentModel::getFileSize() const{
}
QString ContentModel::getName() const{
return Utils::coreStringToAppString(mContent->getName());
return QString::fromStdString(mContent->getName());
}
QString ContentModel::getThumbnail() const{
@ -125,10 +125,10 @@ void ContentModel::createThumbnail () {
QString id;
QString path = Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getFileTransferInformation()->getFilePath());
auto appdata = ChatMessageModel::AppDataManager(Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getAppdata()));
auto appdata = ChatMessageModel::AppDataManager(QString::fromStdString(mChatMessageModel->getChatMessage()->getAppdata()));
if(!appdata.mData.contains(path)
|| !QFileInfo(Utils::coreStringToAppString(Paths::getThumbnailsDirPath())+appdata.mData[path]).isFile()){
|| !QFileInfo(QString::fromStdString(Paths::getThumbnailsDirPath())+appdata.mData[path]).isFile()){
// File don't exist. Create the thumbnail
QImage image(path);
@ -164,11 +164,11 @@ void ContentModel::createThumbnail () {
QString uuid = QUuid::createUuid().toString();
id = QStringLiteral("%1.jpg").arg(uuid.mid(1, uuid.length() - 2));
if (!thumbnail.save(Utils::coreStringToAppString(Paths::getThumbnailsDirPath()) + id , "jpg", 100)) {
if (!thumbnail.save(QString::fromStdString(Paths::getThumbnailsDirPath()) + id , "jpg", 100)) {
qWarning() << QStringLiteral("Unable to create thumbnail of: `%1`.").arg(path);
}else{
appdata.mData[path] = id;
mChatMessageModel->getChatMessage()->setAppdata(Utils::appStringToCoreString(appdata.toString()));
mChatMessageModel->getChatMessage()->setAppdata(appdata.toString().toStdString());
}
}
}
@ -456,11 +456,11 @@ void ChatMessageModel::resendMessage (){
void ChatMessageModel::deleteEvent(){
if (mChatMessage && mChatMessage->getFileTransferInformation()) {// Remove thumbnail
mChatMessage->cancelFileTransfer();
QString appdata = Utils::coreStringToAppString(mChatMessage->getAppdata());
QString appdata = QString::fromStdString(mChatMessage->getAppdata());
QStringList fields = appdata.split(':');
if(fields[0].size() > 0) {
QString thumbnailPath = Utils::coreStringToAppString(Paths::getThumbnailsDirPath()) + fields[0];
QString thumbnailPath = QString::fromStdString(Paths::getThumbnailsDirPath()) + fields[0];
if (!QFile::remove(thumbnailPath))
qWarning() << QStringLiteral("Unable to remove `%1`.").arg(thumbnailPath);
}

View file

@ -638,7 +638,7 @@ void ChatRoomModel::sendFileMessage (const QString &path) {
content->setSubtype(Utils::appStringToCoreString(mimeType[1]));
}
content->setSize(size_t(fileSize));
content->setName(Utils::appStringToCoreString( QFileInfo(file).fileName()));
content->setName(QFileInfo(file).fileName().toStdString());
shared_ptr<linphone::ChatMessage> message = mChatRoom->createFileTransferMessage(content);
message->getContents().front()->setFilePath(Utils::appStringToCoreString(path));

View file

@ -55,7 +55,7 @@ bool ContactsImporterListProxyModel::lessThan (const QModelIndex &left, const QM
const ContactsImporterModel *contactA = sourceModel()->data(left).value<ContactsImporterModel *>();
const ContactsImporterModel *contactB = sourceModel()->data(right).value<ContactsImporterModel *>();
return contactA->getIdentity() <= contactB->getIdentity();
return contactA->getIdentity() < contactB->getIdentity();
}
// -----------------------------------------------------------------------------

View file

@ -45,5 +45,5 @@ bool LdapProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right
const LdapModel* ldapA = sourceModel()->data(left).value<LdapModel*>();
const LdapModel* ldapB = sourceModel()->data(right).value<LdapModel*>();
return ldapA->mId <= ldapB->mId;
return ldapA->mId < ldapB->mId;
}

View file

@ -121,5 +121,5 @@ bool ParticipantProxyModel::lessThan (const QModelIndex &left, const QModelIndex
const ParticipantModel* a = sourceModel()->data(left).value<ParticipantModel*>();
const ParticipantModel* b = sourceModel()->data(right).value<ParticipantModel*>();
return a->getCreationTime() >= b->getCreationTime();
return a->getCreationTime() > b->getCreationTime();
}

View file

@ -94,7 +94,7 @@ bool SipAddressesProxyModel::lessThan (const QModelIndex &left, const QModelInde
return diff <= 0;
// 6. Same contact name, so compare sip addresses.
return sipAddressA <= sipAddressB;
return sipAddressA < sipAddressB;
}
int SipAddressesProxyModel::computeEntryWeight (const QVariantMap &entry) const {

View file

@ -79,7 +79,7 @@ bool SipAddressesSorter::lessThan (const QString& filter, const SearchResultMode
return diff <= 0;
// 6. Same contact name, so compare sip addresses.
return sipAddressA <= sipAddressB;
return sipAddressA < sipAddressB;
}
int SipAddressesSorter::computeEntryWeight (const QString& filter, const SearchResultModel *entry) {

@ -1 +1 @@
Subproject commit ecd5e0be3e83efba08759ed7f865d770eda6a5ff
Subproject commit 48e87038360e272436570b6dc062c34f85625237