| 166 | */ |
| 167 | template<typename Folder> |
| 168 | static QString folderDisplayPath(const std::vector<Folder>& folders, int folderId) |
| 169 | { |
| 170 | QString path; |
| 171 | int cur = folderId; |
| 172 | const int kMax = static_cast<int>(folders.size()); |
| 173 | for (int i = 0; i <= kMax && cur != -1; ++i) { |
| 174 | const Folder* match = nullptr; |
| 175 | for (const auto& f : folders) |
| 176 | if (f.folderId == cur) { |
| 177 | match = &f; |
| 178 | break; |
| 179 | } |
| 180 | |
| 181 | if (!match) |
| 182 | break; |
| 183 | |
| 184 | path = path.isEmpty() ? match->title : (match->title + QLatin1Char('/') + path); |
| 185 | cur = match->parentFolderId; |
| 186 | } |
| 187 | |
| 188 | return path; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * @brief Builds the nested folder hierarchy (folders only) under @p parentId for a cascading |
no test coverage detected