mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-23 05:01:19 -05:00
Support EnableAutoType and EnableSearching group properties.
This commit is contained in:
parent
2b939617bb
commit
82afd43f12
@ -81,6 +81,16 @@ QString Group::defaultAutoTypeSequence() const
|
||||
return m_defaultAutoTypeSequence;
|
||||
}
|
||||
|
||||
int Group::autoTypeEnabled() const
|
||||
{
|
||||
return m_autoTypeEnabled;
|
||||
}
|
||||
|
||||
int Group::searchingEnabed() const
|
||||
{
|
||||
return m_searchingEnabled;
|
||||
}
|
||||
|
||||
Entry* Group::lastTopVisibleEntry() const
|
||||
{
|
||||
return m_lastTopVisibleEntry;
|
||||
@ -138,6 +148,20 @@ void Group::setDefaultAutoTypeSequence(const QString& sequence)
|
||||
m_defaultAutoTypeSequence = sequence;
|
||||
}
|
||||
|
||||
void Group::setAutoTypeEnabled(int enable)
|
||||
{
|
||||
Q_ASSERT(enable >= -1 && enable <= 1);
|
||||
|
||||
m_autoTypeEnabled = enable;
|
||||
}
|
||||
|
||||
void Group::setSearchingEnabled(int enable)
|
||||
{
|
||||
Q_ASSERT(enable >= -1 && enable <= 1);
|
||||
|
||||
m_searchingEnabled = enable;
|
||||
}
|
||||
|
||||
void Group::setLastTopVisibleEntry(Entry* entry)
|
||||
{
|
||||
m_lastTopVisibleEntry = entry;
|
||||
|
@ -42,6 +42,8 @@ public:
|
||||
TimeInfo timeInfo() const;
|
||||
bool isExpanded() const;
|
||||
QString defaultAutoTypeSequence() const;
|
||||
int autoTypeEnabled() const;
|
||||
int searchingEnabed() const;
|
||||
Entry* lastTopVisibleEntry() const;
|
||||
|
||||
void setUuid(const Uuid& uuid);
|
||||
@ -52,6 +54,8 @@ public:
|
||||
void setTimeInfo(const TimeInfo& timeInfo);
|
||||
void setExpanded(bool expanded);
|
||||
void setDefaultAutoTypeSequence(const QString& sequence);
|
||||
void setAutoTypeEnabled(int enable);
|
||||
void setSearchingEnabled(int enable);
|
||||
void setLastTopVisibleEntry(Entry* entry);
|
||||
|
||||
const Group* parentGroup() const;
|
||||
@ -93,6 +97,8 @@ private:
|
||||
TimeInfo m_timeInfo;
|
||||
bool m_isExpanded;
|
||||
QString m_defaultAutoTypeSequence;
|
||||
int m_autoTypeEnabled;
|
||||
int m_searchingEnabled;
|
||||
Entry* m_lastTopVisibleEntry;
|
||||
QList<Group*> m_children;
|
||||
QList<Entry*> m_entries;
|
||||
|
@ -283,12 +283,37 @@ Group* Parser::parseGroup()
|
||||
group->setDefaultAutoTypeSequence(readString());
|
||||
}
|
||||
else if (m_xml.name() == "EnableAutoType") {
|
||||
// TODO implement
|
||||
skipCurrentElement();
|
||||
QString str = readString();
|
||||
|
||||
if (str.compare("null", Qt::CaseInsensitive) == 0) {
|
||||
group->setAutoTypeEnabled(-1);
|
||||
}
|
||||
else if (str.compare("true", Qt::CaseInsensitive) == 0) {
|
||||
group->setAutoTypeEnabled(1);
|
||||
}
|
||||
else if (str.compare("false", Qt::CaseInsensitive) == 0) {
|
||||
group->setAutoTypeEnabled(0);
|
||||
}
|
||||
else {
|
||||
raiseError();
|
||||
}
|
||||
|
||||
}
|
||||
else if (m_xml.name() == "EnableSearching") {
|
||||
// TODO implement
|
||||
skipCurrentElement();
|
||||
QString str = readString();
|
||||
|
||||
if (str.compare("null", Qt::CaseInsensitive) == 0) {
|
||||
group->setSearchingEnabled(-1);
|
||||
}
|
||||
else if (str.compare("true", Qt::CaseInsensitive) == 0) {
|
||||
group->setSearchingEnabled(1);
|
||||
}
|
||||
else if (str.compare("false", Qt::CaseInsensitive) == 0) {
|
||||
group->setSearchingEnabled(0);
|
||||
}
|
||||
else {
|
||||
raiseError();
|
||||
}
|
||||
}
|
||||
else if (m_xml.name() == "LastTopVisibleEntry") {
|
||||
group->setLastTopVisibleEntry(getEntry(readUuid()));
|
||||
@ -511,10 +536,10 @@ bool Parser::readBool()
|
||||
{
|
||||
QString str = readString();
|
||||
|
||||
if (str.compare(QLatin1String("True"), Qt::CaseInsensitive) == 0) {
|
||||
if (str.compare("True", Qt::CaseInsensitive) == 0) {
|
||||
return true;
|
||||
}
|
||||
else if (str.compare(QLatin1String("False"), Qt::CaseInsensitive) == 0) {
|
||||
else if (str.compare("False", Qt::CaseInsensitive) == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
@ -147,8 +147,33 @@ void Writer::writeGroup(const Group* group)
|
||||
writeTimes(group->timeInfo());
|
||||
writeBool("IsExpanded", group->isExpanded());
|
||||
writeString("DefaultAutoTypeSequence", group->defaultAutoTypeSequence());
|
||||
// TODO EnableAutoType
|
||||
// TODO EnableSearching
|
||||
|
||||
int autoTypeEnabled = group->autoTypeEnabled();
|
||||
QString autoTypeEnabledStr;
|
||||
if (autoTypeEnabled == -1) {
|
||||
autoTypeEnabledStr = "null";
|
||||
}
|
||||
else if (autoTypeEnabled == 0) {
|
||||
autoTypeEnabledStr = "false";
|
||||
}
|
||||
else {
|
||||
autoTypeEnabledStr = "true";
|
||||
}
|
||||
writeString("EnableAutoType", autoTypeEnabledStr);
|
||||
|
||||
int searchingEnabed = group->searchingEnabed();
|
||||
QString searchingEnabedStr;
|
||||
if (searchingEnabed == -1) {
|
||||
searchingEnabedStr = "null";
|
||||
}
|
||||
else if (searchingEnabed == 0) {
|
||||
searchingEnabedStr = "false";
|
||||
}
|
||||
else {
|
||||
searchingEnabedStr = "true";
|
||||
}
|
||||
writeString("EnableSearching", searchingEnabedStr);
|
||||
|
||||
writeUuid("LastTopVisibleEntry", group->lastTopVisibleEntry());
|
||||
|
||||
Q_FOREACH (const Group* child, group->children()) {
|
||||
|
Loading…
Reference in New Issue
Block a user