From f79915be60f1b7890d052e59d957668308def464 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Sun, 3 Feb 2008 18:52:11 +0100 Subject: [PATCH] Update variant actions when creating a new game in the same tab. Fixes #64. --- src/mainwindow.cpp | 6 ++++-- src/mainwindow.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 10ba3d6..99ba27e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -196,9 +196,10 @@ void MainWindow::setupActions() { installRegularAction("toggleMoveList", KIcon("view-list-tree"), i18n("Toggle &move list"), this, SLOT(toggleMoveList())); } -void MainWindow::updateVariantActions() { +void MainWindow::updateVariantActions(bool unplug) { ActionCollection* variant_actions = m_ui.variantActions(); - unplugActionList("variantActions"); + if (unplug) + unplugActionList("variantActions"); if (variant_actions) { plugActionList("variantActions", variant_actions->actions()); } @@ -324,6 +325,7 @@ bool MainWindow::newGame(const QString& variantName, AbstractPosition::Ptr start ui().setController(controller); table()->setPlayers(Player(), Player()); m_main->setTabText(m_main->currentIndex(), text); + updateVariantActions(false); } return true; } diff --git a/src/mainwindow.h b/src/mainwindow.h index 227d62a..327ce34 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -73,7 +73,7 @@ Q_OBJECT KAction* addPromotionAction(const QString& name, const QString& text, const char* uiSlot); KAction* installRegularAction(const QString& name, const KIcon& icon, const QString& text, QObject* obj, const char* slot); - void updateVariantActions(); + void updateVariantActions(bool unplug = true); bool openFile(const QString&); void saveFile(QFile&); -- 2.11.4.GIT