1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

ClipboardHistory: Use config file to set number of history items

The number of items in history was hardcoded to 20 earlier, now
we try to load this value from a config file. The default if none
is available is still 20.
This commit is contained in:
Mustafa Quraish 2021-08-26 22:24:09 -04:00 committed by Brian Gianforcaro
parent b9979e9a59
commit b1a3bb638b
4 changed files with 14 additions and 2 deletions

View file

@ -1,10 +1,12 @@
/*
* Copyright (c) 2019-2020, Sergey Bugaev <bugaevc@serenityos.org>
* Copyright (c) 2021, Mustafa Quraish <mustafa@cs.toronto.edu>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "ClipboardHistoryModel.h"
#include <LibConfig/Client.h>
#include <AK/NumberFormat.h>
#include <AK/StringBuilder.h>
@ -13,6 +15,11 @@ NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
return adopt_ref(*new ClipboardHistoryModel());
}
ClipboardHistoryModel::ClipboardHistoryModel()
: m_history_limit(Config::read_i32("ClipboardHistory", "ClipboardHistory", "NumHistoryItems", 20))
{
}
ClipboardHistoryModel::~ClipboardHistoryModel()
{
}