1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 20:53:50 +00:00

delete record button

This commit is contained in:
Marek Kochanowicz 2014-03-17 19:28:41 +01:00
parent 7296b09357
commit 95afca0558
2 changed files with 26 additions and 1 deletions

View file

@ -418,6 +418,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
connect(prevButton, SIGNAL(clicked()), this, SLOT(prevId())); connect(prevButton, SIGNAL(clicked()), this, SLOT(prevId()));
connect(revertButton, SIGNAL(clicked()), this, SLOT(revertRecord())); connect(revertButton, SIGNAL(clicked()), this, SLOT(revertRecord()));
connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteRecord()));
mMainLayout = new QVBoxLayout(mainWidget); mMainLayout = new QVBoxLayout(mainWidget);
@ -550,7 +551,30 @@ void CSVWorld::DialogueSubView::revertRecord()
{ {
if (mTable->rowCount() == 0) if (mTable->rowCount() == 0)
{ {
mEditWidget->setDisabled(true); mEditWidget->setDisabled(true); //closing the editor is other option
return;
}
if (mRow >= mTable->rowCount())
{
prevId();
} else {
dataChanged(mTable->index(mRow, 0));
}
}
}
}
void CSVWorld::DialogueSubView::deleteRecord()
{
int rows = mTable->rowCount();
if (!mLocked && mTable->columnCount() > 0 && mRow < mTable->rowCount() )
{
mUndoStack.push(new CSMWorld::DeleteCommand(*mTable, mTable->data(mTable->index (mRow, 0)).toString().toStdString()));
if (rows != mTable->rowCount())
{
if (mTable->rowCount() == 0)
{
mEditWidget->setDisabled(true); //closing the editor is other option
return; return;
} }
if (mRow >= mTable->rowCount()) if (mRow >= mTable->rowCount())

View file

@ -180,6 +180,7 @@ namespace CSVWorld
void prevId(); void prevId();
void revertRecord(); void revertRecord();
void deleteRecord();
void dataChanged(const QModelIndex & index); void dataChanged(const QModelIndex & index);
///\brief we need to care for deleting currently edited record ///\brief we need to care for deleting currently edited record