예제 #1
0
void TransferListView::remove(const QString& _u, const QString& _p) {
    TransferListItem* item = findTransfer(_u, _p);
    if (! item )
        return;

    if(item->user() == _u && (mGroupMode != None || item->path() == _p)) {
        if(mGroupMode == None) {
            museeq->output("delete item");
            delete item;
        } else {
            delete item;
            TransferListItem* parent = findParent(_u);
            if(parent->childCount() == 0)
                delete parent;
            else
                parent->updateStats();
        }
        return;
    }

}
예제 #2
0
QList<QPair<QString, QString> > Transfers::findSelected(TransferListView* l) {
	QList<QPair<QString, QString> > items;
	QTreeWidgetItemIterator it(mPoppedUpload ? mUploads : mDownloads, QTreeWidgetItemIterator::Selected | QTreeWidgetItemIterator::NotHidden);
	for(; *it; ++it) {
		TransferListItem* item = dynamic_cast<TransferListItem*>(*it);
		if (!item)
            continue;

		if (!item->path().isEmpty())
            items += QPair<QString, QString>(item->user(), item->path());
        else {
            // We would like to delete a group of transfers
            int numChildren = item->childCount();
            for(int childId = 0; childId < numChildren; childId++) {
                TransferListItem* child = dynamic_cast<TransferListItem*>(item->child(childId));
                if (child)
                    items += QPair<QString, QString>(child->user(), child->path());
            }
        }
	}
	return items;
}