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