| 15 | } |
| 16 | |
| 17 | Qt::ItemFlags CRecentModel::flags(const QModelIndex &index) const |
| 18 | { |
| 19 | auto f = QAbstractTableModel::flags(index); |
| 20 | if (!index.isValid()) |
| 21 | return f; |
| 22 | |
| 23 | if(index.row() >= m_Items.count()) |
| 24 | return f; |
| 25 | |
| 26 | auto item = m_Items.at(index.row()); |
| 27 | QString szFile = item.GetFile(); |
| 28 | if(szFile.isEmpty()) { |
| 29 | return f; |
| 30 | } |
| 31 | |
| 32 | bool bExist = false; |
| 33 | QFileInfo fi(szFile); |
| 34 | if(m_pParameterApp->GetGlobalParameters()->GetSaveSettingsType() |
| 35 | == CParameterGlobal::SaveSettingsType::File) { |
| 36 | bExist = fi.exists(); |
| 37 | } else { |
| 38 | bExist = m_pDatabase->HasFileContents(item); |
| 39 | } |
| 40 | |
| 41 | if(bExist) |
| 42 | f |= Qt::ItemIsEnabled; |
| 43 | else |
| 44 | f &= ~Qt::ItemIsEnabled; |
| 45 | return f; |
| 46 | } |
| 47 | |
| 48 | QVariant CRecentModel::headerData(int section, Qt::Orientation orientation, int role) const |
| 49 | { |
nothing calls this directly
no test coverage detected