Bug 269996

Summary: Strip down HTML when copying from chat view
Product: [Frameworks and Libraries] telepathy Reporter: Martin Klapetek <mklapetek>
Component: text-uiAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: francesco.nwokeka, kde, mklapetek
Priority: NOR    
Version: git-latest   
Target Milestone: 0.4.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Screenshot with the bug

Description Martin Klapetek 2011-04-03 13:31:26 UTC
Version:           git-latest (using KDE 4.6.1) 
OS:                Linux

When copying a longer portion of content from chat view, it copies html and then when pasted into chat input, it pastes the html including the avatars etc. See the attached screenshot.

Reproducible: Always
Comment 1 Martin Klapetek 2011-04-03 13:32:15 UTC
Created attachment 58536 [details]
Screenshot with the bug
Comment 2 David Edmundson 2011-04-03 16:30:14 UTC
I think it copies both the HTML and plaintext, as you can have various mimetypes in the clipboard at any time.

At which point we may be able to get away with just running
setAcceptRichText(false) in the ChatTextEdit.

(not tested)
Comment 3 Martin Klapetek 2011-04-03 16:38:19 UTC
That could work, yeah, also for different sources which would otherwise paste a "garbled" text. Although we should probably also consider a use case, where you want to copy the conversation and paste it elsewhere (mail, pastebin etc.).
Comment 4 Francesco Nwokeka 2011-04-03 17:22:20 UTC
(In reply to comment #2)
> I think it copies both the HTML and plaintext, as you can have various
> mimetypes in the clipboard at any time.
> 
> At which point we may be able to get away with just running
> setAcceptRichText(false) in the ChatTextEdit.
> 
> (not tested)
The setAcceptRichText(false) in the ChatTextEdit works as it eliminates all html and pastes only text. It's a one line patch.
(tested)
Is there anything else we're supposed to look out for?
Comment 5 David Edmundson 2011-04-05 00:36:09 UTC
Ship it!
We can deal with anything else if/when it comes up.
Comment 6 Francesco Nwokeka 2011-04-05 00:51:02 UTC
Git commit 8586347e2e6f8cdd65fc0a8b2b004af65e007458 by Francesco Nwokeka.
Committed on 05/04/2011 at 00:58.
Pushed by nwokeka into branch 'master'.

FIX: Strip down HTML when copying from chat view

BUG: 269996
REVIEW: David Edmundson

set the "setAcceptRichText" to false so we don't accept anything unwanted apart from normal text

M  +3    -0    lib/chat-text-edit.cpp     

http://commits.kde.org/telepathy-chat-handler/8586347e2e6f8cdd65fc0a8b2b004af65e007458
Comment 7 Martin Klapetek 2011-04-05 00:57:38 UTC
Great it is fixed. But consider the use cases in comment 3, we should consider different targets for pasting, therefore we should fix the source, not the (one) target.