Ax browsers menu add

This commit is contained in:
Ralf
2025-07-21 10:34:22 +03:00
parent 64d9fb0558
commit 6ccbaeb6d4
27 changed files with 376 additions and 413 deletions
@@ -65,6 +65,44 @@ void AxScriptEngine::registerObject(QObject *obj) { context.objects.append(obj);
void AxScriptEngine::registerAction(QAction *action) { context.actions.append(action); }
/////
void AxScriptEngine::registerEvent(const QString &type, const QJSValue &handler, const QSet<QString> &list_agents, const QSet<QString> &list_os, const QSet<QString> &list_listeners, const QString &id)
{
QSet<int> os;
if (list_os.contains("windows")) os.insert(1);
if (list_os.contains("linux")) os.insert(2);
if (list_os.contains("macos")) os.insert(3);
AxEvent event = {handler, id, list_agents, list_listeners, os, jsEngine.get()};
if ( type == "FileBroserDisks") context.eventFileBroserDisks.append(event);
else if (type == "FileBroserList") context.eventFileBroserList.append(event);
else if (type == "FileBroserUpload") context.eventFileBroserUpload.append(event);
else if (type == "ProcessBrowserList") context.eventProcessBrowserList.append(event);
}
QList<AxEvent> AxScriptEngine::getEvents(const QString &type)
{
if ( type == "FileBroserDisks") return context.eventFileBroserDisks;
else if (type == "FileBroserList") return context.eventFileBroserList;
else if (type == "FileBroserUpload") return context.eventFileBroserUpload;
else if (type == "ProcessBrowserList") return context.eventProcessBrowserList;
return QList<AxEvent>();
}
void AxScriptEngine::removeEvent(const QString &id)
{
for (int i=0; i< context.eventFileBroserDisks.size(); i++) {
if (id == context.eventFileBroserDisks[i].event_id) {
context.eventFileBroserDisks.removeAt(i);
i--;
}
}
}
/////
void AxScriptEngine::registerMenu(const QString &type, AbstractAxMenuItem *menu, const QSet<QString> &list_agents, const QSet<QString> &list_os, const QSet<QString> &list_listeners)