void QuteMessenger::obexOperationCanceld() { if (serviceDisc && serviceDisc->isBusy()) serviceDisc->stopDiscovery(); fileSent(); }
void QuteMessenger::newServiceFound(const QBtDevice& dev, const QBtService& serv) { //since we need only the first available service with the given ClassID //when the first service is reported, the service discovery stops disconnect(serviceDisc, SIGNAL(newServiceFound(const QBtDevice&, const QBtService&)), this, SLOT(newServiceFound(const QBtDevice&, const QBtService&))); qDebug() << "Service to connect: " << serv.getName(); qDebug() << "UUID: " << serv.getClass().get(); qDebug() << "Dev: " << dev.getName(); qDebug() << "Dev Addr: " << dev.getAddress().toString(); if(obexClient) { delete obexClient; obexClient = NULL; } obexClient = new QBtObjectExchangeClient(this); connect(obexClient, SIGNAL(connectedToServer()), this, SLOT(connectedToRemoteOBEXServer())); connect(obexClient, SIGNAL(objectSent()), this, SLOT(fileSent())); connect(obexClient, SIGNAL(error (QBtObjectExchangeClient::ErrorCode)), this, SLOT(reportObexError(QBtObjectExchangeClient::ErrorCode)) ); selectedService = serv; obexClient->connectToServer(deviceQueriedForServices, selectedService); }
/* Méthode qui permet de mettre en place tous les signaux */ void MainWindow::createAction(){ // Si le socket est connecté au serveur QObject::connect(&soc, SIGNAL(connected()), this, SLOT(connexion_OK())); QObject::connect(ui->buttonFile,SIGNAL(pressed()), this, SLOT(file())); QObject::connect(ui->buttonSent,SIGNAL(pressed()), this, SLOT(fileSent())); // Chaque fois qu'on écrit sur le socket, on met à jour la progressbar QObject::connect(&soc, SIGNAL(bytesWritten(qint64)),this, SLOT(updateProgress(qint64))); QObject::connect(&soc,SIGNAL(aboutToClose()),this,SLOT(connexion_OK())); }
void QuteMessenger::fileSent() { if(obexClient) { obexClient->disconnect(); disconnect(obexClient, SIGNAL(objectSent()), this, SLOT(fileSent())); } if(obexDialog) { obexDialog->hide(); SafeDelete(obexDialog); } }