QTfrontend/ui/page/pagedata.cpp
changeset 6932 005393616925
parent 6700 e04da46ee43c
child 6952 7f70f37bbf08
equal deleted inserted replaced
6931:86c951cd0f3f 6932:005393616925
    28 #include <QBuffer>
    28 #include <QBuffer>
    29 
    29 
    30 #include "pagedata.h"
    30 #include "pagedata.h"
    31 #include "databrowser.h"
    31 #include "databrowser.h"
    32 #include "hwconsts.h"
    32 #include "hwconsts.h"
       
    33 #include "DataManager.h"
    33 
    34 
    34 #include "quazip.h"
    35 #include "quazip.h"
    35 #include "quazipfile.h"
    36 #include "quazipfile.h"
    36 
    37 
    37 QLayout * PageDataDownload::bodyLayoutDefinition()
    38 QLayout * PageDataDownload::bodyLayoutDefinition()
    50 }
    51 }
    51 
    52 
    52 void PageDataDownload::connectSignals()
    53 void PageDataDownload::connectSignals()
    53 {
    54 {
    54     connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&)));
    55     connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(request(const QUrl&)));
       
    56     connect(this, SIGNAL(goBack()), this, SLOT(onPageLeave()));
    55 }
    57 }
    56 
    58 
    57 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent)
    59 PageDataDownload::PageDataDownload(QWidget* parent) : AbstractPage(parent)
    58 {
    60 {
    59     initPage();
    61     initPage();
    60 
    62 
    61     web->setOpenLinks(false);
    63     web->setOpenLinks(false);
    62 //    fetchList();
    64 //    fetchList();
       
    65 
       
    66     m_contentDownloaded = false;
    63 }
    67 }
    64 
    68 
    65 void PageDataDownload::request(const QUrl &url)
    69 void PageDataDownload::request(const QUrl &url)
    66 {
    70 {
    67     QUrl finalUrl;
    71     QUrl finalUrl;
   215             if(!file.atEnd())
   219             if(!file.atEnd())
   216             {
   220             {
   217                 qWarning("read all but not EOF");
   221                 qWarning("read all but not EOF");
   218                 return false;
   222                 return false;
   219             }
   223             }
       
   224 
       
   225             m_contentDownloaded = true;
   220         }
   226         }
   221 
   227 
   222         file.close();
   228         file.close();
   223 
   229 
   224         if(file.getZipError()!=UNZ_OK)
   230         if(file.getZipError()!=UNZ_OK)
   230 
   236 
   231     zip.close();
   237     zip.close();
   232 
   238 
   233     return true;
   239     return true;
   234 }
   240 }
       
   241 
       
   242 
       
   243 void PageDataDownload::onPageLeave()
       
   244 {
       
   245     if (m_contentDownloaded)
       
   246     {
       
   247         m_contentDownloaded = false;
       
   248         DataManager::instance().reload();
       
   249     }
       
   250 }