<table><tr><td style="">poboiko created this revision.<br />poboiko added a reviewer: KDE PIM.<br />poboiko added a project: KDE PIM.<br />poboiko requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D9715" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The problem is following: <br />
when I open settings dialog for my Google Calendar resource (in i.e. KOrganizer), all the items in "Calendars" and "Tasklists" lists gets duplicated.  I wasn't able to find such a bug in BugZilla, though.</p>

<p>On first launch of settings dialog, GoogleSettingsDialog::currentAccountChanged signal gets called twice in a row:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">first time due to currentIndexChanged signal from combobox (common/googlesettingsdialog.cpp:72)</li>
<li class="remarkup-list-item">second time, manually, in GoogleSettingsDialog::reloadAccounts() (common/googlesettingsdialog.cpp:107). Somehow, the disconnect-workaround there doesn't work (BTW, the code around there looks weird. Should there be "connect" on line 149?)</li>
</ol>

<p>As a result, SettingsDialog::slotReloadCalendars() and SettingsDialog::slotReloadTaskLists() are called twice, running job and clearing corresponding lists twice as well. Then, in SettingsDialog::slot***Retrieved(), which gets called twice again after job is done, the data gets added twice. The contents of lists gets duplicated. Simple as that.</p>

<p>The problem is thus that list gets cleared when job is set up, and not before populating the lists.<br />
I propose the most trivial (and harmless) solution to this problem: just clear corresponding lists once again, when the job is done, and right before putting new data there.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Opened the settings dialog for my google account. Data is no longer duplicated. I'm happy.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R44 KDE PIM Runtime</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9715" rel="noreferrer">https://phabricator.kde.org/D9715</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>resources/google/calendar/settingsdialog.cpp</div></div></div><br /><div><strong>To: </strong>poboiko, KDE PIM<br /><strong>Cc: </strong>dvasin, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>