mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
So long, date-insert!
This function is superseded by info-insert date, which is much mightier and more flexible.
This commit is contained in:
parent
4bb3511f25
commit
ed61ce74b7
@ -29,6 +29,10 @@
|
|||||||
* \use_qimage
|
* \use_qimage
|
||||||
This is no longer necessary due to the rewrite of the painter.
|
This is no longer necessary due to the rewrite of the painter.
|
||||||
|
|
||||||
|
* \date_insert_format
|
||||||
|
The function date-insert has been removed and superseded by info-insert date.
|
||||||
|
The latter does not need a pref value anymore.
|
||||||
|
|
||||||
|
|
||||||
!!!The following new LyX functions have been introduced in 2.4:
|
!!!The following new LyX functions have been introduced in 2.4:
|
||||||
|
|
||||||
@ -42,6 +46,11 @@
|
|||||||
* info-insert buffer vcs-*: renamed to info-insert vcs *
|
* info-insert buffer vcs-*: renamed to info-insert vcs *
|
||||||
|
|
||||||
|
|
||||||
|
!!!The following LyX functions have been removed in 2.4:
|
||||||
|
|
||||||
|
* date-insert: obsoleted by info-insert date.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
!!!The following LyX documents have been moved in 2.4:
|
!!!The following LyX documents have been moved in 2.4:
|
||||||
|
|
||||||
|
@ -8343,14 +8343,12 @@ Verbatim
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim
|
\begin_layout Verbatim
|
||||||
|
|
||||||
This is Verbatim.
|
This is Verbatim.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim
|
\begin_layout Verbatim
|
||||||
\noindent
|
\noindent
|
||||||
\align block
|
\align block
|
||||||
|
|
||||||
The following 2 lines are empty:
|
The following 2 lines are empty:
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -8363,7 +8361,6 @@ The following 2 lines are empty:
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim
|
\begin_layout Verbatim
|
||||||
|
|
||||||
Almost everything is allowed in Verbatim:"%&$§#~'`
|
Almost everything is allowed in Verbatim:"%&$§#~'`
|
||||||
\backslash
|
\backslash
|
||||||
}][{|
|
}][{|
|
||||||
@ -8387,7 +8384,6 @@ Verbatim
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim*
|
\begin_layout Verbatim*
|
||||||
|
|
||||||
This is Verbatim*.
|
This is Verbatim*.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -49274,6 +49270,8 @@ text
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Description
|
\begin_layout Description
|
||||||
|
|
||||||
|
\change_deleted -712698321 1534601711
|
||||||
Date
|
Date
|
||||||
\begin_inset space ~
|
\begin_inset space ~
|
||||||
\end_inset
|
\end_inset
|
||||||
@ -49326,6 +49324,8 @@ For example the format
|
|||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
prints the date as day/month/year.
|
prints the date as day/month/year.
|
||||||
|
\change_unchanged
|
||||||
|
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Description
|
\begin_layout Description
|
||||||
|
@ -8601,12 +8601,10 @@ Unformatiert
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim
|
\begin_layout Verbatim
|
||||||
|
|
||||||
Dies ist Unformatiert.
|
Dies ist Unformatiert.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim
|
\begin_layout Verbatim
|
||||||
|
|
||||||
Die folgenden 2 Zeilen sind leer:
|
Die folgenden 2 Zeilen sind leer:
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -8619,7 +8617,6 @@ Die folgenden 2 Zeilen sind leer:
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim
|
\begin_layout Verbatim
|
||||||
|
|
||||||
Fast alles ist in Unformatiert erlaubt:"%&$§#~'`
|
Fast alles ist in Unformatiert erlaubt:"%&$§#~'`
|
||||||
\backslash
|
\backslash
|
||||||
}][{|
|
}][{|
|
||||||
@ -8643,7 +8640,6 @@ Unformatiert
|
|||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Verbatim*
|
\begin_layout Verbatim*
|
||||||
|
|
||||||
Dies ist Unformatiert*.
|
Dies ist Unformatiert*.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
@ -47023,58 +47019,6 @@ Text
|
|||||||
langen Zeile ausgegeben.
|
langen Zeile ausgegeben.
|
||||||
\end_layout
|
\end_layout
|
||||||
|
|
||||||
\begin_layout Description
|
|
||||||
Datumsformat
|
|
||||||
\begin_inset Index idx
|
|
||||||
status collapsed
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
Datumsformat
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Index idx
|
|
||||||
status collapsed
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
Einstellungen ! Datumsformat
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
Das Datumsformat kann eines oder eine Mischung der hier aufgelisteten Formate
|
|
||||||
sein:
|
|
||||||
\begin_inset Newline newline
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Flex URL
|
|
||||||
status collapsed
|
|
||||||
|
|
||||||
\begin_layout Plain Layout
|
|
||||||
|
|
||||||
http://man7.org/linux/man-pages/man1/date.1.html
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Newline newline
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
Zum Beispiel gibt das Format
|
|
||||||
\begin_inset Newline newline
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
%d/%m/%y
|
|
||||||
\begin_inset Newline newline
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
das Datum in der Form Tag/Monat/Jahr aus.
|
|
||||||
\end_layout
|
|
||||||
|
|
||||||
\begin_layout Description
|
\begin_layout Description
|
||||||
Beim
|
Beim
|
||||||
\begin_inset space ~
|
\begin_inset space ~
|
||||||
|
@ -217,6 +217,10 @@ def info_rename_vcstreerevision(line):
|
|||||||
return simple_renaming(line, "info-insert buffer vcs-tree-revision", "info-insert vcs tree-revision")
|
return simple_renaming(line, "info-insert buffer vcs-tree-revision", "info-insert vcs tree-revision")
|
||||||
|
|
||||||
|
|
||||||
|
def remove_date_insert(line):
|
||||||
|
return simple_remove(line, "date-insert")
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
@ -253,6 +257,7 @@ conversions = [
|
|||||||
info_rename_vcsdate,
|
info_rename_vcsdate,
|
||||||
info_rename_vcstime,
|
info_rename_vcstime,
|
||||||
info_rename_vcsrevision,
|
info_rename_vcsrevision,
|
||||||
info_rename_vcstreerevision
|
info_rename_vcstreerevision,
|
||||||
|
remove_date_insert
|
||||||
]]
|
]]
|
||||||
]
|
]
|
||||||
|
@ -111,6 +111,9 @@
|
|||||||
# Incremented to format 27, by spitz
|
# Incremented to format 27, by spitz
|
||||||
# Add optional flavor value to needaux flag
|
# Add optional flavor value to needaux flag
|
||||||
|
|
||||||
|
# Incremented to format 28, by spitz
|
||||||
|
# Remove date_insert_format
|
||||||
|
|
||||||
# NOTE: The format should also be updated in LYXRC.cpp and
|
# NOTE: The format should also be updated in LYXRC.cpp and
|
||||||
# in configure.py.
|
# in configure.py.
|
||||||
|
|
||||||
@ -405,6 +408,11 @@ def remove_font_encoding(line):
|
|||||||
return no_match
|
return no_match
|
||||||
return (True, "")
|
return (True, "")
|
||||||
|
|
||||||
|
def remove_date_insert_format(line):
|
||||||
|
if not line.lower().startswith("\\date_insert_format "):
|
||||||
|
return no_match
|
||||||
|
return (True, "")
|
||||||
|
|
||||||
# End conversions for LyX 2.3 to 2.4
|
# End conversions for LyX 2.3 to 2.4
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
@ -446,5 +454,6 @@ conversions = [
|
|||||||
[ 24, [rename_collapsible]],
|
[ 24, [rename_collapsible]],
|
||||||
[ 25, [remove_use_qimage]],
|
[ 25, [remove_use_qimage]],
|
||||||
[ 26, [remove_font_encoding]],
|
[ 26, [remove_font_encoding]],
|
||||||
[ 27, []]
|
[ 27, []],
|
||||||
|
[ 28, [remove_date_insert_format]]
|
||||||
]
|
]
|
||||||
|
@ -241,7 +241,7 @@ enum FuncCode
|
|||||||
LFUN_PREFERENCES_SAVE,
|
LFUN_PREFERENCES_SAVE,
|
||||||
LFUN_HELP_OPEN, // Jug 990627
|
LFUN_HELP_OPEN, // Jug 990627
|
||||||
// 175
|
// 175
|
||||||
LFUN_DATE_INSERT, // jdblair 20000131
|
LFUN_LAYOUT_TOGGLE, // lasgouttes 20180514
|
||||||
LFUN_LANGUAGE, // Dekel 20000203
|
LFUN_LANGUAGE, // Dekel 20000203
|
||||||
LFUN_ERT_INSERT, // Jug 20000218
|
LFUN_ERT_INSERT, // Jug 20000218
|
||||||
LFUN_FOOTNOTE_INSERT, // Jug 20000307
|
LFUN_FOOTNOTE_INSERT, // Jug 20000307
|
||||||
@ -479,9 +479,8 @@ enum FuncCode
|
|||||||
LFUN_BUFFER_ANONYMIZE, // sanda, 20180201
|
LFUN_BUFFER_ANONYMIZE, // sanda, 20180201
|
||||||
LFUN_GRAPHICS_UNIFY, // sanda, 20180207
|
LFUN_GRAPHICS_UNIFY, // sanda, 20180207
|
||||||
LFUN_MASTER_BUFFER_EXPORT, // rkh, 20180417
|
LFUN_MASTER_BUFFER_EXPORT, // rkh, 20180417
|
||||||
LFUN_LAYOUT_TOGGLE, // lasgouttes 20180514
|
|
||||||
// 375
|
|
||||||
LFUN_INSET_END_EDIT, // gb/rkh, 20180605
|
LFUN_INSET_END_EDIT, // gb/rkh, 20180605
|
||||||
|
// 375
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1365,19 +1365,6 @@ void LyXAction::init()
|
|||||||
*/
|
*/
|
||||||
{ LFUN_CUT, "cut", Noop, Edit },
|
{ LFUN_CUT, "cut", Noop, Edit },
|
||||||
|
|
||||||
/*!
|
|
||||||
* \var lyx::FuncCode lyx::LFUN_DATE_INSERT
|
|
||||||
* \li Action: Inserts the current date.
|
|
||||||
* \li Syntax: date-insert [<ARG>]
|
|
||||||
* \li Params: <ARG>: Format of date. The default value (%x) can be set
|
|
||||||
in Preferences->Output->General->Date format. For
|
|
||||||
possible formats see the manual page of the
|
|
||||||
strftime function.
|
|
||||||
* \li Origin: jdblair, 31 Jan 2000
|
|
||||||
* \endvar
|
|
||||||
*/
|
|
||||||
{ LFUN_DATE_INSERT, "date-insert", Noop, Edit },
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \var lyx::FuncCode lyx::LFUN_DEBUG_LEVEL_SET
|
* \var lyx::FuncCode lyx::LFUN_DEBUG_LEVEL_SET
|
||||||
* \li Action: Set debug output level.
|
* \li Action: Set debug output level.
|
||||||
|
@ -59,7 +59,7 @@ namespace {
|
|||||||
|
|
||||||
// The format should also be updated in configure.py, and conversion code
|
// The format should also be updated in configure.py, and conversion code
|
||||||
// should be added to prefs2prefs_prefs.py.
|
// should be added to prefs2prefs_prefs.py.
|
||||||
static unsigned int const LYXRC_FILEFORMAT = 27; // spitz: add flavor value to needaux flag
|
static unsigned int const LYXRC_FILEFORMAT = 28; // spitz: remove \\date_insert_format
|
||||||
// when adding something to this array keep it sorted!
|
// when adding something to this array keep it sorted!
|
||||||
LexerKeyword lyxrcTags[] = {
|
LexerKeyword lyxrcTags[] = {
|
||||||
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
|
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
|
||||||
@ -92,7 +92,6 @@ LexerKeyword lyxrcTags[] = {
|
|||||||
{ "\\copier", LyXRC::RC_COPIER },
|
{ "\\copier", LyXRC::RC_COPIER },
|
||||||
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
|
{ "\\cursor_follows_scrollbar", LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR },
|
||||||
{ "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
|
{ "\\cursor_width", LyXRC::RC_CURSOR_WIDTH },
|
||||||
{ "\\date_insert_format", LyXRC::RC_DATE_INSERT_FORMAT },
|
|
||||||
{ "\\def_file", LyXRC::RC_DEFFILE },
|
{ "\\def_file", LyXRC::RC_DEFFILE },
|
||||||
{ "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
|
{ "\\default_decimal_point", LyXRC::RC_DEFAULT_DECIMAL_POINT },
|
||||||
{ "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
|
{ "\\default_length_unit", LyXRC::RC_DEFAULT_LENGTH_UNIT },
|
||||||
@ -311,7 +310,6 @@ void LyXRC::setDefaults()
|
|||||||
show_banner = true;
|
show_banner = true;
|
||||||
windows_style_tex_paths = false;
|
windows_style_tex_paths = false;
|
||||||
tex_allows_spaces = false;
|
tex_allows_spaces = false;
|
||||||
date_insert_format = "%x";
|
|
||||||
cursor_follows_scrollbar = false;
|
cursor_follows_scrollbar = false;
|
||||||
scroll_below_document = false;
|
scroll_below_document = false;
|
||||||
scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
|
scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
|
||||||
@ -917,9 +915,6 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
|
|||||||
if (lexrc.next())
|
if (lexrc.next())
|
||||||
default_length_unit = (Length::UNIT) lexrc.getInteger();
|
default_length_unit = (Length::UNIT) lexrc.getInteger();
|
||||||
break;
|
break;
|
||||||
case RC_DATE_INSERT_FORMAT:
|
|
||||||
lexrc >> date_insert_format;
|
|
||||||
break;
|
|
||||||
case RC_LANGUAGE_CUSTOM_PACKAGE:
|
case RC_LANGUAGE_CUSTOM_PACKAGE:
|
||||||
lexrc >> language_custom_package;
|
lexrc >> language_custom_package;
|
||||||
break;
|
break;
|
||||||
@ -1592,15 +1587,6 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
|||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
break;
|
break;
|
||||||
// fall through
|
// fall through
|
||||||
case RC_DATE_INSERT_FORMAT:
|
|
||||||
if (ignore_system_lyxrc ||
|
|
||||||
date_insert_format != system_lyxrc.date_insert_format) {
|
|
||||||
os << "\\date_insert_format \"" << date_insert_format
|
|
||||||
<< "\"\n";
|
|
||||||
}
|
|
||||||
if (tag != RC_LAST)
|
|
||||||
break;
|
|
||||||
// fall through
|
|
||||||
case RC_USER_NAME:
|
case RC_USER_NAME:
|
||||||
os << "\\user_name \"" << user_name << "\"\n";
|
os << "\\user_name \"" << user_name << "\"\n";
|
||||||
if (tag != RC_LAST)
|
if (tag != RC_LAST)
|
||||||
@ -2913,7 +2899,6 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
|||||||
case LyXRC::RC_COPIER:
|
case LyXRC::RC_COPIER:
|
||||||
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
|
case LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR:
|
||||||
case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
|
case LyXRC::RC_SCROLL_BELOW_DOCUMENT:
|
||||||
case LyXRC::RC_DATE_INSERT_FORMAT:
|
|
||||||
case LyXRC::RC_GUI_LANGUAGE:
|
case LyXRC::RC_GUI_LANGUAGE:
|
||||||
case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
|
case LyXRC::RC_DEFAULT_OTF_VIEW_FORMAT:
|
||||||
case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
|
case LyXRC::RC_DEFAULT_PLATEX_VIEW_FORMAT:
|
||||||
@ -3153,11 +3138,6 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
|||||||
str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
|
str = _("Show a small box around a Math Macro with the macro name when the cursor is inside.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RC_DATE_INSERT_FORMAT:
|
|
||||||
//xgettext:no-c-format
|
|
||||||
str = _("This accepts the normal strftime formats; see man strftime for full details. E.g.\"%A, %e. %B %Y\".");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RC_DEFFILE:
|
case RC_DEFFILE:
|
||||||
str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
|
str = _("Command definition file. Can either specify an absolute path, or LyX will look in its global and local commands/ directories.");
|
||||||
break;
|
break;
|
||||||
|
@ -66,7 +66,6 @@ public:
|
|||||||
RC_COPIER,
|
RC_COPIER,
|
||||||
RC_CURSOR_FOLLOWS_SCROLLBAR,
|
RC_CURSOR_FOLLOWS_SCROLLBAR,
|
||||||
RC_CURSOR_WIDTH,
|
RC_CURSOR_WIDTH,
|
||||||
RC_DATE_INSERT_FORMAT,
|
|
||||||
RC_DEFAULT_DECIMAL_POINT,
|
RC_DEFAULT_DECIMAL_POINT,
|
||||||
RC_DEFAULT_LENGTH_UNIT,
|
RC_DEFAULT_LENGTH_UNIT,
|
||||||
RC_DEFAULT_OTF_VIEW_FORMAT,
|
RC_DEFAULT_OTF_VIEW_FORMAT,
|
||||||
@ -357,8 +356,6 @@ public:
|
|||||||
///
|
///
|
||||||
std::string lyxpipes;
|
std::string lyxpipes;
|
||||||
///
|
///
|
||||||
std::string date_insert_format;
|
|
||||||
///
|
|
||||||
std::string language_custom_package;
|
std::string language_custom_package;
|
||||||
///
|
///
|
||||||
bool language_auto_begin;
|
bool language_auto_begin;
|
||||||
|
@ -1750,14 +1750,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_DATE_INSERT: {
|
|
||||||
string const format = cmd.argument().empty()
|
|
||||||
? lyxrc.date_insert_format : to_utf8(cmd.argument());
|
|
||||||
string const time = formatted_time(current_time(), format);
|
|
||||||
lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, time));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case LFUN_MOUSE_TRIPLE:
|
case LFUN_MOUSE_TRIPLE:
|
||||||
if (cmd.button() == mouse_button::button1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
tm->cursorHome(cur);
|
tm->cursorHome(cur);
|
||||||
@ -3271,13 +3263,6 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
enable = !inDescriptionItem(cur);
|
enable = !inDescriptionItem(cur);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DATE_INSERT: {
|
|
||||||
string const format = cmd.argument().empty()
|
|
||||||
? lyxrc.date_insert_format : to_utf8(cmd.argument());
|
|
||||||
enable = support::os::is_valid_strftime(format);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case LFUN_LANGUAGE:
|
case LFUN_LANGUAGE:
|
||||||
enable = !cur.paragraph().isPassThru();
|
enable = !cur.paragraph().isPassThru();
|
||||||
flag.setOnOff(cmd.getArg(0) == cur.real_current_font.language()->lang());
|
flag.setOnOff(cmd.getArg(0) == cur.real_current_font.language()->lang());
|
||||||
|
@ -349,35 +349,6 @@ static void setComboxFont(QComboBox * cb, string const & family,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// StrftimeValidator
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class StrftimeValidator : public QValidator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StrftimeValidator(QWidget *);
|
|
||||||
QValidator::State validate(QString & input, int & pos) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
StrftimeValidator::StrftimeValidator(QWidget * parent)
|
|
||||||
: QValidator(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QValidator::State StrftimeValidator::validate(QString & input, int & /*pos*/) const
|
|
||||||
{
|
|
||||||
if (is_valid_strftime(fromqstr(input)))
|
|
||||||
return QValidator::Acceptable;
|
|
||||||
else
|
|
||||||
return QValidator::Intermediate;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// PrefOutput
|
// PrefOutput
|
||||||
@ -389,12 +360,9 @@ PrefOutput::PrefOutput(GuiPreferences * form)
|
|||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
DateED->setValidator(new StrftimeValidator(DateED));
|
|
||||||
dviCB->setValidator(new NoNewLineValidator(dviCB));
|
dviCB->setValidator(new NoNewLineValidator(dviCB));
|
||||||
pdfCB->setValidator(new NoNewLineValidator(pdfCB));
|
pdfCB->setValidator(new NoNewLineValidator(pdfCB));
|
||||||
|
|
||||||
connect(DateED, SIGNAL(textChanged(QString)),
|
|
||||||
this, SIGNAL(changed()));
|
|
||||||
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
|
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
|
||||||
this, SIGNAL(changed()));
|
this, SIGNAL(changed()));
|
||||||
connect(overwriteCO, SIGNAL(activated(int)),
|
connect(overwriteCO, SIGNAL(activated(int)),
|
||||||
@ -430,19 +398,8 @@ PrefOutput::PrefOutput(GuiPreferences * form)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrefOutput::on_DateED_textChanged(const QString &)
|
|
||||||
{
|
|
||||||
QString t = DateED->text();
|
|
||||||
int p = 0;
|
|
||||||
bool valid = DateED->validator()->validate(t, p)
|
|
||||||
== QValidator::Acceptable;
|
|
||||||
setValid(DateLA, valid);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PrefOutput::applyRC(LyXRC & rc) const
|
void PrefOutput::applyRC(LyXRC & rc) const
|
||||||
{
|
{
|
||||||
rc.date_insert_format = fromqstr(DateED->text());
|
|
||||||
rc.plaintext_linelen = plaintextLinelengthSB->value();
|
rc.plaintext_linelen = plaintextLinelengthSB->value();
|
||||||
rc.forward_search_dvi = fromqstr(dviCB->currentText());
|
rc.forward_search_dvi = fromqstr(dviCB->currentText());
|
||||||
rc.forward_search_pdf = fromqstr(pdfCB->currentText());
|
rc.forward_search_pdf = fromqstr(pdfCB->currentText());
|
||||||
@ -467,7 +424,6 @@ void PrefOutput::applyRC(LyXRC & rc) const
|
|||||||
|
|
||||||
void PrefOutput::updateRC(LyXRC const & rc)
|
void PrefOutput::updateRC(LyXRC const & rc)
|
||||||
{
|
{
|
||||||
DateED->setText(toqstr(rc.date_insert_format));
|
|
||||||
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
|
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
|
||||||
dviCB->setEditText(toqstr(rc.forward_search_dvi));
|
dviCB->setEditText(toqstr(rc.forward_search_dvi));
|
||||||
pdfCB->setEditText(toqstr(rc.forward_search_pdf));
|
pdfCB->setEditText(toqstr(rc.forward_search_pdf));
|
||||||
@ -3440,7 +3396,6 @@ GuiPreferences::GuiPreferences(GuiView & lv)
|
|||||||
addModule(new PrefLanguage(this));
|
addModule(new PrefLanguage(this));
|
||||||
addModule(new PrefSpellchecker(this));
|
addModule(new PrefSpellchecker(this));
|
||||||
|
|
||||||
//for strftime validator
|
|
||||||
PrefOutput * output = new PrefOutput(this);
|
PrefOutput * output = new PrefOutput(this);
|
||||||
addModule(output);
|
addModule(output);
|
||||||
addModule(new PrefLatex(this));
|
addModule(new PrefLatex(this));
|
||||||
@ -3464,9 +3419,6 @@ GuiPreferences::GuiPreferences(GuiView & lv)
|
|||||||
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
|
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
|
||||||
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
|
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
|
||||||
bc().setRestore(buttonBox->button(QDialogButtonBox::Reset));
|
bc().setRestore(buttonBox->button(QDialogButtonBox::Reset));
|
||||||
|
|
||||||
// initialize the strftime validator
|
|
||||||
bc().addCheckedLineEdit(output->DateED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,9 +163,6 @@ public:
|
|||||||
|
|
||||||
virtual void applyRC(LyXRC & rc) const;
|
virtual void applyRC(LyXRC & rc) const;
|
||||||
virtual void updateRC(LyXRC const & rc);
|
virtual void updateRC(LyXRC const & rc);
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void on_DateED_textChanged(const QString &);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>356</width>
|
<width>356</width>
|
||||||
<height>393</height>
|
<height>442</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -192,33 +192,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="DateLA">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Date format:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>DateED</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="DateED">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Date format for strftime output</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
<item>
|
<item>
|
||||||
|
@ -31,15 +31,6 @@ time_t current_time()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const formatted_time(time_t t, string const & fmt)
|
|
||||||
{
|
|
||||||
struct tm * loc_tm = localtime(&t);
|
|
||||||
char date[50];
|
|
||||||
strftime(date, sizeof(date), fmt.c_str(), loc_tm);
|
|
||||||
return string(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
docstring formatted_datetime(time_t t, string const & fmt)
|
docstring formatted_datetime(time_t t, string const & fmt)
|
||||||
{
|
{
|
||||||
QString qres;
|
QString qres;
|
||||||
|
@ -24,13 +24,6 @@ namespace support {
|
|||||||
|
|
||||||
time_t current_time();
|
time_t current_time();
|
||||||
|
|
||||||
/** Returns a locale-dependent formatting of the date
|
|
||||||
* and time encoded in \c time. The \p fmt string
|
|
||||||
* holds the formatting arguments of \c strftime.
|
|
||||||
* Prefer the function formatted_datetime below.
|
|
||||||
*/
|
|
||||||
std::string const formatted_time(time_t t, std::string const & fmt);
|
|
||||||
|
|
||||||
/** Returns a locale-dependent formatting of the date and time encoded in \c t
|
/** Returns a locale-dependent formatting of the date and time encoded in \c t
|
||||||
* The \p fmt string holds the formatting arguments of QDateTime::toString().
|
* The \p fmt string holds the formatting arguments of QDateTime::toString().
|
||||||
* If fmt is empty then the formatting of the date and time is itself according
|
* If fmt is empty then the formatting of the date and time is itself according
|
||||||
|
@ -111,9 +111,6 @@ std::string latex_path(std::string const & p);
|
|||||||
*/
|
*/
|
||||||
std::string latex_path_list(std::string const & p);
|
std::string latex_path_list(std::string const & p);
|
||||||
|
|
||||||
/// Checks if the format string is suitable on the OS
|
|
||||||
bool is_valid_strftime(std::string const & p);
|
|
||||||
|
|
||||||
/** Returns a string suitable to be passed to popen when
|
/** Returns a string suitable to be passed to popen when
|
||||||
* reading a file.
|
* reading a file.
|
||||||
*/
|
*/
|
||||||
|
@ -364,23 +364,6 @@ string latex_path_list(string const & p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_valid_strftime(string const & p)
|
|
||||||
{
|
|
||||||
string::size_type pos = p.find_first_of('%');
|
|
||||||
while (pos != string::npos) {
|
|
||||||
if (pos + 1 == string::npos)
|
|
||||||
break;
|
|
||||||
if (!containsOnly(p.substr(pos + 1, 1),
|
|
||||||
"aAbBcCdDeEFgGhHIjklmMnOpPrRsStTuUVwWxXyYzZ%+"))
|
|
||||||
return false;
|
|
||||||
if (pos + 2 == string::npos)
|
|
||||||
break;
|
|
||||||
pos = p.find_first_of('%', pos + 2);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// returns a string suitable to be passed to popen when
|
// returns a string suitable to be passed to popen when
|
||||||
// reading a pipe
|
// reading a pipe
|
||||||
char const * popen_read_mode()
|
char const * popen_read_mode()
|
||||||
|
@ -193,23 +193,6 @@ string latex_path_list(string const & p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_valid_strftime(string const & p)
|
|
||||||
{
|
|
||||||
string::size_type pos = p.find_first_of('%');
|
|
||||||
while (pos != string::npos) {
|
|
||||||
if (pos + 1 == string::npos)
|
|
||||||
break;
|
|
||||||
if (!containsOnly(p.substr(pos + 1, 1),
|
|
||||||
"aAbBcCdDeEFgGhHIjklmMnOpPrRsStTuUVwWxXyYzZ%+"))
|
|
||||||
return false;
|
|
||||||
if (pos + 2 == string::npos)
|
|
||||||
break;
|
|
||||||
pos = p.find_first_of('%', pos + 2);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char const * popen_read_mode()
|
char const * popen_read_mode()
|
||||||
{
|
{
|
||||||
return "r";
|
return "r";
|
||||||
|
@ -442,23 +442,6 @@ string latex_path_list(string const & p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_valid_strftime(string const & p)
|
|
||||||
{
|
|
||||||
string::size_type pos = p.find_first_of('%');
|
|
||||||
while (pos != string::npos) {
|
|
||||||
if (pos + 1 == string::npos)
|
|
||||||
break;
|
|
||||||
if (!containsOnly(p.substr(pos + 1, 1),
|
|
||||||
"aAbBcdfHIjmMpSUwWxXyYzZ%"))
|
|
||||||
return false;
|
|
||||||
if (pos + 2 == string::npos)
|
|
||||||
break;
|
|
||||||
pos = p.find_first_of('%', pos + 2);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// returns a string suitable to be passed to popen when
|
// returns a string suitable to be passed to popen when
|
||||||
// reading a pipe
|
// reading a pipe
|
||||||
char const * popen_read_mode()
|
char const * popen_read_mode()
|
||||||
|
Loading…
Reference in New Issue
Block a user