X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt%2FGuiChanges.cpp;h=b2f809b026a5bd9c620f339dd060552d09e551d7;hb=b4211ef206827f85378b9392472fdc14e1e9f6c4;hp=c1f331feda3516f6a8699460563ca0c6f82824c4;hpb=90ae998287623b14cef1c75f8385063023a77c00;p=lyx.git diff --git a/src/frontends/qt/GuiChanges.cpp b/src/frontends/qt/GuiChanges.cpp index c1f331feda..b2f809b026 100644 --- a/src/frontends/qt/GuiChanges.cpp +++ b/src/frontends/qt/GuiChanges.cpp @@ -15,10 +15,6 @@ #include "qt_helpers.h" -#include "support/gettext.h" -#include "support/lstrings.h" -#include "support/lyxtime.h" - #include "Author.h" #include "Buffer.h" #include "BufferParams.h" @@ -27,7 +23,6 @@ #include "Cursor.h" #include "FuncRequest.h" #include "LyXRC.h" -#include "Text.h" #include #include @@ -51,8 +46,6 @@ GuiChanges::GuiChanges(GuiView & lv) bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel)); - bc().addReadOnly(acceptPB); - bc().addReadOnly(rejectPB); } @@ -65,8 +58,8 @@ void GuiChanges::updateContents() Change const & c = bufferview()->getCurrentChange(); bool const changePresent = c.type != Change::UNCHANGED; - rejectPB->setEnabled(changePresent); - acceptPB->setEnabled(changePresent); + rejectPB->setEnabled(changePresent && !isBufferReadonly()); + acceptPB->setEnabled(changePresent && !isBufferReadonly()); bool const inserted = c.type == Change::INSERTED; QString text; @@ -77,8 +70,15 @@ void GuiChanges::updateContents() text += inserted ? qt_("Inserted by %1").arg(author) : qt_("Deleted by %1").arg(author); - QString const date = QDateTime::fromTime_t(c.changetime) - .toString(Qt::DefaultLocaleLongDate); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) + QString const date = + QLocale().toString(QDateTime::fromSecsSinceEpoch(c.changetime), + QLocale::LongFormat); +#else + QString const date = + QLocale().toString(QDateTime::fromTime_t(c.changetime), + QLocale::LongFormat); +#endif if (!date.isEmpty()) { if (!author.isEmpty()) text += qt_(" on[[date]] %1").arg(date); @@ -130,9 +130,6 @@ void GuiChanges::rejectChange() } -Dialog * createGuiChanges(GuiView & lv) { return new GuiChanges(lv); } - - } // namespace frontend } // namespace lyx