Files
keepassxc/src/browser/BrowserSettings.h
Jonathan White a145bf9119 Complete refactor of Browser Integration classes
* Removed option to attach KeePassXC to the browser extension. Users must use the proxy application to communicate with KeePassXC.
* Significantly streamlined proxy code. Used same implementation of stdin/stdout interface across all platforms.
* Moved browser service entry point to BrowserService class instead of NativeMessagingHost. BrowserService now coordinates the communication to/from clients.
* Moved settings page definition out of MainWindow
* Decoupled BrowserService from DatabaseTabWidget
* Reduced complexity of various functions and cleaned the ABI (public vs private).
* Eliminated BrowserClients class, moved functionality into the BrowserService
* Renamed HostInstaller to NativeMessageInstaller and renamed NativeMessageHost to BrowserHost.
* Recognize XDG_CONFIG_HOME when installing native message file on Linux. Fix #4121 and fix #4123.
2020-05-14 17:14:17 -04:00

134 lines
4.7 KiB
C++

/*
* Copyright (C) 2013 Francois Ferrand
* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BROWSERSETTINGS_H
#define BROWSERSETTINGS_H
#include "BrowserShared.h"
#include "NativeMessageInstaller.h"
#include "core/PassphraseGenerator.h"
#include "core/PasswordGenerator.h"
class BrowserSettings
{
public:
explicit BrowserSettings() = default;
static BrowserSettings* instance();
bool isEnabled();
void setEnabled(bool enabled);
bool showNotification(); // TODO!!
void setShowNotification(bool showNotification);
bool bestMatchOnly();
void setBestMatchOnly(bool bestMatchOnly);
bool unlockDatabase();
void setUnlockDatabase(bool unlockDatabase);
bool matchUrlScheme();
void setMatchUrlScheme(bool matchUrlScheme);
bool sortByUsername();
void setSortByUsername(bool sortByUsername = true);
bool sortByTitle();
void setSortByTitle(bool sortByUsertitle = true);
bool alwaysAllowAccess();
void setAlwaysAllowAccess(bool alwaysAllowAccess);
bool alwaysAllowUpdate();
void setAlwaysAllowUpdate(bool alwaysAllowUpdate);
bool searchInAllDatabases();
void setSearchInAllDatabases(bool searchInAllDatabases);
bool httpAuthPermission();
void setHttpAuthPermission(bool httpAuthPermission);
bool supportKphFields();
void setSupportKphFields(bool supportKphFields);
bool noMigrationPrompt();
void setNoMigrationPrompt(bool prompt);
bool useCustomProxy();
void setUseCustomProxy(bool enabled);
QString customProxyLocation();
void setCustomProxyLocation(const QString& location);
QString proxyLocation();
bool updateBinaryPath();
void setUpdateBinaryPath(bool enabled);
bool allowExpiredCredentials();
void setAllowExpiredCredentials(bool enabled);
bool browserSupport(BrowserShared::SupportedBrowsers browser);
void setBrowserSupport(BrowserShared::SupportedBrowsers browser, bool enabled);
bool passwordUseNumbers();
void setPasswordUseNumbers(bool useNumbers);
bool passwordUseLowercase();
void setPasswordUseLowercase(bool useLowercase);
bool passwordUseUppercase();
void setPasswordUseUppercase(bool useUppercase);
bool passwordUseSpecial();
void setPasswordUseSpecial(bool useSpecial);
bool passwordUseBraces();
void setPasswordUseBraces(bool useBraces);
bool passwordUsePunctuation();
void setPasswordUsePunctuation(bool usePunctuation);
bool passwordUseQuotes();
void setPasswordUseQuotes(bool useQuotes);
bool passwordUseDashes();
void setPasswordUseDashes(bool useDashes);
bool passwordUseMath();
void setPasswordUseMath(bool useMath);
bool passwordUseLogograms();
void setPasswordUseLogograms(bool useLogograms);
bool passwordUseEASCII();
void setPasswordUseEASCII(bool useEASCII);
bool advancedMode();
void setAdvancedMode(bool advancedMode);
QString passwordAdditionalChars();
void setPasswordAdditionalChars(const QString& chars);
QString passwordExcludedChars();
void setPasswordExcludedChars(const QString& chars);
int passPhraseWordCount();
void setPassPhraseWordCount(int wordCount);
QString passPhraseWordSeparator();
void setPassPhraseWordSeparator(const QString& separator);
int generatorType();
void setGeneratorType(int type);
bool passwordEveryGroup();
void setPasswordEveryGroup(bool everyGroup);
bool passwordExcludeAlike();
void setPasswordExcludeAlike(bool excludeAlike);
int passwordLength();
void setPasswordLength(int length);
PasswordGenerator::CharClasses passwordCharClasses();
PasswordGenerator::GeneratorFlags passwordGeneratorFlags();
QJsonObject generatePassword();
void updateBinaryPaths();
private:
static BrowserSettings* m_instance;
PasswordGenerator m_passwordGenerator;
PassphraseGenerator m_passPhraseGenerator;
NativeMessageInstaller m_nativeMessageInstaller;
};
inline BrowserSettings* browserSettings()
{
return BrowserSettings::instance();
}
#endif // BROWSERSETTINGS_H