2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

supporting many templates files

This commit is contained in:
John Preston
2014-08-22 13:53:53 +04:00
parent 63c38712a9
commit 2a8bf173b2
9 changed files with 63 additions and 49 deletions

View File

@@ -3003,7 +3003,7 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
void HistoryWidget::onFieldTabbed() {
QString v = _field.getText(), t = supportTemplate(v.trimmed());
if (!t.isEmpty()) {
bool isImg = (t.indexOf(qsl("img:")) == 0), isFile = (t.indexOf(qsl("file:")) == 0);
bool isImg = t.startsWith(qsl("img:")), isFile = t.startsWith(qsl("file:"));
if (isImg || isFile) {
QString fname = t.mid(isImg ? 4 : 5).trimmed(), text;
int32 lineEnd = fname.indexOf(QChar('\n'));