D5577: Don't use LocalDataBaseManager as a singleton
Daniel Vrátil
noreply at phabricator.kde.org
Tue Apr 25 11:03:21 BST 2017
dvratil created this revision.
dvratil added a project: KDE PIM.
Restricted Application added a subscriber: KDE PIM.
REVISION SUMMARY
Instead make LocalDatabaseManager an instance-based interface for a singleton backend. The reason is that when running Kontact, both Akregator, KMail and possibly others who use WebEngineViewer would share the same instance of LocalDataBaseManager and connect to its signal. This means that when you click on a link in KMail, KMail requests URL check from LocalDataBaseManager singleton and the singleton emits a signal, the signal is delivered to all applications that are connected to it, not just KMail. This results in each application opening the link. Currently you can reproduce when you enable phishing checks in both KMail and Akregator, launch Kontact, open KMail, then switch to Akregator and click any link. The link will get opened twice, once by KMail and once by Akregator.
This patch removes the singleton from LocalDataBaseManager and makes each WebEngineView own its own instance of LocalDataBaseManager. Internally, the actual implementation is still a singleton, however the public interface is non-singleton, which means that each application is connected to its own LocalDataBaseManager instance, thus avoiding the issue described above.
TEST PLAN
Ported Akregator to the new API, links no longer open twice.
REPOSITORY
R94 PIM: Message Library
REVISION DETAIL
https://phabricator.kde.org/D5577
AFFECTED FILES
CMakeLists.txt
messageviewer/autotests/viewergrantleethemesupporttest.cpp
messageviewer/autotests/viewertest.cpp
messageviewer/src/viewer/viewer_p.cpp
messageviewer/src/viewer/viewer_p.h
webengineviewer/src/checkphishingurl/autotests/localdatabasemanagertest.cpp
webengineviewer/src/checkphishingurl/localdatabasemanager.cpp
webengineviewer/src/checkphishingurl/localdatabasemanager.h
webengineviewer/src/checkphishingurl/localdatabasemanager_p.h
webengineviewer/src/checkphishingurl/tests/managelocaldatabasegui.cpp
webengineviewer/src/checkphishingurl/tests/managelocaldatabasegui.h
webengineviewer/src/checkphishingurl/tests/webengineviewwithsafebrowsingsupport.cpp
webengineviewer/src/webengineview.cpp
webengineviewer/src/webengineview.h
To: dvratil, mlaurent
Cc: #kde_pim, dvasin, ach, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20170425/4ca8ed50/attachment.html>
More information about the kde-pim
mailing list