equal
deleted
inserted
replaced
608 return team; |
608 return team; |
609 } |
609 } |
610 |
610 |
611 void PageEditTeam::saveTeam() |
611 void PageEditTeam::saveTeam() |
612 { |
612 { |
613 data().saveToFile(); |
613 HWTeam team = data(); |
|
614 if(!team.wouldOverwriteOtherFile()) |
|
615 { |
|
616 team.saveToFile(); |
|
617 } |
|
618 else |
|
619 { |
|
620 // Name already used -> look for an appropriate name: |
|
621 int i=2; |
|
622 QString origName = team.name(); |
|
623 QString newName; |
|
624 while(team.wouldOverwriteOtherFile()) |
|
625 { |
|
626 newName = tr("%1 (%2)").arg(origName).arg(i++); |
|
627 team.setName(newName); |
|
628 if(i > 1000) |
|
629 break; |
|
630 } |
|
631 |
|
632 QMessageBox teamNameFixedMsg(this); |
|
633 teamNameFixedMsg.setIcon(QMessageBox::Warning); |
|
634 teamNameFixedMsg.setWindowTitle(QMessageBox::tr("Teams - Name already taken")); |
|
635 teamNameFixedMsg.setText(QMessageBox::tr("The team name '%1' is already taken, so your team has been renamed to '%2'.").arg(origName).arg(team.name())); |
|
636 teamNameFixedMsg.setWindowModality(Qt::WindowModal); |
|
637 teamNameFixedMsg.setStandardButtons(QMessageBox::Ok); |
|
638 teamNameFixedMsg.exec(); |
|
639 |
|
640 team.saveToFile(); |
|
641 } |
614 } |
642 } |
615 |
643 |
616 // When the "Use default for all binds" is pressed... |
644 // When the "Use default for all binds" is pressed... |
617 void PageEditTeam::resetAllBinds() |
645 void PageEditTeam::resetAllBinds() |
618 { |
646 { |