mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-15 16:39:43 -05:00
Bundle icons using the Qt resource system.
Simplify resource loading logic and enable reproducible builds. Fixes #2582
This commit is contained in:
parent
4ff781fa48
commit
b045160e4f
56 changed files with 630 additions and 548 deletions
|
|
@ -40,7 +40,6 @@ set(keepassx_SOURCES
|
|||
core/EntryAttachments.cpp
|
||||
core/EntryAttributes.cpp
|
||||
core/EntrySearcher.cpp
|
||||
core/FilePath.cpp
|
||||
core/FileWatcher.cpp
|
||||
core/Group.cpp
|
||||
core/HibpOffline.cpp
|
||||
|
|
@ -50,6 +49,7 @@ set(keepassx_SOURCES
|
|||
core/PasswordGenerator.cpp
|
||||
core/PasswordHealth.cpp
|
||||
core/PassphraseGenerator.cpp
|
||||
core/Resources.cpp
|
||||
core/SignalMultiplexer.cpp
|
||||
core/ScreenLockListener.cpp
|
||||
core/ScreenLockListenerPrivate.cpp
|
||||
|
|
@ -210,6 +210,10 @@ if(MINGW OR (UNIX AND NOT APPLE))
|
|||
core/OSEventFilter.cpp)
|
||||
endif()
|
||||
|
||||
set(keepassx_SOURCES ${keepassx_SOURCES}
|
||||
../share/icons/icons.qrc
|
||||
../share/wizard/wizard.qrc)
|
||||
|
||||
set(keepassx_SOURCES_MAINEXE main.cpp)
|
||||
|
||||
add_feature_info(Auto-Type WITH_XC_AUTOTYPE "Automatic password typing")
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@
|
|||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/ListDeleter.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Tools.h"
|
||||
#include "gui/MessageBox.h"
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ AutoType::AutoType(QObject* parent, bool test)
|
|||
pluginName += "test";
|
||||
}
|
||||
|
||||
QString pluginPath = filePath()->pluginPath(pluginName);
|
||||
QString pluginPath = resources()->pluginPath(pluginName);
|
||||
|
||||
if (!pluginPath.isEmpty()) {
|
||||
#ifdef WITH_XC_AUTOTYPE
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#include "autotype/AutoTypeSelectView.h"
|
||||
#include "core/AutoTypeMatch.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/entry/AutoTypeMatchModel.h"
|
||||
|
||||
AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
|
||||
|
|
@ -49,7 +49,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
|
|||
setAttribute(Qt::WA_X11BypassTransientForHint);
|
||||
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||
setWindowTitle(tr("Auto-Type - KeePassXC"));
|
||||
setWindowIcon(filePath()->applicationIcon());
|
||||
setWindowIcon(resources()->applicationIcon());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
QRect screenGeometry = QApplication::screenAt(QCursor::pos())->availableGeometry();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "BrowserSettings.h"
|
||||
#include "config-keepassx.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ namespace Bootstrap
|
|||
#ifdef QT_NO_DEBUG
|
||||
disableCoreDumps();
|
||||
#endif
|
||||
|
||||
setupSearchPaths();
|
||||
applyEarlyQNetworkAccessManagerWorkaround();
|
||||
Translator::installTranslators();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "DatabaseIcons.h"
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
DatabaseIcons* DatabaseIcons::m_instance(nullptr);
|
||||
const int DatabaseIcons::IconCount(69);
|
||||
|
|
@ -103,18 +103,15 @@ QImage DatabaseIcons::icon(int index)
|
|||
{
|
||||
if (index < 0 || index >= IconCount) {
|
||||
qWarning("DatabaseIcons::icon: invalid icon index %d", index);
|
||||
return QImage();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (!m_iconCache[index].isNull()) {
|
||||
return m_iconCache[index];
|
||||
} else {
|
||||
QString iconPath = QString("icons/database/").append(m_indexToName[index]);
|
||||
QImage icon(filePath()->dataPath(iconPath));
|
||||
|
||||
m_iconCache[index] = icon;
|
||||
return icon;
|
||||
}
|
||||
QImage icon(QStringLiteral(":/icons/database/").append(m_indexToName[index]));
|
||||
m_iconCache[index] = icon;
|
||||
return icon;
|
||||
}
|
||||
|
||||
QPixmap DatabaseIcons::iconPixmap(int index)
|
||||
|
|
|
|||
|
|
@ -1,259 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
|
||||
*
|
||||
* 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 2 or (at your option)
|
||||
* version 3 of the License.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "FilePath.h"
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QDir>
|
||||
#include <QLibrary>
|
||||
#include <QStyle>
|
||||
|
||||
#include "config-keepassx.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Global.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
FilePath* FilePath::m_instance(nullptr);
|
||||
|
||||
QString FilePath::dataPath(const QString& name)
|
||||
{
|
||||
if (name.isEmpty() || name.startsWith('/')) {
|
||||
return m_dataPath + name;
|
||||
} else {
|
||||
return m_dataPath + "/" + name;
|
||||
}
|
||||
}
|
||||
|
||||
QString FilePath::pluginPath(const QString& name)
|
||||
{
|
||||
QStringList pluginPaths;
|
||||
|
||||
QDir buildDir(QCoreApplication::applicationDirPath() + "/autotype");
|
||||
const QStringList buildDirEntryList = buildDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
for (const QString& dir : buildDirEntryList) {
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/autotype/" + dir;
|
||||
}
|
||||
|
||||
// for TestAutoType
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/../src/autotype/test";
|
||||
|
||||
#if defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE)
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/../PlugIns";
|
||||
#endif
|
||||
|
||||
pluginPaths << QCoreApplication::applicationDirPath();
|
||||
|
||||
QString configuredPluginDir = KEEPASSX_PLUGIN_DIR;
|
||||
if (configuredPluginDir != ".") {
|
||||
if (QDir(configuredPluginDir).isAbsolute()) {
|
||||
pluginPaths << configuredPluginDir;
|
||||
} else {
|
||||
QString relativePluginDir =
|
||||
QString("%1/../%2").arg(QCoreApplication::applicationDirPath(), configuredPluginDir);
|
||||
pluginPaths << QDir(relativePluginDir).canonicalPath();
|
||||
|
||||
QString absolutePluginDir = QString("%1/%2").arg(KEEPASSX_PREFIX_DIR, configuredPluginDir);
|
||||
pluginPaths << QDir(absolutePluginDir).canonicalPath();
|
||||
}
|
||||
}
|
||||
|
||||
QStringList dirFilter;
|
||||
dirFilter << QString("*%1*").arg(name);
|
||||
|
||||
for (const QString& path : asConst(pluginPaths)) {
|
||||
const QStringList fileCandidates = QDir(path).entryList(dirFilter, QDir::Files);
|
||||
|
||||
for (const QString& file : fileCandidates) {
|
||||
QString filePath = path + "/" + file;
|
||||
|
||||
if (QLibrary::isLibrary(filePath)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString FilePath::wordlistPath(const QString& name)
|
||||
{
|
||||
return dataPath("wordlists/" + name);
|
||||
}
|
||||
|
||||
QIcon FilePath::applicationIcon()
|
||||
{
|
||||
return icon("apps", "keepassxc", false);
|
||||
}
|
||||
|
||||
QIcon FilePath::trayIcon()
|
||||
{
|
||||
return useDarkIcon() ? icon("apps", "keepassxc-dark", false) : icon("apps", "keepassxc", false);
|
||||
}
|
||||
|
||||
QIcon FilePath::trayIconLocked()
|
||||
{
|
||||
return icon("apps", "keepassxc-locked", false);
|
||||
}
|
||||
|
||||
QIcon FilePath::trayIconUnlocked()
|
||||
{
|
||||
return useDarkIcon() ? icon("apps", "keepassxc-dark", false) : icon("apps", "keepassxc-unlocked", false);
|
||||
}
|
||||
|
||||
QIcon FilePath::icon(const QString& category, const QString& name, bool recolor)
|
||||
{
|
||||
QString combinedName = category + "/" + name;
|
||||
QIcon icon = m_iconCache.value(combinedName);
|
||||
|
||||
if (!icon.isNull()) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
if (icon.isNull()) {
|
||||
const QList<int> pngSizes = {16, 22, 24, 32, 48, 64, 128};
|
||||
QString filename;
|
||||
for (int size : pngSizes) {
|
||||
filename =
|
||||
QString("%1/icons/application/%2x%2/%3.png").arg(m_dataPath, QString::number(size), combinedName);
|
||||
if (QFile::exists(filename)) {
|
||||
icon.addFile(filename, QSize(size, size));
|
||||
}
|
||||
}
|
||||
filename = QString("%1/icons/application/scalable/%2.svg").arg(m_dataPath, combinedName);
|
||||
if (QFile::exists(filename) && getMainWindow() && recolor) {
|
||||
QPalette palette = getMainWindow()->palette();
|
||||
|
||||
QFile f(filename);
|
||||
QIcon scalable(filename);
|
||||
QPixmap pixmap = scalable.pixmap({128, 128});
|
||||
|
||||
auto mask = QBitmap::fromImage(pixmap.toImage().createAlphaMask());
|
||||
pixmap.fill(palette.color(QPalette::WindowText));
|
||||
pixmap.setMask(mask);
|
||||
icon.addPixmap(pixmap, QIcon::Mode::Normal);
|
||||
|
||||
pixmap.fill(palette.color(QPalette::HighlightedText));
|
||||
pixmap.setMask(mask);
|
||||
icon.addPixmap(pixmap, QIcon::Mode::Selected);
|
||||
|
||||
pixmap.fill(palette.color(QPalette::Disabled, QPalette::WindowText));
|
||||
pixmap.setMask(mask);
|
||||
icon.addPixmap(pixmap, QIcon::Mode::Disabled);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
icon.setIsMask(true);
|
||||
#endif
|
||||
} else if (QFile::exists(filename)) {
|
||||
icon.addFile(filename);
|
||||
}
|
||||
}
|
||||
|
||||
m_iconCache.insert(combinedName, icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
QIcon FilePath::onOffIcon(const QString& category, const QString& name, bool recolor)
|
||||
{
|
||||
QString combinedName = category + "/" + name;
|
||||
QString cacheName = "onoff/" + combinedName;
|
||||
|
||||
QIcon icon = m_iconCache.value(cacheName);
|
||||
|
||||
if (!icon.isNull()) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
QIcon on = FilePath::icon(category, name + "-on", recolor);
|
||||
for (const auto& size : on.availableSizes()) {
|
||||
icon.addPixmap(on.pixmap(size, QIcon::Mode::Normal), QIcon::Mode::Normal, QIcon::On);
|
||||
icon.addPixmap(on.pixmap(size, QIcon::Mode::Selected), QIcon::Mode::Selected, QIcon::On);
|
||||
icon.addPixmap(on.pixmap(size, QIcon::Mode::Disabled), QIcon::Mode::Disabled, QIcon::On);
|
||||
}
|
||||
QIcon off = FilePath::icon(category, name + "-off", recolor);
|
||||
for (const auto& size : off.availableSizes()) {
|
||||
icon.addPixmap(off.pixmap(size, QIcon::Mode::Normal), QIcon::Mode::Normal, QIcon::Off);
|
||||
icon.addPixmap(off.pixmap(size, QIcon::Mode::Selected), QIcon::Mode::Selected, QIcon::Off);
|
||||
icon.addPixmap(off.pixmap(size, QIcon::Mode::Disabled), QIcon::Mode::Disabled, QIcon::Off);
|
||||
}
|
||||
|
||||
m_iconCache.insert(cacheName, icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
FilePath::FilePath()
|
||||
{
|
||||
const QString appDirPath = QCoreApplication::applicationDirPath();
|
||||
bool isDataDirAbsolute = QDir::isAbsolutePath(KEEPASSX_DATA_DIR);
|
||||
Q_UNUSED(isDataDirAbsolute);
|
||||
|
||||
if (false) {
|
||||
}
|
||||
#ifdef QT_DEBUG
|
||||
else if (testSetDir(QString(KEEPASSX_SOURCE_DIR) + "/share")) {
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_UNIX) && !(defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE))
|
||||
else if (isDataDirAbsolute && testSetDir(KEEPASSX_DATA_DIR)) {
|
||||
} else if (!isDataDirAbsolute && testSetDir(QString("%1/../%2").arg(appDirPath, KEEPASSX_DATA_DIR))) {
|
||||
} else if (!isDataDirAbsolute && testSetDir(QString("%1/%2").arg(KEEPASSX_PREFIX_DIR, KEEPASSX_DATA_DIR))) {
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE)
|
||||
else if (testSetDir(appDirPath + "/../Resources")) {
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
else if (testSetDir(appDirPath + "/share")) {
|
||||
}
|
||||
#endif
|
||||
// Last ditch test when running in the build directory (mainly for travis tests)
|
||||
else if (testSetDir(QString(KEEPASSX_SOURCE_DIR) + "/share")) {
|
||||
}
|
||||
|
||||
if (m_dataPath.isEmpty()) {
|
||||
qWarning("FilePath::DataPath: can't find data dir");
|
||||
} else {
|
||||
m_dataPath = QDir::cleanPath(m_dataPath);
|
||||
}
|
||||
}
|
||||
|
||||
bool FilePath::testSetDir(const QString& dir)
|
||||
{
|
||||
if (QFile::exists(dir + "/icons/database/C00_Password.png")) {
|
||||
m_dataPath = dir;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool FilePath::useDarkIcon()
|
||||
{
|
||||
return config()->get("GUI/DarkTrayIcon").toBool();
|
||||
}
|
||||
|
||||
FilePath* FilePath::instance()
|
||||
{
|
||||
if (!m_instance) {
|
||||
m_instance = new FilePath();
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
#include <QTextStream>
|
||||
#include <cmath>
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "crypto/Random.h"
|
||||
|
||||
const char* PassphraseGenerator::DefaultSeparator = " ";
|
||||
|
|
@ -80,7 +80,7 @@ void PassphraseGenerator::setWordList(const QString& path)
|
|||
|
||||
void PassphraseGenerator::setDefaultWordList()
|
||||
{
|
||||
const QString path = filePath()->wordlistPath(PassphraseGenerator::DefaultWordList);
|
||||
const QString path = resources()->wordlistPath(PassphraseGenerator::DefaultWordList);
|
||||
setWordList(path);
|
||||
}
|
||||
|
||||
|
|
|
|||
232
src/core/Resources.cpp
Normal file
232
src/core/Resources.cpp
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
|
||||
*
|
||||
* 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 2 or (at your option)
|
||||
* version 3 of the License.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "Resources.h"
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QDir>
|
||||
#include <QLibrary>
|
||||
#include <QStyle>
|
||||
|
||||
#include "config-keepassx.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Global.h"
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
Resources* Resources::m_instance(nullptr);
|
||||
|
||||
QString Resources::dataPath(const QString& name)
|
||||
{
|
||||
if (name.isEmpty() || name.startsWith('/')) {
|
||||
return m_dataPath + name;
|
||||
}
|
||||
return m_dataPath + "/" + name;
|
||||
}
|
||||
|
||||
QString Resources::pluginPath(const QString& name)
|
||||
{
|
||||
QStringList pluginPaths;
|
||||
|
||||
QDir buildDir(QCoreApplication::applicationDirPath() + "/autotype");
|
||||
const QStringList buildDirEntryList = buildDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
for (const QString& dir : buildDirEntryList) {
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/autotype/" + dir;
|
||||
}
|
||||
|
||||
// for TestAutoType
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/../src/autotype/test";
|
||||
|
||||
#if defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE)
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/../PlugIns";
|
||||
#endif
|
||||
|
||||
pluginPaths << QCoreApplication::applicationDirPath();
|
||||
|
||||
QString configuredPluginDir = KEEPASSX_PLUGIN_DIR;
|
||||
if (configuredPluginDir != ".") {
|
||||
if (QDir(configuredPluginDir).isAbsolute()) {
|
||||
pluginPaths << configuredPluginDir;
|
||||
} else {
|
||||
QString relativePluginDir =
|
||||
QStringLiteral("%1/../%2").arg(QCoreApplication::applicationDirPath(), configuredPluginDir);
|
||||
pluginPaths << QDir(relativePluginDir).canonicalPath();
|
||||
|
||||
QString absolutePluginDir = QStringLiteral("%1/%2").arg(KEEPASSX_PREFIX_DIR, configuredPluginDir);
|
||||
pluginPaths << QDir(absolutePluginDir).canonicalPath();
|
||||
}
|
||||
}
|
||||
|
||||
QStringList dirFilter;
|
||||
dirFilter << QStringLiteral("*%1*").arg(name);
|
||||
|
||||
for (const QString& path : asConst(pluginPaths)) {
|
||||
const QStringList fileCandidates = QDir(path).entryList(dirFilter, QDir::Files);
|
||||
|
||||
for (const QString& file : fileCandidates) {
|
||||
QString filePath = path + "/" + file;
|
||||
|
||||
if (QLibrary::isLibrary(filePath)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
QString Resources::wordlistPath(const QString& name)
|
||||
{
|
||||
return dataPath(QStringLiteral("wordlists/%1").arg(name));
|
||||
}
|
||||
|
||||
QIcon Resources::applicationIcon()
|
||||
{
|
||||
return icon("keepassxc", false);
|
||||
}
|
||||
|
||||
QIcon Resources::trayIcon()
|
||||
{
|
||||
return useDarkIcon() ? icon("keepassxc-dark", false) : icon("keepassxc", false);
|
||||
}
|
||||
|
||||
QIcon Resources::trayIconLocked()
|
||||
{
|
||||
return icon("keepassxc-locked", false);
|
||||
}
|
||||
|
||||
QIcon Resources::trayIconUnlocked()
|
||||
{
|
||||
return useDarkIcon() ? icon("keepassxc-dark", false) : icon("keepassxc-unlocked", false);
|
||||
}
|
||||
|
||||
QIcon Resources::icon(const QString& name, bool recolor)
|
||||
{
|
||||
QIcon icon = m_iconCache.value(name);
|
||||
|
||||
if (!icon.isNull()) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
icon = QIcon::fromTheme(name);
|
||||
if (getMainWindow() && recolor) {
|
||||
QPixmap pixmap = icon.pixmap(128, 128);
|
||||
icon = {};
|
||||
|
||||
QPalette palette = getMainWindow()->palette();
|
||||
|
||||
auto mask = QBitmap::fromImage(pixmap.toImage().createAlphaMask());
|
||||
pixmap.fill(palette.color(QPalette::WindowText));
|
||||
pixmap.setMask(mask);
|
||||
icon.addPixmap(pixmap, QIcon::Mode::Normal);
|
||||
|
||||
pixmap.fill(palette.color(QPalette::HighlightedText));
|
||||
pixmap.setMask(mask);
|
||||
icon.addPixmap(pixmap, QIcon::Mode::Selected);
|
||||
|
||||
pixmap.fill(palette.color(QPalette::Disabled, QPalette::WindowText));
|
||||
pixmap.setMask(mask);
|
||||
icon.addPixmap(pixmap, QIcon::Mode::Disabled);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
icon.setIsMask(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
m_iconCache.insert(name, icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
QIcon Resources::onOffIcon(const QString& name, bool recolor)
|
||||
{
|
||||
QString cacheName = "onoff/" + name;
|
||||
|
||||
QIcon icon = m_iconCache.value(cacheName);
|
||||
|
||||
if (!icon.isNull()) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
QIcon on = Resources::icon(name + "-on", recolor);
|
||||
for (const auto& size : on.availableSizes()) {
|
||||
icon.addPixmap(on.pixmap(size, QIcon::Mode::Normal), QIcon::Mode::Normal, QIcon::On);
|
||||
icon.addPixmap(on.pixmap(size, QIcon::Mode::Selected), QIcon::Mode::Selected, QIcon::On);
|
||||
icon.addPixmap(on.pixmap(size, QIcon::Mode::Disabled), QIcon::Mode::Disabled, QIcon::On);
|
||||
}
|
||||
QIcon off = Resources::icon(name + "-off", recolor);
|
||||
for (const auto& size : off.availableSizes()) {
|
||||
icon.addPixmap(off.pixmap(size, QIcon::Mode::Normal), QIcon::Mode::Normal, QIcon::Off);
|
||||
icon.addPixmap(off.pixmap(size, QIcon::Mode::Selected), QIcon::Mode::Selected, QIcon::Off);
|
||||
icon.addPixmap(off.pixmap(size, QIcon::Mode::Disabled), QIcon::Mode::Disabled, QIcon::Off);
|
||||
}
|
||||
|
||||
m_iconCache.insert(cacheName, icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
Resources::Resources()
|
||||
{
|
||||
const QString appDirPath = QCoreApplication::applicationDirPath();
|
||||
#if defined(Q_OS_UNIX) && !(defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE))
|
||||
testResourceDir(KEEPASSX_DATA_DIR) || testResourceDir(QStringLiteral("%1/../%2").arg(appDirPath, KEEPASSX_DATA_DIR))
|
||||
|| testResourceDir(QStringLiteral("%1/%2").arg(KEEPASSX_PREFIX_DIR, KEEPASSX_DATA_DIR));
|
||||
#elif defined(Q_OS_MACOS) && defined(WITH_APP_BUNDLE)
|
||||
testResourceDir(appDirPath + QStringLiteral("/../Resources"));
|
||||
#elif defined(Q_OS_WIN)
|
||||
testResourceDir(appDirPath + QStringLiteral("/share"));
|
||||
#endif
|
||||
|
||||
if (m_dataPath.isEmpty()) {
|
||||
// Last ditch check if we are running from inside the src or test build directory
|
||||
testResourceDir(appDirPath + QStringLiteral("/../../share"))
|
||||
|| testResourceDir(appDirPath + QStringLiteral("/../share"))
|
||||
|| testResourceDir(appDirPath + QStringLiteral("/../../../share"));
|
||||
}
|
||||
|
||||
if (m_dataPath.isEmpty()) {
|
||||
qWarning("Resources::DataPath: can't find data dir");
|
||||
}
|
||||
}
|
||||
|
||||
bool Resources::testResourceDir(const QString& dir)
|
||||
{
|
||||
if (QFile::exists(dir + QStringLiteral("/icons/application/256x256/apps/keepassxc.png"))) {
|
||||
m_dataPath = QDir::cleanPath(dir);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Resources::useDarkIcon()
|
||||
{
|
||||
return config()->get("GUI/DarkTrayIcon").toBool();
|
||||
}
|
||||
|
||||
Resources* Resources::instance()
|
||||
{
|
||||
if (!m_instance) {
|
||||
m_instance = new Resources();
|
||||
|
||||
Q_INIT_RESOURCE(icons);
|
||||
QIcon::setThemeSearchPaths({":/icons"});
|
||||
QIcon::setThemeName("application");
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
|
||||
* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -15,14 +16,14 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KEEPASSX_FILEPATH_H
|
||||
#define KEEPASSX_FILEPATH_H
|
||||
#ifndef KEEPASSX_RESOURCES_H
|
||||
#define KEEPASSX_RESOURCES_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
|
||||
class FilePath
|
||||
class Resources
|
||||
{
|
||||
public:
|
||||
QString dataPath(const QString& name);
|
||||
|
|
@ -32,27 +33,27 @@ public:
|
|||
QIcon trayIcon();
|
||||
QIcon trayIconLocked();
|
||||
QIcon trayIconUnlocked();
|
||||
QIcon icon(const QString& category, const QString& name, bool recolor = true);
|
||||
QIcon onOffIcon(const QString& category, const QString& name, bool recolor = true);
|
||||
QIcon icon(const QString& name, bool recolor = true);
|
||||
QIcon onOffIcon(const QString& name, bool recolor = true);
|
||||
|
||||
static FilePath* instance();
|
||||
static Resources* instance();
|
||||
|
||||
private:
|
||||
FilePath();
|
||||
bool testSetDir(const QString& dir);
|
||||
Resources();
|
||||
bool testResourceDir(const QString& dir);
|
||||
bool useDarkIcon();
|
||||
|
||||
static FilePath* m_instance;
|
||||
static Resources* m_instance;
|
||||
|
||||
QString m_dataPath;
|
||||
QHash<QString, QIcon> m_iconCache;
|
||||
|
||||
Q_DISABLE_COPY(FilePath)
|
||||
Q_DISABLE_COPY(Resources)
|
||||
};
|
||||
|
||||
inline FilePath* filePath()
|
||||
inline Resources* resources()
|
||||
{
|
||||
return FilePath::instance();
|
||||
return Resources::instance();
|
||||
}
|
||||
|
||||
#endif // KEEPASSX_FILEPATH_H
|
||||
#endif // KEEPASSX_RESOURCES_H
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "config-keepassx.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
/**
|
||||
* Install all KeePassXC and Qt translators.
|
||||
|
|
@ -53,7 +53,7 @@ void Translator::installTranslators()
|
|||
#ifdef QT_DEBUG
|
||||
QString("%1/share/translations").arg(KEEPASSX_BINARY_DIR),
|
||||
#endif
|
||||
filePath()->dataPath("translations")};
|
||||
resources()->dataPath("translations")};
|
||||
|
||||
bool translationsLoaded = false;
|
||||
for (const QString& path : paths) {
|
||||
|
|
@ -121,7 +121,7 @@ QList<QPair<QString, QString>> Translator::availableLanguages()
|
|||
#ifdef QT_DEBUG
|
||||
QString("%1/share/translations").arg(KEEPASSX_BINARY_DIR),
|
||||
#endif
|
||||
filePath()->dataPath("translations")};
|
||||
resources()->dataPath("translations")};
|
||||
|
||||
QList<QPair<QString, QString>> languages;
|
||||
languages.append(QPair<QString, QString>("system", "System default"));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "fdosecrets/widgets/DatabaseSettingsWidgetFdoSecrets.h"
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
QString DatabaseSettingsPageFdoSecrets::name()
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ QString DatabaseSettingsPageFdoSecrets::name()
|
|||
|
||||
QIcon DatabaseSettingsPageFdoSecrets::icon()
|
||||
{
|
||||
return filePath()->icon(QStringLiteral("apps"), QStringLiteral("freedesktop"));
|
||||
return resources()->icon(QStringLiteral("freedesktop"));
|
||||
}
|
||||
|
||||
QWidget* DatabaseSettingsPageFdoSecrets::createWidget()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#ifndef KEEPASSXC_FDOSECRETSPLUGIN_H
|
||||
#define KEEPASSXC_FDOSECRETSPLUGIN_H
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/ApplicationSettingsWidget.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
QIcon icon() override
|
||||
{
|
||||
return FilePath::instance()->icon("apps", "freedesktop");
|
||||
return Resources::instance()->icon("freedesktop");
|
||||
}
|
||||
|
||||
QWidget* createWidget() override;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "core/Database.h"
|
||||
#include "core/DatabaseIcons.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/DatabaseTabWidget.h"
|
||||
#include "gui/DatabaseWidget.h"
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ namespace FdoSecrets
|
|||
case Qt::DisplayRole:
|
||||
return tr("Unlock to show");
|
||||
case Qt::DecorationRole:
|
||||
return filePath()->icon(QStringLiteral("apps"), QStringLiteral("object-locked"));
|
||||
return resources()->icon(QStringLiteral("object-locked"));
|
||||
case Qt::FontRole: {
|
||||
QFont font;
|
||||
font.setItalic(true);
|
||||
|
|
@ -165,7 +165,7 @@ namespace FdoSecrets
|
|||
case Qt::DisplayRole:
|
||||
return tr("None");
|
||||
case Qt::DecorationRole:
|
||||
return filePath()->icon(QStringLiteral("apps"), QStringLiteral("paint-none"));
|
||||
return resources()->icon(QStringLiteral("paint-none"));
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "fdosecrets/objects/Session.h"
|
||||
#include "fdosecrets/widgets/SettingsModels.h"
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/DatabaseWidget.h"
|
||||
|
||||
#include <QAction>
|
||||
|
|
@ -63,7 +63,7 @@ namespace
|
|||
|
||||
// db settings
|
||||
m_dbSettingsAct = new QAction(tr("Database settings"), this);
|
||||
m_dbSettingsAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("document-edit")));
|
||||
m_dbSettingsAct->setIcon(resources()->icon(QStringLiteral("document-edit")));
|
||||
m_dbSettingsAct->setToolTip(tr("Edit database settings"));
|
||||
m_dbSettingsAct->setEnabled(false);
|
||||
connect(m_dbSettingsAct, &QAction::triggered, this, [this]() {
|
||||
|
|
@ -77,7 +77,7 @@ namespace
|
|||
|
||||
// unlock/lock
|
||||
m_lockAct = new QAction(tr("Unlock database"), this);
|
||||
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-locked")));
|
||||
m_lockAct->setIcon(resources()->icon(QStringLiteral("object-locked")));
|
||||
m_lockAct->setToolTip(tr("Unlock database to show more information"));
|
||||
connect(m_lockAct, &QAction::triggered, this, [this]() {
|
||||
if (!m_dbWidget) {
|
||||
|
|
@ -135,13 +135,13 @@ namespace
|
|||
}
|
||||
connect(m_dbWidget, &DatabaseWidget::databaseLocked, this, [this]() {
|
||||
m_lockAct->setText(tr("Unlock database"));
|
||||
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-locked")));
|
||||
m_lockAct->setIcon(resources()->icon(QStringLiteral("object-locked")));
|
||||
m_lockAct->setToolTip(tr("Unlock database to show more information"));
|
||||
m_dbSettingsAct->setEnabled(false);
|
||||
});
|
||||
connect(m_dbWidget, &DatabaseWidget::databaseUnlocked, this, [this]() {
|
||||
m_lockAct->setText(tr("Lock database"));
|
||||
m_lockAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("object-unlocked")));
|
||||
m_lockAct->setIcon(resources()->icon(QStringLiteral("object-unlocked")));
|
||||
m_lockAct->setToolTip(tr("Lock database"));
|
||||
m_dbSettingsAct->setEnabled(true);
|
||||
});
|
||||
|
|
@ -174,7 +174,7 @@ namespace
|
|||
addWidget(spacer);
|
||||
|
||||
m_disconnectAct = new QAction(tr("Disconnect"), this);
|
||||
m_disconnectAct->setIcon(filePath()->icon(QStringLiteral("actions"), QStringLiteral("dialog-close")));
|
||||
m_disconnectAct->setIcon(resources()->icon(QStringLiteral("dialog-close")));
|
||||
m_disconnectAct->setToolTip(tr("Disconnect this application"));
|
||||
connect(m_disconnectAct, &QAction::triggered, this, [this]() {
|
||||
if (m_session) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "ui_AboutDialog.h"
|
||||
|
||||
#include "config-keepassx.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Tools.h"
|
||||
#include "crypto/Crypto.h"
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ AboutDialog::AboutDialog(QWidget* parent)
|
|||
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
|
||||
m_ui->nameLabel->setFont(nameLabelFont);
|
||||
|
||||
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48));
|
||||
m_ui->iconLabel->setPixmap(resources()->applicationIcon().pixmap(48));
|
||||
|
||||
QString debugInfo = Tools::debugInfo().append("\n").append(Crypto::debugInfo());
|
||||
m_ui->debugInfo->setPlainText(debugInfo);
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "autotype/AutoType.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Global.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Translator.h"
|
||||
|
||||
#include "MessageBox.h"
|
||||
|
|
@ -91,8 +91,8 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
|
|||
|
||||
m_secUi->setupUi(m_secWidget);
|
||||
m_generalUi->setupUi(m_generalWidget);
|
||||
addPage(tr("General"), FilePath::instance()->icon("categories", "preferences-other"), m_generalWidget);
|
||||
addPage(tr("Security"), FilePath::instance()->icon("status", "security-high"), m_secWidget);
|
||||
addPage(tr("General"), Resources::instance()->icon("preferences-other"), m_generalWidget);
|
||||
addPage(tr("Security"), Resources::instance()->icon("security-high"), m_secWidget);
|
||||
|
||||
if (!autoType()->isAvailable()) {
|
||||
m_generalUi->generalSettingsTabWidget->removeTab(1);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "config-keepassx.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "crypto/Crypto.h"
|
||||
#include "gui/DatabaseWidget.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "crypto/Random.h"
|
||||
#include "format/KeePass2Reader.h"
|
||||
#include "gui/FileDialog.h"
|
||||
|
|
@ -61,14 +61,14 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
|
|||
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(openDatabase()));
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
|
||||
m_ui->hardwareKeyLabelHelp->setIcon(filePath()->icon("actions", "system-help").pixmap(QSize(12, 12)));
|
||||
m_ui->hardwareKeyLabelHelp->setIcon(resources()->icon("system-help").pixmap(QSize(12, 12)));
|
||||
connect(m_ui->hardwareKeyLabelHelp, SIGNAL(clicked(bool)), SLOT(openHardwareKeyHelp()));
|
||||
m_ui->keyFileLabelHelp->setIcon(filePath()->icon("actions", "system-help").pixmap(QSize(12, 12)));
|
||||
m_ui->keyFileLabelHelp->setIcon(resources()->icon("system-help").pixmap(QSize(12, 12)));
|
||||
connect(m_ui->keyFileLabelHelp, SIGNAL(clicked(bool)), SLOT(openKeyFileHelp()));
|
||||
|
||||
connect(m_ui->comboKeyFile->lineEdit(), SIGNAL(textChanged(QString)), SLOT(handleKeyFileComboEdited()));
|
||||
connect(m_ui->comboKeyFile, SIGNAL(currentIndexChanged(int)), SLOT(handleKeyFileComboChanged()));
|
||||
m_ui->keyFileClearIcon->setIcon(filePath()->icon("actions", "edit-clear-locationbar-rtl"));
|
||||
m_ui->keyFileClearIcon->setIcon(resources()->icon("edit-clear-locationbar-rtl"));
|
||||
m_ui->keyFileClearIcon->setVisible(false);
|
||||
connect(m_ui->keyFileClearIcon, SIGNAL(triggered(bool)), SLOT(clearKeyFileEdit()));
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@
|
|||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/EntrySearcher.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/FileWatcher.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/Merger.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Tools.h"
|
||||
#include "format/KeePass2Reader.h"
|
||||
#include "gui/Clipboard.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
EditWidget::EditWidget(QWidget* parent)
|
||||
: DialogyWidget(parent)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <QDir>
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "entry/EntryAttachmentsModel.h"
|
||||
#include "gui/Clipboard.h"
|
||||
#if defined(WITH_XC_KEESHARE)
|
||||
|
|
@ -48,12 +48,12 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
|
|||
m_ui->setupUi(this);
|
||||
|
||||
// Entry
|
||||
m_ui->entryTotpButton->setIcon(filePath()->icon("actions", "chronometer"));
|
||||
m_ui->entryCloseButton->setIcon(filePath()->icon("actions", "dialog-close"));
|
||||
m_ui->entryTotpButton->setIcon(resources()->icon("chronometer"));
|
||||
m_ui->entryCloseButton->setIcon(resources()->icon("dialog-close"));
|
||||
m_ui->entryPasswordLabel->setFont(Font::fixedFont());
|
||||
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
||||
m_ui->toggleEntryNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
||||
m_ui->toggleGroupNotesButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
|
||||
m_ui->togglePasswordButton->setIcon(resources()->onOffIcon("password-show"));
|
||||
m_ui->toggleEntryNotesButton->setIcon(resources()->onOffIcon("password-show"));
|
||||
m_ui->toggleGroupNotesButton->setIcon(resources()->onOffIcon("password-show"));
|
||||
|
||||
m_ui->entryAttachmentsWidget->setReadOnly(true);
|
||||
m_ui->entryAttachmentsWidget->setButtonsVisible(false);
|
||||
|
|
@ -78,7 +78,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
|
|||
connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel()));
|
||||
|
||||
// Group
|
||||
m_ui->groupCloseButton->setIcon(filePath()->icon("actions", "dialog-close"));
|
||||
m_ui->groupCloseButton->setIcon(resources()->icon("dialog-close"));
|
||||
connect(m_ui->groupCloseButton, SIGNAL(clicked()), SLOT(hide()));
|
||||
connect(m_ui->groupTabWidget, SIGNAL(tabBarClicked(int)), SLOT(updateTabIndexes()), Qt::QueuedConnection);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
*/
|
||||
#include "KMessageWidget.h"
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Global.h"
|
||||
|
||||
#include <QAction>
|
||||
|
|
@ -94,7 +94,7 @@ void KMessageWidgetPrivate::init(KMessageWidget *q_ptr)
|
|||
QAction *closeAction = new QAction(q);
|
||||
closeAction->setText(KMessageWidget::tr("&Close"));
|
||||
closeAction->setToolTip(KMessageWidget::tr("Close message"));
|
||||
closeAction->setIcon(FilePath::instance()->icon("actions", "message-close"));
|
||||
closeAction->setIcon(Resources::instance()->icon("message-close"));
|
||||
|
||||
QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(animatedHide()));
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <QStyle>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
LineEdit::LineEdit(QWidget* parent)
|
||||
: QLineEdit(parent)
|
||||
|
|
@ -33,7 +33,7 @@ LineEdit::LineEdit(QWidget* parent)
|
|||
QString iconNameDirected =
|
||||
QString("edit-clear-locationbar-").append((layoutDirection() == Qt::LeftToRight) ? "rtl" : "ltr");
|
||||
|
||||
const auto icon = filePath()->icon("actions", iconNameDirected);
|
||||
const auto icon = resources()->icon(iconNameDirected);
|
||||
|
||||
m_clearButton->setIcon(icon);
|
||||
m_clearButton->setCursor(Qt::ArrowCursor);
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
#include "autotype/AutoType.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/InactivityTimer.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Tools.h"
|
||||
#include "gui/AboutDialog.h"
|
||||
#include "gui/DatabaseWidget.h"
|
||||
|
|
@ -103,7 +103,7 @@ public:
|
|||
|
||||
QIcon icon() override
|
||||
{
|
||||
return FilePath::instance()->icon("apps", "internet-web-browser");
|
||||
return Resources::instance()->icon("internet-web-browser");
|
||||
}
|
||||
|
||||
QWidget* createWidget() override
|
||||
|
|
@ -210,7 +210,7 @@ MainWindow::MainWindow()
|
|||
m_ui->settingsWidget->addSettingsPage(fdoSS);
|
||||
#endif
|
||||
|
||||
setWindowIcon(filePath()->applicationIcon());
|
||||
setWindowIcon(resources()->applicationIcon());
|
||||
m_ui->globalMessageWidget->setHidden(true);
|
||||
// clang-format off
|
||||
connect(m_ui->globalMessageWidget, &MessageWidget::linkActivated, &MessageWidget::openHttpUrl);
|
||||
|
|
@ -334,48 +334,48 @@ MainWindow::MainWindow()
|
|||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_C, this, SLOT(togglePasswordsHidden()));
|
||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B, this, SLOT(toggleUsernamesHidden()));
|
||||
|
||||
m_ui->actionDatabaseNew->setIcon(filePath()->icon("actions", "document-new"));
|
||||
m_ui->actionDatabaseOpen->setIcon(filePath()->icon("actions", "document-open"));
|
||||
m_ui->actionDatabaseSave->setIcon(filePath()->icon("actions", "document-save"));
|
||||
m_ui->actionDatabaseSaveAs->setIcon(filePath()->icon("actions", "document-save-as"));
|
||||
m_ui->actionDatabaseClose->setIcon(filePath()->icon("actions", "document-close"));
|
||||
m_ui->actionReports->setIcon(filePath()->icon("actions", "help-about"));
|
||||
m_ui->actionChangeDatabaseSettings->setIcon(filePath()->icon("actions", "document-edit"));
|
||||
m_ui->actionChangeMasterKey->setIcon(filePath()->icon("actions", "database-change-key"));
|
||||
m_ui->actionLockDatabases->setIcon(filePath()->icon("actions", "database-lock"));
|
||||
m_ui->actionQuit->setIcon(filePath()->icon("actions", "application-exit"));
|
||||
m_ui->actionDatabaseMerge->setIcon(filePath()->icon("actions", "database-merge"));
|
||||
m_ui->actionDatabaseNew->setIcon(resources()->icon("document-new"));
|
||||
m_ui->actionDatabaseOpen->setIcon(resources()->icon("document-open"));
|
||||
m_ui->actionDatabaseSave->setIcon(resources()->icon("document-save"));
|
||||
m_ui->actionDatabaseSaveAs->setIcon(resources()->icon("document-save-as"));
|
||||
m_ui->actionDatabaseClose->setIcon(resources()->icon("document-close"));
|
||||
m_ui->actionReports->setIcon(resources()->icon("help-about"));
|
||||
m_ui->actionChangeDatabaseSettings->setIcon(resources()->icon("document-edit"));
|
||||
m_ui->actionChangeMasterKey->setIcon(resources()->icon("database-change-key"));
|
||||
m_ui->actionLockDatabases->setIcon(resources()->icon("database-lock"));
|
||||
m_ui->actionQuit->setIcon(resources()->icon("application-exit"));
|
||||
m_ui->actionDatabaseMerge->setIcon(resources()->icon("database-merge"));
|
||||
|
||||
m_ui->actionEntryNew->setIcon(filePath()->icon("actions", "entry-new"));
|
||||
m_ui->actionEntryClone->setIcon(filePath()->icon("actions", "entry-clone"));
|
||||
m_ui->actionEntryEdit->setIcon(filePath()->icon("actions", "entry-edit"));
|
||||
m_ui->actionEntryDelete->setIcon(filePath()->icon("actions", "entry-delete"));
|
||||
m_ui->actionEntryAutoType->setIcon(filePath()->icon("actions", "auto-type"));
|
||||
m_ui->actionEntryCopyUsername->setIcon(filePath()->icon("actions", "username-copy"));
|
||||
m_ui->actionEntryCopyPassword->setIcon(filePath()->icon("actions", "password-copy"));
|
||||
m_ui->actionEntryCopyURL->setIcon(filePath()->icon("actions", "url-copy"));
|
||||
m_ui->actionEntryDownloadIcon->setIcon(filePath()->icon("actions", "favicon-download"));
|
||||
m_ui->actionGroupSortAsc->setIcon(filePath()->icon("actions", "sort-alphabetical-ascending"));
|
||||
m_ui->actionGroupSortDesc->setIcon(filePath()->icon("actions", "sort-alphabetical-descending"));
|
||||
m_ui->actionEntryNew->setIcon(resources()->icon("entry-new"));
|
||||
m_ui->actionEntryClone->setIcon(resources()->icon("entry-clone"));
|
||||
m_ui->actionEntryEdit->setIcon(resources()->icon("entry-edit"));
|
||||
m_ui->actionEntryDelete->setIcon(resources()->icon("entry-delete"));
|
||||
m_ui->actionEntryAutoType->setIcon(resources()->icon("auto-type"));
|
||||
m_ui->actionEntryCopyUsername->setIcon(resources()->icon("username-copy"));
|
||||
m_ui->actionEntryCopyPassword->setIcon(resources()->icon("password-copy"));
|
||||
m_ui->actionEntryCopyURL->setIcon(resources()->icon("url-copy"));
|
||||
m_ui->actionEntryDownloadIcon->setIcon(resources()->icon("favicon-download"));
|
||||
m_ui->actionGroupSortAsc->setIcon(resources()->icon("sort-alphabetical-ascending"));
|
||||
m_ui->actionGroupSortDesc->setIcon(resources()->icon("sort-alphabetical-descending"));
|
||||
|
||||
m_ui->actionGroupNew->setIcon(filePath()->icon("actions", "group-new"));
|
||||
m_ui->actionGroupEdit->setIcon(filePath()->icon("actions", "group-edit"));
|
||||
m_ui->actionGroupDelete->setIcon(filePath()->icon("actions", "group-delete"));
|
||||
m_ui->actionGroupEmptyRecycleBin->setIcon(filePath()->icon("actions", "group-empty-trash"));
|
||||
m_ui->actionEntryOpenUrl->setIcon(filePath()->icon("actions", "web"));
|
||||
m_ui->actionGroupDownloadFavicons->setIcon(filePath()->icon("actions", "favicon-download"));
|
||||
m_ui->actionGroupNew->setIcon(resources()->icon("group-new"));
|
||||
m_ui->actionGroupEdit->setIcon(resources()->icon("group-edit"));
|
||||
m_ui->actionGroupDelete->setIcon(resources()->icon("group-delete"));
|
||||
m_ui->actionGroupEmptyRecycleBin->setIcon(resources()->icon("group-empty-trash"));
|
||||
m_ui->actionEntryOpenUrl->setIcon(resources()->icon("web"));
|
||||
m_ui->actionGroupDownloadFavicons->setIcon(resources()->icon("favicon-download"));
|
||||
|
||||
m_ui->actionSettings->setIcon(filePath()->icon("actions", "configure"));
|
||||
m_ui->actionPasswordGenerator->setIcon(filePath()->icon("actions", "password-generator"));
|
||||
m_ui->actionSettings->setIcon(resources()->icon("configure"));
|
||||
m_ui->actionPasswordGenerator->setIcon(resources()->icon("password-generator"));
|
||||
|
||||
m_ui->actionAbout->setIcon(filePath()->icon("actions", "help-about"));
|
||||
m_ui->actionDonate->setIcon(filePath()->icon("actions", "donate"));
|
||||
m_ui->actionBugReport->setIcon(filePath()->icon("actions", "bugreport"));
|
||||
m_ui->actionGettingStarted->setIcon(filePath()->icon("actions", "getting-started"));
|
||||
m_ui->actionUserGuide->setIcon(filePath()->icon("actions", "user-guide"));
|
||||
m_ui->actionOnlineHelp->setIcon(filePath()->icon("actions", "system-help"));
|
||||
m_ui->actionKeyboardShortcuts->setIcon(filePath()->icon("actions", "keyboard-shortcuts"));
|
||||
m_ui->actionCheckForUpdates->setIcon(filePath()->icon("actions", "system-software-update"));
|
||||
m_ui->actionAbout->setIcon(resources()->icon("help-about"));
|
||||
m_ui->actionDonate->setIcon(resources()->icon("donate"));
|
||||
m_ui->actionBugReport->setIcon(resources()->icon("bugreport"));
|
||||
m_ui->actionGettingStarted->setIcon(resources()->icon("getting-started"));
|
||||
m_ui->actionUserGuide->setIcon(resources()->icon("user-guide"));
|
||||
m_ui->actionOnlineHelp->setIcon(resources()->icon("system-help"));
|
||||
m_ui->actionKeyboardShortcuts->setIcon(resources()->icon("keyboard-shortcuts"));
|
||||
m_ui->actionCheckForUpdates->setIcon(resources()->icon("system-software-update"));
|
||||
|
||||
m_actionMultiplexer.connect(
|
||||
SIGNAL(currentModeChanged(DatabaseWidget::Mode)), this, SLOT(setMenuActionState(DatabaseWidget::Mode)));
|
||||
|
|
@ -894,12 +894,12 @@ void MainWindow::openBugReportUrl()
|
|||
|
||||
void MainWindow::openGettingStartedGuide()
|
||||
{
|
||||
customOpenUrl(QString("file:///%1").arg(filePath()->dataPath("docs/KeePassXC_GettingStarted.pdf")));
|
||||
customOpenUrl(QString("file:///%1").arg(resources()->dataPath("docs/KeePassXC_GettingStarted.pdf")));
|
||||
}
|
||||
|
||||
void MainWindow::openUserGuide()
|
||||
{
|
||||
customOpenUrl(QString("file:///%1").arg(filePath()->dataPath("docs/KeePassXC_UserGuide.pdf")));
|
||||
customOpenUrl(QString("file:///%1").arg(resources()->dataPath("docs/KeePassXC_UserGuide.pdf")));
|
||||
}
|
||||
|
||||
void MainWindow::openOnlineHelp()
|
||||
|
|
@ -1138,7 +1138,7 @@ void MainWindow::updateTrayIcon()
|
|||
|
||||
QAction* actionToggle = new QAction(tr("Toggle window"), menu);
|
||||
menu->addAction(actionToggle);
|
||||
actionToggle->setIcon(filePath()->icon("apps", "keepassxc-dark", false));
|
||||
actionToggle->setIcon(resources()->icon("keepassxc-dark", false));
|
||||
|
||||
menu->addAction(m_ui->actionLockDatabases);
|
||||
|
||||
|
|
@ -1158,13 +1158,13 @@ void MainWindow::updateTrayIcon()
|
|||
|
||||
m_trayIcon->setContextMenu(menu);
|
||||
|
||||
m_trayIcon->setIcon(filePath()->trayIcon());
|
||||
m_trayIcon->setIcon(resources()->trayIcon());
|
||||
m_trayIcon->show();
|
||||
}
|
||||
if (m_ui->tabWidget->hasLockableDatabases()) {
|
||||
m_trayIcon->setIcon(filePath()->trayIconUnlocked());
|
||||
m_trayIcon->setIcon(resources()->trayIconUnlocked());
|
||||
} else {
|
||||
m_trayIcon->setIcon(filePath()->trayIconLocked());
|
||||
m_trayIcon->setIcon(resources()->trayIconLocked());
|
||||
}
|
||||
} else {
|
||||
if (m_trayIcon) {
|
||||
|
|
@ -1525,7 +1525,7 @@ void MainWindow::displayDesktopNotification(const QString& msg, QString title, i
|
|||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
|
||||
m_trayIcon->showMessage(title, msg, filePath()->applicationIcon(), msTimeoutHint);
|
||||
m_trayIcon->showMessage(title, msg, resources()->applicationIcon(), msTimeoutHint);
|
||||
#else
|
||||
m_trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, msTimeoutHint);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "PasswordEdit.h"
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/Application.h"
|
||||
#include "gui/Font.h"
|
||||
#include "gui/PasswordGeneratorWidget.h"
|
||||
|
|
@ -39,12 +39,12 @@ namespace
|
|||
PasswordEdit::PasswordEdit(QWidget* parent)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
const QIcon errorIcon = filePath()->icon("status", "dialog-error");
|
||||
const QIcon errorIcon = resources()->icon("dialog-error");
|
||||
m_errorAction = addAction(errorIcon, QLineEdit::TrailingPosition);
|
||||
m_errorAction->setVisible(false);
|
||||
m_errorAction->setToolTip(tr("Passwords do not match"));
|
||||
|
||||
const QIcon correctIcon = filePath()->icon("actions", "dialog-ok");
|
||||
const QIcon correctIcon = resources()->icon("dialog-ok");
|
||||
m_correctAction = addAction(correctIcon, QLineEdit::TrailingPosition);
|
||||
m_correctAction->setVisible(false);
|
||||
m_correctAction->setToolTip(tr("Passwords match so far"));
|
||||
|
|
@ -57,7 +57,7 @@ PasswordEdit::PasswordEdit(QWidget* parent)
|
|||
setFont(passwordFont);
|
||||
|
||||
m_toggleVisibleAction = new QAction(
|
||||
filePath()->icon("actions", "password-show-off"),
|
||||
resources()->icon("password-show"),
|
||||
tr("Toggle Password (%1)").arg(QKeySequence(Qt::CTRL + Qt::Key_H).toString(QKeySequence::NativeText)),
|
||||
nullptr);
|
||||
m_toggleVisibleAction->setCheckable(true);
|
||||
|
|
@ -67,7 +67,7 @@ PasswordEdit::PasswordEdit(QWidget* parent)
|
|||
connect(m_toggleVisibleAction, &QAction::triggered, this, &PasswordEdit::setShowPassword);
|
||||
|
||||
m_passwordGeneratorAction = new QAction(
|
||||
filePath()->icon("actions", "password-generator"),
|
||||
resources()->icon("password-generator"),
|
||||
tr("Generate Password (%1)").arg(QKeySequence(Qt::CTRL + Qt::Key_G).toString(QKeySequence::NativeText)),
|
||||
nullptr);
|
||||
m_passwordGeneratorAction->setShortcut(Qt::CTRL + Qt::Key_G);
|
||||
|
|
@ -105,7 +105,7 @@ void PasswordEdit::enablePasswordGenerator()
|
|||
void PasswordEdit::setShowPassword(bool show)
|
||||
{
|
||||
setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password);
|
||||
m_toggleVisibleAction->setIcon(filePath()->icon("actions", show ? "password-show-on" : "password-show-off"));
|
||||
m_toggleVisibleAction->setIcon(resources()->icon(show ? "password-show-on" : "password-show-off"));
|
||||
m_toggleVisibleAction->setChecked(show);
|
||||
|
||||
if (m_repeatPasswordEdit) {
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@
|
|||
#include <QLineEdit>
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/PasswordGenerator.h"
|
||||
#include "core/PasswordHealth.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/Application.h"
|
||||
#include "gui/Clipboard.h"
|
||||
|
||||
|
|
@ -38,10 +38,10 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
|
|||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->buttonGenerate->setIcon(filePath()->icon("actions", "refresh"));
|
||||
m_ui->buttonGenerate->setIcon(resources()->icon("refresh"));
|
||||
m_ui->buttonGenerate->setToolTip(
|
||||
tr("Regenerate password (%1)").arg(m_ui->buttonGenerate->shortcut().toString(QKeySequence::NativeText)));
|
||||
m_ui->buttonCopy->setIcon(filePath()->icon("actions", "clipboard-text"));
|
||||
m_ui->buttonCopy->setIcon(resources()->icon("clipboard-text"));
|
||||
m_ui->buttonClose->setShortcut(Qt::Key_Escape);
|
||||
|
||||
connect(m_ui->editNewPassword, SIGNAL(textChanged(QString)), SLOT(updateButtonsEnabled(QString)));
|
||||
|
|
@ -85,7 +85,7 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
|
|||
m_ui->wordCaseComboBox->addItem(tr("UPPER CASE"), PassphraseGenerator::UPPERCASE);
|
||||
m_ui->wordCaseComboBox->addItem(tr("Title Case"), PassphraseGenerator::TITLECASE);
|
||||
|
||||
QDir path(filePath()->wordlistPath(""));
|
||||
QDir path(resources()->wordlistPath(""));
|
||||
QStringList files = path.entryList(QDir::Files);
|
||||
m_ui->comboBoxWordList->addItems(files);
|
||||
if (files.size() > 1) {
|
||||
|
|
@ -538,7 +538,7 @@ void PasswordGeneratorWidget::updateGenerator()
|
|||
|
||||
m_dicewareGenerator->setWordCount(m_ui->spinBoxWordCount->value());
|
||||
if (!m_ui->comboBoxWordList->currentText().isEmpty()) {
|
||||
QString path = filePath()->wordlistPath(m_ui->comboBoxWordList->currentText());
|
||||
QString path = resources()->wordlistPath(m_ui->comboBoxWordList->currentText());
|
||||
m_dicewareGenerator->setWordList(path);
|
||||
}
|
||||
m_dicewareGenerator->setWordSeparator(m_ui->editWordSeparator->text());
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include <QToolButton>
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/widgets/PopupHelpWidget.h"
|
||||
|
||||
SearchWidget::SearchWidget(QWidget* parent)
|
||||
|
|
@ -69,13 +69,13 @@ SearchWidget::SearchWidget(QWidget* parent)
|
|||
m_actionLimitGroup->setCheckable(true);
|
||||
m_actionLimitGroup->setChecked(config()->get("SearchLimitGroup", false).toBool());
|
||||
|
||||
m_ui->searchIcon->setIcon(filePath()->icon("actions", "system-search"));
|
||||
m_ui->searchIcon->setIcon(resources()->icon("system-search"));
|
||||
m_ui->searchEdit->addAction(m_ui->searchIcon, QLineEdit::LeadingPosition);
|
||||
|
||||
m_ui->helpIcon->setIcon(filePath()->icon("actions", "system-help"));
|
||||
m_ui->helpIcon->setIcon(resources()->icon("system-help"));
|
||||
m_ui->searchEdit->addAction(m_ui->helpIcon, QLineEdit::TrailingPosition);
|
||||
|
||||
m_ui->clearIcon->setIcon(filePath()->icon("actions", "edit-clear-locationbar-rtl"));
|
||||
m_ui->clearIcon->setIcon(resources()->icon("edit-clear-locationbar-rtl"));
|
||||
m_ui->clearIcon->setVisible(false);
|
||||
m_ui->searchEdit->addAction(m_ui->clearIcon, QLineEdit::TrailingPosition);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <QRegularExpression>
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Tools.h"
|
||||
#include "gui/Font.h"
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ const QColor URLEdit::ErrorColor = QColor(255, 125, 125);
|
|||
URLEdit::URLEdit(QWidget* parent)
|
||||
: QLineEdit(parent)
|
||||
{
|
||||
const QIcon errorIcon = filePath()->icon("status", "dialog-error");
|
||||
const QIcon errorIcon = resources()->icon("dialog-error");
|
||||
m_errorAction = addAction(errorIcon, QLineEdit::TrailingPosition);
|
||||
m_errorAction->setVisible(false);
|
||||
m_errorAction->setToolTip(tr("Invalid URL"));
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "UpdateCheckDialog.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "ui_UpdateCheckDialog.h"
|
||||
#include "updatecheck/UpdateChecker.h"
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ UpdateCheckDialog::UpdateCheckDialog(QWidget* parent)
|
|||
setWindowFlags(Qt::Window);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48));
|
||||
m_ui->iconLabel->setPixmap(resources()->applicationIcon().pixmap(48));
|
||||
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
|
||||
connect(UpdateChecker::instance(),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "config-keepassx.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
WelcomeWidget::WelcomeWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
|
|
@ -36,7 +36,7 @@ WelcomeWidget::WelcomeWidget(QWidget* parent)
|
|||
welcomeLabelFont.setPointSize(welcomeLabelFont.pointSize() + 4);
|
||||
m_ui->welcomeLabel->setFont(welcomeLabelFont);
|
||||
|
||||
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(64));
|
||||
m_ui->iconLabel->setPixmap(resources()->applicationIcon().pixmap(64));
|
||||
|
||||
refreshLastDatabases();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Global.h"
|
||||
#include "core/Resources.h"
|
||||
#include "touchid/TouchID.h"
|
||||
|
||||
class DatabaseSettingsDialog::ExtraPage
|
||||
|
|
@ -76,8 +76,8 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
|
|||
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(save()));
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
|
||||
m_ui->categoryList->addCategory(tr("General"), FilePath::instance()->icon("categories", "preferences-other"));
|
||||
m_ui->categoryList->addCategory(tr("Security"), FilePath::instance()->icon("status", "security-high"));
|
||||
m_ui->categoryList->addCategory(tr("General"), Resources::instance()->icon("preferences-other"));
|
||||
m_ui->categoryList->addCategory(tr("Security"), Resources::instance()->icon("security-high"));
|
||||
m_ui->stackedWidget->addWidget(m_generalWidget);
|
||||
|
||||
m_ui->stackedWidget->addWidget(m_securityTabWidget);
|
||||
|
|
@ -100,8 +100,7 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
|
|||
connect(m_ui->advancedSettingsToggle, SIGNAL(toggled(bool)), SLOT(toggleAdvancedMode(bool)));
|
||||
|
||||
#ifdef WITH_XC_BROWSER
|
||||
m_ui->categoryList->addCategory(tr("Browser Integration"),
|
||||
FilePath::instance()->icon("apps", "internet-web-browser"));
|
||||
m_ui->categoryList->addCategory(tr("Browser Integration"), Resources::instance()->icon("internet-web-browser"));
|
||||
m_ui->stackedWidget->addWidget(m_browserWidget);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/TimeDelta.h"
|
||||
#include "core/Tools.h"
|
||||
#ifdef WITH_XC_SSHAGENT
|
||||
|
|
@ -138,7 +138,7 @@ EditEntryWidget::~EditEntryWidget()
|
|||
void EditEntryWidget::setupMain()
|
||||
{
|
||||
m_mainUi->setupUi(m_mainWidget);
|
||||
addPage(tr("Entry"), FilePath::instance()->icon("actions", "document-edit"), m_mainWidget);
|
||||
addPage(tr("Entry"), Resources::instance()->icon("document-edit"), m_mainWidget);
|
||||
|
||||
m_mainUi->usernameComboBox->setEditable(true);
|
||||
m_usernameCompleter->setCompletionMode(QCompleter::InlineCompletion);
|
||||
|
|
@ -147,7 +147,7 @@ void EditEntryWidget::setupMain()
|
|||
m_mainUi->usernameComboBox->setCompleter(m_usernameCompleter);
|
||||
|
||||
#ifdef WITH_XC_NETWORKING
|
||||
m_mainUi->fetchFaviconButton->setIcon(filePath()->icon("actions", "favicon-download"));
|
||||
m_mainUi->fetchFaviconButton->setIcon(resources()->icon("favicon-download"));
|
||||
m_mainUi->fetchFaviconButton->setDisabled(true);
|
||||
#else
|
||||
m_mainUi->fetchFaviconButton->setVisible(false);
|
||||
|
|
@ -168,7 +168,7 @@ void EditEntryWidget::setupMain()
|
|||
void EditEntryWidget::setupAdvanced()
|
||||
{
|
||||
m_advancedUi->setupUi(m_advancedWidget);
|
||||
addPage(tr("Advanced"), FilePath::instance()->icon("categories", "preferences-other"), m_advancedWidget);
|
||||
addPage(tr("Advanced"), Resources::instance()->icon("preferences-other"), m_advancedWidget);
|
||||
|
||||
m_advancedUi->attachmentsWidget->setReadOnly(false);
|
||||
m_advancedUi->attachmentsWidget->setButtonsVisible(true);
|
||||
|
|
@ -198,7 +198,7 @@ void EditEntryWidget::setupAdvanced()
|
|||
void EditEntryWidget::setupIcon()
|
||||
{
|
||||
m_iconsWidget->setShowApplyIconToButton(false);
|
||||
addPage(tr("Icon"), FilePath::instance()->icon("apps", "preferences-desktop-icons"), m_iconsWidget);
|
||||
addPage(tr("Icon"), Resources::instance()->icon("preferences-desktop-icons"), m_iconsWidget);
|
||||
connect(this, SIGNAL(accepted()), m_iconsWidget, SLOT(abortRequests()));
|
||||
connect(this, SIGNAL(rejected()), m_iconsWidget, SLOT(abortRequests()));
|
||||
}
|
||||
|
|
@ -211,9 +211,9 @@ void EditEntryWidget::openAutotypeHelp()
|
|||
void EditEntryWidget::setupAutoType()
|
||||
{
|
||||
m_autoTypeUi->setupUi(m_autoTypeWidget);
|
||||
addPage(tr("Auto-Type"), FilePath::instance()->icon("actions", "key-enter"), m_autoTypeWidget);
|
||||
addPage(tr("Auto-Type"), Resources::instance()->icon("key-enter"), m_autoTypeWidget);
|
||||
|
||||
m_autoTypeUi->openHelpButton->setIcon(filePath()->icon("actions", "system-help"));
|
||||
m_autoTypeUi->openHelpButton->setIcon(resources()->icon("system-help"));
|
||||
|
||||
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton);
|
||||
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton);
|
||||
|
|
@ -252,7 +252,7 @@ void EditEntryWidget::setupBrowser()
|
|||
m_browserUi->setupUi(m_browserWidget);
|
||||
|
||||
if (config()->get("Browser/Enabled", false).toBool()) {
|
||||
addPage(tr("Browser Integration"), FilePath::instance()->icon("apps", "internet-web-browser"), m_browserWidget);
|
||||
addPage(tr("Browser Integration"), Resources::instance()->icon("internet-web-browser"), m_browserWidget);
|
||||
m_additionalURLsDataModel->setEntryAttributes(m_entryAttributes);
|
||||
m_browserUi->additionalURLsView->setModel(m_additionalURLsDataModel);
|
||||
|
||||
|
|
@ -370,13 +370,13 @@ void EditEntryWidget::updateCurrentURL()
|
|||
|
||||
void EditEntryWidget::setupProperties()
|
||||
{
|
||||
addPage(tr("Properties"), FilePath::instance()->icon("actions", "document-properties"), m_editWidgetProperties);
|
||||
addPage(tr("Properties"), Resources::instance()->icon("document-properties"), m_editWidgetProperties);
|
||||
}
|
||||
|
||||
void EditEntryWidget::setupHistory()
|
||||
{
|
||||
m_historyUi->setupUi(m_historyWidget);
|
||||
addPage(tr("History"), FilePath::instance()->icon("actions", "view-history"), m_historyWidget);
|
||||
addPage(tr("History"), Resources::instance()->icon("view-history"), m_historyWidget);
|
||||
|
||||
m_sortModel->setSourceModel(m_historyModel);
|
||||
m_sortModel->setDynamicSortFilter(true);
|
||||
|
|
@ -521,7 +521,7 @@ void EditEntryWidget::setupSSHAgent()
|
|||
SIGNAL(entryAttachmentsModified()),
|
||||
SLOT(updateSSHAgentAttachments()));
|
||||
|
||||
addPage(tr("SSH Agent"), FilePath::instance()->icon("apps", "utilities-terminal"), m_sshAgentWidget);
|
||||
addPage(tr("SSH Agent"), Resources::instance()->icon("utilities-terminal"), m_sshAgentWidget);
|
||||
}
|
||||
|
||||
void EditEntryWidget::updateSSHAgent()
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
#include "core/Config.h"
|
||||
#include "core/DatabaseIcons.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Global.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Resources.h"
|
||||
#ifdef Q_OS_MACOS
|
||||
#include "gui/osutils/macutils/MacUtils.h"
|
||||
#endif
|
||||
|
|
@ -259,12 +259,12 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
|
|||
return entry->iconScaledPixmap();
|
||||
case Paperclip:
|
||||
if (!entry->attachments()->isEmpty()) {
|
||||
return filePath()->icon("actions", "paperclip");
|
||||
return resources()->icon("paperclip");
|
||||
}
|
||||
break;
|
||||
case Totp:
|
||||
if (entry->hasTotp()) {
|
||||
return filePath()->icon("actions", "chronometer");
|
||||
return resources()->icon("chronometer");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -336,9 +336,9 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro
|
|||
} else if (role == Qt::DecorationRole) {
|
||||
switch (section) {
|
||||
case Paperclip:
|
||||
return filePath()->icon("actions", "paperclip");
|
||||
return resources()->icon("paperclip");
|
||||
case Totp:
|
||||
return filePath()->icon("actions", "chronometer");
|
||||
return resources()->icon("chronometer");
|
||||
}
|
||||
} else if (role == Qt::ToolTipRole) {
|
||||
switch (section) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "EntryURLModel.h"
|
||||
|
||||
#include "core/Entry.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "core/Tools.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
EntryURLModel::EntryURLModel(QObject* parent)
|
||||
: QStandardItemModel(parent)
|
||||
, m_entryAttributes(nullptr)
|
||||
, m_errorIcon(filePath()->icon("status", "dialog-error"))
|
||||
, m_errorIcon(resources()->icon("dialog-error"))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
#include "ui_EditGroupWidgetMain.h"
|
||||
|
||||
#include "core/Config.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/EditWidgetIcons.h"
|
||||
#include "gui/EditWidgetProperties.h"
|
||||
#include "gui/MessageBox.h"
|
||||
|
|
@ -69,12 +69,12 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
|
|||
{
|
||||
m_mainUi->setupUi(m_editGroupWidgetMain);
|
||||
|
||||
addPage(tr("Group"), FilePath::instance()->icon("actions", "document-edit"), m_editGroupWidgetMain);
|
||||
addPage(tr("Icon"), FilePath::instance()->icon("apps", "preferences-desktop-icons"), m_editGroupWidgetIcons);
|
||||
addPage(tr("Group"), Resources::instance()->icon("document-edit"), m_editGroupWidgetMain);
|
||||
addPage(tr("Icon"), Resources::instance()->icon("preferences-desktop-icons"), m_editGroupWidgetIcons);
|
||||
#if defined(WITH_XC_KEESHARE)
|
||||
addEditPage(new EditGroupPageKeeShare(this));
|
||||
#endif
|
||||
addPage(tr("Properties"), FilePath::instance()->icon("actions", "document-properties"), m_editWidgetProperties);
|
||||
addPage(tr("Properties"), Resources::instance()->icon("document-properties"), m_editWidgetProperties);
|
||||
|
||||
connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
|
||||
connect(m_mainUi->autoTypeSequenceCustomRadio,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include "PasswordEditWidget.h"
|
||||
#include "ui_PasswordEditWidget.h"
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/PasswordGeneratorWidget.h"
|
||||
#include "keys/CompositeKey.h"
|
||||
#include "keys/PasswordKey.h"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include "ReportsPageHealthcheck.h"
|
||||
|
||||
#include "ReportsWidgetHealthcheck.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ QString ReportsPageHealthcheck::name()
|
|||
|
||||
QIcon ReportsPageHealthcheck::icon()
|
||||
{
|
||||
return FilePath::instance()->icon("actions", "health");
|
||||
return Resources::instance()->icon("health");
|
||||
}
|
||||
|
||||
QWidget* ReportsPageHealthcheck::createWidget()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include "ReportsPageStatistics.h"
|
||||
|
||||
#include "ReportsWidgetStatistics.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ QString ReportsPageStatistics::name()
|
|||
|
||||
QIcon ReportsPageStatistics::icon()
|
||||
{
|
||||
return FilePath::instance()->icon("actions", "statistics");
|
||||
return Resources::instance()->icon("statistics");
|
||||
}
|
||||
|
||||
QWidget* ReportsPageStatistics::createWidget()
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include "core/AsyncTask.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/PasswordHealth.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
#include <QSharedPointer>
|
||||
#include <QStandardItemModel>
|
||||
|
|
@ -102,7 +102,7 @@ Health::Health(QSharedPointer<Database> db)
|
|||
ReportsWidgetHealthcheck::ReportsWidgetHealthcheck(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::ReportsWidgetHealthcheck())
|
||||
, m_errorIcon(FilePath::instance()->icon("status", "dialog-error"))
|
||||
, m_errorIcon(Resources::instance()->icon("dialog-error"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@
|
|||
|
||||
#include "core/AsyncTask.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/PasswordHealth.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QHash>
|
||||
|
|
@ -150,7 +150,7 @@ namespace
|
|||
ReportsWidgetStatistics::ReportsWidgetStatistics(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::ReportsWidgetStatistics())
|
||||
, m_errIcon(FilePath::instance()->icon("status", "dialog-error"))
|
||||
, m_errIcon(Resources::instance()->icon("dialog-error"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
|
|
|||
|
|
@ -4160,8 +4160,8 @@ void BaseStyle::polish(QApplication* app)
|
|||
}
|
||||
|
||||
Q_INIT_RESOURCE(styles);
|
||||
QString stylesheet;
|
||||
|
||||
QString stylesheet;
|
||||
QFile baseStylesheetFile(":/styles/base/basestyle.qss");
|
||||
if (baseStylesheetFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
stylesheet = baseStylesheetFile.readAll();
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@
|
|||
#include "NewDatabaseWizardPageMetaData.h"
|
||||
|
||||
#include "core/Database.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Global.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/Resources.h"
|
||||
#include "format/KeePass2.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
|
|
@ -48,7 +48,8 @@ NewDatabaseWizard::NewDatabaseWizard(QWidget* parent)
|
|||
|
||||
setWindowTitle(tr("Create a new KeePassXC database..."));
|
||||
|
||||
setPixmap(QWizard::BackgroundPixmap, QPixmap(filePath()->dataPath("wizard/background-pixmap.png")));
|
||||
Q_INIT_RESOURCE(wizard);
|
||||
setPixmap(QWizard::BackgroundPixmap, QPixmap(":/wizard/background-pixmap.png"));
|
||||
}
|
||||
|
||||
NewDatabaseWizard::~NewDatabaseWizard()
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
#include "DatabaseSettingsPageKeeShare.h"
|
||||
|
||||
#include "core/Database.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/Resources.h"
|
||||
#include "keeshare/DatabaseSettingsWidgetKeeShare.h"
|
||||
#include "keeshare/KeeShare.h"
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ QString DatabaseSettingsPageKeeShare::name()
|
|||
|
||||
QIcon DatabaseSettingsPageKeeShare::icon()
|
||||
{
|
||||
return FilePath::instance()->icon("apps", "preferences-system-network-sharing");
|
||||
return Resources::instance()->icon("preferences-system-network-sharing");
|
||||
}
|
||||
|
||||
QWidget* DatabaseSettingsPageKeeShare::createWidget()
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
#include "SettingsPageKeeShare.h"
|
||||
|
||||
#include "core/Database.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/Resources.h"
|
||||
#include "gui/DatabaseTabWidget.h"
|
||||
#include "gui/MessageWidget.h"
|
||||
#include "keeshare/KeeShare.h"
|
||||
|
|
@ -39,7 +39,7 @@ QString SettingsPageKeeShare::name()
|
|||
|
||||
QIcon SettingsPageKeeShare::icon()
|
||||
{
|
||||
return FilePath::instance()->icon("apps", "preferences-system-network-sharing");
|
||||
return Resources::instance()->icon("preferences-system-network-sharing");
|
||||
}
|
||||
|
||||
QWidget* SettingsPageKeeShare::createWidget()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "EditGroupPageKeeShare.h"
|
||||
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
#include "keeshare/group/EditGroupWidgetKeeShare.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
|
@ -34,7 +34,7 @@ QString EditGroupPageKeeShare::name()
|
|||
|
||||
QIcon EditGroupPageKeeShare::icon()
|
||||
{
|
||||
return FilePath::instance()->icon("apps", "preferences-system-network-sharing");
|
||||
return Resources::instance()->icon("preferences-system-network-sharing");
|
||||
}
|
||||
|
||||
QWidget* EditGroupPageKeeShare::createWidget()
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include "core/Config.h"
|
||||
#include "core/CustomData.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Resources.h"
|
||||
#include "crypto/ssh/OpenSSHKey.h"
|
||||
#include "gui/FileDialog.h"
|
||||
#include "keeshare/KeeShare.h"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "AgentSettingsPage.h"
|
||||
#include "AgentSettingsWidget.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Resources.h"
|
||||
|
||||
AgentSettingsPage::AgentSettingsPage(DatabaseTabWidget* tabWidget)
|
||||
{
|
||||
|
|
@ -36,7 +36,7 @@ QString AgentSettingsPage::name()
|
|||
|
||||
QIcon AgentSettingsPage::icon()
|
||||
{
|
||||
return FilePath::instance()->icon("apps", "utilities-terminal");
|
||||
return Resources::instance()->icon("utilities-terminal");
|
||||
}
|
||||
|
||||
QWidget* AgentSettingsPage::createWidget()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue