示例#1
0
void DolphinView::slotChangeNameFilter(const QString& nameFilter)
{
    // The name filter of KDirLister does a 'hard' filtering, which
    // means that only the items are shown where the names match
    // exactly the filter. This is non-transparent for the user, which
    // just wants to have a 'soft' filtering: does the name contain
    // the filter string?
    QString adjustedFilter(nameFilter);
    adjustedFilter.insert(0, '*');
    adjustedFilter.append('*');

    m_dirLister->setNameFilter(adjustedFilter);
    m_dirLister->emitChanges();

    // TODO: this is a workaround for QIconView: the item position
    // stay as they are by filtering, only an inserting of an item
    // results to an automatic adjusting of the item position. In Qt4/KDE4
    // this workaround should get obsolete due to Interview.
    KFileView* view = fileView();
    if (view == m_iconsView) {
        KFileItem* first = view->firstFileItem();
        if (first != 0) {
            view->removeItem(first);
            view->insertItem(first);
        }
    }
}
示例#2
0
void DolphinView::slotCompleted()
{
    m_refreshing = true;

    KFileView* view = fileView();
    view->clearView();

    // TODO: in Qt4 the code should get a lot
    // simpler and nicer due to Interview...
    if (m_iconsView != 0) {
        m_iconsView->beginItemUpdates();
    }
    if (m_detailsView != 0) {
        m_detailsView->beginItemUpdates();
    }

    if (m_showProgress) {
        m_statusBar->setProgressText(QString::null);
        m_statusBar->setProgress(100);
        m_showProgress = false;
    }

    KFileItemList items(m_dirLister->items());
    KFileItemListIterator it(items);

    m_fileCount = 0;
    m_folderCount = 0;

    KFileItem* item = 0;
    while ((item = it.current()) != 0) {
        view->insertItem(item);
        if (item->isDir()) {
            ++m_folderCount;
        }
        else {
            ++m_fileCount;
        }
        ++it;
    }

    updateStatusBar();

    if (m_iconsView != 0) {
        // Prevent a flickering of the icon view widget by giving a small
        // timeslot to swallow asynchronous update events.
        m_iconsView->setUpdatesEnabled(false);
        QTimer::singleShot(10, this, SLOT(slotDelayedUpdate()));
    }

    if (m_detailsView != 0) {
        m_detailsView->endItemUpdates();
        m_refreshing = false;
    }
}
示例#3
0
DolphinView::Sorting DolphinView::sorting() const
{
    const QDir::SortSpec spec = fileView()->sorting();

    if (spec & QDir::Time) {
        return SortByDate;
    }

    if (spec & QDir::Size) {
        return SortBySize;
    }

    return SortByName;
}
示例#4
0
KURL::List DolphinView::selectedURLs() const
{
    KURL::List urls;

    const KFileItemList* list = fileView()->selectedItems();
    if (list != 0) {
        KFileItemListIterator it(*list);
        KFileItem* item = 0;
        while ((item = it.current()) != 0) {
            urls.append(item->url());
            ++it;
        }
    }

    return urls;
}
示例#5
0
void DolphinView::setSortOrder(Qt::SortOrder order)
{
    if (sortOrder() != order) {
        KFileView* view = fileView();
        int sorting = view->sorting();
        sorting = (order == Qt::Ascending) ? (sorting & ~QDir::Reversed) :
                                             (sorting | QDir::Reversed);

        ViewProperties props(url());
        props.setSortOrder(order);

        view->setSorting(static_cast<QDir::SortSpec>(sorting));

        emit signalSortOrderChanged(order);
    }
}
示例#6
0
void DolphinView::setSorting(Sorting sorting)
{
    if (sorting != this->sorting()) {
        KFileView* view = fileView();
        int spec = view->sorting() & ~QDir::Name & ~QDir::Size & ~QDir::Time & ~QDir::Unsorted;

        switch (sorting) {
            case SortByName: spec = spec | QDir::Name; break;
            case SortBySize: spec = spec | QDir::Size; break;
            case SortByDate: spec = spec | QDir::Time; break;
            default: break;
        }

        ViewProperties props(url());
        props.setSorting(sorting);

        view->setSorting(static_cast<QDir::SortSpec>(spec));

        emit signalSortingChanged(sorting);
    }
}
示例#7
0
void lmcTransferWindow::createTransfer(MessageType type, FileMode mode, QString* lpszUserId, QString* lpszUserName, XmlMessage* pMessage) {
	FileView fileView(pMessage->data(XN_FILEID));
	fileView.fileSize = pMessage->data(XN_FILESIZE).toLongLong();
	fileView.sizeDisplay = Helper::formatSize(fileView.fileSize);
	fileView.userId = *lpszUserId;
	fileView.userName = *lpszUserName;
    fileView.fileName = pMessage->data(XN_FILENAME);
    fileView.filePath = pMessage->data(XN_FILEPATH);
    fileView.type = type;
	if(mode == FM_Send) {
		fileView.mode = FileView::TM_Send;
        fileView.state = FileView::TS_Send;
	} else {
		fileView.mode = FileView::TM_Receive;
        fileView.state = FileView::TS_Receive;
	}
	fileView.fileDisplay = fileView.fileName + " (" + fileView.sizeDisplay + ")";
	fileView.icon = getIcon(fileView.filePath);
    fileView.startTime = QDateTime::currentDateTime();
    ui.lvTransferList->insertItem(0, &fileView);
    ui.lvTransferList->setCurrentRow(0);
}
示例#8
0
void DolphinView::slotAddItems(const KFileItemList& list)
{
  fileView()->addItemList(list);
  fileView()->updateView();
}
示例#9
0
void DolphinView::slotDeleteItem(KFileItem* item)
{
    fileView()->removeItem(item);
    updateStatusBar();
}
示例#10
0
void DolphinView::slotClear()
{
    fileView()->clearView();
    updateStatusBar();
}
示例#11
0
const KFileItem* DolphinView::currentFileItem() const
{
    return fileView()->currentFileItem();
}
示例#12
0
const KFileItemList* DolphinView::selectedItems() const
{
    return fileView()->selectedItems();
}
示例#13
0
Qt::SortOrder DolphinView::sortOrder() const
{
    return fileView()->isReversed() ? Qt::Descending : Qt::Ascending;
}
示例#14
0
void DolphinView::invertSelection()
{
    fileView()->invertSelection();
}
示例#15
0
void DolphinView::selectAll()
{
    fileView()->selectAll();
}