File indexing completed on 2024-09-01 05:28:21
0001 /** 0002 * SPDX-FileCopyrightText: (C) 2010 Brian C. Milco <bcmilco@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "history.h" 0008 #include "global.h" 0009 0010 #include "basketscene.h" 0011 #include "bnpview.h" 0012 0013 #include <KLocalizedString> 0014 #include <QLocale> 0015 0016 HistorySetBasket::HistorySetBasket(BasketScene *basket, QUndoCommand *parent) 0017 : QUndoCommand(parent) 0018 { 0019 setText(i18n("Set current basket to %1", basket->basketName())); 0020 m_folderNameOld = Global::bnpView->currentBasket()->folderName(); 0021 m_folderNameNew = basket->folderName(); 0022 } 0023 0024 void HistorySetBasket::undo() 0025 { 0026 BasketScene *oldBasket = Global::bnpView->basketForFolderName(m_folderNameOld); 0027 Global::bnpView->setCurrentBasket(oldBasket); 0028 } 0029 0030 void HistorySetBasket::redo() 0031 { 0032 BasketScene *curBasket = Global::bnpView->basketForFolderName(m_folderNameNew); 0033 Global::bnpView->setCurrentBasket(curBasket); 0034 }