~mzanetti/+junk/ubtd

« back to all changes in this revision

Viewing changes to app/obexagent.cpp

  • Committer: Michael Zanetti
  • Date: 2016-04-14 23:34:10 UTC
  • Revision ID: michael.zanetti@canonical.com-20160414233410-17jg7ez3w1qc5e16
make it work, polish a bit, 0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 
14
14
}
15
15
 
16
 
QString ObexAgent::Authorize(const QDBusObjectPath &transfer, const QString &bt_address, const QString &name, const QString &type, int length, int time)
 
16
void ObexAgent::accept(const QString &path, const QString &fileName)
 
17
{
 
18
    if (!m_pendingRequests.contains(path)) {
 
19
        return;
 
20
    }
 
21
    QDBusMessage msg = m_pendingRequests.take(path);
 
22
    QDBusConnection::sessionBus().send(msg.createReply(fileName));
 
23
}
 
24
 
 
25
QString ObexAgent::AuthorizePush(const QDBusObjectPath &transfer)
17
26
{
18
27
    qDebug() << "authorize called" <<  transfer.path();
19
28
 
20
 
    QString targetPath = "/tmp/obexd/";
21
 
    QDir dir(targetPath);
22
 
    if (!dir.exists()) {
23
 
        dir.mkpath(targetPath);
24
 
    }
25
29
 
26
 
    emit authorized(transfer.path(), targetPath, name, bt_address, type, length);
27
 
    return targetPath + name;
 
30
    setDelayedReply(true);
 
31
    m_pendingRequests[transfer.path()] = message();
 
32
    QTimer::singleShot(0, [this, transfer]() { emit authorized(transfer.path());});
 
33
    qDebug() << "returning";
 
34
    return QString();
28
35
}
29
36