Skip to content

Commit

Permalink
Remove useless function in Edit Table dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Jan 23, 2017
1 parent b6b94a8 commit f728ff7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
15 changes: 2 additions & 13 deletions src/EditTableDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column)
{
case kName:
// When a field of that name already exists, show a warning to the user and don't apply the new name
if(fieldNameExists(item->text(column)))
if(m_table.findField(item->text(column)))
{
QMessageBox::warning(this, qApp->applicationName(), tr("There already is a field with that name. Please rename it first or choose a different "
"name for this field."));
Expand Down Expand Up @@ -504,7 +504,7 @@ void EditTableDialog::addField()
{
field_name = "Field" + QString::number(field_number);
field_number++;
} while(fieldNameExists(field_name));
} while(m_table.findField(field_name));
tbitem->setText(kName, field_name);
}

Expand Down Expand Up @@ -729,14 +729,3 @@ void EditTableDialog::setTemporary(bool is_temp)
}
}
}

bool EditTableDialog::fieldNameExists(const QString& name)
{
foreach(const sqlb::FieldPtr& ptr, m_table.fields())
{
if(ptr->name() == name)
return true;
}

return false;
}
3 changes: 0 additions & 3 deletions src/EditTableDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ class EditTableDialog : public QDialog

void moveCurrentField(bool down);

// Returns true if there already is a field of that name
bool fieldNameExists(const QString& name);

private slots:
void populateFields();
void addField();
Expand Down

0 comments on commit f728ff7

Please sign in to comment.