| 241 | } |
| 242 | |
| 243 | bool JSPluginModuleSpec::validateMenuTypeModule() |
| 244 | { |
| 245 | QVector<QString> buttonLocationOptions = { |
| 246 | "Main", "Document" |
| 247 | }; |
| 248 | if (!buttonLocationOptions.contains(m_buttonLocation)) { |
| 249 | warn(QString("Unknown ButtonLocation '%1'").arg(m_buttonLocation)); |
| 250 | return false; |
| 251 | } |
| 252 | |
| 253 | if (m_actionIndexes.isEmpty()) { |
| 254 | warn("Empty menu actions"); |
| 255 | return false; |
| 256 | } |
| 257 | |
| 258 | JSPluginSpec *spec = parentSpec(); |
| 259 | bool isAllActionValid = std::all_of(m_actionIndexes.begin(), m_actionIndexes.end(), |
| 260 | [spec, this](const int &index) { |
| 261 | if (index > spec->moduleCount()) { |
| 262 | warn("menu action index out of range"); |
| 263 | return false; |
| 264 | } |
| 265 | JSPluginModuleSpec *ms = spec->module(index); |
| 266 | if (ms->moduleType() != "Action") { |
| 267 | warn("menu module must be action type"); |
| 268 | return false; |
| 269 | } |
| 270 | if (ms->buttonLocation() != "Menu") { |
| 271 | warn("menu module must be located at Menu"); |
| 272 | return false; |
| 273 | } |
| 274 | return true; |
| 275 | }); |
| 276 | |
| 277 | return isAllActionValid; |
| 278 | } |
| 279 | |
| 280 | bool JSPluginModuleSpec::validate() |
| 281 | { |
nothing calls this directly
no test coverage detected