mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Rename DataPath to FilePath.
This commit is contained in:
parent
4781fc19fe
commit
7fef3bd701
@ -25,11 +25,11 @@ set(keepassx_SOURCES
|
|||||||
core/Config.cpp
|
core/Config.cpp
|
||||||
core/Database.cpp
|
core/Database.cpp
|
||||||
core/DatabaseIcons.cpp
|
core/DatabaseIcons.cpp
|
||||||
core/DataPath.cpp
|
|
||||||
core/Endian.cpp
|
core/Endian.cpp
|
||||||
core/Entry.cpp
|
core/Entry.cpp
|
||||||
core/EntryAttachments.cpp
|
core/EntryAttachments.cpp
|
||||||
core/EntryAttributes.cpp
|
core/EntryAttributes.cpp
|
||||||
|
core/FilePath.cpp
|
||||||
core/Group.cpp
|
core/Group.cpp
|
||||||
core/ListDeleter.h
|
core/ListDeleter.h
|
||||||
core/Metadata.cpp
|
core/Metadata.cpp
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "DatabaseIcons.h"
|
#include "DatabaseIcons.h"
|
||||||
|
|
||||||
#include "core/DataPath.h"
|
#include "core/FilePath.h"
|
||||||
|
|
||||||
DatabaseIcons* DatabaseIcons::m_instance(Q_NULLPTR);
|
DatabaseIcons* DatabaseIcons::m_instance(Q_NULLPTR);
|
||||||
const int DatabaseIcons::IconCount(69);
|
const int DatabaseIcons::IconCount(69);
|
||||||
@ -106,7 +106,7 @@ QImage DatabaseIcons::icon(int index)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QString iconPath = QString("icons/database/").append(m_indexToName[index]);
|
QString iconPath = QString("icons/database/").append(m_indexToName[index]);
|
||||||
QImage icon(dataPath()->path(iconPath));
|
QImage icon(filePath()->path(iconPath));
|
||||||
|
|
||||||
m_iconCache[index] = icon;
|
m_iconCache[index] = icon;
|
||||||
return icon;
|
return icon;
|
||||||
|
@ -15,26 +15,26 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DataPath.h"
|
#include "FilePath.h"
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
|
||||||
#include "config-keepassx.h"
|
#include "config-keepassx.h"
|
||||||
|
|
||||||
DataPath* DataPath::m_instance(Q_NULLPTR);
|
FilePath* FilePath::m_instance(Q_NULLPTR);
|
||||||
|
|
||||||
QString DataPath::path(const QString& name)
|
QString FilePath::dataPath(const QString& name)
|
||||||
{
|
{
|
||||||
return m_basePath + name;
|
return m_basePath + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon DataPath::applicationIcon()
|
QIcon FilePath::applicationIcon()
|
||||||
{
|
{
|
||||||
return icon("apps", "keepassx");
|
return icon("apps", "keepassx");
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon DataPath::icon(const QString& category, const QString& name, bool fromTheme)
|
QIcon FilePath::icon(const QString& category, const QString& name, bool fromTheme)
|
||||||
{
|
{
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ QIcon DataPath::icon(const QString& category, const QString& name, bool fromThem
|
|||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataPath::DataPath()
|
FilePath::FilePath()
|
||||||
{
|
{
|
||||||
if (false) {
|
if (false) {
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ DataPath::DataPath()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataPath::testSetDir(const QString& dir)
|
bool FilePath::testSetDir(const QString& dir)
|
||||||
{
|
{
|
||||||
if (QFile::exists(dir + "/icons/database/C00_Password.png")) {
|
if (QFile::exists(dir + "/icons/database/C00_Password.png")) {
|
||||||
m_basePath = dir;
|
m_basePath = dir;
|
||||||
@ -101,10 +101,10 @@ bool DataPath::testSetDir(const QString& dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataPath* DataPath::instance()
|
FilePath* FilePath::instance()
|
||||||
{
|
{
|
||||||
if (!m_instance) {
|
if (!m_instance) {
|
||||||
m_instance = new DataPath();
|
m_instance = new FilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_instance;
|
return m_instance;
|
@ -15,36 +15,36 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef KEEPASSX_DATAPATH_H
|
#ifndef KEEPASSX_FILEPATH_H
|
||||||
#define KEEPASSX_DATAPATH_H
|
#define KEEPASSX_FILEPATH_H
|
||||||
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
#include "core/Global.h"
|
#include "core/Global.h"
|
||||||
|
|
||||||
class DataPath
|
class FilePath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString path(const QString& name);
|
QString dataPath(const QString& name);
|
||||||
QIcon applicationIcon();
|
QIcon applicationIcon();
|
||||||
QIcon icon(const QString& category, const QString& name, bool fromTheme = true);
|
QIcon icon(const QString& category, const QString& name, bool fromTheme = true);
|
||||||
|
|
||||||
static DataPath* instance();
|
static FilePath* instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DataPath();
|
FilePath();
|
||||||
bool testSetDir(const QString& dir);
|
bool testSetDir(const QString& dir);
|
||||||
|
|
||||||
static DataPath* m_instance;
|
static FilePath* m_instance;
|
||||||
|
|
||||||
QString m_basePath;
|
QString m_basePath;
|
||||||
|
|
||||||
Q_DISABLE_COPY(DataPath)
|
Q_DISABLE_COPY(FilePath)
|
||||||
};
|
};
|
||||||
|
|
||||||
inline DataPath* dataPath() {
|
inline FilePath* filePath() {
|
||||||
return DataPath::instance();
|
return FilePath::instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // KEEPASSX_DATAPATH_H
|
#endif // KEEPASSX_FILEPATH_H
|
@ -19,7 +19,7 @@
|
|||||||
#include "ui_AboutDialog.h"
|
#include "ui_AboutDialog.h"
|
||||||
|
|
||||||
#include "config-keepassx.h"
|
#include "config-keepassx.h"
|
||||||
#include "core/DataPath.h"
|
#include "core/FilePath.h"
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget* parent)
|
AboutDialog::AboutDialog(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
@ -33,7 +33,7 @@ AboutDialog::AboutDialog(QWidget* parent)
|
|||||||
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
|
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
|
||||||
m_ui->nameLabel->setFont(nameLabelFont);
|
m_ui->nameLabel->setFont(nameLabelFont);
|
||||||
|
|
||||||
m_ui->iconLabel->setPixmap(dataPath()->applicationIcon().pixmap(48));
|
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48));
|
||||||
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
|
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <QtGui/QSplitter>
|
#include <QtGui/QSplitter>
|
||||||
|
|
||||||
#include "autotype/AutoType.h"
|
#include "autotype/AutoType.h"
|
||||||
#include "core/DataPath.h"
|
#include "core/FilePath.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
#include "gui/ChangeMasterKeyWidget.h"
|
#include "gui/ChangeMasterKeyWidget.h"
|
||||||
@ -84,7 +84,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||||||
rightHandSideWidget->setSizePolicy(policy);
|
rightHandSideWidget->setSizePolicy(policy);
|
||||||
|
|
||||||
QAction* closeAction = new QAction(m_searchWidget);
|
QAction* closeAction = new QAction(m_searchWidget);
|
||||||
QIcon closeIcon = dataPath()->icon("actions", "dialog-close");
|
QIcon closeIcon = filePath()->icon("actions", "dialog-close");
|
||||||
closeAction->setIcon(closeIcon);
|
closeAction->setIcon(closeIcon);
|
||||||
m_searchUi->closeSearchButton->setDefaultAction(closeAction);
|
m_searchUi->closeSearchButton->setDefaultAction(closeAction);
|
||||||
m_searchWidget->hide();
|
m_searchWidget->hide();
|
||||||
@ -130,15 +130,15 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||||||
addWidget(m_keepass1OpenWidget);
|
addWidget(m_keepass1OpenWidget);
|
||||||
|
|
||||||
m_actionEntryNew = m_menuEntry->addAction(tr("Add new entry"), this, SLOT(createEntry()));
|
m_actionEntryNew = m_menuEntry->addAction(tr("Add new entry"), this, SLOT(createEntry()));
|
||||||
m_actionEntryNew->setIcon(dataPath()->icon("actions", "entry-new", false));
|
m_actionEntryNew->setIcon(filePath()->icon("actions", "entry-new", false));
|
||||||
m_actionEntryClone = m_menuEntry->addAction(tr("Clone entry"), this, SLOT(cloneEntry()));
|
m_actionEntryClone = m_menuEntry->addAction(tr("Clone entry"), this, SLOT(cloneEntry()));
|
||||||
m_actionEntryClone->setIcon(dataPath()->icon("actions", "entry-clone", false));
|
m_actionEntryClone->setIcon(filePath()->icon("actions", "entry-clone", false));
|
||||||
m_actionEntryClone->setEnabled(false);
|
m_actionEntryClone->setEnabled(false);
|
||||||
m_actionEntryEditView = m_menuEntry->addAction(tr("View/Edit entry"), this, SLOT(switchToEntryEdit()));
|
m_actionEntryEditView = m_menuEntry->addAction(tr("View/Edit entry"), this, SLOT(switchToEntryEdit()));
|
||||||
m_actionEntryEditView->setIcon(dataPath()->icon("actions", "entry-edit", false));
|
m_actionEntryEditView->setIcon(filePath()->icon("actions", "entry-edit", false));
|
||||||
m_actionEntryEditView->setEnabled(false);
|
m_actionEntryEditView->setEnabled(false);
|
||||||
m_actionEntryDelete = m_menuEntry->addAction(tr("Delete entry"), this, SLOT(deleteEntry()));
|
m_actionEntryDelete = m_menuEntry->addAction(tr("Delete entry"), this, SLOT(deleteEntry()));
|
||||||
m_actionEntryDelete->setIcon(dataPath()->icon("actions", "entry-delete", false));
|
m_actionEntryDelete->setIcon(filePath()->icon("actions", "entry-delete", false));
|
||||||
m_actionEntryDelete->setEnabled(false);
|
m_actionEntryDelete->setEnabled(false);
|
||||||
m_actionEntryCopyUsername = m_menuEntry->addAction(tr("Copy username to clipboard"), this,
|
m_actionEntryCopyUsername = m_menuEntry->addAction(tr("Copy username to clipboard"), this,
|
||||||
SLOT(copyUsername()), Qt::CTRL + Qt::Key_B);
|
SLOT(copyUsername()), Qt::CTRL + Qt::Key_B);
|
||||||
@ -157,11 +157,11 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||||||
m_actionEntryAutoType->setEnabled(false);
|
m_actionEntryAutoType->setEnabled(false);
|
||||||
|
|
||||||
m_actionGroupNew = m_menuGroup->addAction(tr("Add new group"), this, SLOT(createGroup()));
|
m_actionGroupNew = m_menuGroup->addAction(tr("Add new group"), this, SLOT(createGroup()));
|
||||||
m_actionGroupNew->setIcon(dataPath()->icon("actions", "group-new", false));
|
m_actionGroupNew->setIcon(filePath()->icon("actions", "group-new", false));
|
||||||
m_actionGroupEdit = m_menuGroup->addAction(tr("Edit group"), this, SLOT(switchToGroupEdit()));
|
m_actionGroupEdit = m_menuGroup->addAction(tr("Edit group"), this, SLOT(switchToGroupEdit()));
|
||||||
m_actionGroupEdit->setIcon(dataPath()->icon("actions", "group-edit", false));
|
m_actionGroupEdit->setIcon(filePath()->icon("actions", "group-edit", false));
|
||||||
m_actionGroupDelete = m_menuGroup->addAction(tr("Delete group"), this, SLOT(deleteGroup()));
|
m_actionGroupDelete = m_menuGroup->addAction(tr("Delete group"), this, SLOT(deleteGroup()));
|
||||||
m_actionGroupDelete->setIcon(dataPath()->icon("actions", "group-delete", false));
|
m_actionGroupDelete->setIcon(filePath()->icon("actions", "group-delete", false));
|
||||||
m_actionGroupDelete->setEnabled(false);
|
m_actionGroupDelete->setEnabled(false);
|
||||||
|
|
||||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
|
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include <QtGui/QStyle>
|
#include <QtGui/QStyle>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
#include "core/DataPath.h"
|
#include "core/FilePath.h"
|
||||||
|
|
||||||
LineEdit::LineEdit(QWidget* parent)
|
LineEdit::LineEdit(QWidget* parent)
|
||||||
: QLineEdit(parent)
|
: QLineEdit(parent)
|
||||||
@ -37,7 +37,7 @@ LineEdit::LineEdit(QWidget* parent)
|
|||||||
if (icon.isNull()) {
|
if (icon.isNull()) {
|
||||||
icon = QIcon::fromTheme("edit-clear");
|
icon = QIcon::fromTheme("edit-clear");
|
||||||
if (icon.isNull()) {
|
if (icon.isNull()) {
|
||||||
icon = dataPath()->icon("actions", iconNameDirected, false);
|
icon = filePath()->icon("actions", iconNameDirected, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "autotype/AutoType.h"
|
#include "autotype/AutoType.h"
|
||||||
#include "core/Config.h"
|
#include "core/Config.h"
|
||||||
#include "core/Database.h"
|
#include "core/Database.h"
|
||||||
#include "core/DataPath.h"
|
#include "core/FilePath.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "gui/AboutDialog.h"
|
#include "gui/AboutDialog.h"
|
||||||
#include "gui/DatabaseWidget.h"
|
#include "gui/DatabaseWidget.h"
|
||||||
@ -34,7 +34,7 @@ MainWindow::MainWindow()
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
setWindowIcon(dataPath()->applicationIcon());
|
setWindowIcon(filePath()->applicationIcon());
|
||||||
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();
|
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();
|
||||||
toggleViewAction->setText(tr("Show toolbar"));
|
toggleViewAction->setText(tr("Show toolbar"));
|
||||||
m_ui->menuView->addAction(toggleViewAction);
|
m_ui->menuView->addAction(toggleViewAction);
|
||||||
@ -56,29 +56,29 @@ MainWindow::MainWindow()
|
|||||||
m_ui->actionEntryCopyPassword->setShortcut(Qt::CTRL + Qt::Key_C);
|
m_ui->actionEntryCopyPassword->setShortcut(Qt::CTRL + Qt::Key_C);
|
||||||
setShortcut(m_ui->actionEntryAutoType, QKeySequence::Paste, Qt::CTRL + Qt::Key_V);
|
setShortcut(m_ui->actionEntryAutoType, QKeySequence::Paste, Qt::CTRL + Qt::Key_V);
|
||||||
|
|
||||||
m_ui->actionDatabaseNew->setIcon(dataPath()->icon("actions", "document-new"));
|
m_ui->actionDatabaseNew->setIcon(filePath()->icon("actions", "document-new"));
|
||||||
m_ui->actionDatabaseOpen->setIcon(dataPath()->icon("actions", "document-open"));
|
m_ui->actionDatabaseOpen->setIcon(filePath()->icon("actions", "document-open"));
|
||||||
m_ui->actionDatabaseSave->setIcon(dataPath()->icon("actions", "document-save"));
|
m_ui->actionDatabaseSave->setIcon(filePath()->icon("actions", "document-save"));
|
||||||
m_ui->actionDatabaseSaveAs->setIcon(dataPath()->icon("actions", "document-save-as"));
|
m_ui->actionDatabaseSaveAs->setIcon(filePath()->icon("actions", "document-save-as"));
|
||||||
m_ui->actionDatabaseClose->setIcon(dataPath()->icon("actions", "document-close"));
|
m_ui->actionDatabaseClose->setIcon(filePath()->icon("actions", "document-close"));
|
||||||
m_ui->actionChangeDatabaseSettings->setIcon(dataPath()->icon("actions", "document-edit"));
|
m_ui->actionChangeDatabaseSettings->setIcon(filePath()->icon("actions", "document-edit"));
|
||||||
m_ui->actionChangeMasterKey->setIcon(dataPath()->icon("actions", "database-change-key", false));
|
m_ui->actionChangeMasterKey->setIcon(filePath()->icon("actions", "database-change-key", false));
|
||||||
m_ui->actionQuit->setIcon(dataPath()->icon("actions", "application-exit"));
|
m_ui->actionQuit->setIcon(filePath()->icon("actions", "application-exit"));
|
||||||
|
|
||||||
m_ui->actionEntryNew->setIcon(dataPath()->icon("actions", "entry-new", false));
|
m_ui->actionEntryNew->setIcon(filePath()->icon("actions", "entry-new", false));
|
||||||
m_ui->actionEntryClone->setIcon(dataPath()->icon("actions", "entry-clone", false));
|
m_ui->actionEntryClone->setIcon(filePath()->icon("actions", "entry-clone", false));
|
||||||
m_ui->actionEntryEdit->setIcon(dataPath()->icon("actions", "entry-edit", false));
|
m_ui->actionEntryEdit->setIcon(filePath()->icon("actions", "entry-edit", false));
|
||||||
m_ui->actionEntryDelete->setIcon(dataPath()->icon("actions", "entry-delete", false));
|
m_ui->actionEntryDelete->setIcon(filePath()->icon("actions", "entry-delete", false));
|
||||||
|
|
||||||
m_ui->actionGroupNew->setIcon(dataPath()->icon("actions", "group-new", false));
|
m_ui->actionGroupNew->setIcon(filePath()->icon("actions", "group-new", false));
|
||||||
m_ui->actionGroupEdit->setIcon(dataPath()->icon("actions", "group-edit", false));
|
m_ui->actionGroupEdit->setIcon(filePath()->icon("actions", "group-edit", false));
|
||||||
m_ui->actionGroupDelete->setIcon(dataPath()->icon("actions", "group-delete", false));
|
m_ui->actionGroupDelete->setIcon(filePath()->icon("actions", "group-delete", false));
|
||||||
|
|
||||||
m_ui->actionSettings->setIcon(dataPath()->icon("actions", "configure"));
|
m_ui->actionSettings->setIcon(filePath()->icon("actions", "configure"));
|
||||||
|
|
||||||
m_ui->actionAbout->setIcon(dataPath()->icon("actions", "help-about"));
|
m_ui->actionAbout->setIcon(filePath()->icon("actions", "help-about"));
|
||||||
|
|
||||||
m_ui->actionSearch->setIcon(dataPath()->icon("actions", "system-search"));
|
m_ui->actionSearch->setIcon(filePath()->icon("actions", "system-search"));
|
||||||
|
|
||||||
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)),
|
connect(m_ui->tabWidget, SIGNAL(entrySelectionChanged(bool)),
|
||||||
SLOT(setMenuActionState()));
|
SLOT(setMenuActionState()));
|
||||||
|
Loading…
Reference in New Issue
Block a user