forked from blue/squawk
SimpleCrypt password jamming is now optional
This commit is contained in:
parent
85ff6c25ba
commit
9a44ae1fa5
6 changed files with 62 additions and 39 deletions
|
@ -21,6 +21,13 @@
|
|||
|
||||
#include "enums.h"
|
||||
#include "ui/models/roster.h"
|
||||
|
||||
#ifdef WITH_SIMPLE_CRYPT
|
||||
#define SIMPLE_CRYPT_ENABLED true
|
||||
#else
|
||||
#define SIMPLE_CRYPT_ENABLED false
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OMEMO
|
||||
constexpr bool OMEMO_SUPPORT = true;
|
||||
#else
|
||||
|
@ -36,11 +43,10 @@ QFont getFont (QFontDatabase::SystemFont type, bool bold = false, bool italic =
|
|||
|
||||
if (factor != 1.0) {
|
||||
float ps = font.pointSizeF();
|
||||
if (ps != -1) {
|
||||
if (ps != -1)
|
||||
font.setPointSizeF(ps * factor);
|
||||
} else {
|
||||
else
|
||||
font.setPointSize(font.pointSize() * factor);
|
||||
}
|
||||
}
|
||||
|
||||
return font;
|
||||
|
@ -148,10 +154,11 @@ Shared::Global::Global():
|
|||
smallFontMetrics(smallFont),
|
||||
headerFontMetrics(headerFont),
|
||||
titleFontMetrics(titleFont),
|
||||
pluginSupport({
|
||||
optionalFeatures({
|
||||
{"KWallet", false},
|
||||
{"openFileManagerWindowJob", false},
|
||||
{"colorSchemeTools", false}
|
||||
{"colorSchemeTools", false},
|
||||
{"simpleCryptJammedPassword", SIMPLE_CRYPT_ENABLED}
|
||||
}),
|
||||
fileCache()
|
||||
{
|
||||
|
@ -197,8 +204,7 @@ Shared::Global::Global():
|
|||
|
||||
|
||||
static const QSize defaultIconFileInfoHeight(50, 50);
|
||||
Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path)
|
||||
{
|
||||
Shared::Global::FileInfo Shared::Global::getFileInfo(const QString& path) {
|
||||
std::map<QString, FileInfo>::const_iterator itr = instance->fileCache.find(path);
|
||||
if (itr == instance->fileCache.end()) {
|
||||
QMimeDatabase db;
|
||||
|
@ -275,17 +281,17 @@ QString Shared::Global::getName(EncryptionProtocol ep) {
|
|||
}
|
||||
|
||||
void Shared::Global::setSupported(const QString& pluginName, bool support) {
|
||||
std::map<QString, bool>::iterator itr = instance->pluginSupport.find(pluginName);
|
||||
if (itr != instance->pluginSupport.end()) {
|
||||
std::map<QString, bool>::iterator itr = instance->optionalFeatures.find(pluginName);
|
||||
if (itr != instance->optionalFeatures.end()) {
|
||||
itr->second = support;
|
||||
}
|
||||
}
|
||||
|
||||
bool Shared::Global::supported(const QString& pluginName) {
|
||||
std::map<QString, bool>::iterator itr = instance->pluginSupport.find(pluginName);
|
||||
if (itr != instance->pluginSupport.end()) {
|
||||
std::map<QString, bool>::iterator itr = instance->optionalFeatures.find(pluginName);
|
||||
if (itr != instance->optionalFeatures.end())
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -325,11 +331,10 @@ void Shared::Global::highlightInFileManager(const QString& path)
|
|||
QString output = proc.readLine().simplified();
|
||||
|
||||
QString folder;
|
||||
if (info.isDir()) {
|
||||
if (info.isDir())
|
||||
folder = info.canonicalFilePath();
|
||||
} else {
|
||||
else
|
||||
folder = info.canonicalPath();
|
||||
}
|
||||
|
||||
if (output.contains(dolphinReg)) {
|
||||
//there is a bug on current (21.04.0) dolphin, it works correct only if you already have dolphin launched
|
||||
|
@ -389,20 +394,19 @@ void Shared::Global::setTheme(const QString& path) {
|
|||
}
|
||||
|
||||
void Shared::Global::setStyle(const QString& style) {
|
||||
if (style.toLower() == "system") {
|
||||
if (style.toLower() == "system")
|
||||
QApplication::setStyle(getInstance()->defaultSystemStyle);
|
||||
} else {
|
||||
else
|
||||
QApplication::setStyle(style);
|
||||
}
|
||||
}
|
||||
|
||||
#define FROM_INT_INPL(Enum) \
|
||||
template<> \
|
||||
Enum Shared::Global::fromInt(int src) \
|
||||
{ \
|
||||
if (src < static_cast<int>(Enum##Lowest) || src > static_cast<int>(Enum##Highest)) { \
|
||||
if (src < static_cast<int>(Enum##Lowest) || src > static_cast<int>(Enum##Highest)) \
|
||||
throw EnumOutOfRange(#Enum); \
|
||||
} \
|
||||
\
|
||||
return static_cast<Enum>(src); \
|
||||
} \
|
||||
template<> \
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace Shared {
|
|||
private:
|
||||
static Global* instance;
|
||||
|
||||
std::map<QString, bool> pluginSupport;
|
||||
std::map<QString, bool> optionalFeatures;
|
||||
std::map<QString, FileInfo> fileCache;
|
||||
|
||||
#ifdef WITH_KIO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue