本文整理汇总了C++中KFileItem::time方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItem::time方法的具体用法?C++ KFileItem::time怎么用?C++ KFileItem::time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItem
的用法示例。
在下文中一共展示了KFileItem::time方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
示例2: cachedMetaInfo
static KFileMetaInfo cachedMetaInfo(const KFileItem& file)
{
QString dbName="metainfocache";
if (!QSqlDatabase::contains(dbName))
{
QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE",dbName);
db.setDatabaseName(KStandardDirs::locateLocal("appdata", dbName+".sqlite"));
if (KDE_ISUNLIKELY( !db.open() ))
return KFileMetaInfo(file.url());
initDataBase(db);
}
QSqlDatabase db=QSqlDatabase::database(dbName);
if (!db.isOpen())
return KFileMetaInfo(file.url());
static const QString fields[]={
"translation.translated",
"translation.untranslated",
"translation.fuzzy",
"translation.last_translator",
"translation.source_date",
"translation.translation_date",
"translation.translated_reviewer",
"translation.translated_approver",
"translation.fuzzy_reviewer",
"translation.fuzzy_approver"
};
static const int nFields = sizeof(fields) / sizeof(fields[0]);
QByteArray result;
QSqlQuery queryCache(db);
queryCache.prepare("SELECT * from metainfo where filepath=?");
queryCache.bindValue(0, qHash(file.localPath()));
queryCache.exec();
if (queryCache.next() && file.time(KFileItem::ModificationTime).dateTime()==queryCache.value(2).toDateTime())
{
result=queryCache.value(1).toByteArray();
QDataStream stream(&result,QIODevice::ReadOnly);
//unfortunately direct KFileMetaInfo << operator doesn't work
KFileMetaInfo info;
QVector<QVariant> keys;
stream>>keys;
for(int i=0;i<keys.count();i++)
info.item(fields[i]).setValue(keys.at(i));
return info;
}
示例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.
}
示例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 ) );
}