mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Make C++11 mandatory.
This commit is contained in:
parent
0e85c98d02
commit
7fa0eddc5f
@ -32,7 +32,6 @@ include(CheckCXXSourceCompiles)
|
|||||||
option(WITH_TESTS "Enable building of unit tests" ON)
|
option(WITH_TESTS "Enable building of unit tests" ON)
|
||||||
option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
|
option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
|
||||||
option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF)
|
option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF)
|
||||||
option(WITH_CXX11 "Build with the C++ 11 standard" ON)
|
|
||||||
|
|
||||||
set(KEEPASSX_VERSION "2.0 beta 2")
|
set(KEEPASSX_VERSION "2.0 beta 2")
|
||||||
set(KEEPASSX_VERSION_NUM "1.9.92")
|
set(KEEPASSX_VERSION_NUM "1.9.92")
|
||||||
@ -115,16 +114,24 @@ if(WITH_LTO)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WITH_CXX11)
|
check_cxx_compiler_flag("-std=c++11" CXX11_AVAILABLE)
|
||||||
add_gcc_compiler_cxxflags("-std=c++0x")
|
if (CXX11_AVAILABLE)
|
||||||
add_gcc_compiler_cflags("-ansi")
|
add_gcc_compiler_cxxflags("-std=c++11")
|
||||||
if(APPLE)
|
|
||||||
add_gcc_compiler_cxxflags("-stdlib=libc++")
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
add_gcc_compiler_flags("-ansi")
|
check_cxx_compiler_flag("-std=c++0x" CXX0X_AVAILABLE)
|
||||||
|
if(CXX0X_AVAILABLE)
|
||||||
|
add_gcc_compiler_cxxflags("-std=c++0x")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Compiler doesn't support C++11")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
add_gcc_compiler_cxxflags("-stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_gcc_compiler_cflags("-ansi")
|
||||||
|
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(CMAKE_RC_COMPILER_INIT windres)
|
set(CMAKE_RC_COMPILER_INIT windres)
|
||||||
enable_language(RC)
|
enable_language(RC)
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
#include "gui/MessageBox.h"
|
#include "gui/MessageBox.h"
|
||||||
|
|
||||||
AutoType* AutoType::m_instance = Q_NULLPTR;
|
AutoType* AutoType::m_instance = nullptr;
|
||||||
|
|
||||||
AutoType::AutoType(QObject* parent, bool test)
|
AutoType::AutoType(QObject* parent, bool test)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
@ -40,8 +40,8 @@ AutoType::AutoType(QObject* parent, bool test)
|
|||||||
, m_currentGlobalKey(static_cast<Qt::Key>(0))
|
, m_currentGlobalKey(static_cast<Qt::Key>(0))
|
||||||
, m_currentGlobalModifiers(0)
|
, m_currentGlobalModifiers(0)
|
||||||
, m_pluginLoader(new QPluginLoader(this))
|
, m_pluginLoader(new QPluginLoader(this))
|
||||||
, m_plugin(Q_NULLPTR)
|
, m_plugin(nullptr)
|
||||||
, m_executor(Q_NULLPTR)
|
, m_executor(nullptr)
|
||||||
, m_windowFromGlobal(0)
|
, m_windowFromGlobal(0)
|
||||||
{
|
{
|
||||||
// prevent crash when the plugin has unresolved symbols
|
// prevent crash when the plugin has unresolved symbols
|
||||||
@ -68,7 +68,7 @@ AutoType::~AutoType()
|
|||||||
{
|
{
|
||||||
if (m_executor) {
|
if (m_executor) {
|
||||||
delete m_executor;
|
delete m_executor;
|
||||||
m_executor = Q_NULLPTR;
|
m_executor = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,11 +195,11 @@ void AutoType::performGlobalAutoType(const QList<Database*>& dbList)
|
|||||||
QString message = tr("Couldn't find an entry that matches the window title:");
|
QString message = tr("Couldn't find an entry that matches the window title:");
|
||||||
message.append("\n\n");
|
message.append("\n\n");
|
||||||
message.append(windowTitle);
|
message.append(windowTitle);
|
||||||
MessageBox::information(Q_NULLPTR, tr("Auto-Type - KeePassX"), message);
|
MessageBox::information(nullptr, tr("Auto-Type - KeePassX"), message);
|
||||||
}
|
}
|
||||||
else if ((entryList.size() == 1) && !config()->get("security/autotypeask").toBool()) {
|
else if ((entryList.size() == 1) && !config()->get("security/autotypeask").toBool()) {
|
||||||
m_inAutoType = false;
|
m_inAutoType = false;
|
||||||
performAutoType(entryList.first(), Q_NULLPTR, sequenceHash[entryList.first()]);
|
performAutoType(entryList.first(), nullptr, sequenceHash[entryList.first()]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_windowFromGlobal = m_plugin->activeWindow();
|
m_windowFromGlobal = m_plugin->activeWindow();
|
||||||
@ -219,7 +219,7 @@ void AutoType::performAutoTypeFromGlobal(Entry* entry, const QString& sequence)
|
|||||||
Q_ASSERT(m_inAutoType);
|
Q_ASSERT(m_inAutoType);
|
||||||
|
|
||||||
m_inAutoType = false;
|
m_inAutoType = false;
|
||||||
performAutoType(entry, Q_NULLPTR, sequence, m_windowFromGlobal);
|
performAutoType(entry, nullptr, sequence, m_windowFromGlobal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoType::resetInAutoType()
|
void AutoType::resetInAutoType()
|
||||||
@ -233,12 +233,12 @@ void AutoType::unloadPlugin()
|
|||||||
{
|
{
|
||||||
if (m_executor) {
|
if (m_executor) {
|
||||||
delete m_executor;
|
delete m_executor;
|
||||||
m_executor = Q_NULLPTR;
|
m_executor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_plugin) {
|
if (m_plugin) {
|
||||||
m_plugin->unload();
|
m_plugin->unload();
|
||||||
m_plugin = Q_NULLPTR;
|
m_plugin = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class AutoTypeAction;
|
class AutoTypeAction;
|
||||||
class AutoTypeExecutor;
|
class AutoTypeExecutor;
|
||||||
class AutoTypePlatformInterface;
|
class AutoTypePlatformInterface;
|
||||||
@ -37,7 +35,7 @@ class AutoType : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QStringList windowTitles();
|
QStringList windowTitles();
|
||||||
void performAutoType(const Entry* entry, QWidget* hideWindow = Q_NULLPTR,
|
void performAutoType(const Entry* entry, QWidget* hideWindow = nullptr,
|
||||||
const QString& customSequence = QString(), WId window = 0);
|
const QString& customSequence = QString(), WId window = 0);
|
||||||
bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
||||||
void unregisterGlobalShortcut();
|
void unregisterGlobalShortcut();
|
||||||
@ -62,7 +60,7 @@ private Q_SLOTS:
|
|||||||
void unloadPlugin();
|
void unloadPlugin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit AutoType(QObject* parent = Q_NULLPTR, bool test = false);
|
explicit AutoType(QObject* parent = nullptr, bool test = false);
|
||||||
~AutoType();
|
~AutoType();
|
||||||
void loadPlugin(const QString& pluginPath);
|
void loadPlugin(const QString& pluginPath);
|
||||||
bool parseActions(const QString& sequence, const Entry* entry, QList<AutoTypeAction*>& actions);
|
bool parseActions(const QString& sequence, const Entry* entry, QList<AutoTypeAction*>& actions);
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class AutoTypeSelectView;
|
class AutoTypeSelectView;
|
||||||
class Entry;
|
class Entry;
|
||||||
|
|
||||||
@ -32,7 +30,7 @@ class AutoTypeSelectDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoTypeSelectDialog(QWidget* parent = Q_NULLPTR);
|
explicit AutoTypeSelectDialog(QWidget* parent = nullptr);
|
||||||
void setEntries(const QList<Entry*>& entries, const QHash<Entry*, QString>& sequences);
|
void setEntries(const QList<Entry*>& entries, const QHash<Entry*, QString>& sequences);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#ifndef KEEPASSX_AUTOTYPESELECTVIEW_H
|
#ifndef KEEPASSX_AUTOTYPESELECTVIEW_H
|
||||||
#define KEEPASSX_AUTOTYPESELECTVIEW_H
|
#define KEEPASSX_AUTOTYPESELECTVIEW_H
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "gui/entry/EntryView.h"
|
#include "gui/entry/EntryView.h"
|
||||||
|
|
||||||
class Entry;
|
class Entry;
|
||||||
@ -28,10 +27,10 @@ class AutoTypeSelectView : public EntryView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoTypeSelectView(QWidget* parent = Q_NULLPTR);
|
explicit AutoTypeSelectView(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
void mouseMoveEvent(QMouseEvent* event) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void selectFirstEntry();
|
void selectFirstEntry();
|
||||||
|
@ -20,21 +20,19 @@
|
|||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class ShortcutWidget : public QLineEdit
|
class ShortcutWidget : public QLineEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ShortcutWidget(QWidget* parent = Q_NULLPTR);
|
explicit ShortcutWidget(QWidget* parent = nullptr);
|
||||||
Qt::Key key() const;
|
Qt::Key key() const;
|
||||||
Qt::KeyboardModifiers modifiers() const;
|
Qt::KeyboardModifiers modifiers() const;
|
||||||
void setShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
void setShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
void keyReleaseEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
|
void keyReleaseEvent(QKeyEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void keyEvent(QKeyEvent* event);
|
void keyEvent(QKeyEvent* event);
|
||||||
|
@ -20,19 +20,17 @@
|
|||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class WindowSelectComboBox : public QComboBox
|
class WindowSelectComboBox : public QComboBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WindowSelectComboBox(QWidget* parent = Q_NULLPTR);
|
explicit WindowSelectComboBox(QWidget* parent = nullptr);
|
||||||
void refreshWindowList();
|
void refreshWindowList();
|
||||||
|
|
||||||
void showPopup() Q_DECL_OVERRIDE;
|
void showPopup() override;
|
||||||
QSize sizeHint() const Q_DECL_OVERRIDE;
|
QSize sizeHint() const override;
|
||||||
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
QSize minimumSizeHint() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_WINDOWSELECTCOMBOBOX_H
|
#endif // KEEPASSX_WINDOWSELECTCOMBOBOX_H
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "autotype/AutoTypePlatformPlugin.h"
|
#include "autotype/AutoTypePlatformPlugin.h"
|
||||||
#include "autotype/AutoTypeAction.h"
|
#include "autotype/AutoTypeAction.h"
|
||||||
#include "autotype/test/AutoTypeTestInterface.h"
|
#include "autotype/test/AutoTypeTestInterface.h"
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class AutoTypePlatformTest : public QObject,
|
class AutoTypePlatformTest : public QObject,
|
||||||
public AutoTypePlatformInterface,
|
public AutoTypePlatformInterface,
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
bool AutoTypePlatformX11::m_catchXErrors = false;
|
bool AutoTypePlatformX11::m_catchXErrors = false;
|
||||||
bool AutoTypePlatformX11::m_xErrorOccured = false;
|
bool AutoTypePlatformX11::m_xErrorOccured = false;
|
||||||
int (*AutoTypePlatformX11::m_oldXErrorHandler)(Display*, XErrorEvent*) = Q_NULLPTR;
|
int (*AutoTypePlatformX11::m_oldXErrorHandler)(Display*, XErrorEvent*) = nullptr;
|
||||||
|
|
||||||
AutoTypePlatformX11::AutoTypePlatformX11()
|
AutoTypePlatformX11::AutoTypePlatformX11()
|
||||||
{
|
{
|
||||||
@ -46,8 +46,8 @@ AutoTypePlatformX11::AutoTypePlatformX11()
|
|||||||
m_currentGlobalKey = static_cast<Qt::Key>(0);
|
m_currentGlobalKey = static_cast<Qt::Key>(0);
|
||||||
m_currentGlobalModifiers = 0;
|
m_currentGlobalModifiers = 0;
|
||||||
|
|
||||||
m_keysymTable = Q_NULLPTR;
|
m_keysymTable = nullptr;
|
||||||
m_xkb = Q_NULLPTR;
|
m_xkb = nullptr;
|
||||||
m_remapKeycode = 0;
|
m_remapKeycode = 0;
|
||||||
m_currentRemapKeysym = NoSymbol;
|
m_currentRemapKeysym = NoSymbol;
|
||||||
m_modifierMask = ControlMask | ShiftMask | Mod1Mask | Mod4Mask;
|
m_modifierMask = ControlMask | ShiftMask | Mod1Mask | Mod4Mask;
|
||||||
@ -94,7 +94,7 @@ WId AutoTypePlatformX11::activeWindow()
|
|||||||
|
|
||||||
Window root;
|
Window root;
|
||||||
Window parent;
|
Window parent;
|
||||||
Window* children = Q_NULLPTR;
|
Window* children = nullptr;
|
||||||
unsigned int numChildren;
|
unsigned int numChildren;
|
||||||
tree = XQueryTree(m_dpy, window, &root, &parent, &children, &numChildren);
|
tree = XQueryTree(m_dpy, window, &root, &parent, &children, &numChildren);
|
||||||
window = parent;
|
window = parent;
|
||||||
@ -231,7 +231,7 @@ QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist)
|
|||||||
int format;
|
int format;
|
||||||
unsigned long nitems;
|
unsigned long nitems;
|
||||||
unsigned long after;
|
unsigned long after;
|
||||||
unsigned char* data = Q_NULLPTR;
|
unsigned char* data = nullptr;
|
||||||
|
|
||||||
// the window manager spec says we should read _NET_WM_NAME first, then fall back to WM_NAME
|
// the window manager spec says we should read _NET_WM_NAME first, then fall back to WM_NAME
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist)
|
|||||||
XTextProperty textProp;
|
XTextProperty textProp;
|
||||||
retVal = XGetTextProperty(m_dpy, window, &textProp, m_atomWmName);
|
retVal = XGetTextProperty(m_dpy, window, &textProp, m_atomWmName);
|
||||||
if ((retVal != 0) && textProp.value) {
|
if ((retVal != 0) && textProp.value) {
|
||||||
char** textList = Q_NULLPTR;
|
char** textList = nullptr;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (textProp.encoding == m_atomUtf8String) {
|
if (textProp.encoding == m_atomUtf8String) {
|
||||||
@ -297,8 +297,8 @@ QString AutoTypePlatformX11::windowClassName(Window window)
|
|||||||
QString className;
|
QString className;
|
||||||
|
|
||||||
XClassHint wmClass;
|
XClassHint wmClass;
|
||||||
wmClass.res_name = Q_NULLPTR;
|
wmClass.res_name = nullptr;
|
||||||
wmClass.res_class = Q_NULLPTR;
|
wmClass.res_class = nullptr;
|
||||||
|
|
||||||
if (XGetClassHint(m_dpy, window, &wmClass) && wmClass.res_name) {
|
if (XGetClassHint(m_dpy, window, &wmClass) && wmClass.res_name) {
|
||||||
className = QString::fromLocal8Bit(wmClass.res_name);
|
className = QString::fromLocal8Bit(wmClass.res_name);
|
||||||
@ -337,7 +337,7 @@ QStringList AutoTypePlatformX11::windowTitlesRecursive(Window window)
|
|||||||
|
|
||||||
Window root;
|
Window root;
|
||||||
Window parent;
|
Window parent;
|
||||||
Window* children = Q_NULLPTR;
|
Window* children = nullptr;
|
||||||
unsigned int numChildren;
|
unsigned int numChildren;
|
||||||
if (XQueryTree(m_dpy, window, &root, &parent, &children, &numChildren) && children) {
|
if (XQueryTree(m_dpy, window, &root, &parent, &children, &numChildren) && children) {
|
||||||
for (uint i = 0; i < numChildren; i++) {
|
for (uint i = 0; i < numChildren; i++) {
|
||||||
@ -357,7 +357,7 @@ bool AutoTypePlatformX11::isTopLevelWindow(Window window)
|
|||||||
int format;
|
int format;
|
||||||
unsigned long nitems;
|
unsigned long nitems;
|
||||||
unsigned long after;
|
unsigned long after;
|
||||||
unsigned char* data = Q_NULLPTR;
|
unsigned char* data = nullptr;
|
||||||
int retVal = XGetWindowProperty(m_dpy, window, m_atomWmState, 0, 0, false, AnyPropertyType, &type, &format,
|
int retVal = XGetWindowProperty(m_dpy, window, m_atomWmState, 0, 0, false, AnyPropertyType, &type, &format,
|
||||||
&nitems, &after, &data);
|
&nitems, &after, &data);
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -512,7 +512,7 @@ void AutoTypePlatformX11::updateKeymap()
|
|||||||
timespec ts;
|
timespec ts;
|
||||||
ts.tv_sec = 0;
|
ts.tv_sec = 0;
|
||||||
ts.tv_nsec = 30 * 1000 * 1000;
|
ts.tv_nsec = 30 * 1000 * 1000;
|
||||||
nanosleep(&ts, Q_NULLPTR);
|
nanosleep(&ts, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoTypePlatformX11::isRemapKeycodeValid()
|
bool AutoTypePlatformX11::isRemapKeycodeValid()
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include "autotype/AutoTypePlatformPlugin.h"
|
#include "autotype/AutoTypePlatformPlugin.h"
|
||||||
#include "autotype/AutoTypeAction.h"
|
#include "autotype/AutoTypeAction.h"
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
#define N_MOD_INDICES (Mod5MapIndex + 1)
|
#define N_MOD_INDICES (Mod5MapIndex + 1)
|
||||||
|
|
||||||
@ -43,7 +42,7 @@ class AutoTypePlatformX11 : public QObject, public AutoTypePlatformInterface
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AutoTypePlatformX11();
|
AutoTypePlatformX11();
|
||||||
void unload() Q_DECL_OVERRIDE;
|
void unload() override;
|
||||||
QStringList windowTitles();
|
QStringList windowTitles();
|
||||||
WId activeWindow();
|
WId activeWindow();
|
||||||
QString activeWindowTitle();
|
QString activeWindowTitle();
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class AutoTypeAssociations : public QObject
|
class AutoTypeAssociations : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -36,7 +34,7 @@ public:
|
|||||||
bool operator!=(const AutoTypeAssociations::Association& other) const;
|
bool operator!=(const AutoTypeAssociations::Association& other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit AutoTypeAssociations(QObject* parent = Q_NULLPTR);
|
explicit AutoTypeAssociations(QObject* parent = nullptr);
|
||||||
void copyDataFrom(const AutoTypeAssociations* other);
|
void copyDataFrom(const AutoTypeAssociations* other);
|
||||||
void add(const AutoTypeAssociations::Association& association);
|
void add(const AutoTypeAssociations::Association& association);
|
||||||
void remove(int index);
|
void remove(int index);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
Config* Config::m_instance(Q_NULLPTR);
|
Config* Config::m_instance(nullptr);
|
||||||
|
|
||||||
QVariant Config::get(const QString& key)
|
QVariant Config::get(const QString& key)
|
||||||
{
|
{
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
|
|
||||||
class Config : public QObject
|
class Config : public QObject
|
||||||
|
@ -104,7 +104,7 @@ Entry* Database::recFindEntry(const Uuid& uuid, Group* group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* Database::resolveGroup(const Uuid& uuid)
|
Group* Database::resolveGroup(const Uuid& uuid)
|
||||||
@ -125,7 +125,7 @@ Group* Database::recFindGroup(const Uuid& uuid, Group* group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<DeletedObject> Database::deletedObjects()
|
QList<DeletedObject> Database::deletedObjects()
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "core/FilePath.h"
|
#include "core/FilePath.h"
|
||||||
|
|
||||||
DatabaseIcons* DatabaseIcons::m_instance(Q_NULLPTR);
|
DatabaseIcons* DatabaseIcons::m_instance(nullptr);
|
||||||
const int DatabaseIcons::IconCount(69);
|
const int DatabaseIcons::IconCount(69);
|
||||||
const int DatabaseIcons::ExpiredIconIndex(45);
|
const int DatabaseIcons::ExpiredIconIndex(45);
|
||||||
const char* const DatabaseIcons::m_indexToName[] = {
|
const char* const DatabaseIcons::m_indexToName[] = {
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class DatabaseIcons
|
class DatabaseIcons
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -28,7 +28,7 @@ Entry::Entry()
|
|||||||
: m_attributes(new EntryAttributes(this))
|
: m_attributes(new EntryAttributes(this))
|
||||||
, m_attachments(new EntryAttachments(this))
|
, m_attachments(new EntryAttachments(this))
|
||||||
, m_autoTypeAssociations(new AutoTypeAssociations(this))
|
, m_autoTypeAssociations(new AutoTypeAssociations(this))
|
||||||
, m_tmpHistoryItem(Q_NULLPTR)
|
, m_tmpHistoryItem(nullptr)
|
||||||
, m_modifiedSinceBegin(false)
|
, m_modifiedSinceBegin(false)
|
||||||
, m_updateTimeinfo(true)
|
, m_updateTimeinfo(true)
|
||||||
{
|
{
|
||||||
@ -513,7 +513,7 @@ void Entry::endUpdate()
|
|||||||
delete m_tmpHistoryItem;
|
delete m_tmpHistoryItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_tmpHistoryItem = Q_NULLPTR;
|
m_tmpHistoryItem = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::updateModifiedSinceBegin()
|
void Entry::updateModifiedSinceBegin()
|
||||||
@ -574,7 +574,7 @@ const Database* Entry::database() const
|
|||||||
return m_group->database();
|
return m_group->database();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "core/AutoTypeAssociations.h"
|
#include "core/AutoTypeAssociations.h"
|
||||||
#include "core/EntryAttachments.h"
|
#include "core/EntryAttachments.h"
|
||||||
#include "core/EntryAttributes.h"
|
#include "core/EntryAttributes.h"
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/TimeInfo.h"
|
#include "core/TimeInfo.h"
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
|
@ -21,14 +21,12 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class EntryAttachments : public QObject
|
class EntryAttachments : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryAttachments(QObject* parent = Q_NULLPTR);
|
explicit EntryAttachments(QObject* parent = nullptr);
|
||||||
QList<QString> keys() const;
|
QList<QString> keys() const;
|
||||||
bool hasKey(const QString& key) const;
|
bool hasKey(const QString& key) const;
|
||||||
QList<QByteArray> values() const;
|
QList<QByteArray> values() const;
|
||||||
|
@ -23,14 +23,12 @@
|
|||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class EntryAttributes : public QObject
|
class EntryAttributes : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryAttributes(QObject* parent = Q_NULLPTR);
|
explicit EntryAttributes(QObject* parent = nullptr);
|
||||||
QList<QString> keys() const;
|
QList<QString> keys() const;
|
||||||
bool hasKey(const QString& key) const;
|
bool hasKey(const QString& key) const;
|
||||||
QList<QString> customKeys();
|
QList<QString> customKeys();
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "config-keepassx.h"
|
#include "config-keepassx.h"
|
||||||
|
|
||||||
FilePath* FilePath::m_instance(Q_NULLPTR);
|
FilePath* FilePath::m_instance(nullptr);
|
||||||
|
|
||||||
QString FilePath::dataPath(const QString& name)
|
QString FilePath::dataPath(const QString& name)
|
||||||
{
|
{
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class FilePath
|
class FilePath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -371,7 +371,7 @@ void Group::setParent(Database* db)
|
|||||||
|
|
||||||
cleanupParent();
|
cleanupParent();
|
||||||
|
|
||||||
m_parent = Q_NULLPTR;
|
m_parent = nullptr;
|
||||||
recSetDatabase(db);
|
recSetDatabase(db);
|
||||||
|
|
||||||
QObject::setParent(db);
|
QObject::setParent(db);
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
class InactivityTimer : public QObject
|
class InactivityTimer : public QObject
|
||||||
@ -30,7 +28,7 @@ class InactivityTimer : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit InactivityTimer(QObject* parent = Q_NULLPTR);
|
explicit InactivityTimer(QObject* parent = nullptr);
|
||||||
void setInactivityTimeout(int inactivityTimeout);
|
void setInactivityTimeout(int inactivityTimeout);
|
||||||
void activate();
|
void activate();
|
||||||
void deactivate();
|
void deactivate();
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
@ -35,7 +34,7 @@ class Metadata : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Metadata(QObject* parent = Q_NULLPTR);
|
explicit Metadata(QObject* parent = nullptr);
|
||||||
|
|
||||||
struct MetadataData
|
struct MetadataData
|
||||||
{
|
{
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
typedef QVector<QChar> PasswordGroup;
|
typedef QVector<QChar> PasswordGroup;
|
||||||
|
|
||||||
class PasswordGenerator
|
class PasswordGenerator
|
||||||
|
@ -24,7 +24,7 @@ SignalMultiplexer::SignalMultiplexer()
|
|||||||
SignalMultiplexer::~SignalMultiplexer()
|
SignalMultiplexer::~SignalMultiplexer()
|
||||||
{
|
{
|
||||||
// disconnect all connections
|
// disconnect all connections
|
||||||
setCurrentObject(Q_NULLPTR);
|
setCurrentObject(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject* SignalMultiplexer::currentObject() const
|
QObject* SignalMultiplexer::currentObject() const
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class SignalMultiplexer
|
class SignalMultiplexer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -161,7 +161,7 @@ void sleep(int ms)
|
|||||||
timespec ts;
|
timespec ts;
|
||||||
ts.tv_sec = ms / 1000;
|
ts.tv_sec = ms / 1000;
|
||||||
ts.tv_nsec = (ms % 1000) * 1000 * 1000;
|
ts.tv_nsec = (ms % 1000) * 1000 * 1000;
|
||||||
nanosleep(&ts, Q_NULLPTR);
|
nanosleep(&ts, nullptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
|
|
||||||
namespace Tools {
|
namespace Tools {
|
||||||
|
@ -74,18 +74,18 @@ bool Crypto::backendSelfTest()
|
|||||||
|
|
||||||
bool Crypto::checkAlgorithms()
|
bool Crypto::checkAlgorithms()
|
||||||
{
|
{
|
||||||
if (gcry_cipher_algo_info(GCRY_CIPHER_AES256, GCRYCTL_TEST_ALGO, Q_NULLPTR, Q_NULLPTR) != 0) {
|
if (gcry_cipher_algo_info(GCRY_CIPHER_AES256, GCRYCTL_TEST_ALGO, nullptr, nullptr) != 0) {
|
||||||
m_errorStr = "GCRY_CIPHER_AES256 not found.";
|
m_errorStr = "GCRY_CIPHER_AES256 not found.";
|
||||||
qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr));
|
qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (gcry_cipher_algo_info(GCRY_CIPHER_TWOFISH, GCRYCTL_TEST_ALGO, Q_NULLPTR, Q_NULLPTR) != 0) {
|
if (gcry_cipher_algo_info(GCRY_CIPHER_TWOFISH, GCRYCTL_TEST_ALGO, nullptr, nullptr) != 0) {
|
||||||
m_errorStr = "GCRY_CIPHER_TWOFISH not found.";
|
m_errorStr = "GCRY_CIPHER_TWOFISH not found.";
|
||||||
qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr));
|
qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef GCRYPT_HAS_SALSA20
|
#ifdef GCRYPT_HAS_SALSA20
|
||||||
if (gcry_cipher_algo_info(GCRY_CIPHER_SALSA20, GCRYCTL_TEST_ALGO, Q_NULLPTR, Q_NULLPTR) != 0) {
|
if (gcry_cipher_algo_info(GCRY_CIPHER_SALSA20, GCRYCTL_TEST_ALGO, nullptr, nullptr) != 0) {
|
||||||
m_errorStr = "GCRY_CIPHER_SALSA20 not found.";
|
m_errorStr = "GCRY_CIPHER_SALSA20 not found.";
|
||||||
qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr));
|
qWarning("Crypto::checkAlgorithms: %s", qPrintable(m_errorStr));
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class Crypto
|
class Crypto
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -19,15 +19,16 @@
|
|||||||
|
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
|
||||||
|
#include "core/Global.h"
|
||||||
#include "crypto/Crypto.h"
|
#include "crypto/Crypto.h"
|
||||||
|
|
||||||
class RandomBackendGcrypt : public RandomBackend
|
class RandomBackendGcrypt : public RandomBackend
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void randomize(void* data, int len) Q_DECL_OVERRIDE;
|
void randomize(void* data, int len) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
Random* Random::m_instance(Q_NULLPTR);
|
Random* Random::m_instance(nullptr);
|
||||||
|
|
||||||
void Random::randomize(QByteArray& ba)
|
void Random::randomize(QByteArray& ba)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ SymmetricCipherBackend* SymmetricCipher::createBackend(SymmetricCipher::Algorith
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "crypto/SymmetricCipherBackend.h"
|
#include "crypto/SymmetricCipherBackend.h"
|
||||||
|
|
||||||
class SymmetricCipher
|
class SymmetricCipher
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
SymmetricCipherGcrypt::SymmetricCipherGcrypt(SymmetricCipher::Algorithm algo, SymmetricCipher::Mode mode,
|
SymmetricCipherGcrypt::SymmetricCipherGcrypt(SymmetricCipher::Algorithm algo, SymmetricCipher::Mode mode,
|
||||||
SymmetricCipher::Direction direction)
|
SymmetricCipher::Direction direction)
|
||||||
: m_ctx(Q_NULLPTR)
|
: m_ctx(nullptr)
|
||||||
, m_algo(gcryptAlgo(algo))
|
, m_algo(gcryptAlgo(algo))
|
||||||
, m_mode(gcryptMode(mode))
|
, m_mode(gcryptMode(mode))
|
||||||
, m_direction(direction)
|
, m_direction(direction)
|
||||||
@ -93,7 +93,7 @@ bool SymmetricCipherGcrypt::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t blockSizeT;
|
size_t blockSizeT;
|
||||||
error = gcry_cipher_algo_info(m_algo, GCRYCTL_GET_BLKLEN, Q_NULLPTR, &blockSizeT);
|
error = gcry_cipher_algo_info(m_algo, GCRYCTL_GET_BLKLEN, nullptr, &blockSizeT);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
setErrorString(error);
|
setErrorString(error);
|
||||||
return false;
|
return false;
|
||||||
@ -161,10 +161,10 @@ bool SymmetricCipherGcrypt::processInPlace(QByteArray& data)
|
|||||||
gcry_error_t error;
|
gcry_error_t error;
|
||||||
|
|
||||||
if (m_direction == SymmetricCipher::Decrypt) {
|
if (m_direction == SymmetricCipher::Decrypt) {
|
||||||
error = gcry_cipher_decrypt(m_ctx, data.data(), data.size(), Q_NULLPTR, 0);
|
error = gcry_cipher_decrypt(m_ctx, data.data(), data.size(), nullptr, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error = gcry_cipher_encrypt(m_ctx, data.data(), data.size(), Q_NULLPTR, 0);
|
error = gcry_cipher_encrypt(m_ctx, data.data(), data.size(), nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
@ -186,7 +186,7 @@ bool SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds)
|
|||||||
|
|
||||||
if (m_direction == SymmetricCipher::Decrypt) {
|
if (m_direction == SymmetricCipher::Decrypt) {
|
||||||
for (quint64 i = 0; i != rounds; ++i) {
|
for (quint64 i = 0; i != rounds; ++i) {
|
||||||
error = gcry_cipher_decrypt(m_ctx, rawData, size, Q_NULLPTR, 0);
|
error = gcry_cipher_decrypt(m_ctx, rawData, size, nullptr, 0);
|
||||||
|
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
setErrorString(error);
|
setErrorString(error);
|
||||||
@ -196,7 +196,7 @@ bool SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (quint64 i = 0; i != rounds; ++i) {
|
for (quint64 i = 0; i != rounds; ++i) {
|
||||||
error = gcry_cipher_encrypt(m_ctx, rawData, size, Q_NULLPTR, 0);
|
error = gcry_cipher_encrypt(m_ctx, rawData, size, nullptr, 0);
|
||||||
|
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
setErrorString(error);
|
setErrorString(error);
|
||||||
|
@ -49,9 +49,9 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
KeePass1Reader::KeePass1Reader()
|
KeePass1Reader::KeePass1Reader()
|
||||||
: m_db(Q_NULLPTR)
|
: m_db(nullptr)
|
||||||
, m_tmpParent(Q_NULLPTR)
|
, m_tmpParent(nullptr)
|
||||||
, m_device(Q_NULLPTR)
|
, m_device(nullptr)
|
||||||
, m_encryptionFlags(0)
|
, m_encryptionFlags(0)
|
||||||
, m_transformRounds(0)
|
, m_transformRounds(0)
|
||||||
, m_error(false)
|
, m_error(false)
|
||||||
@ -72,16 +72,16 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
|||||||
|
|
||||||
if (keyfileData.isEmpty()) {
|
if (keyfileData.isEmpty()) {
|
||||||
raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString()));
|
raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString()));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!keyfileDevice->seek(0)) {
|
if (!keyfileDevice->seek(0)) {
|
||||||
raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString()));
|
raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString()));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newFileKey.load(keyfileDevice)) {
|
if (!newFileKey.load(keyfileDevice)) {
|
||||||
raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString()));
|
raiseError(tr("Unable to read keyfile.").append("\n").append(keyfileDevice->errorString()));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,72 +96,72 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
|||||||
quint32 signature1 = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
quint32 signature1 = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok || signature1 != KeePass1::SIGNATURE_1) {
|
if (!ok || signature1 != KeePass1::SIGNATURE_1) {
|
||||||
raiseError(tr("Not a KeePass database."));
|
raiseError(tr("Not a KeePass database."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 signature2 = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
quint32 signature2 = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok || signature2 != KeePass1::SIGNATURE_2) {
|
if (!ok || signature2 != KeePass1::SIGNATURE_2) {
|
||||||
raiseError(tr("Not a KeePass database."));
|
raiseError(tr("Not a KeePass database."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_encryptionFlags = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
m_encryptionFlags = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok || !(m_encryptionFlags & KeePass1::Rijndael || m_encryptionFlags & KeePass1::Twofish)) {
|
if (!ok || !(m_encryptionFlags & KeePass1::Rijndael || m_encryptionFlags & KeePass1::Twofish)) {
|
||||||
raiseError(tr("Unsupported encryption algorithm."));
|
raiseError(tr("Unsupported encryption algorithm."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 version = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
quint32 version = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok || (version & KeePass1::FILE_VERSION_CRITICAL_MASK)
|
if (!ok || (version & KeePass1::FILE_VERSION_CRITICAL_MASK)
|
||||||
!= (KeePass1::FILE_VERSION & KeePass1::FILE_VERSION_CRITICAL_MASK)) {
|
!= (KeePass1::FILE_VERSION & KeePass1::FILE_VERSION_CRITICAL_MASK)) {
|
||||||
raiseError(tr("Unsupported KeePass database version."));
|
raiseError(tr("Unsupported KeePass database version."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_masterSeed = m_device->read(16);
|
m_masterSeed = m_device->read(16);
|
||||||
if (m_masterSeed.size() != 16) {
|
if (m_masterSeed.size() != 16) {
|
||||||
raiseError("Unable to read master seed");
|
raiseError("Unable to read master seed");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_encryptionIV = m_device->read(16);
|
m_encryptionIV = m_device->read(16);
|
||||||
if (m_encryptionIV.size() != 16) {
|
if (m_encryptionIV.size() != 16) {
|
||||||
raiseError("Unable to read encryption IV");
|
raiseError("Unable to read encryption IV");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 numGroups = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
quint32 numGroups = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
raiseError("Invalid number of groups");
|
raiseError("Invalid number of groups");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 numEntries = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
quint32 numEntries = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
raiseError("Invalid number of entries");
|
raiseError("Invalid number of entries");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_contentHashHeader = m_device->read(32);
|
m_contentHashHeader = m_device->read(32);
|
||||||
if (m_contentHashHeader.size() != 32) {
|
if (m_contentHashHeader.size() != 32) {
|
||||||
raiseError("Invalid content hash size");
|
raiseError("Invalid content hash size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_transformSeed = m_device->read(32);
|
m_transformSeed = m_device->read(32);
|
||||||
if (m_transformSeed.size() != 32) {
|
if (m_transformSeed.size() != 32) {
|
||||||
raiseError("Invalid transform seed size");
|
raiseError("Invalid transform seed size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_transformRounds = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
m_transformRounds = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
raiseError("Invalid number of transform rounds");
|
raiseError("Invalid number of transform rounds");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!m_db->setTransformRounds(m_transformRounds)) {
|
if (!m_db->setTransformRounds(m_transformRounds)) {
|
||||||
raiseError(tr("Unable to calculate master key"));
|
raiseError(tr("Unable to calculate master key"));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 contentPos = m_device->pos();
|
qint64 contentPos = m_device->pos();
|
||||||
@ -169,14 +169,14 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
|||||||
QScopedPointer<SymmetricCipherStream> cipherStream(testKeys(password, keyfileData, contentPos));
|
QScopedPointer<SymmetricCipherStream> cipherStream(testKeys(password, keyfileData, contentPos));
|
||||||
|
|
||||||
if (!cipherStream) {
|
if (!cipherStream) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Group*> groups;
|
QList<Group*> groups;
|
||||||
for (quint32 i = 0; i < numGroups; i++) {
|
for (quint32 i = 0; i < numGroups; i++) {
|
||||||
Group* group = readGroup(cipherStream.data());
|
Group* group = readGroup(cipherStream.data());
|
||||||
if (!group) {
|
if (!group) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
groups.append(group);
|
groups.append(group);
|
||||||
}
|
}
|
||||||
@ -185,14 +185,14 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
|||||||
for (quint32 i = 0; i < numEntries; i++) {
|
for (quint32 i = 0; i < numEntries; i++) {
|
||||||
Entry* entry = readEntry(cipherStream.data());
|
Entry* entry = readEntry(cipherStream.data());
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
entries.append(entry);
|
entries.append(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!constructGroupTree(groups)) {
|
if (!constructGroupTree(groups)) {
|
||||||
raiseError("Unable to construct group tree");
|
raiseError("Unable to construct group tree");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH (Entry* entry, entries) {
|
Q_FOREACH (Entry* entry, entries) {
|
||||||
@ -243,7 +243,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
|||||||
|
|
||||||
if (!db->setKey(key)) {
|
if (!db->setKey(key)) {
|
||||||
raiseError(tr("Unable to calculate master key"));
|
raiseError(tr("Unable to calculate master key"));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db.take();
|
return db.take();
|
||||||
@ -257,7 +257,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
|
|||||||
keyFile.reset(new QFile(keyfileName));
|
keyFile.reset(new QFile(keyfileName));
|
||||||
if (!keyFile->open(QFile::ReadOnly)) {
|
if (!keyFile->open(QFile::ReadOnly)) {
|
||||||
raiseError(keyFile->errorString());
|
raiseError(keyFile->errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,14 +272,14 @@ Database* KeePass1Reader::readDatabase(const QString& filename, const QString& p
|
|||||||
QFile dbFile(filename);
|
QFile dbFile(filename);
|
||||||
if (!dbFile.open(QFile::ReadOnly)) {
|
if (!dbFile.open(QFile::ReadOnly)) {
|
||||||
raiseError(dbFile.errorString());
|
raiseError(dbFile.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Database* db = readDatabase(&dbFile, password, keyfileName);
|
Database* db = readDatabase(&dbFile, password, keyfileName);
|
||||||
|
|
||||||
if (dbFile.error() != QFile::NoError) {
|
if (dbFile.error() != QFile::NoError) {
|
||||||
raiseError(dbFile.errorString());
|
raiseError(dbFile.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
@ -337,7 +337,7 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q
|
|||||||
|
|
||||||
QByteArray finalKey = key(passwordData, keyfileData);
|
QByteArray finalKey = key(passwordData, keyfileData);
|
||||||
if (finalKey.isEmpty()) {
|
if (finalKey.isEmpty()) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (m_encryptionFlags & KeePass1::Rijndael) {
|
if (m_encryptionFlags & KeePass1::Rijndael) {
|
||||||
cipherStream.reset(new SymmetricCipherStream(m_device, SymmetricCipher::Aes256,
|
cipherStream.reset(new SymmetricCipherStream(m_device, SymmetricCipher::Aes256,
|
||||||
@ -350,11 +350,11 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q
|
|||||||
|
|
||||||
if (!cipherStream->init(finalKey, m_encryptionIV)) {
|
if (!cipherStream->init(finalKey, m_encryptionIV)) {
|
||||||
raiseError(cipherStream->errorString());
|
raiseError(cipherStream->errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!cipherStream->open(QIODevice::ReadOnly)) {
|
if (!cipherStream->open(QIODevice::ReadOnly)) {
|
||||||
raiseError(cipherStream->errorString());
|
raiseError(cipherStream->errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success = verifyKey(cipherStream.data());
|
bool success = verifyKey(cipherStream.data());
|
||||||
@ -368,7 +368,7 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q
|
|||||||
}
|
}
|
||||||
raiseError(msg);
|
raiseError(msg);
|
||||||
|
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
cipherStream->open(QIODevice::ReadOnly);
|
cipherStream->open(QIODevice::ReadOnly);
|
||||||
|
|
||||||
@ -442,19 +442,19 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
quint16 fieldType = Endian::readUInt16(cipherStream, KeePass1::BYTEORDER, &ok);
|
quint16 fieldType = Endian::readUInt16(cipherStream, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
raiseError("Invalid group field type number");
|
raiseError("Invalid group field type number");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fieldSize = static_cast<int>(Endian::readUInt32(cipherStream, KeePass1::BYTEORDER, &ok));
|
int fieldSize = static_cast<int>(Endian::readUInt32(cipherStream, KeePass1::BYTEORDER, &ok));
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
raiseError("Invalid group field size");
|
raiseError("Invalid group field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray fieldData = cipherStream->read(fieldSize);
|
QByteArray fieldData = cipherStream->read(fieldSize);
|
||||||
if (fieldData.size() != fieldSize) {
|
if (fieldData.size() != fieldSize) {
|
||||||
raiseError("Read group field data doesn't match size");
|
raiseError("Read group field data doesn't match size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fieldType) {
|
switch (fieldType) {
|
||||||
@ -464,7 +464,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
case 0x0001:
|
case 0x0001:
|
||||||
if (fieldSize != 4) {
|
if (fieldSize != 4) {
|
||||||
raiseError("Incorrect group id field size");
|
raiseError("Incorrect group id field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
||||||
groupIdSet = true;
|
groupIdSet = true;
|
||||||
@ -476,7 +476,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 5) {
|
if (fieldSize != 5) {
|
||||||
raiseError("Incorrect group creation time field size");
|
raiseError("Incorrect group creation time field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
||||||
if (dateTime.isValid()) {
|
if (dateTime.isValid()) {
|
||||||
@ -488,7 +488,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 5) {
|
if (fieldSize != 5) {
|
||||||
raiseError("Incorrect group modification time field size");
|
raiseError("Incorrect group modification time field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
||||||
if (dateTime.isValid()) {
|
if (dateTime.isValid()) {
|
||||||
@ -523,7 +523,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 4) {
|
if (fieldSize != 4) {
|
||||||
raiseError("Incorrect group icon field size");
|
raiseError("Incorrect group icon field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
quint32 iconNumber = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
quint32 iconNumber = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
||||||
group->setIcon(iconNumber);
|
group->setIcon(iconNumber);
|
||||||
@ -533,7 +533,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 2) {
|
if (fieldSize != 2) {
|
||||||
raiseError("Incorrect group level field size");
|
raiseError("Incorrect group level field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
groupLevel = Endian::bytesToUInt16(fieldData, KeePass1::BYTEORDER);
|
groupLevel = Endian::bytesToUInt16(fieldData, KeePass1::BYTEORDER);
|
||||||
groupLevelSet = true;
|
groupLevelSet = true;
|
||||||
@ -548,13 +548,13 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
|
|||||||
default:
|
default:
|
||||||
// invalid field
|
// invalid field
|
||||||
raiseError("Invalid group field type");
|
raiseError("Invalid group field type");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} while (!reachedEnd);
|
} while (!reachedEnd);
|
||||||
|
|
||||||
if (!groupIdSet || !groupLevelSet) {
|
if (!groupIdSet || !groupLevelSet) {
|
||||||
raiseError("Missing group id or level");
|
raiseError("Missing group id or level");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
group->setUuid(Uuid::random());
|
group->setUuid(Uuid::random());
|
||||||
@ -580,19 +580,19 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
quint16 fieldType = Endian::readUInt16(cipherStream, KeePass1::BYTEORDER, &ok);
|
quint16 fieldType = Endian::readUInt16(cipherStream, KeePass1::BYTEORDER, &ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
raiseError("Missing entry field type number");
|
raiseError("Missing entry field type number");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fieldSize = static_cast<int>(Endian::readUInt32(cipherStream, KeePass1::BYTEORDER, &ok));
|
int fieldSize = static_cast<int>(Endian::readUInt32(cipherStream, KeePass1::BYTEORDER, &ok));
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
raiseError("Invalid entry field size");
|
raiseError("Invalid entry field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray fieldData = cipherStream->read(fieldSize);
|
QByteArray fieldData = cipherStream->read(fieldSize);
|
||||||
if (fieldData.size() != fieldSize) {
|
if (fieldData.size() != fieldSize) {
|
||||||
raiseError("Read entry field data doesn't match size");
|
raiseError("Read entry field data doesn't match size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fieldType) {
|
switch (fieldType) {
|
||||||
@ -602,7 +602,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
case 0x0001:
|
case 0x0001:
|
||||||
if (fieldSize != 16) {
|
if (fieldSize != 16) {
|
||||||
raiseError("Invalid entry uuid field size");
|
raiseError("Invalid entry uuid field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
m_entryUuids.insert(fieldData, entry.data());
|
m_entryUuids.insert(fieldData, entry.data());
|
||||||
break;
|
break;
|
||||||
@ -610,7 +610,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 4) {
|
if (fieldSize != 4) {
|
||||||
raiseError("Invalid entry group id field size");
|
raiseError("Invalid entry group id field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
quint32 groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
quint32 groupId = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
||||||
m_entryGroupIds.insert(entry.data(), groupId);
|
m_entryGroupIds.insert(entry.data(), groupId);
|
||||||
@ -620,7 +620,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 4) {
|
if (fieldSize != 4) {
|
||||||
raiseError("Invalid entry icon field size");
|
raiseError("Invalid entry icon field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
quint32 iconNumber = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
quint32 iconNumber = Endian::bytesToUInt32(fieldData, KeePass1::BYTEORDER);
|
||||||
entry->setIcon(iconNumber);
|
entry->setIcon(iconNumber);
|
||||||
@ -645,7 +645,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 5) {
|
if (fieldSize != 5) {
|
||||||
raiseError("Invalid entry creation time field size");
|
raiseError("Invalid entry creation time field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
||||||
if (dateTime.isValid()) {
|
if (dateTime.isValid()) {
|
||||||
@ -657,7 +657,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 5) {
|
if (fieldSize != 5) {
|
||||||
raiseError("Invalid entry modification time field size");
|
raiseError("Invalid entry modification time field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
||||||
if (dateTime.isValid()) {
|
if (dateTime.isValid()) {
|
||||||
@ -669,7 +669,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 5) {
|
if (fieldSize != 5) {
|
||||||
raiseError("Invalid entry creation time field size");
|
raiseError("Invalid entry creation time field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
||||||
if (dateTime.isValid()) {
|
if (dateTime.isValid()) {
|
||||||
@ -681,7 +681,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
{
|
{
|
||||||
if (fieldSize != 5) {
|
if (fieldSize != 5) {
|
||||||
raiseError("Invalid entry expiry time field size");
|
raiseError("Invalid entry expiry time field size");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
QDateTime dateTime = dateFromPackedStruct(fieldData);
|
||||||
if (dateTime.isValid()) {
|
if (dateTime.isValid()) {
|
||||||
@ -704,7 +704,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
|
|||||||
default:
|
default:
|
||||||
// invalid field
|
// invalid field
|
||||||
raiseError("Invalid entry field type");
|
raiseError("Invalid entry field type");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} while (!reachedEnd);
|
} while (!reachedEnd);
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@
|
|||||||
#include "streams/SymmetricCipherStream.h"
|
#include "streams/SymmetricCipherStream.h"
|
||||||
|
|
||||||
KeePass2Reader::KeePass2Reader()
|
KeePass2Reader::KeePass2Reader()
|
||||||
: m_device(Q_NULLPTR)
|
: m_device(nullptr)
|
||||||
, m_headerStream(Q_NULLPTR)
|
, m_headerStream(nullptr)
|
||||||
, m_error(false)
|
, m_error(false)
|
||||||
, m_headerEnd(false)
|
, m_headerEnd(false)
|
||||||
, m_saveXml(false)
|
, m_saveXml(false)
|
||||||
, m_db(Q_NULLPTR)
|
, m_db(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,13 +66,13 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
quint32 signature1 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok);
|
quint32 signature1 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok);
|
||||||
if (!ok || signature1 != KeePass2::SIGNATURE_1) {
|
if (!ok || signature1 != KeePass2::SIGNATURE_1) {
|
||||||
raiseError(tr("Not a KeePass database."));
|
raiseError(tr("Not a KeePass database."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 signature2 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok);
|
quint32 signature2 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok);
|
||||||
if (!ok || signature2 != KeePass2::SIGNATURE_2) {
|
if (!ok || signature2 != KeePass2::SIGNATURE_2) {
|
||||||
raiseError(tr("Not a KeePass database."));
|
raiseError(tr("Not a KeePass database."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 version = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok)
|
quint32 version = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok)
|
||||||
@ -80,7 +80,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
quint32 maxVersion = KeePass2::FILE_VERSION & KeePass2::FILE_VERSION_CRITICAL_MASK;
|
quint32 maxVersion = KeePass2::FILE_VERSION & KeePass2::FILE_VERSION_CRITICAL_MASK;
|
||||||
if (!ok || (version < KeePass2::FILE_VERSION_MIN) || (version > maxVersion)) {
|
if (!ok || (version < KeePass2::FILE_VERSION_MIN) || (version > maxVersion)) {
|
||||||
raiseError(tr("Unsupported KeePass database version."));
|
raiseError(tr("Unsupported KeePass database version."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (readHeaderField() && !hasError()) {
|
while (readHeaderField() && !hasError()) {
|
||||||
@ -89,7 +89,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
headerStream.close();
|
headerStream.close();
|
||||||
|
|
||||||
if (hasError()) {
|
if (hasError()) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if all required headers were present
|
// check if all required headers were present
|
||||||
@ -97,12 +97,12 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
|| m_streamStartBytes.isEmpty() || m_protectedStreamKey.isEmpty()
|
|| m_streamStartBytes.isEmpty() || m_protectedStreamKey.isEmpty()
|
||||||
|| m_db->cipher().isNull()) {
|
|| m_db->cipher().isNull()) {
|
||||||
raiseError("missing database headers");
|
raiseError("missing database headers");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_db->setKey(key, m_transformSeed, false)) {
|
if (!m_db->setKey(key, m_transformSeed, false)) {
|
||||||
raiseError(tr("Unable to calculate master key"));
|
raiseError(tr("Unable to calculate master key"));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CryptoHash hash(CryptoHash::Sha256);
|
CryptoHash hash(CryptoHash::Sha256);
|
||||||
@ -114,24 +114,24 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
SymmetricCipher::Cbc, SymmetricCipher::Decrypt);
|
SymmetricCipher::Cbc, SymmetricCipher::Decrypt);
|
||||||
if (!cipherStream.init(finalKey, m_encryptionIV)) {
|
if (!cipherStream.init(finalKey, m_encryptionIV)) {
|
||||||
raiseError(cipherStream.errorString());
|
raiseError(cipherStream.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!cipherStream.open(QIODevice::ReadOnly)) {
|
if (!cipherStream.open(QIODevice::ReadOnly)) {
|
||||||
raiseError(cipherStream.errorString());
|
raiseError(cipherStream.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray realStart = cipherStream.read(32);
|
QByteArray realStart = cipherStream.read(32);
|
||||||
|
|
||||||
if (realStart != m_streamStartBytes) {
|
if (realStart != m_streamStartBytes) {
|
||||||
raiseError(tr("Wrong key or database file is corrupt."));
|
raiseError(tr("Wrong key or database file is corrupt."));
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashedBlockStream hashedStream(&cipherStream);
|
HashedBlockStream hashedStream(&cipherStream);
|
||||||
if (!hashedStream.open(QIODevice::ReadOnly)) {
|
if (!hashedStream.open(QIODevice::ReadOnly)) {
|
||||||
raiseError(hashedStream.errorString());
|
raiseError(hashedStream.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QIODevice* xmlDevice;
|
QIODevice* xmlDevice;
|
||||||
@ -145,7 +145,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
ioCompressor->setStreamFormat(QtIOCompressor::GzipFormat);
|
ioCompressor->setStreamFormat(QtIOCompressor::GzipFormat);
|
||||||
if (!ioCompressor->open(QIODevice::ReadOnly)) {
|
if (!ioCompressor->open(QIODevice::ReadOnly)) {
|
||||||
raiseError(ioCompressor->errorString());
|
raiseError(ioCompressor->errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
xmlDevice = ioCompressor.data();
|
xmlDevice = ioCompressor.data();
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
KeePass2RandomStream randomStream;
|
KeePass2RandomStream randomStream;
|
||||||
if (!randomStream.init(m_protectedStreamKey)) {
|
if (!randomStream.init(m_protectedStreamKey)) {
|
||||||
raiseError(randomStream.errorString());
|
raiseError(randomStream.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<QBuffer> buffer;
|
QScopedPointer<QBuffer> buffer;
|
||||||
@ -170,7 +170,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
|
|
||||||
if (xmlReader.hasError()) {
|
if (xmlReader.hasError()) {
|
||||||
raiseError(xmlReader.errorString());
|
raiseError(xmlReader.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(version < 0x00030001 || !xmlReader.headerHash().isEmpty());
|
Q_ASSERT(version < 0x00030001 || !xmlReader.headerHash().isEmpty());
|
||||||
@ -179,7 +179,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
|
|||||||
QByteArray headerHash = CryptoHash::hash(headerStream.storedData(), CryptoHash::Sha256);
|
QByteArray headerHash = CryptoHash::hash(headerStream.storedData(), CryptoHash::Sha256);
|
||||||
if (headerHash != xmlReader.headerHash()) {
|
if (headerHash != xmlReader.headerHash()) {
|
||||||
raiseError("Head doesn't match hash");
|
raiseError("Head doesn't match hash");
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,14 +191,14 @@ Database* KeePass2Reader::readDatabase(const QString& filename, const CompositeK
|
|||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if (!file.open(QFile::ReadOnly)) {
|
if (!file.open(QFile::ReadOnly)) {
|
||||||
raiseError(file.errorString());
|
raiseError(file.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<Database> db(readDatabase(&file, key));
|
QScopedPointer<Database> db(readDatabase(&file, key));
|
||||||
|
|
||||||
if (file.error() != QFile::NoError) {
|
if (file.error() != QFile::NoError) {
|
||||||
raiseError(file.errorString());
|
raiseError(file.errorString());
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return db.take();
|
return db.take();
|
||||||
|
@ -31,10 +31,10 @@
|
|||||||
typedef QPair<QString, QString> StringPair;
|
typedef QPair<QString, QString> StringPair;
|
||||||
|
|
||||||
KeePass2XmlReader::KeePass2XmlReader()
|
KeePass2XmlReader::KeePass2XmlReader()
|
||||||
: m_randomStream(Q_NULLPTR)
|
: m_randomStream(nullptr)
|
||||||
, m_db(Q_NULLPTR)
|
, m_db(nullptr)
|
||||||
, m_meta(Q_NULLPTR)
|
, m_meta(nullptr)
|
||||||
, m_tmpParent(Q_NULLPTR)
|
, m_tmpParent(nullptr)
|
||||||
, m_error(false)
|
, m_error(false)
|
||||||
, m_strictMode(false)
|
, m_strictMode(false)
|
||||||
{
|
{
|
||||||
@ -1144,7 +1144,7 @@ QByteArray KeePass2XmlReader::readCompressedBinary()
|
|||||||
Group* KeePass2XmlReader::getGroup(const Uuid& uuid)
|
Group* KeePass2XmlReader::getGroup(const Uuid& uuid)
|
||||||
{
|
{
|
||||||
if (uuid.isNull()) {
|
if (uuid.isNull()) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_groups.contains(uuid)) {
|
if (m_groups.contains(uuid)) {
|
||||||
@ -1163,7 +1163,7 @@ Group* KeePass2XmlReader::getGroup(const Uuid& uuid)
|
|||||||
Entry* KeePass2XmlReader::getEntry(const Uuid& uuid)
|
Entry* KeePass2XmlReader::getEntry(const Uuid& uuid)
|
||||||
{
|
{
|
||||||
if (uuid.isNull()) {
|
if (uuid.isNull()) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_entries.contains(uuid)) {
|
if (m_entries.contains(uuid)) {
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/TimeInfo.h"
|
#include "core/TimeInfo.h"
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
@ -42,7 +41,7 @@ class KeePass2XmlReader
|
|||||||
public:
|
public:
|
||||||
KeePass2XmlReader();
|
KeePass2XmlReader();
|
||||||
Database* readDatabase(QIODevice* device);
|
Database* readDatabase(QIODevice* device);
|
||||||
void readDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = Q_NULLPTR);
|
void readDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = nullptr);
|
||||||
Database* readDatabase(const QString& filename);
|
Database* readDatabase(const QString& filename);
|
||||||
bool hasError();
|
bool hasError();
|
||||||
QString errorString();
|
QString errorString();
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
#include "streams/QtIOCompressor"
|
#include "streams/QtIOCompressor"
|
||||||
|
|
||||||
KeePass2XmlWriter::KeePass2XmlWriter()
|
KeePass2XmlWriter::KeePass2XmlWriter()
|
||||||
: m_db(Q_NULLPTR)
|
: m_db(nullptr)
|
||||||
, m_meta(Q_NULLPTR)
|
, m_meta(nullptr)
|
||||||
, m_randomStream(Q_NULLPTR)
|
, m_randomStream(nullptr)
|
||||||
, m_error(false)
|
, m_error(false)
|
||||||
{
|
{
|
||||||
m_xml.setAutoFormatting(true);
|
m_xml.setAutoFormatting(true);
|
||||||
|
@ -36,7 +36,7 @@ class KeePass2XmlWriter
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeePass2XmlWriter();
|
KeePass2XmlWriter();
|
||||||
void writeDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = Q_NULLPTR,
|
void writeDatabase(QIODevice* device, Database* db, KeePass2RandomStream* randomStream = nullptr,
|
||||||
const QByteArray& headerHash = QByteArray());
|
const QByteArray& headerHash = QByteArray());
|
||||||
void writeDatabase(const QString& filename, Database* db);
|
void writeDatabase(const QString& filename, Database* db);
|
||||||
bool hasError();
|
bool hasError();
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AboutDialog;
|
class AboutDialog;
|
||||||
}
|
}
|
||||||
@ -32,7 +30,7 @@ class AboutDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AboutDialog(QWidget* parent = Q_NULLPTR);
|
explicit AboutDialog(QWidget* parent = nullptr);
|
||||||
~AboutDialog();
|
~AboutDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
class XcbEventFilter : public QAbstractNativeEventFilter
|
class XcbEventFilter : public QAbstractNativeEventFilter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) Q_DECL_OVERRIDE
|
virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) override
|
||||||
{
|
{
|
||||||
Q_UNUSED(result)
|
Q_UNUSED(result)
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class Application : public QApplication
|
class Application : public QApplication
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -30,7 +28,7 @@ class Application : public QApplication
|
|||||||
public:
|
public:
|
||||||
Application(int& argc, char** argv);
|
Application(int& argc, char** argv);
|
||||||
|
|
||||||
bool event(QEvent* event) Q_DECL_OVERRIDE;
|
bool event(QEvent* event) override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void openFile(const QString& filename);
|
void openFile(const QString& filename);
|
||||||
|
@ -33,7 +33,7 @@ class ChangeMasterKeyWidget : public DialogyWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ChangeMasterKeyWidget(QWidget* parent = Q_NULLPTR);
|
explicit ChangeMasterKeyWidget(QWidget* parent = nullptr);
|
||||||
~ChangeMasterKeyWidget();
|
~ChangeMasterKeyWidget();
|
||||||
void clearForms();
|
void clearForms();
|
||||||
CompositeKey newMasterKey();
|
CompositeKey newMasterKey();
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "core/Config.h"
|
#include "core/Config.h"
|
||||||
|
|
||||||
Clipboard* Clipboard::m_instance(Q_NULLPTR);
|
Clipboard* Clipboard::m_instance(nullptr);
|
||||||
|
|
||||||
Clipboard::Clipboard(QObject* parent)
|
Clipboard::Clipboard(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
class Clipboard : public QObject
|
class Clipboard : public QObject
|
||||||
@ -38,7 +36,7 @@ private Q_SLOTS:
|
|||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit Clipboard(QObject* parent = Q_NULLPTR);
|
explicit Clipboard(QObject* parent = nullptr);
|
||||||
|
|
||||||
static Clipboard* m_instance;
|
static Clipboard* m_instance;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
|
DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
|
||||||
: DialogyWidget(parent)
|
: DialogyWidget(parent)
|
||||||
, m_ui(new Ui::DatabaseOpenWidget())
|
, m_ui(new Ui::DatabaseOpenWidget())
|
||||||
, m_db(Q_NULLPTR)
|
, m_db(nullptr)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class DatabaseOpenWidget : public DialogyWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatabaseOpenWidget(QWidget* parent = Q_NULLPTR);
|
explicit DatabaseOpenWidget(QWidget* parent = nullptr);
|
||||||
~DatabaseOpenWidget();
|
~DatabaseOpenWidget();
|
||||||
void load(const QString& filename);
|
void load(const QString& filename);
|
||||||
void enterKey(const QString& pw, const QString& keyFile);
|
void enterKey(const QString& pw, const QString& keyFile);
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent)
|
DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent)
|
||||||
: DialogyWidget(parent)
|
: DialogyWidget(parent)
|
||||||
, m_ui(new Ui::DatabaseSettingsWidget())
|
, m_ui(new Ui::DatabaseSettingsWidget())
|
||||||
, m_db(Q_NULLPTR)
|
, m_db(nullptr)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class DatabaseSettingsWidget : public DialogyWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatabaseSettingsWidget(QWidget* parent = Q_NULLPTR);
|
explicit DatabaseSettingsWidget(QWidget* parent = nullptr);
|
||||||
~DatabaseSettingsWidget();
|
~DatabaseSettingsWidget();
|
||||||
|
|
||||||
void load(Database* db);
|
void load(Database* db);
|
||||||
|
@ -37,8 +37,8 @@
|
|||||||
#include "gui/group/GroupView.h"
|
#include "gui/group/GroupView.h"
|
||||||
|
|
||||||
DatabaseManagerStruct::DatabaseManagerStruct()
|
DatabaseManagerStruct::DatabaseManagerStruct()
|
||||||
: dbWidget(Q_NULLPTR)
|
: dbWidget(nullptr)
|
||||||
, lockFile(Q_NULLPTR)
|
, lockFile(nullptr)
|
||||||
, saveToFilename(false)
|
, saveToFilename(false)
|
||||||
, modified(false)
|
, modified(false)
|
||||||
, readOnly(false)
|
, readOnly(false)
|
||||||
@ -160,7 +160,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
|
|||||||
if (result == QMessageBox::No) {
|
if (result == QMessageBox::No) {
|
||||||
dbStruct.readOnly = true;
|
dbStruct.readOnly = true;
|
||||||
delete lockFile;
|
delete lockFile;
|
||||||
lockFile = Q_NULLPTR;
|
lockFile = nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// take over the lock file if possible
|
// take over the lock file if possible
|
||||||
@ -558,7 +558,7 @@ Database* DatabaseTabWidget::indexDatabase(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseManagerStruct DatabaseTabWidget::indexDatabaseManagerStruct(int index)
|
DatabaseManagerStruct DatabaseTabWidget::indexDatabaseManagerStruct(int index)
|
||||||
@ -586,7 +586,7 @@ Database* DatabaseTabWidget::databaseFromDatabaseWidget(DatabaseWidget* dbWidget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct& dbStruct)
|
void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct& dbStruct)
|
||||||
@ -611,7 +611,7 @@ DatabaseWidget* DatabaseTabWidget::currentDatabaseWidget()
|
|||||||
return m_dbList[db].dbWidget;
|
return m_dbList[db].dbWidget;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class DatabaseTabWidget : public QTabWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatabaseTabWidget(QWidget* parent = Q_NULLPTR);
|
explicit DatabaseTabWidget(QWidget* parent = nullptr);
|
||||||
~DatabaseTabWidget();
|
~DatabaseTabWidget();
|
||||||
void openDatabase(const QString& fileName, const QString& pw = QString(),
|
void openDatabase(const QString& fileName, const QString& pw = QString(),
|
||||||
const QString& keyFile = QString());
|
const QString& keyFile = QString());
|
||||||
@ -101,7 +101,7 @@ private:
|
|||||||
Database* databaseFromDatabaseWidget(DatabaseWidget* dbWidget);
|
Database* databaseFromDatabaseWidget(DatabaseWidget* dbWidget);
|
||||||
void insertDatabase(Database* db, const DatabaseManagerStruct& dbStruct);
|
void insertDatabase(Database* db, const DatabaseManagerStruct& dbStruct);
|
||||||
void updateLastDatabases(const QString& filename);
|
void updateLastDatabases(const QString& filename);
|
||||||
void connectDatabase(Database* newDb, Database* oldDb = Q_NULLPTR);
|
void connectDatabase(Database* newDb, Database* oldDb = nullptr);
|
||||||
|
|
||||||
KeePass2Writer m_writer;
|
KeePass2Writer m_writer;
|
||||||
QHash<Database*, DatabaseManagerStruct> m_dbList;
|
QHash<Database*, DatabaseManagerStruct> m_dbList;
|
||||||
|
@ -51,9 +51,9 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||||||
, m_db(db)
|
, m_db(db)
|
||||||
, m_searchUi(new Ui::SearchWidget())
|
, m_searchUi(new Ui::SearchWidget())
|
||||||
, m_searchWidget(new QWidget())
|
, m_searchWidget(new QWidget())
|
||||||
, m_newGroup(Q_NULLPTR)
|
, m_newGroup(nullptr)
|
||||||
, m_newEntry(Q_NULLPTR)
|
, m_newEntry(nullptr)
|
||||||
, m_newParent(Q_NULLPTR)
|
, m_newParent(nullptr)
|
||||||
{
|
{
|
||||||
m_searchUi->setupUi(m_searchWidget);
|
m_searchUi->setupUi(m_searchWidget);
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ DatabaseWidget::~DatabaseWidget()
|
|||||||
|
|
||||||
DatabaseWidget::Mode DatabaseWidget::currentMode() const
|
DatabaseWidget::Mode DatabaseWidget::currentMode() const
|
||||||
{
|
{
|
||||||
if (currentWidget() == Q_NULLPTR) {
|
if (currentWidget() == nullptr) {
|
||||||
return DatabaseWidget::None;
|
return DatabaseWidget::None;
|
||||||
}
|
}
|
||||||
else if (currentWidget() == m_mainWidget) {
|
else if (currentWidget() == m_mainWidget) {
|
||||||
@ -552,8 +552,8 @@ void DatabaseWidget::switchToView(bool accepted)
|
|||||||
delete m_newGroup;
|
delete m_newGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_newGroup = Q_NULLPTR;
|
m_newGroup = nullptr;
|
||||||
m_newParent = Q_NULLPTR;
|
m_newParent = nullptr;
|
||||||
}
|
}
|
||||||
else if (m_newEntry) {
|
else if (m_newEntry) {
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
@ -565,8 +565,8 @@ void DatabaseWidget::switchToView(bool accepted)
|
|||||||
delete m_newEntry;
|
delete m_newEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_newEntry = Q_NULLPTR;
|
m_newEntry = nullptr;
|
||||||
m_newParent = Q_NULLPTR;
|
m_newParent = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurrentWidget(m_mainWidget);
|
setCurrentWidget(m_mainWidget);
|
||||||
@ -636,9 +636,9 @@ void DatabaseWidget::openDatabase(bool accepted)
|
|||||||
// We won't need those anymore and KeePass1OpenWidget closes
|
// We won't need those anymore and KeePass1OpenWidget closes
|
||||||
// the file in its dtor.
|
// the file in its dtor.
|
||||||
delete m_databaseOpenWidget;
|
delete m_databaseOpenWidget;
|
||||||
m_databaseOpenWidget = Q_NULLPTR;
|
m_databaseOpenWidget = nullptr;
|
||||||
delete m_keepass1OpenWidget;
|
delete m_keepass1OpenWidget;
|
||||||
m_keepass1OpenWidget = Q_NULLPTR;
|
m_keepass1OpenWidget = nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (m_databaseOpenWidget->database()) {
|
if (m_databaseOpenWidget->database()) {
|
||||||
@ -881,7 +881,7 @@ bool DatabaseWidget::isInSearchMode() const
|
|||||||
void DatabaseWidget::clearLastGroup(Group* group)
|
void DatabaseWidget::clearLastGroup(Group* group)
|
||||||
{
|
{
|
||||||
if (group) {
|
if (group) {
|
||||||
m_lastGroup = Q_NULLPTR;
|
m_lastGroup = nullptr;
|
||||||
m_searchWidget->hide();
|
m_searchWidget->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -930,7 +930,7 @@ QStringList DatabaseWidget::customEntryAttributes() const
|
|||||||
|
|
||||||
bool DatabaseWidget::isGroupSelected() const
|
bool DatabaseWidget::isGroupSelected() const
|
||||||
{
|
{
|
||||||
return m_groupView->currentGroup() != Q_NULLPTR;
|
return m_groupView->currentGroup() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseWidget::currentEntryHasTitle()
|
bool DatabaseWidget::currentEntryHasTitle()
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
#include "gui/entry/EntryModel.h"
|
#include "gui/entry/EntryModel.h"
|
||||||
@ -59,7 +58,7 @@ public:
|
|||||||
LockedMode
|
LockedMode
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit DatabaseWidget(Database* db, QWidget* parent = Q_NULLPTR);
|
explicit DatabaseWidget(Database* db, QWidget* parent = nullptr);
|
||||||
~DatabaseWidget();
|
~DatabaseWidget();
|
||||||
Database* database();
|
Database* database();
|
||||||
bool dbHasKey() const;
|
bool dbHasKey() const;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
DatabaseWidgetStateSync::DatabaseWidgetStateSync(QObject* parent)
|
DatabaseWidgetStateSync::DatabaseWidgetStateSync(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_activeDbWidget(Q_NULLPTR)
|
, m_activeDbWidget(nullptr)
|
||||||
, m_blockUpdates(false)
|
, m_blockUpdates(false)
|
||||||
{
|
{
|
||||||
m_splitterSizes = variantToIntList(config()->get("GUI/SplitterState"));
|
m_splitterSizes = variantToIntList(config()->get("GUI/SplitterState"));
|
||||||
|
@ -26,7 +26,7 @@ class DatabaseWidgetStateSync : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DatabaseWidgetStateSync(QObject* parent = Q_NULLPTR);
|
explicit DatabaseWidgetStateSync(QObject* parent = nullptr);
|
||||||
~DatabaseWidgetStateSync();
|
~DatabaseWidgetStateSync();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
@ -21,17 +21,15 @@
|
|||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class DialogyWidget : public QWidget
|
class DialogyWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DialogyWidget(QWidget* parent = Q_NULLPTR);
|
explicit DialogyWidget(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void keyPressEvent(QKeyEvent* e) Q_DECL_OVERRIDE;
|
virtual void keyPressEvent(QKeyEvent* e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool clickButton(QDialogButtonBox::StandardButton standardButton);
|
bool clickButton(QDialogButtonBox::StandardButton standardButton);
|
||||||
|
@ -20,21 +20,19 @@
|
|||||||
|
|
||||||
#include <QTabBar>
|
#include <QTabBar>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class DragTabBar : public QTabBar
|
class DragTabBar : public QTabBar
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DragTabBar(QWidget* parent = Q_NULLPTR);
|
explicit DragTabBar(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent* event) Q_DECL_OVERRIDE;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
void dragMoveEvent(QDragMoveEvent* event) Q_DECL_OVERRIDE;
|
void dragMoveEvent(QDragMoveEvent* event) override;
|
||||||
void dragLeaveEvent(QDragLeaveEvent* event) Q_DECL_OVERRIDE;
|
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||||
void dropEvent(QDropEvent* event) Q_DECL_OVERRIDE;
|
void dropEvent(QDropEvent* event) override;
|
||||||
void tabLayoutChange() Q_DECL_OVERRIDE;
|
void tabLayoutChange() override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void dragSwitchTab();
|
void dragSwitchTab();
|
||||||
|
@ -33,7 +33,7 @@ class EditWidget : public DialogyWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EditWidget(QWidget* parent = Q_NULLPTR);
|
explicit EditWidget(QWidget* parent = nullptr);
|
||||||
~EditWidget();
|
~EditWidget();
|
||||||
|
|
||||||
void add(const QString& labelText, QWidget* widget);
|
void add(const QString& labelText, QWidget* widget);
|
||||||
|
@ -35,7 +35,7 @@ IconStruct::IconStruct()
|
|||||||
EditWidgetIcons::EditWidgetIcons(QWidget* parent)
|
EditWidgetIcons::EditWidgetIcons(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_ui(new Ui::EditWidgetIcons())
|
, m_ui(new Ui::EditWidgetIcons())
|
||||||
, m_database(Q_NULLPTR)
|
, m_database(nullptr)
|
||||||
, m_defaultIconModel(new DefaultIconModel(this))
|
, m_defaultIconModel(new DefaultIconModel(this))
|
||||||
, m_customIconModel(new CustomIconModel(this))
|
, m_customIconModel(new CustomIconModel(this))
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ IconStruct EditWidgetIcons::save()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_database = Q_NULLPTR;
|
m_database = nullptr;
|
||||||
m_currentUuid = Uuid();
|
m_currentUuid = Uuid();
|
||||||
return iconStruct;
|
return iconStruct;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
@ -44,7 +43,7 @@ class EditWidgetIcons : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EditWidgetIcons(QWidget* parent = Q_NULLPTR);
|
explicit EditWidgetIcons(QWidget* parent = nullptr);
|
||||||
~EditWidgetIcons();
|
~EditWidgetIcons();
|
||||||
|
|
||||||
IconStruct save();
|
IconStruct save();
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/TimeInfo.h"
|
#include "core/TimeInfo.h"
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
@ -33,7 +32,7 @@ class EditWidgetProperties : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EditWidgetProperties(QWidget* parent = Q_NULLPTR);
|
explicit EditWidgetProperties(QWidget* parent = nullptr);
|
||||||
~EditWidgetProperties();
|
~EditWidgetProperties();
|
||||||
|
|
||||||
void setFields(TimeInfo timeInfo, Uuid uuid);
|
void setFields(TimeInfo timeInfo, Uuid uuid);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "core/Config.h"
|
#include "core/Config.h"
|
||||||
|
|
||||||
FileDialog* FileDialog::m_instance(Q_NULLPTR);
|
FileDialog* FileDialog::m_instance(nullptr);
|
||||||
|
|
||||||
QString FileDialog::getOpenFileName(QWidget* parent, const QString& caption, QString dir,
|
QString FileDialog::getOpenFileName(QWidget* parent, const QString& caption, QString dir,
|
||||||
const QString& filter, QString* selectedFilter,
|
const QString& filter, QString* selectedFilter,
|
||||||
|
@ -20,17 +20,15 @@
|
|||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class FileDialog
|
class FileDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString getOpenFileName(QWidget* parent = Q_NULLPTR, const QString& caption = QString(),
|
QString getOpenFileName(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||||
QString dir = QString(), const QString& filter = QString(),
|
QString dir = QString(), const QString& filter = QString(),
|
||||||
QString* selectedFilter = Q_NULLPTR, QFileDialog::Options options = 0);
|
QString* selectedFilter = nullptr, QFileDialog::Options options = 0);
|
||||||
QString getSaveFileName(QWidget* parent = Q_NULLPTR, const QString& caption = QString(),
|
QString getSaveFileName(QWidget* parent = nullptr, const QString& caption = QString(),
|
||||||
QString dir = QString(), const QString& filter = QString(),
|
QString dir = QString(), const QString& filter = QString(),
|
||||||
QString* selectedFilter = Q_NULLPTR, QFileDialog::Options options = 0,
|
QString* selectedFilter = nullptr, QFileDialog::Options options = 0,
|
||||||
const QString& defaultExtension = QString());
|
const QString& defaultExtension = QString());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/Uuid.h"
|
#include "core/Uuid.h"
|
||||||
|
|
||||||
class DefaultIconModel : public QAbstractListModel
|
class DefaultIconModel : public QAbstractListModel
|
||||||
@ -29,10 +28,10 @@ class DefaultIconModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DefaultIconModel(QObject* parent = Q_NULLPTR);
|
explicit DefaultIconModel(QObject* parent = nullptr);
|
||||||
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CustomIconModel : public QAbstractListModel
|
class CustomIconModel : public QAbstractListModel
|
||||||
@ -40,10 +39,10 @@ class CustomIconModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CustomIconModel(QObject* parent = Q_NULLPTR);
|
explicit CustomIconModel(QObject* parent = nullptr);
|
||||||
|
|
||||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
void setIcons(const QHash<Uuid, QImage>& icons, const QList<Uuid>& iconsOrder);
|
void setIcons(const QHash<Uuid, QImage>& icons, const QList<Uuid>& iconsOrder);
|
||||||
Uuid uuidFromIndex(const QModelIndex& index) const;
|
Uuid uuidFromIndex(const QModelIndex& index) const;
|
||||||
QModelIndex indexFromUuid(const Uuid& uuid) const;
|
QModelIndex indexFromUuid(const Uuid& uuid) const;
|
||||||
|
@ -25,10 +25,10 @@ class KeePass1OpenWidget : public DatabaseOpenWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KeePass1OpenWidget(QWidget* parent = Q_NULLPTR);
|
explicit KeePass1OpenWidget(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void openDatabase() Q_DECL_OVERRIDE;
|
void openDatabase() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_KEEPASS1OPENWIDGET_H
|
#endif // KEEPASSX_KEEPASS1OPENWIDGET_H
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
|
|
||||||
class LineEdit : public QLineEdit
|
class LineEdit : public QLineEdit
|
||||||
@ -31,10 +29,10 @@ class LineEdit : public QLineEdit
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LineEdit(QWidget* parent = Q_NULLPTR);
|
explicit LineEdit(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updateCloseButton(const QString& text);
|
void updateCloseButton(const QString& text);
|
||||||
|
@ -33,7 +33,7 @@ const QString MainWindow::BaseWindowTitle = "KeePassX";
|
|||||||
|
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
: m_ui(new Ui::MainWindow())
|
: m_ui(new Ui::MainWindow())
|
||||||
, m_trayIcon(Q_NULLPTR)
|
, m_trayIcon(nullptr)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
@ -514,7 +514,7 @@ void MainWindow::updateTrayIcon()
|
|||||||
if (m_trayIcon) {
|
if (m_trayIcon) {
|
||||||
m_trayIcon->hide();
|
m_trayIcon->hide();
|
||||||
delete m_trayIcon;
|
delete m_trayIcon;
|
||||||
m_trayIcon = Q_NULLPTR;
|
m_trayIcon = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ public Q_SLOTS:
|
|||||||
const QString& keyFile = QString());
|
const QString& keyFile = QString());
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE;
|
void closeEvent(QCloseEvent* event) override;
|
||||||
void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
void changeEvent(QEvent* event) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
|
void setMenuActionState(DatabaseWidget::Mode mode = DatabaseWidget::None);
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class MessageBox
|
class MessageBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
PasswordComboBox::PasswordComboBox(QWidget* parent)
|
PasswordComboBox::PasswordComboBox(QWidget* parent)
|
||||||
: QComboBox(parent)
|
: QComboBox(parent)
|
||||||
, m_generator(Q_NULLPTR)
|
, m_generator(nullptr)
|
||||||
, m_alternatives(10)
|
, m_alternatives(10)
|
||||||
{
|
{
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class PasswordGenerator;
|
class PasswordGenerator;
|
||||||
|
|
||||||
class PasswordComboBox : public QComboBox
|
class PasswordComboBox : public QComboBox
|
||||||
@ -30,7 +28,7 @@ class PasswordComboBox : public QComboBox
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PasswordComboBox(QWidget* parent = Q_NULLPTR);
|
explicit PasswordComboBox(QWidget* parent = nullptr);
|
||||||
~PasswordComboBox();
|
~PasswordComboBox();
|
||||||
|
|
||||||
void setGenerator(PasswordGenerator* generator);
|
void setGenerator(PasswordGenerator* generator);
|
||||||
|
@ -17,14 +17,12 @@
|
|||||||
|
|
||||||
#include "PasswordEdit.h"
|
#include "PasswordEdit.h"
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
const QColor PasswordEdit::CorrectSoFarColor = QColor(255, 205, 15);
|
const QColor PasswordEdit::CorrectSoFarColor = QColor(255, 205, 15);
|
||||||
const QColor PasswordEdit::ErrorColor = QColor(255, 125, 125);
|
const QColor PasswordEdit::ErrorColor = QColor(255, 125, 125);
|
||||||
|
|
||||||
PasswordEdit::PasswordEdit(QWidget* parent)
|
PasswordEdit::PasswordEdit(QWidget* parent)
|
||||||
: QLineEdit(parent)
|
: QLineEdit(parent)
|
||||||
, m_basePasswordEdit(Q_NULLPTR)
|
, m_basePasswordEdit(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class PasswordEdit : public QLineEdit
|
class PasswordEdit : public QLineEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -30,7 +28,7 @@ public:
|
|||||||
static const QColor CorrectSoFarColor;
|
static const QColor CorrectSoFarColor;
|
||||||
static const QColor ErrorColor;
|
static const QColor ErrorColor;
|
||||||
|
|
||||||
explicit PasswordEdit(QWidget* parent = Q_NULLPTR);
|
explicit PasswordEdit(QWidget* parent = nullptr);
|
||||||
void enableVerifyMode(PasswordEdit* baseEdit);
|
void enableVerifyMode(PasswordEdit* baseEdit);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
#include "core/PasswordGenerator.h"
|
#include "core/PasswordGenerator.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -35,7 +34,7 @@ class PasswordGeneratorWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PasswordGeneratorWidget(QWidget* parent = Q_NULLPTR);
|
explicit PasswordGeneratorWidget(QWidget* parent = nullptr);
|
||||||
~PasswordGeneratorWidget();
|
~PasswordGeneratorWidget();
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -30,7 +30,7 @@ class SettingsWidget : public EditWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SettingsWidget(QWidget* parent = Q_NULLPTR);
|
explicit SettingsWidget(QWidget* parent = nullptr);
|
||||||
~SettingsWidget();
|
~SettingsWidget();
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
|
||||||
|
@ -21,19 +21,17 @@
|
|||||||
#include <QBitArray>
|
#include <QBitArray>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class SortFilterHideProxyModel : public QSortFilterProxyModel
|
class SortFilterHideProxyModel : public QSortFilterProxyModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SortFilterHideProxyModel(QObject* parent = Q_NULLPTR);
|
explicit SortFilterHideProxyModel(QObject* parent = nullptr);
|
||||||
Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE;
|
Qt::DropActions supportedDragActions() const override;
|
||||||
void hideColumn(int column, bool hide);
|
void hideColumn(int column, bool hide);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool filterAcceptsColumn(int sourceColumn, const QModelIndex& sourceParent) const Q_DECL_OVERRIDE;
|
bool filterAcceptsColumn(int sourceColumn, const QModelIndex& sourceParent) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QBitArray m_hiddenColumns;
|
QBitArray m_hiddenColumns;
|
||||||
|
@ -33,5 +33,5 @@ void UnlockDatabaseWidget::clearForms()
|
|||||||
m_ui->comboKeyFile->clear();
|
m_ui->comboKeyFile->clear();
|
||||||
m_ui->checkPassword->setChecked(false);
|
m_ui->checkPassword->setChecked(false);
|
||||||
m_ui->checkKeyFile->setChecked(false);
|
m_ui->checkKeyFile->setChecked(false);
|
||||||
m_db = Q_NULLPTR;
|
m_db = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class UnlockDatabaseWidget : public DatabaseOpenWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit UnlockDatabaseWidget(QWidget* parent = Q_NULLPTR);
|
explicit UnlockDatabaseWidget(QWidget* parent = nullptr);
|
||||||
void clearForms();
|
void clearForms();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class WelcomeWidget;
|
class WelcomeWidget;
|
||||||
}
|
}
|
||||||
@ -31,7 +29,7 @@ class WelcomeWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WelcomeWidget(QWidget* parent = Q_NULLPTR);
|
explicit WelcomeWidget(QWidget* parent = nullptr);
|
||||||
~WelcomeWidget();
|
~WelcomeWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
AutoTypeAssociationsModel::AutoTypeAssociationsModel(QObject* parent)
|
AutoTypeAssociationsModel::AutoTypeAssociationsModel(QObject* parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, m_autoTypeAssociations(Q_NULLPTR)
|
, m_autoTypeAssociations(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ class AutoTypeAssociationsModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoTypeAssociationsModel(QObject* parent = Q_NULLPTR);
|
explicit AutoTypeAssociationsModel(QObject* parent = nullptr);
|
||||||
void setAutoTypeAssociations(AutoTypeAssociations* autoTypeAssociations);
|
void setAutoTypeAssociations(AutoTypeAssociations* autoTypeAssociations);
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void associationChange(int i);
|
void associationChange(int i);
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
EditEntryWidget::EditEntryWidget(QWidget* parent)
|
EditEntryWidget::EditEntryWidget(QWidget* parent)
|
||||||
: EditWidget(parent)
|
: EditWidget(parent)
|
||||||
, m_entry(Q_NULLPTR)
|
, m_entry(nullptr)
|
||||||
, m_mainUi(new Ui::EditEntryWidgetMain())
|
, m_mainUi(new Ui::EditEntryWidgetMain())
|
||||||
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
|
, m_advancedUi(new Ui::EditEntryWidgetAdvanced())
|
||||||
, m_autoTypeUi(new Ui::EditEntryWidgetAutoType())
|
, m_autoTypeUi(new Ui::EditEntryWidgetAutoType())
|
||||||
@ -477,8 +477,8 @@ void EditEntryWidget::cancel()
|
|||||||
|
|
||||||
void EditEntryWidget::clear()
|
void EditEntryWidget::clear()
|
||||||
{
|
{
|
||||||
m_entry = Q_NULLPTR;
|
m_entry = nullptr;
|
||||||
m_database = Q_NULLPTR;
|
m_database = nullptr;
|
||||||
m_entryAttributes->clear();
|
m_entryAttributes->clear();
|
||||||
m_entryAttachments->clear();
|
m_entryAttachments->clear();
|
||||||
m_autoTypeAssoc->clear();
|
m_autoTypeAssoc->clear();
|
||||||
|
@ -52,7 +52,7 @@ class EditEntryWidget : public EditWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EditEntryWidget(QWidget* parent = Q_NULLPTR);
|
explicit EditEntryWidget(QWidget* parent = nullptr);
|
||||||
~EditEntryWidget();
|
~EditEntryWidget();
|
||||||
|
|
||||||
void loadEntry(Entry* entry, bool create, bool history, const QString& parentName,
|
void loadEntry(Entry* entry, bool create, bool history, const QString& parentName,
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
EntryAttachmentsModel::EntryAttachmentsModel(QObject* parent)
|
EntryAttachmentsModel::EntryAttachmentsModel(QObject* parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, m_entryAttachments(Q_NULLPTR)
|
, m_entryAttachments(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class EntryAttachments;
|
class EntryAttachments;
|
||||||
|
|
||||||
class EntryAttachmentsModel : public QAbstractListModel
|
class EntryAttachmentsModel : public QAbstractListModel
|
||||||
@ -29,11 +27,11 @@ class EntryAttachmentsModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryAttachmentsModel(QObject* parent = Q_NULLPTR);
|
explicit EntryAttachmentsModel(QObject* parent = nullptr);
|
||||||
void setEntryAttachments(EntryAttachments* entry);
|
void setEntryAttachments(EntryAttachments* entry);
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
QString keyByIndex(const QModelIndex& index) const;
|
QString keyByIndex(const QModelIndex& index) const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
EntryAttributesModel::EntryAttributesModel(QObject* parent)
|
EntryAttributesModel::EntryAttributesModel(QObject* parent)
|
||||||
: QAbstractListModel(parent)
|
: QAbstractListModel(parent)
|
||||||
, m_entryAttributes(Q_NULLPTR)
|
, m_entryAttributes(nullptr)
|
||||||
, m_nextRenameDataChange(false)
|
, m_nextRenameDataChange(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class EntryAttributes;
|
class EntryAttributes;
|
||||||
|
|
||||||
class EntryAttributesModel : public QAbstractListModel
|
class EntryAttributesModel : public QAbstractListModel
|
||||||
@ -29,14 +27,14 @@ class EntryAttributesModel : public QAbstractListModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryAttributesModel(QObject* parent = Q_NULLPTR);
|
explicit EntryAttributesModel(QObject* parent = nullptr);
|
||||||
void setEntryAttributes(EntryAttributes* entryAttributes);
|
void setEntryAttributes(EntryAttributes* entryAttributes);
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
|
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
|
||||||
Qt::ItemFlags flags(const QModelIndex& index) const Q_DECL_OVERRIDE;
|
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||||
QModelIndex indexByKey(const QString& key) const;
|
QModelIndex indexByKey(const QString& key) const;
|
||||||
QString keyByIndex(const QModelIndex& index) const;
|
QString keyByIndex(const QModelIndex& index) const;
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class Entry;
|
class Entry;
|
||||||
|
|
||||||
class EntryHistoryModel : public QAbstractTableModel
|
class EntryHistoryModel : public QAbstractTableModel
|
||||||
@ -29,13 +27,13 @@ class EntryHistoryModel : public QAbstractTableModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryHistoryModel(QObject* parent = Q_NULLPTR);
|
explicit EntryHistoryModel(QObject* parent = nullptr);
|
||||||
|
|
||||||
Entry* entryFromIndex(const QModelIndex& index) const;
|
Entry* entryFromIndex(const QModelIndex& index) const;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||||
|
|
||||||
void setEntries(const QList<Entry*>& entries);
|
void setEntries(const QList<Entry*>& entries);
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
EntryModel::EntryModel(QObject* parent)
|
EntryModel::EntryModel(QObject* parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
, m_group(Q_NULLPTR)
|
, m_group(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ void EntryModel::setEntryList(const QList<Entry*>& entries)
|
|||||||
|
|
||||||
severConnections();
|
severConnections();
|
||||||
|
|
||||||
m_group = Q_NULLPTR;
|
m_group = nullptr;
|
||||||
m_allGroups.clear();
|
m_allGroups.clear();
|
||||||
m_entries = entries;
|
m_entries = entries;
|
||||||
m_orgEntries = entries;
|
m_orgEntries = entries;
|
||||||
@ -215,7 +215,7 @@ QStringList EntryModel::mimeTypes() const
|
|||||||
QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const
|
QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const
|
||||||
{
|
{
|
||||||
if (indexes.isEmpty()) {
|
if (indexes.isEmpty()) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData* data = new QMimeData();
|
QMimeData* data = new QMimeData();
|
||||||
@ -240,7 +240,7 @@ QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const
|
|||||||
|
|
||||||
if (seenEntries.isEmpty()) {
|
if (seenEntries.isEmpty()) {
|
||||||
delete data;
|
delete data;
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data->setData(mimeTypes().first(), encoded);
|
data->setData(mimeTypes().first(), encoded);
|
||||||
@ -298,11 +298,11 @@ void EntryModel::entryDataChanged(Entry* entry)
|
|||||||
void EntryModel::severConnections()
|
void EntryModel::severConnections()
|
||||||
{
|
{
|
||||||
if (m_group) {
|
if (m_group) {
|
||||||
disconnect(m_group, Q_NULLPTR, this, Q_NULLPTR);
|
disconnect(m_group, nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH (const Group* group, m_allGroups) {
|
Q_FOREACH (const Group* group, m_allGroups) {
|
||||||
disconnect(group, Q_NULLPTR, this, Q_NULLPTR);
|
disconnect(group, nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class Entry;
|
class Entry;
|
||||||
class Group;
|
class Group;
|
||||||
|
|
||||||
@ -38,19 +36,19 @@ public:
|
|||||||
Url = 3
|
Url = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit EntryModel(QObject* parent = Q_NULLPTR);
|
explicit EntryModel(QObject* parent = nullptr);
|
||||||
Entry* entryFromIndex(const QModelIndex& index) const;
|
Entry* entryFromIndex(const QModelIndex& index) const;
|
||||||
QModelIndex indexFromEntry(Entry* entry) const;
|
QModelIndex indexFromEntry(Entry* entry) const;
|
||||||
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
|
Qt::DropActions supportedDropActions() const override;
|
||||||
Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE;
|
Qt::DropActions supportedDragActions() const override;
|
||||||
Qt::ItemFlags flags(const QModelIndex& modelIndex) const Q_DECL_OVERRIDE;
|
Qt::ItemFlags flags(const QModelIndex& modelIndex) const override;
|
||||||
QStringList mimeTypes() const Q_DECL_OVERRIDE;
|
QStringList mimeTypes() const override;
|
||||||
QMimeData* mimeData(const QModelIndexList& indexes) const Q_DECL_OVERRIDE;
|
QMimeData* mimeData(const QModelIndexList& indexes) const override;
|
||||||
|
|
||||||
void setEntryList(const QList<Entry*>& entries);
|
void setEntryList(const QList<Entry*>& entries);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ Entry* EntryView::currentEntry()
|
|||||||
return m_model->entryFromIndex(m_sortModel->mapToSource(list.first()));
|
return m_model->entryFromIndex(m_sortModel->mapToSource(list.first()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ Entry* EntryView::entryFromIndex(const QModelIndex& index)
|
|||||||
return m_model->entryFromIndex(m_sortModel->mapToSource(index));
|
return m_model->entryFromIndex(m_sortModel->mapToSource(index));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
#include "gui/entry/EntryModel.h"
|
#include "gui/entry/EntryModel.h"
|
||||||
|
|
||||||
class Entry;
|
class Entry;
|
||||||
@ -34,8 +32,8 @@ class EntryView : public QTreeView
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EntryView(QWidget* parent = Q_NULLPTR);
|
explicit EntryView(QWidget* parent = nullptr);
|
||||||
void setModel(QAbstractItemModel* model) Q_DECL_OVERRIDE;
|
void setModel(QAbstractItemModel* model) override;
|
||||||
Entry* currentEntry();
|
Entry* currentEntry();
|
||||||
void setCurrentEntry(Entry* entry);
|
void setCurrentEntry(Entry* entry);
|
||||||
Entry* entryFromIndex(const QModelIndex& index);
|
Entry* entryFromIndex(const QModelIndex& index);
|
||||||
@ -52,7 +50,7 @@ Q_SIGNALS:
|
|||||||
void entrySelectionChanged();
|
void entrySelectionChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
|
void keyPressEvent(QKeyEvent* event) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void emitEntryActivated(const QModelIndex& index);
|
void emitEntryActivated(const QModelIndex& index);
|
||||||
|
@ -28,8 +28,8 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
|
|||||||
, m_editGroupWidgetMain(new QWidget())
|
, m_editGroupWidgetMain(new QWidget())
|
||||||
, m_editGroupWidgetIcons(new EditWidgetIcons())
|
, m_editGroupWidgetIcons(new EditWidgetIcons())
|
||||||
, m_editWidgetProperties(new EditWidgetProperties())
|
, m_editWidgetProperties(new EditWidgetProperties())
|
||||||
, m_group(Q_NULLPTR)
|
, m_group(nullptr)
|
||||||
, m_database(Q_NULLPTR)
|
, m_database(nullptr)
|
||||||
{
|
{
|
||||||
m_mainUi->setupUi(m_editGroupWidgetMain);
|
m_mainUi->setupUi(m_editGroupWidgetMain);
|
||||||
|
|
||||||
@ -142,8 +142,8 @@ void EditGroupWidget::cancel()
|
|||||||
|
|
||||||
void EditGroupWidget::clear()
|
void EditGroupWidget::clear()
|
||||||
{
|
{
|
||||||
m_group = Q_NULLPTR;
|
m_group = nullptr;
|
||||||
m_database = Q_NULLPTR;
|
m_database = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditGroupWidget::addTriStateItems(QComboBox* comboBox, bool inheritDefault)
|
void EditGroupWidget::addTriStateItems(QComboBox* comboBox, bool inheritDefault)
|
||||||
|
@ -37,7 +37,7 @@ class EditGroupWidget : public EditWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EditGroupWidget(QWidget* parent = Q_NULLPTR);
|
explicit EditGroupWidget(QWidget* parent = nullptr);
|
||||||
~EditGroupWidget();
|
~EditGroupWidget();
|
||||||
|
|
||||||
void loadGroup(Group* group, bool create, Database* database);
|
void loadGroup(Group* group, bool create, Database* database);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
GroupModel::GroupModel(Database* db, QObject* parent)
|
GroupModel::GroupModel(Database* db, QObject* parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
, m_db(Q_NULLPTR)
|
, m_db(nullptr)
|
||||||
{
|
{
|
||||||
changeDatabase(db);
|
changeDatabase(db);
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ QStringList GroupModel::mimeTypes() const
|
|||||||
QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const
|
QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const
|
||||||
{
|
{
|
||||||
if (indexes.isEmpty()) {
|
if (indexes.isEmpty()) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMimeData* data = new QMimeData();
|
QMimeData* data = new QMimeData();
|
||||||
@ -354,7 +354,7 @@ QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const
|
|||||||
|
|
||||||
if (seenGroups.isEmpty()) {
|
if (seenGroups.isEmpty()) {
|
||||||
delete data;
|
delete data;
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data->setData(mimeTypes().first(), encoded);
|
data->setData(mimeTypes().first(), encoded);
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
#include "core/Global.h"
|
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class Group;
|
class Group;
|
||||||
|
|
||||||
@ -30,23 +28,23 @@ class GroupModel : public QAbstractItemModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GroupModel(Database* db, QObject* parent = Q_NULLPTR);
|
explicit GroupModel(Database* db, QObject* parent = nullptr);
|
||||||
void changeDatabase(Database* newDb);
|
void changeDatabase(Database* newDb);
|
||||||
QModelIndex index(Group* group) const;
|
QModelIndex index(Group* group) const;
|
||||||
Group* groupFromIndex(const QModelIndex& index) const;
|
Group* groupFromIndex(const QModelIndex& index) const;
|
||||||
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||||
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
|
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QModelIndex parent(const QModelIndex& index) const Q_DECL_OVERRIDE;
|
QModelIndex parent(const QModelIndex& index) const override;
|
||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||||
Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
|
Qt::DropActions supportedDropActions() const override;
|
||||||
Qt::ItemFlags flags(const QModelIndex& modelIndex) const Q_DECL_OVERRIDE;
|
Qt::ItemFlags flags(const QModelIndex& modelIndex) const override;
|
||||||
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
|
bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
|
||||||
const QModelIndex& parent) Q_DECL_OVERRIDE;
|
const QModelIndex& parent) override;
|
||||||
QStringList mimeTypes() const Q_DECL_OVERRIDE;
|
QStringList mimeTypes() const override;
|
||||||
QMimeData* mimeData(const QModelIndexList& indexes) const Q_DECL_OVERRIDE;
|
QMimeData* mimeData(const QModelIndexList& indexes) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QModelIndex parent(Group* group) const;
|
QModelIndex parent(Group* group) const;
|
||||||
|
@ -75,7 +75,7 @@ void GroupView::dragMoveEvent(QDragMoveEvent* event)
|
|||||||
Group* GroupView::currentGroup()
|
Group* GroupView::currentGroup()
|
||||||
{
|
{
|
||||||
if (currentIndex() == QModelIndex()) {
|
if (currentIndex() == QModelIndex()) {
|
||||||
return Q_NULLPTR;
|
return nullptr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return m_model->groupFromIndex(currentIndex());
|
return m_model->groupFromIndex(currentIndex());
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user