void UINetworkManagerDialog::addNetworkRequestWidget(UINetworkRequest *pNetworkRequest) { /* Make sure network-request is really exists: */ AssertMsg(pNetworkRequest, ("Network-request doesn't exists!\n")); /* Create new network-request widget: */ UINetworkRequestWidget *pNetworkRequestWidget = new UINetworkRequestWidget(this, pNetworkRequest); m_pWidgetsLayout->addWidget(pNetworkRequestWidget); m_widgets.insert(pNetworkRequest->uuid(), pNetworkRequestWidget); /* Hide label: */ m_pLabel->hide(); /* Show button-box: */ m_pButtonBox->show(); /* If customer made a force-call: */ if (pNetworkRequest->customer()->isItForceCall()) { /* Show dialog: */ showNormal(); } /* Prepare network-request widget's notifications for network-request: */ connect(pNetworkRequestWidget, SIGNAL(sigRetry()), pNetworkRequest, SLOT(sltRetry()), Qt::QueuedConnection); connect(pNetworkRequestWidget, SIGNAL(sigCancel()), pNetworkRequest, SLOT(sltCancel()), Qt::QueuedConnection); }
void UINetworkRequest::prepare() { /* Prepare listeners for network-manager: */ connect(manager(), SIGNAL(sigCancelNetworkRequests()), this, SLOT(sltCancel()), Qt::QueuedConnection); /* Choose first url as current: */ m_iUrlIndex = 0; m_url = m_urls.at(m_iUrlIndex); /* Register network-request in network-manager: */ manager()->registerNetworkRequest(this); /* Prepare network-reply: */ prepareNetworkReply(); }
/* UIDownloader stuff: */ UIMiniProgressWidget* UIDownloader::progressWidget(QWidget *pParent) const { /* Create progress widget: */ UIMiniProgressWidget *pWidget = createProgressWidgetFor(pParent); /* Connect the signal to notify about progress canceled: */ connect(pWidget, SIGNAL(sigCancel()), this, SLOT(sltCancel())); /* Connect the signal to notify about source changed: */ connect(this, SIGNAL(sigSourceChanged(const QString&)), pWidget, SLOT(sltSetSource(const QString&))); /* Connect the signal to notify about downloading progress: */ connect(this, SIGNAL(sigDownloadProgress(qint64, qint64)), pWidget, SLOT(sltSetProgress(qint64, qint64))); /* Make sure the widget is destroyed when this class is deleted: */ connect(this, SIGNAL(destroyed(QObject*)), pWidget, SLOT(deleteLater())); /* Return widget: */ return pWidget; }
/* Initialize: */ void UINetworkRequest::initialize() { /* Prepare listeners for parent(): */ connect(parent(), SIGNAL(sigCancelNetworkRequests()), this, SLOT(sltCancel())); /* Create network-request widget in network-manager dialog: */ m_pNetworkManagerDialog->addNetworkRequestWidget(this); /* Create network-request description in network-manager state-indicator: */ m_pNetworkManagerIndicator->addNetworkRequest(this); /* Choose first network-request as current: */ m_iCurrentRequestIndex = 0; m_request = m_requests[m_iCurrentRequestIndex]; /* Create network-reply: */ prepareNetworkReply(); }