QString const guiString(QString in)
{
- // recode specially encoded chars in file names
- return in.replace('_', ' ').replace("%26", "&").replace("%28", "(").replace("%29", ")");
+ // recode specially encoded chars in file names (URL encoding and underbar)
+ return QString(QByteArray::fromPercentEncoding(in.toUtf8())).replace('_', ' ');
}
} // namespace anon
QTreeWidgetItem * item = new QTreeWidgetItem();
QString const filename = info.fileName();
QString guiname = filename.left(filename.lastIndexOf(getSuffix())).replace('_', ' ');
- if (translateName())
+ // Special case: defaults.lyx
+ if (type_ == "templates" && guiname == "defaults")
+ guiname = qt_("Default Template");
+ else if (translateName())
guiname = toqstr(translateIfPossible(qstring_to_ucs4(guiString(guiname))));
QIcon file_icon = (realpath.startsWith(toqstr(package().user_support().absFileName()))) ?
user_icon : system_icon;
void GuiLyXFiles::selectItem(QString const item)
{
- QList<QTreeWidgetItem *> twi = filesLW->findItems(item, Qt::MatchExactly|Qt::MatchRecursive);
+ /* Using an intermediary variable flags is needed up to at least
+ * Qt 5.5 because of a subtle namespace issue. See:
+ * https://stackoverflow.com/questions/10755058/qflags-enum-type-conversion-fails-all-of-a-sudden
+ * for details.*/
+ Qt::MatchFlags const flags(Qt::MatchExactly|Qt::MatchRecursive);
+ QList<QTreeWidgetItem *> twi = filesLW->findItems(item, flags);
if (!twi.isEmpty())
twi.first()->setSelected(true);
}