Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed double connection of a signal to a slot

  • Loading branch information...
commit 48cf5fae129edb5c6e0daef312f1de3baaa1ef1c 1 parent 733c076
@mborho authored
Showing with 10 additions and 5 deletions.
  1. +7 −4 kipptconnector.cpp
  2. +3 −1 main.cpp
View
11 kipptconnector.cpp
@@ -5,6 +5,7 @@
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QSignalMapper>
+#include <QDebug>
KipptConnector::KipptConnector(QObject *parent) : QObject(parent)
{
@@ -19,25 +20,27 @@ QString KipptConnector::deleteCall(QString ressource,QString path, QByteArray us
request.setRawHeader("X-Kippt-Username", username);
request.setRawHeader("X-Kippt-API-Token", apiToken);
- m_NetCtrl.deleteResource(request);
-
if(ressource == "clip") {
- connect(&m_NetCtrl, SIGNAL(finished(QNetworkReply*)), SLOT(deletedClip(QNetworkReply*)));
+ connect(&m_NetCtrl, SIGNAL(finished(QNetworkReply*)), this, SLOT(deletedClip(QNetworkReply*)), Qt::UniqueConnection);
} else if(ressource == "list") {
- connect(&m_NetCtrl, SIGNAL(finished(QNetworkReply*)), SLOT(deletedList(QNetworkReply*)));
+ connect(&m_NetCtrl, SIGNAL(finished(QNetworkReply*)), this, SLOT(deletedList(QNetworkReply*)), Qt::UniqueConnection);
}
+ m_NetCtrl.deleteResource(request);
+
return path;
}
void KipptConnector::deletedClip(QNetworkReply* apiReply)
{
+ qDebug() << "clip deleted";
QVariant statusCode = apiReply->attribute( QNetworkRequest::HttpStatusCodeAttribute );
emit clipDeleted(statusCode);
}
void KipptConnector::deletedList(QNetworkReply* apiReply)
{
+ qDebug() << "list deleted";
QVariant statusCode = apiReply->attribute( QNetworkRequest::HttpStatusCodeAttribute );
emit listDeleted(statusCode);
}
View
4 main.cpp
@@ -9,7 +9,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QmlApplicationViewer viewer;
QDeclarativeContext *ctxt = viewer.rootContext();
- ctxt->setContextProperty("KipptConnector", new KipptConnector());
+ KipptConnector *connector = new KipptConnector();
+ ctxt->setContextProperty("KipptConnector", connector);
+
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/klippr/main.qml"));
Please sign in to comment.
Something went wrong with that request. Please try again.