Monitor for changes from PersonsDataSource
Review Request #110801 - Created June 3, 2013 and submitted
|apol, dvratil, mklapetek, vhanda|
Monitor for changes from PersonsDataSource Add a new class DataSourceWatcher that monitors speific contactIDs PersonsModel and PersonData are then updated to use it. ContactURIs are mapped to save searching through the entire model
Opened contact-list-kpeople went offline online everyone updates immediately :)
|From the QHash docs - "Returns the value associated with the key. If the hash contains no item with the ...||Vishesh Handa|
|This is probably another nitpick - Why check if the resource has the property and then iterate over all the ...||Vishesh Handa|
|...and unless I'm missing something very important, PersonsModel is leaking the private struct as well.||Daniel Vrátil|
Annoying nitpick. Could you please add a new line over here?
From the QHash docs - "Returns the value associated with the key. If the hash contains no item with the key, the function returns a default-constructed value. If there are multiple items for the key in the hash, the value of the most recently inserted one is returned." We do not want to keep constructing empty values and unnecessarily increase the size of the hash. It would be better to use QHash::constFind(QString)
This is probably another nitpick - Why check if the resource has the property and then iterate over all the results? You might as well iterate over all the results. This way you avoid one qHash(QUrl) because of Resource::hasProperty
You are leaking the d_ptr
Unless setUri() is guaranteed to be called only once, you should either call disconnect(), or better move this connect() to constructor where you create the dataSourceWatcher.
...and unless I'm missing something very important, PersonsModel is leaking the private struct as well.