Move contact list view to a separate class, easily embeddable
Review Request #103481 - Created Dec. 20, 2011 and submitted
This second part moves the actual view out of MainWidget to a separate ContactListWidget class. The separate private class is mainly for the context menu, which needs access to the private variables. The widget should be fully self contained with public slots to change its behaviour/look (switch between groups/accounts, show offline users etc). All error messages are sent out as signals and picked by MainWidget, which displays the actual notifications. All Tp stuff was also moved there.
Tested all actions. Started chat etc. All works.
|Align the code style here as well||Dario Freddi|
Close enough. There is just one big issue and some annoyances (but hey that's me so you'd better expect that)
Code style: declare after slots
Code style: put right before Q_OBJECT (and include a Q_DISABLE_COPY while you're at it)
NNNOOOOOOOO. When you use Q_DECLARE_PRIVATE, *never* use d_ptr directly. Instead, there is a handy macro for you: Q_D. Use it like that: Q_D(ContactListWidget); at the beginning of each function where you need to access the d pointer. In fact, this macro generates a "d" variable which is your dpointer with the correct type. This allows you to subclass private classes. So, once you use Q_D, you can switch all of your d_ptr-> to d->
Hmm, wouldn't KMessageBox be a better fit here?
constify and watch for the style: Q_FOREACH (const QString &filename, filenames)
A decent code style here wouldn't hurt. align all of the first letters, your choice whether to put the comma under the colon for each variable or not.