Index: terepaima-0.4.16/sources/mainwindow.cpp
===================================================================
--- terepaima-0.4.16/sources/mainwindow.cpp	(revision db917521885748bd954d5ef73075698bdb6c52cf)
+++ terepaima-0.4.16/sources/mainwindow.cpp	(revision 30f315271647bbf112108eda16fe8343439d2351)
@@ -347,4 +347,11 @@
 
     on_tabWidget_currentChanged(m_tabWidget->currentIndex());
+
+    //localFile = new QFile("download.pdf");
+    //QString downloadfilesign = currentTab()->fileInfo().absoluteFilePath();
+    //qDebug("Dirección del archivo %s", downloadfilesign);
+
+    //localFile = new QFile("download.pdf");
+    //localFile = new QFile(downloadfilesign);
 }
 
@@ -4101,6 +4108,16 @@
     qDebug("** downloadSignedFile() **");
 
-    url = "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/aee1a794-5fc7-4008-ac6d-de2e79583074.pdf";
+    QString downloadfilesign = currentTab()->fileInfo().absoluteFilePath();
+    //qDebug("Dirección del archivo %s", downloadfilesign);
+
+    localFile = new QFile(downloadfilesign);
+
+    //url = "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/aee1a794-5fc7-4008-ac6d-de2e79583074.pdf";
+    url = "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + signedfile;
     QString empty = "";
+
+    delete manager;
+    manager = NULL;
+
     executeRest(url.toString(), "admin", "admin", empty);
 
@@ -4158,4 +4175,7 @@
 //    //connect(response,SIGNAL(finished()),this, SLOT(httpDownloadFinished()));
 */
+    QString newfilesign = currentTab()->fileInfo().absoluteFilePath();
+    open(newfilesign);
+    m_detailsSignatureView->setModel(view_table_verify_signature()); // refresca la table de verificación de firma electrónica
 
 }
@@ -4332,5 +4352,5 @@
         QString newsignature = QString(m_nct->toHex(result));
         qDebug("Resultado Firma en HEX: |%s|", qPrintable(newsignature));
-        open("/home/pbuitrago/Cenditel/Seguridad/POA-2015/Portal_verificacion_firma/reconocimientoMurachi-signed.pdf"); // para refrescar el archivo al firmado
+        //open("/home/pbuitrago/Cenditel/Seguridad/POA-2015/Portal_verificacion_firma/reconocimientoMurachi-signed.pdf"); // para refrescar el archivo al firmado
         m_detailsSignatureView->setModel(view_table_verify_signature()); // refresca la table de verificación de firma electrónica
         QString resenas = QString("{\"signature\":\"%1\"}").arg(newsignature);
@@ -4419,7 +4439,25 @@
 
 void MainWindow::httpDownloadFinished() {
-        qDebug("MainWindow::httpDownloadFinished....*1");
-    localFile.flush();
-    localFile.close();
+    qDebug("MainWindow::httpDownloadFinished....*1");
+
+    if (!reply->error()) {
+        //localFile = new QFile("download.pdf");
+
+        //localFile->setFileName("download.pdf");
+
+
+        if (!localFile->open(QIODevice::WriteOnly ))
+                return;
+        ;
+        localFile->write(reply->readAll());
+
+
+     } else {
+     qDebug("handleNetworkData  OCURRED ERROR network error: |%s|",qPrintable(reply->errorString()));
+    }
+
+    localFile->flush();
+    //localFile->AbortErrorclose();
+    localFile->close();
     reply->deleteLater();
 
@@ -4438,12 +4476,13 @@
 
     if (!reply->error()) {
-
-        localFile.setFileName("download.pdf");
-
-
-        if (!localFile.open(QIODevice::WriteOnly ))
+        //localFile = new QFile("download.pdf");
+
+        //localFile->setFileName("download.pdf");
+
+
+        if (!localFile->open(QIODevice::WriteOnly ))
                 return;
         ;
-        localFile.write(reply->readAll());
+        localFile->write(reply->readAll());
 
 
@@ -4704,8 +4743,8 @@
       //QNetworkReply *reply = manager->get(request);
 
+
       if (url.indexOf("/descargas") > 0){
+
         reply = manager->get(request);
-        connect(reply, SIGNAL(readyRead()),
-                this, SLOT(handleDownloadFile()));
         connect(reply, SIGNAL(finished()),
                     this, SLOT(httpDownloadFinished()));
