aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp26
-rw-r--r--src/plugins/bazaar/bazaarplugin.h8
-rw-r--r--src/plugins/clearcase/clearcaseconstants.h2
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp20
-rw-r--r--src/plugins/clearcase/clearcaseplugin.h6
-rw-r--r--src/plugins/cvs/cvsplugin.cpp22
-rw-r--r--src/plugins/cvs/cvsplugin.h6
-rw-r--r--src/plugins/git/gitconstants.h2
-rw-r--r--src/plugins/git/gitplugin.cpp21
-rw-r--r--src/plugins/git/gitplugin.h6
-rw-r--r--src/plugins/mercurial/constants.h3
-rw-r--r--src/plugins/mercurial/mercurialplugin.cpp22
-rw-r--r--src/plugins/mercurial/mercurialplugin.h8
-rw-r--r--src/plugins/perforce/perforceplugin.cpp22
-rw-r--r--src/plugins/perforce/perforceplugin.h6
-rw-r--r--src/plugins/subversion/subversionconstants.h3
-rw-r--r--src/plugins/subversion/subversionplugin.cpp20
-rw-r--r--src/plugins/subversion/subversionplugin.h6
-rw-r--r--src/plugins/vcsbase/basevcssubmiteditorfactory.cpp37
-rw-r--r--src/plugins/vcsbase/basevcssubmiteditorfactory.h9
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.h7
21 files changed, 59 insertions, 203 deletions
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
index 8d6b62e29c..707ad88c2e 100644
--- a/src/plugins/bazaar/bazaarplugin.cpp
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -104,9 +104,6 @@ const char COMMIT[] = "Bazaar.Action.Commit";
const char UNCOMMIT[] = "Bazaar.Action.UnCommit";
const char CREATE_REPOSITORY[] = "Bazaar.Action.CreateRepository";
-// Submit editor actions
-const char DIFFEDITOR[] = "Bazaar.Action.Editor.Diff";
-
const VcsBaseEditorParameters editorParameters[] = {
{ LogOutput, // type
Constants::FILELOG_ID, // id
@@ -175,8 +172,6 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
createMenu(context);
- createSubmitEditorActions();
-
return true;
}
@@ -486,26 +481,6 @@ void BazaarPlugin::update()
m_client->update(state.topLevel(), revertUi.revisionLineEdit->text());
}
-void BazaarPlugin::createSubmitEditorActions()
-{
- Context context(COMMIT_ID);
- Command *command;
-
- m_editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- command = ActionManager::registerAction(m_editorCommit, COMMIT, context);
- command->setAttribute(Command::CA_UpdateText);
- connect(m_editorCommit, &QAction::triggered, this, &BazaarPlugin::commitFromEditor);
-
- m_editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- ActionManager::registerAction(m_editorDiff, DIFFEDITOR, context);
-
- m_editorUndo = new QAction(tr("&Undo"), this);
- ActionManager::registerAction(m_editorUndo, Core::Constants::UNDO, context);
-
- m_editorRedo = new QAction(tr("&Redo"), this);
- ActionManager::registerAction(m_editorRedo, Core::Constants::REDO, context);
-}
-
void BazaarPlugin::commit()
{
if (!promptBeforeCommit())
@@ -559,7 +534,6 @@ void BazaarPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &stat
}
setSubmitEditor(commitEditor);
- commitEditor->registerActions(m_editorUndo, m_editorRedo, m_editorCommit, m_editorDiff);
connect(commitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
this, &BazaarPlugin::diffFromEditorSelected);
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h
index 8e8c9dbfba..54184f5598 100644
--- a/src/plugins/bazaar/bazaarplugin.h
+++ b/src/plugins/bazaar/bazaarplugin.h
@@ -96,13 +96,12 @@ private:
void update();
void commit();
void showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status);
- void commitFromEditor();
+ void commitFromEditor() override;
void uncommit();
void diffFromEditorSelected(const QStringList &files);
// Functions
void createMenu(const Core::Context &context);
- void createSubmitEditorActions();
void createFileActions(const Core::Context &context);
void createDirectoryActions(const Core::Context &context);
void createRepositoryActions(const Core::Context &context);
@@ -127,11 +126,6 @@ private:
Utils::ParameterAction *m_revertFile = nullptr;
Utils::ParameterAction *m_statusFile = nullptr;
- // Submit editor actions
- QAction *m_editorCommit = nullptr;
- QAction *m_editorDiff = nullptr;
- QAction *m_editorUndo = nullptr;
- QAction *m_editorRedo = nullptr;
QAction *m_menuAction = nullptr;
QString m_submitRepository;
diff --git a/src/plugins/clearcase/clearcaseconstants.h b/src/plugins/clearcase/clearcaseconstants.h
index a2b8573b1f..97df059fe3 100644
--- a/src/plugins/clearcase/clearcaseconstants.h
+++ b/src/plugins/clearcase/clearcaseconstants.h
@@ -35,8 +35,6 @@ const char VCS_ID_CLEARCASE[] = "E.ClearCase";
const char CLEARCASE_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.clearcase.submit";
const char CLEARCASECHECKINEDITOR_ID[] = "ClearCase Check In Editor";
const char CLEARCASECHECKINEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "ClearCase Check In Editor");
-const char CHECKIN_SELECTED[] = "ClearCase.CheckInSelected";
-const char DIFF_SELECTED[] = "ClearCase.DiffSelected";
const char TASK_INDEX[] = "ClearCase.Task.Index";
const char KEEP_ACTIVITY[] = "__KEEP__";
enum { debug = 0 };
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index d389118144..5feacbdd2e 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -567,23 +567,6 @@ bool ClearCasePlugin::initialize(const QStringList & /*arguments */, QString *er
clearcaseMenu->addAction(command);
m_commandLocator->appendCommand(command);
- // Actions of the submit editor
- Context clearcasecheckincontext(Constants::CLEARCASECHECKINEDITOR_ID);
-
- m_checkInSelectedAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Check In"), this);
- command = ActionManager::registerAction(m_checkInSelectedAction, Constants::CHECKIN_SELECTED, clearcasecheckincontext);
- command->setAttribute(Command::CA_UpdateText);
- connect(m_checkInSelectedAction, &QAction::triggered, this, &ClearCasePlugin::checkInSelected);
-
- m_checkInDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff Selected Files"), this);
- ActionManager::registerAction(m_checkInDiffAction , Constants::DIFF_SELECTED, clearcasecheckincontext);
-
- m_submitUndoAction = new QAction(tr("&Undo"), this);
- ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, clearcasecheckincontext);
-
- m_submitRedoAction = new QAction(tr("&Redo"), this);
- ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, clearcasecheckincontext);
-
return true;
}
@@ -745,7 +728,6 @@ ClearCaseSubmitEditor *ClearCasePlugin::openClearCaseSubmitEditor(const QString
EditorManager::openEditor(fileName, Constants::CLEARCASECHECKINEDITOR_ID);
ClearCaseSubmitEditor *submitEditor = qobject_cast<ClearCaseSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0);
- submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_checkInSelectedAction, m_checkInDiffAction);
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
this, &ClearCasePlugin::diffCheckInFiles);
submitEditor->setCheckScriptWorkingDirectory(m_checkInView);
@@ -1441,7 +1423,7 @@ void ClearCasePlugin::describe(const QString &source, const QString &changeNr)
}
}
-void ClearCasePlugin::checkInSelected()
+void ClearCasePlugin::commitFromEditor()
{
m_submitActionTriggered = true;
QTC_ASSERT(submitEditor(), return);
diff --git a/src/plugins/clearcase/clearcaseplugin.h b/src/plugins/clearcase/clearcaseplugin.h
index 6aeacf6865..08312077b1 100644
--- a/src/plugins/clearcase/clearcaseplugin.h
+++ b/src/plugins/clearcase/clearcaseplugin.h
@@ -210,7 +210,7 @@ private:
void historyCurrentFile();
void annotateCurrentFile();
void viewStatus();
- void checkInSelected();
+ void commitFromEditor() override;
void diffCheckInFiles(const QStringList &);
void updateIndex();
void updateView();
@@ -281,10 +281,6 @@ private:
QAction *m_checkInAllAction = nullptr;
QAction *m_statusAction = nullptr;
- QAction *m_checkInSelectedAction = nullptr;
- QAction *m_checkInDiffAction = nullptr;
- QAction *m_submitUndoAction = nullptr;
- QAction *m_submitRedoAction = nullptr;
QAction *m_menuAction = nullptr;
bool m_submitActionTriggered = false;
QMutex *m_activityMutex;
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 3dbc5a8a59..706f852384 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -120,8 +120,6 @@ const char CMD_ID_REPOSITORYUPDATE[] = "CVS.RepositoryUpdate";
const char CVS_SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.cvs.submit";
const char CVSCOMMITEDITOR_ID[] = "CVS Commit Editor";
const char CVSCOMMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
-const char SUBMIT_CURRENT[] = "CVS.SubmitCurrentLog";
-const char DIFF_SELECTED[] = "CVS.DiffSelectedFilesInLog";
const VcsBaseEditorParameters editorParameters[] = {
{
@@ -410,23 +408,6 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(m_revertRepositoryAction, &QAction::triggered, this, &CvsPlugin::revertAll);
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
-
- // Actions of the submit editor
- Context cvscommitcontext(CVSCOMMITEDITOR_ID);
-
- m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, cvscommitcontext);
- command->setAttribute(Command::CA_UpdateText);
- connect(m_submitCurrentLogAction, &QAction::triggered, this, &CvsPlugin::submitCurrentLog);
-
- m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- ActionManager::registerAction(m_submitDiffAction , DIFF_SELECTED, cvscommitcontext);
-
- m_submitUndoAction = new QAction(tr("&Undo"), this);
- ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext);
-
- m_submitRedoAction = new QAction(tr("&Redo"), this);
- ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext);
return true;
}
@@ -494,7 +475,6 @@ CvsSubmitEditor *CvsPlugin::openCVSSubmitEditor(const QString &fileName)
IEditor *editor = EditorManager::openEditor(fileName, CVSCOMMITEDITOR_ID);
CvsSubmitEditor *submitEditor = qobject_cast<CvsSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0);
- submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
this, &CvsPlugin::diffCommitFiles);
@@ -1107,7 +1087,7 @@ bool CvsPlugin::describe(const QString &repositoryPath,
return true;
}
-void CvsPlugin::submitCurrentLog()
+void CvsPlugin::commitFromEditor()
{
m_submitActionTriggered = true;
QTC_ASSERT(submitEditor(), return);
diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h
index fdd8eb72f1..c03dd6ae09 100644
--- a/src/plugins/cvs/cvsplugin.h
+++ b/src/plugins/cvs/cvsplugin.h
@@ -114,7 +114,7 @@ private:
void projectStatus();
void updateDirectory();
void updateProject();
- void submitCurrentLog();
+ void commitFromEditor() override;
void diffCommitFiles(const QStringList &);
void logProject();
void logRepository();
@@ -188,10 +188,6 @@ private:
QAction *m_updateRepositoryAction = nullptr;
QAction *m_statusRepositoryAction = nullptr;
- QAction *m_submitCurrentLogAction = nullptr;
- QAction *m_submitDiffAction = nullptr;
- QAction *m_submitUndoAction = nullptr;
- QAction *m_submitRedoAction = nullptr;
QAction *m_menuAction = nullptr;
bool m_submitActionTriggered = false;
diff --git a/src/plugins/git/gitconstants.h b/src/plugins/git/gitconstants.h
index d817fcda28..72cccd0501 100644
--- a/src/plugins/git/gitconstants.h
+++ b/src/plugins/git/gitconstants.h
@@ -46,8 +46,6 @@ const char GIT_REBASE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Reba
const char GIT_CONTEXT[] = "Git Context";
const char GITSUBMITEDITOR_ID[] = "Git Submit Editor";
const char GITSUBMITEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Submit Editor");
-const char SUBMIT_CURRENT[] = "Git.SubmitCurrentLog";
-const char DIFF_SELECTED[] = "Git.DiffSelectedFilesInLog";
const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.git.submit";
const char C_GITEDITORID[] = "Git Editor";
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index bfb259992e..af72beae45 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -640,22 +640,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(createRepositoryAction, &QAction::triggered, this, &GitPlugin::createRepository);
gitContainer->addAction(createRepositoryCommand);
- // Submit editor
- Context submitContext(Constants::GITSUBMITEDITOR_ID);
- m_submitCurrentAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- Command *command = ActionManager::registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
- command->setAttribute(Command::CA_UpdateText);
- connect(m_submitCurrentAction, &QAction::triggered, this, &GitPlugin::submitCurrentLog);
-
- m_diffSelectedFilesAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- ActionManager::registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext);
-
- m_undoAction = new QAction(tr("&Undo"), this);
- ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, submitContext);
-
- m_redoAction = new QAction(tr("&Redo"), this);
- ActionManager::registerAction(m_redoAction, Core::Constants::REDO, submitContext);
-
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
this, &GitPlugin::updateContinueAndAbortCommands);
connect(VcsManager::instance(), &VcsManager::repositoryChanged,
@@ -1002,9 +986,6 @@ IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &
GitSubmitEditor *submitEditor = qobject_cast<GitSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0);
setSubmitEditor(submitEditor);
- // The actions are for some reason enabled by the context switching
- // mechanism. Disable them correctly.
- submitEditor->registerActions(m_undoAction, m_redoAction, m_submitCurrentAction, m_diffSelectedFilesAction);
submitEditor->setCommitData(cd);
submitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
QString title;
@@ -1024,7 +1005,7 @@ IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &
return editor;
}
-void GitPlugin::submitCurrentLog()
+void GitPlugin::commitFromEditor()
{
// Close the submit editor
m_submitActionTriggered = true;
diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h
index f382e3a0ab..999f2ae36b 100644
--- a/src/plugins/git/gitplugin.h
+++ b/src/plugins/git/gitplugin.h
@@ -108,7 +108,7 @@ private slots:
private:
void diffCurrentFile();
void diffCurrentProject();
- void submitCurrentLog();
+ void commitFromEditor() override;
void logFile();
void blameFile();
void logProject();
@@ -186,10 +186,6 @@ private:
Core::CommandLocator *m_commandLocator = nullptr;
- QAction *m_submitCurrentAction = nullptr;
- QAction *m_diffSelectedFilesAction = nullptr;
- QAction *m_undoAction = nullptr;
- QAction *m_redoAction = nullptr;
QAction *m_menuAction = nullptr;
QAction *m_repositoryBrowserAction = nullptr;
QAction *m_mergeToolAction = nullptr;
diff --git a/src/plugins/mercurial/constants.h b/src/plugins/mercurial/constants.h
index d08c3e2fdf..b515c28b8b 100644
--- a/src/plugins/mercurial/constants.h
+++ b/src/plugins/mercurial/constants.h
@@ -86,8 +86,5 @@ const char OUTGOING[] = "Mercurial.Action.Outgoing";
const char COMMIT[] = "Mercurial.Action.Commit";
const char CREATE_REPOSITORY[] = "Mercurial.Action.CreateRepository";
-// Submit editor actions
-const char DIFFEDITOR[] = "Mercurial.Action.Editor.Diff";
-
} // namespace Constants
} // namespace mercurial
diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp
index 12accd6747..662586b7a8 100644
--- a/src/plugins/mercurial/mercurialplugin.cpp
+++ b/src/plugins/mercurial/mercurialplugin.cpp
@@ -145,8 +145,6 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
createMenu(context);
- createSubmitEditorActions();
-
return true;
}
@@ -472,25 +470,6 @@ void MercurialPlugin::outgoing()
m_client->outgoing(state.topLevel());
}
-void MercurialPlugin::createSubmitEditorActions()
-{
- Core::Context context(Constants::COMMIT_ID);
-
- editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- Core::Command *command = Core::ActionManager::registerAction(editorCommit, Core::Id(Constants::COMMIT), context);
- command->setAttribute(Core::Command::CA_UpdateText);
- connect(editorCommit, &QAction::triggered, this, &MercurialPlugin::commitFromEditor);
-
- editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- Core::ActionManager::registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context);
-
- editorUndo = new QAction(tr("&Undo"), this);
- Core::ActionManager::registerAction(editorUndo, Core::Id(Core::Constants::UNDO), context);
-
- editorRedo = new QAction(tr("&Redo"), this);
- Core::ActionManager::registerAction(editorRedo, Core::Id(Core::Constants::REDO), context);
-}
-
void MercurialPlugin::commit()
{
if (!promptBeforeCommit())
@@ -538,7 +517,6 @@ void MercurialPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &s
CommitEditor *commitEditor = static_cast<CommitEditor *>(editor);
setSubmitEditor(commitEditor);
- commitEditor->registerActions(editorUndo, editorRedo, editorCommit, editorDiff);
connect(commitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
this, &MercurialPlugin::diffFromEditorSelected);
commitEditor->setCheckScriptWorkingDirectory(m_submitRepository);
diff --git a/src/plugins/mercurial/mercurialplugin.h b/src/plugins/mercurial/mercurialplugin.h
index 890238b375..696d77d491 100644
--- a/src/plugins/mercurial/mercurialplugin.h
+++ b/src/plugins/mercurial/mercurialplugin.h
@@ -98,7 +98,7 @@ private:
void outgoing();
void commit();
void showCommitWidget(const QList<VcsBase::VcsBaseClient::StatusItem> &status);
- void commitFromEditor();
+ void commitFromEditor() override;
void diffFromEditorSelected(const QStringList &files);
//TODO implement
@@ -116,7 +116,6 @@ private:
void serve();*/
void createMenu(const Core::Context &context);
- void createSubmitEditorActions();
void createFileActions(const Core::Context &context);
void createDirectoryActions(const Core::Context &context);
void createRepositoryActions(const Core::Context &context);
@@ -142,11 +141,6 @@ private:
Utils::ParameterAction *statusFile = nullptr;
QAction *m_createRepositoryAction = nullptr;
- // Submit editor actions
- QAction *editorCommit = nullptr;
- QAction *editorDiff = nullptr;
- QAction *editorUndo = nullptr;
- QAction *editorRedo = nullptr;
QAction *m_menuAction = nullptr;
QString m_submitRepository;
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index 143b07f71a..e63f351676 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -74,8 +74,6 @@ using namespace VcsBase;
namespace Perforce {
namespace Internal {
-const char SUBMIT_CURRENT[] = "Perforce.SubmitCurrentLog";
-const char DIFF_SELECTED[] = "Perforce.DiffSelectedFilesInLog";
const char SUBMIT_MIMETYPE[] = "text/vnd.qtcreator.p4.submit";
const char PERFORCE_CONTEXT[] = "Perforce Context";
@@ -213,8 +211,6 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
mtools->addMenu(perforceContainer);
m_menuAction = perforceContainer->menu()->menuAction();
- Context perforcesubmitcontext(PERFORCE_SUBMIT_EDITOR_ID);
-
Command *command;
m_diffFileAction = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
@@ -378,21 +374,6 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
command = ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, context);
connect(m_filelogAction, &QAction::triggered, this, &PerforcePlugin::filelogFile);
perforceContainer->addAction(command);
-
- m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this);
- command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, perforcesubmitcontext);
- command->setAttribute(Command::CA_UpdateText);
- connect(m_submitCurrentLogAction, &QAction::triggered, this, &PerforcePlugin::submitCurrentLog);
-
- m_diffSelectedFiles = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- ActionManager::registerAction(m_diffSelectedFiles, DIFF_SELECTED, perforcesubmitcontext);
-
- m_undoAction = new QAction(tr("&Undo"), this);
- ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext);
-
- m_redoAction = new QAction(tr("&Redo"), this);
- ActionManager::registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext);
-
return true;
}
@@ -623,7 +604,6 @@ IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName, const
PerforceSubmitEditor *submitEditor = static_cast<PerforceSubmitEditor*>(editor);
setSubmitEditor(submitEditor);
submitEditor->restrictToProjectFiles(depotFileNames);
- submitEditor->registerActions(m_undoAction, m_redoAction, m_submitCurrentLogAction, m_diffSelectedFiles);
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
this, &PerforcePlugin::slotSubmitDiff);
submitEditor->setCheckScriptWorkingDirectory(m_settings.topLevel());
@@ -1295,7 +1275,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
showOutputInEditor(tr("p4 describe %1").arg(n), result.stdOut, VcsBase::DiffOutput, source, codec);
}
-void PerforcePlugin::submitCurrentLog()
+void PerforcePlugin::commitFromEditor()
{
m_submitActionTriggered = true;
QTC_ASSERT(submitEditor(), return);
diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h
index 814969537a..c7824c0548 100644
--- a/src/plugins/perforce/perforceplugin.h
+++ b/src/plugins/perforce/perforceplugin.h
@@ -136,7 +136,7 @@ private:
void logProject();
void logRepository();
- void submitCurrentLog();
+ void commitFromEditor() override;
void printPendingChanges();
void slotSubmitDiff(const QStringList &files);
void setTopLevel(const QString &);
@@ -234,14 +234,10 @@ private:
QAction *m_filelogAction = nullptr;
Utils::ParameterAction *m_logProjectAction = nullptr;
QAction *m_logRepositoryAction = nullptr;
- QAction *m_submitCurrentLogAction = nullptr;
QAction *m_updateAllAction = nullptr;
bool m_submitActionTriggered = false;
- QAction *m_diffSelectedFiles = nullptr;
QString m_commitMessageFileName;
mutable QString m_tempFilePattern;
- QAction *m_undoAction = nullptr;
- QAction *m_redoAction = nullptr;
QAction *m_menuAction = nullptr;
static PerforcePlugin *m_instance;
diff --git a/src/plugins/subversion/subversionconstants.h b/src/plugins/subversion/subversionconstants.h
index 13c0ef4167..1ff8e30d76 100644
--- a/src/plugins/subversion/subversionconstants.h
+++ b/src/plugins/subversion/subversionconstants.h
@@ -49,8 +49,5 @@ const char SUBVERSION_BLAME_EDITOR_ID[] = "Subversion Annotation Editor";
const char SUBVERSION_BLAME_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Subversion Annotation Editor");
const char SUBVERSION_BLAME_MIMETYPE[] = "text/vnd.qtcreator.svn.annotation";
-const char SUBMIT_CURRENT[] = "Subversion.SubmitCurrentLog";
-const char DIFF_SELECTED[] = "Subversion.DiffSelectedFilesInLog";
-
} // namespace Constants
} // namespace Subversion
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index 8084e37603..37166b6450 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -386,23 +386,6 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
subversionMenu->addAction(command);
m_commandLocator->appendCommand(command);
- // Actions of the submit editor
- Context svncommitcontext(Constants::SUBVERSION_COMMIT_EDITOR_ID);
-
- m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
- command = ActionManager::registerAction(m_submitCurrentLogAction, SUBMIT_CURRENT, svncommitcontext);
- command->setAttribute(Command::CA_UpdateText);
- connect(m_submitCurrentLogAction, &QAction::triggered, this, &SubversionPlugin::submitCurrentLog);
-
- m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
- ActionManager::registerAction(m_submitDiffAction , DIFF_SELECTED, svncommitcontext);
-
- m_submitUndoAction = new QAction(tr("&Undo"), this);
- ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext);
-
- m_submitRedoAction = new QAction(tr("&Redo"), this);
- ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext);
-
return true;
}
@@ -485,7 +468,6 @@ SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QStri
SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, return 0);
setSubmitEditor(submitEditor);
- submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
connect(submitEditor, &VcsBaseSubmitEditor::diffSelectedFiles,
this, &SubversionPlugin::diffCommitFiles);
submitEditor->setCheckScriptWorkingDirectory(m_commitRepository);
@@ -867,7 +849,7 @@ void SubversionPlugin::slotDescribe()
describe(state.topLevel(), QString::number(revision));
}
-void SubversionPlugin::submitCurrentLog()
+void SubversionPlugin::commitFromEditor()
{
m_submitActionTriggered = true;
QTC_ASSERT(submitEditor(), return);
diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h
index 35a99e2cd9..13f12559f8 100644
--- a/src/plugins/subversion/subversionplugin.h
+++ b/src/plugins/subversion/subversionplugin.h
@@ -122,7 +122,7 @@ private:
void projectStatus();
void slotDescribe();
void updateProject();
- void submitCurrentLog();
+ void commitFromEditor() override;
void diffCommitFiles(const QStringList &);
void logProject();
void logRepository();
@@ -171,10 +171,6 @@ private:
Utils::ParameterAction *m_commitProjectAction = nullptr;
QAction *m_describeAction = nullptr;
- QAction *m_submitCurrentLogAction = nullptr;
- QAction *m_submitDiffAction = nullptr;
- QAction *m_submitUndoAction = nullptr;
- QAction *m_submitRedoAction = nullptr;
QAction *m_menuAction = nullptr;
bool m_submitActionTriggered = false;
diff --git a/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp b/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp
index b2d05a2835..7b5b1fbab7 100644
--- a/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp
+++ b/src/plugins/vcsbase/basevcssubmiteditorfactory.cpp
@@ -24,24 +24,55 @@
****************************************************************************/
#include "basevcssubmiteditorfactory.h"
+
+#include "vcsbaseplugin.h"
#include "vcsbasesubmiteditor.h"
+#include <coreplugin/actionmanager/actionmanager.h>
+#include <utils/qtcassert.h>
+
+#include <QAction>
+
+using namespace Core;
+
namespace VcsBase {
+const char SUBMIT[] = "Vcs.Submit";
+const char DIFF_SELECTED[] = "Vcs.DiffSelectedFiles";
+
VcsSubmitEditorFactory::VcsSubmitEditorFactory
(const VcsBaseSubmitEditorParameters *parameters,
const EditorCreator &editorCreator,
- QObject *parent)
- : IEditorFactory(parent), m_editorCreator(editorCreator)
+ VcsBasePlugin *plugin)
+ : IEditorFactory(plugin), m_editorCreator(editorCreator)
{
setId(parameters->id);
setDisplayName(QLatin1String(parameters->displayName));
addMimeType(parameters->mimeType);
+
+ Context context(parameters->id);
+ m_undoAction = new QAction(tr("&Undo"), this);
+ ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, context);
+
+ m_redoAction = new QAction(tr("&Redo"), this);
+ ActionManager::registerAction(m_redoAction, Core::Constants::REDO, context);
+
+ QTC_ASSERT(plugin, return);
+ m_submitAction = new QAction(VcsBaseSubmitEditor::submitIcon(),
+ plugin->commitDisplayName(), this);
+ Command *command = ActionManager::registerAction(m_submitAction, SUBMIT, context);
+ command->setAttribute(Command::CA_UpdateText);
+ connect(m_submitAction, &QAction::triggered, plugin, &VcsBasePlugin::commitFromEditor);
+
+ m_diffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
+ ActionManager::registerAction(m_diffAction, DIFF_SELECTED, context);
}
Core::IEditor *VcsSubmitEditorFactory::createEditor()
{
- return m_editorCreator();
+ VcsBaseSubmitEditor *editor = m_editorCreator();
+ editor->registerActions(m_undoAction, m_redoAction, m_submitAction, m_diffAction);
+ return editor;
}
} // namespace VcsBase
diff --git a/src/plugins/vcsbase/basevcssubmiteditorfactory.h b/src/plugins/vcsbase/basevcssubmiteditorfactory.h
index da2e6ffaa9..d74f635698 100644
--- a/src/plugins/vcsbase/basevcssubmiteditorfactory.h
+++ b/src/plugins/vcsbase/basevcssubmiteditorfactory.h
@@ -30,10 +30,13 @@
#include <coreplugin/editormanager/ieditorfactory.h>
#include <functional>
+QT_FORWARD_DECLARE_CLASS(QAction);
+
namespace VcsBase {
class VcsBaseSubmitEditor;
class VcsBaseSubmitEditorParameters;
+class VcsBasePlugin;
// Parametrizable base class for editor factories creating instances of
// VcsBaseSubmitEditor subclasses.
@@ -46,12 +49,16 @@ public:
VcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters *parameters,
const EditorCreator &editorCreator,
- QObject *parent = nullptr);
+ VcsBasePlugin *plugin);
Core::IEditor *createEditor() override;
private:
EditorCreator m_editorCreator;
+ QAction *m_submitAction = nullptr;
+ QAction *m_diffAction = nullptr;
+ QAction *m_undoAction = nullptr;
+ QAction *m_redoAction = nullptr;
};
} // namespace VcsBase
diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h
index 87ba3ce1bc..1bbe0c29b4 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.h
+++ b/src/plugins/vcsbase/vcsbaseplugin.h
@@ -177,9 +177,12 @@ public:
QTextCodec *outputCodec = nullptr,
const QProcessEnvironment &env = QProcessEnvironment());
-protected:
- // Display name of the commit action:
+ // Display name of the commit action
virtual QString commitDisplayName() const;
+
+ virtual void commitFromEditor() = 0;
+
+protected:
// Prompt to save all files before commit:
bool promptBeforeCommit();