当前位置: 首页>>代码示例>>C++>>正文


C++ KFileItem::size方法代码示例

本文整理汇总了C++中KFileItem::size方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItem::size方法的具体用法?C++ KFileItem::size怎么用?C++ KFileItem::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KFileItem的用法示例。


在下文中一共展示了KFileItem::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: selectionStatusBarText

QString DolphinView::selectionStatusBarText() const
{
    QString text;
    const KFileItemList* list = selectedItems();
    assert((list != 0) && !list->isEmpty());

    int fileCount = 0;
    int folderCount = 0;
    KIO::filesize_t byteSize = 0;
    for (KFileItemListIterator it(*list); it.current() != 0; ++it) {
        KFileItem* item = it.current();
        if (item->isDir()) {
            ++folderCount;
        }
        else {
            ++fileCount;
            byteSize += item->size();
        }
    }

    if (folderCount>0) {
        text = i18n("1 Folder selected","%n Folders selected", folderCount);
    }

    if ((fileCount > 0) && (folderCount > 0)) {
        text += ", ";
    }

    if (fileCount > 0) {
        const QString sizeText(KIO::convertSize(byteSize));
        text += i18n("1 File selected (%1)", "%n Files selected (%1)", fileCount).arg(sizeText);
    }

    return text;
}
开发者ID:serghei,项目名称:kde3-apps-dolphin,代码行数:35,代码来源:dolphinview.cpp

示例2: TQListViewItem

KfFileLVI::KfFileLVI(KfindWindow* lv, const KFileItem &item, const TQString& matchingLine)
  : TQListViewItem(lv),
    fileitem(item)
{
  fileInfo = new TQFileInfo(item.url().path());

  TQString size = TDEGlobal::locale()->formatNumber(item.size(), 0);

  TQDateTime dt;
  dt.setTime_t(item.time(TDEIO::UDS_MODIFICATION_TIME));
  TQString date = TDEGlobal::locale()->formatDateTime(dt);

  int perm_index;
  if(fileInfo->isReadable())
    perm_index = fileInfo->isWritable() ? RW : RO;
  else
    perm_index = fileInfo->isWritable() ? WO : NA;

  // Fill the item with data
  setText(0, item.url().fileName(false));
  setText(1, lv->reducedDir(item.url().directory(false)));
  setText(2, size);
  setText(3, date);
  setText(4, i18n(perm[perm_index]));
  setText(5, matchingLine);

  // put the icon into the leftmost column
  setPixmap(0, item.pixmap(16));
}
开发者ID:Fat-Zer,项目名称:tdebase,代码行数:29,代码来源:kfwin.cpp

示例3: cmp

bool KFileItem::cmp( const KFileItem & item )
{
    bool hasSize1,hasSize2,hasTime1,hasTime2;
    hasSize1 = hasSize2 = hasTime1 = hasTime2 = false;
    return ( m_strName == item.m_strName
             && m_bIsLocalURL == item.m_bIsLocalURL
             && m_fileMode == item.m_fileMode
             && m_permissions == item.m_permissions
             && m_user == item.m_user
             && m_group == item.m_group
             && m_bLink == item.m_bLink
             && m_hidden == item.m_hidden
             && size(hasSize1) == item.size(hasSize2)
	     && hasSize1 == hasSize2
             && time(KIO::UDS_MODIFICATION_TIME, hasTime1) == item.time(KIO::UDS_MODIFICATION_TIME, hasTime2)
	     && hasTime1 == hasTime2
             && (!d || !item.d || d->iconName == item.d->iconName) );

    // Don't compare the mimetypes here. They might not be known, and we don't want to
    // do the slow operation of determining them here.
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例4: slotSortingChanged

void KFileDetailView::slotSortingChanged( int col )
{
    // col is the section here, not the index!
    
    TQDir::SortSpec sort = sorting();
    int sortSpec = -1;
    bool reversed = (col == m_sortingCol) && (sort & TQDir::Reversed) == 0;
    m_sortingCol = col;

    switch( col ) {
        case COL_NAME:
            sortSpec = (sort & ~TQDir::SortByMask | TQDir::Name);
            break;
        case COL_SIZE:
            sortSpec = (sort & ~TQDir::SortByMask | TQDir::Size);
            break;
        case COL_DATE:
            sortSpec = (sort & ~TQDir::SortByMask | TQDir::Time);
            break;

        // the following columns have no equivalent in TQDir, so we set it
        // to TQDir::Unsorted and remember the column (m_sortingCol)
        case COL_OWNER:
        case COL_GROUP:
        case COL_PERM:
            // grmbl, TQDir::Unsorted == SortByMask.
            sortSpec = (sort & ~TQDir::SortByMask);// | TQDir::Unsorted;
            break;
        default:
            break;
    }

    if ( reversed )
        sortSpec |= TQDir::Reversed;
    else
        sortSpec &= ~TQDir::Reversed;

    if ( sort & TQDir::IgnoreCase )
        sortSpec |= TQDir::IgnoreCase;
    else
        sortSpec &= ~TQDir::IgnoreCase;


    KFileView::setSorting( static_cast<TQDir::SortSpec>( sortSpec ) );

    KFileItem *item;
    KFileItemListIterator it( *items() );

    if ( sortSpec & TQDir::Time ) {
        for ( ; (item = it.current()); ++it )
            viewItem(item)->setKey( sortingKey( item->time( TDEIO::UDS_MODIFICATION_TIME ), item->isDir(), sortSpec ));
    }

    else if ( sortSpec & TQDir::Size ) {
        for ( ; (item = it.current()); ++it )
            viewItem(item)->setKey( sortingKey( item->size(), item->isDir(),
                                                sortSpec ));
    }
    else { // Name or Unsorted -> use column text
        for ( ; (item = it.current()); ++it ) {
            KFileListViewItem *i = viewItem( item );
            i->setKey( sortingKey( i->text(m_sortingCol), item->isDir(),
                                   sortSpec ));
        }
    }

    TDEListView::setSorting( m_sortingCol, !reversed );
    TDEListView::sort();

    if ( !m_blockSortingSignal )
        sig->changeSorting( static_cast<TQDir::SortSpec>( sortSpec ) );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:72,代码来源:tdefiledetailview.cpp


注:本文中的KFileItem::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。