From kde-commits Tue Aug 26 17:09:45 2008 From: Stefan Majewsky Date: Tue, 26 Aug 2008 17:09:45 +0000 To: kde-commits Subject: playground/games/palapeli/game/interface Message-Id: <1219770585.217556.11321.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121977059602915 SVN commit 852807 by majewsky: Add a "Delete" button to the LoadWidget, thereby completing the new interface. Once it has recieved some testing and review, the old interface will be removed completely. M +13 -4 loadwidget.cpp --- trunk/playground/games/palapeli/game/interface/loadwidget.cpp #852806:852807 @@ -40,7 +40,7 @@ } Palapeli::LoadWidget::LoadWidget(QListView* view, Palapeli::AutoscalingItem* parent) - : Palapeli::OnScreenDialog(view, QList() << KStandardGuiItem::open() << KStandardGuiItem::cancel(), i18n("Open a saved game"), parent) + : Palapeli::OnScreenDialog(view, QList() << KStandardGuiItem::open() << KStandardGuiItem::del() << KStandardGuiItem::cancel(), i18n("Open a saved game"), parent) , m_view(view) { connect(this, SIGNAL(buttonPressed(int)), this, SLOT(handleButton(int))); @@ -51,9 +51,18 @@ void Palapeli::LoadWidget::handleButton(int id) { - if (id == 0) //the "Load" button - QTimer::singleShot(animator()->duration(), this, SLOT(load())); //start loading after this item has been hidden - ppIMgr()->hide(Palapeli::InterfaceManager::LoadWidget); + if (id == 1) //the "Delete" button + { + //delete selected games + foreach (const QModelIndex& item, m_view->selectionModel()->selectedIndexes()) + ppMgr()->deleteGame(ppMgr()->savegameModel()->data(item, Qt::DisplayRole).toString()); + } + else + { + if (id == 0) //the "Load" button + QTimer::singleShot(animator()->duration(), this, SLOT(load())); //start loading after this item has been hidden + ppIMgr()->hide(Palapeli::InterfaceManager::LoadWidget); + } } void Palapeli::LoadWidget::handleSelectionChange()