| 162 | |
| 163 | |
| 164 | void CsvMenu::updateOpenRecentMenu(std::vector<std::string> files) { |
| 165 | std::string menuItemStr = "&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT; |
| 166 | int menuIndex = find_index("&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT); |
| 167 | if( menuIndex != -1 ) { |
| 168 | clear_submenu(menuIndex); |
| 169 | if( files.size() > 0 ) { |
| 170 | std::string item_tpl = "&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT "/&"; |
| 171 | int i = 0; |
| 172 | for( auto filepath : files ) { |
| 173 | std::string filename_only = std::filesystem::path(filepath).filename().u8string(); |
| 174 | std::string item = item_tpl + filename_only; // + " (" + std::to_string(i+1) + ")"; |
| 175 | add(item.c_str(), FL_COMMAND + ('1' + i), MyMenuCallback, (void *) &(INTEGERS[i]), 0); |
| 176 | ++i; |
| 177 | } |
| 178 | } else { |
| 179 | // no entries available |
| 180 | add("&File/" TCRUNCHER_MENUTEXT_OPEN_RECENT "/&(empty)", 0, 0, 0, FL_MENU_INACTIVE); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | |
| 186 |
no test coverage detected