From 6ab54bc95a9cc0baaa3a787fa554b7bfdcfdc227 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Wed, 23 Sep 2015 22:26:49 +0200 Subject: [PATCH 1/7] Check if libXi is installed and explicitly link against it. --- src/autotype/CMakeLists.txt | 3 ++- src/autotype/x11/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/autotype/CMakeLists.txt b/src/autotype/CMakeLists.txt index 0bf5fc25..a0f7877f 100644 --- a/src/autotype/CMakeLists.txt +++ b/src/autotype/CMakeLists.txt @@ -1,10 +1,11 @@ if(Q_WS_X11) find_package(X11) if(PRINT_SUMMARY) + add_feature_info(libXi X11_Xi_FOUND "The X11 Xi Protocol library is required for auto-type") add_feature_info(libXtest X11_XTest_FOUND "The X11 XTEST Protocol library is required for auto-type") endif() - if(X11_FOUND AND X11_XTest_FOUND) + if(X11_FOUND AND X11_Xi_FOUND AND X11_XTest_FOUND) add_subdirectory(x11) endif() endif() diff --git a/src/autotype/x11/CMakeLists.txt b/src/autotype/x11/CMakeLists.txt index e9835577..cc401f7e 100644 --- a/src/autotype/x11/CMakeLists.txt +++ b/src/autotype/x11/CMakeLists.txt @@ -11,7 +11,7 @@ set(autotype_X11_MOC qt4_wrap_cpp(autotype_X11_SOURCES ${autotype_X11_MOC}) add_library(keepassx-autotype-x11 MODULE ${autotype_X11_SOURCES}) -target_link_libraries(keepassx-autotype-x11 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${X11_X11_LIB} ${X11_XTest_LIB}) +target_link_libraries(keepassx-autotype-x11 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_XTest_LIB}) install(TARGETS keepassx-autotype-x11 BUNDLE DESTINATION . COMPONENT Runtime LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} COMPONENT Runtime) From 54f44f526742caf3e080aded9fddc9aed763fbc5 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Wed, 23 Sep 2015 23:16:49 +0200 Subject: [PATCH 2/7] Show a better message when trying to open an old database format. Refs #338 --- src/format/KeePass2Reader.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/format/KeePass2Reader.cpp b/src/format/KeePass2Reader.cpp index 2a25001c..adde8cdb 100644 --- a/src/format/KeePass2Reader.cpp +++ b/src/format/KeePass2Reader.cpp @@ -24,6 +24,7 @@ #include "core/Database.h" #include "core/Endian.h" #include "crypto/CryptoHash.h" +#include "format/KeePass1.h" #include "format/KeePass2.h" #include "format/KeePass2RandomStream.h" #include "format/KeePass2XmlReader.h" @@ -70,7 +71,14 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke } quint32 signature2 = Endian::readUInt32(m_headerStream, KeePass2::BYTEORDER, &ok); - if (!ok || signature2 != KeePass2::SIGNATURE_2) { + if (ok && signature2 == KeePass1::SIGNATURE_2) { + raiseError(tr("The selected file is an old KeePass 1 database (.kdb).\n\n" + "You can import it by clicking on Database > 'Import KeePass 1 database'.\n" + "This is a one-way migration. You won't be able to open the imported " + "database with the old KeePassX 0.4 version.")); + return Q_NULLPTR; + } + else if (!ok || signature2 != KeePass2::SIGNATURE_2) { raiseError(tr("Not a KeePass database.")); return Q_NULLPTR; } From 2edf414aa424a65c13dc63fdae105dca2bb36ba1 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 24 Sep 2015 18:45:23 +0200 Subject: [PATCH 3/7] Fix compiler warning on OS X and Windows. --- src/gui/FileDialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/FileDialog.cpp b/src/gui/FileDialog.cpp index 7dd02b17..84482585 100644 --- a/src/gui/FileDialog.cpp +++ b/src/gui/FileDialog.cpp @@ -67,6 +67,7 @@ QString FileDialog::getSaveFileName(QWidget* parent, const QString& caption, QSt QString result; #if defined(Q_OS_MAC) || defined(Q_OS_WIN) + Q_UNUSED(defaultExtension); // the native dialogs on these platforms already append the file extension result = QFileDialog::getSaveFileName(parent, caption, dir, filter, selectedFilter, options); From ee81c7c00ef1caaefbd9d8a5fdd8adb398f9ce74 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 24 Sep 2015 23:03:12 +0200 Subject: [PATCH 4/7] Remove WITH_LTO option. It's broken and probably not worth the potential again. Refs #353 --- CMakeLists.txt | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55458617..233f0f92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,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") @@ -101,20 +100,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,relro") endif() -if(WITH_LTO) - if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX) - check_cxx_compiler_flag("-flto -fuse-linker-plugin" LTO_AVAILABLE) - - if(LTO_AVAILABLE) - add_gcc_compiler_flags("-flto -fuse-linker-plugin") - else() - message(FATAL_ERROR "This version of gcc doesn't support LTO") - endif(LTO_AVAILABLE) - else() - message(FATAL_ERROR "LTO is only supported with gcc") - endif() -endif() - if (WITH_CXX11) add_gcc_compiler_cxxflags("-std=c++0x") add_gcc_compiler_cflags("-ansi") From 9d42db98498134f7222ba39b47d2332f77e0f5b8 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Fri, 25 Sep 2015 16:59:12 +0200 Subject: [PATCH 5/7] Mark more methods as override. --- src/autotype/test/AutoTypeTest.h | 32 ++++++++++++++++---------------- src/autotype/x11/AutoTypeX11.h | 22 +++++++++++----------- src/gui/group/GroupModel.h | 4 ++-- src/gui/group/GroupView.h | 2 +- src/streams/HashedBlockStream.h | 4 ++-- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/autotype/test/AutoTypeTest.h b/src/autotype/test/AutoTypeTest.h index c21ff3be..94056416 100644 --- a/src/autotype/test/AutoTypeTest.h +++ b/src/autotype/test/AutoTypeTest.h @@ -33,23 +33,23 @@ class AutoTypePlatformTest : public QObject, Q_INTERFACES(AutoTypePlatformInterface AutoTypeTestInterface) public: - QString keyToString(Qt::Key key); + QString keyToString(Qt::Key key) Q_DECL_OVERRIDE; - QStringList windowTitles(); - WId activeWindow(); - QString activeWindowTitle(); - bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); - void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); - int platformEventFilter(void* event); - int initialTimeout(); - bool raiseWindow(WId window); - AutoTypeExecutor* createExecutor(); + QStringList windowTitles() Q_DECL_OVERRIDE; + WId activeWindow() Q_DECL_OVERRIDE; + QString activeWindowTitle() Q_DECL_OVERRIDE; + bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; + void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; + int platformEventFilter(void* event) Q_DECL_OVERRIDE; + int initialTimeout() Q_DECL_OVERRIDE; + bool raiseWindow(WId window) Q_DECL_OVERRIDE; + AutoTypeExecutor* createExecutor() Q_DECL_OVERRIDE; - void setActiveWindowTitle(const QString& title); + void setActiveWindowTitle(const QString& title) Q_DECL_OVERRIDE; - QString actionChars(); - int actionCount(); - void clearActions(); + QString actionChars() Q_DECL_OVERRIDE; + int actionCount() Q_DECL_OVERRIDE; + void clearActions() Q_DECL_OVERRIDE; void addActionChar(AutoTypeChar* action); void addActionKey(AutoTypeKey* action); @@ -68,8 +68,8 @@ class AutoTypeExecturorTest : public AutoTypeExecutor public: explicit AutoTypeExecturorTest(AutoTypePlatformTest* platform); - void execChar(AutoTypeChar* action); - void execKey(AutoTypeKey* action); + void execChar(AutoTypeChar* action) Q_DECL_OVERRIDE; + void execKey(AutoTypeKey* action) Q_DECL_OVERRIDE; private: AutoTypePlatformTest* const m_platform; diff --git a/src/autotype/x11/AutoTypeX11.h b/src/autotype/x11/AutoTypeX11.h index a1d6e9ff..a2080a84 100644 --- a/src/autotype/x11/AutoTypeX11.h +++ b/src/autotype/x11/AutoTypeX11.h @@ -43,15 +43,15 @@ class AutoTypePlatformX11 : public QObject, public AutoTypePlatformInterface public: AutoTypePlatformX11(); void unload() Q_DECL_OVERRIDE; - QStringList windowTitles(); - WId activeWindow(); - QString activeWindowTitle(); - bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); - void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); - int platformEventFilter(void* event); - int initialTimeout(); - bool raiseWindow(WId window); - AutoTypeExecutor* createExecutor(); + QStringList windowTitles() Q_DECL_OVERRIDE; + WId activeWindow() Q_DECL_OVERRIDE; + QString activeWindowTitle() Q_DECL_OVERRIDE; + bool registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; + void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; + int platformEventFilter(void* event) Q_DECL_OVERRIDE; + int initialTimeout() Q_DECL_OVERRIDE; + bool raiseWindow(WId window) Q_DECL_OVERRIDE; + AutoTypeExecutor* createExecutor() Q_DECL_OVERRIDE; KeySym charToKeySym(const QChar& ch); KeySym keyToKeySym(Qt::Key key); @@ -122,8 +122,8 @@ class AutoTypeExecturorX11 : public AutoTypeExecutor public: explicit AutoTypeExecturorX11(AutoTypePlatformX11* platform); - void execChar(AutoTypeChar* action); - void execKey(AutoTypeKey* action); + void execChar(AutoTypeChar* action) Q_DECL_OVERRIDE; + void execKey(AutoTypeKey* action) Q_DECL_OVERRIDE; private: AutoTypePlatformX11* const m_platform; diff --git a/src/gui/group/GroupModel.h b/src/gui/group/GroupModel.h index 173ea3a2..752eb2b2 100644 --- a/src/gui/group/GroupModel.h +++ b/src/gui/group/GroupModel.h @@ -35,8 +35,8 @@ public: 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; + int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; + int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; 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; diff --git a/src/gui/group/GroupView.h b/src/gui/group/GroupView.h index 98073f63..06bdbafa 100644 --- a/src/gui/group/GroupView.h +++ b/src/gui/group/GroupView.h @@ -49,7 +49,7 @@ private Q_SLOTS: void modelReset(); protected: - void dragMoveEvent(QDragMoveEvent* event); + void dragMoveEvent(QDragMoveEvent* event) Q_DECL_OVERRIDE; private: void recInitExpanded(Group* group); diff --git a/src/streams/HashedBlockStream.h b/src/streams/HashedBlockStream.h index f38d5716..cae4eb4a 100644 --- a/src/streams/HashedBlockStream.h +++ b/src/streams/HashedBlockStream.h @@ -31,8 +31,8 @@ public: HashedBlockStream(QIODevice* baseDevice, qint32 blockSize); ~HashedBlockStream(); - bool reset(); - void close(); + bool reset() Q_DECL_OVERRIDE; + void close() Q_DECL_OVERRIDE; protected: qint64 readData(char* data, qint64 maxSize) Q_DECL_OVERRIDE; From 14aac093186ac5bd856ca610737acc88a9969602 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Fri, 25 Sep 2015 17:06:37 +0200 Subject: [PATCH 6/7] Avoid implicit casts from bool to int. --- src/autotype/x11/AutoTypeX11.cpp | 37 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/autotype/x11/AutoTypeX11.cpp b/src/autotype/x11/AutoTypeX11.cpp index 87000222..98d68a16 100644 --- a/src/autotype/x11/AutoTypeX11.cpp +++ b/src/autotype/x11/AutoTypeX11.cpp @@ -30,12 +30,12 @@ AutoTypePlatformX11::AutoTypePlatformX11() m_dpy = QX11Info::display(); m_rootWindow = QX11Info::appRootWindow(); - m_atomWmState = XInternAtom(m_dpy, "WM_STATE", true); - m_atomWmName = XInternAtom(m_dpy, "WM_NAME", true); - m_atomNetWmName = XInternAtom(m_dpy, "_NET_WM_NAME", true); - m_atomString = XInternAtom(m_dpy, "STRING", true); - m_atomUtf8String = XInternAtom(m_dpy, "UTF8_STRING", true); - m_atomNetActiveWindow = XInternAtom(m_dpy, "_NET_ACTIVE_WINDOW", true); + m_atomWmState = XInternAtom(m_dpy, "WM_STATE", True); + m_atomWmName = XInternAtom(m_dpy, "WM_NAME", True); + m_atomNetWmName = XInternAtom(m_dpy, "_NET_WM_NAME", True); + m_atomString = XInternAtom(m_dpy, "STRING", True); + m_atomUtf8String = XInternAtom(m_dpy, "UTF8_STRING", True); + m_atomNetActiveWindow = XInternAtom(m_dpy, "_NET_ACTIVE_WINDOW", True); m_classBlacklist << "desktop_window" << "gnome-panel"; // Gnome m_classBlacklist << "kdesktop" << "kicker"; // KDE 3 @@ -117,12 +117,12 @@ bool AutoTypePlatformX11::registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifi uint nativeModifiers = qtToNativeModifiers(modifiers); startCatchXErrors(); - XGrabKey(m_dpy, keycode, nativeModifiers, m_rootWindow, true, GrabModeAsync, GrabModeAsync); - XGrabKey(m_dpy, keycode, nativeModifiers | Mod2Mask, m_rootWindow, true, GrabModeAsync, + XGrabKey(m_dpy, keycode, nativeModifiers, m_rootWindow, True, GrabModeAsync, GrabModeAsync); + XGrabKey(m_dpy, keycode, nativeModifiers | Mod2Mask, m_rootWindow, True, GrabModeAsync, GrabModeAsync); - XGrabKey(m_dpy, keycode, nativeModifiers | LockMask, m_rootWindow, true, GrabModeAsync, + XGrabKey(m_dpy, keycode, nativeModifiers | LockMask, m_rootWindow, True, GrabModeAsync, GrabModeAsync); - XGrabKey(m_dpy, keycode, nativeModifiers | Mod2Mask | LockMask, m_rootWindow, true, + XGrabKey(m_dpy, keycode, nativeModifiers | Mod2Mask | LockMask, m_rootWindow, True, GrabModeAsync, GrabModeAsync); stopCatchXErrors(); @@ -215,7 +215,7 @@ QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist) // the window manager spec says we should read _NET_WM_NAME first, then fall back to WM_NAME - int retVal = XGetWindowProperty(m_dpy, window, m_atomNetWmName, 0, 1000, false, m_atomUtf8String, + int retVal = XGetWindowProperty(m_dpy, window, m_atomNetWmName, 0, 1000, False, m_atomUtf8String, &type, &format, &nitems, &after, &data); if ((retVal == 0) && data) { @@ -338,7 +338,7 @@ bool AutoTypePlatformX11::isTopLevelWindow(Window window) unsigned long nitems; unsigned long after; unsigned char* data = Q_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); if (data) { XFree(data); @@ -520,7 +520,7 @@ void AutoTypePlatformX11::stopCatchXErrors() { Q_ASSERT(m_catchXErrors); - XSync(m_dpy, false); + XSync(m_dpy, False); XSetErrorHandler(m_oldXErrorHandler); m_catchXErrors = false; } @@ -569,11 +569,18 @@ int AutoTypePlatformX11::AddKeysym(KeySym keysym) */ void AutoTypePlatformX11::SendEvent(XKeyEvent* event, int event_type) { - XSync(event->display, FALSE); + XSync(event->display, False); int (*oldHandler) (Display*, XErrorEvent*) = XSetErrorHandler(MyErrorHandler); event->type = event_type; - XTestFakeKeyEvent(event->display, event->keycode, event->type == KeyPress, 0); + Bool press; + if (event->type == KeyPress) { + press = True; + } + else { + press = False; + } + XTestFakeKeyEvent(event->display, event->keycode, press, 0); XFlush(event->display); XSetErrorHandler(oldHandler); From bcb54bc38aa3392fa599cfc29f4ec84e4794bf35 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Fri, 25 Sep 2015 21:33:55 +0200 Subject: [PATCH 7/7] Avoid dereferencing QLists. --- src/gui/entry/EntryModel.cpp | 2 +- src/gui/group/GroupModel.cpp | 2 +- tests/TestEntry.cpp | 2 +- tests/TestExporter.cpp | 6 +++--- tests/TestKeePass1Reader.cpp | 4 ++-- tests/TestKeePass2XmlReader.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp index 7ee1df8f..c75d38a1 100644 --- a/src/gui/entry/EntryModel.cpp +++ b/src/gui/entry/EntryModel.cpp @@ -239,7 +239,7 @@ QMimeData* EntryModel::mimeData(const QModelIndexList& indexes) const return Q_NULLPTR; } else { - data->setData(mimeTypes().first(), encoded); + data->setData(mimeTypes().at(0), encoded); return data; } } diff --git a/src/gui/group/GroupModel.cpp b/src/gui/group/GroupModel.cpp index b33a5ff5..21f8c7e3 100644 --- a/src/gui/group/GroupModel.cpp +++ b/src/gui/group/GroupModel.cpp @@ -357,7 +357,7 @@ QMimeData* GroupModel::mimeData(const QModelIndexList& indexes) const return Q_NULLPTR; } else { - data->setData(mimeTypes().first(), encoded); + data->setData(mimeTypes().at(0), encoded); return data; } } diff --git a/tests/TestEntry.cpp b/tests/TestEntry.cpp index 477e83b8..f918b6cc 100644 --- a/tests/TestEntry.cpp +++ b/tests/TestEntry.cpp @@ -120,6 +120,6 @@ void TestEntry::testClone() QCOMPARE(entryCloneNone->uuid(), entryOrg->uuid()); QCOMPARE(entryCloneHistory->title(), QString("New Title")); QCOMPARE(entryCloneHistory->historyItems().size(), 1); - QCOMPARE(entryCloneHistory->historyItems().first()->title(), QString("Original Title")); + QCOMPARE(entryCloneHistory->historyItems().at(0)->title(), QString("Original Title")); QCOMPARE(entryCloneHistory->timeInfo().creationTime(), entryOrg->timeInfo().creationTime()); } diff --git a/tests/TestExporter.cpp b/tests/TestExporter.cpp index d703e02f..76a6f75c 100644 --- a/tests/TestExporter.cpp +++ b/tests/TestExporter.cpp @@ -60,19 +60,19 @@ void TestExporter::testToDbExporter() Database* dbExp = ToDbExporter().exportGroup(groupOrg); QCOMPARE(dbExp->rootGroup()->children().size(), 1); - Group* groupExp = dbExp->rootGroup()->children().first(); + Group* groupExp = dbExp->rootGroup()->children().at(0); QVERIFY(groupExp != groupOrg); QCOMPARE(groupExp->name(), groupOrg->name()); QCOMPARE(groupExp->entries().size(), 1); - Entry* entryExp = groupExp->entries().first(); + Entry* entryExp = groupExp->entries().at(0); QCOMPARE(entryExp->title(), entryOrg->title()); QCOMPARE(dbExp->metadata()->customIcons().size(), 1); QVERIFY(dbExp->metadata()->containsCustomIcon(iconUuid)); QCOMPARE(entryExp->iconNumber(), entryOrg->iconNumber()); QCOMPARE(entryExp->historyItems().size(), 1); - QCOMPARE(entryExp->historyItems().first()->iconUuid(), iconUuid); + QCOMPARE(entryExp->historyItems().at(0)->iconUuid(), iconUuid); delete dbOrg; delete dbExp; diff --git a/tests/TestKeePass1Reader.cpp b/tests/TestKeePass1Reader.cpp index 249a3657..d9dff9e4 100644 --- a/tests/TestKeePass1Reader.cpp +++ b/tests/TestKeePass1Reader.cpp @@ -71,7 +71,7 @@ void TestKeePass1Reader::testBasic() QVERIFY(entry11->timeInfo().expires()); QCOMPARE(entry11->timeInfo().expiryTime(), genDT(2012, 5, 9, 10, 32)); QCOMPARE(entry11->attachments()->keys().size(), 1); - QCOMPARE(entry11->attachments()->keys().first(), QString("attachment.txt")); + QCOMPARE(entry11->attachments()->keys().at(0), QString("attachment.txt")); QCOMPARE(entry11->attachments()->value("attachment.txt"), QByteArray("hello world\n")); Entry* entry12 = group1->entries().at(1); @@ -118,7 +118,7 @@ void TestKeePass1Reader::testCustomIcons() { QCOMPARE(m_db->metadata()->customIcons().size(), 1); - Entry* entry = m_db->rootGroup()->children().at(1)->entries().first(); + Entry* entry = m_db->rootGroup()->children().at(1)->entries().at(0); QCOMPARE(entry->icon().width(), 16); QCOMPARE(entry->icon().height(), 16); diff --git a/tests/TestKeePass2XmlReader.cpp b/tests/TestKeePass2XmlReader.cpp index b458761d..81690009 100644 --- a/tests/TestKeePass2XmlReader.cpp +++ b/tests/TestKeePass2XmlReader.cpp @@ -315,7 +315,7 @@ void TestKeePass2XmlReader::testEntry2() void TestKeePass2XmlReader::testEntryHistory() { - const Entry* entryMain = m_db->rootGroup()->entries().first(); + const Entry* entryMain = m_db->rootGroup()->entries().at(0); QCOMPARE(entryMain->historyItems().size(), 2); {