Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Config #4665

Merged
merged 1 commit into from
May 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/autotype/AutoType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void AutoType::executeAutoTypeActions(const Entry* entry, QWidget* hideWindow, c
#endif
}

Tools::wait(qMax(100, config()->get("AutoTypeStartDelay", 500).toInt()));
Tools::wait(qMax(100, config()->get(Config::AutoTypeStartDelay).toInt()));

// Used only for selected entry auto-type
if (!window) {
Expand Down Expand Up @@ -339,7 +339,7 @@ void AutoType::performGlobalAutoType(const QList<QSharedPointer<Database>>& dbLi

m_inGlobalAutoTypeDialog.unlock();
emit autotypeRejected();
} else if ((matchList.size() == 1) && !config()->get("security/autotypeask").toBool()) {
} else if ((matchList.size() == 1) && !config()->get(Config::Security_AutoTypeAsk).toBool()) {
executeAutoTypeActions(matchList.first().entry, nullptr, matchList.first().sequence, m_windowForGlobal);
m_inGlobalAutoTypeDialog.unlock();
} else {
Expand Down Expand Up @@ -390,7 +390,7 @@ bool AutoType::parseActions(const QString& actionSequence, const Entry* entry, Q
{
QString tmpl;
bool inTmpl = false;
m_autoTypeDelay = qMax(config()->get("AutoTypeDelay").toInt(), 0);
m_autoTypeDelay = qMax(config()->get(Config::AutoTypeDelay).toInt(), 0);
droidmonkey marked this conversation as resolved.
Show resolved Hide resolved

QString sequence = actionSequence;
sequence.replace("{{}", "{LEFTBRACE}");
Expand Down Expand Up @@ -617,12 +617,12 @@ QList<QString> AutoType::autoTypeSequences(const Entry* entry, const QString& wi
}
}

if (config()->get("AutoTypeEntryTitleMatch").toBool()
if (config()->get(Config::AutoTypeEntryTitleMatch).toBool()
&& windowMatchesTitle(windowTitle, entry->resolvePlaceholder(entry->title()))) {
sequenceList.append(entry->effectiveAutoTypeSequence());
}

if (config()->get("AutoTypeEntryURLMatch").toBool()
if (config()->get(Config::AutoTypeEntryURLMatch).toBool()
&& windowMatchesUrl(windowTitle, entry->resolvePlaceholder(entry->url()))) {
sequenceList.append(entry->effectiveAutoTypeSequence());
}
Expand Down
4 changes: 2 additions & 2 deletions src/autotype/AutoTypeSelectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
#else
QRect screenGeometry = QApplication::desktop()->availableGeometry(QCursor::pos());
#endif
QSize size = config()->get("GUI/AutoTypeSelectDialogSize", QSize(600, 250)).toSize();
QSize size = config()->get(Config::GUI_AutoTypeSelectDialogSize).toSize();
size.setWidth(qMin(size.width(), screenGeometry.width()));
size.setHeight(qMin(size.height(), screenGeometry.height()));
resize(size);
Expand Down Expand Up @@ -111,7 +111,7 @@ void AutoTypeSelectDialog::setMatchList(const QList<AutoTypeMatch>& matchList)

void AutoTypeSelectDialog::done(int r)
{
config()->set("GUI/AutoTypeSelectDialogSize", size());
config()->set(Config::GUI_AutoTypeSelectDialogSize, size());

QDialog::done(r);
}
Expand Down
Loading