src/dbus/qdbusintegrator.cpp
branchRCL_3
changeset 7 3f74d0d4af4c
parent 5 d3bac044e0f0
equal deleted inserted replaced
6:dee5afe5301f 7:3f74d0d4af4c
  1935                                                int timeout)
  1935                                                int timeout)
  1936 {
  1936 {
  1937     QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout);
  1937     QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout);
  1938     Q_ASSERT(pcall);
  1938     Q_ASSERT(pcall);
  1939 
  1939 
  1940     // has it already finished (dispatched locally)?
  1940     // has it already finished with success (dispatched locally)?
  1941     if (pcall->replyMessage.type() == QDBusMessage::ReplyMessage) {
  1941     if (pcall->replyMessage.type() == QDBusMessage::ReplyMessage) {
  1942         pcall->setReplyCallback(receiver, returnMethod);
  1942         pcall->setReplyCallback(receiver, returnMethod);
  1943         processFinishedCall(pcall);
  1943         processFinishedCall(pcall);
  1944         delete pcall;
  1944         delete pcall;
  1945         return 1;
  1945         return 1;
  1946     }
  1946     }
  1947 
  1947 
       
  1948     // either it hasn't finished or it has finished with error
       
  1949     if (errorMethod) {
       
  1950         pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
       
  1951         connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod,
       
  1952                 Qt::QueuedConnection);
       
  1953         pcall->watcherHelper->moveToThread(thread());
       
  1954     }
       
  1955 
  1948     // has it already finished and is an error reply message?
  1956     // has it already finished and is an error reply message?
  1949     if (pcall->replyMessage.type() == QDBusMessage::ErrorMessage) {
  1957     if (pcall->replyMessage.type() == QDBusMessage::ErrorMessage) {
  1950         if (errorMethod) {
       
  1951             pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
       
  1952             connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod);
       
  1953             pcall->watcherHelper->moveToThread(thread());
       
  1954         }
       
  1955         processFinishedCall(pcall);
  1958         processFinishedCall(pcall);
  1956         delete pcall;
  1959         delete pcall;
  1957         return 1;
  1960         return 1;
  1958     }
  1961     }
  1959 
  1962 
  1960     // has it already finished with error?
       
  1961     if (pcall->replyMessage.type() != QDBusMessage::InvalidMessage) {
       
  1962         delete pcall;
       
  1963         return 0;
       
  1964     }
       
  1965 
       
  1966     pcall->autoDelete = true;
  1963     pcall->autoDelete = true;
  1967     pcall->ref.ref();
  1964     pcall->ref.ref();
  1968 
       
  1969     pcall->setReplyCallback(receiver, returnMethod);
  1965     pcall->setReplyCallback(receiver, returnMethod);
  1970     if (errorMethod) {
       
  1971         pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
       
  1972         connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod);
       
  1973         pcall->watcherHelper->moveToThread(thread());
       
  1974     }
       
  1975 
  1966 
  1976     return 1;
  1967     return 1;
  1977 }
  1968 }
  1978 
  1969 
  1979 bool QDBusConnectionPrivate::connectSignal(const QString &service,
  1970 bool QDBusConnectionPrivate::connectSignal(const QString &service,