- // loop on xmlFiles
- QString aNoAccessFiles;
- for (int i = 0; i < xmlFiles.count(); i++) {
- QString xmlFile = xmlFiles[ i ];
-
- QFile file (xmlFile);
- if (file.exists() && file.open(QIODevice::ReadOnly)) {
- file.close();
-
- GEOMGUI_XmlHandler* aXmlHandler = new GEOMGUI_XmlHandler();
- ASSERT(aXmlHandler);
-
- QXmlInputSource source (&file);
- QXmlSimpleReader reader;
- reader.setContentHandler(aXmlHandler);
- reader.setErrorHandler(aXmlHandler);
- bool ok = reader.parse(source);
- file.close();
-
- if (ok) {
- // bind action lib and label to its ID for activateOperation() method proper work
- myPluginLibs[aXmlHandler->myPluginData.myName] = aXmlHandler->myPluginData.myClientLib;
-
- QListIterator<GEOMGUI_ActionData> anActionsIter (aXmlHandler->myPluginData.myListOfActions);
- while (anActionsIter.hasNext()) {
- GEOMGUI_ActionData anActionData = anActionsIter.next();
-
- //QPixmap icon = resMgr->loadPixmap("GEOM", tr(anActionData.myIcon.toLatin1().constData()));
- QPixmap icon = resMgr->loadPixmap(aXmlHandler->myPluginData.myName,
- anActionData.myIcon.toLatin1().constData());
-
- // path to action in menu
- QStringList smenus = anActionData.myMenu.split( "/" );
- QString actionName = smenus.last();
- actionName = actionName.toUpper().prepend("MEN_");
- smenus.removeLast();
-
- // path to action in toolbar
- QStringList stools = anActionData.myTooltip.split( "/" );
- QString actionTool = stools.last();
- actionTool = actionTool.toUpper().prepend("TOP_");
- stools.removeLast();
-
- QString actionStat = anActionData.myStatusBar;
- actionStat = actionStat.toUpper().prepend("STB_");
-
- createAction(id, // ~ anActionData.myLabel
- tr(actionTool.toLatin1().constData()),
- icon,
- tr(actionName.toLatin1().constData()),
- tr(actionStat.toLatin1().constData()),
- 0 /*accel*/,
- application()->desktop(),
- false /*toggle*/,
- this, SLOT(OnGUIEvent()),
- QString() /*shortcutAction*/);
-
- int menuId = -1;
- foreach (QString subMenu, smenus) {
- subMenu = subMenu.toUpper().prepend("MEN_");
- menuId = createMenu(tr(subMenu.toLatin1().constData()), menuId, -1);
- }
- //createMenu(id, pluginMenuId, -1);
- createMenu(id, menuId, -1);