void MColorComboBoxViewPrivate::_q_popupDisappeared()
{
    Q_Q(MColorComboBoxView);

    QObject::disconnect(controller, SIGNAL(dismissed()), popupWidget(), SLOT(reject()));
    q->disconnect(popupWidget(), SIGNAL(disappeared()), q, SLOT(_q_popupDisappeared()));
    q->disconnect(colorWidget(), SIGNAL(colorPicked()), q, SLOT(_q_colorPicked()));
}
void MColorComboBoxViewPrivate::_q_showPopup()
{
    Q_Q(MColorComboBoxView);

    popupWidget()->setTitle(q->model()->title());
    colorWidget()->setSelectedColor(q->model()->color());

    q->connect(popupWidget(), SIGNAL(disappeared()), q, SLOT(_q_popupDisappeared()));
    q->connect(colorWidget(), SIGNAL(colorPicked()), q, SLOT(_q_colorPicked()));
    popupWidget()->appear();
}
void MColorComboBoxViewPrivate::_q_colorPicked()
{
    Q_Q(MColorComboBoxView);

    q->model()->setColor(colorWidget()->selectedColor());
    popupWidget()->disappear();
}
void MColorComboBoxViewPrivate::_q_popupDisappeared()
{
    Q_Q(MColorComboBoxView);

    q->disconnect(popupWidget(), SIGNAL(disappeared()), q, SLOT(_q_popupDisappeared()));
    q->disconnect(colorWidget(), SIGNAL(colorPicked()), q, SLOT(_q_colorPicked()));
}
MColorList *MColorComboBoxViewPrivate::colorWidget()
{
    if (!widget) {
        widget = new MColorList(popupWidget());
        widget->setView(new MColorListView(widget));
    }

    return widget;
}
void MColorComboBoxViewPrivate::updateTitle(const QString &title)
{
    buttonWidget()->setTitle(title);
    popupWidget()->setTitle(title);
}