From df8f1d512c60a96f9041f9663b3fdc2db51cba33 Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Tue, 21 Oct 2014 22:48:35 -0400 Subject: Imported Upstream version 2.8.1 --- src/frontend/displaywindow/btactioncollection.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/frontend/displaywindow/btactioncollection.cpp') diff --git a/src/frontend/displaywindow/btactioncollection.cpp b/src/frontend/displaywindow/btactioncollection.cpp index f1956d5..9c26143 100644 --- a/src/frontend/displaywindow/btactioncollection.cpp +++ b/src/frontend/displaywindow/btactioncollection.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2009 by the BibleTime developers. +* Copyright 1999-2011 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -21,8 +21,10 @@ class BtActionItem : public QObject { public: - BtActionItem(QObject* parent) - : QObject(parent) { + BtActionItem(QAction *action, QObject *parent = 0) + : QObject(parent), defaultKeys(action->shortcut()), action(action) + { + // Intentionally empty } QKeySequence defaultKeys; QAction* action; @@ -56,13 +58,11 @@ QAction* BtActionCollection::action(const QString& name) { QAction* BtActionCollection::addAction(const QString& name, QAction* action) { Q_ASSERT(action != 0); - Q_ASSERT(m_actions[name] == 0); /// \todo replacing actions is ok??? - int count; - count = m_actions.count(); - BtActionItem* item = new BtActionItem(this); - item->action = action; - item->defaultKeys = action->shortcut(); - m_actions[name] = item; + if (m_actions.contains(name)) { + delete m_actions[name]; + } + BtActionItem* item = new BtActionItem(action, this); + m_actions.insert(name, item); return action; } -- cgit v1.2.3