From 9828f045b88c013399f617845ed2ab6268f66074 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mikko=20Kein=C3=A4nen?= Date: Sat, 18 Dec 2010 23:56:20 +0200 Subject: [PATCH] Added confirmation dialog for deleting items. --- doc/tests.txt | 176 ++++++++++++++++++++++++++++++++++++++++ src/views/emufronteditview.cpp | 13 +++ src/views/emufronteditview.h | 1 + 3 files changed, 190 insertions(+) diff --git a/doc/tests.txt b/doc/tests.txt index 91d5866..a547343 100644 --- a/doc/tests.txt +++ b/doc/tests.txt @@ -20,6 +20,182 @@ - Select a folder > A messagebox is shown telling that the Temporary directory has been updated to selected folder. +3. Platform +----------- + +3.1. Add platform +----------------- +- Select 'Config->Set platforms' +> New view is opened with a title describing about setting platforms + > 'Add' and 'OK' buttons active + > 'Edit' and 'Delete' buttons disabled +- Click 'Add' button +> New entry is created to the platform table view + > The name field in the new row is activated for editing +- Type a platform name, e.g. 'Commodore 128' and press enter +> The name field presents the platform name + >editing is disabled +- Add a couple of more platforms (>= 3) + +3.2. Edit platform +---------------- + +3.2.1. Edit platform by double clicking first row +----------------------------------------------- +- double click a platform name in the first row +> The name field in the first row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field presents the platform name + >editing is disabled + +3.2.2. Edit platform by double clicking 2nd row +--------------------------------------------- +- double click a platform name in the second row +> The name field in the second row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field presents the platform name + >editing is disabled + +3.2.3. Edit platform by double clicking last row +---------------------------------------------- +- double click a platform name in the last row +> The name field in the last row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field presents the platform name + >editing is disabled + +3.2.4. Edit platform using 'Edit' button, 1st row +----------------------------------------------- +- Select first row +> Selected row is highlighted +> Edit button is activated +- Click edit button +> The name field in the selected is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field in the selected row presents the platform name + >editing is disabled + +3.2.5. Edit platform using 'Edit' button, 2nd row +----------------------------------------------- +- Select 2nd row +> Selected row is highlighted +> Edit button is activated +- Click edit button +> The name field in the selected row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field in the selected row presents the platform name + >editing is disabled + +3.2.6. Edit platform using 'Edit' button, last row +----------------------------------------------- +- Select last row +> Selected row is highlighted +> Edit button is activated +- Click edit button +> The name field in the selected row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field in the selected row presents the platform name + >editing is disabled + +3.3. Delete platform +-------------------- + +3.3.1. Delete platform, 2nd row +------------------------------- +- Select 2nd row +> Selected row is highlighted +> Delete button is activated +- Click Delete button +> Confirmation dialog is presented +- Select 'No' +> Deleting is aborted and the platform entry remains +- Select the same row, click delete button, answer 'Yes' +> Platform was removed from the table view + +3.3.1. Delete platform, last row +------------------------------- +- Select last row +> Selected row is highlighted +> Delete button is activated +- Click Delete button +> Confirmation dialog is presented +- Select 'No' +> Deleting is aborted and the platform entry remains +- Select the same row, click delete button, answer 'Yes' +> Platform was removed from the table view + +3.3.1. Delete platform, 1st row +------------------------------- +- Select first row +> Selected row is highlighted +> Delete button is activated +- Click Delete button +> Confirmation dialog is presented +- Select 'No' +> Deleting is aborted and the platform entry remains +- Select the same row, click delete button, answer 'Yes' +> Platform was removed from the table view + + + +4.1. Edit platform by double clicking first row +----------------------------------------------- +- double click a platform name in the first row +> The name field in the first row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field presents the platform name + >editing is disabled + +4.2. Edit platform by double clicking 2nd row +--------------------------------------------- +- double click a platform name in the second row +> The name field in the second row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field presents the platform name + >editing is disabled + +4.3. Edit platform by double clicking last row +---------------------------------------------- +- double click a platform name in the last row +> The name field in the last row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field presents the platform name + >editing is disabled + +4.4. Edit platform using 'Edit' button, 1st row +----------------------------------------------- +- Select first row +> Selected row is highlighted +> Edit button is activated +- Click edit button +> The name field in the selected is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field in the selected row presents the platform name + >editing is disabled + +4.5. Edit platform using 'Edit' button, 2nd row +----------------------------------------------- +- Select 2nd row +> Selected row is highlighted +> Edit button is activated +- Click edit button +> The name field in the selected row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field in the selected row presents the platform name + >editing is disabled + +4.6. Edit platform using 'Edit' button, last row +----------------------------------------------- +- Select last row +> Selected row is highlighted +> Edit button is activated +- Click edit button +> The name field in the selected row is activated for editing +- Change the name, eg. 'Commodore 128' -> 'Commodore 64' and press enter +> The name field in the selected row presents the platform name + >editing is disabled + + X. Setupview ------------ diff --git a/src/views/emufronteditview.cpp b/src/views/emufronteditview.cpp index d874a13..3d7b713 100644 --- a/src/views/emufronteditview.cpp +++ b/src/views/emufronteditview.cpp @@ -81,6 +81,9 @@ void EmuFrontEditView::deleteButtonClicked() setButtonsEnabled(false); if (!objectList->currentIndex().isValid()) return; + QString msg = tr("Are you sure you want to delete the selected item? If other data objects are assigned to the selected item, they will be also removed!"); + if (!confirm(msg)) + return; int row = objectList->currentIndex().row(); if ( !model->removeRows(row, 1) ) { errorMessage->showMessage(tr("Failed removing selected item.")); @@ -121,3 +124,13 @@ void EmuFrontEditView::setHiddenColumns() { // default implementation } + +bool EmuFrontEditView::confirm(QString &msg) +{ + int r = QMessageBox::warning(this, tr("Confirm"), msg, QMessageBox::Yes | QMessageBox::No); + if ( r == QMessageBox::No ) + return false; + return true; +} + + diff --git a/src/views/emufronteditview.h b/src/views/emufronteditview.h index e2f7221..b03b466 100644 --- a/src/views/emufronteditview.h +++ b/src/views/emufronteditview.h @@ -55,6 +55,7 @@ private: virtual void setHiddenColumns(); void hideColumns(); void setButtonsEnabled(bool); + bool confirm(QString &msg); }; -- 1.7.9.5