<table><tr><td style="">poboiko created this revision.<br />poboiko added a reviewer: dvratil.<br />Herald 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/D28560">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This is an attempt to unify existing Calendar&Tasks and Contacts resources into<br />
a single Groupware resource. At some point, hopefully, GMail support could be also<br />
added here (see task <a href="https://phabricator.kde.org/T646" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">T646: [Google] Native Gmail resource / Google Groupware</a> and <a href="https://phabricator.kde.org/T9422" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">T9422: Automatic setup of Gmail + Google Calendar/Contacts</a>).</p>

<p>Various "subresources" (Calendar, Tasks and Contacts) are implemented as subclasses of <tt style="background: #ebebeb; font-size: 13px;">GenericHandler</tt>,<br />
which is a basic <tt style="background: #ebebeb; font-size: 13px;">Akonadi::ResourceBase</tt> interface. The resource decides which <tt style="background: #ebebeb; font-size: 13px;">Handler</tt> it should call<br />
by looking at mimetypes. <tt style="background: #ebebeb; font-size: 13px;">Handlers</tt> are <tt style="background: #ebebeb; font-size: 13px;">friends</tt> of <tt style="background: #ebebeb; font-size: 13px;">GoogleResource</tt>, so they can call its callbacks<br />
(like <tt style="background: #ebebeb; font-size: 13px;">itemsRetrieved()</tt>) as needed. This was done primarily to separate logic of different subresources;<br />
this might be not the best solution, I'm open to suggestions.</p>

<p>This patch also reworks the settings dialog & relevant code. <br />
The dialog is now using <tt style="background: #ebebeb; font-size: 13px;">.ui</tt> file. The "account picker" is gone, as it's no longer needed; <br />
instead, a single "Configure..." button is added which invokes the auth process.</p>

<p>It also implements "last sync token" API (<a href="https://phabricator.kde.org/T647" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">T647: [KGAPI] Investigate the new "last sync token" in Google API</a>) for calendar incremental updates. Without this API,<br />
event moving between calendars were not handled properly (i.e. event was not removed from the "source" calendar).</p>

<p>Work to be done:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">KAccounts integration. Need to be able to <tt style="background: #ebebeb; font-size: 13px;">disable</tt> various <tt style="background: #ebebeb; font-size: 13px;">subresources</tt> on demand, and determine auth <tt style="background: #ebebeb; font-size: 13px;">scopes</tt> based on that.</li>
<li class="remarkup-list-item">GMail integration. Need to somehow adopt <tt style="background: #ebebeb; font-size: 13px;">ImapResourceBase</tt> / <tt style="background: #ebebeb; font-size: 13px;">ResourceState</tt> scheme, and merge it with current <tt style="background: #ebebeb; font-size: 13px;">Handlers</tt> scheme.</li>
<li class="remarkup-list-item">Add <tt style="background: #ebebeb; font-size: 13px;">Akonadi::Tag</tt> support for Contacts. Tags seem to be more appropriate than having bunch of virtual collections, but this might require some changes inside KAddressBook.</li>
</ol></div></div><br /><div><strong>TEST PLAN</strong><div><p>Here's a comprehensive list of what was tested and what issues were discovered.</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">Adding event locally</li>
<li class="remarkup-list-item">Changing event locally</li>
<li class="remarkup-list-item">Removing event locally</li>
<li class="remarkup-list-item">Moving events between calendars locally</li>
<li class="remarkup-list-item"><strong>Adding calendar locally</strong><ul class="remarkup-list">
<li class="remarkup-list-item">new calendar is added as a virtual collection, cannot add events there afterwards; probably a KOrganizer issue</li>
<li class="remarkup-list-item">color of newly added calendar is not known, google just don't return it to us</li>
</ul></li>
<li class="remarkup-list-item">Removing calendar locally</li>
<li class="remarkup-list-item">Changing calendar locally</li>
<li class="remarkup-list-item">Adding event remotely</li>
<li class="remarkup-list-item">Changing event remotely</li>
<li class="remarkup-list-item">Removing event remotely</li>
<li class="remarkup-list-item">Moving events between calendars remotely</li>
<li class="remarkup-list-item">Adding calendar remotely</li>
<li class="remarkup-list-item">Removing calendar remotely</li>
<li class="remarkup-list-item">Adding task&subtask remotely</li>
<li class="remarkup-list-item">Changing task locally</li>
<li class="remarkup-list-item">Removing task locally</li>
<li class="remarkup-list-item">Removing a task with subtasks locally (subtasks go to the upper level)</li>
<li class="remarkup-list-item"><strong>Adding/removing tasklist locally</strong><ul class="remarkup-list">
<li class="remarkup-list-item">wasn't tested, but should work. KOrganizer just don't know how to add a tasklist, it adds a calendar by default (probably it sees no difference between them...)</li>
</ul></li>
<li class="remarkup-list-item">Changing tasklist locally</li>
<li class="remarkup-list-item">Adding task&subtask remotely</li>
<li class="remarkup-list-item">Changing task remotely</li>
<li class="remarkup-list-item">Removing task remotely</li>
<li class="remarkup-list-item">Adding tasklist remotely (it is not subscribed automatically, however, so user have to go to account settings and enable it)</li>
<li class="remarkup-list-item">Changing tasklist remotely</li>
<li class="remarkup-list-item">Removing tasklist remotely</li>
<li class="remarkup-list-item">Adding contact (including photo) locally, both inside "My Contacts" and "Other Contacts" groups</li>
<li class="remarkup-list-item">Moving contact between "My Contacts" and "Other Contacts" groups</li>
<li class="remarkup-list-item">Chaging contact (including photo) locally</li>
<li class="remarkup-list-item">Removing contat locally</li>
<li class="remarkup-list-item">Adding contact to contact group locally<ul class="remarkup-list">
<li class="remarkup-list-item"><a href="https://phabricator.kde.org/D28432" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: line-through;">D28432: [Akonadi/PasteHelper] Add support for items linking</a> required, otherwise "Link Item" gets silently ignored</li>
</ul></li>
<li class="remarkup-list-item"><strong>Removing contact from contact group locally</strong><ul class="remarkup-list">
<li class="remarkup-list-item">wasn't tested, since I've found to UI to "Unlink Item" :(</li>
</ul></li>
<li class="remarkup-list-item">Adding contact (including photo) remotely</li>
<li class="remarkup-list-item">Changing contact (including photo) remotely</li>
<li class="remarkup-list-item">Removing contact remotely</li>
<li class="remarkup-list-item">Adding contact to contact group remotely</li>
<li class="remarkup-list-item"><strong>Removing contact from contact group remotely</strong><ul class="remarkup-list">
<li class="remarkup-list-item">doesn't work: need an easy way to fetch all collections we're linked to (so we know which UnlinkJobs we should start)</li>
</ul></li>
</ol></div></div><br /><div><strong>REPOSITORY</strong><div><div>R44 KDE PIM Runtime</div></div></div><br /><div><strong>BRANCH</strong><div><div>dev/google-groupware</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28560">https://phabricator.kde.org/D28560</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>kdepim-runtime.categories<br />
resources/CMakeLists.txt<br />
resources/google-groupware/CMakeLists.txt<br />
resources/google-groupware/calendarhandler.cpp<br />
resources/google-groupware/calendarhandler.h<br />
resources/google-groupware/contacthandler.cpp<br />
resources/google-groupware/contacthandler.h<br />
resources/google-groupware/defaultreminderattribute.cpp<br />
resources/google-groupware/defaultreminderattribute.h<br />
resources/google-groupware/generichandler.cpp<br />
resources/google-groupware/generichandler.h<br />
resources/google-groupware/googleresource.cpp<br />
resources/google-groupware/googleresource.desktop<br />
resources/google-groupware/googleresource.h<br />
resources/google-groupware/googlesettings.cpp<br />
resources/google-groupware/googlesettings.h<br />
resources/google-groupware/googlesettingsdialog.cpp<br />
resources/google-groupware/googlesettingsdialog.h<br />
resources/google-groupware/googlesettingsdialog.ui<br />
resources/google-groupware/settingsbase.kcfg<br />
resources/google-groupware/settingsbase.kcfgc<br />
resources/google-groupware/taskhandler.cpp<br />
resources/google-groupware/taskhandler.h</div></div></div><br /><div><strong>To: </strong>poboiko, dvratil<br /><strong>Cc: </strong>kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>