void WorkAreaManager::redrawAll(bool update_metrics)
{
- iterator it = work_areas_.begin();
- iterator const en = work_areas_.end();
- for (; it != en; ++it)
- (*it)->redraw(update_metrics);
+ for (WorkArea * wa : work_areas_)
+ wa->redraw(update_metrics);
}
void WorkAreaManager::updateTitles()
{
- iterator it = work_areas_.begin();
- iterator const en = work_areas_.end();
- for (; it != en; ++it)
- (*it)->updateWindowTitle();
+ for (WorkArea * wa : work_areas_)
+ wa->updateWindowTitle();
}
+
} // namespace frontend
} // namespace lyx
Buffer const & buf = wa->bufferView().buffer();
// Set the windows title
docstring title = buf.fileName().displayName(130) + from_ascii("[*]");
+ if (buf.notifiesExternalModification()) {
+ title = bformat(_("%1$s (modified externally)"), title);
+ // If the external modification status has changed, then maybe the status of
+ // buffer-save has changed too.
+ updateToolbars();
+ }
#ifndef Q_WS_MAC
title += from_ascii(" - LyX");
#endif
need_resize_(false), schedule_redraw_(false), preedit_lines_(1),
pixel_ratio_(1.0),
completer_(new GuiCompleter(p, p)), dialog_mode_(false),
- read_only_(false), clean_(true)
+ read_only_(false), clean_(true), externally_modified_(false)
{
}
void GuiWorkArea::updateWindowTitle()
{
Buffer const & buf = bufferView().buffer();
- if (buf.fileName() != d->file_name_ || buf.isReadonly() != d->read_only_
- || buf.lyxvc().vcstatus() != d->vc_status_ || buf.isClean() != d->clean_) {
+ if (buf.fileName() != d->file_name_
+ || buf.isReadonly() != d->read_only_
+ || buf.lyxvc().vcstatus() != d->vc_status_
+ || buf.isClean() != d->clean_
+ || buf.notifiesExternalModification() != d->externally_modified_) {
d->file_name_ = buf.fileName();
d->read_only_ = buf.isReadonly();
d->vc_status_ = buf.lyxvc().vcstatus();
d->clean_ = buf.isClean();
+ d->externally_modified_ = buf.notifiesExternalModification();
Q_EMIT titleChanged(this);
}
}
QString tab_tooltip = it->abs();
if (buf.isReadonly()) {
setTabIcon(tab_index, QIcon(getPixmap("images/", "emblem-readonly", "svgz,png")));
- tab_tooltip = qt_("%1 (read only)").arg(it->abs());
+ tab_tooltip = qt_("%1 (read only)").arg(tab_tooltip);
} else
setTabIcon(tab_index, QIcon());
+ if (buf.notifiesExternalModification()) {
+ QString const warn = qt_("%1 (modified externally)");
+ tab_tooltip = warn.arg(tab_tooltip);
+ tab_text += QChar(0x26a0);
+ }
setTabText(tab_index, tab_text);
setTabToolTip(tab_index, tab_tooltip);
}
QString label = toqstr(b.fileName().displayName(20));
if (!b.isClean())
label += "*";
+ if (b.notifiesExternalModification())
+ label += QChar(0x26a0);
if (i < 10)
label = QString::number(i) + ". " + label + '|' + QString::number(i);
add(MenuItem(MenuItem::Command, label,
QString label = toqstr(b->fileName().displayName(20));
if (!b->isClean())
label += "*";
+ if (b->notifiesExternalModification())
+ label += QChar(0x26a0);
if (i < 10)
label = QString::number(i) + ". " + label + '|' + QString::number(i);
item.submenu().add(MenuItem(MenuItem::Command, label,