Prevent duplicates in url list.
ClosedPublic

Authored by pinaraf on Oct 26 2019, 12:41 PM.

Details

Summary

When not doing that, drag'n'drop-ing an article from the article list
to the browser opened the article twice.

Test Plan

Tested with various RSS feeds dropping to Firefox, no more duplicated tabs

Diff Detail

Repository
R201 Akregator
Branch
noDuplicatesOnDragAndDrop
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 18295
Build 18313: arc lint + arc unit
pinaraf created this revision.Oct 26 2019, 12:41 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptOct 26 2019, 12:41 PM
Restricted Application added a subscriber: kde-pim. · View Herald Transcript
pinaraf requested review of this revision.Oct 26 2019, 12:41 PM

You select one article and it opens 2 articles ?
Perhaps we need to understand why before to create a workaround no ?

You select one article and it opens 2 articles ?
Perhaps we need to understand why before to create a workaround no ?

I select one article and it opens it twice, sometimes even worse. But sure it's better with an explanation of what I saw.
And thanks for asking. I don't know what I was thinking when I wrote this one.
The issue is that mimeData is called with a list of Index, one per column per row. So if you have three columns, there are three similar urls in the mime data, thus 3 new tabs in your browser or 3 lines in your text editor…
I'm sending a much better fix right now.

pinaraf updated this revision to Diff 68802.Oct 26 2019, 8:34 PM

While writing the explanation for Laurent, I felt stupid for not writing
this patch that way the first time.

pinaraf updated this revision to Diff 68803.Oct 26 2019, 8:35 PM

Fix indent.

mlaurent requested changes to this revision.Oct 28 2019, 5:53 AM

Minor optimization const int rowIndex = i.row();
After that it's ok for me.

Thanks

This revision now requires changes to proceed.Oct 28 2019, 5:53 AM

Hum, sure it is an optimization on a non-optimizing compiler, but since QModelIndex::row() is const and declared in the headers, thus inlined when called, we don't really get anything here (on the contrary, on a -O3 code with GCC 9.2 on amd64 we get two extra instructions and allocate more stack because the variable is kept).
Are you sure it is worth it?

mlaurent accepted this revision.Oct 29 2019, 5:50 AM

I prefer it but as you want :)

This revision is now accepted and ready to land.Oct 29 2019, 5:50 AM
pinaraf updated this revision to Diff 68951.Oct 29 2019, 8:01 AM

Laurent prefers it that way :)

This revision was automatically updated to reflect the committed changes.