MCPcopy Create free account
hub / github.com/YACReader/yacreader / folderFromItem

Method folderFromItem

YACReaderLibrary/db/folder_model.cpp:330–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330Folder FolderModel::folderFromItem(FolderItem *folderItem)
331{
332 auto name = folderItem->data(FolderModel::Name).toString();
333 auto parentItem = folderItem->parent();
334
335 QString path;
336 if (parentItem == nullptr) {
337 parentItem = rootItem;
338 path = "/";
339 } else {
340 path = parentItem->data(Columns::Path).toString() + "/" + name;
341 }
342
343 auto folder = Folder(folderItem->id,
344 parentItem->id,
345 name,
346 path,
347 folderItem->data(Columns::Completed).toBool(),
348 folderItem->data(Columns::Finished).toBool(),
349 folderItem->data(Columns::NumChildren).toInt(),
350 folderItem->data(Columns::FirstChildHash).toString(),
351 folderItem->data(Columns::CustomImage).toString(),
352 folderItem->data(Columns::Type).value<YACReader::FileType>(),
353 folderItem->data(Columns::Added).toLongLong(),
354 folderItem->data(Columns::Updated).toLongLong());
355
356 return folder;
357}
358
359void FolderModel::reload(const QModelIndex &index)
360{

Callers

nothing calls this directly

Calls 4

toStringMethod · 0.80
FolderClass · 0.50
dataMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected