~ken-vandine/content-hub/desktop_file_less

« back to all changes in this revision

Viewing changes to src/com/ubuntu/content/hub.cpp

New upstream version to reflect addition of the out of process
peer picker

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
    QObject::connect(d->service, SIGNAL(PasteboardChanged()),
90
90
            this,
91
91
            SIGNAL(pasteboardChanged()));
 
92
    QObject::connect(d->service, SIGNAL(PeerSelected(const QString&, const QString&)),
 
93
            this,
 
94
            SLOT(onPeerSelected(const QString&, const QString&)));
 
95
    QObject::connect(d->service, SIGNAL(PeerSelectionCancelled(const QString&)),
 
96
            this,
 
97
            SLOT(onPeerSelectionCancelled(const QString&)));
92
98
}
93
99
 
94
100
cuc::Hub::~Hub()
101
107
    return hub;
102
108
}
103
109
 
 
110
void cuc::Hub::requestPeerForType(cuc::Type type, QString handler_id)
 
111
{
 
112
    TRACE() << Q_FUNC_INFO << type.id();
 
113
    d->service->RequestPeerForTypeByAppId(type.id(), handler_id, app_id());
 
114
}
 
115
 
 
116
void cuc::Hub::selectPeerForAppId(QString app_id, QString peer_id)
 
117
{
 
118
    TRACE() << Q_FUNC_INFO << app_id << peer_id;
 
119
    d->service->SelectPeerForAppId(app_id, peer_id);
 
120
}
 
121
 
 
122
void cuc::Hub::selectPeerForAppIdCancelled(QString app_id)
 
123
{
 
124
    TRACE() << Q_FUNC_INFO << app_id;
 
125
    d->service->SelectPeerForAppIdCancelled(app_id);
 
126
}
 
127
 
104
128
void cuc::Hub::requestPasteFormats()
105
129
{
106
130
    auto reply = d->service->PasteFormats();
126
150
    Q_EMIT(pasteFormatsChanged());
127
151
}
128
152
 
 
153
void cuc::Hub::onPeerSelected(const QString &id, const QString &peer_id)
 
154
{
 
155
    TRACE() << Q_FUNC_INFO << id << peer_id;
 
156
    if (id == app_id())
 
157
        Q_EMIT(peerSelected(peer_id));
 
158
}
 
159
 
 
160
 
 
161
void cuc::Hub::onPeerSelectionCancelled(const QString &id)
 
162
{
 
163
    TRACE() << Q_FUNC_INFO << id;
 
164
    if (id == app_id())
 
165
        Q_EMIT(peerSelectionCancelled());
 
166
}
 
167
 
129
168
bool cuc::Hub::eventFilter(QObject *obj, QEvent *event)
130
169
{
131
170
   if (event->type() == QEvent::ApplicationActivate)