[Kde-pim] Review Request 112552: kaddressbook contact display: make it possible to easily copy an item's text

Jonathan Marten jjm at keelhaul.me.uk
Tue Sep 10 20:15:55 BST 2013



> On Sept. 10, 2013, 4:14 p.m., Kevin Krammer wrote:
> > akonadi/contact/textbrowser.cpp, line 116
> > <http://git.reviewboard.kde.org/r/112552/diff/4/?file=188571#file188571line116>
> >
> >     is the type different if it is a photo, QR code or other image?
> >     if it is always QPixmap than this would always work, no?

No, unfortunately the returned string isn't enough to identify the image.  It is Unicode 0xFFFC 0x0020 for the contact photo, and 0xFFFC 0x0020 0xFFFC 0x0020 for either of the matrix codes.  Suspect that the latter is because the generated HTML is just two adjacent <img> tags.

If fetched as a QImage the resources can be distinguished from each other either by their cacheKey(), or by adding a property with setText() when creating them.  But there is still no way to get from the click position to identify the image under it...

Unless there is a way within QTextBrowser to identify the clicked image, I'm not sure that "Copy Photo" could be made to work.  But it's a potentially useful function, so there could be individual options within KAddressBook's Edit menu: "Copy Contact Photo", "Copy QR Code", "Copy DataMatrix"... (Or under the Export menu: "Save Contact Photo", etc...)


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/112552/#review39735
-----------------------------------------------------------


On Sept. 10, 2013, 12:52 p.m., Jonathan Marten wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/112552/
> -----------------------------------------------------------
> 
> (Updated Sept. 10, 2013, 12:52 p.m.)
> 
> 
> Review request for KDEPIM-Libraries.
> 
> 
> Description
> -------
> 
> In the contact display, the context menu over an item which is an email address allows the address to be copied easily using the "Copy e-mail address" action.  But, for any other sort of information, the action is not available - all that can be done is to select the item (which requires precise mouse movement) and then use the standard "Copy" action.
> 
> This change allows the text of any item to be copied.  Email addresses work as before.  For an external link (e.g. Homepage), the URL is copied and the action says "Copy Link URL".  For any other item, it is copied in text form and the action says "Copy Item".
> 
> There are some hacks in the code to properly handle certain items.  Anything formatted over multiple lines (e.g. addresses) needs to have the Unicode line separator characters as returned converted back to '\n'.  The suffix link "(SMS)" added to a mobile number is removed.  There is nothing meaningful to copy for a popup over the photo image, so this is suppressed.
> 
> The "Select All" action is pointless here, so it is removed from the popup menu.
> 
> There is an anomaly in the operation in that a click in the first column (the item keys) copies the text of the key, not its value.  I can't currently see a way around this apart from specially formatting the generated HTML, which would place restrictions on user-provided or GHNS templates.
> 
> 
> Diffs
> -----
> 
>   akonadi/contact/textbrowser.cpp 6f856e4 
>   akonadi/contact/textbrowser_p.h fdf79e2 
> 
> Diff: http://git.reviewboard.kde.org/r/112552/diff/
> 
> 
> Testing
> -------
> 
> Built kdepimlibs and kaddressbook with these changes.  Verified the correct naming and enabling of the action, and that the correct information is copied, over all parts of the contact display.
> 
> 
> Thanks,
> 
> Jonathan Marten
> 
>

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list