Exemplo n.º 1
0
void FtpApp::addToList(const QUrlInfo &urlInfo)
{
    QTreeWidgetItem *item = new QTreeWidgetItem;
    item->setText(0, urlInfo.name());
    item->setText(1, QString::number(float(urlInfo.size())/1000)+"KB");
    item->setText(2, urlInfo.owner());
    item->setText(3, urlInfo.group());
    item->setText(4, urlInfo.lastModified().toString("MMM dd yyyy"));    

    fileSize[urlInfo.name()]=urlInfo.size();

    QPixmap pixmap(urlInfo.isDir() ? ":/images/dir.png" : ":/images/file.png");
    item->setIcon(0, pixmap);

    fileList->addTopLevelItem(item);
    if (!fileList->currentItem()) {
        fileList->setCurrentItem(fileList->topLevelItem(0));
        fileList->setEnabled(true);
    }
    statusLabel->setText("Status");
    this->setContentsMargins(0,0,0,0);
    this->setCentralWidget(fileList);
    //if(processLabel!=0) {delete processLabel;std::cout<<"Success";}
    splash->close();
    this->show();
}
Exemplo n.º 2
0
void MainWindow::addToList(const QUrlInfo &urlInfo)
{
    QTreeWidgetItem *item = new QTreeWidgetItem;
    item->setText(0, urlInfo.name());
    item->setText(1, QString::number(urlInfo.size()));
    item->setText(2, urlInfo.owner());
    item->setText(3, urlInfo.group());
    item->setText(4, urlInfo.lastModified().toString("MMM dd yyyy"));
    QPixmap pixmap(urlInfo.isDir() ? "../myFTP/dir.png" : "../myFTP/file.png");
    item->setIcon(0, pixmap);
    isDirectory[urlInfo.name()] = urlInfo.isDir();
    ui->fileList->addTopLevelItem(item);
    if (!ui->fileList->currentItem()) {
        ui->fileList->setCurrentItem(ui->fileList->topLevelItem(0));
        ui->fileList->setEnabled(true);
    }
}
Exemplo n.º 3
0
void DNetLoad::addToList(const QUrlInfo &urlInfo)
{
    QTreeWidgetItem *item = new QTreeWidgetItem;
    item->setText(0, urlInfo.name());
    item->setText(1, QString::number(urlInfo.size()));
    item->setText(2, urlInfo.owner());
    item->setText(3, urlInfo.group());
    item->setText(4, urlInfo.lastModified().toString("yyyy-MM-dd"));

    tree->addTopLevelItem(item);

//    if(!tree->currentItem())
//    {
//        tree->setCurrentItem(tree->topLevelItem(0));
////        tree->setEnabled(true);
//    }
}
Exemplo n.º 4
0
// Make the file list with directories and files
void CFtpSelection::AddToList(const QUrlInfo &urlInfo)
{
	QTreeWidgetItem *item = new QTreeWidgetItem;
	item->setText(0, urlInfo.name());
	item->setText(1, QString::number(urlInfo.size()));
	item->setText(2, urlInfo.owner());
	item->setText(3, urlInfo.group());
	item->setText(4, urlInfo.lastModified().toString("MMM dd yyyy"));

	QPixmap pixmap(urlInfo.isDir() ? ":/translationManager/images/dir.png" : ":/translationManager/images/file.png");
	item->setIcon(0, pixmap);

	isDirectory[urlInfo.name()] = urlInfo.isDir();
	_ui.fileList->addTopLevelItem(item);
	if (!_ui.fileList->currentItem())
	{
		_ui.fileList->setCurrentItem(_ui.fileList->topLevelItem(0));
		_ui.fileList->setEnabled(true);
	}
}
//![10]
void FtpDownloader::addToList(const QUrlInfo &urlInfo)
{
    // Fill an FtpItem with the data from FTP directory listing ...
    FtpItem item;
    item.fileName = urlInfo.name();
    item.fileSize = urlInfo.size();
    item.owner = urlInfo.owner();
    item.group = urlInfo.group();
    item.time = urlInfo.lastModified();
    item.isDirectory = urlInfo.isDir();

    const bool wasEmpty = m_model.isEmpty();

    // ... and append it to the model
    m_model.append(item);

    // If this is the first entry in the model, also update the status property
    if (wasEmpty) {
        m_selectionPossible = true;
        emit selectionPossibleChanged();
    }
}