Browse Source

implement sanitize, one tweak

pull/414/head
dubslow 11 years ago
parent
commit
72a76dba03
  1. 10
      core.cpp
  2. 2
      widget/form/settingsform.cpp

10
core.cpp

@ -888,7 +888,15 @@ void Core::checkConnection() @@ -888,7 +888,15 @@ void Core::checkConnection()
QString Core::sanitize(QString name)
{
// do things
// these are pretty much Windows banned filename characters
QList<QChar> banned = {'/', '\\', ':', '<', '>', '"', '|', '?', '*'};
for (QChar c : banned)
name.replace(c, '_');
// also remove leading and trailing periods
if (name[0] == '.')
name[0] = '_';
if (name.endsWith('.'))
name[name.length()-1] = '_';
return name;
}

2
widget/form/settingsform.cpp

@ -141,6 +141,8 @@ void SettingsForm::show(Ui::MainWindow &ui) @@ -141,6 +141,8 @@ void SettingsForm::show(Ui::MainWindow &ui)
{
profiles.addItem(profile);
}
if (QString current = Settings::getInstance().getCurrentProfile())
profiles.setCurrentText(current);
ui.mainContent->layout()->addWidget(main);
ui.mainHead->layout()->addWidget(head);
main->show();

Loading…
Cancel
Save