String KeyFileInfo::toString() const { String result; result = format(_T("KeyFileInfo:\n" " Version : %s\n" " Head size : %d bytes\n" " Page size : %s bytes\n" " Key size : %d bytes\n" " PageItem size : %d bytes\n" " Max. keys/leafpage : %d\n" " Max. keys/nonleafpage: %d\n" " File size : %s (%s bytes)\n" " Key count : %s\n" " Tree height : %d\n" " Data pages : %s\n" " Free pages : %s\n" " Utilization rate : %.2lf%%\n" " Rootpage.keyCount : %d\n" " Rootpage index : %s\n") ,m_header.getDbFileVersion().cstr() ,sizeof(m_header) ,format1000(m_pageInfo.m_pageSize).cstr() ,m_header.m_keydef.getSize() ,m_pageInfo.m_itemSize ,m_pageInfo.m_maxKeyCount ,m_pageInfo.m_maxItemCount ,formatFileSize(m_size).cstr(), format1000(m_size).cstr() ,format1000(m_header.m_keyCount).cstr() ,m_treeHeight ,format1000(m_dataPageCount).cstr() ,format1000(m_header.m_freeListSize).cstr() ,m_utilizationRate ,m_rootPageItemCount ,format1000(m_rootPageIndex).cstr() ); if(m_rootPageAddress != DB_NULLADDR) { result += format(_T(" Rootpage offset : %s\n"), format1000(m_rootPageAddress).cstr()); } return result; }
void nDownloadWidget::updateProgress(qint64 done, qint64 total) { double percent = std::max(0.001, (double)done / (double)total); qint64 totalTime = ((double)download->getElapsedTime() / 1000) / percent; seconds += totalTime; itCount++; #warning download time estimation keep all values // why not use Naveo1 time estimation which is much more stable ? qint64 remaining = seconds / itCount - download->getElapsedTime() / 1000; progressBar->setFormat(QString("%p% : %1 (%2) ").arg(remaining < 60 ? QString("%1s").arg(remaining) : QString("%1min %2s").arg(remaining / 60).arg(remaining % 60)).arg(formatFileSize(done, total > MEGA))); progressBar->setRange(0, total); progressBar->setValue(done); }
size_t DeliverSMTP(IMFILE *imf, /* Input file name */ const MAIL_ADDR *sender, const char *targetAddress, const char *path) { static char *savePath = NULL; /* System we previously queued for*/ static SMTP_ADDR addrList[50]; static int subscript = 0; static int addressMax = sizeof addrList / sizeof addrList[0]; static KWBoolean recursive = KWFalse; /* Only one connection at a time */ if (recursive) { if (path == NULL) { printmsg(0,"DeliverSMTP: Recursive flush call!"); panic(); } return DeliverRemote(imf, sender, targetAddress, E_nodename); } /* if (recursive) */ recursive = KWTrue; /*--------------------------------------------------------------------*/ /* Flush previously queued addresses, if needed */ /*--------------------------------------------------------------------*/ if (subscript) { KWBoolean queueNow = KWFalse; if (path == NULL) queueNow = KWTrue; else if (! equal(savePath, path)) queueNow = KWTrue; else if (subscript >= addressMax) queueNow = KWTrue; /*--------------------------------------------------------------------*/ /* We need to actually perform delivery */ /*--------------------------------------------------------------------*/ if (queueNow) { ConnectSMTP(imf, sender, savePath, addrList, subscript, KWTrue); while(subscript-- > 0) { /* Queue failed SMTP mail for local node for retry */ if (!addrList[subscript].processed) { printmsg(0,"Requeuing mail for %s:", addrList[subscript].address); DeliverRemote(imf, sender, addrList[subscript].address, E_nodename); } free(addrList[subscript].address); addrList[subscript].address = NULL; } subscript = 0; } /* if (queueNow && subscript) */ } /* if (savePath != NULL) */ /*--------------------------------------------------------------------*/ /* Return if we only flushing the cache */ /*--------------------------------------------------------------------*/ if (path == NULL) { recursive = KWFalse; return 0; } /*--------------------------------------------------------------------*/ /* Report and queue the current delivery */ /*--------------------------------------------------------------------*/ printmsg(1,"Queuing SMTP mail %sfrom %s to %s via %s", formatFileSize(imf), sender->address, targetAddress, path); savePath = newstr(path); memset(&addrList[subscript], 0, sizeof addrList[subscript]); addrList[subscript].address = strdup(targetAddress); checkref(addrList[subscript].address); subscript++; recursive = KWFalse; return 1; } /* DeliverSMTP */