[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/games/palapeli/game/interface
From:       Stefan Majewsky <majewsky () gmx ! net>
Date:       2008-08-26 17:09:45
Message-ID: 1219770585.217556.11321.nullmailer () svn ! kde ! org
[Download RAW message or body]

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<KGuiItem>() << KStandardGuiItem::open() << \
KStandardGuiItem::cancel(), i18n("Open a saved game"), parent) +	: \
Palapeli::OnScreenDialog(view, QList<KGuiItem>() << 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()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic