Initial commit
authorTimothy Redaelli <timothy@redaelli.eu>
Tue, 15 Dec 2009 17:04:32 +0000 (18:04 +0100)
committerTimothy Redaelli <timothy@redaelli.eu>
Tue, 15 Dec 2009 17:04:32 +0000 (18:04 +0100)
313 files changed:
CMakeLists.txt [new file with mode: 0644]
COPYING [new file with mode: 0644]
INSTALL [new file with mode: 0644]
changelog [new file with mode: 0644]
cmake/FindPCHSupport.cmake [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/keepass.1 [new file with mode: 0644]
debian/patches/00list [new file with mode: 0644]
debian/patches/10_RemoveSystray.dpatch [new file with mode: 0755]
debian/patches/20_LargeIcons.dpatch [new file with mode: 0755]
debian/rules [new file with mode: 0755]
keepassx.pro [new file with mode: 0644]
share/CMakeLists.txt [new file with mode: 0644]
share/applications/keepassx.desktop [new file with mode: 0644]
share/keepassx/i18n/keepassx-de_DE.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-es_ES.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-fi_FI.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-fr_FR.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-gl_ES.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-hu_HU.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-it_IT.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-nb_NO.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-nl_NL.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-pl_PL.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-ru_RU.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-tr_TR.qm [new file with mode: 0644]
share/keepassx/i18n/keepassx-zh_CN.qm [new file with mode: 0644]
share/keepassx/i18n/qt_fi.qm [new file with mode: 0644]
share/keepassx/i18n/qt_hu.qm [new file with mode: 0644]
share/keepassx/i18n/qt_it.qm [new file with mode: 0644]
share/keepassx/i18n/qt_nl.qm [new file with mode: 0644]
share/keepassx/i18n/qt_tr.qm [new file with mode: 0644]
share/keepassx/icons/alarmclock.png [new file with mode: 0644]
share/keepassx/icons/appsettings.png [new file with mode: 0644]
share/keepassx/icons/autotype.png [new file with mode: 0644]
share/keepassx/icons/bookmark.png [new file with mode: 0644]
share/keepassx/icons/bookmark_add.png [new file with mode: 0644]
share/keepassx/icons/bookmark_del.png [new file with mode: 0644]
share/keepassx/icons/bookmark_edit.png [new file with mode: 0644]
share/keepassx/icons/bookmark_folder.png [new file with mode: 0644]
share/keepassx/icons/bookmark_this.png [new file with mode: 0644]
share/keepassx/icons/clientic.png [new file with mode: 0644]
share/keepassx/icons/clock.png [new file with mode: 0644]
share/keepassx/icons/cloneentry.png [new file with mode: 0644]
share/keepassx/icons/copypwd.png [new file with mode: 0644]
share/keepassx/icons/copyusername.png [new file with mode: 0644]
share/keepassx/icons/dbsearch.png [new file with mode: 0644]
share/keepassx/icons/dbsettings.png [new file with mode: 0644]
share/keepassx/icons/delete.png [new file with mode: 0644]
share/keepassx/icons/deleteentry.png [new file with mode: 0644]
share/keepassx/icons/deletegroup.png [new file with mode: 0644]
share/keepassx/icons/dice.png [new file with mode: 0644]
share/keepassx/icons/document.png [new file with mode: 0644]
share/keepassx/icons/down.png [new file with mode: 0644]
share/keepassx/icons/editentry.png [new file with mode: 0644]
share/keepassx/icons/editgroup.png [new file with mode: 0644]
share/keepassx/icons/exit.png [new file with mode: 0644]
share/keepassx/icons/expired.png [new file with mode: 0644]
share/keepassx/icons/fileclose.png [new file with mode: 0644]
share/keepassx/icons/filedelete.png [new file with mode: 0644]
share/keepassx/icons/filenew.png [new file with mode: 0644]
share/keepassx/icons/fileopen.png [new file with mode: 0644]
share/keepassx/icons/filesave.png [new file with mode: 0644]
share/keepassx/icons/filesaveas.png [new file with mode: 0644]
share/keepassx/icons/filesavedisabled.png [new file with mode: 0644]
share/keepassx/icons/generator.png [new file with mode: 0644]
share/keepassx/icons/go-home.png [new file with mode: 0644]
share/keepassx/icons/go-next.png [new file with mode: 0644]
share/keepassx/icons/go-previous.png [new file with mode: 0644]
share/keepassx/icons/groupsearch.png [new file with mode: 0644]
share/keepassx/icons/help.png [new file with mode: 0644]
share/keepassx/icons/help_about.png [new file with mode: 0644]
share/keepassx/icons/i18n.png [new file with mode: 0644]
share/keepassx/icons/keepassx.png [new file with mode: 0644]
share/keepassx/icons/keepassx_large.png [new file with mode: 0644]
share/keepassx/icons/keepassx_locked.png [new file with mode: 0644]
share/keepassx/icons/keepassx_small.png [new file with mode: 0644]
share/keepassx/icons/key.png [new file with mode: 0644]
share/keepassx/icons/lock.png [new file with mode: 0644]
share/keepassx/icons/manual.png [new file with mode: 0644]
share/keepassx/icons/newentry.png [new file with mode: 0644]
share/keepassx/icons/newgroup.png [new file with mode: 0644]
share/keepassx/icons/ok.png [new file with mode: 0644]
share/keepassx/icons/openurl.png [new file with mode: 0644]
share/keepassx/icons/pwd_hide.png [new file with mode: 0644]
share/keepassx/icons/pwd_show.png [new file with mode: 0644]
share/keepassx/icons/restore.png [new file with mode: 0644]
share/keepassx/icons/search.png [new file with mode: 0644]
share/keepassx/icons/swap.png [new file with mode: 0644]
share/keepassx/icons/templates.png [new file with mode: 0644]
share/keepassx/icons/text_block.png [new file with mode: 0644]
share/keepassx/icons/text_bold.png [new file with mode: 0644]
share/keepassx/icons/text_center.png [new file with mode: 0644]
share/keepassx/icons/text_italic.png [new file with mode: 0644]
share/keepassx/icons/text_left.png [new file with mode: 0644]
share/keepassx/icons/text_right.png [new file with mode: 0644]
share/keepassx/icons/text_under.png [new file with mode: 0644]
share/keepassx/icons/trashcan.png [new file with mode: 0644]
share/keepassx/icons/up.png [new file with mode: 0644]
share/keepassx/license.html [new file with mode: 0644]
share/macx_bundle/Info.plist [new file with mode: 0644]
share/macx_bundle/Info_cmake.plist [new file with mode: 0644]
share/macx_bundle/icon.icns [new file with mode: 0644]
share/mime/packages/keepassx.xml [new file with mode: 0644]
share/mimelnk/application/x-keepass.desktop [new file with mode: 0644]
share/pixmaps/keepassx.xpm [new file with mode: 0644]
share/win_ico/keepassx.ico [new file with mode: 0644]
share/win_ico/keepassx.rc [new file with mode: 0644]
src/Application_X11.cpp [new file with mode: 0644]
src/Application_X11.h [new file with mode: 0644]
src/CMakeLists.txt [new file with mode: 0644]
src/Database.cpp [new file with mode: 0644]
src/Database.h [new file with mode: 0644]
src/Kdb3Database.cpp [new file with mode: 0644]
src/Kdb3Database.h [new file with mode: 0644]
src/KpxConfig.cpp [new file with mode: 0644]
src/KpxConfig.h [new file with mode: 0644]
src/apg/convert.c [new file with mode: 0644]
src/apg/convert.h [new file with mode: 0644]
src/apg/owntypes.h [new file with mode: 0644]
src/apg/pronpass.c [new file with mode: 0644]
src/apg/pronpass.h [new file with mode: 0644]
src/apg/randpass.c [new file with mode: 0644]
src/apg/randpass.h [new file with mode: 0644]
src/apg/smbl.h [new file with mode: 0644]
src/crypto/aes.h [new file with mode: 0644]
src/crypto/aes_endian.h [new file with mode: 0644]
src/crypto/aes_modes.c [new file with mode: 0644]
src/crypto/aes_types.h [new file with mode: 0644]
src/crypto/aescpp.h [new file with mode: 0644]
src/crypto/aescrypt.c [new file with mode: 0644]
src/crypto/aeskey.c [new file with mode: 0644]
src/crypto/aesopt.h [new file with mode: 0644]
src/crypto/aestab.c [new file with mode: 0644]
src/crypto/aestab.h [new file with mode: 0644]
src/crypto/arcfour.cpp [new file with mode: 0644]
src/crypto/arcfour.h [new file with mode: 0644]
src/crypto/blowfish.cpp [new file with mode: 0644]
src/crypto/blowfish.h [new file with mode: 0644]
src/crypto/sha256.cpp [new file with mode: 0644]
src/crypto/sha256.h [new file with mode: 0644]
src/crypto/twoclass.cpp [new file with mode: 0644]
src/crypto/twoclass.h [new file with mode: 0644]
src/crypto/twofish.cpp [new file with mode: 0644]
src/crypto/twofish.h [new file with mode: 0644]
src/crypto/yarrow.cpp [new file with mode: 0644]
src/crypto/yarrow.h [new file with mode: 0644]
src/crypto/yarrow_macros.h [new file with mode: 0644]
src/dialogs/AboutDlg.cpp [new file with mode: 0644]
src/dialogs/AboutDlg.h [new file with mode: 0644]
src/dialogs/AddBookmarkDlg.cpp [new file with mode: 0644]
src/dialogs/AddBookmarkDlg.h [new file with mode: 0644]
src/dialogs/AutoTypeDlg.cpp [new file with mode: 0644]
src/dialogs/AutoTypeDlg.h [new file with mode: 0644]
src/dialogs/CalendarDlg.cpp [new file with mode: 0644]
src/dialogs/CalendarDlg.h [new file with mode: 0644]
src/dialogs/CollectEntropyDlg.cpp [new file with mode: 0644]
src/dialogs/CollectEntropyDlg.h [new file with mode: 0644]
src/dialogs/CustomizeDetailViewDlg.cpp [new file with mode: 0644]
src/dialogs/CustomizeDetailViewDlg.h [new file with mode: 0644]
src/dialogs/DatabaseSettingsDlg.cpp [new file with mode: 0644]
src/dialogs/DatabaseSettingsDlg.h [new file with mode: 0644]
src/dialogs/EditEntryDlg.cpp [new file with mode: 0644]
src/dialogs/EditEntryDlg.h [new file with mode: 0644]
src/dialogs/EditGroupDlg.cpp [new file with mode: 0644]
src/dialogs/EditGroupDlg.h [new file with mode: 0644]
src/dialogs/ExpiredEntriesDlg.cpp [new file with mode: 0644]
src/dialogs/ExpiredEntriesDlg.h [new file with mode: 0644]
src/dialogs/HelpDlg.cpp [new file with mode: 0644]
src/dialogs/HelpDlg.h [new file with mode: 0644]
src/dialogs/ManageBookmarksDlg.cpp [new file with mode: 0644]
src/dialogs/ManageBookmarksDlg.h [new file with mode: 0644]
src/dialogs/PasswordDlg.cpp [new file with mode: 0644]
src/dialogs/PasswordDlg.h [new file with mode: 0644]
src/dialogs/PasswordGenDlg.cpp [new file with mode: 0644]
src/dialogs/PasswordGenDlg.h [new file with mode: 0644]
src/dialogs/SearchDlg.cpp [new file with mode: 0644]
src/dialogs/SearchDlg.h [new file with mode: 0644]
src/dialogs/SelectIconDlg.cpp [new file with mode: 0644]
src/dialogs/SelectIconDlg.h [new file with mode: 0644]
src/dialogs/SettingsDlg.cpp [new file with mode: 0644]
src/dialogs/SettingsDlg.h [new file with mode: 0644]
src/dialogs/SimplePasswordDlg.cpp [new file with mode: 0644]
src/dialogs/SimplePasswordDlg.h [new file with mode: 0644]
src/dialogs/TargetWindowDlg.cpp [new file with mode: 0644]
src/dialogs/TargetWindowDlg.h [new file with mode: 0644]
src/dialogs/TrashCanDlg.cpp [new file with mode: 0644]
src/dialogs/TrashCanDlg.h [new file with mode: 0644]
src/export/Export.cpp [new file with mode: 0644]
src/export/Export.h [new file with mode: 0644]
src/export/Export_KeePassX_Xml.cpp [new file with mode: 0644]
src/export/Export_KeePassX_Xml.h [new file with mode: 0644]
src/export/Export_Txt.cpp [new file with mode: 0644]
src/export/Export_Txt.h [new file with mode: 0644]
src/forms/AboutDlg.ui [new file with mode: 0644]
src/forms/AddBookmarkDlg.ui [new file with mode: 0644]
src/forms/AutoTypeDlg.ui [new file with mode: 0644]
src/forms/CalendarDlg.ui [new file with mode: 0644]
src/forms/CollectEntropyDlg.ui [new file with mode: 0644]
src/forms/CustomizeDetailViewDlg.ui [new file with mode: 0644]
src/forms/DatabaseSettingsDlg.ui [new file with mode: 0644]
src/forms/EditEntryDlg.ui [new file with mode: 0644]
src/forms/EditGroupDlg.ui [new file with mode: 0644]
src/forms/ExpiredEntriesDlg.ui [new file with mode: 0644]
src/forms/HelpDlg.ui [new file with mode: 0644]
src/forms/MainWindow.ui [new file with mode: 0644]
src/forms/ManageBookmarksDlg.ui [new file with mode: 0644]
src/forms/PasswordDlg.ui [new file with mode: 0644]
src/forms/PasswordGenDlg.ui [new file with mode: 0644]
src/forms/SearchDlg.ui [new file with mode: 0644]
src/forms/SelectIconDlg.ui [new file with mode: 0644]
src/forms/SettingsDlg.ui [new file with mode: 0644]
src/forms/SimplePasswordDlg.ui [new file with mode: 0644]
src/forms/TargetWindowDlg.ui [new file with mode: 0644]
src/forms/TrashCanDlg.ui [new file with mode: 0644]
src/forms/WorkspaceLockedWidget.ui [new file with mode: 0644]
src/import/Import.cpp [new file with mode: 0644]
src/import/Import.h [new file with mode: 0644]
src/import/Import_GnuKeyRing.cpp [new file with mode: 0644]
src/import/Import_GnuKeyRing.h [new file with mode: 0644]
src/import/Import_KWalletXml.cpp [new file with mode: 0644]
src/import/Import_KWalletXml.h [new file with mode: 0644]
src/import/Import_KeePassX_Xml.cpp [new file with mode: 0644]
src/import/Import_KeePassX_Xml.h [new file with mode: 0644]
src/import/Import_PwManager.cpp [new file with mode: 0644]
src/import/Import_PwManager.h [new file with mode: 0644]
src/keepassx.h [new file with mode: 0644]
src/lib/AutoType.h [new file with mode: 0644]
src/lib/AutoTypeGlobalX11.cpp [new file with mode: 0644]
src/lib/AutoTypeGlobalX11.h [new file with mode: 0644]
src/lib/AutoTypeTreeWidget.cpp [new file with mode: 0644]
src/lib/AutoTypeTreeWidget.h [new file with mode: 0644]
src/lib/AutoTypeX11.cpp [new file with mode: 0644]
src/lib/AutoTypeX11.h [new file with mode: 0644]
src/lib/EntryView.cpp [new file with mode: 0644]
src/lib/EntryView.h [new file with mode: 0644]
src/lib/FileDialogs.cpp [new file with mode: 0644]
src/lib/FileDialogs.h [new file with mode: 0644]
src/lib/GroupView.cpp [new file with mode: 0644]
src/lib/GroupView.h [new file with mode: 0644]
src/lib/HelperX11.cpp [new file with mode: 0644]
src/lib/HelperX11.h [new file with mode: 0644]
src/lib/SecString.cpp [new file with mode: 0644]
src/lib/SecString.h [new file with mode: 0644]
src/lib/ShortcutWidget.cpp [new file with mode: 0644]
src/lib/ShortcutWidget.h [new file with mode: 0644]
src/lib/UrlLabel.cpp [new file with mode: 0644]
src/lib/UrlLabel.h [new file with mode: 0644]
src/lib/WaitAnimationWidget.cpp [new file with mode: 0644]
src/lib/WaitAnimationWidget.h [new file with mode: 0644]
src/lib/bookmarks.cpp [new file with mode: 0644]
src/lib/bookmarks.h [new file with mode: 0644]
src/lib/random.cpp [new file with mode: 0644]
src/lib/random.h [new file with mode: 0644]
src/lib/tools.cpp [new file with mode: 0644]
src/lib/tools.h [new file with mode: 0644]
src/main.cpp [new file with mode: 0644]
src/main.h [new file with mode: 0644]
src/main_macx.cpp [new file with mode: 0644]
src/main_unix.cpp [new file with mode: 0644]
src/main_win32.cpp [new file with mode: 0644]
src/mainwindow.cpp [new file with mode: 0644]
src/mainwindow.h [new file with mode: 0644]
src/plugins/gnome/keepassx-gnome.cpp [new file with mode: 0644]
src/plugins/gnome/keepassx-gnome.h [new file with mode: 0644]
src/plugins/gnome/keepassx-gnome.pro [new file with mode: 0644]
src/plugins/interfaces/IFileDialog.h [new file with mode: 0644]
src/plugins/interfaces/IGnomeInit.h [new file with mode: 0644]
src/plugins/interfaces/IIconTheme.h [new file with mode: 0644]
src/plugins/interfaces/IKdeInit.h [new file with mode: 0644]
src/plugins/kde/KpKApplication.cpp [new file with mode: 0644]
src/plugins/kde/KpKApplication.h [new file with mode: 0644]
src/plugins/kde/keepassx-kde.cpp [new file with mode: 0644]
src/plugins/kde/keepassx-kde.h [new file with mode: 0644]
src/plugins/kde/keepassx-kde.pro [new file with mode: 0644]
src/res/default-detailview-classic.html [new file with mode: 0644]
src/res/default-detailview.html [new file with mode: 0644]
src/res/docs/external.png [new file with mode: 0644]
src/res/docs/faq.html [new file with mode: 0644]
src/res/docs/features.html [new file with mode: 0644]
src/res/docs/index.html [new file with mode: 0644]
src/res/docs/installation.html [new file with mode: 0644]
src/res/docs/quickstart.html [new file with mode: 0644]
src/res/docs/systemreq.html [new file with mode: 0644]
src/res/resources.qrc [new file with mode: 0644]
src/src.pro [new file with mode: 0644]
src/translations/keepassx-cs_CZ.ts [new file with mode: 0644]
src/translations/keepassx-de_DE.ts [new file with mode: 0644]
src/translations/keepassx-es_ES.ts [new file with mode: 0644]
src/translations/keepassx-fi_FI.ts [new file with mode: 0644]
src/translations/keepassx-fr_FR.ts [new file with mode: 0644]
src/translations/keepassx-gl_ES.ts [new file with mode: 0644]
src/translations/keepassx-hu_HU.ts [new file with mode: 0644]
src/translations/keepassx-it_IT.ts [new file with mode: 0644]
src/translations/keepassx-ja_JP.ts [new file with mode: 0644]
src/translations/keepassx-nb_NO.ts [new file with mode: 0644]
src/translations/keepassx-nl_NL.ts [new file with mode: 0644]
src/translations/keepassx-pl_PL.ts [new file with mode: 0644]
src/translations/keepassx-ru_RU.ts [new file with mode: 0644]
src/translations/keepassx-tr_TR.ts [new file with mode: 0644]
src/translations/keepassx-uk_UA.ts [new file with mode: 0644]
src/translations/keepassx-xx_XX.ts [new file with mode: 0644]
src/translations/keepassx-zh_CN.ts [new file with mode: 0644]
src/translations/qt_fi.ts [new file with mode: 0644]
src/translations/qt_hu.ts [new file with mode: 0644]
src/translations/qt_it.ts [new file with mode: 0644]
src/translations/qt_nl.ts [new file with mode: 0644]
src/translations/qt_tr.ts [new file with mode: 0644]
translations_release.sh [new file with mode: 0755]
translations_update.sh [new file with mode: 0755]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6d98fe0
--- /dev/null
@@ -0,0 +1,96 @@
+# CMake is still experimental, use qmake instead
+
+PROJECT(KeePassX)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
+
+MESSAGE("CMake is still experimental, use qmake instead")
+
+SET( keepassx_VERSION_SHORT "0.4.0" )
+SET( keepassx_VERSION "0.4.0" )
+
+ADD_DEFINITIONS(-D'KEEPASSX_VERSION="${keepassx_VERSION}"')
+
+#Set the custom CMake module directory where our include/lib finders are
+SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+IF( APPLE OR MINGW )
+       SET( PROGNAME KeePassX )
+ELSE( APPLE OR MINGW )
+       SET( PROGNAME keepassx )
+ENDIF( APPLE OR MINGW )
+
+IF( APPLE )
+       SET( MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/share/macx_bundle/Info_cmake.plist )
+       SET( MACOSX_BUNDLE_ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/share/macx_bundle/icon.icns )
+       SET( MACOSX_BUNDLE_INFO_STRING KeePassX v${keepassx_VERSION} )
+       SET( MACOSX_BUNDLE_VERSION ${keepassx_VERSION} )
+       SET( MACOSX_BUNDLE_SHORT_VERSION_STRING ${keepassx_VERSION_SHORT} )
+       SET( MACOSX_BUNDLE_LONG_VERSION_STRING Version ${keepassx_VERSION} )
+       SET( CMAKE_OSX_ARCHITECTURES ppc;i386 )
+ENDIF( APPLE )
+
+IF( MINGW )
+       FIND_PROGRAM(CMAKE_RC NAMES ${_CMAKE_TOOLCHAIN_PREFIX}windres HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+       
+       ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/keepassx.o
+               COMMAND ${CMAKE_RC} -I${CMAKE_CURRENT_SOURCE_DIR}
+               -i${CMAKE_CURRENT_SOURCE_DIR}/share/win_ico/keepassx.rc -o ${CMAKE_CURRENT_BINARY_DIR}/keepassx.o )
+       SET(keepassx_RCS ${CMAKE_CURRENT_BINARY_DIR}/keepassx.o)
+ENDIF( MINGW )
+
+
+OPTION(PRECOMPILED_HEADER "Enable precompiled header (required gcc >= 3.4.0)" TRUE)
+IF( APPLE OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD )
+       SET(PRECOMPILED_HEADER FALSE)
+ENDIF( APPLE OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD )
+
+IF( PRECOMPILED_HEADER )
+       FIND_PACKAGE(PCHSupport)
+       IF(NOT PCHSupport_FOUND)
+               SET(PRECOMPILED_HEADER FALSE)
+       ENDIF(NOT PCHSupport_FOUND)
+ENDIF( PRECOMPILED_HEADER )
+
+
+SET(QT_MIN_VERSION "4.3.0")
+SET(QT_USE_QTXML TRUE)
+SET(QT_USE_QTMAIN TRUE)
+FIND_PACKAGE(Qt4 REQUIRED)
+INCLUDE(${QT_USE_FILE})
+
+
+OPTION(AUTOTYPE "Enable auto-type (X11 only)" TRUE)
+
+IF( NOT UNIX )
+       SET(AUTOTYPE FALSE)
+ENDIF( NOT UNIX )
+
+IF( AUTOTYPE )
+       find_package(X11)
+       
+       IF( X11_XTest_FOUND )
+               INCLUDE_DIRECTORIES( ${X11_XTest_INCLUDE_PATH} )
+               SET(AUTOTYPE_LIBRARIES ${X11_XTest_LIB})
+               ADD_DEFINITIONS(-DAUTOTYPE -DGLOBAL_AUTOTYPE)
+       ELSE( X11_XTest_FOUND )
+               SET(AUTOTYPE FALSE)
+       ENDIF( X11_XTest_FOUND )
+ENDIF( AUTOTYPE )
+
+
+IF( MINGW )
+       SET(BINDIR "")
+       SET(SHAREDIR "share")
+ELSEIF( APPLE )
+       SET(BINDIR "")
+       SET(SHAREDIR "Contents/Resources")
+ELSE( MINGW )
+       SET(BINDIR "bin")
+       SET(SHAREDIR "share/keepassx")
+       SET(SHAREDIR_APP "share")
+ENDIF( MINGW )
+
+
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(share)
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..376dd53
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,330 @@
+Copyright (C) 2005-2008 Tarek Saidi <tarek.saidi@arcor.de>
+Copyright (C) 2007-2009 Felix Geyer <debfx-keepassx {at} fobos.de>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+text of the GNU General Public License below for more details.
+
+
+Other licenses:
+
+apg/*:
+       Copyright (c) 1999, 2000, 2001, 2002, 2003 Adel I. Mirzazhanov <a-del@iname.com>
+       3-clause BSD license
+
+crypto/aes*:
+       Copyright (c) 1998-2008, Brian Gladman
+       3-clause BSD license
+
+crypto/arcfour*:
+       Copyright (C) 2003-2008 Dominik Reichl <dominik.reichl@t-online.de>
+       GPLv2 or later
+
+crypto/blowfish*:
+       Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+       Copyright (C) 2003 by Michael Buesch
+       Copyright (C) 2007 by Tarek Saidi <tarek.saidi@arcor.de>
+       GPLv2
+
+crypto/sha256*:
+       Copyright (C) 2001-2003 by Christophe Devine
+       Copyright (C) 2005-2006 by Tarek Saidi
+       GPLv2
+
+crypto/two*:
+       Copyright (C) 2005-2007 Tarek Saidi <tarek.saidi@arcor.de>
+       Copyright (c) 2003,2004 Dominik Reichl <dominik.reichl@t-online.de>
+       GPLv2
+
+crypto/yarrow*:
+       Copyright (C) 2007 Tarek Saidi <tarek.saidi@arcor.de>
+       Copyright (C) 2001 Niels Müler
+       GPLv2
+
+---------------------------------------------------------------------------
+                       
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+               51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..097aeac
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,8 @@
+Installation instructions for *nix:
+-----------------------------------
+1. qmake-qt4 / qmake
+   You have to use qmake of Qt >= 4.3.0, depending on your distro it is called qmake or qmake-qt4.
+   By default KeePassX is installed to /usr, you can change that by adding PREFIX=[PATH] to the qmake command.
+   You can also add DEBUG=1 to build KeePassX with debug symbols.
+2. make
+3. make install
diff --git a/changelog b/changelog
new file mode 100644 (file)
index 0000000..c24bafe
--- /dev/null
+++ b/changelog
@@ -0,0 +1,193 @@
+----------------------------
+    0.4.1 (2009-09-14)
+----------------------------
+- Added initial documentation (by Jussi Sainio)
+- Added and improved many translations
+- Added ability to drag'n'drop fields (username, password, ...) to other applications [Linux]
+- Added option to show the application window always on top [Linux and Windows]
+- Seperate columns settings between normal and search results view
+- Interrupt auto-type if the focused window changed meanwhile
+- Reduced height of password generator dialog (Bug #2831504)
+- Fixed: "Key Stroke Delay" interpreted as seconds instead of ms (Bug #2716877)
+- Escape HTML chars in detail view (Bug #2836096)
+- Fixed: Mispelling of initialize in interface (Bug #2806402)
+- Fixed: Race condition on lock file (Bug #2801583)
+- Fixed: Modified entry does not refresh Entry Details Pane (Bug #2782262)
+- Fixed: Logoff doesn't close database correctly (Bug #2726197)
+- Fixed: Incorrect auto-type keymapping when KeePassX is in autostart
+- Fixed: Workspace is being locked after auto-type
+- Fixed: compiler warning/error "format not a string literal and no format arguments" (Bug #2815290)
+- Fixed: Makefile uninstall target removes system directories (Bug #2830345)
+- Fixed key rounds benchmark to return incorrect results
+- Set default auto-type key stroke delay to 5ms
+- Removed "Close to Tray" option
+
+----------------------------
+    0.4.0 (2009-03-25)
+----------------------------
+- Added pronounceable password generator
+- Added action "Copy URL to Clipboard"
+- Added "Tools" button to EditEntryDlg: Window List and Auto-Type sequence
+- Improved Auto-Typing: ability to type all unicode characters
+- Added option to save database after every change
+- Associate KeePassX with *.kdb files on Linux and Mac OS
+- Display warning when opening a database that is already opened
+- Distinguish between adding groups and subgroups (Bug #2194057)
+- Store list of preferred characters in password generator (Bug #2432748)
+- Implemented backup feature
+- Don't include entries from "Backup" group in search results
+- Added menu action to sort groups (Bug #2268672)
+- Clear Klipper history when clearing clipboard
+- Use serif font for all password fields (Bug #2594868)
+- Redesigned the Settings dialog and added ability to select language
+- Added Finnish, Gallican, Italian, Norwegian and Turkish translations
+- Cache and protect MasterKey - speeds up saving database
+- Added 2 new password generator options
+- Changed default config filename to "config.ini"
+- XDG compliant config location on Linux
+- Fixed: Crash on saving a database (Bug #1955677)
+- Fixed: Unnamed Database saved as ".kdb" (Bugs #2109972, #2118340)
+- Fixed: Date of Modification isn't updated (Bugs #2108658, #2121768)
+- Fixed: Cannot open DB from KeePassX 0.2.2 (Bug #2535569)
+- Fixed: Predefined expire times don't work (Bug #2109987)
+- Fixed: Sorting isn't consistent (Bug #2108655)
+- Fixed: KeepassX fails to lock itself after Ctrl-V (Bug #2106604)
+- Fixed: Position of main window not properly restored (Bugs #2090649, #2371738, #2336064)
+- Fixed: No password generated using list of very special characters (Bug #2230887)
+- Fixed: Crash if minimize to systray with locked workbench on Mac OS (Bug #2482531)
+- Fixed: Exports aren't sorted consistently (Bug #2108661)
+- Fixed: Sudden exit on bookmarking a new (not saved) file (Bug #2599802)
+- Fixed: -min parameter is sometimes ignored (Debian Bug #514414)
+- Fixed: Cloned entries are not immediately sorted
+- Fixed: Crash when moving entry to another group (Bug #2644545)
+- Fixed: Different qm files in different paths, no overruling (Bug #2657158)
+- Improved the initialization of the Windows RNG and fallback random number source (Bug #2091784)
+- Improved Mac OS bundle information (Bugs #2096992, #1921260)
+- Improve tab order in many dialogs (Bug #2130397)
+- Added nostrip qmake option
+
+----------------------------
+    0.3.4 (2008-11-09)
+----------------------------
+- fixed crash when auto-typing special characters (Bug #2111588)
+- only allow plain text in comment field
+
+----------------------------
+    0.3.3 (2008-08-11)
+----------------------------
+- fixed error when opening twofish encrypted databases (Bug #2025075)
+
+----------------------------
+    0.3.2 (2008-07-20)
+----------------------------
+- add default groups when creating a database
+- improved the auto-type dialog (keyboard only usage, visual selection feedback)
+- automatically try to unlock db when global auto-type key has been pressed
+- fixed password encoding problem (Bug #1687864)
+- fixed sorting of date columns (Bugs #1861726, #1922311)
+- fixed problem when restoring window after auto-type (Bug #1978861)
+- don't use entries in 'Backup' group for global auto-type (Bug #1915664)
+- hide contents of search field while database is locked (Bug #1923554)
+- fixed: custom entry icons are not saved (Bug #1995561)
+- added new icons introduced in KeePass 1.11
+- improved format of date strings (Bug #1932394)
+- added missing menu accelerators (Bug #1955304)
+- fixed: line breaks are ignored in Entry Detail View (Bug #1942362)
+- master key transformations (rounds) are now computed in two threads (from KeePass 1.11)
+- added ability to measure the number of rounds that can be calculated in 1 second
+- increase and randomize the default key transformation number
+- print help if parsing the arguments fails
+- disable precompiled header on FreeBSD by default to fix compilation error (Bug #1943446)
+
+---------------
+    0.3.1
+---------------
+- made key/password dialog more user friendly
+- added option for automatic database locking on inactivity
+- native file dialogs are used again under MacOS X and Windows
+- program accepts Qt command line switches like "-style" again
+- parameter "-cfg" now accepts relative paths (Bug #1825446)
+- fixed invalid entries in .desktop file (Bug #1906875)
+- fixed potential compilation problem in AES implementation (Bug #1905810)
+- fixed crash when re-arranging groups (Bug #1754998)
+- fixed size problems of some dialogs
+- files are not longer truncated when saving fails (Bug #1648616)
+- improved seeding of the random number generator
+
+---------------
+    0.3.0a
+---------------
+- fixed bug which prevented MacOS X bundle from starting (Bug #1906517)
+- fixed error message about missing license file when opening about dialog (Bug #1906696)
+
+---------------
+    0.3.0
+---------------
+- many bug fixes
+- global Auto-Type
+- fully customizable HTML based detail view
+- better structured settings dialog
+- secure random number generator based on 'Yarrow' including an optional entropy collector
+- new dialog to view expiered entries
+- calendar widget to edit expiration dates in a more confortable way
+- restructured password generator
+- much better appearance under MacOS X
+- fine tuning options for auto-type
+- system tray icon
+- workspace locking
+
+---------------
+    0.2.2
+---------------
+-fixed crash when parsing config file under Win32
+-fixed loss of entry icons when saving a database which was not created with KeePassX (no KPX_CUSTOM_ICONS metastream)
+-introduces new metastream format for custom icons
+-removed all old Qt3 support dependecies
+-QtNetwork and QtSql are not longer requiered (when using Qt 4.1.3 or later)
+-implemented correct UUID management for entries
+-added delay of 0.3s before performing auto-type
+-metastreams now get valid group IDs (KeePass/Win compatibility)
+-fixed drawing errors when performing drag and drop operations in group view
+-when there is no translation installed for the system's country preference but one for the same language the program will use it now
+-when canceling the file dialog for the opening of an existing database a already openend database will not longer be closed
+-same for the creation of a new database
+-alpha blending for banner icons
+-new standard banner icon
+-MacOS packages: all Qt libraries are now included in the application bundle (extra installation is not longer necessary)
+
+---------------
+    0.2.1
+---------------
+-added AutoType feature (experimental!)
+-added custom icons feature
+-new command line option for manual language selection (-lang <LOCALE-CODE>)
+-when saving an attachment the original filename is adopted by the file dialog
+-fixed strange sorting behavior of entries (Bug #7083)
+-sorting by dates now works as expected
+-the 'Expires' column and the detailed entry view now also show the string 'never' 
+ for entries which don't expire
+-entry view now gets updated after changing the column setup
+-added menu entry to change the size of the toolbar icons
+
+---------------
+    0.2.0
+---------------
+-ported whole application from Qt3 to Qt4
+(better performance, less memory usage, ready for KDE4)
+-improved Mac OS X support
+-added Drag&Drop support
+-multiple seclection mode for entries
+-improved loading performance for large databases
+-faster in-memory encryption
+-search field in toolbar now works
+-mainwindow size, splitter position and column sizes are restored at start-up
+-added option for alternating row colors
+-improved key/password dialog
+-removed language dialog - program now uses system's default language
+-loading translation files for Qt (e.g. file dialogs)
+-added text export function
+-added option "Never" for expire dates.
+-fixed problem with hex. key files
+-fixed problem with damaged file attachments after various entry operations
+-fixed segmentation fault when using new icons with higher index
+-fixed error when saving empty databases
\ No newline at end of file
diff --git a/cmake/FindPCHSupport.cmake b/cmake/FindPCHSupport.cmake
new file mode 100644 (file)
index 0000000..0c733d9
--- /dev/null
@@ -0,0 +1,65 @@
+# - Try to find precompiled headers support for GCC 3.4 and 4.x
+# Once done this will define:
+#
+# Variable:
+#   PCHSupport_FOUND
+#
+# Macro:
+#   ADD_PRECOMPILED_HEADER
+
+IF(CMAKE_COMPILER_IS_GNUCXX)
+    EXEC_PROGRAM(
+       ${CMAKE_CXX_COMPILER} 
+        ARGS                   --version 
+        OUTPUT_VARIABLE _compiler_output)
+    STRING(REGEX REPLACE ".* ([0-9]\\.[0-9]\\.[0-9]) .*" "\\1" 
+           gcc_compiler_version ${_compiler_output})
+    #MESSAGE("GCC Version: ${gcc_compiler_version}")
+    IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
+        SET(PCHSupport_FOUND TRUE)
+    ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
+        IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
+            SET(PCHSupport_FOUND TRUE)
+        ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
+    ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+MACRO(ADD_PRECOMPILED_HEADER _targetName _input )
+
+    GET_FILENAME_COMPONENT(_name ${_input} NAME)
+    SET(_source "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
+    SET(_outdir "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch")
+    MAKE_DIRECTORY(${_outdir})
+    SET(_output "${_outdir}/${CMAKE_BUILD_TYPE}.c++")
+    STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
+    SET(_compiler_FLAGS ${${_flags_var_name}})
+    
+    GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
+    FOREACH(item ${_directory_flags})
+    LIST(APPEND _compiler_FLAGS "-I${item}")
+    ENDFOREACH(item)
+
+       GET_DIRECTORY_PROPERTY(_directory_flags COMPILE_DEFINITIONS)
+       FOREACH(item ${_directory_flags})
+    LIST(APPEND _compiler_FLAGS "-D${item}")
+    ENDFOREACH(item)
+
+    SEPARATE_ARGUMENTS(_compiler_FLAGS)
+    #MESSAGE("_compiler_FLAGS: ${_compiler_FLAGS}")
+    message("${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}")
+    ADD_CUSTOM_COMMAND(
+        OUTPUT ${_output}
+        COMMAND ${CMAKE_CXX_COMPILER}
+                               ${_compiler_FLAGS}
+                               -x c++-header
+                               -o ${_output} ${_source}
+        DEPENDS ${_source} )
+       ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output})
+    ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)
+    #SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include ${_name} -Winvalid-pch -H")
+    #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${_name} -Winvalid-pch")
+    SET_TARGET_PROPERTIES(${_targetName} PROPERTIES
+       COMPILE_FLAGS "-include ${_name} -Winvalid-pch"
+    )
+       
+ENDMACRO(ADD_PRECOMPILED_HEADER)
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..1e237f1
--- /dev/null
@@ -0,0 +1,43 @@
+keepassx (0.4.1) unstable; urgency=low
+
+  * Bumped to 0.4.1
+
+ -- Timothy Redaelli <timothy@redaelli.eu>  Mon, 14 Dec 2009 18:13:01 +0100
+
+keepassx (0.2.2-3osso) unstable; urgency=low
+
+  * Add Maximize button support - Mark Bergman patch (  bergman@merctech.com ) 
+  * Set Large Fonts -  Mark Bergman patch (  bergman@merctech.com )
+  * Correct some package Bugs
+
+ -- Antonio Aloisio <gnuton@gnuton.org>  Tue, 11 Mar 2008 20:20:13 +0100
+
+keepassx (0.2.2-2osso) unstable; urgency=low
+
+  * Imported to maemo Qt4 repository 
+
+ -- Antonio Aloisio <gnuton@gnuton.org>  Fri, 28 Dic 2007 00:07:08 +0100
+
+keepassx (0.2.2-2) unstable; urgency=low
+
+  * Upload to unstable
+  * Fix typo in package description. Thanks to Stefan Fritsch!
+  * Translate desktop file
+
+ -- Reinhard Tartler <siretart@tauware.de>  Sat, 10 Feb 2007 17:15:55 +0100
+
+keepassx (0.2.2-1) experimental; urgency=low
+
+  * cleanups to debian/rules
+  * upload to debian/experimental for now (Closes: #405896)
+  * small changes to description
+  * remove libstdc++6-4.0-dev from build-depends
+
+ -- Reinhard Tartler <siretart@tauware.de>  Mon,  8 Jan 2007 17:59:13 +0100
+
+keepassx (0.2.2-0ubuntu1) edgy; urgency=low
+
+  * Initial release
+
+ -- David Valot <ptitdav69@gmail.com>  Wed,  6 Sep 2006 21:07:02 +0200
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..ebc4827
--- /dev/null
@@ -0,0 +1,61 @@
+Source: keepassx
+Section: user/tools
+Priority: optional
+Maintainer: Timothy Redaelli <timothy@redaelli.eu>
+Maintainer: Timothy Redaelli <timothy@redaelli.eu>
+Build-Depends: debhelper (>= 5.0.0), libqt4-dev, libpng12-dev, libxtst-dev
+Standards-Version: 3.7.2
+
+Package: keepassx
+Architecture: any
+Depends: ${shlibs:Depends}
+XB-Maemo-Icon-26:
+ iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c6QAAAAZiS0dE
+ AP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9gDDA05Fs1HWjIAAAeM
+ SURBVEjHpZZ7UNTXFcc/v99vH6z7QFAIisACglHBR7RaEJKIL6Cah21MWs1k0rGOzUzaibaJ
+ aZwKjp1KTKrtjNE/rLFWbZ4jplF81Nck9Q2igIOwiyIIuyIsu8uyr9/+bv9QHOqk05n2zJw/
+ 7tz7vZ85c84998D/Zr8G/HFxRpE6LlXk5U8WdrtdWKwWAQjgGpDC/2FFwGdmi1mUlZeJj/fs
+ FpdrL4tWR4u43nBdHPqqWqx4dYUYnTRaSJLUB6wbEipAOZAD7ATeBt4AxgIdQN8wiAXYYbVZ
+ l7zzztu8teYtdDZocl+ioes8PYG7jBubzg+fW4Y9M4ObzTdNfX19xUAj0CyZTCYxY+YMbDYb
+ sizh9Xqpq7tKYCBwG1gItD4E/clsMb+5cuVKVv18JWdb/s4N73nCsh9NikFMwhCzMHXU08zP
+ W8o/Tpyk4reVuLpdtcBiJS09rWL79u2sXr2aF19cSnlZGQOBARytrSOjUbVcCHEMSJEkafP0
+ p6ZZN1Rs4LzzOHXe48QMISRZQEwmIToOKarD2deITotj7uxS2u/cpqnpxlihiagsSaA36Glt
+ b+H01VP4wj7ee289K15dgcFgyAYOA5sMRsOYZ+fORZOjXOs9i9BHEWgQk5gYV8ia8irWlm7B
+ 3Gnn7NUa+gJuSkvLsNlsAO/qNE0QCoY4c/0kR5zVpFvtrClbx7p17xIMBfni8y+zfV5fttVq
+ JS8vj9auZoJyP5ImISsgqXqyUvIZnZAEQE5qHkeuHsDZ1czEiflkZmbi6fMga5qGoihkpWRj
+ NVi4G27nDzW/p919i8qKjbz8yjLiTHGYTCYSExPoDbgIRgRqTEOLQTAU5NsrZ+js7OROxx1O
+ nzxNKBbAF/JgHmEmzhT3oOqiarTCbs9g8YIlaCFBs6uZvlgP7d1OJqXmU/J0CZFoBLfbxYKF
+ CwhJAzj9jSBryICiB3ePi2NfnKH60EFcwVtkFozmydTppFjTqa6u5m7nXZRoNFrR4nCQkZ7B
+ ouIyCMk4ex3cC7tp63QyPWsGc4vnkp6ezoynZnLf28v1nosISSAelqNxpIQYFUB5Isi4WRZs
+ 8TYK0krxewb55MDf6Pf0owBmv883u6GxQc7OzmbxvMUMeoM0u27SE3XR1d1FfsZUigufoT/g
+ 4eCVA/SpbgAkGSRJRpZljBYFc6IRvV6H3TiFObmLqPm6hiOHa1BVFQU4Adj6+/tntbW1yZMm
+ Taa8uJyAJ8CtPgddg120d7UTr4vnq9rPueo5j+BBflRVICkCIQQIgSRkRsZSWZL/GoPeENu2
+ bePOnY5HnYGHMOu9e/fmNDRcp6CwkIUFC+ns6OaWx4E7eJfLLRdp8zuQ9DEkTWKCeTpjjHZ8
+ 3iChSBhDdAS5ppm8MvsNLPqRbK6q4tTJU8RisQfRP9bLKmRZ3jBr9vfYsXMnY8aMYeuXH3Li
+ 9hFkvUCnAxkdJWkLWVX6JqY4E5FIhGA4SJzRhE5RuHTpEtu2/ZF/fvMt4XBk6N6zusdAbkVR
+ sFisxBmNRNUoETWKGtOQZA2BTJI8ipeLVmDQG9m1axc9PfcxW0YQHAzR0NhA3ZU6eu/3omna
+ 0J3HgKXKMMgqvV7/4ZyiOYb3q6pISk5m25dbOdF2koimIskSEhJRLUq8MpIpWVOxWqzs27eP
+ Tw58yrlz53C0OAgEAg9y9sC+BpYD/iHQSr1ev7VkXol5Y2UlafZ0dtfs5lDTV8RUFbvVToYt
+ A7NkpS/qwdnTAiGZwmmF5OTk0NrqwO1yo6rqEOA6cBpYBXiGiuE1vV6/Y07RHFNlZSXjc8ez
+ u2Y3n9Z9RpgQKSNSWP/Ce7zyzI8pfvJpXF0uWr1ObroakSIyJd+fR25uLrV1tfT29iLJ0jlZ
+ lucLIfYDwUf/kaLI9UVFxbrNVZvJGp/F/qP72V97gJAUQpIk4vXxFGQXcLj6MAnxCZQWltHc
+ 1szdgQ4c926ihTQWFC4kJyeHG0038Pl8adFI1A1cGJ58ZdToxIqq96uYMmUKe4/tZe/lvxIU
+ QeJ1NqYlT2Va6jQmp03i80+/4ODBgxQWFDJ/xnwc7Q46Bjto7m4m7Iuy5NklpKaO5cyZswQG
+ AunAIcD/CJSQmFixbNkyzjWf5+OLexiMDZJsSGL9c+v52eJVzJwwAwmZmpojfHP2G+qv1VNe
+ Vk5RXjEtt1rpDnXT5rmJCEg8P/8FnE4nTY1NSZqmLXr4xXgBZCEEsViMbk83QhWkm9NYW76W
+ 6bnT+WDLFn700kss/8lyLpy7gKZp1NfV8+663xAOhPnFD37JxPjJ+ANham9fJhwJo9frh4KY
+ /NAB0ElIKDodZbPKmJKZT6J1FBPsE9jzlz189NEO/D7/8HJF0zROnTzFRoOB323axNrnf0XD
+ rQaeiE/GaIxDjanfOdXo/AN+Thw/QXZ2NkjQI+5ztPooe/fuxef1DZ0LALeHFqqqjj5+7PgT
+ iiLz+us/JXNkFrIkc62+nq6u7uGP9d9MGAwGYTQahdFoFAajQSiKMjSfCSAErHxMkwd0KYoi
+ EhISRFJykkhOThZJyUnCYDQM15YPF309bOO7/LX/MOPlAX/+L9pHoH8BckZaKDsXE4QAAAAA
+ SUVORK5CYII=
+Description: Cross Platform Password Manager
+ KeePassX is a free/open-source password manager or safe which helps you
+ to manage your passwords in a secure way. You can put all your
+ passwords in one database, which is locked with one master key or a
+ key-disk. So you only have to remember one single master password or
+ insert the key-disk to unlock the whole database. The databases are
+ encrypted using the algorithms AES or Twofish.
+ .
+  Homepage: http://keepassx.sourceforge.net
+  Keepass for maemo homepage: http://qt4.garage.maemo.org
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..d840d8a
--- /dev/null
@@ -0,0 +1,161 @@
+This package was debianized by David Valot <ptitdav69@gmail.com> on
+Wed,  6 Sep 2006 21:07:02 +0200.
+
+It was downloaded from http://keepassx.sourceforge.net
+
+Upstream Author: Tarek Saidi <mail@tarek-saidi.de>
+
+Copyright: 2006 Tarek Saidi
+
+License:
+
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This package is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2006, David Valot <ptitdav69@gmail.com> and
+(C) 2007, Reinhard Tartler <siretart@tauware.de>. It is licensed under
+the GPL, see above.
+
+The directory src/crypto contains implementations of several crypto
+algorithms, which have other licences and/or copyright holders:
+
+src/crypto/blowfish.c:
+
+/* 2003.05.02: Derived from libgcrypt-1.1.12 by Michael Buesch */
+
+/* blowfish.c  -  Blowfish encryption
+ *     Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+ *
+ * This file is part of Libgcrypt.
+ *
+ * Libgcrypt is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser general Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ ...
+ */
+
+
+src/crypto/rijandael.cpp:
+
+// Another implementation of the Rijndael cipher.
+// This is intended to be an easily usable library file.
+// This code is public domain.
+// Based on the Vincent Rijmen and K.U.Leuven implementation 2.4.
+//
+
+//
+// Original Copyright notice:
+//
+//    rijndael-alg-fst.c   v2.4   April '2000
+//    rijndael-alg-fst.h
+//    rijndael-api-fst.c
+//    rijndael-api-fst.h
+//
+//    Optimised ANSI C code
+//
+//    authors: v1.0: Antoon Bosselaers
+//             v2.0: Vincent Rijmen, K.U.Leuven
+//             v2.3: Paulo Barreto
+//             v2.4: Vincent Rijmen, K.U.Leuven
+//
+//    This code is placed in the public domain.
+//
+
+src/crypto/sha1.cpp:
+/*
+       100% free public domain implementation of the SHA-1 algorithm
+       by Dominik Reichl <dominik.reichl@t-online.de>
+...
+*/
+
+src/crypto/sha256.c:
+
+/*
+ *  FIPS-180-2 compliant SHA-256 implementation
+ *
+ *  Copyright (C) 2001-2003  Christophe Devine
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ ...
+ */
+
+src/crypto/twoclass.cpp:
+
+/*
+  Copyright (c) 2003/2004, Dominik Reichl <dominik.reichl@t-online.de>
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+
+  - Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer. 
+  - Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the following disclaimer in the documentation
+    and/or other materials provided with the distribution.
+  - Neither the name of ReichlSoft nor the names of its contributors may be
+    used to endorse or promote products derived from this software without
+    specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+*/
+
+src/crypto/twofish.cpp:
+
+ * Fast, portable, and easy-to-use Twofish implementation, 
+ * Version 0.3.
+ * Copyright (c) 2002 by Niels Ferguson. 
+
+ * Now for the license:
+ * The author hereby grants a perpetual license to everybody to
+ * use this code for any purpose as long as the copyright message is included
+ * in the source code of this or any derived work.
+ * 
+ * Yes, this means that you, your company, your club, and anyone else
+ * can use this code anywhere you want. You can change it and distribute it
+ * under the GPL, include it in your commercial product without releasing
+ * the source code, put it on the web, etc. 
+ * The only thing you cannot do is remove my copyright message, 
+ * or distribute any source code based on this implementation that does not 
+ * include my copyright message. 
+ * 
+ * I appreciate a mention in the documentation or credits, 
+ * but I understand if that is difficult to do.
+ * I also appreciate it if you tell me where and why you used my code.
+ *
+ * Please send any questions or comments to niels@ferguson.net
+
+ * DISCLAIMER: As I'm giving away my work for free, I'm of course not going
+ * to accept any liability of any form. This code, or the Twofish cipher,
+ * might very well be flawed; you have been warned.
+ * This software is provided as-is, without any kind of warrenty or
+ * guarantee. And that is really all you can expect when you download 
+ * code for free from the Internet. 
diff --git a/debian/keepass.1 b/debian/keepass.1
new file mode 100644 (file)
index 0000000..1b211e4
--- /dev/null
@@ -0,0 +1,12 @@
+.TH KEEPASSX 1 "Sep 04, 2006"
+.SH NAME
+keepassx \- password manager
+.SH SYNOPSIS
+.B keepassx
+.RI [ files/filelist ]
+.SH DESCRIPTION
+\fBKeePassX\fP is a free/open-source password manager or safe which helps you to manage your passwords in a secure way. You can put all your passwords in one database, which is locked with one master key or a key-disk. So you only have to remember one single master password or insert the key-disk to unlock the whole database. The databases are encrypted using the best and most secure encryption algorithms currently known (AES and Twofish).
+.SH COMMANDS
+.SH AUTHOR
+This manual page was written by David Valot <ptitdav69@gmail.com>,
+for the Debian project (but may be used by others).
diff --git a/debian/patches/00list b/debian/patches/00list
new file mode 100644 (file)
index 0000000..a313ed0
--- /dev/null
@@ -0,0 +1,2 @@
+10_RemoveSystray.dpatch
+20_LargeIcons.dpatch
diff --git a/debian/patches/10_RemoveSystray.dpatch b/debian/patches/10_RemoveSystray.dpatch
new file mode 100755 (executable)
index 0000000..27de627
--- /dev/null
@@ -0,0 +1,157 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## RemoveSystray.dpatch by  <drizzt@>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad keepassx-0.4.1~/src/main.cpp keepassx-0.4.1/src/main.cpp
+--- keepassx-0.4.1~/src/main.cpp       2009-09-03 18:53:44.000000000 +0200
++++ keepassx-0.4.1/src/main.cpp        2009-12-15 17:17:27.222405495 +0100
+@@ -56,6 +56,13 @@
+ #else
+       QApplication* app = new QApplication(argc,argv);
+ #endif
++
++#ifdef Q_WS_HILDON
++      QFont font = app->font();
++      font.setPointSize( font.pointSize()-4 );
++      app->setFont( font );
++#endif
++      
+       EventListener* eventListener = new EventListener();
+       app->installEventFilter(eventListener);
+       
+diff -urNad keepassx-0.4.1~/src/mainwindow.cpp keepassx-0.4.1/src/mainwindow.cpp
+--- keepassx-0.4.1~/src/mainwindow.cpp 2009-09-14 10:59:05.000000000 +0200
++++ keepassx-0.4.1/src/mainwindow.cpp  2009-12-15 17:17:27.222405495 +0100
+@@ -72,7 +72,9 @@
+               restoreGeometry(windowGeo);
+       VSplitter->restoreState(config->vSplitterPos());
+       HSplitter->restoreState(config->hSplitterPos());
++#ifndef       Q_WS_HILDON
+       SysTray=new QSystemTrayIcon(this);
++#endif
+       setupToolbar();
+       setupIcons();
+       setStateFileOpen(false);
+@@ -207,7 +209,9 @@
+       connect(EntryView, SIGNAL(viewModeChanged(bool)), SLOT(loadColumnVisibility()));
+       connect(EntryView, SIGNAL(viewModeChanged(bool)), ViewColumnsGroupAction, SLOT(setVisible(bool)));
++#ifndef Q_WS_HILDON
+       connect(SysTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));
++#endif
+       connect(DetailView,SIGNAL(anchorClicked(const QUrl&)),this,SLOT(OnDetailViewUrlClicked(const QUrl&)));
+       connect(WorkspaceLockedWidget.Button_Unlock,SIGNAL(clicked()),this,SLOT(OnUnLockWorkspace()));
+       connect(WorkspaceLockedWidget.Button_CloseDatabase,SIGNAL(clicked()),this,SLOT(OnLockClose()));
+@@ -278,9 +282,11 @@
+       AddThisAsBookmarkAction->setIcon(getIcon("bookmark_this"));
+       AddBookmarkAction->setIcon(getIcon("bookmark_add"));
+       ManageBookmarksAction->setIcon(getIcon("bookmark"));
++#ifndef Q_WS_HILDON
+       SysTray->setIcon(getIcon("keepassx"));
+       if(config->showSysTrayIcon())
+               SysTray->show();
++#endif
+ }
+ void KeepassMainWindow::setupMenus(){
+@@ -327,9 +333,11 @@
+       SysTrayMenu->addAction(FileUnLockWorkspaceAction);
+       SysTrayMenu->addSeparator();
+       SysTrayMenu->addAction(FileExitAction);
++#ifndef Q_WS_HILDON
+       SysTray->setContextMenu(SysTrayMenu);
+       updateTrayTooltip();
+-
++#endif
++      
+       #define _add_import(name){\
+       QAction* import=new QAction(this);\
+       import->setData(qVariantFromValue(dynamic_cast<QObject*>(&name)));\
+@@ -1082,7 +1090,9 @@
+               config->setHSplitterPos(HSplitter->saveState());
+       config->setShowStatusbar(statusBar()->isVisible());
+       
++#ifndef Q_WS_HILDON
+       delete SysTray;
++#endif
+       QMainWindow::closeEvent(e);
+       QApplication::quit();
+ }
+@@ -1133,7 +1143,9 @@
+       }
+       
+       EntryView->setAlternatingRowColors(config->alternatingRowColors());
++#ifndef Q_WS_HILDON
+       SysTray->setVisible(config->showSysTrayIcon());
++#endif
+       menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
+ #ifndef Q_WS_MAC
+       if (config->alwaysOnTop() != oldAlwaysOnTop) {
+@@ -1225,6 +1237,7 @@
+       toolBar->setIconSize(QSize(28,28));
+ }
++#ifndef Q_WS_HILDON
+ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason){
+       if(reason!=QSystemTrayIcon::Context){
+               if (isVisible()){
+@@ -1243,6 +1256,7 @@
+               }
+       }
+ }
++#endif
+ void KeepassMainWindow::restoreWindow(){
+       showNormal();
+@@ -1344,7 +1358,9 @@
+       NormalCentralWidget->setParent(NULL);
+       setCentralWidget(LockedCentralWidget);
+       LockedCentralWidget->setVisible(true);
++#ifndef Q_WS_HILDON
+       SysTray->setIcon(getIcon("keepassx_locked"));
++#endif
+       FileUnLockWorkspaceAction->setText(tr("Un&lock Workspace"));
+       IsLocked=true;
+       updateTrayTooltip();
+@@ -1359,7 +1375,9 @@
+       LockedCentralWidget->setParent(NULL);
+       setCentralWidget(NormalCentralWidget);
+       NormalCentralWidget->setVisible(true);
++#ifndef Q_WS_HILDON
+       SysTray->setIcon(getIcon("keepassx"));
++#endif
+       FileUnLockWorkspaceAction->setText(tr("&Lock Workspace"));
+       IsLocked=false;
+       updateTrayTooltip();
+@@ -1481,6 +1499,7 @@
+ }
+ void KeepassMainWindow::updateTrayTooltip() {
++#ifndef Q_WS_HILDON
+       if (!IsLocked && !FileOpen)
+               SysTray->setToolTip(QString("%1 - %2").arg(APP_DISPLAY_NAME, APP_SHORT_FUNC));
+       else {
+@@ -1490,6 +1509,7 @@
+                       tooltip.append( QString(" (%1)").arg(tr("locked")) );
+               SysTray->setToolTip(tooltip);
+       }
++#endif
+ }
+ void KeepassMainWindow::updateCurrentFile(const QString& filePath) {
+diff -urNad keepassx-0.4.1~/src/mainwindow.h keepassx-0.4.1/src/mainwindow.h
+--- keepassx-0.4.1~/src/mainwindow.h   2009-12-15 16:55:18.000000000 +0100
++++ keepassx-0.4.1/src/mainwindow.h    2009-12-15 17:17:27.232398814 +0100
+@@ -131,7 +131,9 @@
+               QLabel* StatusBarGeneral;
+               //QLabel* StatusBarSelection;
+               QToolBar* toolBar;
++#ifndef Q_WS_HILDON
+               QSystemTrayIcon* SysTray;
++#endif
+               QAction* ViewShowToolbarAction;
+               QMenu* SysTrayMenu;
+               //QAssistantClient* HelpBrowser; //TODO HelpBrowser
diff --git a/debian/patches/20_LargeIcons.dpatch b/debian/patches/20_LargeIcons.dpatch
new file mode 100755 (executable)
index 0000000..2ba0fbe
--- /dev/null
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 20_LargeIcons.dpatch by  <drizzt@>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad keepassx-0.4.1~/src/KpxConfig.h keepassx-0.4.1/src/KpxConfig.h
+--- keepassx-0.4.1~/src/KpxConfig.h    2009-12-15 17:17:21.000000000 +0100
++++ keepassx-0.4.1/src/KpxConfig.h     2009-12-15 17:37:33.632426586 +0100
+@@ -99,7 +99,7 @@
+       bool showStatusbar(){return settings.value("UI/ShowStatusbar",true).toBool();}
+       bool showSysTrayIcon(){return settings.value("Options/ShowSysTrayIcon",false).toBool();}
+       bool showToolbar(){return settings.value("UI/ShowToolbar",true).toBool();}
+-      int toolbarIconSize(){return settings.value("UI/ToolbarIconSize",16).toInt();}
++      int toolbarIconSize(){return settings.value("UI/ToolbarIconSize",28).toInt();}
+       QString urlCmd(){return settings.value("Options/UrlCmd").toString();}
+       bool urlCmdDef(){return settings.value("Options/UrlCmdDef",true).toBool();}
+       QByteArray vSplitterPos(){return settings.value("UI/VSplitterPos").toByteArray();}
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..898f867
--- /dev/null
@@ -0,0 +1,73 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# Include dpatch stuff.
+# include /usr/share/dpatch/dpatch.make
+
+CFLAGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+
+build: patch build-stamp
+build-stamp: 
+       dh_testdir
+       #/opt/qt4-maemo5/bin/
+       qmake-qt4 PREFIX=/usr QMAKE_CFLAGS_DEBUG="$(CFLAGS)" QMAKE_CXXFLAGS_DEBUG="$(CFLAGS)" DEBUG=1
+       $(MAKE)
+       touch build-stamp
+
+clean: clean-patched unpatch
+clean-patched:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       -$(MAKE) distclean
+       rm -rf src/Makefile Makefile
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+       make INSTALL_ROOT=$(CURDIR)/debian/keepassx install
+
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs changelog
+       dh_installdocs
+       dh_installexamples
+       dh_installman debian/keepass.1
+       dh_desktop
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+patch: patch-stamp
+
+patch-stamp:
+       dpatch apply-all
+
+unpatch:
+       dpatch deapply-all
+       rm -rf debian/patched
+
+binary: binary-indep binary-arch
+.PHONY: build build-stamp clean clean-patched install binary-indep binary-arch binary patch patch-stamp unpatch binary
diff --git a/keepassx.pro b/keepassx.pro
new file mode 100644 (file)
index 0000000..23a9d0b
--- /dev/null
@@ -0,0 +1,28 @@
+message("See 'INSTALL' for configuration options.")
+#message("*** Build Configuration:")
+TEMPLATE = subdirs
+isEmpty(PREFIX){
+       PREFIX = /usr
+}
+#isEmpty(KDEDIR){
+#      KDEDIR = /usr
+#}
+SUBDIRS += src
+#contains(INT_PLUGINS,kde) {
+#      SUBDIRS +=src/plugins/kde
+#      message("Build KDE Plugin: yes")
+#}
+#!contains(INT_PLUGINS,kde) {
+#      message("Build KDE Plugin: no")
+#}
+#contains(INT_PLUGINS,gtk) {
+#      SUBDIRS +=src/plugins/gnome
+#      message("Build Gnome Plugin: yes")
+#}
+#!contains(INT_PLUGINS,gtk) {
+#      message("Build Gnome Plugin: no")
+#}
+message("Install Prefix:" $$PREFIX)
+#message("KDE Prefix:" $$KDEDIR)
+message("*** Makefile successfully generated.")
+message("*** Start make now.")
diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c3db725
--- /dev/null
@@ -0,0 +1,33 @@
+# CMake is still experimental, use qmake instead
+
+INSTALL(DIRECTORY keepassx/i18n keepassx/icons
+       DESTINATION ${SHAREDIR}
+       PATTERN *.qm EXCLUDE
+       PATTERN *~ EXCLUDE
+       PATTERN .svn EXCLUDE
+)
+
+INSTALL(FILES keepassx/license.html DESTINATION ${SHAREDIR})
+
+IF (NOT MINGW AND NOT APPLE)
+       INSTALL(DIRECTORY applications
+               DESTINATION ${SHAREDIR_APP}
+               PATTERN *~ EXCLUDE
+               PATTERN .svn EXCLUDE
+       )
+       INSTALL(DIRECTORY mime
+               DESTINATION ${SHAREDIR_APP}
+               PATTERN *~ EXCLUDE
+               PATTERN .svn EXCLUDE
+       )
+       INSTALL(DIRECTORY mimelnk
+               DESTINATION ${SHAREDIR_APP}
+               PATTERN *~ EXCLUDE
+               PATTERN .svn EXCLUDE
+       )
+       INSTALL(DIRECTORY pixmaps
+               DESTINATION ${SHAREDIR_APP}
+               PATTERN *~ EXCLUDE
+               PATTERN .svn EXCLUDE
+       )
+ENDIF (NOT MINGW AND NOT APPLE)
diff --git a/share/applications/keepassx.desktop b/share/applications/keepassx.desktop
new file mode 100644 (file)
index 0000000..a66c60e
--- /dev/null
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Name=KeePassX
+GenericName=Cross Platform Password Manager
+GenericName[de]=Passwortverwaltung
+GenericName[es]=Gestor de contraseñas multiplataforma
+GenericName[fr]=Gestionnaire de mot de passe
+Exec=keepassx %f
+Icon=keepassx
+Comment=Cross Platform Password Manager
+Comment[de]=Passwortverwaltung
+Comment[es]=Gestor de contraseñas multiplataforma
+Comment[fr]=Gestionnaire de mot de passe
+Terminal=false
+Type=Application
+Categories=Qt;Utility;Security;
+MimeType=application/x-keepass;
+X-SuSE-translate=true
diff --git a/share/keepassx/i18n/keepassx-de_DE.qm b/share/keepassx/i18n/keepassx-de_DE.qm
new file mode 100644 (file)
index 0000000..2df2805
Binary files /dev/null and b/share/keepassx/i18n/keepassx-de_DE.qm differ
diff --git a/share/keepassx/i18n/keepassx-es_ES.qm b/share/keepassx/i18n/keepassx-es_ES.qm
new file mode 100644 (file)
index 0000000..97d14d1
Binary files /dev/null and b/share/keepassx/i18n/keepassx-es_ES.qm differ
diff --git a/share/keepassx/i18n/keepassx-fi_FI.qm b/share/keepassx/i18n/keepassx-fi_FI.qm
new file mode 100644 (file)
index 0000000..40c4a0e
Binary files /dev/null and b/share/keepassx/i18n/keepassx-fi_FI.qm differ
diff --git a/share/keepassx/i18n/keepassx-fr_FR.qm b/share/keepassx/i18n/keepassx-fr_FR.qm
new file mode 100644 (file)
index 0000000..53cb6f9
Binary files /dev/null and b/share/keepassx/i18n/keepassx-fr_FR.qm differ
diff --git a/share/keepassx/i18n/keepassx-gl_ES.qm b/share/keepassx/i18n/keepassx-gl_ES.qm
new file mode 100644 (file)
index 0000000..36e34e1
Binary files /dev/null and b/share/keepassx/i18n/keepassx-gl_ES.qm differ
diff --git a/share/keepassx/i18n/keepassx-hu_HU.qm b/share/keepassx/i18n/keepassx-hu_HU.qm
new file mode 100644 (file)
index 0000000..2c50b4c
Binary files /dev/null and b/share/keepassx/i18n/keepassx-hu_HU.qm differ
diff --git a/share/keepassx/i18n/keepassx-it_IT.qm b/share/keepassx/i18n/keepassx-it_IT.qm
new file mode 100644 (file)
index 0000000..10569fe
Binary files /dev/null and b/share/keepassx/i18n/keepassx-it_IT.qm differ
diff --git a/share/keepassx/i18n/keepassx-nb_NO.qm b/share/keepassx/i18n/keepassx-nb_NO.qm
new file mode 100644 (file)
index 0000000..ca8f2cf
Binary files /dev/null and b/share/keepassx/i18n/keepassx-nb_NO.qm differ
diff --git a/share/keepassx/i18n/keepassx-nl_NL.qm b/share/keepassx/i18n/keepassx-nl_NL.qm
new file mode 100644 (file)
index 0000000..36e220a
Binary files /dev/null and b/share/keepassx/i18n/keepassx-nl_NL.qm differ
diff --git a/share/keepassx/i18n/keepassx-pl_PL.qm b/share/keepassx/i18n/keepassx-pl_PL.qm
new file mode 100644 (file)
index 0000000..f201817
Binary files /dev/null and b/share/keepassx/i18n/keepassx-pl_PL.qm differ
diff --git a/share/keepassx/i18n/keepassx-ru_RU.qm b/share/keepassx/i18n/keepassx-ru_RU.qm
new file mode 100644 (file)
index 0000000..30dc147
Binary files /dev/null and b/share/keepassx/i18n/keepassx-ru_RU.qm differ
diff --git a/share/keepassx/i18n/keepassx-tr_TR.qm b/share/keepassx/i18n/keepassx-tr_TR.qm
new file mode 100644 (file)
index 0000000..7234e50
Binary files /dev/null and b/share/keepassx/i18n/keepassx-tr_TR.qm differ
diff --git a/share/keepassx/i18n/keepassx-zh_CN.qm b/share/keepassx/i18n/keepassx-zh_CN.qm
new file mode 100644 (file)
index 0000000..d29500f
Binary files /dev/null and b/share/keepassx/i18n/keepassx-zh_CN.qm differ
diff --git a/share/keepassx/i18n/qt_fi.qm b/share/keepassx/i18n/qt_fi.qm
new file mode 100644 (file)
index 0000000..f4ee13f
Binary files /dev/null and b/share/keepassx/i18n/qt_fi.qm differ
diff --git a/share/keepassx/i18n/qt_hu.qm b/share/keepassx/i18n/qt_hu.qm
new file mode 100644 (file)
index 0000000..be651ee
--- /dev/null
@@ -0,0 +1 @@
+<¸d\18Êï\9c\95Í!\1c¿`¡½Ý
\ No newline at end of file
diff --git a/share/keepassx/i18n/qt_it.qm b/share/keepassx/i18n/qt_it.qm
new file mode 100644 (file)
index 0000000..70526dd
Binary files /dev/null and b/share/keepassx/i18n/qt_it.qm differ
diff --git a/share/keepassx/i18n/qt_nl.qm b/share/keepassx/i18n/qt_nl.qm
new file mode 100644 (file)
index 0000000..be651ee
--- /dev/null
@@ -0,0 +1 @@
+<¸d\18Êï\9c\95Í!\1c¿`¡½Ý
\ No newline at end of file
diff --git a/share/keepassx/i18n/qt_tr.qm b/share/keepassx/i18n/qt_tr.qm
new file mode 100644 (file)
index 0000000..56b2412
Binary files /dev/null and b/share/keepassx/i18n/qt_tr.qm differ
diff --git a/share/keepassx/icons/alarmclock.png b/share/keepassx/icons/alarmclock.png
new file mode 100644 (file)
index 0000000..c66d2b1
Binary files /dev/null and b/share/keepassx/icons/alarmclock.png differ
diff --git a/share/keepassx/icons/appsettings.png b/share/keepassx/icons/appsettings.png
new file mode 100644 (file)
index 0000000..6f3b1f4
Binary files /dev/null and b/share/keepassx/icons/appsettings.png differ
diff --git a/share/keepassx/icons/autotype.png b/share/keepassx/icons/autotype.png
new file mode 100644 (file)
index 0000000..c73f55d
Binary files /dev/null and b/share/keepassx/icons/autotype.png differ
diff --git a/share/keepassx/icons/bookmark.png b/share/keepassx/icons/bookmark.png
new file mode 100644 (file)
index 0000000..972f550
Binary files /dev/null and b/share/keepassx/icons/bookmark.png differ
diff --git a/share/keepassx/icons/bookmark_add.png b/share/keepassx/icons/bookmark_add.png
new file mode 100644 (file)
index 0000000..bbaa71a
Binary files /dev/null and b/share/keepassx/icons/bookmark_add.png differ
diff --git a/share/keepassx/icons/bookmark_del.png b/share/keepassx/icons/bookmark_del.png
new file mode 100644 (file)
index 0000000..231713f
Binary files /dev/null and b/share/keepassx/icons/bookmark_del.png differ
diff --git a/share/keepassx/icons/bookmark_edit.png b/share/keepassx/icons/bookmark_edit.png
new file mode 100644 (file)
index 0000000..7e63526
Binary files /dev/null and b/share/keepassx/icons/bookmark_edit.png differ
diff --git a/share/keepassx/icons/bookmark_folder.png b/share/keepassx/icons/bookmark_folder.png
new file mode 100644 (file)
index 0000000..b1b319c
Binary files /dev/null and b/share/keepassx/icons/bookmark_folder.png differ
diff --git a/share/keepassx/icons/bookmark_this.png b/share/keepassx/icons/bookmark_this.png
new file mode 100644 (file)
index 0000000..758d9be
Binary files /dev/null and b/share/keepassx/icons/bookmark_this.png differ
diff --git a/share/keepassx/icons/clientic.png b/share/keepassx/icons/clientic.png
new file mode 100644 (file)
index 0000000..ed7ca49
Binary files /dev/null and b/share/keepassx/icons/clientic.png differ
diff --git a/share/keepassx/icons/clock.png b/share/keepassx/icons/clock.png
new file mode 100644 (file)
index 0000000..1f36aca
Binary files /dev/null and b/share/keepassx/icons/clock.png differ
diff --git a/share/keepassx/icons/cloneentry.png b/share/keepassx/icons/cloneentry.png
new file mode 100644 (file)
index 0000000..18627b7
Binary files /dev/null and b/share/keepassx/icons/cloneentry.png differ
diff --git a/share/keepassx/icons/copypwd.png b/share/keepassx/icons/copypwd.png
new file mode 100644 (file)
index 0000000..dc95992
Binary files /dev/null and b/share/keepassx/icons/copypwd.png differ
diff --git a/share/keepassx/icons/copyusername.png b/share/keepassx/icons/copyusername.png
new file mode 100644 (file)
index 0000000..a0c95be
Binary files /dev/null and b/share/keepassx/icons/copyusername.png differ
diff --git a/share/keepassx/icons/dbsearch.png b/share/keepassx/icons/dbsearch.png
new file mode 100644 (file)
index 0000000..62e3227
Binary files /dev/null and b/share/keepassx/icons/dbsearch.png differ
diff --git a/share/keepassx/icons/dbsettings.png b/share/keepassx/icons/dbsettings.png
new file mode 100644 (file)
index 0000000..feebf2b
Binary files /dev/null and b/share/keepassx/icons/dbsettings.png differ
diff --git a/share/keepassx/icons/delete.png b/share/keepassx/icons/delete.png
new file mode 100644 (file)
index 0000000..2d5e260
Binary files /dev/null and b/share/keepassx/icons/delete.png differ
diff --git a/share/keepassx/icons/deleteentry.png b/share/keepassx/icons/deleteentry.png
new file mode 100644 (file)
index 0000000..ae6f86a
Binary files /dev/null and b/share/keepassx/icons/deleteentry.png differ
diff --git a/share/keepassx/icons/deletegroup.png b/share/keepassx/icons/deletegroup.png
new file mode 100644 (file)
index 0000000..80dad40
Binary files /dev/null and b/share/keepassx/icons/deletegroup.png differ
diff --git a/share/keepassx/icons/dice.png b/share/keepassx/icons/dice.png
new file mode 100644 (file)
index 0000000..fe15a5f
Binary files /dev/null and b/share/keepassx/icons/dice.png differ
diff --git a/share/keepassx/icons/document.png b/share/keepassx/icons/document.png
new file mode 100644 (file)
index 0000000..2b60577
Binary files /dev/null and b/share/keepassx/icons/document.png differ
diff --git a/share/keepassx/icons/down.png b/share/keepassx/icons/down.png
new file mode 100644 (file)
index 0000000..5cbe6bb
Binary files /dev/null and b/share/keepassx/icons/down.png differ
diff --git a/share/keepassx/icons/editentry.png b/share/keepassx/icons/editentry.png
new file mode 100644 (file)
index 0000000..cd7d348
Binary files /dev/null and b/share/keepassx/icons/editentry.png differ
diff --git a/share/keepassx/icons/editgroup.png b/share/keepassx/icons/editgroup.png
new file mode 100644 (file)
index 0000000..e8db2b8
Binary files /dev/null and b/share/keepassx/icons/editgroup.png differ
diff --git a/share/keepassx/icons/exit.png b/share/keepassx/icons/exit.png
new file mode 100644 (file)
index 0000000..609d4d8
Binary files /dev/null and b/share/keepassx/icons/exit.png differ
diff --git a/share/keepassx/icons/expired.png b/share/keepassx/icons/expired.png
new file mode 100644 (file)
index 0000000..b3f3c5f
Binary files /dev/null and b/share/keepassx/icons/expired.png differ
diff --git a/share/keepassx/icons/fileclose.png b/share/keepassx/icons/fileclose.png
new file mode 100644 (file)
index 0000000..34eb16f
Binary files /dev/null and b/share/keepassx/icons/fileclose.png differ
diff --git a/share/keepassx/icons/filedelete.png b/share/keepassx/icons/filedelete.png
new file mode 100644 (file)
index 0000000..f2a3c2a
Binary files /dev/null and b/share/keepassx/icons/filedelete.png differ
diff --git a/share/keepassx/icons/filenew.png b/share/keepassx/icons/filenew.png
new file mode 100644 (file)
index 0000000..a71c1a2
Binary files /dev/null and b/share/keepassx/icons/filenew.png differ
diff --git a/share/keepassx/icons/fileopen.png b/share/keepassx/icons/fileopen.png
new file mode 100644 (file)
index 0000000..77c992f
Binary files /dev/null and b/share/keepassx/icons/fileopen.png differ
diff --git a/share/keepassx/icons/filesave.png b/share/keepassx/icons/filesave.png
new file mode 100644 (file)
index 0000000..ae13a15
Binary files /dev/null and b/share/keepassx/icons/filesave.png differ
diff --git a/share/keepassx/icons/filesaveas.png b/share/keepassx/icons/filesaveas.png
new file mode 100644 (file)
index 0000000..55ca1ec
Binary files /dev/null and b/share/keepassx/icons/filesaveas.png differ
diff --git a/share/keepassx/icons/filesavedisabled.png b/share/keepassx/icons/filesavedisabled.png
new file mode 100644 (file)
index 0000000..f32f63f
Binary files /dev/null and b/share/keepassx/icons/filesavedisabled.png differ
diff --git a/share/keepassx/icons/generator.png b/share/keepassx/icons/generator.png
new file mode 100644 (file)
index 0000000..99e878c
Binary files /dev/null and b/share/keepassx/icons/generator.png differ
diff --git a/share/keepassx/icons/go-home.png b/share/keepassx/icons/go-home.png
new file mode 100644 (file)
index 0000000..b16c19f
Binary files /dev/null and b/share/keepassx/icons/go-home.png differ
diff --git a/share/keepassx/icons/go-next.png b/share/keepassx/icons/go-next.png
new file mode 100644 (file)
index 0000000..c4da8a9
Binary files /dev/null and b/share/keepassx/icons/go-next.png differ
diff --git a/share/keepassx/icons/go-previous.png b/share/keepassx/icons/go-previous.png
new file mode 100644 (file)
index 0000000..68ed8a1
Binary files /dev/null and b/share/keepassx/icons/go-previous.png differ
diff --git a/share/keepassx/icons/groupsearch.png b/share/keepassx/icons/groupsearch.png
new file mode 100644 (file)
index 0000000..950c670
Binary files /dev/null and b/share/keepassx/icons/groupsearch.png differ
diff --git a/share/keepassx/icons/help.png b/share/keepassx/icons/help.png
new file mode 100644 (file)
index 0000000..d56ba2c
Binary files /dev/null and b/share/keepassx/icons/help.png differ
diff --git a/share/keepassx/icons/help_about.png b/share/keepassx/icons/help_about.png
new file mode 100644 (file)
index 0000000..2658cca
Binary files /dev/null and b/share/keepassx/icons/help_about.png differ
diff --git a/share/keepassx/icons/i18n.png b/share/keepassx/icons/i18n.png
new file mode 100644 (file)
index 0000000..cdd941d
Binary files /dev/null and b/share/keepassx/icons/i18n.png differ
diff --git a/share/keepassx/icons/keepassx.png b/share/keepassx/icons/keepassx.png
new file mode 100644 (file)
index 0000000..33234c8
Binary files /dev/null and b/share/keepassx/icons/keepassx.png differ
diff --git a/share/keepassx/icons/keepassx_large.png b/share/keepassx/icons/keepassx_large.png
new file mode 100644 (file)
index 0000000..24c2c4b
Binary files /dev/null and b/share/keepassx/icons/keepassx_large.png differ
diff --git a/share/keepassx/icons/keepassx_locked.png b/share/keepassx/icons/keepassx_locked.png
new file mode 100644 (file)
index 0000000..c06e350
Binary files /dev/null and b/share/keepassx/icons/keepassx_locked.png differ
diff --git a/share/keepassx/icons/keepassx_small.png b/share/keepassx/icons/keepassx_small.png
new file mode 100644 (file)
index 0000000..7fb7334
Binary files /dev/null and b/share/keepassx/icons/keepassx_small.png differ
diff --git a/share/keepassx/icons/key.png b/share/keepassx/icons/key.png
new file mode 100644 (file)
index 0000000..b74e831
Binary files /dev/null and b/share/keepassx/icons/key.png differ
diff --git a/share/keepassx/icons/lock.png b/share/keepassx/icons/lock.png
new file mode 100644 (file)
index 0000000..4f30170
Binary files /dev/null and b/share/keepassx/icons/lock.png differ
diff --git a/share/keepassx/icons/manual.png b/share/keepassx/icons/manual.png
new file mode 100644 (file)
index 0000000..d09e04b
Binary files /dev/null and b/share/keepassx/icons/manual.png differ
diff --git a/share/keepassx/icons/newentry.png b/share/keepassx/icons/newentry.png
new file mode 100644 (file)
index 0000000..0226c2f
Binary files /dev/null and b/share/keepassx/icons/newentry.png differ
diff --git a/share/keepassx/icons/newgroup.png b/share/keepassx/icons/newgroup.png
new file mode 100644 (file)
index 0000000..495440a
Binary files /dev/null and b/share/keepassx/icons/newgroup.png differ
diff --git a/share/keepassx/icons/ok.png b/share/keepassx/icons/ok.png
new file mode 100644 (file)
index 0000000..d19bd22
Binary files /dev/null and b/share/keepassx/icons/ok.png differ
diff --git a/share/keepassx/icons/openurl.png b/share/keepassx/icons/openurl.png
new file mode 100644 (file)
index 0000000..47d4b36
Binary files /dev/null and b/share/keepassx/icons/openurl.png differ
diff --git a/share/keepassx/icons/pwd_hide.png b/share/keepassx/icons/pwd_hide.png
new file mode 100644 (file)
index 0000000..103fe9e
Binary files /dev/null and b/share/keepassx/icons/pwd_hide.png differ
diff --git a/share/keepassx/icons/pwd_show.png b/share/keepassx/icons/pwd_show.png
new file mode 100644 (file)
index 0000000..d84e9b9
Binary files /dev/null and b/share/keepassx/icons/pwd_show.png differ
diff --git a/share/keepassx/icons/restore.png b/share/keepassx/icons/restore.png
new file mode 100644 (file)
index 0000000..fe16aa7
Binary files /dev/null and b/share/keepassx/icons/restore.png differ
diff --git a/share/keepassx/icons/search.png b/share/keepassx/icons/search.png
new file mode 100644 (file)
index 0000000..f507381
Binary files /dev/null and b/share/keepassx/icons/search.png differ
diff --git a/share/keepassx/icons/swap.png b/share/keepassx/icons/swap.png
new file mode 100644 (file)
index 0000000..4b0e37a
Binary files /dev/null and b/share/keepassx/icons/swap.png differ
diff --git a/share/keepassx/icons/templates.png b/share/keepassx/icons/templates.png
new file mode 100644 (file)
index 0000000..3632895
Binary files /dev/null and b/share/keepassx/icons/templates.png differ
diff --git a/share/keepassx/icons/text_block.png b/share/keepassx/icons/text_block.png
new file mode 100644 (file)
index 0000000..c4a9b8c
Binary files /dev/null and b/share/keepassx/icons/text_block.png differ
diff --git a/share/keepassx/icons/text_bold.png b/share/keepassx/icons/text_bold.png
new file mode 100644 (file)
index 0000000..7984923
Binary files /dev/null and b/share/keepassx/icons/text_bold.png differ
diff --git a/share/keepassx/icons/text_center.png b/share/keepassx/icons/text_center.png
new file mode 100644 (file)
index 0000000..4ddfee4
Binary files /dev/null and b/share/keepassx/icons/text_center.png differ
diff --git a/share/keepassx/icons/text_italic.png b/share/keepassx/icons/text_italic.png
new file mode 100644 (file)
index 0000000..1a9baad
Binary files /dev/null and b/share/keepassx/icons/text_italic.png differ
diff --git a/share/keepassx/icons/text_left.png b/share/keepassx/icons/text_left.png
new file mode 100644 (file)
index 0000000..54d22a3
Binary files /dev/null and b/share/keepassx/icons/text_left.png differ
diff --git a/share/keepassx/icons/text_right.png b/share/keepassx/icons/text_right.png
new file mode 100644 (file)
index 0000000..20dba5b
Binary files /dev/null and b/share/keepassx/icons/text_right.png differ
diff --git a/share/keepassx/icons/text_under.png b/share/keepassx/icons/text_under.png
new file mode 100644 (file)
index 0000000..e9ac03b
Binary files /dev/null and b/share/keepassx/icons/text_under.png differ
diff --git a/share/keepassx/icons/trashcan.png b/share/keepassx/icons/trashcan.png
new file mode 100644 (file)
index 0000000..f19899d
Binary files /dev/null and b/share/keepassx/icons/trashcan.png differ
diff --git a/share/keepassx/icons/up.png b/share/keepassx/icons/up.png
new file mode 100644 (file)
index 0000000..899ad4f
Binary files /dev/null and b/share/keepassx/icons/up.png differ
diff --git a/share/keepassx/license.html b/share/keepassx/license.html
new file mode 100644 (file)
index 0000000..7e7d943
--- /dev/null
@@ -0,0 +1,330 @@
+<html><pre>Copyright (C) 2005-2008 Tarek Saidi &lt;tarek.saidi@arcor.de&gt;
+Copyright (C) 2007-2009 Felix Geyer &lt;debfx-keepassx {at} fobos.de&gt;
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+text of the GNU General Public License below for more details.
+
+
+Other licenses:
+
+apg/*:
+       Copyright (c) 1999, 2000, 2001, 2002, 2003 Adel I. Mirzazhanov
+       3-clause BSD license
+
+crypto/aes*:
+       Copyright (c) 1998-2008, Brian Gladman, Worcester
+       3-clause BSD license
+
+crypto/arcfour*:
+       Copyright (C) 2003-2008 Dominik Reichl &lt;dominik.reichl@t-online.de&gt;
+       GPLv2 or later
+
+crypto/blowfish*:
+       Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc.
+       Copyright (C) 2003 by Michael Buesch
+       Copyright (C) 2007 by Tarek Saidi &lt;tarek.saidi@arcor.de&gt;
+       GPLv2
+
+crypto/sha256*:
+       Copyright (C) 2001-2003 by Christophe Devine
+       Copyright (C) 2005-2006 by Tarek Saidi
+       GPLv2
+
+crypto/two*:
+       Copyright (C) 2005-2007 Tarek Saidi &lt;tarek.saidi@arcor.de&gt;
+       Copyright (c) 2003,2004 Dominik Reichl &lt;dominik.reichl@t-online.de&gt;
+       GPLv2
+
+crypto/yarrow*:
+       Copyright (C) 2007 Tarek Saidi &lt;tarek.saidi@arcor.de>
+       Copyright (C) 2001 Niels Müler
+       GPLv2
+
+---------------------------------------------------------------------------
+                       
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+               51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS</pre></html>
diff --git a/share/macx_bundle/Info.plist b/share/macx_bundle/Info.plist
new file mode 100644 (file)
index 0000000..57fc349
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+  <dict>
+
+    <!-- For a full list of properties, see
+    http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html
+    -->
+
+
+
+    <key>CFBundleIconFile</key>
+    <string>icon.icns</string>
+
+    <key>CFBundlePackageType</key>
+    <string>APPL</string>
+
+    <key>CFBundleGetInfoString</key>
+    <string>KeePassX 0.4.1</string>
+
+    <key>CFBundleSignature</key>
+    <string>kpsx</string>
+
+    <key>CFBundleExecutable</key>
+    <string>KeePassX</string>
+
+    <key>CFBundleVersion</key>
+    <string>0.4.1</string>
+
+    <key>CFBundleShortVersionString</key>
+    <string>0.4.1</string>
+
+    <key>CFBundleName</key>
+    <string>KeePassX</string>
+
+    <key>CFBundleInfoDictionaryVersion</key>
+    <string>6.0</string>
+
+    <key>CFBundleIdentifier</key>
+    <string>com.apple.application-bundle</string>
+
+    <key>CFBundleDocumentTypes</key>
+    <array>
+      <dict>
+        <key>CFBundleTypeExtensions</key>
+          <array>
+            <string>kdb</string>
+          </array>
+        <key>CFBundleTypeIconFile</key>
+        <string>icon</string>
+        <key>CFBundleTypeName</key>
+        <string>KeePassX Password Database</string>
+        <key>CFBundleTypeOSTypes</key>
+           <array>
+             <string>kpsx</string>
+           </array>
+        <key>CFBundleTypeRole</key>
+        <string>Editor</string>
+      </dict>
+    </array>
+
+  </dict>
+</plist>
diff --git a/share/macx_bundle/Info_cmake.plist b/share/macx_bundle/Info_cmake.plist
new file mode 100644 (file)
index 0000000..cc6f677
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <!-- For a full list of properties, see
+       http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html
+       -->
+               
+       <key>CFBundleIconFile</key>
+       <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+       
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       
+       <key>CFBundleGetInfoString</key>
+       <string>${MACOSX_BUNDLE_INFO_STRING}</string>
+       
+       <key>CFBundleSignature</key>
+       <string>kpsx</string>
+       
+       <key>CFBundleExecutable</key>
+       <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+       
+       <key>CFBundleVersion</key>
+       <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+       
+       <key>CFBundleShortVersionString</key>
+       <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+       
+       <key>CFBundleLongVersionString</key>
+       <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+       
+       <key>CFBundleName</key>
+       <string>KeePassX</string>
+       
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       
+       <key>CFBundleIdentifier</key>
+       <string>org.keepassx.KeePassX</string>
+       
+       <key>NSHumanReadableCopyright</key>
+       <string>© 2005-2009, KeePassX Development Team</string>
+       
+       <key>CFBundleDocumentTypes</key>
+       <array>
+               <dict>
+                       <key>CFBundleTypeExtensions</key>
+                       <array>
+                               <string>kdb</string>
+                       </array>
+                       
+                       <key>CFBundleTypeIconFile</key>
+                       <string>icon</string>
+                       
+                       <key>CFBundleTypeName</key>
+                       <string>KeePassX Password Database</string>
+                       
+                       <key>CFBundleTypeOSTypes</key>
+                       <array>
+                               <string>kpsx</string>
+                       </array>
+                       
+                       <key>CFBundleTypeRole</key>
+                       <string>Editor</string>
+               </dict>
+       </array>
+       
+</dict>
+</plist>
diff --git a/share/macx_bundle/icon.icns b/share/macx_bundle/icon.icns
new file mode 100644 (file)
index 0000000..42ebe49
Binary files /dev/null and b/share/macx_bundle/icon.icns differ
diff --git a/share/mime/packages/keepassx.xml b/share/mime/packages/keepassx.xml
new file mode 100644 (file)
index 0000000..5175081
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
+  <mime-type type="application/x-keepass">
+    <comment>KeePass database</comment>
+    <comment xml:lang="de">KeePass Datenbank</comment>
+    <glob pattern="*.kdb"/>
+  </mime-type>
+</mime-info>
diff --git a/share/mimelnk/application/x-keepass.desktop b/share/mimelnk/application/x-keepass.desktop
new file mode 100644 (file)
index 0000000..63ee32f
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Comment=KeePass database
+Comment[de]=KeePass Datenbank
+Hidden=false
+Icon=keepassx
+MimeType=application/x-keepass;
+Patterns=*.kdb;
+Type=MimeType
diff --git a/share/pixmaps/keepassx.xpm b/share/pixmaps/keepassx.xpm
new file mode 100644 (file)
index 0000000..f58a3cf
--- /dev/null
@@ -0,0 +1,501 @@
+/* XPM */
+static char * keepassx2_xpm[] = {
+"32 32 466 2",
+"      c None",
+".     c #000000",
+"+     c #181B16",
+"@     c #0B0C0A",
+"#     c #6E7967",
+"$     c #9BA596",
+"%     c #CBCFCA",
+"&     c #FAFAFA",
+"*     c #9CA696",
+"=     c #707D68",
+"-     c #0D110B",
+";     c #343A30",
+">     c #BCC3B8",
+",     c #FFFFFF",
+"'     c #FEFEFE",
+")     c #CED1CC",
+"!     c #ADB6A8",
+"~     c #E6E7E5",
+"{     c #BDC4B9",
+"]     c #3A4435",
+"^     c #010101",
+"/     c #4D5549",
+"(     c #EDEEED",
+"_     c #FBFBFB",
+":     c #92A588",
+"<     c #66914E",
+"[     c #65A142",
+"}     c #6EB048",
+"|     c #639B44",
+"1     c #70975B",
+"2     c #B7C0B1",
+"3     c #55614D",
+"4     c #030303",
+"5     c #788375",
+"6     c #839080",
+"7     c #869283",
+"8     c #899586",
+"9     c #748270",
+"0     c #060905",
+"a     c #141713",
+"b     c #D1D6CF",
+"c     c #EAECEA",
+"d     c #71935E",
+"e     c #63A93B",
+"f     c #64AB3C",
+"g     c #64AA3B",
+"h     c #63AA3A",
+"i     c #5F9F3A",
+"j     c #8A9E7F",
+"k     c #D1D7CF",
+"l     c #191F15",
+"m     c #E5E5E5",
+"n     c #909D8C",
+"o     c #111310",
+"p     c #8A9385",
+"q     c #88A07A",
+"r     c #6AAE44",
+"s     c #6BAE44",
+"t     c #64A93D",
+"u     c #628A4B",
+"v     c #637957",
+"w     c #5A903C",
+"x     c #67A543",
+"y     c #AFB8A9",
+"z     c #8F9B88",
+"A     c #E2E2E2",
+"B     c #AEB5AC",
+"C     c #BABFB8",
+"D     c #F9F9F9",
+"E     c #8E9A8A",
+"F     c #050805",
+"G     c #131513",
+"H     c #F2F2F2",
+"I     c #C2C9BE",
+"J     c #64A042",
+"K     c #6AAE43",
+"L     c #718367",
+"M     c #FCFCFC",
+"N     c #9D9D9D",
+"O     c #365424",
+"P     c #678F4F",
+"Q     c #F5F5F5",
+"R     c #1B2317",
+"S     c #DEDEDE",
+"T     c #B8BDB7",
+"U     c #2E7922",
+"V     c #337D24",
+"W     c #63825D",
+"X     c #869382",
+"Y     c #080A08",
+"Z     c #3E443A",
+"`     c #8CA281",
+" .    c #5FA539",
+"..    c #62A83B",
+"+.    c #5DA135",
+"@.    c #BFC1BE",
+"#.    c #30302F",
+"$.    c #63A240",
+"%.    c #BCC2B8",
+"&.    c #4A5742",
+"*.    c #D9DAD9",
+"=.    c #BBC0BB",
+"-.    c #3A7E31",
+";.    c #408735",
+">.    c #428935",
+",.    c #6D8866",
+"'.    c #869282",
+").    c #0E0F0E",
+"!.    c #6B7667",
+"~.    c #7B9A6D",
+"{.    c #65A845",
+"].    c #68AB46",
+"^.    c #6CAE47",
+"/.    c #65A440",
+"(.    c #A0A0A0",
+"_.    c #EAEAEA",
+":.    c #242424",
+"<.    c #76A45B",
+"[.    c #A3B29A",
+"}.    c #73816B",
+"|.    c #D2D3D2",
+"1.    c #FDFDFD",
+"2.    c #70886E",
+"3.    c #317A27",
+"4.    c #357F29",
+"5.    c #378029",
+"6.    c #6C8667",
+"7.    c #7C8A79",
+"8.    c #020301",
+"9.    c #7E8A79",
+"0.    c #689058",
+"a.    c #569E34",
+"b.    c #59A135",
+"c.    c #5CA437",
+"d.    c #5FA737",
+"e.    c #60A836",
+"f.    c #3F4F37",
+"g.    c #A6A6A6",
+"h.    c #C4C4C4",
+"i.    c #515151",
+"j.    c #0D1309",
+"k.    c #64AA3C",
+"l.    c #93AA87",
+"m.    c #819078",
+"n.    c #546153",
+"o.    c #6E876B",
+"p.    c #367E2D",
+"q.    c #3A832F",
+"r.    c #3C8430",
+"s.    c #728A6D",
+"t.    c #7C8879",
+"u.    c #0F0F0F",
+"v.    c #758071",
+"w.    c #809C75",
+"x.    c #5DA140",
+"y.    c #60A441",
+"z.    c #64A743",
+"A.    c #67AA45",
+"B.    c #6BAD47",
+"C.    c #5F963F",
+"D.    c #2E4223",
+"E.    c #181818",
+"F.    c #273420",
+"G.    c #6F9E55",
+"H.    c #AAB7A3",
+"I.    c #697861",
+"J.    c #020202",
+"K.    c #687468",
+"L.    c #6B8668",
+"M.    c #377F2F",
+"N.    c #3B8331",
+"O.    c #3C8230",
+"P.    c #758D71",
+"Q.    c #838E80",
+"R.    c #DADCD9",
+"S.    c #8FA289",
+"T.    c #559B3A",
+"U.    c #599E3B",
+"V.    c #5BA13C",
+"W.    c #5FA43D",
+"X.    c #61A73E",
+"Y.    c #64A93F",
+"Z.    c #67AC40",
+"`.    c #67A743",
+" +    c #67AC3F",
+".+    c #CFD2CD",
+"++    c #3C4936",
+"@+    c #717E71",
+"#+    c #638060",
+"$+    c #2E7A26",
+"%+    c #317D26",
+"&+    c #337C27",
+"*+    c #788D73",
+"=+    c #DBDEDB",
+"-+    c #558246",
+";+    c #4E9734",
+">+    c #529936",
+",+    c #559C37",
+"'+    c #59A039",
+")+    c #5CA23B",
+"!+    c #61A63D",
+"~+    c #64A83F",
+"{+    c #66AC40",
+"]+    c #68AD40",
+"^+    c #799669",
+"/+    c #D8DBD7",
+"(+    c #0F150B",
+"_+    c #879287",
+":+    c #F8F8F8",
+"<+    c #658262",
+"[+    c #3B8233",
+"}+    c #3E8534",
+"|+    c #3E8333",
+"1+    c #7E927A",
+"2+    c #EDEEEC",
+"3+    c #5E8355",
+"4+    c #51953C",
+"5+    c #54983E",
+"6+    c #579B3E",
+"7+    c #5A9E3F",
+"8+    c #5DA141",
+"9+    c #60A442",
+"0+    c #64A744",
+"a+    c #66A945",
+"b+    c #6AAC46",
+"c+    c #67984B",
+"d+    c #D9DCD8",
+"e+    c #6E7C66",
+"f+    c #050505",
+"g+    c #090A09",
+"h+    c #939E92",
+"i+    c #F6F6F6",
+"j+    c #5A7C57",
+"k+    c #2C7823",
+"l+    c #2E7A24",
+"m+    c #317924",
+"n+    c #7D9179",
+"o+    c #5F7F58",
+"p+    c #3B8628",
+"q+    c #3E892A",
+"r+    c #428C2B",
+"s+    c #41892A",
+"t+    c #468430",
+"u+    c #4B952F",
+"v+    c #4E9831",
+"w+    c #529B32",
+"x+    c #559E33",
+"y+    c #59A235",
+"z+    c #648F4E",
+"A+    c #C3C9BF",
+"B+    c #AEB7A8",
+"C+    c #040603",
+"D+    c #040404",
+"E+    c #0A0C0A",
+"F+    c #A3ADA3",
+"G+    c #F3F3F3",
+"H+    c #5D7E5A",
+"I+    c #398132",
+"J+    c #3E8434",
+"K+    c #3D8132",
+"L+    c #438935",
+"M+    c #478C38",
+"N+    c #498F39",
+"O+    c #4C9039",
+"P+    c #7C9275",
+"Q+    c #CDD1CB",
+"R+    c #7D9874",
+"S+    c #658B56",
+"T+    c #5E8A4C",
+"U+    c #78986A",
+"V+    c #92A589",
+"W+    c #EEEEED",
+"X+    c #BFC7BB",
+"Y+    c #323D2D",
+"Z+    c #080808",
+"`+    c #181C18",
+" @    c #B3BAB3",
+".@    c #EFF0EF",
+"+@    c #567B54",
+"@@    c #327C2B",
+"#@    c #347E2B",
+"$@    c #38812D",
+"%@    c #3B852E",
+"&@    c #3E872E",
+"*@    c #6C8965",
+"=@    c #82907B",
+"-@    c #141A13",
+";@    c #0A0A0A",
+">@    c #171817",
+",@    c #ACB4AC",
+"'@    c #638262",
+")@    c #2A7624",
+"!@    c #2E7927",
+"~@    c #327C28",
+"{@    c #5E8158",
+"]@    c #848F81",
+"^@    c #6E7E6B",
+"/@    c #919F8D",
+"(@    c #ABB4A8",
+"_@    c #8E9C88",
+":@    c #63725D",
+"<@    c #313C2B",
+"[@    c #0B0B0B",
+"}@    c #121512",
+"|@    c #ADB4AD",
+"1@    c #698469",
+"2@    c #2F772D",
+"3@    c #337A30",
+"4@    c #357D31",
+"5@    c #3C8334",
+"6@    c #547E4D",
+"7@    c #DCDFDC",
+"8@    c #EEEFEE",
+"9@    c #525F4E",
+"0@    c #101311",
+"a@    c #A8B1A8",
+"b@    c #658165",
+"c@    c #1A681B",
+"d@    c #1B691C",
+"e@    c #1D6C1C",
+"f@    c #216F1D",
+"g@    c #24721F",
+"h@    c #277520",
+"i@    c #2B7822",
+"j@    c #497843",
+"k@    c #DADDD9",
+"l@    c #E6E8E5",
+"m@    c #3F4C3D",
+"n@    c #151815",
+"o@    c #AAB2AA",
+"p@    c #6F876F",
+"q@    c #2A722B",
+"r@    c #2C752D",
+"s@    c #316B32",
+"t@    c #799179",
+"u@    c #829882",
+"v@    c #8B9F8A",
+"w@    c #4F794D",
+"x@    c #388032",
+"y@    c #527E4C",
+"z@    c #DEE0DD",
+"A@    c #424D40",
+"B@    c #0E110E",
+"C@    c #A7B0A7",
+"D@    c #708870",
+"E@    c #236C24",
+"F@    c #246F25",
+"G@    c #236F24",
+"H@    c #306431",
+"I@    c #DDE0DD",
+"J@    c #447341",
+"K@    c #2E7827",
+"L@    c #307A27",
+"M@    c #4A7844",
+"N@    c #D7DAD6",
+"O@    c #D4D9D3",
+"P@    c #2C3629",
+"Q@    c #121412",
+"R@    c #A6B0A6",
+"S@    c #728972",
+"T@    c #206A21",
+"U@    c #226E23",
+"V@    c #677667",
+"W@    c #98A298",
+"X@    c #D5DAD5",
+"Y@    c #427340",
+"Z@    c #317B2C",
+"`@    c #357E2D",
+" #    c #4D7A47",
+".#    c #D6D9D5",
+"+#    c #CBD1CA",
+"@#    c #31382D",
+"##    c #131313",
+"$#    c #919B91",
+"%#    c #798D79",
+"&#    c #2A702B",
+"*#    c #286C29",
+"=#    c #29652A",
+"-#    c #365A36",
+";#    c #6B7A6B",
+">#    c #151715",
+",#    c #A6AEA6",
+"'#    c #CCD1CC",
+")#    c #41733F",
+"!#    c #357D2F",
+"~#    c #378030",
+"{#    c #4D7A46",
+"]#    c #D3D8D3",
+"^#    c #C1C7C0",
+"/#    c #20281F",
+"(#    c #B5BAB5",
+"_#    c #788E79",
+":#    c #186419",
+"<#    c #19681A",
+"[#    c #3E6E3E",
+"}#    c #C1C5C1",
+"|#    c #697A69",
+"1#    c #111511",
+"2#    c #ADB6AE",
+"3#    c #C1C9C1",
+"4#    c #346C31",
+"5#    c #287422",
+"6#    c #2C7825",
+"7#    c #457640",
+"8#    c #D1D6D0",
+"9#    c #AFB6AD",
+"0#    c #020502",
+"a#    c #B7BCB7",
+"b#    c #296C2A",
+"c#    c #447345",
+"d#    c #D7DAD7",
+"e#    c #D6D8D6",
+"f#    c #C3C7C3",
+"g#    c #C3C6C3",
+"h#    c #5F6F5F",
+"i#    c #161C16",
+"j#    c #BBC2BB",
+"k#    c #BAC2BA",
+"l#    c #3C733A",
+"m#    c #367E31",
+"n#    c #398133",
+"o#    c #4F744B",
+"p#    c #E2E3E2",
+"q#    c #0C110A",
+"r#    c #B6BBB6",
+"s#    c #216B22",
+"t#    c #396C3A",
+"u#    c #CDD2CD",
+"v#    c #B4BDB5",
+"w#    c #171E17",
+"x#    c #1F251F",
+"y#    c #C3C9C3",
+"z#    c #AEB8AE",
+"A#    c #2E6B2B",
+"B#    c #267321",
+"C#    c #396A34",
+"D#    c #DCDDDB",
+"E#    c #020701",
+"F#    c #EFEFEF",
+"G#    c #B1B8B1",
+"H#    c #D9DBD9",
+"I#    c #C9CFC9",
+"J#    c #1D271D",
+"K#    c #090909",
+"L#    c #222A23",
+"M#    c #CDD1CD",
+"N#    c #C0C7C0",
+"O#    c #A3B0A3",
+"P#    c #D7D9D7",
+"Q#    c #080B07",
+"R#    c #B1B6B1",
+"S#    c #F7F7F7",
+"T#    c #D7DAD8",
+"U#    c #364336",
+"V#    c #2F382F",
+"W#    c #D6DAD7",
+"X#    c #D0D4D0",
+"Y#    c #030603",
+"Z#    c #0C120C",
+"`#    c #0D150E",
+" $    c #090F09",
+".$    c #262F26",
+"+$    c #485648",
+"@$    c #475647",
+"#$    c #475646",
+"$$    c #404E3F",
+"                                    . . . + . . .               ",
+"                                  @ # $ % & % * = - .           ",
+"                              . ; > , ' ) ! ~ , , { ] ^         ",
+". . . . . .                 . / ( _ : < [ } | 1 2 , ( 3 .       ",
+"4 5 6 7 8 9 0               a b c d e f g g g h i j , k l .     ",
+"4 m , , , , n o           ^ p , q r r s s t u v w x y , z 4     ",
+". A ( B C D , E F         G H I J s r r K L M , N O P Q H R .   ",
+". S T U V W _ , X Y       Z , `  ...f f +.@., , ' #.$.%., &..   ",
+". *.=.-.;.>.,.M , '.).  . !., ~.{.].^.} /.(., , _.:.<.[., }..   ",
+". |.1.2.3.4.5.6.1., 7.8.. 9., 0.a.b.c.d.e.f.g.h.i.j.k.l., m..   ",
+". n.M M o.p.q.r.s.' , t.u.v., w.x.y.z.A.B.C.D.E.F.G.} H., I..   ",
+"  J.K., _ L.M.N.O.P.' , Q.R., S.T.U.V.W.X.Y.Z.`. + +i .+, ++.   ",
+"    . @+, & #+$+%+&+*+, , , =+-+;+>+,+'+)+!+~+{+]+]+^+, /+(+.   ",
+"    . ^ _+, :+<+[+}+|+1+, 2+3+4+5+6+7+8+9+0+a+b+^.c+d+, e+f+    ",
+"      . g+h+, i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+, B+C+D+    ",
+"        . E+F+, G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+W+, X+Y+Z+      ",
+"          . `+ @, .@+@@@#@$@%@&@*@1., , , , , , :+=@-@;@.       ",
+"            >@,@, _ '@)@!@~@4.{@:+, ]@^@/@(@_@:@<@^ [@          ",
+"          }@|@, M 1@2@3@4@I+5@6@7@, 8@9@. . ^ f+4 .             ",
+"        0@a@, 1.b@c@d@e@f@g@h@i@j@k@, l@m@f+                    ",
+"      n@o@, ' p@q@r@s@t@u@v@w@x@[+y@d+, z@A@;@                  ",
+"    B@C@, , D@E@F@G@H@, , , I@J@K@L@M@N@, O@P@.                 ",
+"  Q@R@, , S@T@U@U@G@H@, V@W@, X@Y@Z@`@ #.#, +#@###              ",
+". $#, , %#&#r@r@*#=#-#, ;#>#,#, '#)#!#~#{#]#, ^#/#.             ",
+". (#, _#:#<#<#[#}#_.1., |#. 1#2#, 3#4#5#6#7#8#, 9#0#            ",
+". a#}#b#r@r@c#d#, e#f#g#h#. . i#j#, k#l#m#n#o#, p#q#.           ",
+". r#a#s#U@t#u#, v#w#. . . .   . x#y#, z#A#B#C#, D#E#.           ",
+". r#F#G#G#H#, I#J#K#. . . .     . L#M#, N#O#R@, P#Q#.           ",
+". R#S#S#S#S#T#U#;@                . V#W#, , , , X#Y#.           ",
+". Z#`#`#`#`# $D+.                   . .$+$@$@$#$$$. .           ",
+". . . . . . . .                       . . . . . . .             ",
+"                                                                "};
diff --git a/share/win_ico/keepassx.ico b/share/win_ico/keepassx.ico
new file mode 100644 (file)
index 0000000..a63ca8b
Binary files /dev/null and b/share/win_ico/keepassx.ico differ
diff --git a/share/win_ico/keepassx.rc b/share/win_ico/keepassx.rc
new file mode 100644 (file)
index 0000000..db38704
--- /dev/null
@@ -0,0 +1 @@
+IDI_ICON1    ICON    DISCARDABLE    "keepassx.ico"
diff --git a/src/Application_X11.cpp b/src/Application_X11.cpp
new file mode 100644 (file)
index 0000000..18a50b8
--- /dev/null
@@ -0,0 +1,56 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by Felix Geyer                                *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+
+#include "Application_X11.h"
+#include "lib/AutoTypeGlobalX11.h"
+#include "lib/HelperX11.h"
+
+KeepassApplication::KeepassApplication(int& argc, char** argv) : QApplication(argc, argv), remove_invalid(0){
+}
+
+bool KeepassApplication::x11EventFilter(XEvent* event){
+       if (autoType == NULL)
+               return QApplication::x11EventFilter(event);
+       
+#ifdef GLOBAL_AUTOTYPE
+       if (remove_invalid == 0) {
+               AutoTypeGlobalX11* autoTypeGlobal = static_cast<AutoTypeGlobalX11*>(autoType);
+               remove_invalid = ControlMask | ShiftMask | autoTypeGlobal->maskAlt() |
+                               autoTypeGlobal->maskAltGr() | autoTypeGlobal->maskMeta();
+       }
+       
+       if (event->type==KeyPress && autoType->getShortcut().key!=0 &&
+                       event->xkey.keycode == XKeysymToKeycode(event->xkey.display,HelperX11::getKeysym(autoType->getShortcut().key)) &&
+                       (event->xkey.state&remove_invalid) == HelperX11::getShortcutModifierMask(autoType->getShortcut()) &&
+                       focusWidget()==NULL)
+       {
+               EventOccurred = true;
+               autoType->performGlobal();
+               return true;
+       }
+#endif
+       
+       if (event->type == MappingNotify) {
+               dynamic_cast<AutoTypeX11*>(autoType)->updateKeymap();
+               remove_invalid = 0;
+       }
+       
+       return QApplication::x11EventFilter(event);
+}
diff --git a/src/Application_X11.h b/src/Application_X11.h
new file mode 100644 (file)
index 0000000..3e37f4e
--- /dev/null
@@ -0,0 +1,35 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by Felix Geyer                                *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef APPLICATION_X11_H
+#define APPLICATION_X11_H
+
+class KeepassApplication : public QApplication
+{
+       Q_OBJECT
+       
+       public:
+               KeepassApplication(int& argc, char** argv);
+               bool x11EventFilter(XEvent* event);
+               
+       private:
+               unsigned int remove_invalid;
+};
+
+#endif // APPLICATION_X11_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3288711
--- /dev/null
@@ -0,0 +1,188 @@
+# CMake is still experimental, use qmake instead
+
+SET(keepassx_HEADERS
+       main.h
+       mainwindow.h
+       Database.h
+       Kdb3Database.h
+       lib/EntryView.h
+       lib/FileDialogs.h
+       lib/GroupView.h
+       lib/ShortcutWidget.h
+       lib/UrlLabel.h
+       lib/WaitAnimationWidget.h
+       dialogs/AboutDlg.h
+       dialogs/AddBookmarkDlg.h
+       dialogs/CalendarDlg.h
+       dialogs/CollectEntropyDlg.h
+       dialogs/CustomizeDetailViewDlg.h
+       dialogs/DatabaseSettingsDlg.h
+       dialogs/EditEntryDlg.h
+       dialogs/EditGroupDlg.h
+       dialogs/ExpiredEntriesDlg.h
+       dialogs/HelpDlg.h
+       dialogs/ManageBookmarksDlg.h
+       dialogs/PasswordDlg.h
+       dialogs/PasswordGenDlg.h
+       dialogs/SearchDlg.h
+       dialogs/SelectIconDlg.h
+       dialogs/SettingsDlg.h
+       dialogs/SimplePasswordDlg.h
+#      dialogs/TrashCanDlg.h
+       import/Import.h
+#      import/Import_GnuKeyRing.h
+       import/Import_KeePassX_Xml.h
+       import/Import_KWalletXml.h
+       import/Import_PwManager.h
+       export/Export.h
+       export/Export_KeePassX_Xml.h
+       export/Export_Txt.h
+)
+
+SET(keepassx_SOURCES
+       main.cpp
+       mainwindow.cpp
+       KpxConfig.cpp
+       Database.cpp
+       Kdb3Database.cpp
+       lib/bookmarks.cpp
+       lib/EntryView.cpp
+       lib/FileDialogs.cpp
+       lib/GroupView.cpp
+       lib/random.cpp
+       lib/SecString.cpp
+       lib/ShortcutWidget.cpp
+       lib/tools.cpp
+       lib/UrlLabel.cpp
+       lib/WaitAnimationWidget.cpp
+       crypto/aescrypt.c
+       crypto/aeskey.c
+       crypto/aes_modes.c
+       crypto/aestab.c
+       crypto/arcfour.cpp
+       crypto/blowfish.cpp
+       crypto/sha256.cpp
+       crypto/twoclass.cpp
+       crypto/twofish.cpp
+       crypto/yarrow.cpp
+       apg/convert.c
+       apg/pronpass.c
+       apg/randpass.c
+       dialogs/AboutDlg.cpp
+       dialogs/AddBookmarkDlg.cpp
+       dialogs/CalendarDlg.cpp
+       dialogs/CollectEntropyDlg.cpp
+       dialogs/CustomizeDetailViewDlg.cpp
+       dialogs/DatabaseSettingsDlg.cpp
+       dialogs/EditEntryDlg.cpp
+       dialogs/EditGroupDlg.cpp
+       dialogs/ExpiredEntriesDlg.cpp
+       dialogs/HelpDlg.cpp
+       dialogs/ManageBookmarksDlg.cpp
+       dialogs/PasswordDlg.cpp
+       dialogs/PasswordGenDlg.cpp
+       dialogs/SearchDlg.cpp
+       dialogs/SelectIconDlg.cpp
+       dialogs/SettingsDlg.cpp
+       dialogs/SimplePasswordDlg.cpp
+#      dialogs/TrashCanDlg.cpp
+       import/Import.cpp
+#      import/Import_GnuKeyRing.cpp
+       import/Import_KeePassX_Xml.cpp
+       import/Import_KWalletXml.cpp
+       import/Import_PwManager.cpp
+       export/Export.cpp
+       export/Export_KeePassX_Xml.cpp
+       export/Export_Txt.cpp
+)
+
+SET(keepassx_FORMS
+       forms/AboutDlg.ui
+       forms/AddBookmarkDlg.ui
+       forms/CalendarDlg.ui
+       forms/CollectEntropyDlg.ui
+       forms/CustomizeDetailViewDlg.ui
+       forms/DatabaseSettingsDlg.ui
+       forms/EditEntryDlg.ui
+       forms/EditGroupDlg.ui
+       forms/ExpiredEntriesDlg.ui
+       forms/HelpDlg.ui
+       forms/MainWindow.ui
+       forms/ManageBookmarksDlg.ui
+       forms/PasswordDlg.ui
+       forms/PasswordGenDlg.ui
+       forms/SearchDlg.ui
+       forms/SelectIconDlg.ui
+       forms/SettingsDlg.ui
+       forms/SimplePasswordDlg.ui
+#      forms/TrashCanDlg.ui
+       forms/WorkspaceLockedWidget.ui
+)
+
+SET(keepassx_RESOURCES res/resources.qrc)
+
+set(keepassx_TRANSLATIONS
+#      translations/keepassx-cs_CZ.ts
+       translations/keepassx-de_DE.ts
+       translations/keepassx-es_ES.ts
+       translations/keepassx-fi_FI.ts
+       translations/keepassx-fr_FR.ts
+       translations/keepassx-gl_ES.ts
+       translations/keepassx-hu_HU.ts
+       translations/keepassx-it_IT.ts
+       translations/keepassx-ja_JP.ts
+       translations/keepassx-nb_NO.ts
+       translations/keepassx-nl_NL.ts
+       translations/keepassx-pl_PL.ts
+       translations/keepassx-ru_RU.ts
+       translations/keepassx-tr_TR.ts
+       translations/keepassx-uk_UA.ts
+       translations/keepassx-zh_CN.ts
+       translations/qt_fi.ts
+       translations/qt_hu.ts
+       translations/qt_it.ts
+       translations/qt_nl.ts
+       translations/qt_tr.ts
+)
+
+#IF( MINGW )
+#      SET(keepassx_SOURCES ${keepassx_SOURCES} main_win32.cpp)
+#ELSEIF( APPLE )
+#      SET(keepassx_SOURCES ${keepassx_SOURCES} main_macx.cpp)
+#ELSE( MINGW )
+#      SET(keepassx_SOURCES ${keepassx_SOURCES} main_unix.cpp)
+#ENDIF( MINGW )
+
+IF( AUTOTYPE )
+       SET(keepassx_HEADERS ${keepassx_HEADERS}
+               Application_X11.h dialogs/AutoTypeDlg.h lib/AutoTypeTreeWidget.h dialogs/TargetWindowDlg.h)
+       SET(keepassx_SOURCES ${keepassx_SOURCES}
+               lib/HelperX11.cpp lib/AutoTypeX11.cpp Application_X11.cpp lib/AutoTypeGlobalX11.cpp
+               dialogs/AutoTypeDlg.cpp lib/AutoTypeTreeWidget.cpp dialogs/TargetWindowDlg.cpp)
+       SET(keepassx_FORMS ${keepassx_FORMS}
+               forms/AutoTypeDlg.ui forms/TargetWindowDlg.ui)
+ENDIF( AUTOTYPE )
+
+IF( NOT PRECOMPILED_HEADER )
+       ADD_DEFINITIONS(-include keepassx.h)
+ENDIF( NOT PRECOMPILED_HEADER )
+
+INCLUDE_DIRECTORIES(. lib crypto plugins/interfaces export import dialogs ${CMAKE_CURRENT_BINARY_DIR})
+
+QT4_ADD_RESOURCES( keepassx_RESOURCES_SOURCES ${keepassx_RESOURCES} )
+QT4_WRAP_UI( keepassx_FORMS_HEADERS ${keepassx_FORMS} )
+QT4_WRAP_CPP( keepassx_HEADERS_MOC ${keepassx_HEADERS} )
+
+ADD_EXECUTABLE( ${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES} ${keepassx_HEADERS_MOC}
+       ${keepassx_RESOURCES_SOURCES} ${keepassx_FORMS_HEADERS} ${keepassx_RCS} )
+IF( PRECOMPILED_HEADER )
+       ADD_PRECOMPILED_HEADER(${PROGNAME} keepassx.h)
+ENDIF( PRECOMPILED_HEADER )
+
+TARGET_LINK_LIBRARIES(${PROGNAME} ${QT_LIBRARIES} ${AUTOTYPE_LIBRARIES})
+
+QT4_ADD_TRANSLATION(QM_FILES ${keepassx_TRANSLATIONS})
+ADD_CUSTOM_TARGET(translations ALL DEPENDS ${QM_FILES})
+
+INSTALL(TARGETS ${PROGNAME} DESTINATION ${BINDIR})
+INSTALL(FILES ${QM_FILES} DESTINATION ${SHAREDIR}/i18n)
diff --git a/src/Database.cpp b/src/Database.cpp
new file mode 100644 (file)
index 0000000..c87fd32
--- /dev/null
@@ -0,0 +1,140 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2007 by Tarek Saidi                                *
+ *   tarek.saidi@arcor.de                                                  *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+
+
+KpxUuid::KpxUuid() : Data(16,0){
+}
+
+KpxUuid::KpxUuid(const void* src){
+       fromRaw(src);
+}
+
+void KpxUuid::generate(){
+       char uuid[16];
+       randomize(uuid,16);
+       quint32 Secs=QDateTime::currentDateTime().toTime_t();
+       quint16 mSecs=QTime::currentTime().msec();
+       mSecs=(mSecs & 0x3FF) | (*((quint16*)(uuid+4)) & 0xFC00); //msec has only 10 Bits, filling the rest with random data
+       memcpy((void*)uuid,&Secs,4);
+       memcpy((void*)(uuid+4),&mSecs,2);
+       Data=QByteArray(uuid,16);
+}
+
+QString KpxUuid::toString()const{
+       QString hex;
+       Q_ASSERT(Data.length()==16);
+       for(int i=0;i<16;i++){
+               QString HexByte;
+               HexByte.setNum((unsigned char)*(Data.data()+i),16);
+               if(HexByte.length()<2)HexByte="0"+HexByte;
+               hex+=HexByte;
+       }
+       return QString("{%1-%2-%3-%4-%5}")
+                       .arg(hex.mid(0,8))
+                       .arg(hex.mid(8,4))
+                       .arg(hex.mid(12,4))
+                       .arg(hex.mid(16,4))
+                       .arg(hex.mid(20,12));
+}
+
+void KpxUuid::toRaw(void* dst)const{
+       memcpy(dst,Data.data(),16);
+}
+
+void KpxUuid::fromRaw(const void* src){
+       Data=QByteArray((char*)src,16);
+}
+
+bool KpxUuid::operator==(const KpxUuid& other)const{
+       return other.Data==Data;
+}
+
+bool KpxUuid::operator!=(const KpxUuid& other)const{
+       return other.Data!=Data;
+}
+
+
+
+QString KpxDateTime::toString(Qt::DateFormat format) const{
+       if (*this==Date_Never)
+               return QCoreApplication::translate("Database","Never");
+       else if (format==Qt::SystemLocaleDate){
+               QString strFormat = QLocale::system().dateFormat(QLocale::ShortFormat);
+               if (!strFormat.contains("dd")) strFormat.replace("d", "dd");
+               if (!strFormat.contains("MM")) strFormat.replace("M", "MM");
+               if (!strFormat.contains("yyyy")) strFormat.replace("yy", "yyyy");
+               if (!strFormat.contains("hh")) strFormat.replace("h", "hh");
+               if (!strFormat.contains("HH")) strFormat.replace("H", "HH");
+               if (!strFormat.contains("mm")) strFormat.replace("m", "mm");
+               if (!strFormat.contains("ss")) strFormat.replace("s", "ss");
+               return date().toString(strFormat);
+       }
+       else
+               return QDateTime::toString(format);
+}
+
+QString KpxDateTime::dateToString(Qt::DateFormat format) const{
+       if (*this==Date_Never)
+               return QCoreApplication::translate("Database","Never");
+       else if (format==Qt::SystemLocaleDate){
+               QString strFormat = QLocale::system().dateFormat(QLocale::ShortFormat);
+               if (!strFormat.contains("dd")) strFormat.replace("d", "dd");
+               if (!strFormat.contains("MM")) strFormat.replace("M", "MM");
+               if (!strFormat.contains("yyyy")) strFormat.replace("yy", "yyyy");
+               return date().toString(strFormat);
+       }
+       else
+               return date().toString(format);
+}
+
+
+KpxDateTime KpxDateTime::fromString(const QString& string,Qt::DateFormat format){
+       if(string.toLower()=="never")
+               return Date_Never;
+       else return QDateTime::fromString(string,format);       
+}
+
+CEntry::CEntry(){
+       Image=0;
+       GroupId=0;
+       Creation=QDateTime::currentDateTime();
+       LastMod=QDateTime::currentDateTime();
+       LastAccess=QDateTime::currentDateTime();
+       Expire=QDateTime(QDate(2999,12,28),QTime(23,59,59)); //Never
+       Binary=QByteArray();
+}
+
+bool KpxDateTime::operator<(const QDateTime& other){
+       if(*this!=Date_Never && other!=Date_Never)return ((QDateTime)(*this)<other);
+       if(*this==Date_Never && other==Date_Never)return false;
+       if(*this==Date_Never)return false;
+       if(other==Date_Never)return true;
+       
+       return false;
+}
+
+
+CGroup::CGroup(){
+       Image=0;
+       IsExpanded=false;
+}
+
+
diff --git a/src/Database.h b/src/Database.h
new file mode 100644 (file)
index 0000000..bfcbae6
--- /dev/null
@@ -0,0 +1,414 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2006 by Tarek Saidi                                *
+ *   tarek.saidi@arcor.de                                                  *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _DATABASE_H_
+#define _DATABASE_H_
+
+extern const QDateTime Date_Never;
+
+enum CryptAlgorithm{
+       Rijndael_Cipher=0,
+       Twofish_Cipher=1
+};
+
+//! Universally Unique Identifier Class.
+/*!
+Provides generation, serialization, deserialization and comparison of UUIDs.
+*/
+class KpxUuid{
+public:
+       KpxUuid();
+       KpxUuid(const void* src);
+       void generate();
+       QString toString() const;
+       const unsigned char* data()const
+               {return (const unsigned char*) Data.data();}
+       void toRaw(void* dst)const;
+       void fromRaw(const void* src);
+       bool operator==(const KpxUuid&) const;
+       bool operator!=(const KpxUuid&) const;
+private:
+       QByteArray Data;
+};
+
+//! Advanced DateTime Class.
+/*!
+This class advances the standard Qt class 'QDateTime' with KeePassX specific methods for string conversion.
+*/
+class KpxDateTime:public QDateTime{
+       public:
+               KpxDateTime(){};
+               KpxDateTime ( const QDate & date ):QDateTime(date){};
+               KpxDateTime ( const QDate & date, const QTime & time, Qt::TimeSpec spec = Qt::LocalTime):QDateTime(date,time,spec){};
+               KpxDateTime ( const QDateTime & other ):QDateTime(other){};
+               //! Returns a string representation of the DateTime object in the given format or "Never" if the DateTime value is 28.12.2999 23:59:59.
+               virtual QString toString(Qt::DateFormat format = Qt::TextDate ) const;
+               //! Returns a string representation of the date part of the DateTime object in the given format or "Never" if the DateTime value is 28.12.2999 23:59:59.
+               QString dateToString(Qt::DateFormat format = Qt::TextDate)const;
+               static KpxDateTime fromString(const QString& string,Qt::DateFormat format = Qt::TextDate);
+               bool operator<(const QDateTime& other);
+};
+
+//! Entry Data Structure
+/*! This class holds the data of a normal database entry. It is used by some interface functions to process predefined entries and can be used for internal data handling.*/
+class CEntry{
+public:
+       CEntry();
+       KpxUuid Uuid;
+       quint32 GroupId;
+       quint32 Image;
+       QString Title;
+       QString Url;
+       QString Username;
+       SecString Password;
+       QString Comment;
+       QString BinaryDesc;
+       KpxDateTime Creation;
+       KpxDateTime LastMod;
+       KpxDateTime LastAccess;
+       KpxDateTime Expire;
+       QByteArray Binary;
+       bool operator==(const CEntry& other) const;
+};
+
+//! Group Data Structure
+/*! This class holds the data of a normal database group. It is used by some interface functions to process predefined groups and can be used for internal data handling.*/
+class CGroup{
+public:
+       CGroup();
+       quint32 Id;
+       quint32 Image;
+       QString Title;
+       bool operator==(const CGroup& other) const;
+       bool IsExpanded;
+};
+
+
+class IGroupHandle;
+class IEntryHandle;
+//! Handle class interface for accessing entries
+/*!
+The IEntryHandle interface provides access to Entry data structures without using direct references. Every entry handle class must implement this interface necessarily.
+*/
+class IEntryHandle{
+public:
+       virtual void setImage(const quint32& ImageID)=0;
+       virtual void setTitle(const QString& Title)=0;
+       virtual void setUrl(const QString& URL)=0;
+    virtual void setUsername(const QString& Username)=0;
+       virtual void setPassword(const SecString& Password)=0;
+       virtual void setComment(const QString& Comment)=0;
+       virtual void setBinaryDesc(const QString& BinaryDesc)=0;
+       virtual void setCreation(const KpxDateTime& Creation)=0;
+       virtual void setLastMod(const KpxDateTime& LastMod)=0;
+       virtual void setLastAccess(const KpxDateTime& LastAccess)=0;
+       virtual void setExpire(const KpxDateTime& Expire)=0;
+       virtual void setBinary(const QByteArray& BinaryData)=0;
+
+       virtual KpxUuid uuid()const=0;
+       virtual IGroupHandle* group()const=0;
+       virtual quint32 image()const=0;
+       virtual QString title()const=0;
+       virtual QString url()const=0;
+       virtual QString username()const=0;
+       virtual SecString password()const=0;
+       virtual QString comment()const=0;
+       virtual QString binaryDesc()const=0;
+       virtual KpxDateTime creation()const=0;
+       virtual KpxDateTime lastMod()const=0;
+       virtual KpxDateTime lastAccess()const=0;
+       virtual KpxDateTime expire()const=0;
+       virtual QByteArray binary()const=0;
+       virtual quint32 binarySize()const=0;
+       virtual QString friendlySize()const=0;
+
+       //! \return the index of the entry amongst the entries of its group. The index of the first entry is 0.
+       virtual int visualIndex()const=0;
+
+       /*! Sets the visual index of an entry. The indices of all other entries in the same group get automaticly readjusted by this function.
+               \param index The new visual index.
+       */
+       virtual void setVisualIndex(int index)=0;
+
+       /*! Sets the visual index of an entry. The indices of all other entries in the same group need to be adjusted manually!
+               This function is optimal to avoid readjustion overhead when sorting items.
+               \param index The new visual index.
+       */
+       virtual void setVisualIndexDirectly(int index)=0;
+
+       /*! Tests the validity of the handle.
+               \return TRUE if the handle is valid and FALSE if the handle is invalid e.g. because the associated entry was deleted.*/
+       virtual bool isValid()const=0;
+
+       virtual CEntry data()const=0;
+};
+
+//! Custom Icon Interface
+/*!
+This class provides an interface for the management of custom icons. The implementation is optional and not necessarily needed.
+ */
+class ICustomIcons:public QObject{
+       Q_OBJECT
+       public:
+               /*! Adds a new custom icon to the database.
+               \param icon The pixmap which contains the new icon. This function makes a copy of the given pixmap.
+                */
+               virtual void addIcon(const QPixmap& icon)=0;
+
+               /*! Removes an icon.
+               \param index The index of the icon which should be removed. Built-in icons cannot be removed so make sure that index is not the index of an Built-in icon before calling this function.
+                */
+               virtual void removeIcon(int index)=0;
+
+               /*! Replaces one icon with another one.
+               \param index The index of the icon which should be replaced. Built-in icons cannot be replaced so make sure that index is not the index of an Built-in icon before calling this function.
+               \param icon The pixmap which contains the new icon.
+                */
+               virtual void replaceIcon(int index,const QPixmap& icon)=0;
+       signals:
+               /*! This signal is emitted when an icon was modified.
+               That means it is emitted after every call off addIcon(), removeIcon() and replaceIcon().
+                */
+               void iconsModified();
+
+};
+
+
+//! Handle class interface for accessing groups
+/*!
+The IGroupHandle interface provides access to CGroup data structures without using direct references. Every entry handle class must implement this interface necessarily.
+*/
+class IGroupHandle{
+public:
+       virtual void setTitle(const QString& Title)=0;
+       virtual void setImage(const quint32& ImageID)=0;
+
+       virtual QString title()=0;
+       virtual quint32 image()=0;
+
+       //! \return a pointer to the handle of the parent group or NULL if the group has no parent.
+       virtual IGroupHandle* parent()=0;
+
+       //! \return a List of pointers to the handles of all children of the group and an empty list if the group has no children. The list is sorted.
+       virtual QList<IGroupHandle*> children()=0;
+
+       //! \return the index of the group amongst the children of its parent. The index of the first child is 0.
+       virtual int index()=0;
+
+       /*! Sets the index of a group amongst the children of its parent.
+               This function can be used to sort the groups of the database in a specific order.
+               \param index The new index of the group. The indices of the other groups which are affected by this operation will be automatically adjusted.*/
+       //virtual void setIndex(int index)=0;
+
+       /*! Tests the validity of the handle.
+               \return TRUE if the handle is valid and FALSE if the handle is invalid e.g. because the associated group was deleted.*/
+       virtual bool isValid()=0;
+
+       /*! \return the level of the group in the group tree. This level is tantamount to the number of parents that the group has. */
+       virtual int level()=0;
+
+       virtual bool expanded()=0;
+       virtual void setExpanded(bool)=0;
+
+};
+
+//! Common Database Interface.
+/*!
+This is the common base interface for databases. Every database class must implement this interface necessarily.
+*/
+class IDatabase{
+public:
+       virtual ~IDatabase(){};
+       
+       virtual bool setKey(const QString& password,const QString& keyfile)=0;
+       virtual bool isKeyError()=0;
+       virtual void generateMasterKey()=0;
+
+       //! Loads a database.
+       /*! It is not allowed to call this function if a database is already loaded.
+               \param  identifier Normally this is the filename of the database but it can also be an IP address or something else if the database is not file based.
+               \return TRUE if loading was successfull, otherwise FALSE.
+       */
+       virtual bool load(QString identifier, bool readOnly)=0;
+
+       //! Saves the current database.
+       /*! It is not allowed to call this function if no database is loaded.
+               \return TRUE if saving was successfull, otherwise FALSE.
+       */
+       virtual bool save()=0;
+
+       //! Closes the current database.
+       /*! After a call of this function the database object can be used to load another database.
+               It is not allowed to call this function if no database is loaded.
+               Please note: The database will be closed without saving it in before.
+        *  \return TRUE if closing was successfull, otherwise FALSE.
+       */
+       virtual bool close()=0;
+
+       //! Creates a new database.
+       /*! It is not allowed to call this function if a database is already loaded.
+               \return TRUE if saving was successfull, otherwise FALSE.
+       */
+       virtual void create()=0;
+
+
+       virtual bool changeFile(const QString& filename)=0;
+
+       virtual QFile* file()=0;
+
+       //! \return a list with the pointers to the handles of all entries of the database. The list contains only valid handles. The list is not sorted.
+       virtual QList<IEntryHandle*> entries()=0;
+
+       //! \param Group The group which contains the wanted entries.
+       //! \return a list of pointers to the handles of all entries which belong to the given group. The list contains only valid handles and is sorted in an ascending order regarding to the entry indices.
+       virtual QList<IEntryHandle*> entries(IGroupHandle* Group)=0;
+
+       //! \param Group The group which contains the wanted entries.
+       //! \return a list of pointers to the handles of all entries which belong to the given group. The list contains only valid handles and is sorted in an ascending order (title, username).
+       virtual QList<IEntryHandle*> entriesSortedStd(IGroupHandle* Group)=0;
+
+       //! \return a list with the pointers to the handles of all expired entries of the database. The list contains only valid handles. The list is not sorted.
+       virtual QList<IEntryHandle*> expiredEntries()=0;
+
+       //! \return a list with the pointers to the handles of all entries of the database. The list contains only valid handles and is not sorted.
+       virtual QList<IGroupHandle*> groups()=0;
+
+       /*!
+               This function might be slower than groups() - denpending on the implementation.
+               \return a list with the pointers to the handles of all entries of the database. The list ist sorted and contains only valid handles.*/
+       virtual QList<IGroupHandle*> sortedGroups()=0;
+
+       /*! \return handle of the backup group or NULL if it doesn't exist
+               \param create Create the backup group if it doesn't exist
+        */
+       virtual IGroupHandle* backupGroup(bool create=false)=0;
+
+       /*! \return the last error message or an empty QString() object if no error occured.*/
+       virtual QString getError()=0;
+
+       /*! Creates a clone of a given entry.
+               All attributes besides the UUID are copied, even the creation date.
+               \param entry The handle of the entry which should be cloned.
+               \return a pointer to the handle of the cloned entry.
+       */
+       virtual IEntryHandle* cloneEntry(const IEntryHandle* entry)=0;
+
+       /*! Deletes a given entry.
+               \param entry The handle of the entry which should be deleted.
+       */
+       virtual void deleteEntry(IEntryHandle* entry)=0;
+
+
+       /*! Deletes the last added entry.
+               This function should only be called immediately after an addEntry() call, otherwise the behavior is undefined. Immediately means that there are no other add/move/delete operations between the two function calls.*/
+       virtual void deleteLastEntry()=0;
+
+
+       /*! Deletes multiple given entries.
+               Calling this function can be faster then calling deleteEntry(..) several times - depending on the implementation.
+               Important: All entries must belong to the same group!
+               \param entries A pointer list of handles of the entries which sould be deleted. The list can be empty therefore no prior testing is necessary.*/
+       virtual void deleteEntries(QList<IEntryHandle*> entries)=0;
+
+
+       /*! Creates a new blank entry.
+               \param Group The group to which the entry should be added.
+               \return the handle of the new entry.
+       */
+       virtual IEntryHandle* newEntry(IGroupHandle* Group)=0;
+
+       /*! Adds a Entry object to the database.
+               \param Group The group to which the entry should be added.
+               \param NewEntry The new entry. It is important that the new entry object has a valid UUID!
+               \return a pointer to the handle of the added entry.
+       */
+       virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* Group)=0;
+
+       /*! Moves an entry to another group.
+               \param entry The entry which should be moved.
+               \param group The new group of the entry.*/
+       virtual void moveEntry(IEntryHandle* entry, IGroupHandle* group)=0;
+
+
+       /*! Removes a group from the database.
+               Deletes the group, all it's entries and child groups and their entries as well.
+               \param group The group which should be deleted.*/
+       virtual void deleteGroup(IGroupHandle* group)=0;
+
+       /*! Adds a group to the database.
+               \param Group A pointer to a CGroup object. Id and ParentId of the object are ignored.
+               \param Parent A pointer to the handle of parent of the group. Can be NULL if the group is a top-level group.
+               \return a pointer to the handle of the added group.*/
+       virtual IGroupHandle* addGroup(const CGroup* Group,IGroupHandle* Parent)=0;
+
+       /*! Moves a group.
+               \param Group The group which should be moved.
+               \param NewParent The new parent of the group.
+               \param Position The position of the group amongst it's new siblings. If Position is 0 the group will be prepended if it is -1 the group will be appended.*/
+       virtual void moveGroup(IGroupHandle* Group,IGroupHandle* NewParent,int Position)=0;
+
+       /*! Checks two given groups if one is the parent of the other.
+               \param Child The child group.
+               \param Parent The parent group.
+               \return TRUE if Parent is the parent of child, otherwise FALSE.*/
+       virtual bool isParent(IGroupHandle* parent, IGroupHandle* child)=0;
+
+       /*! \param index Index of the requested icon.
+               \return a reference to the pixmap of the requested icon.
+       */
+       virtual QPixmap& icon(int index)=0;
+       //! \return the number of icons provided by the database. This number can vary at runtime if the database supports custom icons.
+       virtual int numIcons()=0;
+
+       /*! Deletes all old invalid handles of the database.
+               Make sure that there are no pointers to those handles which are still in use before calling this function.*/
+       virtual void cleanUpHandles()=0;
+
+       /*! \return the number of groups in the database.*/
+       virtual int numGroups()=0;
+
+       /*! \return the number of entires in the database.*/
+       virtual int numEntries()=0;
+
+       /*! \return the number of built-in icons of the database. Each database must contain at least one built-in icon. */
+       virtual int builtinIcons()=0;
+
+       /*! Searches in the database for a string or regular expression.
+               \param Group The group where the search should be performed in. If Group is NULL the search will be performed in the whole database.
+               \param SearchString The searched string or a regular expression.
+               \param CaseSensitvie If this parameter is true the search will be case sensitive.
+               \param RegExp The SearchString parameter will be handled as regular expression if this parameter is true.
+               \param Recursive Defines whether the search should include subgroups of Group or not. This parameter has no effect if Group is NULL.
+               \param Fields A pointer to a six element bool array. It defines which fields are included into the search. The order is: title, username, url, password, comment, attachment description. The pointer can also be NULL, than the default pattern is used instead.
+               \return the search results as a list of pointers to the entry handles.*/
+       virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields)=0;
+       
+       //virtual IDatabase* groupToNewDb(IGroupHandle* group)=0;
+};
+
+class IKdbSettings{
+       public:
+               virtual void setCryptAlgorithm(CryptAlgorithm algo)=0;
+               virtual CryptAlgorithm cryptAlgorithm()=0;
+               virtual unsigned int keyTransfRounds()=0;
+               virtual void setKeyTransfRounds(unsigned int rounds)=0;
+};
+
+#endif
diff --git a/src/Kdb3Database.cpp b/src/Kdb3Database.cpp
new file mode 100644 (file)
index 0000000..4eb8f99
--- /dev/null
@@ -0,0 +1,2015 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2008 by Tarek Saidi                                *
+ *   tarek.saidi@arcor.de                                                  *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include "Kdb3Database.h"
+
+#include "crypto/twoclass.h"
+#include <QBuffer>
+#include <algorithm>
+
+#define UNEXP_ERROR error=QString("Unexpected error in: %1, Line:%2").arg(__FILE__).arg(__LINE__);
+
+const QDateTime Date_Never(QDate(2999,12,28),QTime(23,59,59));
+
+
+bool Kdb3Database::EntryHandleLessThan(const IEntryHandle* This,const IEntryHandle* Other){
+       if(!This->isValid() && Other->isValid())return true;
+       if(This->isValid() && !Other->isValid())return false;
+       if(!This->isValid() && !Other->isValid())return false;
+       return This->visualIndex()<Other->visualIndex();
+}
+
+bool Kdb3Database::EntryHandleLessThanStd(const IEntryHandle* This,const IEntryHandle* Other){
+       int comp = This->title().compare(Other->title());
+       if (comp < 0) return true;
+       else if (comp > 0) return false;
+       
+       comp = This->username().compare(Other->username());
+       if (comp < 0) return true;
+       else if (comp > 0) return false;
+       
+       return true;
+}
+
+bool Kdb3Database::StdEntryLessThan(const Kdb3Database::StdEntry& This,const Kdb3Database::StdEntry& Other){
+       return This.Index<Other.Index;
+}
+
+
+Kdb3Database::Kdb3Database() : RawMasterKey(32), RawMasterKey_CP1252(32),
+       RawMasterKey_Latin1(32), RawMasterKey_UTF8(32), MasterKey(32){
+}
+
+QString Kdb3Database::getError(){
+       return error;
+}
+
+void Kdb3Database::addIcon(const QPixmap& icon){
+       CustomIcons << icon;
+       emit iconsModified();
+}
+
+QPixmap& Kdb3Database::icon(int i){
+       if(i>=builtinIcons()+CustomIcons.size())
+               return EntryIcons[0];
+       if(i<builtinIcons())
+               return EntryIcons[i];
+       return CustomIcons[i-builtinIcons()];
+}
+
+void Kdb3Database::removeIcon(int id){
+       id-=builtinIcons();
+       if(id < 0 ) return;
+       if(id >= CustomIcons.size()) return;
+       CustomIcons.removeAt(id); // .isNull()==true
+       for(int i=0;i<Entries.size();i++){
+               if(Entries[i].Image == id+builtinIcons())
+                       Entries[i].Image=0;
+               if(Entries[i].Image>id+builtinIcons())
+                       Entries[i].Image--;
+       }
+       for(int i=0;i<Groups.size();i++){
+               if(Groups[i].Image == id+builtinIcons())
+                       Groups[i].Image=0;
+               if(Groups[i].Image>id+builtinIcons())
+                       Groups[i].Image--;
+       }
+       emit iconsModified();
+}
+
+void Kdb3Database::replaceIcon(int id,const QPixmap& icon){
+       if(id<builtinIcons())return;
+               CustomIcons[id-builtinIcons()]=icon;
+       emit iconsModified();
+}
+
+int Kdb3Database::numIcons(){
+       return builtinIcons()+CustomIcons.size();
+}
+
+bool Kdb3Database::parseMetaStream(const StdEntry& entry){
+
+       qDebug("Found Metastream: %s", CSTR(entry.Comment));
+
+       if(entry.Comment=="KPX_GROUP_TREE_STATE"){
+               parseGroupTreeStateMetaStream(entry.Binary);
+               return true;
+       }
+       else if(entry.Comment=="KPX_CUSTOM_ICONS_4"){
+               parseCustomIconsMetaStream(entry.Binary);
+               return true;
+       }
+       else if(entry.Comment=="KPX_CUSTOM_ICONS_3"){
+               if (!hasV4IconMetaStream)
+                       parseCustomIconsMetaStreamV3(entry.Binary);
+               return true;
+       }
+       else if(entry.Comment=="KPX_CUSTOM_ICONS_2"){
+               qDebug("Removed old CuIcMeSt v2");
+               return true;
+       }
+       else if(entry.Comment=="KPX_CUSTOM_ICONS"){
+               qDebug("Removed old CuIcMeSt v1");
+               return true;
+       }
+
+       return false; //unknown MetaStream
+}
+
+bool Kdb3Database::isMetaStream(StdEntry& p){
+       if(p.Binary.isNull()) return false;
+       if(p.Comment == "") return false;
+       if(p.BinaryDesc != "bin-stream") return false;
+       if(p.Title != "Meta-Info") return false;
+       if(p.Username != "SYSTEM") return false;
+       if(p.Url != "$") return false;
+       if(p.Image != 0) return false;
+       return true;
+}
+
+void Kdb3Database::parseCustomIconsMetaStream(const QByteArray& dta){
+       //Rev 4 (KeePassX 0.3.2)
+       quint32 NumIcons,NumEntries,NumGroups,offset;
+       memcpyFromLEnd32(&NumIcons,dta.data());
+       memcpyFromLEnd32(&NumEntries,dta.data()+4);
+       memcpyFromLEnd32(&NumGroups,dta.data()+8);
+       offset=12;
+       CustomIcons.clear();
+       for(int i=0;i<NumIcons;i++){
+               CustomIcons << QPixmap();
+               quint32 Size;
+               memcpyFromLEnd32(&Size,dta.data()+offset);
+               if(offset+Size > dta.size()){
+                       CustomIcons.clear();
+                       qWarning("Discarded metastream KPX_CUSTOM_ICONS_4 because of a parsing error.");
+                       return;
+               }
+               offset+=4;
+               if(!CustomIcons.back().loadFromData((const unsigned char*)dta.data()+offset,Size,"PNG")){
+                       CustomIcons.clear();
+                       qWarning("Discarded metastream KPX_CUSTOM_ICONS_4 because of a parsing error.");
+                       return;
+               }
+               offset+=Size;
+               if(offset > dta.size()){
+                       CustomIcons.clear();
+                       qWarning("Discarded metastream KPX_CUSTOM_ICONS_4 because of a parsing error.");
+                       return;
+               }
+       }
+       for(int i=0;i<NumEntries;i++){
+               quint32 Icon;
+               KpxUuid EntryUuid;
+               EntryUuid.fromRaw(dta.data()+offset);
+               offset+=16;
+               memcpyFromLEnd32(&Icon,dta.data()+offset);
+               offset+=4;
+               StdEntry* entry=getEntry(EntryUuid);
+               if(entry)
+                       entry->Image=Icon+BUILTIN_ICONS;
+       }
+       for(int i=0;i<NumGroups;i++){
+               quint32 GroupId,Icon;
+               memcpyFromLEnd32(&GroupId,dta.data()+offset);
+               offset+=4;
+               memcpyFromLEnd32(&Icon,dta.data()+offset);
+               offset+=4;
+               StdGroup* Group=getGroup(GroupId);
+               if(Group)
+                       Group->Image=Icon+BUILTIN_ICONS;
+       }
+       return;
+}
+
+void Kdb3Database::parseCustomIconsMetaStreamV3(const QByteArray& dta){
+       //Rev 3
+       quint32 NumIcons,NumEntries,NumGroups,offset;
+       memcpyFromLEnd32(&NumIcons,dta.data());
+       memcpyFromLEnd32(&NumEntries,dta.data()+4);
+       memcpyFromLEnd32(&NumGroups,dta.data()+8);
+       offset=12;
+       CustomIcons.clear();
+       for(int i=0;i<NumIcons;i++){
+               CustomIcons << QPixmap();
+               quint32 Size;
+               memcpyFromLEnd32(&Size,dta.data()+offset);
+               if(offset+Size > dta.size()){
+                       CustomIcons.clear();
+                       qWarning("Discarded metastream KPX_CUSTOM_ICONS_3 because of a parsing error.");
+                       return;
+               }
+               offset+=4;
+               if(!CustomIcons.back().loadFromData((const unsigned char*)dta.data()+offset,Size,"PNG")){
+                       CustomIcons.clear();
+                       qWarning("Discarded metastream KPX_CUSTOM_ICONS_3 because of a parsing error.");
+                       return;
+               }
+               offset+=Size;
+               if(offset > dta.size()){
+                       CustomIcons.clear();
+                       qWarning("Discarded metastream KPX_CUSTOM_ICONS_3 because of a parsing error.");
+                       return;
+               }
+       }
+       for(int i=0;i<NumEntries;i++){
+               quint32 Icon;
+               KpxUuid EntryUuid;
+               EntryUuid.fromRaw(dta.data()+offset);
+               offset+=16;
+               memcpyFromLEnd32(&Icon,dta.data()+offset);
+               offset+=4;
+               StdEntry* entry=getEntry(EntryUuid);
+               if(entry){
+                       if (Icon>=65)
+                               entry->Image=Icon+4; // Since v0.3.2 the BUILTIN_ICONS number has increased by 4
+                       else
+                               entry->Image=Icon;
+               }
+       }
+       for(int i=0;i<NumGroups;i++){
+               quint32 GroupId,Icon;
+               memcpyFromLEnd32(&GroupId,dta.data()+offset);
+               offset+=4;
+               memcpyFromLEnd32(&Icon,dta.data()+offset);
+               offset+=4;
+               StdGroup* Group=getGroup(GroupId);
+               if(Group){
+                       if (Group->Image>=65)
+                               Group->Image=Icon+4; // Since v0.3.2 the BUILTIN_ICONS number has increased by 4
+                       else
+                               Group->Image=Icon;
+               }
+       }
+       return;
+}
+
+void Kdb3Database::parseGroupTreeStateMetaStream(const QByteArray& dta){
+       if(dta.size()<4){
+               qWarning("Discarded metastream KPX_GROUP_TREE_STATE because of a parsing error.");
+               return;
+       }
+       quint32 Num;
+       memcpyFromLEnd32(&Num,dta.data());
+       if(Num*5!=dta.size()-4){
+               qWarning("Discarded metastream KPX_GROUP_TREE_STATE because of a parsing error.");
+               return;
+       }
+       TreeStateMetaStream.clear();
+       for(int i=0;i<Num;i++){
+               quint32 GroupID;
+               quint8 IsExpanded;
+               memcpyFromLEnd32(&GroupID,dta.data()+4+5*i);
+               memcpy(&IsExpanded,dta.data()+8+5*i,1);
+               TreeStateMetaStream.insert(GroupID,(bool)IsExpanded);
+       }
+       return;
+}
+
+void Kdb3Database::createGroupTreeStateMetaStream(StdEntry* e){
+       e->BinaryDesc="bin-stream";
+       e->Title="Meta-Info";
+       e->Username="SYSTEM";
+       e->Comment="KPX_GROUP_TREE_STATE";
+       e->Url="$";
+       e->Image=0;
+       if(Groups.size())e->GroupId=Groups[0].Id;
+       QByteArray bin;
+       quint32 Num=Groups.size();
+       bin.resize(Num*5+4);
+       memcpyToLEnd32(bin.data(),&Num);
+       for(int i=0;i<Num;i++){
+               memcpyToLEnd32(bin.data()+4+5*i,&Groups[i].Id);
+               if(Groups[i].IsExpanded)
+                       bin.data()[8+5*i]=1;
+               else
+                       bin.data()[8+5*i]=0;
+       }
+       e->Binary=bin;
+}
+
+Kdb3Database::StdEntry* Kdb3Database::getEntry(const KpxUuid& uuid){
+       for(int i=0; i<Entries.size();i++)
+               if(Entries[i].Uuid==uuid)return &Entries[i];
+       return NULL;
+}
+
+Kdb3Database::StdGroup* Kdb3Database::getGroup(quint32 Id){
+       for(int i=0; i<Groups.size();i++)
+               if(Groups[i].Id==Id)return &Groups[i];
+       return NULL;
+}
+
+
+//! Extracts one entry from raw decrypted data.
+bool Kdb3Database::readEntryField(StdEntry* entry, quint16 FieldType, quint32 FieldSize, quint8 *pData){
+switch(FieldType)
+       {
+       case 0x0000:
+               // Ignore field
+               break;
+       case 0x0001:
+               entry->Uuid=KpxUuid(pData);
+               break;
+       case 0x0002:
+               memcpyFromLEnd32(&entry->GroupId, (char*)pData);
+               break;
+       case 0x0003:
+               memcpyFromLEnd32(&entry->Image, (char*)pData);
+               break;
+       case 0x0004:
+               entry->Title=QString::fromUtf8((char*)pData);
+               break;
+       case 0x0005:
+               entry->Url=QString::fromUtf8((char*)pData);
+               break;
+       case 0x0006:
+               entry->Username=QString::fromUtf8((char*)pData);
+               break;
+       case 0x0007:{
+               QString s=QString::fromUtf8((char*)pData);
+               entry->Password.setString(s,true);
+               break;}
+       case 0x0008:
+               entry->Comment=QString::fromUtf8((char*)pData);
+               break;
+       case 0x0009:
+               entry->Creation=dateFromPackedStruct5(pData);
+               break;
+       case 0x000A:
+               entry->LastMod=dateFromPackedStruct5(pData);
+               break;
+       case 0x000B:
+               entry->LastAccess=dateFromPackedStruct5(pData);
+               break;
+       case 0x000C:
+               entry->Expire=dateFromPackedStruct5(pData);
+               break;
+       case 0x000D:
+               entry->BinaryDesc=QString::fromUtf8((char*)pData);
+               break;
+       case 0x000E:
+               if(FieldSize != 0)
+                       entry->Binary=QByteArray((char*)pData,FieldSize);
+               else
+                       entry->Binary=QByteArray();
+               break;
+       case 0xFFFF:
+               break;
+       default:
+               return false;
+       }
+       return true;
+}
+
+//! Extracts one group from raw decrypted data.
+bool Kdb3Database::readGroupField(StdGroup* group,QList<quint32>& Levels,quint16 FieldType, quint8 *pData)
+{
+       switch(FieldType)
+       {
+       case 0x0000:
+               // Ignore field
+               break;
+       case 0x0001:
+               memcpyFromLEnd32(&group->Id, (char*)pData);
+               break;
+       case 0x0002:
+               group->Title=QString::fromUtf8((char*)pData);
+               break;
+       case 0x0003: //not longer used by KeePassX but part of the KDB format
+               break;
+       case 0x0004: //not longer used by KeePassX but part of the KDB format
+               break;
+       case 0x0005: //not longer used by KeePassX but part of the KDB format
+               break;
+       case 0x0006: //not longer used by KeePassX but part of the KDB format
+               break;
+       case 0x0007:
+               memcpyFromLEnd32(&group->Image, (char*)pData);
+               break;
+       case 0x0008:
+               quint16 Level;
+               memcpyFromLEnd16(&Level, (char*)pData);
+               Levels.append(Level);
+               break;
+       case 0x0009:
+                //not used by KeePassX but part of the KDB format
+                //memcpyFromLEnd32(&Flags, (char*)pData);
+               break;
+       case 0xFFFF:
+               break;
+       default:
+               return false; // Field unsupported
+       }
+
+       return true; // Field supported
+}
+
+bool Kdb3Database::createGroupTree(QList<quint32>& Levels){
+       if(Levels[0]!=0) return false;
+       //find the parent for every group
+       for(int i=0;i<Groups.size();i++){
+               if(Levels[i]==0){
+                       Groups[i].Parent=&RootGroup;
+                       Groups[i].Index=RootGroup.Children.size();
+                       RootGroup.Children.append(&Groups[i]);
+                       continue;
+               }
+               int j;
+               //the first item with a lower level is the parent
+               for(j=i-1;j>=0;j--){
+                       if(Levels[j]<Levels[i]){
+                               if(Levels[i]-Levels[j]!=1)return false;
+                               break;
+                       }
+                       if(j==0)return false; //No parent found
+               }
+               Groups[i].Parent=&Groups[j];
+               Groups[i].Index=Groups[j].Children.size();
+               Groups[i].Parent->Children.append(&Groups[i]);
+       }
+
+       QList<int> EntryIndexCounter;
+       for(int i=0;i<Groups.size();i++)EntryIndexCounter << 0;
+
+       for(int e=0;e<Entries.size();e++){
+               for(int g=0;g<Groups.size();g++){
+                       if(Entries[e].GroupId==Groups[g].Id){
+                               Groups[g].Entries.append(&Entries[e]);
+                               Entries[e].Group=&Groups[g];
+                               Entries[e].Index=EntryIndexCounter[g];
+                               EntryIndexCounter[g]++;
+                       }
+               }
+       }
+
+       return true;
+}
+
+void Kdb3Database::createHandles(){
+       for(int i=0;i<Groups.size();i++){
+               GroupHandles.append(GroupHandle(this));
+               Groups[i].Handle=&GroupHandles.back();
+               GroupHandles.back().Group=&Groups[i];
+       }
+       for(int i=0;i<Entries.size();i++){
+               EntryHandles.append(EntryHandle(this));
+               Entries[i].Handle=&EntryHandles.back();
+               EntryHandles.back().Entry=&Entries[i];
+       }
+}
+
+void Kdb3Database::restoreGroupTreeState(){
+       switch (config->groupTreeState()){
+               case KpxConfig::RestoreLast:
+                       for(int i=0;i<Groups.size();i++){
+                               if(TreeStateMetaStream.contains(Groups[i].Id))
+                                       Groups[i].IsExpanded=TreeStateMetaStream.value(Groups[i].Id);
+                       }
+                       break;
+
+               case KpxConfig::ExpandAll:
+                       for(int i=0;i<Groups.size();i++)
+                               Groups[i].IsExpanded=true;
+                       break;
+               
+               case KpxConfig::DoNothing:
+                       break;
+       }
+}
+
+bool Kdb3Database::load(QString identifier, bool readOnly){
+       return loadReal(identifier, readOnly, false);
+}
+
+#define LOAD_RETURN_CLEANUP \
+       delete File; \
+       File = NULL; \
+       delete[] buffer; \
+       return false;
+
+bool Kdb3Database::loadReal(QString filename, bool readOnly, bool differentEncoding) {
+       unsigned long total_size,crypto_size;
+       quint32 Signature1,Signature2,Version,NumGroups,NumEntries,Flags;
+       quint8 FinalRandomSeed[16];
+       quint8 ContentsHash[32];
+       quint8 EncryptionIV[16];
+       
+       File = new QFile(filename);
+       if (readOnly) {
+               if(!File->open(QIODevice::ReadOnly)){
+                       error=tr("Could not open file.");
+                       delete File;
+                       File = NULL;
+                       return false;
+               }
+       }
+       else {
+               if(!File->open(QIODevice::ReadWrite)){
+                       if(!File->open(QIODevice::ReadOnly)){
+                               error=tr("Could not open file.");
+                               delete File;
+                               File = NULL;
+                               return false;
+                       }
+                       else{
+                               readOnly = true;
+                       }
+               }
+       }
+       
+       total_size=File->size();
+       char* buffer = new char[total_size];
+       File->read(buffer,total_size);
+       
+       if(total_size < DB_HEADER_SIZE){
+               error=tr("Unexpected file size (DB_TOTAL_SIZE < DB_HEADER_SIZE)");
+               LOAD_RETURN_CLEANUP
+       }
+       
+       memcpyFromLEnd32(&Signature1,buffer);
+       memcpyFromLEnd32(&Signature2,buffer+4);
+       memcpyFromLEnd32(&Flags,buffer+8);
+       memcpyFromLEnd32(&Version,buffer+12);
+       memcpy(FinalRandomSeed,buffer+16,16);
+       memcpy(EncryptionIV,buffer+32,16);
+       memcpyFromLEnd32(&NumGroups,buffer+48);
+       memcpyFromLEnd32(&NumEntries,buffer+52);
+       memcpy(ContentsHash,buffer+56,32);
+       memcpy(TransfRandomSeed,buffer+88,32);
+       memcpyFromLEnd32(&KeyTransfRounds,buffer+120);
+       
+       if((Signature1!=PWM_DBSIG_1) || (Signature2!=PWM_DBSIG_2)){
+               error=tr("Wrong Signature");
+               LOAD_RETURN_CLEANUP
+       }
+       
+       if((Version & 0xFFFFFF00) != (PWM_DBVER_DW & 0xFFFFFF00)){
+               error=tr("Unsupported File Version.");
+               LOAD_RETURN_CLEANUP
+       }
+       
+       if (Flags & PWM_FLAG_RIJNDAEL)
+               Algorithm = Rijndael_Cipher;
+       else if (Flags & PWM_FLAG_TWOFISH)
+               Algorithm = Twofish_Cipher;
+       else{
+               error=tr("Unknown Encryption Algorithm.");
+               LOAD_RETURN_CLEANUP
+       }
+       
+       RawMasterKey.unlock();
+       MasterKey.unlock();
+       KeyTransform::transform(*RawMasterKey,*MasterKey,TransfRandomSeed,KeyTransfRounds);
+       
+       quint8 FinalKey[32];
+       
+       SHA256 sha;
+       sha.update(FinalRandomSeed,16);
+       sha.update(*MasterKey,32);
+       sha.finish(FinalKey);
+       
+       RawMasterKey.lock();
+       MasterKey.lock();
+       
+       if(Algorithm == Rijndael_Cipher){
+               AESdecrypt aes;
+               aes.key256(FinalKey);
+               aes.cbc_decrypt((unsigned char*)buffer+DB_HEADER_SIZE,(unsigned char*)buffer+DB_HEADER_SIZE,total_size-DB_HEADER_SIZE,(unsigned char*)EncryptionIV);
+               crypto_size=total_size-((quint8*)buffer)[total_size-1]-DB_HEADER_SIZE;
+       }
+       else if(Algorithm == Twofish_Cipher){
+               CTwofish twofish;
+               if (twofish.init(FinalKey, 32, EncryptionIV) != true){
+                       error=tr("Unable to initialize the twofish algorithm.");
+                       LOAD_RETURN_CLEANUP
+               }
+               crypto_size = (unsigned long)twofish.padDecrypt((quint8 *)buffer + DB_HEADER_SIZE,
+               total_size - DB_HEADER_SIZE, (quint8 *)buffer + DB_HEADER_SIZE);
+       }
+       else{
+               error=tr("Unknown encryption algorithm.");
+               LOAD_RETURN_CLEANUP
+       }
+       
+       if ((crypto_size > 2147483446) || (!crypto_size && NumGroups)){
+               error=tr("Decryption failed.\nThe key is wrong or the file is damaged.");
+               LOAD_RETURN_CLEANUP
+       }
+       SHA256::hashBuffer(buffer+DB_HEADER_SIZE,FinalKey,crypto_size);
+       
+       if(memcmp(ContentsHash, FinalKey, 32) != 0){
+               if(PotentialEncodingIssueLatin1){
+                       delete[] buffer;
+                       delete File;
+                       File = NULL;
+                       
+                       RawMasterKey.copyData(RawMasterKey_Latin1);
+                       PotentialEncodingIssueLatin1 = false;
+                       qDebug("Decryption failed. Retrying with Latin-1.");
+                       return loadReal(filename, readOnly, true); // second try
+               }
+               if(PotentialEncodingIssueUTF8){
+                       delete[] buffer;
+                       delete File;
+                       File = NULL;
+                       
+                       RawMasterKey.copyData(RawMasterKey_UTF8);
+                       PotentialEncodingIssueUTF8 = false;
+                       qDebug("Decryption failed. Retrying with UTF-8.");
+                       return loadReal(filename, readOnly, true); // second/third try
+               }
+               error=tr("Hash test failed.\nThe key is wrong or the file is damaged.");
+               KeyError=true;
+               LOAD_RETURN_CLEANUP
+       }
+       
+       unsigned long pos = DB_HEADER_SIZE;
+       quint16 FieldType;
+       quint32 FieldSize;
+       char* pField;
+       bool bRet;
+       StdGroup group;
+       QList<quint32> Levels;
+       RootGroup.Title="$ROOT$";
+       RootGroup.Parent=NULL;
+       RootGroup.Handle=NULL;
+       
+       for(unsigned long CurGroup = 0; CurGroup < NumGroups; )
+       {
+               pField = buffer+pos;
+       
+               memcpyFromLEnd16(&FieldType, pField);
+               pField += 2; pos += 2;
+               if (pos >= total_size){
+                       error=tr("Unexpected error: Offset is out of range.").append(" [G1]");
+                       LOAD_RETURN_CLEANUP
+               }
+       
+               memcpyFromLEnd32(&FieldSize, pField);
+               pField += 4; pos += 4;
+               if (pos >= (total_size + FieldSize)){
+                       error=tr("Unexpected error: Offset is out of range.").append(" [G2]");
+                       LOAD_RETURN_CLEANUP
+               }
+       
+               bRet = readGroupField(&group,Levels, FieldType, (quint8 *)pField);
+               if ((FieldType == 0xFFFF) && (bRet == true)){
+                       Groups << group;
+                       CurGroup++; // Now and ONLY now the counter gets increased
+               }
+               pField += FieldSize;
+               pos += FieldSize;
+               if (pos >= total_size){
+                       error=tr("Unexpected error: Offset is out of range.").append(" [G1]");
+                       LOAD_RETURN_CLEANUP
+               }
+       }
+       
+       StdEntry entry;
+       
+       for (unsigned long CurEntry = 0; CurEntry < NumEntries;)
+       {
+               pField = buffer+pos;
+       
+               memcpyFromLEnd16(&FieldType, pField);
+               pField += 2; pos += 2;
+               if(pos >= total_size){
+                       error=tr("Unexpected error: Offset is out of range.").append(" [E1]");
+                       LOAD_RETURN_CLEANUP
+               }
+       
+               memcpyFromLEnd32(&FieldSize, pField);
+               pField += 4; pos += 4;
+               if (pos >= (total_size + FieldSize)){
+                       error=tr("Unexpected error: Offset is out of range.").append(" [E2]");
+                       LOAD_RETURN_CLEANUP
+               }
+       
+               bRet = readEntryField(&entry,FieldType,FieldSize,(quint8*)pField);
+       
+               if((FieldType == 0xFFFF) && (bRet == true)){
+                       Entries << entry;
+                       if(!entry.GroupId)
+                               qDebug("NULL: %i, '%s'", (int)CurEntry, (char*)entry.Title.toUtf8().data());
+                       CurEntry++;
+               }
+       
+               pField += FieldSize;
+               pos += FieldSize;
+               if (pos >= total_size){
+                       error=tr("Unexpected error: Offset is out of range.").append(" [E3]");
+                       LOAD_RETURN_CLEANUP
+               }
+       }
+       
+       if(!createGroupTree(Levels)){
+               error=tr("Invalid group tree.");
+               LOAD_RETURN_CLEANUP
+       }
+       
+       delete [] buffer;
+       
+       hasV4IconMetaStream = false;
+       for(int i=0;i<Entries.size();i++){
+               if(isMetaStream(Entries[i]) && Entries[i].Comment=="KPX_CUSTOM_ICONS_4"){
+                       hasV4IconMetaStream = true;
+                       break;
+               }
+       }
+       
+       //Remove the metastreams from the entry list
+       for(int i=0;i<Entries.size();i++){
+               if(isMetaStream(Entries[i])){
+                       if(!parseMetaStream(Entries[i]))
+                               UnknownMetaStreams << Entries[i];
+                       Entries.removeAt(i);
+                       i--;
+               }
+       }
+       
+       int* EntryIndices=new int[Groups.size()];
+       for(int i=0;i<Groups.size();i++)EntryIndices[i]=0;
+       
+       for(int g=0;g<Groups.size();g++){
+               for(int e=0;e<Entries.size();e++){
+                       if(Entries[e].GroupId==Groups[g].Id){
+                               Entries[e].Index=EntryIndices[g];
+                               EntryIndices[g]++;
+                       }
+               }
+       }
+       delete [] EntryIndices;
+       createHandles();
+       restoreGroupTreeState();
+       
+       passwordEncodingChanged = differentEncoding;
+       if (differentEncoding) {
+               RawMasterKey.copyData(RawMasterKey_CP1252);
+               generateMasterKey();
+       }
+       
+       return true;
+}
+
+QDateTime Kdb3Database::dateFromPackedStruct5(const unsigned char* pBytes){
+       quint32 dw1, dw2, dw3, dw4, dw5;
+       dw1 = (quint32)pBytes[0]; dw2 = (quint32)pBytes[1]; dw3 = (quint32)pBytes[2];
+       dw4 = (quint32)pBytes[3]; dw5 = (quint32)pBytes[4];
+       int y = (dw1 << 6) | (dw2 >> 2);
+       int mon = ((dw2 & 0x00000003) << 2) | (dw3 >> 6);
+       int d = (dw3 >> 1) & 0x0000001F;
+       int h = ((dw3 & 0x00000001) << 4) | (dw4 >> 4);
+       int min = ((dw4 & 0x0000000F) << 2) | (dw5 >> 6);
+       int s = dw5 & 0x0000003F;
+       return QDateTime(QDate(y,mon,d),QTime(h,min,s));
+}
+
+
+void Kdb3Database::dateToPackedStruct5(const QDateTime& d,unsigned char* pBytes){
+       pBytes[0] = (quint8)(((quint32)d.date().year() >> 6) & 0x0000003F);
+       pBytes[1] = (quint8)((((quint32)d.date().year() & 0x0000003F) << 2) | (((quint32)d.date().month() >> 2) & 0x00000003));
+       pBytes[2] = (quint8)((((quint32)d.date().month() & 0x00000003) << 6) | (((quint32)d.date().day() & 0x0000001F) << 1) | (((quint32)d.time().hour() >> 4) & 0x00000001));
+       pBytes[3] = (quint8)((((quint32)d.time().hour() & 0x0000000F) << 4) | (((quint32)d.time().minute() >> 2) & 0x0000000F));
+       pBytes[4] = (quint8)((((quint32)d.time().minute() & 0x00000003) << 6) | ((quint32)d.time().second() & 0x0000003F));
+}
+
+
+int Kdb3Database::numGroups(){
+       return Groups.size();
+}
+
+int Kdb3Database::numEntries(){
+       return Entries.size();
+}
+
+void Kdb3Database::deleteGroup(StdGroup* group){
+
+       while(group->Children.size())
+               deleteGroup(group->Children.front());
+
+       QList<IEntryHandle*> GroupEntries;
+       GroupEntries=entries(group->Handle);
+       deleteEntries(GroupEntries);
+
+       Q_ASSERT(group==group->Parent->Children[group->Index]);
+       group->Parent->Children.removeAt(group->Index);
+       for(int i=group->Index;i<group->Parent->Children.size();i++){
+               group->Parent->Children[i]->Index--;
+       }
+       group->Handle->invalidate();
+
+       for(int i=0;i<Groups.size();i++){
+               if(&Groups[i]==group){
+                       Groups.removeAt(i);
+                       break;
+               }
+       }
+
+}
+
+
+void Kdb3Database::deleteGroup(IGroupHandle* group){
+       deleteGroup(((GroupHandle*)group)->Group);
+}
+
+/*
+void Kdb3Database::GroupHandle::setIndex(int index){
+       quint32 ParentId=((GroupHandle*)parent())->Id;
+       int Pos=pDB->getGroupListIndex(this);
+       int NewPos=0;
+       // Move the group to the new position in the list
+       if(ParentId)
+               NewPos=pDB->getGroupListIndex((GroupHandle*)parent());
+       if(!index){
+               if(ParentId)
+                       pDB->Groups.move(Pos,NewPos+1);
+               else
+                       pDB->Groups.move(Pos,NewPos);
+       }
+       else{
+               for(NewPos;NewPos<pDB->Groups.size();NewPos++){
+                       if(pDB->Groups[NewPos].ParentId==ParentId && pDB->Groups[NewPos].Index+1==index)
+                               break;
+               }
+               //skip the children of the found sibling
+               for(NewPos;NewPos<Groups.size();NewPos++){
+                       if(Groups[NewPos]
+                       pDB->Groups.move(Pos,NewPos);
+               }
+
+       }
+       // adjust the indices
+       int NewIndex=0;
+       for(int i=0;i<pDB->Groups.size();i++){
+               if(pDB->Groups[i].ParentId==ParentId){
+                       pDB->Groups[i].Index=NewIndex;
+                       NewIndex++;
+               }
+       }
+}
+*/
+
+bool Kdb3Database::convHexToBinaryKey(char* HexKey, char* dst){
+       QString hex=QString::fromAscii(HexKey,64);
+       for(int i=0; i<64; i+=2){
+               bool err;
+               quint8 bin;
+               bin=hex.mid(i,2).toUInt(&err,16);
+               if(!err)return false;
+               memcpy(dst+(i/2),&bin,1);
+       }
+       return true;
+}
+
+bool Kdb3Database::setKey(const QString& password,const QString& keyfile){
+       if(!password.isEmpty() && !keyfile.isEmpty())
+               return setCompositeKey(password,keyfile);
+       if(!password.isEmpty())
+               return setPasswordKey(password);
+       if(!keyfile.isEmpty())
+               return setFileKey(keyfile);
+       Q_ASSERT(false);
+       return false;
+}
+
+bool Kdb3Database::setPasswordKey(const QString& Password){
+       Q_ASSERT(Password.size());
+       QTextCodec* codec=QTextCodec::codecForName("Windows-1252");
+       QByteArray Password_CP1252 = codec->fromUnicode(Password);
+       RawMasterKey_CP1252.unlock();
+       SHA256::hashBuffer(Password_CP1252.data(),*RawMasterKey_CP1252,Password_CP1252.size());
+       RawMasterKey_CP1252.lock();
+       RawMasterKey.copyData(RawMasterKey_CP1252);
+       
+       QByteArray Password_Latin1 = Password.toLatin1();
+       QByteArray Password_UTF8 = Password.toUtf8();
+       PotentialEncodingIssueLatin1 = false;
+       PotentialEncodingIssueUTF8 = false;
+       
+       if (Password_Latin1 != Password_CP1252){
+               // KeePassX used Latin-1 encoding for passwords until version 0.3.1
+               // but KeePass/Win32 uses Windows Codepage 1252.
+               // To stay compatible with databases created with KeePassX <= 0.3.1
+               // the loading function gives both encodings a try.
+               PotentialEncodingIssueLatin1 = true;
+               RawMasterKey_Latin1.unlock();
+               SHA256::hashBuffer(Password_Latin1.data(),*RawMasterKey_Latin1,Password_Latin1.size());
+               RawMasterKey_Latin1.lock();
+       }
+       
+       if (Password_UTF8 != Password_CP1252){
+               // KeePassX used UTF-8 encoding for passwords until version 0.2.2
+               // but KeePass/Win32 uses Windows Codepage 1252.
+               // To stay compatible with databases created with KeePassX <= 0.2.2
+               // the loading function gives both encodings a try.
+               PotentialEncodingIssueUTF8 = true;
+               RawMasterKey_UTF8.unlock();
+               SHA256::hashBuffer(Password_UTF8.data(),*RawMasterKey_UTF8,Password_UTF8.size());
+               RawMasterKey_UTF8.lock();
+       }
+       
+       return true;
+}
+
+bool Kdb3Database::setFileKey(const QString& filename){
+       QFile file(filename);
+       if(!file.open(QIODevice::ReadOnly|QIODevice::Unbuffered)){
+               error=decodeFileError(file.error());
+               return false;
+       }
+       qint64 FileSize=file.size();
+       if(FileSize == 0){
+               error=tr("Key file is empty.");
+               return false;
+       }
+       RawMasterKey.unlock();
+       if(FileSize == 32){
+               if(file.read((char*)(*RawMasterKey),32) != 32){
+                       error=decodeFileError(file.error());
+                       RawMasterKey.lock();
+                       return false;
+               }
+               RawMasterKey.lock();
+               return true;
+       }
+       if(FileSize == 64){
+               char hex[64];
+               if(file.read(hex,64) != 64){
+                       error=decodeFileError(file.error());
+                       RawMasterKey.lock();
+                       return false;
+               }
+               if (convHexToBinaryKey(hex,(char*)(*RawMasterKey))){
+                       RawMasterKey.lock();
+                       return true;
+               }
+       }
+       SHA256 sha;
+       unsigned char* buffer[2048];
+       unsigned long read;
+       do {
+               read = file.read((char*)buffer,2048);
+               if (read != 0)
+                       sha.update(buffer,read);
+       } while (read == 2048);
+       sha.finish(*RawMasterKey);
+       RawMasterKey.lock();
+       return true;
+}
+
+bool Kdb3Database::setCompositeKey(const QString& Password,const QString& filename){
+       SHA256 sha;
+       
+       setPasswordKey(Password);
+       RawMasterKey.unlock();
+       sha.update(*RawMasterKey,32);
+       RawMasterKey.lock();
+       
+       if(!setFileKey(filename))return false;
+       RawMasterKey.unlock();
+       sha.update(*RawMasterKey,32);
+       sha.finish(*RawMasterKey);
+       RawMasterKey.lock();
+       
+       return true;
+}
+
+QList<IEntryHandle*> Kdb3Database::entries(){
+       QList<IEntryHandle*> handles;
+       for(int i=0; i<EntryHandles.size(); i++){
+               if(EntryHandles[i].isValid())handles.append(&EntryHandles[i]);
+       }
+       return handles;
+}
+
+QList<IEntryHandle*> Kdb3Database::expiredEntries(){
+       QList<IEntryHandle*> handles;
+       for(int i=0; i<EntryHandles.size(); i++){
+               if(EntryHandles[i].isValid() &&
+                 (EntryHandles[i].expire()<=QDateTime::currentDateTime()) &&
+                 (EntryHandles[i].expire()!=Date_Never))
+                       handles.append(&EntryHandles[i]);
+       }
+       return handles;
+}
+
+QList<IEntryHandle*> Kdb3Database::entries(IGroupHandle* Group){
+       QList<IEntryHandle*> handles;
+       for(int i=0; i<EntryHandles.size(); i++){
+               if(EntryHandles[i].isValid() && (EntryHandles[i].group()==Group))
+                       handles.append(&EntryHandles[i]);
+       }
+       qSort(handles.begin(),handles.end(),EntryHandleLessThan);
+
+       return handles;
+}
+
+QList<IEntryHandle*> Kdb3Database::entriesSortedStd(IGroupHandle* Group){
+       QList<IEntryHandle*> handles;
+       for(int i=0; i<EntryHandles.size(); i++){
+               if(EntryHandles[i].isValid() && (EntryHandles[i].group()==Group))
+                       handles.append(&EntryHandles[i]);
+       }
+       qSort(handles.begin(),handles.end(),EntryHandleLessThanStd);
+
+       return handles;
+}
+
+void Kdb3Database::deleteEntry(IEntryHandle* entry){
+       if(!entry)return;
+       int j;
+       for(j=0;j<Entries.size();j++){
+               if(&Entries[j]==((EntryHandle*)entry)->Entry)
+                       break;
+       }
+       Entries[j].Handle->invalidate();
+       Entries.removeAt(j);
+}
+
+void Kdb3Database::moveEntry(IEntryHandle* entry, IGroupHandle* group){
+       ((EntryHandle*)entry)->Entry->GroupId=((GroupHandle*)group)->Group->Id;
+       ((EntryHandle*)entry)->Entry->Group=((GroupHandle*)group)->Group;
+}
+
+
+void Kdb3Database::deleteEntries(QList<IEntryHandle*> entries){
+       if(!entries.size())return;
+       StdGroup* Group=((EntryHandle*)entries[0])->Entry->Group;
+       for(int i=0;i<entries.size();i++){
+               int j;
+               for(j=0;j<Entries.size();j++){
+                       if(&Entries[j]==((EntryHandle*)entries[i])->Entry)
+                               break;
+               }
+               Group->Children.removeAt(Entries[j].Index);
+               Entries[j].Handle->invalidate();
+               Entries.removeAt(j);
+       }
+
+       for(int i=0;i<Group->Children.size();i++){
+               Group->Children[i]->Index=i;
+       }
+};
+
+QList<IGroupHandle*> Kdb3Database::groups(){
+       QList<IGroupHandle*> handles;
+       for(int i=0; i<GroupHandles.size(); i++){
+               if(GroupHandles[i].isValid())handles.append(&GroupHandles[i]);
+       }
+       return handles;
+}
+
+quint32 Kdb3Database::getNewGroupId(){
+       quint32 id;
+       bool used;
+       do{
+               used=false;
+               randomize(&id,4);
+               if(!id)continue; //group IDs must not be 0
+               for(int j=0;j<Groups.size();j++){
+                       if(Groups[j].Id==id){
+                               used=true;
+                               break;
+                       }
+               }
+       } while(used);
+       return id;
+}
+
+IGroupHandle* Kdb3Database::addGroup(const CGroup* group,IGroupHandle* ParentHandle){
+       GroupHandles.append(GroupHandle(this));
+       Groups.append(*group);
+       Groups.back().Id=getNewGroupId();
+       Groups.back().Handle=&GroupHandles.back();
+       GroupHandles.back().Group=&Groups.back();
+       if(ParentHandle){
+               Groups.back().Parent=((GroupHandle*)ParentHandle)->Group;
+               Groups.back().Index=Groups.back().Parent->Children.size();
+               Groups.back().Parent->Children.append(&Groups.back());
+       }
+       else{
+               Groups.back().Parent=&RootGroup;
+               Groups.back().Index=RootGroup.Children.size();
+               if (group->Title!="Backup" && RootGroup.Children.size() && RootGroup.Children.last()->Title=="Backup"){
+                       RootGroup.Children.last()->Index = Groups.back().Index;
+                       Groups.back().Index--;
+               }
+               Groups.back().Parent->Children.append(&Groups.back());
+       }
+       return &GroupHandles.back();
+}
+
+IGroupHandle* Kdb3Database::backupGroup(bool create){
+       IGroupHandle* group = NULL;
+       QList<IGroupHandle*> allGroups = groups();
+       for (int i=0; i<allGroups.size(); i++){
+               if (allGroups[i]->parent()==NULL && allGroups[i]->title()=="Backup"){
+                       group = allGroups[i];
+                       break;
+               }
+       }
+       
+       if (group==NULL && create){
+               CGroup newGroup;
+               newGroup.Title = "Backup";
+               newGroup.Image = 4;
+               group = addGroup(&newGroup, NULL);
+       }
+       
+       return group;
+}
+
+Kdb3Database::StdGroup::StdGroup(const CGroup& other){
+       Index=0;
+       Id=other.Id;
+       Image=other.Image;
+       Title=other.Title;
+}
+
+void Kdb3Database::EntryHandle::setTitle(const QString& Title){Entry->Title=Title; }
+void Kdb3Database::EntryHandle::setUsername(const QString& Username){Entry->Username=Username;}
+void Kdb3Database::EntryHandle::setUrl(const QString& Url){Entry->Url=Url;}
+void Kdb3Database::EntryHandle::setPassword(const SecString& Password){Entry->Password=Password;}
+void Kdb3Database::EntryHandle::setExpire(const KpxDateTime& s){Entry->Expire=s;}
+void Kdb3Database::EntryHandle::setCreation(const KpxDateTime& s){Entry->Creation=s;}
+void Kdb3Database::EntryHandle::setLastAccess(const KpxDateTime& s){Entry->LastAccess=s;}
+void Kdb3Database::EntryHandle::setLastMod(const KpxDateTime& s){Entry->LastMod=s;}
+void Kdb3Database::EntryHandle::setBinaryDesc(const QString& s){Entry->BinaryDesc=s;}
+void Kdb3Database::EntryHandle::setComment(const QString& s){Entry->Comment=s;}
+void Kdb3Database::EntryHandle::setBinary(const QByteArray& s){Entry->Binary=s;}
+void Kdb3Database::EntryHandle::setImage(const quint32& s){Entry->Image=s;}
+KpxUuid        Kdb3Database::EntryHandle::uuid()const{return Entry->Uuid;}
+IGroupHandle* Kdb3Database::EntryHandle::group()const{return Entry->Group->Handle;}
+quint32        Kdb3Database::EntryHandle::image()const{return Entry->Image;}
+QString        Kdb3Database::EntryHandle::title()const{return Entry->Title;}
+QString        Kdb3Database::EntryHandle::url()const{return Entry->Url;}
+QString        Kdb3Database::EntryHandle::username()const{return Entry->Username;}
+SecString Kdb3Database::EntryHandle::password()const{return Entry->Password;}
+QString        Kdb3Database::EntryHandle::comment()const{return Entry->Comment;}
+QString        Kdb3Database::EntryHandle::binaryDesc()const{return Entry->BinaryDesc;}
+KpxDateTime    Kdb3Database::EntryHandle::creation()const{return Entry->Creation;}
+KpxDateTime    Kdb3Database::EntryHandle::lastMod()const{return Entry->LastMod;}
+KpxDateTime    Kdb3Database::EntryHandle::lastAccess()const{return Entry->LastAccess;}
+KpxDateTime    Kdb3Database::EntryHandle::expire()const{return Entry->Expire;}
+QByteArray Kdb3Database::EntryHandle::binary()const{return Entry->Binary;}
+quint32 Kdb3Database::EntryHandle::binarySize()const{return Entry->Binary.size();}
+
+QString Kdb3Database::EntryHandle::friendlySize()const
+{
+    quint32 binsize = binarySize();
+    QString unit;
+    uint    faktor;
+    int     prec;
+
+    if (binsize < 1024)
+    {
+        unit = tr("Bytes");
+        faktor = 1;
+        prec = 0;
+    }
+    else
+    {
+        if (binsize < 1048576)
+        {
+            unit = tr("KiB");
+            faktor = 1024;
+        }
+        else
+            if (binsize < 1073741824)
+            {
+                unit = tr("MiB");
+                faktor = 1048576;
+            }
+            else
+            {
+                unit = tr("GiB");
+                faktor = 1073741824;
+            }
+        prec = 1;
+    }
+    return (QString::number((float)binsize / (float)faktor, 'f', prec) + " " + unit);
+}
+
+int Kdb3Database::EntryHandle::visualIndex()const{return Entry->Index;}
+void Kdb3Database::EntryHandle::setVisualIndexDirectly(int i){Entry->Index=i;}
+bool Kdb3Database::EntryHandle::isValid()const{return valid;}
+
+CEntry Kdb3Database::EntryHandle::data()const{
+       return *this->Entry;
+}
+
+void Kdb3Database::EntryHandle::setVisualIndex(int index){
+       QList<IEntryHandle*>Entries=pDB->entries(Entry->Group->Handle);
+       Entries.move(visualIndex(),index);
+       for(int i=0;i<Entries.size();i++){
+               dynamic_cast<Kdb3Database::EntryHandle*>(Entries[i])->Entry->Index=index;
+       }
+}
+
+Kdb3Database::EntryHandle::EntryHandle(Kdb3Database* db){
+       pDB=db;
+       valid=true;
+}
+
+
+bool Kdb3Database::GroupHandle::isValid(){return valid;}
+QString Kdb3Database::GroupHandle::title(){return Group->Title;}
+quint32        Kdb3Database::GroupHandle::image(){return Group->Image;}
+int Kdb3Database::GroupHandle::index(){return Group->Index;}
+void Kdb3Database::GroupHandle::setTitle(const QString& Title){Group->Title=Title;}
+void Kdb3Database::GroupHandle::setExpanded(bool IsExpanded){Group->IsExpanded=IsExpanded;}
+bool Kdb3Database::GroupHandle::expanded(){return Group->IsExpanded;}
+void Kdb3Database::GroupHandle::setImage(const quint32& New){Group->Image=New;}
+
+
+Kdb3Database::GroupHandle::GroupHandle(Kdb3Database* db){
+       pDB=db;
+       valid=true;
+       Group=NULL;
+}
+
+IGroupHandle* Kdb3Database::GroupHandle::parent(){
+       return (IGroupHandle*)Group->Parent->Handle;
+}
+
+int Kdb3Database::GroupHandle::level(){
+       int i=0;
+       StdGroup* group=Group;
+       while(group->Parent){
+               group=group->Parent;
+               i++;
+       }
+       i--;
+       return i;
+}
+
+
+QList<IGroupHandle*> Kdb3Database::GroupHandle::children(){
+       QList<IGroupHandle*> children;
+       for(int i=0; i < Group->Children.size(); i++){
+               children.append(Group->Children[i]->Handle);
+       }
+       return children;
+}
+
+
+void memcpyFromLEnd32(quint32* dst,const char* src){
+       if (QSysInfo::ByteOrder==QSysInfo::BigEndian){
+               memcpy(((char*)dst)+3,src+0,1);
+               memcpy(((char*)dst)+2,src+1,1);
+               memcpy(((char*)dst)+1,src+2,1);
+               memcpy(((char*)dst)+0,src+3,1);
+       }
+       else{
+               memcpy(dst,src,4);
+       }
+}
+
+void memcpyFromLEnd16(quint16* dst,const char* src){
+       if (QSysInfo::ByteOrder==QSysInfo::BigEndian){
+               memcpy(((char*)dst)+1,src+0,1);
+               memcpy(((char*)dst)+0,src+1,1);
+       }
+       else{
+               memcpy(dst,src,2);
+       }
+}
+
+void memcpyToLEnd32(char* dst,const quint32* src){
+       if (QSysInfo::ByteOrder==QSysInfo::BigEndian){
+               memcpy(dst+0,((char*)src)+3,1);
+               memcpy(dst+1,((char*)src)+2,1);
+               memcpy(dst+2,((char*)src)+1,1);
+               memcpy(dst+3,((char*)src)+0,1);
+       }
+       else{
+               memcpy(dst,src,4);
+       }
+}
+
+void memcpyToLEnd16(char* dst,const quint16* src){
+       if (QSysInfo::ByteOrder==QSysInfo::BigEndian){
+               memcpy(dst+0,((char*)src)+1,1);
+               memcpy(dst+1,((char*)src)+0,1);
+       }
+       else{
+               memcpy(dst,src,2);
+       }
+}
+
+bool Kdb3Database::save(){
+       if(!Groups.size()){
+               error=tr("The database must contain at least one group.");
+               return false;
+       }
+       
+       //Delete old backup entries
+       if (config->backup() && config->backupDelete() && config->backupDeleteAfter()>0 && backupGroup()){
+               QDateTime time = QDateTime::currentDateTime().addDays(-config->backupDeleteAfter());
+               QList<IEntryHandle*> backupEntries = entries(backupGroup());
+               for (int i=0; i<backupEntries.size(); i++){
+                       if (backupEntries[i]->lastMod()<time)
+                               deleteEntry(backupEntries[i]);
+               }
+       }
+       
+       quint32 NumGroups,NumEntries,Signature1,Signature2,Flags,Version;
+       quint8 FinalRandomSeed[16];
+       quint8 ContentsHash[32];
+       quint8 EncryptionIV[16];
+
+       if(!(File->openMode() & QIODevice::WriteOnly)){
+               error = tr("The database has been opened read-only.");
+               return false;
+       }
+
+       unsigned int FileSize;
+
+       QList<StdEntry> MetaStreams;
+       MetaStreams << StdEntry();
+       createCustomIconsMetaStream(&MetaStreams.back());
+       MetaStreams << StdEntry();
+       createGroupTreeStateMetaStream(&MetaStreams.back());
+
+       FileSize=DB_HEADER_SIZE;
+       // Get the size of all groups (94 Byte + length of the name string)
+       for(int i = 0; i < Groups.size(); i++){
+               FileSize += 94 + Groups[i].Title.toUtf8().length()+1;
+       }
+       // Get the size of all entries
+       for(int i = 0; i < Entries.size(); i++){
+               FileSize
+                       += 134
+                       +Entries[i].Title.toUtf8().length()+1
+                       +Entries[i].Username.toUtf8().length()+1
+                       +Entries[i].Url.toUtf8().length()+1
+                       +Entries[i].Password.length()+1
+                       +Entries[i].Comment.toUtf8().length()+1
+                       +Entries[i].BinaryDesc.toUtf8().length()+1
+                       +Entries[i].Binary.length();
+       }
+
+       for(int i=0; i < UnknownMetaStreams.size(); i++){
+               FileSize
+                       +=165
+                       +UnknownMetaStreams[i].Comment.toUtf8().length()+1
+                       +UnknownMetaStreams[i].Binary.length();
+       }
+
+       for(int i=0; i < MetaStreams.size(); i++){
+               FileSize
+                               +=165
+                               +MetaStreams[i].Comment.toUtf8().length()+1
+                               +MetaStreams[i].Binary.length();
+       }
+
+
+       // Round up filesize to 16-byte boundary for Rijndael/Twofish
+       FileSize = (FileSize + 16) - (FileSize % 16);
+       char* buffer=new char[FileSize+16];
+
+       Signature1 = PWM_DBSIG_1;
+       Signature2 = PWM_DBSIG_2;
+       Flags = PWM_FLAG_SHA2;
+       if(Algorithm == Rijndael_Cipher) Flags |= PWM_FLAG_RIJNDAEL;
+       else if(Algorithm == Twofish_Cipher) Flags |= PWM_FLAG_TWOFISH;
+       Version = PWM_DBVER_DW;
+       NumGroups = Groups.size();
+       NumEntries = Entries.size()+UnknownMetaStreams.size()+MetaStreams.size();
+
+       QList<StdEntry> saveEntries = Entries;
+       qSort(saveEntries.begin(),saveEntries.end(),StdEntryLessThan);
+
+       randomize(FinalRandomSeed,16);
+       randomize(EncryptionIV,16);
+
+       unsigned int pos=DB_HEADER_SIZE; // Skip the header, it will be written later
+
+       serializeGroups(buffer,pos);
+       serializeEntries(saveEntries,buffer,pos);
+       serializeEntries(UnknownMetaStreams,buffer,pos);
+       serializeEntries(MetaStreams,buffer,pos);
+       SHA256::hashBuffer(buffer+DB_HEADER_SIZE,ContentsHash,pos-DB_HEADER_SIZE);
+       memcpyToLEnd32(buffer,&Signature1);
+       memcpyToLEnd32(buffer+4,&Signature2);
+       memcpyToLEnd32(buffer+8,&Flags);
+       memcpyToLEnd32(buffer+12,&Version);
+       memcpy(buffer+16,FinalRandomSeed,16);
+       memcpy(buffer+32,EncryptionIV,16);
+       memcpyToLEnd32(buffer+48,&NumGroups);
+       memcpyToLEnd32(buffer+52,&NumEntries);
+       memcpy(buffer+56,ContentsHash,32);
+       memcpy(buffer+88,TransfRandomSeed,32);
+       memcpyToLEnd32(buffer+120,&KeyTransfRounds);
+       quint8 FinalKey[32];
+
+       SHA256 sha;
+       sha.update(FinalRandomSeed,16);
+       MasterKey.unlock();
+       sha.update(*MasterKey,32);
+       MasterKey.lock();
+       sha.finish(FinalKey);
+
+       unsigned long EncryptedPartSize;
+
+       if(Algorithm == Rijndael_Cipher){
+               EncryptedPartSize=((pos-DB_HEADER_SIZE)/16+1)*16;
+               quint8 PadLen=EncryptedPartSize-(pos-DB_HEADER_SIZE);
+               for(int i=0;i<PadLen;i++)
+                       ((quint8*)buffer)[DB_HEADER_SIZE+EncryptedPartSize-1-i]=PadLen;
+               AESencrypt aes;
+               aes.key256(FinalKey);
+               aes.cbc_encrypt((unsigned char*)buffer+DB_HEADER_SIZE,(unsigned char*)buffer+DB_HEADER_SIZE,EncryptedPartSize,(unsigned char*)EncryptionIV);
+       }
+       else{ // Algorithm == Twofish_Cipher
+               CTwofish twofish;
+               if(twofish.init(FinalKey, 32, EncryptionIV) == false){
+                       UNEXP_ERROR
+                       delete [] buffer;
+                       return false;
+               }
+               EncryptedPartSize = (unsigned long)twofish.padEncrypt((quint8*)buffer+DB_HEADER_SIZE,
+                       pos - DB_HEADER_SIZE,(quint8*)buffer+DB_HEADER_SIZE);
+       }
+       if((EncryptedPartSize > (0xFFFFFFE - 202)) || (!EncryptedPartSize && Groups.size())){
+               UNEXP_ERROR
+               delete [] buffer;
+               return false;
+       }
+       
+       int size = EncryptedPartSize+DB_HEADER_SIZE;
+       
+       if (!File->resize(size)){
+               // only recreate file if the new database is smaller
+               if (File->size() > size) {
+                       qDebug("Unable to resize, trying to recreate file");
+                       if (!File->remove() || !File->open(QIODevice::ReadWrite)) {
+                               delete [] buffer;
+                               error=decodeFileError(File->error());
+                               return false;
+                       }
+               }
+       }
+       File->seek(0);
+       if (File->write(buffer,size)!=size){
+               delete [] buffer;
+               error=decodeFileError(File->error());
+               return false;
+       }
+       if (!syncFile(File))
+               qWarning("Unable to flush file to disk");
+
+       delete [] buffer;
+       //if(SearchGroupID!=-1)Groups.push_back(SearchGroup);
+       return true;
+}
+
+void Kdb3Database::createCustomIconsMetaStream(StdEntry* e){
+       /* Rev 3 */
+       e->BinaryDesc="bin-stream";
+       e->Title="Meta-Info";
+       e->Username="SYSTEM";
+       e->Comment="KPX_CUSTOM_ICONS_4";
+       e->Url="$";
+       if(Groups.size())e->GroupId=Groups[0].Id;
+       int Size=12;
+       quint32 NumEntries=0;
+       for(quint32 i=0;i<Entries.size();i++){
+               if (Entries[i].Image>=BUILTIN_ICONS)
+                       NumEntries++;
+       }
+       quint32 NumGroups=0;
+       for(quint32 i=0;i<Groups.size();i++){
+               if (Groups[i].Image>=BUILTIN_ICONS)
+                       NumGroups++;
+       }
+       Size+=8*NumGroups+20*NumEntries;
+       Size+=CustomIcons.size()*1000; // 1KB
+       e->Binary.reserve(Size);
+       e->Binary.resize(12);
+       quint32 NumIcons=CustomIcons.size();
+
+       memcpyToLEnd32(e->Binary.data(),&NumIcons);
+       memcpyToLEnd32(e->Binary.data()+4,&NumEntries);
+       memcpyToLEnd32(e->Binary.data()+8,&NumGroups);
+       for(int i=0;i<CustomIcons.size();i++){
+               quint32 ImgSize;
+               char ImgSizeBin[4];
+               QByteArray png;
+               png.reserve(1000);
+               QBuffer buffer(&png);
+               CustomIcons[i].save(&buffer,"PNG",0);
+               ImgSize=png.size();
+               memcpyToLEnd32(ImgSizeBin,&ImgSize);
+               e->Binary.append(QByteArray::fromRawData(ImgSizeBin,4));
+               e->Binary.append(png);
+       }
+       
+       for(quint32 i=0;i<Entries.size();i++){
+               if (Entries[i].Image>=BUILTIN_ICONS){
+                       char Bin[20];
+                       Entries[i].Uuid.toRaw(Bin);
+                       quint32 id=Entries[i].Image-BUILTIN_ICONS;
+                       memcpyToLEnd32(Bin+16,&id);
+                       e->Binary.append(QByteArray::fromRawData(Bin,20));
+               }
+       }
+       for(quint32 i=0;i<Groups.size();i++){
+               if (Groups[i].Image>=BUILTIN_ICONS){
+                       char Bin[8];
+                       memcpyToLEnd32(Bin,&Groups[i].Id);
+                       quint32 id=Groups[i].Image-BUILTIN_ICONS;
+                       memcpyToLEnd32(Bin+4,&id);
+                       e->Binary.append(QByteArray::fromRawData(Bin,8));
+               }
+       }
+}
+
+QList<IGroupHandle*> Kdb3Database::sortedGroups(){
+       QList<IGroupHandle*> SortedGroups;
+       appendChildrenToGroupList(SortedGroups,RootGroup);
+       return SortedGroups;
+}
+
+
+void Kdb3Database::appendChildrenToGroupList(QList<IGroupHandle*>& list,StdGroup& group){
+       for(int i=0;i<group.Children.size();i++){
+               list << group.Children[i]->Handle;
+               appendChildrenToGroupList(list,*group.Children[i]);
+       }
+}
+
+
+void Kdb3Database::appendChildrenToGroupList(QList<StdGroup*>& list,StdGroup& group){
+       for(int i=0;i<group.Children.size();i++){
+               list << group.Children[i];
+               appendChildrenToGroupList(list,*group.Children[i]);
+       }
+}
+
+
+void Kdb3Database::serializeGroups(char* buffer,unsigned int& pos){
+       quint16 FieldType;
+       quint32 FieldSize;
+       quint32 Flags=0; //unused
+       QList<StdGroup*>SortedGroups;
+       appendChildrenToGroupList(SortedGroups,RootGroup);
+
+       for(int i=0; i < SortedGroups.size(); i++){
+               unsigned char Date[5];
+               dateToPackedStruct5(Date_Never,Date);
+               quint16 Level=0;
+               StdGroup* group=SortedGroups[i];
+               while(group->Parent){
+                       Level++;
+                       group=group->Parent;
+               }
+               Level--;
+
+               FieldType = 0x0001; FieldSize = 4;
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpyToLEnd32(buffer+pos, &SortedGroups[i]->Id); pos += 4;
+
+               FieldType = 0x0002; FieldSize = SortedGroups[i]->Title.toUtf8().length() + 1;
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpy(buffer+pos, SortedGroups[i]->Title.toUtf8(),FieldSize); pos += FieldSize;
+
+               FieldType = 0x0003; FieldSize = 5; //Creation
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpy(buffer+pos, Date,5); pos+=5;
+
+               FieldType = 0x0004; FieldSize = 5; //LastMod
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpy(buffer+pos, Date,5); pos+=5;
+
+               FieldType = 0x0005; FieldSize = 5; //LastAccess
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpy(buffer+pos, Date,5); pos+=5;
+
+               FieldType = 0x0006; FieldSize = 5; //Expire
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpy(buffer+pos, Date,5); pos+=5;
+
+               FieldType = 0x0007; FieldSize = 4;
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpyToLEnd32(buffer+pos, &SortedGroups[i]->Image); pos += 4;
+
+               FieldType = 0x0008; FieldSize = 2;
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpyToLEnd16(buffer+pos, &Level); pos += 2;
+
+               FieldType = 0x0009; FieldSize = 4;
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+               memcpyToLEnd32(buffer+pos, &Flags); pos += 4;
+
+               FieldType = 0xFFFF; FieldSize = 0;
+               memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+               memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+       }
+
+}
+
+
+void Kdb3Database::serializeEntries(QList<StdEntry>& EntryList,char* buffer,unsigned int& pos){
+        quint16 FieldType;
+        quint32 FieldSize;
+        for(int i = 0; i < EntryList.size(); i++){
+                FieldType = 0x0001; FieldSize = 16;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                EntryList[i].Uuid.toRaw(buffer+pos);           pos += 16;
+
+                FieldType = 0x0002; FieldSize = 4;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                memcpyToLEnd32(buffer+pos, &EntryList[i].GroupId); pos += 4;
+
+                FieldType = 0x0003; FieldSize = 4;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                memcpyToLEnd32(buffer+pos,&EntryList[i].Image); pos += 4;
+
+
+                FieldType = 0x0004;
+                FieldSize = EntryList[i].Title.toUtf8().length() + 1; // Add terminating NULL character space
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                memcpy(buffer+pos, EntryList[i].Title.toUtf8(),FieldSize);  pos += FieldSize;
+
+                FieldType = 0x0005;
+                FieldSize = EntryList[i].Url.toUtf8().length() + 1; // Add terminating NULL character space
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                memcpy(buffer+pos, EntryList[i].Url.toUtf8(),FieldSize);  pos += FieldSize;
+
+                FieldType = 0x0006;
+                FieldSize = EntryList[i].Username.toUtf8().length() + 1; // Add terminating NULL character space
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                memcpy(buffer+pos, EntryList[i].Username.toUtf8(),FieldSize);  pos += FieldSize;
+
+                FieldType = 0x0007;
+                FieldSize = EntryList[i].Password.length() + 1; // Add terminating NULL character space
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                EntryList[i].Password.unlock();
+                memcpy(buffer+pos, EntryList[i].Password.string().toUtf8(),FieldSize);  pos += FieldSize;
+                EntryList[i].Password.lock();
+
+                FieldType = 0x0008;
+                FieldSize = EntryList[i].Comment.toUtf8().length() + 1; // Add terminating NULL character space
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                memcpy(buffer+pos, EntryList[i].Comment.toUtf8(),FieldSize);  pos += FieldSize;
+
+                FieldType = 0x0009; FieldSize = 5;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                dateToPackedStruct5(EntryList[i].Creation,(unsigned char*)buffer+pos); pos+=5;
+
+
+                FieldType = 0x000A; FieldSize = 5;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                dateToPackedStruct5(EntryList[i].LastMod,(unsigned char*)buffer+pos); pos+=5;
+
+                FieldType = 0x000B; FieldSize = 5;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                dateToPackedStruct5(EntryList[i].LastAccess,(unsigned char*)buffer+pos); pos+=5;
+
+                FieldType = 0x000C; FieldSize = 5;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                dateToPackedStruct5(EntryList[i].Expire,(unsigned char*)buffer+pos); pos+=5;
+
+                FieldType = 0x000D;
+                FieldSize = EntryList[i].BinaryDesc.toUtf8().length() + 1; // Add terminating NULL character space
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                memcpy(buffer+pos, EntryList[i].BinaryDesc.toUtf8(),FieldSize);  pos += FieldSize;
+
+                FieldType = 0x000E; FieldSize = EntryList[i].Binary.length();
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+                if((!EntryList[i].Binary.isNull()) && (FieldSize != 0))
+                        memcpy(buffer+pos, EntryList[i].Binary.data(), FieldSize);
+                pos += FieldSize;
+
+                FieldType = 0xFFFF; FieldSize = 0;
+                memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
+                memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
+        }
+ }
+
+bool Kdb3Database::close(){
+       if (File!=NULL)
+               delete File;
+       return true;
+}
+
+void Kdb3Database::create(){
+       File=NULL;
+       RootGroup.Title="$ROOT$";
+       RootGroup.Parent=NULL;
+       RootGroup.Handle=NULL;
+       Algorithm=Rijndael_Cipher;
+       KeyTransfRounds=50000;
+       KeyError=false;
+}
+
+bool Kdb3Database::isKeyError(){
+       if(KeyError){
+               KeyError=false;
+               return true;
+       }
+       else
+               return false;
+}
+
+IEntryHandle* Kdb3Database::cloneEntry(const IEntryHandle* entry){
+       StdEntry dolly;
+       dolly=*((EntryHandle*)entry)->Entry;
+       dolly.Uuid.generate();
+       Entries.append(dolly);
+       EntryHandles.append(EntryHandle(this));
+       EntryHandles.back().Entry=&Entries.back();
+       Entries.back().Handle=&EntryHandles.back();
+       return &EntryHandles.back();
+}
+
+IEntryHandle* Kdb3Database::newEntry(IGroupHandle* group){
+       StdEntry Entry;
+       Entry.Uuid.generate();
+       Entry.Group=((GroupHandle*)group)->Group;
+       Entry.GroupId=Entry.Group->Id;
+       Entries.append(Entry);
+       EntryHandles.append(EntryHandle(this));
+       EntryHandles.back().Entry=&Entries.back();
+       Entries.back().Handle=&EntryHandles.back();
+       return &EntryHandles.back();
+}
+
+IEntryHandle* Kdb3Database::addEntry(const CEntry* NewEntry, IGroupHandle* Group){
+       StdEntry Entry(*((StdEntry*)NewEntry));
+       Entry.Uuid.generate();
+       Entry.Group=((GroupHandle*)Group)->Group;
+       Entry.GroupId=Entry.Group->Id;
+       Entries.append(Entry);
+       EntryHandles.append(EntryHandle(this));
+       EntryHandles.back().Entry=&Entries.back();
+       Entries.back().Handle=&EntryHandles.back();
+       return &EntryHandles.back();
+}
+
+void Kdb3Database::deleteLastEntry(){
+       Entries.removeAt(Entries.size()-1);
+       EntryHandles.back().invalidate();
+}
+
+bool Kdb3Database::isParent(IGroupHandle* parent, IGroupHandle* child){
+       StdGroup* group=((GroupHandle*)child)->Group;
+       while(group->Parent!=&RootGroup){
+               if(group->Parent==((GroupHandle*)parent)->Group)return true;
+               group=group->Parent;
+       }
+       return false;
+}
+
+
+
+void Kdb3Database::cleanUpHandles(){}
+
+bool Kdb3Database::searchStringContains(const QString& search, const QString& string,bool Cs, bool RegExp){
+       if(RegExp){
+               QRegExp exp(search,Cs ? Qt::CaseSensitive : Qt::CaseInsensitive);
+               if(string.contains(exp)==0)return false;}
+               else
+                       if(string.contains(search,Cs ? Qt::CaseSensitive : Qt::CaseInsensitive)==0)return false;
+
+               return true;
+}
+
+void Kdb3Database::getEntriesRecursive(IGroupHandle* Group, QList<IEntryHandle*>& EntryList){
+       EntryList<<entries(Group);
+       for(int i=0;i<((GroupHandle*)Group)->Group->Children.size();    i++){
+               getEntriesRecursive(((GroupHandle*)Group)->Group->Children[i]->Handle,EntryList);
+       }
+}
+
+QList<IEntryHandle*> Kdb3Database::search(IGroupHandle* Group,const QString& search, bool CaseSensitive, bool RegExp, bool Recursive,bool* Fields){
+       bool fields[6]={true,true,true,false,true,true};
+       if(!Fields)
+               Fields=fields;
+       QList<IEntryHandle*> SearchEntries;
+       if(search==QString())return Group ? entries(Group) : entries();
+       if(Group){
+               if(Recursive)
+                       getEntriesRecursive(Group,SearchEntries);
+               else
+                       SearchEntries=entries(Group);
+       }
+       else
+               SearchEntries=entries();
+       
+       IGroupHandle* bGroup = backupGroup();
+       
+       QList<IEntryHandle*> ResultEntries;
+       for(int i=0; i<SearchEntries.size(); i++){
+               IGroupHandle* entryGroup = SearchEntries[i]->group();
+               while (entryGroup->parent())
+                       entryGroup = entryGroup->parent();
+               if (entryGroup == bGroup)
+                       continue;
+               
+               bool match=false;
+               if(Fields[0])match=match||searchStringContains(search,SearchEntries[i]->title(),CaseSensitive,RegExp);
+               if(Fields[1])match=match||searchStringContains(search,SearchEntries[i]->username(),CaseSensitive,RegExp);
+               if(Fields[2])match=match||searchStringContains(search,SearchEntries[i]->url(),CaseSensitive,RegExp);
+               SecString Password=SearchEntries[i]->password();
+               Password.unlock();
+               if(Fields[3])match=match||searchStringContains(search,Password.string(),CaseSensitive,RegExp);
+               Password.lock();
+               if(Fields[4])match=match||searchStringContains(search,SearchEntries[i]->comment(),CaseSensitive,RegExp);
+               if(Fields[5])match=match||searchStringContains(search,SearchEntries[i]->binaryDesc(),CaseSensitive,RegExp);
+               if(match)
+                       ResultEntries << SearchEntries[i];
+       }
+
+       return ResultEntries;
+}
+
+void Kdb3Database::rebuildIndices(QList<StdGroup*>& list){
+       for(int i=0;i<list.size();i++){
+               list[i]->Index=i;
+       }
+}
+
+
+void Kdb3Database::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,int Pos){
+       StdGroup* Parent;
+       StdGroup* Group=((GroupHandle*)groupHandle)->Group;
+       if(NewParent)
+               Parent=((GroupHandle*)NewParent)->Group;
+       else
+               Parent=&RootGroup;
+       Group->Parent->Children.removeAt(Group->Index);
+       rebuildIndices(Group->Parent->Children);
+       Group->Parent=Parent;
+       if(Pos==-1){
+               Parent->Children.append(Group);
+       }
+       else
+       {
+               Q_ASSERT(Parent->Children.size()>=Pos);
+               Parent->Children.insert(Pos,Group);
+       }
+       rebuildIndices(Parent->Children);
+}
+
+bool Kdb3Database::changeFile(const QString& filename){
+       QFile* tmpFile = new QFile(filename);
+       if(!tmpFile->open(QIODevice::ReadWrite)){
+               error = decodeFileError(File->error());
+               delete tmpFile;
+               return false;
+       }
+       
+       if (File)
+               delete File;
+       
+       File = tmpFile;
+
+       return true;
+}
+
+void Kdb3Database::generateMasterKey(){
+       randomize(TransfRandomSeed,32);
+       RawMasterKey.unlock();
+       MasterKey.unlock();
+       KeyTransform::transform(*RawMasterKey,*MasterKey,TransfRandomSeed,KeyTransfRounds);
+       RawMasterKey.lock();
+       MasterKey.lock();
+}
+
+/*void Kdb3Database::copyTree(Kdb3Database* db, GroupHandle* orgGroup, IGroupHandle* parent) {
+       IGroupHandle* newParent = db->addGroup(orgGroup->Group, parent);
+       
+       QList<IEntryHandle*> entryList = entries(orgGroup);
+       for (int i=0; i<entryList.size(); i++) {
+               EntryHandle* entry = static_cast<EntryHandle*>(entryList[i]);
+               db->addEntry(entry->Entry, newParent);
+       }
+       
+       QList<IGroupHandle*> children = orgGroup->children();
+       for (int i=0; i<children.size(); i++) {
+               GroupHandle* child = static_cast<GroupHandle*>(children[i]);
+               copyTree(db, child, newParent);
+       }
+}
+
+IDatabase* Kdb3Database::groupToNewDb(IGroupHandle* group){
+       Kdb3Database* db = new Kdb3Database();
+       db->create();
+       copyTree(db, static_cast<GroupHandle*>(group), NULL);
+       
+       db->changeFile("/ramtmp/test.kdb");
+       if (!db->save())
+               qWarning("%s", CSTR(db->error));
+       
+       return db;
+}*/
+
+
+void KeyTransform::transform(quint8* src, quint8* dst, quint8* KeySeed, int rounds){
+       KeyTransform* ktLeft = new KeyTransform(&src[0], &dst[0], KeySeed, rounds);
+       KeyTransform* ktRight = new KeyTransform(&src[16], &dst[16], KeySeed, rounds);
+       ktLeft->start();
+       ktRight->start();
+       ktLeft->wait();
+       ktRight->wait();
+       SHA256::hashBuffer(dst,dst,32);
+       delete ktLeft;
+       delete ktRight;
+}
+
+KeyTransform::KeyTransform(quint8* pSrc, quint8* pDst, quint8* pKeySeed, int pRounds){
+       src = pSrc;
+       dst = pDst;
+       KeySeed = pKeySeed;
+       rounds = pRounds;
+}
+
+void KeyTransform::run(){
+       AESencrypt aes;
+       aes.key256(KeySeed);
+       memcpy(dst,src,16);
+       for (int i=0; i<rounds; i++){
+               aes.ecb_encrypt(dst,dst,16);
+       }
+}
+
+
+int KeyTransformBenchmark::benchmark(int pMSecs){
+       KeyTransformBenchmark* ktbLeft = new KeyTransformBenchmark(pMSecs);
+       KeyTransformBenchmark* ktbRight = new KeyTransformBenchmark(pMSecs);
+       ktbLeft->start();
+       ktbRight->start();
+       ktbLeft->wait();
+       ktbRight->wait();
+       int num = std::min(ktbLeft->rounds, ktbRight->rounds);
+       delete ktbLeft;
+       delete ktbRight;
+       
+       return num;
+}
+
+KeyTransformBenchmark::KeyTransformBenchmark(int pMSecs){
+       msecs = pMSecs;
+       rounds = 0;
+}
+
+void KeyTransformBenchmark::run(){
+       quint8 KeySeed[32];
+       memset(KeySeed, 0x4B, 32);
+       quint8 dst[16];
+       memset(dst, 0x7E, 16);
+       
+       QTime t;
+       t.start();
+       
+       AESencrypt aes;
+       aes.key256(KeySeed);
+       
+       do {
+               for (int i=0; i<64; i++){
+                       aes.ecb_encrypt(dst,dst,16);
+               }
+               rounds += 64;
+       } while (t.elapsed() < msecs);
+}
diff --git a/src/Kdb3Database.h b/src/Kdb3Database.h
new file mode 100644 (file)
index 0000000..765bbf9
--- /dev/null
@@ -0,0 +1,288 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2007 by Tarek Saidi                                *
+ *   tarek.saidi@arcor.de                                                  *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _STD_DATABASE_H_
+#define _STD_DATABASE_H_
+
+#include <QThread>
+
+#define DB_HEADER_SIZE 124
+#define PWM_DBSIG_1            0x9AA2D903
+#define PWM_DBSIG_2    0xB54BFB65
+#define PWM_DBVER_DW   0x00030002
+#define PWM_FLAG_SHA2                  1
+#define PWM_FLAG_RIJNDAEL              2
+#define PWM_FLAG_ARCFOUR               4
+#define PWM_FLAG_TWOFISH               8
+#define PWM_STD_KEYENCROUNDS   6000
+
+void memcpyFromLEnd32(quint32* dst,const char* src);
+void memcpyFromLEnd16(quint16* dst,const char* src);
+void memcpyToLEnd32(char* src,const quint32* dst);
+void memcpyToLEnd16(char* src,const quint16* dst);
+
+//! Implementation of the standard KeePassX database.
+class Kdb3Database:public ICustomIcons,public IDatabase, public IKdbSettings{
+Q_OBJECT
+public:
+       class StdGroup;
+       class StdEntry;
+       class EntryHandle:public IEntryHandle{
+
+               friend class Kdb3Database;
+               public:
+                       EntryHandle(Kdb3Database* db);
+                       virtual void setImage(const quint32& ImageID);
+                       virtual void setTitle(const QString& Title);
+                       virtual void setUrl(const QString& URL);
+                       virtual void setUsername(const QString& Username);
+                       virtual void setPassword(const SecString& Password);
+                       virtual void setComment(const QString& Comment);
+                       virtual void setBinaryDesc(const QString& BinaryDesc);
+                       virtual void setCreation(const KpxDateTime& Creation);
+                       virtual void setLastMod(const KpxDateTime& LastMod);
+                       virtual void setLastAccess(const KpxDateTime& LastAccess);
+                       virtual void setExpire(const KpxDateTime& Expire);
+                       virtual void setBinary(const QByteArray& BinaryData);
+                       virtual KpxUuid uuid()const;
+                       virtual IGroupHandle* group()const;
+                       virtual quint32 image()const;
+                       virtual int visualIndex() const;
+                       virtual void setVisualIndex(int i);
+                       virtual void setVisualIndexDirectly(int i);
+                       virtual QString title()const;
+                       virtual QString url()const;
+                       virtual QString username()const;
+                       virtual SecString password()const;
+                       virtual QString comment()const;
+                       virtual QString binaryDesc()const;
+                       virtual KpxDateTime creation()const;
+                       virtual KpxDateTime lastMod()const;
+                       virtual KpxDateTime lastAccess()const;
+                       virtual KpxDateTime expire()const;
+                       virtual QByteArray binary()const;
+                       virtual quint32 binarySize()const;
+                       virtual QString friendlySize()const;
+                       virtual bool isValid() const;
+                       virtual CEntry data()const;
+               private:
+                       void invalidate(){valid=false;}
+                       bool valid;
+                       //KpxUuid Uuid; ???
+                       Kdb3Database* pDB;
+                       StdEntry* Entry;
+       };
+
+       class GroupHandle:public IGroupHandle{
+               friend class Kdb3Database;
+               GroupHandle(Kdb3Database* db);
+               public:
+                       virtual void setTitle(const QString& Title);
+                       virtual void setImage(const quint32& ImageId);
+                       virtual QString title();
+                       virtual quint32 image();
+                       virtual bool isValid();
+                       virtual IGroupHandle* parent();
+                       virtual QList<IGroupHandle*> children();
+                       virtual int index();
+                       //virtual void setIndex(int index);
+                       virtual int level();
+                       virtual bool expanded();
+                       virtual void setExpanded(bool IsExpanded);
+               private:
+                       void invalidate(){valid=false;}
+                       bool valid;
+                       StdGroup* Group;
+                       Kdb3Database* pDB;
+       };
+
+       friend class EntryHandle;
+       friend class GroupHandle;
+
+       class StdEntry:public CEntry{
+               public:
+                               quint16 Index;
+                               EntryHandle* Handle;
+                               StdGroup* Group;
+       };
+
+       class StdGroup:public CGroup{
+               public:
+                       StdGroup():CGroup(){};
+                       StdGroup(const CGroup&);
+                       quint16 Index;
+                       StdGroup* Parent;
+                       GroupHandle* Handle;
+                       QList<StdGroup*> Children;
+                       QList<StdEntry*> Entries;
+       };
+
+       Kdb3Database();
+       virtual ~Kdb3Database(){};
+       virtual bool load(QString identifier, bool readOnly);
+       virtual bool save();
+       virtual bool close();
+       virtual void create();
+       virtual int numEntries();
+       virtual int numGroups();
+       virtual QString getError();
+       virtual bool isKeyError();
+       virtual void cleanUpHandles();
+       virtual QPixmap& icon(int index);
+       virtual int numIcons();
+       virtual void addIcon(const QPixmap& icon);
+       virtual void removeIcon(int index);
+       virtual void replaceIcon(int index,const QPixmap& icon);
+       virtual int builtinIcons(){return BUILTIN_ICONS;};
+       virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields);
+       virtual QFile* file(){return File;}
+       virtual bool changeFile(const QString& filename);
+       virtual void setCryptAlgorithm(CryptAlgorithm algo){Algorithm=algo;}
+       virtual CryptAlgorithm cryptAlgorithm(){return Algorithm;}
+       virtual unsigned int keyTransfRounds(){return KeyTransfRounds;}
+       virtual void setKeyTransfRounds(unsigned int rounds){KeyTransfRounds=rounds;}
+       virtual bool setKey(const QString& password, const QString& keyfile);
+       virtual bool setPasswordKey(const QString& password);
+       virtual bool setFileKey(const QString& filename);
+       virtual bool setCompositeKey(const QString& password,const QString& filename);
+
+       virtual QList<IEntryHandle*> entries();
+       virtual QList<IEntryHandle*> entries(IGroupHandle* Group);
+       virtual QList<IEntryHandle*> entriesSortedStd(IGroupHandle* Group);
+       virtual QList<IEntryHandle*> expiredEntries();
+
+       virtual IEntryHandle* cloneEntry(const IEntryHandle* entry);
+       virtual void deleteEntry(IEntryHandle* entry);
+       virtual void deleteEntries(QList<IEntryHandle*> entries);
+       virtual IEntryHandle* newEntry(IGroupHandle* group);
+       virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* group);
+       virtual void moveEntry(IEntryHandle* entry, IGroupHandle* group);
+       virtual void deleteLastEntry();
+
+
+       virtual QList<IGroupHandle*> groups();
+       virtual QList<IGroupHandle*> sortedGroups();
+       virtual void deleteGroup(IGroupHandle* group);
+       virtual void moveGroup(IGroupHandle* Group,IGroupHandle* NewParent,int Position);
+       virtual IGroupHandle* addGroup(const CGroup* Group,IGroupHandle* Parent);
+       virtual IGroupHandle* backupGroup(bool create=false);
+       virtual bool isParent(IGroupHandle* parent, IGroupHandle* child);
+       
+       virtual void generateMasterKey();
+       //virtual IDatabase* groupToNewDb(IGroupHandle* group);
+       
+       inline bool hasPasswordEncodingChanged() { return passwordEncodingChanged; };
+
+private:
+       bool loadReal(QString filename, bool readOnly, bool differentEncoding);
+       QDateTime dateFromPackedStruct5(const unsigned char* pBytes);
+       void dateToPackedStruct5(const QDateTime& datetime, unsigned char* dst);
+       bool isMetaStream(StdEntry& Entry);
+       bool parseMetaStream(const StdEntry& Entry);
+       void parseCustomIconsMetaStream(const QByteArray& data);
+       void parseCustomIconsMetaStreamV3(const QByteArray& data);
+       void parseGroupTreeStateMetaStream(const QByteArray& data);
+       void createCustomIconsMetaStream(StdEntry* e);
+       void createGroupTreeStateMetaStream(StdEntry* e);
+       bool readEntryField(StdEntry* entry, quint16 FieldType, quint32 FieldSize, quint8 *pData);
+       bool readGroupField(StdGroup* group,QList<quint32>& Levels,quint16 FieldType, quint8 *pData);
+       bool createGroupTree(QList<quint32>& Levels);
+       void createHandles();
+       void invalidateHandle(StdEntry* entry);
+       bool convHexToBinaryKey(char* HexKey, char* dst);
+       quint32 getNewGroupId();
+       void serializeEntries(QList<StdEntry>& EntryList,char* buffer,unsigned int& pos);
+       void serializeGroups(char* buffer,unsigned int& pos);
+       void appendChildrenToGroupList(QList<StdGroup*>& list,StdGroup& group);
+       void appendChildrenToGroupList(QList<IGroupHandle*>& list,StdGroup& group);
+       bool searchStringContains(const QString& search, const QString& string,bool Cs, bool RegExp);
+       void getEntriesRecursive(IGroupHandle* Group, QList<IEntryHandle*>& EntryList);
+       void rebuildIndices(QList<StdGroup*>& list);
+       void restoreGroupTreeState();
+       //void copyTree(Kdb3Database* db, GroupHandle* orgGroup, IGroupHandle* parent);
+       static bool EntryHandleLessThan(const IEntryHandle* This,const IEntryHandle* Other);
+       static bool EntryHandleLessThanStd(const IEntryHandle* This,const IEntryHandle* Other);
+       static bool StdEntryLessThan(const Kdb3Database::StdEntry& This,const Kdb3Database::StdEntry& Other);
+
+       StdEntry* getEntry(const KpxUuid& uuid);
+       StdEntry* getEntry(EntryHandle* handle);
+       int getEntryListIndex(EntryHandle* handle);
+       EntryHandle* getHandle(StdEntry* entry);
+
+       StdGroup* getGroup(quint32 Id);
+       void deleteGroup(StdGroup* group);
+
+       QList<EntryHandle> EntryHandles;
+       QList<GroupHandle> GroupHandles;
+       QList<StdEntry> Entries;
+       QList<StdGroup> Groups;
+       StdGroup RootGroup;
+       QList<QPixmap>CustomIcons;
+       QFile* File;
+       QString error;
+       bool KeyError;
+       bool PotentialEncodingIssueLatin1;
+       bool PotentialEncodingIssueUTF8;
+       QList<StdEntry> UnknownMetaStreams;
+       QMap<quint32,bool> TreeStateMetaStream;
+       unsigned int KeyTransfRounds;
+       CryptAlgorithm Algorithm;
+       SecData RawMasterKey;
+       SecData RawMasterKey_CP1252;
+       SecData RawMasterKey_Latin1;
+       SecData RawMasterKey_UTF8;
+       SecData MasterKey;
+       quint8 TransfRandomSeed[32];
+       bool hasV4IconMetaStream;
+       bool passwordEncodingChanged;
+};
+
+class KeyTransform : public QThread{
+       Q_OBJECT
+       
+       public:
+               static void transform(quint8* src, quint8* dst, quint8* KeySeed, int rounds);
+       
+       private:
+               KeyTransform(quint8* pSrc, quint8* pDst, quint8* pKeySeed, int pRounds);
+               quint8* src;
+               quint8* dst;
+               quint8* KeySeed;
+               int rounds;
+       
+       protected:
+               void run();
+};
+
+class KeyTransformBenchmark : public QThread{
+       Q_OBJECT
+       
+       public:
+               static int benchmark(int pMSecs);
+       
+       private:
+               KeyTransformBenchmark(int pMSecs);
+               int msecs;
+               int rounds;
+       
+       protected:
+               void run();
+};
+
+#endif
diff --git a/src/KpxConfig.cpp b/src/KpxConfig.cpp
new file mode 100644 (file)
index 0000000..080c459
--- /dev/null
@@ -0,0 +1,273 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2007 by Tarek Saidi                                *
+ *   tarek.saidi@arcor.de                                                  *
+ *                                                                         *
+ *   Copyright (C) 2007 by Constantin "Dinosaur" Makshin                   *
+ *   dinosaur-rus@users.sourceforge.net                                    *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#include <QLayout>
+
+KpxConfig::KpxConfig(const QString& filePath) : settings(filePath,QSettings::IniFormat){
+       configFile=filePath;
+       if (settings.contains("Options/GroupTreeRestore") && !settings.contains("Options/GroupTreeState")){
+               switch (settings.value("Options/GroupTreeRestore",1).toInt()){
+                       case 0:
+                               setGroupTreeState(RestoreLast);
+                               break;
+
+                       case 2:
+                               setGroupTreeState(DoNothing);
+                               break;
+
+                       default:
+                               setGroupTreeState(ExpandAll);
+               }
+               settings.remove("Options/GroupTreeRestore");
+       }
+       if (urlCmd()=="<<default>>")
+               setUrlCmd(QString());
+}
+
+#ifdef GLOBAL_AUTOTYPE
+Shortcut KpxConfig::globalShortcut(){
+       Shortcut s;
+       s.key = settings.value("Options/GlobalShortcutKey",0).toUInt();
+       QBitArray mods = settings.value("Options/GlobalShortcutMods",QBitArray(5)).toBitArray();
+       if (mods.size()!=5)
+               mods = QBitArray(5);
+       s.ctrl = mods.testBit(0);
+       s.shift = mods.testBit(1);
+       s.alt = mods.testBit(2);
+       s.altgr = mods.testBit(3);
+       s.win = mods.testBit(4);
+       
+       return s;
+}
+
+void KpxConfig::setGlobalShortcut(const Shortcut& s){
+       settings.setValue("Options/GlobalShortcutKey", s.key);
+       QBitArray mods(5);
+       mods.setBit(0, s.ctrl);
+       mods.setBit(1, s.shift);
+       mods.setBit(2, s.alt);
+       mods.setBit(3, s.altgr);
+       mods.setBit(4, s.win);
+       settings.setValue("Options/GlobalShortcutMods", mods);
+}
+#endif
+
+unsigned KpxConfig::fileDlgHistorySize(){
+       settings.beginGroup("FileDlgHistory");
+       unsigned res=static_cast<unsigned>(settings.childKeys().size());
+       settings.endGroup();
+       return res;
+}
+
+QColor KpxConfig::stringToColor(const QString& str){
+       QStringList ints=str.split(',');
+       QColor res;
+       if (ints.count()>0)
+               res.setRed(ints.at(0).toInt());
+       if (ints.count()>1)
+               res.setGreen(ints.at(1).toInt());
+       if (ints.count()>2)
+               res.setBlue(ints.at(2).toInt());
+       return res;
+}
+
+QBitArray KpxConfig::stringToBitArray(const QString& str, unsigned count){
+       QBitArray res(static_cast<int>(count));
+       if (static_cast<unsigned>(str.length())<count)
+               count=static_cast<unsigned>(str.length());
+       for (int i=0;i<static_cast<int>(count);i++){
+               QChar c=str.at(i);
+               if ((c=='1') || (c=='t') || (c=='y'))
+                       res.setBit(i);
+       }
+       return res;
+}
+
+KpxConfig::GrpTreeState KpxConfig::stringToGrpTreeState(const QString& str){
+       GrpTreeState res=ExpandAll;
+       if (!str.compare("Restore",Qt::CaseInsensitive))
+               res=RestoreLast;
+       else if (!str.compare("None",Qt::CaseInsensitive))
+               res=DoNothing;
+       return res;
+}
+
+QList<int> KpxConfig::stringToIntArray(const QString& str, unsigned count){
+       QStringList ints=str.split(',');
+       QList<int> res;
+       unsigned i,
+                intsCount=qMin(static_cast<unsigned>(ints.count()),count);
+       for (i=0;i<intsCount;i++)
+               res.append(ints.at(i).toInt());
+       for (;i<count;i++)
+               res.append(0);
+       return res;
+}
+
+KpxConfig::IntegrPluginType KpxConfig::stringToIntegrPluginType(const QString& str){
+       IntegrPluginType res=NoIntegr;
+       if (!str.compare("KDE",Qt::CaseInsensitive))
+               res=KDE;
+       else if (!str.compare("Gnome",Qt::CaseInsensitive))
+               res=Gnome;
+       return res;
+}
+
+tKeyType KpxConfig::stringToKeyType(const QString& str){
+       tKeyType res=PASSWORD;
+       if (!str.compare("KeyFile",Qt::CaseInsensitive))
+               res=KEYFILE;
+       else if (!str.compare("Composite",Qt::CaseInsensitive))
+               res=BOTH;
+       return res;
+}
+
+QString KpxConfig::bitArrayToString(const QBitArray& bitArray){
+       QString res;
+       for (int i=0;i<bitArray.count();i++)
+               res.append(QString::number(bitArray.at(i)?1:0));
+       return res;
+}
+
+QString KpxConfig::grpTreeStateToString(GrpTreeState grpTreeState){
+       QString res;
+       switch (grpTreeState){
+               case RestoreLast:
+                       res="Restore";
+                       break;
+
+               case ExpandAll:
+                       res="ExpandAll";
+                       break;
+
+               case DoNothing:
+                       res="None";
+       }
+       return res;
+}
+
+QString KpxConfig::intArrayToString(const QList<int>& intArray){
+       QString res;
+       if (!intArray.isEmpty())
+       {
+               res.setNum(intArray.first());
+               for (int i=1;i<intArray.count();i++)
+                       res.append(QString(",%1").arg(intArray.at(i)));
+       }
+       return res;
+}
+
+QString KpxConfig::integrPluginTypeToString(IntegrPluginType integrPluginType){
+       QString res;
+       switch (integrPluginType){
+               case NoIntegr:
+                       res="None";
+                       break;
+
+               case KDE:
+                       res="KDE";
+                       break;
+
+               case Gnome:
+                       res="Gnome";
+       }
+       return res;
+}
+
+QString KpxConfig::keyTypeToString(tKeyType keyType){
+       QString res;
+       switch (keyType){
+               case PASSWORD:
+                       res="Password";
+                       break;
+
+               case KEYFILE:
+                       res="KeyFile";
+                       break;
+
+               case BOTH:
+                       res="Composite";
+       }
+       return res;
+}
+
+QByteArray KpxConfig::mainWindowGeometry() {
+       QVariant var = settings.value("UI/MainWindowGeometry");
+       if (var.type() == QVariant::ByteArray)
+               return var.toByteArray();
+       else
+               return QByteArray();
+}
+
+QRect KpxConfig::dialogGeometry(const QWidget* widget){
+       Q_ASSERT(widget->parentWidget()!=NULL && widget->parentWidget()->window()!=NULL);
+       QSize size = settings.value(QString("UI/%1Size").arg(widget->objectName()),widget->size()).toSize();
+       QSize minSize = widget->minimumSize();
+       if (size.width() < minSize.width() || size.height() < minSize.height())
+               size = minSize;
+       if (minSize.isNull() && widget->layout()!=NULL){
+               minSize = widget->layout()->minimumSize();
+               if (size.width() < minSize.width() || size.height() < minSize.height())
+                       size = minSize;
+       }
+
+       QRect rect;
+       rect=QRect(QPoint(), size);
+       rect.moveCenter( widget->parentWidget()->window()->geometry().center() );
+       return rect;
+}
+
+void KpxConfig::setDialogGeometry(const QWidget* widget){
+       settings.setValue(QString("UI/%1Size").arg(widget->objectName()),widget->size());
+}
+
+QString KpxConfig::detailViewTemplate(){
+       if (settings.contains("UI/DetailsView")){
+               return QString::fromUtf8( qUncompress(settings.value("UI/DetailsView").toByteArray()) );
+       }
+       else{
+               return defaultDetailViewTemplate();
+       }
+}
+
+QString KpxConfig::defaultDetailViewTemplate(){
+       QFile templ(":/default-detailview.html");
+       templ.open(QIODevice::ReadOnly);
+       QString value=QString::fromUtf8(templ.readAll());
+       templ.close();
+       value.replace("Group",QCoreApplication::translate("DetailViewTemplate","Group"));
+       value.replace("Title",QCoreApplication::translate("DetailViewTemplate","Title"));
+       value.replace("Username",QCoreApplication::translate("DetailViewTemplate","Username"));
+       value.replace("Password",QCoreApplication::translate("DetailViewTemplate","Password"));
+       value.replace("URL",QCoreApplication::translate("DetailViewTemplate","URL"));
+       value.replace("Creation",QCoreApplication::translate("DetailViewTemplate","Creation"));
+       value.replace("Last Access",QCoreApplication::translate("DetailViewTemplate","Last Access"));
+       value.replace("Last Modification",QCoreApplication::translate("DetailViewTemplate","Last Modification"));
+       value.replace("Expiration",QCoreApplication::translate("DetailViewTemplate","Expiration"));
+       value.replace("Comment",QCoreApplication::translate("DetailViewTemplate","Comment"));
+       return value;
+}
+
+void KpxConfig::setDetailViewTemplate(const QString& value){
+       settings.setValue("UI/DetailsView", qCompress(value.toUtf8(),9) );
+}
diff --git a/src/KpxConfig.h b/src/KpxConfig.h
new file mode 100644 (file)
index 0000000..45ff3ec
--- /dev/null
@@ -0,0 +1,219 @@
+/***************************************************************************
+ *   Copyright (C) 2005-2007 by Tarek Saidi                                *
+ *   tarek.saidi@arcor.de                                                  *
+ *                                                                         *
+ *   Copyright (C) 2007 by Constantin "Dinosaur" Makshin                   *
+ *   dinosaur-rus@users.sourceforge.net                                    *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; version 2 of the License.               *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifndef _KPXCONFIG_H_
+#define _KPXCONFIG_H_
+
+#include "lib/AutoType.h"
+
+#if defined(Q_WS_MAC)
+#      define DEFAULT_MOUNT_DIR "/Volumes/"
+#elif defined(Q_WS_X11)
+#      define DEFAULT_MOUNT_DIR "/media/"
+#elif defined(Q_WS_WIN)
+#      define DEFAULT_MOUNT_DIR "/"
+#else
+#      define DEFAULT_MOUNT_DIR QString()
+#endif
+
+class KpxConfig{
+public:
+       friend class KpxBookmarks;
+       
+       enum IntegrPluginType{NoIntegr,KDE,Gnome};
+       enum GrpTreeState{DoNothing,RestoreLast,ExpandAll};
+
+       KpxConfig(const QString& filePath);
+
+       bool alternatingRowColors(){return settings.value("Options/AlternatingRowColors",true).toBool();}
+       QColor bannerColor1(){return stringToColor(settings.value("Options/BannerColor1","0,85,127").toString());}
+       QColor bannerColor2(){return stringToColor(settings.value("Options/BannerColor2","0,117,175").toString());}
+       QColor bannerTextColor(){return stringToColor(settings.value("Options/BannerTextColor","222,222,222").toString());}
+       int clipboardTimeOut(){return settings.value("Options/ClipboardTimeOut",20).toInt();}
+       QBitArray columns(){return stringToBitArray(settings.value("UI/Columns","11111000000").toString(),11);}
+       QList<int> columnOrder(){return stringToIntArray(settings.value("UI/ColumnOrder","1,2,3,4,5,6,7,8,9,10,11").toString(),11);}
+       QList<int> columnSizes(){return stringToIntArray(settings.value("UI/ColumnSizes","15,10,10,10,10,10,10,10,10,10,10").toString(),11);}
+       int columnSort(){return settings.value("UI/ColumnSort",0).toInt();}
+       Qt::SortOrder columnSortOrder(){return static_cast<Qt::SortOrder>(settings.value("UI/ColumnSortOrder",Qt::AscendingOrder).toInt());}
+       QBitArray searchColumns(){return stringToBitArray(settings.value("UI/SearchColumns","11110000001").toString(),11);}
+       QList<int> searchColumnOrder(){return stringToIntArray(settings.value("UI/SearchColumnOrder","2,3,4,5,6,7,8,9,10,11,1").toString(),11);}
+       QList<int> searchColumnSizes(){return stringToIntArray(settings.value("UI/SearchColumnSizes","15,10,10,10,10,10,10,10,10,10,10").toString(),11);}
+       int searchColumnSort(){return settings.value("UI/SearchColumnSort",0).toInt();}
+       Qt::SortOrder searchColumnSortOrder(){return static_cast<Qt::SortOrder>(settings.value("UI/SearchColumnSortOrder",Qt::AscendingOrder).toInt());}
+       QStringList fileDlgHistory(unsigned index){return settings.value(QString("FileDlgHistory/ENTRY%1").arg(index)).toStringList();}
+       GrpTreeState groupTreeState(){return stringToGrpTreeState(settings.value("Options/GroupTreeState").toString());}
+       bool hidePasswords(){return settings.value("UI/HidePasswords",true).toBool();}
+       bool hideUsernames(){return settings.value("UI/HideUsernames",true).toBool();}
+       QByteArray hSplitterPos(){return settings.value("UI/HSplitterPos").toByteArray();}
+       bool alwaysOnTop(){return settings.value("UI/AlwaysOnTop",false).toBool();}
+       IntegrPluginType integrPlugin(){return stringToIntegrPluginType(settings.value("Options/IntegrPlugin").toString());}
+       QString lastFile(){return settings.value("Options/LastFile").toString();}
+       QString lastKeyLocation(){return settings.value("Options/LastKeyLocation").toString();}
+       tKeyType lastKeyType(){return stringToKeyType(settings.value("Options/LastKeyType").toString());}
+       QByteArray mainWindowGeometry();
+       bool minimizeTray(){return settings.value("Options/MinimizeTray",false).toBool();}
+       bool startMinimized(){return settings.value("Options/StartMinimized",false).toBool();}
+       bool startLocked(){return settings.value("Options/StartLocked",false).toBool();}
+       QString mountDir(){return settings.value("Options/MountDir",DEFAULT_MOUNT_DIR).toString();}
+       bool openLastFile(){return settings.value("Options/OpenLastFile",true).toBool();}
+       bool autoSave(){return settings.value("Options/AutoSave",false).toBool();}
+       bool autoSaveChange(){return settings.value("Options/AutoSaveChange",false).toBool();}
+       bool backup(){return settings.value("Options/Backup",true).toBool();}
+       bool backupDelete(){return settings.value("Options/BackupDelete",false).toBool();}
+       int backupDeleteAfter(){return settings.value("Options/BackupDeleteAfter",14).toInt();}
+       int pwGenCategory(){return settings.value("Options/PwGenCategory",0).toInt();}
+       QString pwGenCharList(){return settings.value("Options/PwGenCharList").toString();}
+       bool pwGenExcludeLookAlike(){return settings.value("Options/PwGenExcludeLookAlike").toBool();}
+       bool pwGenEveryGroup(){return settings.value("Options/PwGenEveryGroup").toBool();}
+       int pwGenLength(){return settings.value("Options/PwGenLength",25).toInt();}
+       QBitArray pwGenOptions(){return stringToBitArray(settings.value("Options/PwGenOptions","11111000011110").toString(),14);}
+       bool rememberLastKey(){return settings.value("Options/RememberLastKey",true).toBool();}
+       bool saveFileDlgHistory(){return settings.value("Options/SaveFileDlgHistory",true).toBool();}
+       bool saveRelativePaths(){return settings.value("Options/SaveRelativePaths",true).toBool();}
+       QBitArray searchOptions(){return stringToBitArray(settings.value("Options/SearchOptions","001101111").toString(),9);}
+       bool showEntryDetails(){return settings.value("UI/ShowEntryDetails",true).toBool();}
+       bool showPasswords(){return settings.value("Options/ShowPasswords",false).toBool();}
+       bool showPasswordsPasswordDlg(){return settings.value("Options/ShowPasswordsPasswordDlg",false).toBool();}
+       bool lockOnMinimize(){return settings.value("Options/LockOnMinimize",false).toBool();}
+       bool lockOnInactivity(){return settings.value("Options/LockOnInactivity",false).toBool();}
+       int lockAfterSec(){return settings.value("Options/LockAfterSec",30).toInt();}
+       bool showStatusbar(){return settings.value("UI/ShowStatusbar",true).toBool();}
+       bool showSysTrayIcon(){return settings.value("Options/ShowSysTrayIcon",false).toBool();}
+       bool showToolbar(){return settings.value("UI/ShowToolbar",true).toBool();}
+       int toolbarIconSize(){return settings.value("UI/ToolbarIconSize",16).toInt();}
+       QString urlCmd(){return settings.value("Options/UrlCmd").toString();}
+       bool urlCmdDef(){return settings.value("Options/UrlCmdDef",true).toBool();}
+       QByteArray vSplitterPos(){return settings.value("UI/VSplitterPos").toByteArray();}
+       bool askBeforeDelete(){return settings.value("Options/AskBeforeDelete",true).toBool();}
+#ifdef AUTOTYPE
+       int autoTypePreGap(){return settings.value("Options/AutoTypePreGap",500).toInt();}
+       int autoTypeKeyStrokeDelay(){return settings.value("Options/AutoTypeKeyStrokeDelay",5).toInt();}
+#endif
+#ifdef GLOBAL_AUTOTYPE
+       Shortcut globalShortcut();
+       bool entryTitlesMatch(){return settings.value("Options/EntryTitlesMatch",true).toBool();}
+#endif
+       //bool featureBookmarks(){return settings.value("Features/Bookmarks",true).toBool();}
+       bool featureBookmarks(){return true;}
+       QString language(){return settings.value("Options/Language","auto").toString();}
+       
+       void setAlternatingRowColors(bool value){settings.setValue("Options/AlternatingRowColors",value);}
+       void setBannerColor1(const QColor& value){settings.setValue("Options/BannerColor1",colorToString(value));}
+       void setBannerColor2(const QColor& value){settings.setValue("Options/BannerColor2",colorToString(value));}
+       void setBannerTextColor(const QColor& value){settings.setValue("Options/BannerTextColor",colorToString(value));}
+       void setClipboardTimeOut(int value){settings.setValue("Options/ClipboardTimeOut",value);}
+       void setColumns(const QBitArray& value){settings.setValue("UI/Columns",bitArrayToString(value));}
+       void setColumnOrder(const QList<int>& value){settings.setValue("UI/ColumnOrder",intArrayToString(value));}
+       void setColumnSizes(const QList<int>& value){settings.setValue("UI/ColumnSizes",intArrayToString(value));}
+       void setColumnSort(int value){settings.setValue("UI/ColumnSort",value);}
+       void setColumnSortOrder(int value){settings.setValue("UI/ColumnSortOrder",value);}
+       void setSearchColumns(const QBitArray& value){settings.setValue("UI/SearchColumns",bitArrayToString(value));}
+       void setSearchColumnOrder(const QList<int>& value){settings.setValue("UI/SearchColumnOrder",intArrayToString(value));}
+       void setSearchColumnSizes(const QList<int>& value){settings.setValue("UI/SearchColumnSizes",intArrayToString(value));}
+       void setSearchColumnSort(int value){settings.setValue("UI/SearchColumnSort",value);}
+       void setSearchColumnSortOrder(int value){settings.setValue("UI/SearchColumnSortOrder",value);}
+       void setFileDlgHistory(unsigned index,const QStringList& value){settings.setValue(QString("FileDlgHistory/ENTRY%1").arg(index), value);}
+       void setGroupTreeState(GrpTreeState value){settings.setValue("Options/GroupTreeState",grpTreeStateToString(value));}
+       void setHidePasswords(bool value){settings.setValue("UI/HidePasswords",value);}
+       void setHideUsernames(bool value){settings.setValue("UI/HideUsernames",value);}
+       void setHSplitterPos(const QByteArray& value){settings.setValue("UI/HSplitterPos",value);}
+       void setAlwaysOnTop(bool value){settings.setValue("UI/AlwaysOnTop",value);}
+       void setIntegrPlugin(IntegrPluginType value){settings.setValue("Options/IntegrPlugin",integrPluginTypeToString(value));}
+       void setLastFile(const QString& value){settings.setValue("Options/LastFile",value);}
+       void setLastKeyLocation(const QString& value){settings.setValue("Options/LastKeyLocation",value);}
+       void setLastKeyType(tKeyType value){settings.setValue("Options/LastKeyType",keyTypeToString(value));}
+       void setMainWindowGeometry(const QByteArray& value){settings.setValue("UI/MainWindowGeometry",value);}
+       void setMinimizeTray(bool value){settings.setValue("Options/MinimizeTray",value);}
+       void setStartMinimized(bool value){settings.setValue("Options/StartMinimized",value);}
+       void setStartLocked(bool value){settings.setValue("Options/StartLocked",value);}
+       void setMountDir(const QString& value){settings.setValue("Options/MountDir",value);}
+       void setOpenLastFile(bool value){settings.setValue("Options/OpenLastFile",value);}
+       void setAutoSave(bool value){settings.setValue("Options/AutoSave",value);}
+       void setAutoSaveChange(bool value){settings.setValue("Options/AutoSaveChange",value);}
+       void setBackup(bool value){settings.setValue("Options/Backup",value);}
+       void setBackupDelete(bool value){settings.setValue("Options/BackupDelete",value);}
+       void setBackupDeleteAfter(int value){settings.setValue("Options/BackupDeleteAfter",value);}
+       void setPwGenCategory(int value){settings.setValue("Options/PwGenCategory",value);}
+       void setPwGenCharList(const QString& value){settings.setValue("Options/PwGenCharList",value);}
+       void setPwGenExcludeLookAlike(bool value){settings.setValue("Options/PwGenExcludeLookAlike",value);}
+       void setPwGenEveryGroup(bool value){settings.setValue("Options/PwGenEveryGroup",value);}
+       void setPwGenLength(int value){settings.setValue("Options/PwGenLength",value);}
+       void setPwGenOptions(const QBitArray& value){settings.setValue("Options/PwGenOptions",bitArrayToString(value));}
+       void setRememberLastKey(bool value){settings.setValue("Options/RememberLastKey",value);}
+       void setSaveFileDlgHistory(bool value){settings.setValue("Options/SaveFileDlgHistory",value);}
+       void setSaveRelativePaths(bool value){settings.setValue("Options/SaveRelativePaths",value);}
+       void setSearchOptions(const QBitArray& value){settings.setValue("Options/SearchOptions",bitArrayToString(value));}
+       void setShowEntryDetails(bool value){settings.setValue("UI/ShowEntryDetails",value);}
+       void setShowPasswords(bool value){settings.setValue("Options/ShowPasswords",value);}
+       void setShowPasswordsPasswordDlg(bool value){settings.setValue("Options/ShowPasswordsPasswordDlg",value);}
+       void setLockOnMinimize(bool value){settings.setValue("Options/LockOnMinimize",value);}
+       void setLockOnInactivity(bool value){settings.setValue("Options/LockOnInactivity",value);}
+       void setLockAfterSec(int value){settings.setValue("Options/LockAfterSec",value);}
+       void setShowStatusbar(bool value){settings.setValue("UI/ShowStatusbar",value);}
+       void setShowSysTrayIcon(bool value){settings.setValue("Options/ShowSysTrayIcon",value);}
+       void setShowToolbar(bool value){settings.setValue("UI/ShowToolbar",value);}
+       void setToolbarIconSize(int value){settings.setValue("UI/ToolbarIconSize",value);}
+       void setUrlCmd(const QString& value){settings.setValue("Options/UrlCmd",value);}
+       void setUrlCmdDef(bool value){settings.setValue("Options/UrlCmdDef",value);}
+       void setVSplitterPos(const QByteArray& value){settings.setValue("UI/VSplitterPos",value);}
+       void setAskBeforeDelete(bool value){settings.setValue("Options/AskBeforeDelete",value);}
+#ifdef AUTOTYPE
+       void setAutoTypePreGap(int value){settings.setValue("Options/AutoTypePreGap",value);}
+       void setAutoTypeKeyStrokeDelay(int value){settings.setValue("Options/AutoTypeKeyStrokeDelay",value);}
+#endif
+#ifdef GLOBAL_AUTOTYPE
+       void setGlobalShortcut(const Shortcut& s);
+       void setEntryTitlesMatch(bool value){settings.setValue("Options/EntryTitlesMatch",value);}
+#endif
+       //void setFeatureBookmarks(bool value){settings.setValue("Features/Bookmarks",value);}
+       void setLanguage(const QString& value){settings.setValue("Options/Language",value);}
+
+       unsigned fileDlgHistorySize();
+       void clearFileDlgHistory(){settings.remove("FileDlgHistory");};
+       
+       QRect dialogGeometry(const QWidget* widget);
+       void setDialogGeometry(const QWidget* widget);
+       
+       QString detailViewTemplate();
+       QString defaultDetailViewTemplate();
+       void setDetailViewTemplate(const QString& value);
+
+private:
+       QSettings settings;
+       QString configFile;
+
+       QColor stringToColor(const QString& str);
+       QBitArray stringToBitArray(const QString& str, unsigned count);
+       GrpTreeState stringToGrpTreeState(const QString& str);
+       QList<int> stringToIntArray(const QString& str, unsigned count);
+       IntegrPluginType stringToIntegrPluginType(const QString& str);
+       tKeyType stringToKeyType(const QString& str);
+
+       QString colorToString(const QColor& color){return QString("%1,%2,%3").arg(color.red()).arg(color.green()).arg(color.blue());}
+       QString bitArrayToString(const QBitArray& bitArray);
+       QString grpTreeStateToString(GrpTreeState grpTreeState);
+       QString intArrayToString(const QList<int>& intArray);
+       QString integrPluginTypeToString(IntegrPluginType integrPluginType);
+       QString keyTypeToString(tKeyType keyType);
+};
+
+#endif
diff --git a/src/apg/convert.c b/src/apg/convert.c
new file mode 100644 (file)
index 0000000..e30dc52
--- /dev/null
@@ -0,0 +1,404 @@
+/*
+** Copyright (c) 1999, 2000, 2001, 2002, 2003
+** Adel I. Mirzazhanov. All rights reserved
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 
+**     1.Redistributions of source code must retain the above copyright notice,
+**       this list of conditions and the following disclaimer. 
+**     2.Redistributions in binary form must reproduce the above copyright
+**       notice, this list of conditions and the following disclaimer in the
+**       documentation and/or other materials provided with the distribution. 
+**     3.The name of the author may not be used to endorse or promote products
+**       derived from this software without specific prior written permission. 
+**               
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND ANY EXPRESS
+** OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO, THE IMPLIED
+** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED.  IN  NO  EVENT  SHALL THE AUTHOR BE LIABLE FOR ANY
+** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE
+** GOODS OR SERVICES;  LOSS OF USE,  DATA,  OR  PROFITS;  OR BUSINESS
+** INTERRUPTION)  HOWEVER  CAUSED  AND  ON  ANY  THEORY OF LIABILITY,
+** WHETHER  IN  CONTRACT,   STRICT   LIABILITY,  OR  TORT  (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "random.h"
+
+#include "randpass.h"
+#include "convert.h"
+
+/*
+** GLOBALS
+*/
+
+/* small letters */
+char let[26] =
+ {
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+ 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+ 'u', 'v', 'w', 'x', 'w', 'z'
+ };
+/* capital letters */
+char clet[26] =
+ {
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+ 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+ 'U', 'V', 'W', 'X', 'W', 'Z'
+  };
+
+/*
+** FUNCTIONS
+*/
+
+/*
+** decapitalize() - This routine replaces all capital letters
+**                  to small letters in the word:
+** INPUT:
+**   char * - word.
+** OUTPUT:
+**   none.
+** NOTES:
+**   none.
+*/
+void
+decapitalize (char *word)
+{
+ int i = 0; /* counter */
+ int j = 0; /* counter */
+ int str_len = strlen(word);
+ for(j = 0; j < str_len; j++)
+  for(i=0; i < 26; i++)
+   if(word[j] == clet[i])
+       word[j] = let[i];
+}
+
+#ifndef APGBFM
+/*
+** capitalize() - This routine designed to modify sullable like this:
+** adel ----> Adel
+** dot  ----> Dot
+** etc.
+** INPUT:
+**   char * - syllable.
+** OUTPUT:
+**   none.
+** NOTES:
+**   none.
+*/
+void
+capitalize (char *syllable)
+{
+ char tmp = 0x00;
+ int i = 0;
+ if ( randint(2) == TRUE)
+  {
+   (void)memcpy((void *)&tmp, (void *)syllable, sizeof(tmp));
+   for(i=0; i < 26; i++)
+     if ( let[i] == tmp )
+       if (is_restricted_symbol(clet[i]) != TRUE)
+         (void)memcpy ((void *)syllable, (void *)&clet[i], 1);
+  }
+}
+
+/*
+** numerize() - This routine designed to modify single-letter
+** syllable like this:
+** a ----> 1 or 2 or 3 etc.
+** u ----> 1 or 2 or 3 etc.
+** etc.
+** INPUT:
+**   char * - single-letter syllable
+** OUTPUT:
+**   none.
+** NOTES:
+**   none.
+*/
+void
+numerize (char *syllable)
+{
+ char *tmp;
+ if ( (tmp = (char *)calloc(1, 4)) == NULL)
+    perror("calloc");
+ if ( strlen (syllable) == 1 )
+      {
+       (void) gen_rand_symbol(tmp, S_NB);
+       (void)memcpy ((void *)syllable, (void *)tmp, 1);
+      }
+ free ((void *)tmp);
+}
+/*
+** specialize() - This routine designed to modify single-letter syllable
+** like this:
+** a ----> # or $ or % etc.
+** u ----> # or $ or % etc.
+** etc.
+** INPUT:
+**   char * - single-letter syllable.
+** OUTPUT:
+**   none.
+** NOTES:
+**   none.
+*/
+void
+specialize (char *syllable)
+{
+ char *tmp;
+ if ( (tmp = (char *)calloc(1, 4)) == NULL)
+    perror("calloc");
+ if ( strlen (syllable) == 1 )
+      {
+       (void) gen_rand_symbol(tmp, S_SS);
+       (void)memcpy ((void *)syllable, (void *)tmp, 1);
+      }
+ free ((void *)tmp);
+}
+
+/*
+** symb2name - convert symbol to it's name
+** INPUT:
+**   char * - one symbol syllable
+** OUTPUT:
+**   none.
+** NOTES:
+**   none.
+*/
+void
+symb2name(char * syllable, char * h_syllable)
+{
+ struct ssymb_names
+  {
+   char symbol;
+   char *name;
+  };
+ static struct ssymb_names ssn[42] =
+  {
+   {'1',"ONE"},
+   {'2',"TWO"},
+   {'3',"THREE"},
+   {'4',"FOUR"},
+   {'5',"FIVE"},
+   {'6',"SIX"},
+   {'7',"SEVEN"},
+   {'8',"EIGHT"},
+   {'9',"NINE"},
+   {'0',"ZERO"},
+   {33, "EXCLAMATION_POINT"},
+   {34, "QUOTATION_MARK"},
+   {35, "CROSSHATCH"},
+   {36, "DOLLAR_SIGN"},
+   {37, "PERCENT_SIGN"},
+   {38, "AMPERSAND"},
+   {39, "APOSTROPHE"},
+   {40, "LEFT_PARENTHESIS"},
+   {41, "RIGHT_PARENTHESIS"},
+   {42, "ASTERISK"},
+   {43, "PLUS_SIGN"},
+   {44, "COMMA"},
+   {45, "HYPHEN"},
+   {46, "PERIOD"},
+   {47, "SLASH"},
+   {58, "COLON"},
+   {59, "SEMICOLON"},
+   {60, "LESS_THAN"},
+   {61, "EQUAL_SIGN"},
+   {62, "GREATER_THAN"},
+   {63, "QUESTION_MARK"},
+   {64, "AT_SIGN"},
+   {91, "LEFT_BRACKET"},
+   {92, "BACKSLASH"},
+   {93, "RIGHT_BRACKET"},
+   {94, "CIRCUMFLEX"},
+   {95, "UNDERSCORE"},
+   {96, "GRAVE"},
+   {123, "LEFT_BRACE"},
+   {124, "VERTICAL_BAR"},
+   {125, "RIGHT_BRACE"},
+   {126, "TILDE"}
+  };
+ int i = 0;
+ int flag = FALSE;
+ if (strlen(syllable) == 1)
+    {
+     for (i = 0; i < 42; i++)
+      {
+       if(*syllable == ssn[i].symbol)
+        {
+         (void)memcpy((void*)h_syllable, (void*)ssn[i].name, strlen(ssn[i].name));
+        flag = TRUE;
+        }
+      }
+     if (flag != TRUE)
+       (void)memcpy((void*)h_syllable, (void*)syllable, strlen(syllable));
+    }
+}
+
+/*
+** spell_word - spell the word
+** INPUT:
+**   char * - pointer to the word
+**   char * - pointer to the spelled word
+** OUTPUT:
+**   char * - pointer to the spelled word
+**    NULL  - something is wrong
+** NOTES:
+**   You should free() memory pointed by spelled_word after each use of spell_word
+*/
+char *
+spell_word(char * word, char * spelled_word)
+{
+ struct char_spell
+  {
+   char symbol;
+   char *name;
+  };
+ static struct char_spell cs[94] =
+  {
+   {'1',"ONE"              },
+   {'2',"TWO"              },
+   {'3',"THREE"            },
+   {'4',"FOUR"             },
+   {'5',"FIVE"             },
+   {'6',"SIX"              },
+   {'7',"SEVEN"            },
+   {'8',"EIGHT"            },
+   {'9',"NINE"             },
+   {'0',"ZERO"             },
+   {'A', "Alfa"            },
+   {'B', "Bravo"           },
+   {'C', "Charlie"         },
+   {'D', "Delta"           },
+   {'E', "Echo"            },
+   {'F', "Foxtrot"         },
+   {'G', "Golf"            },
+   {'H', "Hotel"           },
+   {'I', "India"           },
+   {'J', "Juliett"         },
+   {'K', "Kilo"            },
+   {'L', "Lima"            },
+   {'M', "Mike"            },
+   {'N', "November"        },
+   {'O', "Oscar"           },
+   {'P', "Papa"            },
+   {'Q', "Quebec"          },
+   {'R', "Romeo"           },
+   {'S', "Sierra"          },
+   {'T', "Tango"           },
+   {'U', "Uniform"         },
+   {'V', "Victor"          },
+   {'W', "Whiskey"         },
+   {'X', "X_ray"           },
+   {'Y', "Yankee"          },
+   {'Z', "Zulu"            },
+   {'a', "alfa"            },
+   {'b', "bravo"           },
+   {'c', "charlie"         },
+   {'d', "delta"           },
+   {'e', "echo"            },
+   {'f', "foxtrot"         },
+   {'g', "golf"            },
+   {'h', "hotel"           },
+   {'i', "india"           },
+   {'j', "juliett"         },
+   {'k', "kilo"            },
+   {'l', "lima"            },
+   {'m', "mike"            },
+   {'n', "november"        },
+   {'o', "oscar"           },
+   {'p', "papa"            },
+   {'q', "quebec"          },
+   {'r', "romeo"           },
+   {'s', "sierra"          },
+   {'t', "tango"           },
+   {'u', "uniform"         },
+   {'v', "victor"          },
+   {'w', "whiskey"         },
+   {'x', "x_ray"           },
+   {'y', "yankee"          },
+   {'z', "zulu"            },
+   {33, "EXCLAMATION_POINT"},
+   {34, "QUOTATION_MARK"   },
+   {35, "CROSSHATCH"       },
+   {36, "DOLLAR_SIGN"      },
+   {37, "PERCENT_SIGN"     },
+   {38, "AMPERSAND"        },
+   {39, "APOSTROPHE"       },
+   {40, "LEFT_PARENTHESIS" },
+   {41, "RIGHT_PARENTHESIS"},
+   {42, "ASTERISK"         },
+   {43, "PLUS_SIGN"        },
+   {44, "COMMA"            },
+   {45, "HYPHEN"           },
+   {46, "PERIOD"           },
+   {47, "SLASH"            },
+   {58, "COLON"            },
+   {59, "SEMICOLON"        },
+   {60, "LESS_THAN"        },
+   {61, "EQUAL_SIGN"       },
+   {62, "GREATER_THAN"     },
+   {63, "QUESTION_MARK"    },
+   {64, "AT_SIGN"          },
+   {91, "LEFT_BRACKET"     },
+   {92, "BACKSLASH"        },
+   {93, "RIGHT_BRACKET"    },
+   {94, "CIRCUMFLEX"       },
+   {95, "UNDERSCORE"       },
+   {96, "GRAVE"            },
+   {123, "LEFT_BRACE"      },
+   {124, "VERTICAL_BAR"    },
+   {125, "RIGHT_BRACE"     },
+   {126, "TILDE"           }
+  };
+  int s_length = 0;
+  int i = 0;
+  int j = 0;
+  int word_len = strlen(word);
+  char * tmp_ptr;
+  char hyphen = '-';
+  char zero   = 0x00;
+  
+  /* Count the length of the spelled word */
+  for (i=0; i <= word_len; i++)
+   for (j=0; j < 94; j++)
+    if (word[i] == cs[j].symbol)
+     {
+      s_length = s_length + strlen(cs[j].name) + 1;
+      continue;
+     }
+
+  /* Allocate memory for spelled word */
+  if ( (spelled_word = (char *)calloc(1, (size_t)s_length)) == NULL)
+    return(NULL);
+
+  /* Construct spelled word */
+  tmp_ptr = spelled_word;
+
+  for (i=0; i < word_len; i++)
+   for (j=0; j < 94; j++)
+    if (word[i] == cs[j].symbol)
+     {
+      (void) memcpy((void *)tmp_ptr, (void *)cs[j].name, strlen(cs[j].name));
+      tmp_ptr = tmp_ptr + strlen(cs[j].name);
+      /* Place the hyphen after each symbol */
+      (void) memcpy((void *)(tmp_ptr), (void *)&hyphen, 1);
+      tmp_ptr = tmp_ptr + 1;
+      continue;
+     }
+
+  /* Remove hyphen at the end of the word */
+  tmp_ptr = tmp_ptr - 1;
+  (void) memcpy((void *)(tmp_ptr), (void *)&zero, 1);
+
+  return (spelled_word);
+}
+
+#endif /* APGBFM */
diff --git a/src/apg/convert.h b/src/apg/convert.h
new file mode 100644 (file)
index 0000000..08f0bf0
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+** Copyright (c) 1999, 2000, 2001, 2002, 2003
+** Adel I. Mirzazhanov. All rights reserved
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 
+**     1.Redistributions of source code must retain the above copyright notice,
+**       this list of conditions and the following disclaimer. 
+**     2.Redistributions in binary form must reproduce the above copyright
+**       notice, this list of conditions and the following disclaimer in the
+**       documentation and/or other materials provided with the distribution. 
+**     3.The name of the author may not be used to endorse or promote products
+**       derived from this software without specific prior written permission. 
+**               
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND ANY EXPRESS
+** OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO, THE IMPLIED
+** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED.  IN  NO  EVENT  SHALL THE AUTHOR BE LIABLE FOR ANY
+** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE
+** GOODS OR SERVICES;  LOSS OF USE,  DATA,  OR  PROFITS;  OR BUSINESS
+** INTERRUPTION)  HOWEVER  CAUSED  AND  ON  ANY  THEORY OF LIABILITY,
+** WHETHER  IN  CONTRACT,   STRICT   LIABILITY,  OR  TORT  (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef APG_CONVERT_H
+#define APG_CONVERT_H  1
+
+void decapitalize (char *word);
+
+#ifndef APGBFM
+void capitalize (char *syllable);
+void numerize (char *syllable);
+void specialize (char *syllable);
+void symb2name(char * syllable, char * h_syllable);
+char* spell_word(char * word, char * spelled_word);
+#endif /* APGBFM */
+
+#endif /* APG_CONVERT_H */
diff --git a/src/apg/owntypes.h b/src/apg/owntypes.h
new file mode 100644 (file)
index 0000000..6252e5c
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+** Copyright (c) 1999, 2000, 2001, 2002, 2003
+** Adel I. Mirzazhanov. All rights reserved
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 
+**     1.Redistributions of source code must retain the above copyright notice,
+**       this list of conditions and the following disclaimer. 
+**     2.Redistributions in binary form must reproduce the above copyright
+**       notice, this list of conditions and the following disclaimer in the
+**       documentation and/or other materials provided with the distribution. 
+**     3.The name of the author may not be used to endorse or promote products
+**       derived from this software without specific prior written permission. 
+**               
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND ANY EXPRESS
+** OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO, THE IMPLIED
+** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED.  IN  NO  EVENT  SHALL THE AUTHOR BE LIABLE FOR ANY
+** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE
+** GOODS OR SERVICES;  LOSS OF USE,  DATA,  OR  PROFITS;  OR BUSINESS
+** INTERRUPTION)  HOWEVER  CAUSED  AND  ON  ANY  THEORY OF LIABILITY,
+** WHETHER  IN  CONTRACT,   STRICT   LIABILITY,  OR  TORT  (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef APG_OWN_TYPES_H
+#define APG_OWN_TYPES_H        1
+
+typedef unsigned int         UINT;
+typedef unsigned short       USHORT;
+typedef short int            SHORT;
+typedef int                  boolean;
+typedef unsigned long int     UINT32;
+
+#ifndef TRUE
+#define TRUE   1
+#endif
+
+#ifndef FALSE
+#define FALSE  0
+#endif
+
+#define APG_MAX_PASSWORD_LENGTH 255
+
+#endif /* APG_OWN_TYPES_H */
diff --git a/src/apg/pronpass.c b/src/apg/pronpass.c
new file mode 100644 (file)
index 0000000..6169b1c
--- /dev/null
@@ -0,0 +1,2289 @@
+/*
+** This module uses code from the NIST implementation of  FIPS-181,
+** but the algorythm is CHANGED and I think that I CAN
+** copyright it. See copiright notes below.
+*/
+
+/*
+** Copyright (c) 1999, 2000, 2001, 2002, 2003
+** Adel I. Mirzazhanov. All rights reserved
+**