@@ -1980,29 +1980,57 @@ void MainWindow::tabBarRightClicked(ScintillaNext *editor)
1980
1980
// Focus on the correct tab
1981
1981
dockedEditor->switchToEditor (editor);
1982
1982
1983
- // Create the menu and show it
1983
+ // Create the menu
1984
1984
QMenu *menu = new QMenu (this );
1985
1985
menu->setAttribute (Qt::WA_DeleteOnClose);
1986
1986
1987
- menu->addAction (ui->actionClose );
1988
- menu->addAction (ui->actionCloseAllExceptActive );
1989
- menu->addAction (ui->actionCloseAllToLeft );
1990
- menu->addAction (ui->actionCloseAllToRight );
1991
- menu->addSeparator ();
1992
- menu->addAction (ui->actionSave );
1993
- menu->addAction (ui->actionSaveAs );
1994
- menu->addAction (ui->actionRename );
1995
- menu->addSeparator ();
1996
- menu->addAction (ui->actionReload );
1997
- menu->addSeparator ();
1987
+ // Default actions
1988
+ QStringList actionNames{
1989
+ " actionClose" ,
1990
+ " actionCloseAllExceptActive" ,
1991
+ " actionCloseAllToLeft" ,
1992
+ " actionCloseAllToRight" ,
1993
+ " " ,
1994
+ " actionSave" ,
1995
+ " actionSaveAs" ,
1996
+ " actionRename" ,
1997
+ " " ,
1998
+ " actionReload" ,
1999
+ " " ,
1998
2000
#ifdef Q_OS_WIN
1999
- menu-> addAction (ui-> actionShowInExplorer );
2000
- menu-> addAction (ui-> actionOpenCommandPromptHere );
2001
- menu-> addSeparator ();
2001
+ " actionShowInExplorer" ,
2002
+ " actionOpenCommandPromptHere" ,
2003
+ " " ,
2002
2004
#endif
2003
- menu->addAction (ui->actionCopyFullPath );
2004
- menu->addAction (ui->actionCopyFileName );
2005
- menu->addAction (ui->actionCopyFileDirectory );
2005
+ " actionCopyFullPath" ,
2006
+ " actionCopyFileName" ,
2007
+ " actionCopyFileDirectory"
2008
+ };
2009
+
2010
+ // If the entry exists in the settings, use that
2011
+ ApplicationSettings *settings = app->getSettings ();
2012
+ if (settings->contains (" Gui/TabBarContextMenu" )) {
2013
+ actionNames = settings->value (" Gui/TabBarContextMenu" ).toStringList ();
2014
+ }
2015
+
2016
+ // Populate the menu
2017
+ for (const QString &actionName : actionNames) {
2018
+ if (actionName.isEmpty ()) {
2019
+ menu->addSeparator ();
2020
+ }
2021
+ else {
2022
+ QAction *a = findChild<QAction *>(actionName, Qt::FindDirectChildrenOnly);
2023
+
2024
+ if (a != Q_NULLPTR) {
2025
+ menu->addAction (a);
2026
+ }
2027
+ else {
2028
+ qWarning () << " Cannot locate menu named" << actionName;
2029
+ }
2030
+ }
2031
+ }
2032
+
2033
+ // Show it
2006
2034
menu->popup (QCursor::pos ());
2007
2035
}
2008
2036
0 commit comments