~zsombi/ubuntu-ui-toolkit/78-action-property

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/plugin/ucactionpanel_p.cpp

  • Committer: Zsombor Egri
  • Date: 2015-01-08 12:08:22 UTC
  • mfrom: (1363.3.13 77-pressandhold)
  • Revision ID: zsombor.egri@canonical.com-20150108120822-gsld0der0d7pcetz
prereq sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    , panelItem(0)
32
32
    , status(UCListItem::Disconnected)
33
33
    , leading(leading)
 
34
    , connected(false)
34
35
{
35
36
 
36
37
}
61
62
        } else {
62
63
            context->setParent(panelItem);
63
64
            QQml_setParent_noEvent(panelItem, listItem);
 
65
            panelItem->setParentItem(listItem);
64
66
            // create attached property!
65
67
            UCListItemAttached *attached = static_cast<UCListItemAttached*>(
66
68
                        qmlAttachedPropertiesObject<UCListItem>(panelItem));
110
112
        }
111
113
    }
112
114
    if (*panel) {
113
 
        (*panel)->panelItem->setParentItem((*panel)->listItem);
 
115
        (*panel)->connected = true;
114
116
        (*panel)->status = leading ? UCListItem::Leading : UCListItem::Trailing;
115
117
        Q_EMIT (*panel)->statusChanged();
116
118
    }
119
121
 
120
122
void UCActionPanel::ungrabPanel(UCActionPanel *panel)
121
123
{
122
 
    if (!panel || !panel->panelItem || panel->status == UCListItem::Disconnected) {
 
124
    if (!panel || !panel->connected) {
123
125
        return;
124
126
    }
125
 
    panel->panelItem->setParentItem(0);
126
 
    panel->status = UCListItem::Disconnected;
127
 
    Q_EMIT panel->statusChanged();
 
127
    panel->connected = false;
 
128
    panel->panelItem->setVisible(false);
128
129
}
129
130
 
130
131
bool UCActionPanel::isConnected(UCActionPanel *panel)
131
132
{
132
 
    return panel && panel->status != UCListItem::Disconnected;
 
133
    return panel && panel->connected;
133
134
}