/*!
    Set the download progress bar value (0 - 100 %). If the given value is 0,
    the progress bar is hidden.

    \param value The progress bar value.
*/
void NmAttachmentListItem::setProgressBarValue(const int value)
{
    NM_FUNCTION;
    
    // First check if the value is 0 or below -> hide progressbar.
    if (0 >= value) {
        removeProgressBar();
        return;
    }

    if (!mProgressBar) {
        mProgressBar = new HbProgressBar(this); 
        mProgressBar->setObjectName("attachmentlistitem_progress");
        mProgressBar->setRange(PROGRESSBAR_MIN,PROGRESSBAR_MAX);
        HbStyle::setItemName(mProgressBar, "progressbar");
        repolish();
    }

    mProgressBar->setProgressValue(value);
    
    // Start hiding the count down.
    if (PROGRESSBAR_MAX <= value){
        hideProgressBar();
    }
}
Exemplo n.º 2
0
void kvoctrainApp::loadfileFromPath(const KURL & url, bool addRecent)
{
    if (!url.path().isEmpty())
    {
      view->setView(0, langset);
      delete doc;
      doc = 0;

      QString format = i18n("Loading %1");
      QString msg = format.arg(url.path());

      slotStatusMsg(msg);
      prepareProgressBar();
      doc = new kvoctrainDoc (this, url);
      removeProgressBar();
      loadDocProps(doc);
      view->setView(doc, langset);
      view->getTable()->setFont(Prefs::tableFont());
      view->adjustContent();
      if (addRecent)
        fileOpenRecent->addURL(url) /*addRecentFile (url.path())*/;
      connect (doc, SIGNAL (docModified(bool)), this, SLOT(slotModifiedDoc(bool)));
      doc->setModified(false);
    }
/*!
    Hides the progress bar. Used if the download is cancelled before 100
    percent is reached.
*/
void NmAttachmentListItem::hideProgressBar()
{
    NM_FUNCTION;
    
    QTimer::singleShot(PROGRESSBAR_HIDE_COUNTDOWN, this, SLOT(removeProgressBar()));
}