Skip to content

Commit f05f839

Browse files
Add: Add settings for date and time format.
1 parent 5ce67ca commit f05f839

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

src/manage_sql.c

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16041,6 +16041,28 @@ check_db_settings ()
1604116041
" || ' in SecInfo updates before the end of the file'"
1604216042
" || ' being processed.',"
1604316043
" '100' );");
16044+
16045+
if (sql_int ("SELECT count(*) FROM settings"
16046+
" WHERE uuid = '" SETTING_UUID_USER_INTERFACE_TIME_FORMAT "'"
16047+
" AND " ACL_IS_GLOBAL () ";")
16048+
== 0)
16049+
sql ("INSERT into settings (uuid, owner, name, comment, value)"
16050+
" VALUES"
16051+
" ('" SETTING_UUID_USER_INTERFACE_TIME_FORMAT "', NULL,"
16052+
" 'User Interface Time Format',"
16053+
" 'Preferred time format to be used in client user interfaces.',"
16054+
" '24' );");
16055+
16056+
if (sql_int ("SELECT count(*) FROM settings"
16057+
" WHERE uuid = '" SETTING_UUID_USER_INTERFACE_DATE_FORMAT "'"
16058+
" AND " ACL_IS_GLOBAL () ";")
16059+
== 0)
16060+
sql ("INSERT into settings (uuid, owner, name, comment, value)"
16061+
" VALUES"
16062+
" ('" SETTING_UUID_USER_INTERFACE_DATE_FORMAT "', NULL,"
16063+
" 'User Interface Date Format',"
16064+
" 'Preferred date format to be used in client user interfaces.',"
16065+
" 'wdmy' );");
1604416066
}
1604516067

1604616068
/**
@@ -52453,7 +52475,9 @@ modify_setting (const gchar *uuid, const gchar *name,
5245352475
|| strcmp (uuid, "578a1c14-e2dc-45ef-a591-89d31391d007") == 0
5245452476
|| strcmp (uuid, "02e294fa-061b-11e6-ae64-28d24461215b") == 0
5245552477
|| strcmp (uuid, "5a9046cc-0628-11e6-ba53-28d24461215b") == 0
52456-
|| strcmp (uuid, "a09285b0-2d47-49b6-a4ef-946ee71f1d5c") == 0))
52478+
|| strcmp (uuid, "a09285b0-2d47-49b6-a4ef-946ee71f1d5c") == 0
52479+
|| strcmp (uuid, "11deb7ff-550b-4950-aacf-06faeb7c61b9") == 0
52480+
|| strcmp (uuid, "d9857b7c-1159-4193-9bc0-18fae5473a69") == 0))
5245752481
{
5245852482
gsize value_size;
5245952483
gchar *value, *quoted_uuid, *quoted_value;
@@ -52591,6 +52615,28 @@ modify_setting (const gchar *uuid, const gchar *name,
5259152615
}
5259252616
}
5259352617

52618+
if (strcmp (uuid, "11deb7ff-550b-4950-aacf-06faeb7c61b9") == 0)
52619+
{
52620+
int value_int;
52621+
/* User Interface Time Format */
52622+
if (sscanf (value, "%d", &value_int) != 1
52623+
|| (strcmp (value, "12") && strcmp (value, "24")))
52624+
{
52625+
g_free (value);
52626+
return 2;
52627+
}
52628+
}
52629+
52630+
if (strcmp (uuid, "d9857b7c-1159-4193-9bc0-18fae5473a69") == 0)
52631+
{
52632+
/* User Interface Date Format */
52633+
if (strcmp (value, "wmdy") && strcmp (value, "wdmy"))
52634+
{
52635+
g_free (value);
52636+
return 2;
52637+
}
52638+
}
52639+
5259452640
quoted_value = sql_quote (value);
5259552641
g_free (value);
5259652642

src/manage_sql.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@
147147
*/
148148
#define SETTING_UUID_SECINFO_SQL_BUFFER_THRESHOLD "316275a9-3629-49ad-9cea-5b3ab155b93f"
149149

150+
/**
151+
* @brief UUID of 'User Interface Time Format' setting.
152+
*/
153+
#define SETTING_UUID_USER_INTERFACE_TIME_FORMAT "11deb7ff-550b-4950-aacf-06faeb7c61b9"
154+
155+
/**
156+
* @brief UUID of 'User Interface Date Format' setting.
157+
*/
158+
#define SETTING_UUID_USER_INTERFACE_DATE_FORMAT "d9857b7c-1159-4193-9bc0-18fae5473a69"
159+
150160
/**
151161
* @brief Trust constant for error.
152162
*/

0 commit comments

Comments
 (0)