Skip to content

Commit

Permalink
This exactly matches copy behavior in v3.5.3.
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Treat <[email protected]>
  • Loading branch information
manyoso committed Dec 20, 2024
1 parent 45c53ee commit f242b56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 1 addition & 4 deletions gpt4all-chat/qml/ChatView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -935,10 +935,7 @@ Rectangle {
visible: false
}
onClicked: {
var conversation = chatModel.copyToClipboard()
copyEdit.text = conversation
copyEdit.selectAll()
copyEdit.copy()
chatModel.copyToClipboard()
copyMessage.open()
}
ToolTip.visible: copyChatButton.hovered
Expand Down
9 changes: 6 additions & 3 deletions gpt4all-chat/src/chatmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -985,12 +985,15 @@ class ChatModel : public QAbstractListModel
Q_INVOKABLE void copyToClipboard()
{
QMutexLocker locker(&m_mutex);
QStringList content;
QString conversation;
for (ChatItem *item : m_chatItems) {
content << item->clipboardContent();
QString string = item->name;
string += item->clipboardContent();
string += "\n";
conversation += string;
}
QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setText(content.join("\n\n"), QClipboard::Clipboard);
clipboard->setText(conversation, QClipboard::Clipboard);
}

Q_INVOKABLE void copyToClipboard(int index)
Expand Down

0 comments on commit f242b56

Please sign in to comment.