[Qt][WK2] QtFileDownloader ctor shouldn't call QtFileDownloader::onReadyRead()
[WebKit.git] / Source / WebKit2 / WebProcess / Downloads / qt / QtFileDownloader.cpp
index d04db05..c936b08 100644 (file)
@@ -43,12 +43,6 @@ QtFileDownloader::QtFileDownloader(Download* download, PassOwnPtr<QNetworkReply>
     , m_error(QNetworkReply::NoError)
     , m_headersRead(false)
 {
-    connect(m_reply.get(), SIGNAL(readyRead()), SLOT(onReadyRead()));
-    connect(m_reply.get(), SIGNAL(finished()), SLOT(onFinished()));
-    connect(m_reply.get(), SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError)));
-
-    // Call onReadyRead just in case some data is already waiting.
-    onReadyRead();
 }
 
 QtFileDownloader::~QtFileDownloader()
@@ -59,6 +53,16 @@ QtFileDownloader::~QtFileDownloader()
     abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorAborted);
 }
 
+void QtFileDownloader::start()
+{
+    connect(m_reply.get(), SIGNAL(readyRead()), SLOT(onReadyRead()));
+    connect(m_reply.get(), SIGNAL(finished()), SLOT(onFinished()));
+    connect(m_reply.get(), SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError)));
+
+    // Call onReadyRead just in case some data is already waiting.
+    onReadyRead();
+}
+
 void QtFileDownloader::determineFilename()
 {
     ASSERT(!m_destinationFile);