mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-28 01:09:19 +00:00
Fix text lost when switching timelines : if QML TextEdit is set for rich texts, Qt will change the text before item completion.
This commit is contained in:
parent
1dd4f4f285
commit
c46727ce75
4 changed files with 14 additions and 6 deletions
|
|
@ -110,7 +110,6 @@ void ChatRoomProxyModel::sendMessage(const QString &text){
|
|||
void ChatRoomProxyModel::compose (const QString& text) {
|
||||
if (mChatRoomModel && !text.isEmpty())
|
||||
mChatRoomModel->compose();
|
||||
gCachedText = text;
|
||||
}
|
||||
|
||||
int ChatRoomProxyModel::getEntryTypeFilter () {
|
||||
|
|
@ -255,6 +254,10 @@ QString ChatRoomProxyModel::getCachedText() const{
|
|||
return gCachedText;
|
||||
}
|
||||
|
||||
void ChatRoomProxyModel::setCachedText(const QString& text){
|
||||
gCachedText = text;
|
||||
}
|
||||
|
||||
void ChatRoomProxyModel::setIsCall(const bool& isCall){
|
||||
if(mIsCall != isCall) {
|
||||
if(mChatRoomModel){
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class ChatRoomProxyModel : public SortFilterProxyModel {
|
|||
Q_PROPERTY(QString fullLocalAddress READ getFullLocalAddress WRITE setFullLocalAddress NOTIFY fullLocalAddressChanged)
|
||||
Q_PROPERTY(ChatRoomModel *chatRoomModel READ getChatRoomModel WRITE setChatRoomModel NOTIFY chatRoomModelChanged)
|
||||
Q_PROPERTY(QList<QString> composers READ getComposers NOTIFY isRemoteComposingChanged)
|
||||
Q_PROPERTY(QString cachedText READ getCachedText)
|
||||
Q_PROPERTY(QString cachedText READ getCachedText WRITE setCachedText NOTIFY cachedTextChanged)
|
||||
|
||||
Q_PROPERTY(QString filterText MEMBER mFilterText WRITE setFilterText NOTIFY filterTextChanged)
|
||||
Q_PROPERTY(bool markAsReadEnabled READ markAsReadEnabled WRITE enableMarkAsRead NOTIFY markAsReadEnabledChanged)// Focus is at end of the list. Used to reset message count if not at end
|
||||
|
|
@ -95,6 +95,7 @@ signals:
|
|||
void entryTypeFilterChanged (int type);
|
||||
void filterTextChanged();
|
||||
void isCallChanged();
|
||||
void cachedTextChanged();
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
|
|
@ -122,6 +123,7 @@ private:
|
|||
QList<QString> getComposers () const;
|
||||
|
||||
QString getCachedText() const;
|
||||
void setCachedText(const QString& text);
|
||||
|
||||
void reload (ChatRoomModel *chatRoomModel);
|
||||
|
||||
|
|
|
|||
|
|
@ -638,7 +638,6 @@ bool Utils::isImage(const QString& path){
|
|||
}else if(!QMimeDatabase().mimeTypeForFile(info).name().contains("image/"))
|
||||
return false;
|
||||
QImageReader reader(path);
|
||||
qWarning() << reader.imageCount();
|
||||
return reader.canRead() && reader.imageCount() == 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -411,9 +411,13 @@ Rectangle {
|
|||
placeholderText: qsTr('newMessagePlaceholder')
|
||||
recordAudioToggled: RecorderManager.haveVocalRecorder && RecorderManager.getVocalRecorder().state != LinphoneEnums.RecorderStateClosed
|
||||
emojiVisible: chatEmojis.visible
|
||||
|
||||
onDropped: Logic.handleFilesDropped(files)
|
||||
onTextChanged: Logic.handleTextChanged(getText())
|
||||
property bool componentReady: false
|
||||
onTextChanged: {// This slot can be call before the item has been completed because of Rich text. So the cache must not take it account.
|
||||
if(componentReady) {
|
||||
proxyModel.cachedText=text
|
||||
}
|
||||
}
|
||||
onValidText: {
|
||||
textArea.text = ''
|
||||
chat.bindToEnd = true
|
||||
|
|
@ -428,7 +432,7 @@ Rectangle {
|
|||
onEmojiClicked: {
|
||||
chatEmojis.visible = !chatEmojis.visible
|
||||
}
|
||||
Component.onCompleted: {text = proxyModel.cachedText; cursorPosition=text.length}
|
||||
Component.onCompleted: {text = proxyModel.cachedText; cursorPosition=text.length;componentReady=true}
|
||||
Rectangle{
|
||||
anchors.fill:parent
|
||||
color:'white'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue