}
//******************************************************
-QAction* NewGeom_Module::addEditCommand(const QString& theId, const QString& theTitle,
- const QString& theTip, const QIcon& theIcon,
- const QKeySequence& theKeys, bool isCheckable)
+QAction* NewGeom_Module::addDesktopCommand(const QString& theId, const QString& theTitle,
+ const QString& theTip, const QIcon& theIcon,
+ const QKeySequence& theKeys, bool isCheckable,
+ const char* theMenuSourceText, const int theMenuPosition)
{
- int aMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1);
+ int aMenu = createMenu(tr(theMenuSourceText), -1, -1);
int aId = myActionsList.size();
myActionsList.append(theId);
QAction* aAction = createAction(aId, theTip, theIcon, theTitle, theTip, aKeys, aDesk,
isCheckable);
aAction->setData(theId);
- createMenu(aId, aMenu, 10);
+ createMenu(aId, aMenu, theMenuPosition);
return aAction;
}
//******************************************************
-void NewGeom_Module::addEditMenuSeparator()
+void NewGeom_Module::addDesktopMenuSeparator(const char* theMenuSourceText, const int theMenuPosition)
{
- int aMenu = createMenu(tr("MEN_DESK_EDIT"), -1, -1);
- createMenu(separator(), aMenu, -1, 10);
+ int aMenu = createMenu(tr(theMenuSourceText), -1, -1);
+ createMenu(separator(), aMenu, -1, theMenuPosition);
}
//******************************************************
const QKeySequence& theKeys = QKeySequence(),
bool isCheckable = false);
- virtual QAction* addEditCommand(const QString& theId, const QString& theTitle,
- const QString& theTip, const QIcon& theIcon,
- const QKeySequence& theKeys, bool isCheckable);
-
- virtual void addEditMenuSeparator();
+ virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
+ const QString& theTip, const QIcon& theIcon,
+ const QKeySequence& theKeys, bool isCheckable,
+ const char* theMenuSourceText,
+ const int theMenuPosition = 10);
+
+ virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
+ const int theMenuPosition = 10);
virtual QMainWindow* desktop() const;
//! \param theIcon - icon
//! \param isCheckable - is checkable or not
//! \param theKeys - hot keys
+ //! \param theMenuSourceText - a source text of the desktop menu
+ //! \param theMenuPosition - a position of the command in the desktop menu
//! returns created action
- virtual QAction* addEditCommand(const QString& theId, const QString& theTitle,
- const QString& theTip, const QIcon& theIcon,
- const QKeySequence& theKeys, bool isCheckable) = 0;
+ virtual QAction* addDesktopCommand(const QString& theId, const QString& theTitle,
+ const QString& theTip, const QIcon& theIcon,
+ const QKeySequence& theKeys, bool isCheckable,
+ const char* theMenuSourceText,
+ const int theMenuPosition = 10) = 0;
//! Insert separator into Edit menu of SALOME desktop
- virtual void addEditMenuSeparator() = 0;
+ virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
+ const int theMenuPosition = 10) = 0;
//! Returns desktop window of SALOME
virtual QMainWindow* desktop() const = 0;
if (isSalomeMode()) {
// Create only Undo, Redo commands
- QAction* aAction = salomeConnector()->addEditCommand("UNDO_CMD", tr("Undo"),
+ QAction* aAction = salomeConnector()->addDesktopCommand("UNDO_CMD", tr("Undo"),
tr("Undo last command"),
QIcon(":pictures/undo.png"),
- QKeySequence::Undo, false);
+ QKeySequence::Undo, false, "MEN_DESK_EDIT");
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onUndo()));
- aAction = salomeConnector()->addEditCommand("REDO_CMD", tr("Redo"), tr("Redo last command"),
+ aAction = salomeConnector()->addDesktopCommand("REDO_CMD", tr("Redo"), tr("Redo last command"),
QIcon(":pictures/redo.png"), QKeySequence::Redo,
- false);
+ false, "MEN_DESK_EDIT");
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRedo()));
- salomeConnector()->addEditMenuSeparator();
- aAction = salomeConnector()->addEditCommand("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
+ salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
+ aAction = salomeConnector()->addDesktopCommand("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
QIcon(":pictures/rebuild.png"), QKeySequence(),
- false);
+ false, "MEN_DESK_EDIT");
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRebuild()));
- salomeConnector()->addEditMenuSeparator();
+ salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
+
+ aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Export NewGeom..."), tr("Export the current NewGeom document into a file"),
+ QIcon(), QKeySequence(),
+ false, "MEN_DESK_FILE");
+ connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSaveAs()));
+
+ aAction = salomeConnector()->addDesktopCommand("OPEN_CMD", tr("Import NewGeom..."), tr("Import a NewGeom file"),
+ QIcon(), QKeySequence(),
+ false, "MEN_DESK_FILE");
+ connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onOpen()));
+ salomeConnector()->addDesktopMenuSeparator("MEN_DESK_FILE");
+
return;
}
// File commands group
std::list<std::string> aFiles;
saveDocument(myCurrentDir, aFiles);
updateCommandStatus();
- myMainWindow->setModifiedState(false);
+ if (!isSalomeMode())
+ myMainWindow->setModifiedState(false);
return true;
}