Compare commits
361 Commits
2.0-alpha4
...
2.0-beta2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a954e9a4d8 | ||
|
|
95c449481e | ||
|
|
0b43607aa1 | ||
|
|
e75efb8bfb | ||
|
|
d83fee89bd | ||
|
|
98417d6465 | ||
|
|
0ea64afe92 | ||
|
|
a862f62fe8 | ||
|
|
5bd525a6dd | ||
|
|
af3d896bdf | ||
|
|
ceeb72a277 | ||
|
|
2c17fdcff0 | ||
|
|
41a7c96968 | ||
|
|
98d9dae087 | ||
|
|
2033174d95 | ||
|
|
606e36acf3 | ||
|
|
0422943d52 | ||
|
|
0024f2e30f | ||
|
|
abe5e8ecea | ||
|
|
61503a8047 | ||
|
|
fcb5deff0a | ||
|
|
fdec16c3a0 | ||
|
|
84ee8b993f | ||
|
|
3d1c27ceb7 | ||
|
|
7d3fb58cf5 | ||
|
|
df5da2fcef | ||
|
|
1226d1dbd5 | ||
|
|
607007f94f | ||
|
|
6327eaf587 | ||
|
|
b1fd99f4c4 | ||
|
|
d1331053c8 | ||
|
|
c6fe0da569 | ||
|
|
b9fe2c1bf9 | ||
|
|
3efc8f457a | ||
|
|
65e8732eeb | ||
|
|
e82015d419 | ||
|
|
fa0fe6d33d | ||
|
|
8be135adf9 | ||
|
|
d04927ce7f | ||
|
|
6889cc2f20 | ||
|
|
8325b20d36 | ||
|
|
826cd472c8 | ||
|
|
8ecab15c33 | ||
|
|
c9520214e2 | ||
|
|
6d1ca363af | ||
|
|
2170794d9c | ||
|
|
719ac64851 | ||
|
|
d3a7e0dee9 | ||
|
|
240919335f | ||
|
|
ceb6a0383e | ||
|
|
0185b112e1 | ||
|
|
af84261eb6 | ||
|
|
274f86fd04 | ||
|
|
bcc3108c3d | ||
|
|
5f1b286630 | ||
|
|
8ad48d6774 | ||
|
|
721bec9794 | ||
|
|
c6105a08ab | ||
|
|
154f1673e9 | ||
|
|
577609b3e3 | ||
|
|
f22069bb11 | ||
|
|
280a1aceb9 | ||
|
|
bcd3de1180 | ||
|
|
f4361dd4d5 | ||
|
|
fc43aa1717 | ||
|
|
d553698b20 | ||
|
|
7db9c78855 | ||
|
|
7a2c02f0df | ||
|
|
c535736853 | ||
|
|
a8bf6a9782 | ||
|
|
0458dad6dc | ||
|
|
68373730bf | ||
|
|
5d9039ea89 | ||
|
|
7e1faadd11 | ||
|
|
fceb93061d | ||
|
|
c9d007fcdf | ||
|
|
eeb940c0dc | ||
|
|
05b5446e94 | ||
|
|
b45437d502 | ||
|
|
a599787a25 | ||
|
|
58061af959 | ||
|
|
8bf1bb0517 | ||
|
|
d26cff520f | ||
|
|
04aa10cee7 | ||
|
|
ade684d501 | ||
|
|
4362c3ea38 | ||
|
|
e0d4b4b625 | ||
|
|
cfffdae573 | ||
|
|
f6243675c9 | ||
|
|
a762cef0a9 | ||
|
|
a7f4e2d0cd | ||
|
|
ae013c2196 | ||
|
|
eefe844dcd | ||
|
|
94111c3662 | ||
|
|
3fca61dc24 | ||
|
|
e41bf008e9 | ||
|
|
6c9c0fd5c5 | ||
|
|
f3d956ceed | ||
|
|
b9c9c56059 | ||
|
|
bed58cde84 | ||
|
|
855d79e28f | ||
|
|
a044467d10 | ||
|
|
ecb2e337ef | ||
|
|
2dde18b179 | ||
|
|
6411b9bd66 | ||
|
|
cf0bc32b27 | ||
|
|
93ab7eb058 | ||
|
|
bd3ae05fcf | ||
|
|
b055d524e8 | ||
|
|
9e051e835b | ||
|
|
3ab1072e9e | ||
|
|
00df73ced0 | ||
|
|
940a5026c1 | ||
|
|
2631277184 | ||
|
|
b86b640860 | ||
|
|
2dfc740782 | ||
|
|
e4985f4ff7 | ||
|
|
22f579a59e | ||
|
|
c9d12e93c2 | ||
|
|
778f01bcf1 | ||
|
|
ccb7a4c96d | ||
|
|
33650c4a04 | ||
|
|
019cf9684c | ||
|
|
835c411d12 | ||
|
|
e4758c1984 | ||
|
|
eb22f0a2d8 | ||
|
|
3ea0592b53 | ||
|
|
876a75b572 | ||
|
|
c39898dad9 | ||
|
|
07a3d7a696 | ||
|
|
7f412fbd7f | ||
|
|
2adc64939f | ||
|
|
71d39865b3 | ||
|
|
226c061c01 | ||
|
|
dd2fbebb81 | ||
|
|
889c742a33 | ||
|
|
5cc3334325 | ||
|
|
e58be44523 | ||
|
|
34a7321786 | ||
|
|
07e4fbacd4 | ||
|
|
8fd69e084e | ||
|
|
dd79105baa | ||
|
|
b1c3814972 | ||
|
|
57107ea560 | ||
|
|
4b3a82592c | ||
|
|
6ecb8690f2 | ||
|
|
1c365b8417 | ||
|
|
315df0b8a8 | ||
|
|
87468b648b | ||
|
|
4cdb9a645d | ||
|
|
870d7355ca | ||
|
|
f1aa6aca26 | ||
|
|
72b59d541a | ||
|
|
0e8aa0bc6c | ||
|
|
3a0648cf25 | ||
|
|
2e76385cae | ||
|
|
867d14f7aa | ||
|
|
0d6117bf4c | ||
|
|
b417bf9187 | ||
|
|
7137990a21 | ||
|
|
916ab99d62 | ||
|
|
5a31e055cf | ||
|
|
28694ae687 | ||
|
|
becd3a0019 | ||
|
|
8cc1e6008e | ||
|
|
910788c038 | ||
|
|
9391de74c7 | ||
|
|
c806f9ebf4 | ||
|
|
e776de8eeb | ||
|
|
a25b28ffee | ||
|
|
0e75e6ff03 | ||
|
|
76da4a6cd4 | ||
|
|
8a4100adbd | ||
|
|
584f4b50bf | ||
|
|
9ac01c930d | ||
|
|
d874f58a39 | ||
|
|
05de45dadb | ||
|
|
4ab887c773 | ||
|
|
552ca7bf71 | ||
|
|
2d8ba2b394 | ||
|
|
a6d44034a4 | ||
|
|
77af79498c | ||
|
|
ea3375490c | ||
|
|
204cd8d971 | ||
|
|
c2940a8f18 | ||
|
|
4f60df029d | ||
|
|
819cfd459a | ||
|
|
c90ac914bb | ||
|
|
8bf4826003 | ||
|
|
e361b0dd81 | ||
|
|
ce7e01a1b1 | ||
|
|
cda5e990ac | ||
|
|
50cbd80925 | ||
|
|
75d3e6261b | ||
|
|
bf39d0b1be | ||
|
|
147cd4ed7b | ||
|
|
9363d23e09 | ||
|
|
b718e9d8f2 | ||
|
|
d6c30b0886 | ||
|
|
7c7f0b93ae | ||
|
|
e263c475c9 | ||
|
|
c917096d3c | ||
|
|
5de62a5ef4 | ||
|
|
7893a2e84d | ||
|
|
ad26d962dc | ||
|
|
967a9f0195 | ||
|
|
6c663a19bf | ||
|
|
b194c29166 | ||
|
|
0b9167c78b | ||
|
|
63ae460a80 | ||
|
|
43a1d54bba | ||
|
|
2963752585 | ||
|
|
1decdc6c11 | ||
|
|
6659745e2b | ||
|
|
1e2d1a1b17 | ||
|
|
f300ca5b7b | ||
|
|
b9370c6e79 | ||
|
|
54bb7462f6 | ||
|
|
4a08101a60 | ||
|
|
809be5f89e | ||
|
|
bf9a755bea | ||
|
|
34b82da9aa | ||
|
|
e0c59395da | ||
|
|
b07de47e35 | ||
|
|
586de64293 | ||
|
|
9321943e64 | ||
|
|
c00550078c | ||
|
|
2190260a68 | ||
|
|
678c4a8ece | ||
|
|
c2781274a0 | ||
|
|
bc14898b13 | ||
|
|
b6497d9245 | ||
|
|
79d827ffa4 | ||
|
|
811eb2714f | ||
|
|
a914b837a1 | ||
|
|
04c9332a99 | ||
|
|
97f374a189 | ||
|
|
6f3648d63e | ||
|
|
350cf4b00a | ||
|
|
3af2307468 | ||
|
|
29c997e1bc | ||
|
|
223c5a1651 | ||
|
|
8b437821a2 | ||
|
|
4ded95a060 | ||
|
|
0b6b149351 | ||
|
|
eee909e948 | ||
|
|
8c7e655274 | ||
|
|
8e86437e89 | ||
|
|
a8edad1e27 | ||
|
|
41162ea2e8 | ||
|
|
0cbf59209b | ||
|
|
0f91e0d141 | ||
|
|
6a50a76466 | ||
|
|
1fce1ac905 | ||
|
|
b9a955c048 | ||
|
|
5a577e5e4c | ||
|
|
f648172625 | ||
|
|
4b41dd30e6 | ||
|
|
2a416d1f1d | ||
|
|
23f338b0c3 | ||
|
|
cdcea91b50 | ||
|
|
4549c97e51 | ||
|
|
fc3cc12038 | ||
|
|
62ea117f45 | ||
|
|
3d8ff5b585 | ||
|
|
a3b95c1c38 | ||
|
|
2308099260 | ||
|
|
4a3da3abe7 | ||
|
|
3e4811791a | ||
|
|
34f12ac39c | ||
|
|
af98c2636c | ||
|
|
f21b331844 | ||
|
|
ea628af580 | ||
|
|
9cae8a412a | ||
|
|
47b7befd2f | ||
|
|
2fcc369c41 | ||
|
|
66b3d22041 | ||
|
|
03e4b2d13c | ||
|
|
c83579ecdb | ||
|
|
a26119ea20 | ||
|
|
98c821df05 | ||
|
|
a992c76d6a | ||
|
|
f2dfef8c41 | ||
|
|
cb804eb143 | ||
|
|
74e912ccd3 | ||
|
|
1f47033835 | ||
|
|
3fcfc348ed | ||
|
|
6b33298a6e | ||
|
|
68e1fc0cd0 | ||
|
|
31796d33fb | ||
|
|
755241df5c | ||
|
|
9080864167 | ||
|
|
d25e883983 | ||
|
|
091e87aeb3 | ||
|
|
4a870f61f1 | ||
|
|
5daf0853c9 | ||
|
|
ef3d7b7772 | ||
|
|
7dde8a771f | ||
|
|
3dd4681e69 | ||
|
|
98d888063b | ||
|
|
9c788a6e84 | ||
|
|
e087baeb48 | ||
|
|
b64276c4e8 | ||
|
|
f7dd63a126 | ||
|
|
a68a86f19b | ||
|
|
984b23de70 | ||
|
|
d5b70b1bef | ||
|
|
551637f0c2 | ||
|
|
8778df5789 | ||
|
|
67338aac7b | ||
|
|
626351c5da | ||
|
|
6504b6f2bd | ||
|
|
035271d469 | ||
|
|
5c84aa308d | ||
|
|
e1c82a4453 | ||
|
|
db6ac26794 | ||
|
|
a505d85792 | ||
|
|
6df30df992 | ||
|
|
0ec29b2354 | ||
|
|
f1bebe904a | ||
|
|
e16720d06d | ||
|
|
3be7fa6b3b | ||
|
|
e99e3ae6ca | ||
|
|
d182586557 | ||
|
|
1f5564760f | ||
|
|
2be045eb8f | ||
|
|
7a89510916 | ||
|
|
5588792344 | ||
|
|
3acb33e05a | ||
|
|
61ee763515 | ||
|
|
3658a65380 | ||
|
|
fd18bc0330 | ||
|
|
b499a6df77 | ||
|
|
cabec57631 | ||
|
|
63f7a0685f | ||
|
|
94e6d3f89b | ||
|
|
94ac9c9ea1 | ||
|
|
bbf183bef7 | ||
|
|
6f92188323 | ||
|
|
f0985ff9d9 | ||
|
|
ba3baf3595 | ||
|
|
34c6b416b0 | ||
|
|
bf906a7867 | ||
|
|
5786e2620a | ||
|
|
fe42861bed | ||
|
|
5a96e19ce9 | ||
|
|
8ed0379136 | ||
|
|
4e2f5b1a5b | ||
|
|
317f603262 | ||
|
|
701013baab | ||
|
|
4b3bee6400 | ||
|
|
91868969ca | ||
|
|
ef46b3e8ad | ||
|
|
9e87230102 | ||
|
|
2558e6db79 | ||
|
|
bee570c3cf | ||
|
|
be288d26ca | ||
|
|
b055780984 | ||
|
|
e805a6ff82 | ||
|
|
60335452a4 | ||
|
|
3a822c24e2 |
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
src/version.h.cmake export-subst
|
||||
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
CMakeLists.txt.*
|
||||
build/
|
||||
|
||||
19
.travis.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
language: cpp
|
||||
install:
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -qq update; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get -qq install cmake libqt4-dev libgcrypt11-dev zlib1g-dev libxtst-dev; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install cmake qt libgcrypt; fi
|
||||
before_script: mkdir build && pushd build
|
||||
script:
|
||||
- cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_GUI_TESTS=ON ..
|
||||
- make
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then make test ARGS+="-E testgui --output-on-failure"; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then xvfb-run -a --server-args="-screen 0 800x600x24" make test ARGS+="-R testgui --output-on-failure"; fi
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then make test; fi
|
||||
8
.tx/config
Normal file
@@ -0,0 +1,8 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[keepassx.keepassx_ents]
|
||||
source_file = share/translations/keepassx_en.ts
|
||||
file_filter = share/translations/keepassx_<lang>.ts
|
||||
source_lang = en
|
||||
type = QT
|
||||
48
CHANGELOG
@@ -1,3 +1,50 @@
|
||||
2.0 Beta 2 (2015-09-06)
|
||||
=========================
|
||||
|
||||
- Fix crash when locking with search UI open [#309]
|
||||
- Fix file locking on Mac OS X [#327]
|
||||
- Set default extension when saving a database [#79, #308]
|
||||
|
||||
2.0 Beta 1 (2015-07-18)
|
||||
=========================
|
||||
|
||||
- Remember entry column sizes [#159]
|
||||
- Add translations
|
||||
- Support opening attachments directly
|
||||
- Support cmd:// URLs [#244]
|
||||
- Protect opened databases with a file lock [#18]
|
||||
- Export to csv files [#57]
|
||||
- Add optional tray icon [#153]
|
||||
- Allow setting the default auto-type sequence for groups [#175]
|
||||
- Make the kdbx parser more lenient
|
||||
- Remove --password command line option [#285]
|
||||
|
||||
2.0 Alpha 6 (2014-04-12)
|
||||
=========================
|
||||
|
||||
- Add option to lock databases after user inactivity [#62]
|
||||
- Add compatibility with libgcrypt 1.6 [#129]
|
||||
- Display passwords in monospace font [#51]
|
||||
- Use an icon for the button that shows/masks passwords [#38]
|
||||
- Add an option to show passwords by default [#93]
|
||||
- Improve password generator design [#122]
|
||||
- On Linux link .kdbx files with KeePassX
|
||||
- Remember window size [#154]
|
||||
- Disallow global auto-typing when the database is locked
|
||||
|
||||
2.0 Alpha 5 (2013-12-20)
|
||||
=========================
|
||||
|
||||
- Support copying entries and groups using drag'n'drop [#74]
|
||||
- Open last used databases on startup [#36]
|
||||
- Made the kdbx file parser more robust
|
||||
- Only edit entries on doubleclick (not single) or with enter key
|
||||
- Allow removing multiple entries
|
||||
- Added option to minimize window when copying data to clipboard
|
||||
- Save password generator settings
|
||||
- Fixed auto-type producing wrong chars in some keyboard configurations [#116]
|
||||
- Added some more actions to the toolbar
|
||||
|
||||
2.0 Alpha 4 (2013-03-29)
|
||||
=========================
|
||||
|
||||
@@ -29,7 +76,6 @@
|
||||
- Sortable entry view
|
||||
- Support building Mac OS X bundles
|
||||
|
||||
|
||||
2.0 Alpha 1 (2012-05-07)
|
||||
=========================
|
||||
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo Debug Debugfull Profile MinSizeRel."
|
||||
FORCE)
|
||||
endif()
|
||||
|
||||
project(KeePassX)
|
||||
|
||||
cmake_minimum_required(VERSION 2.6.4)
|
||||
@@ -26,10 +32,10 @@ include(CheckCXXSourceCompiles)
|
||||
option(WITH_TESTS "Enable building of unit tests" ON)
|
||||
option(WITH_GUI_TESTS "Enable building of GUI tests" OFF)
|
||||
option(WITH_LTO "Enable Link Time Optimization (LTO)" OFF)
|
||||
option(WITH_CXX11 "Build with the C++ 11 standard" OFF)
|
||||
option(WITH_CXX11 "Build with the C++ 11 standard" ON)
|
||||
|
||||
set(KEEPASSX_VERSION "2.0 alpha 4")
|
||||
set(KEEPASSX_VERSION_NUM "1.9.83")
|
||||
set(KEEPASSX_VERSION "2.0 beta 2")
|
||||
set(KEEPASSX_VERSION_NUM "1.9.92")
|
||||
|
||||
if("${CMAKE_C_COMPILER}" MATCHES "clang$" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||
set(CMAKE_COMPILER_IS_CLANG 1)
|
||||
@@ -58,14 +64,21 @@ endmacro(add_gcc_compiler_flags)
|
||||
|
||||
add_definitions(-DQT_NO_KEYWORDS -DQT_NO_EXCEPTIONS -DQT_NO_STL -DQT_STRICT_ITERATORS -DQT_NO_CAST_TO_ASCII)
|
||||
|
||||
add_gcc_compiler_flags("-fno-common -fstack-protector -D_FORTIFY_SOURCE=2")
|
||||
add_gcc_compiler_flags("-fno-common -fstack-protector --param=ssp-buffer-size=4")
|
||||
add_gcc_compiler_flags("-Wall -Wextra -Wundef -Wpointer-arith -Wno-long-long")
|
||||
add_gcc_compiler_flags("-Wformat=2 -Wmissing-format-attribute")
|
||||
add_gcc_compiler_flags("-fvisibility=hidden")
|
||||
add_gcc_compiler_cxxflags("-fvisibility-inlines-hidden")
|
||||
|
||||
add_gcc_compiler_cxxflags("-fno-exceptions -fno-rtti")
|
||||
add_gcc_compiler_cxxflags("-Wnon-virtual-dtor -Wold-style-cast -Woverloaded-virtual")
|
||||
add_gcc_compiler_cflags("-Wchar-subscripts -Wwrite-strings")
|
||||
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
|
||||
if (CMAKE_BUILD_TYPE_LOWER MATCHES (release|relwithdebinfo|minsizerel))
|
||||
add_gcc_compiler_flags("-D_FORTIFY_SOURCE=2")
|
||||
endif()
|
||||
|
||||
check_c_compiler_flag("-Werror=format-security -Werror=implicit-function-declaration" WERROR_C_AVAILABLE)
|
||||
check_cxx_compiler_flag("-Werror=format-security" WERROR_CXX_AVAILABLE)
|
||||
if(WERROR_C_AVAILABLE AND WERROR_CXX_AVAILABLE)
|
||||
@@ -73,16 +86,12 @@ if(WERROR_C_AVAILABLE AND WERROR_CXX_AVAILABLE)
|
||||
add_gcc_compiler_cflags("-Werror=implicit-function-declaration")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANGXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mllvm -stack-protector-buffer-size=4")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align --param=ssp-buffer-size=4")
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-align")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_CLANG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mllvm -stack-protector-buffer-size=4")
|
||||
elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align --param=ssp-buffer-size=4")
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wcast-align")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
@@ -109,6 +118,9 @@ endif()
|
||||
if (WITH_CXX11)
|
||||
add_gcc_compiler_cxxflags("-std=c++0x")
|
||||
add_gcc_compiler_cflags("-ansi")
|
||||
if(APPLE)
|
||||
add_gcc_compiler_cxxflags("-stdlib=libc++")
|
||||
endif()
|
||||
else()
|
||||
add_gcc_compiler_flags("-ansi")
|
||||
endif()
|
||||
@@ -138,9 +150,11 @@ elseif(APPLE)
|
||||
set(PLUGIN_INSTALL_DIR ".")
|
||||
set(DATA_INSTALL_DIR "${PROGNAME}.app/Contents/Resources")
|
||||
else()
|
||||
set(BIN_INSTALL_DIR "bin")
|
||||
set(PLUGIN_INSTALL_DIR "lib/keepassx")
|
||||
set(DATA_INSTALL_DIR "share/keepassx")
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
|
||||
set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/keepassx")
|
||||
set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/keepassx")
|
||||
endif()
|
||||
|
||||
if(WITH_TESTS)
|
||||
@@ -148,21 +162,18 @@ if(WITH_TESTS)
|
||||
endif(WITH_TESTS)
|
||||
|
||||
set(QT_REQUIRED_MODULES QtCore QtGui QtTest)
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(QT_REQUIRED_MODULES ${QT_REQUIRED_MODULES} QtDBus)
|
||||
endif()
|
||||
|
||||
find_package(Qt4 4.6.0 REQUIRED ${QT_REQUIRED_MODULES})
|
||||
add_definitions(${QT_DEFINITIONS} -DQT_CORE_LIB -DQT_GUI_LIB)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
|
||||
endif()
|
||||
include(${QT_USE_FILE})
|
||||
# Debian sets the the build type to None for package builds.
|
||||
# Make sure we don't enable asserts there.
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_NONE QT_NO_DEBUG)
|
||||
|
||||
find_package(Gcrypt REQUIRED)
|
||||
if(NOT (${GCRYPT_VERSION_STRING} VERSION_LESS "1.6.0"))
|
||||
message(STATUS "Gcrypt ${GCRYPT_VERSION_STRING} supports the SALSA20 cipher")
|
||||
set(GCRYPT_HAS_SALSA20 1)
|
||||
endif()
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
@@ -201,7 +212,12 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include_directories(SYSTEM ${QT_INCLUDE_DIR} ${GCRYPT_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
include_directories(SYSTEM ${GCRYPT_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if(NOT (${CMAKE_VERSION} VERSION_LESS 2.8.3))
|
||||
set(PRINT_SUMMARY ON)
|
||||
include(FeatureSummary)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(share)
|
||||
@@ -209,3 +225,7 @@ add_subdirectory(utils)
|
||||
if(WITH_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif(WITH_TESTS)
|
||||
|
||||
if(PRINT_SUMMARY)
|
||||
feature_summary(WHAT ALL)
|
||||
endif()
|
||||
|
||||
15
COPYING
@@ -25,8 +25,15 @@ Copyright: 2010-2012, Felix Geyer <debfx@fobos.de>
|
||||
2012, Intel Corporation
|
||||
2012, Nokia Corporation and/or its subsidiary(-ies)
|
||||
2000-2008, Tom Sato <VEF00200@nifty.ne.jp>
|
||||
2013, Laszlo Papp <lpapp@kde.org>
|
||||
2013, David Faure <faure@kde.org>
|
||||
License: GPL-2 or GPL-3
|
||||
|
||||
Files: cmake/GNUInstallDirs.cmake
|
||||
Copyright: 2011 Nikita Krupen'ko <krnekit@gmail.com>
|
||||
2011 Kitware, Inc.
|
||||
License: BSD-3-clause
|
||||
|
||||
Files: share/icons/application/*/apps/keepassx.png
|
||||
share/icons/application/scalable/apps/keepassx.svgz
|
||||
Copyright: 2006, Otto Salminen
|
||||
@@ -122,13 +129,17 @@ Files: share/icons/application/*/actions/application-exit.png
|
||||
share/icons/application/*/actions/dialog-ok.png
|
||||
share/icons/application/*/actions/document-close.png
|
||||
share/icons/application/*/actions/document-edit.png
|
||||
share/icons/application/*/actions/document-encrypt.png
|
||||
share/icons/application/*/actions/document-new.png
|
||||
share/icons/application/*/actions/document-open.png
|
||||
share/icons/application/*/actions/document-save.png
|
||||
share/icons/application/*/actions/document-save-as.png
|
||||
share/icons/application/*/actions/edit-clear-locationbar-ltr.png
|
||||
share/icons/application/*/actions/edit-clear-locationbar-rtl.png
|
||||
share/icons/application/*/actions/password-copy.png
|
||||
share/icons/application/*/actions/password-show-*.png
|
||||
share/icons/application/*/actions/system-search.png
|
||||
share/icons/application/*/actions/username-copy.png
|
||||
share/icons/application/*/status/dialog-error.png
|
||||
share/icons/application/*/status/dialog-information.png
|
||||
share/icons/application/*/status/dialog-warning.png
|
||||
@@ -172,3 +183,7 @@ Files: src/streams/qtiocompressor.*
|
||||
tests/modeltest.*
|
||||
Copyright: 2009-2012, Nokia Corporation and/or its subsidiary(-ies)
|
||||
License: LGPL-2.1 or GPL-3
|
||||
|
||||
Files: cmake/GetGitRevisionDescription.cmake*
|
||||
Copyright: 2009-2010, Iowa State University
|
||||
License: Boost-1.0
|
||||
|
||||
16
INSTALL
@@ -2,7 +2,7 @@ Building:
|
||||
=========
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. [CMAKE PARAMETERS]
|
||||
cmake [CMAKE PARAMETERS] ..
|
||||
make [-jX]
|
||||
|
||||
Common cmake parameters:
|
||||
@@ -16,15 +16,13 @@ Installing:
|
||||
===========
|
||||
make install [DESTDIR=X]
|
||||
|
||||
Create a bundle on Mac:
|
||||
make package
|
||||
|
||||
Run tests:
|
||||
==========
|
||||
make test [CTEST_OUTPUT_ON_FAILURE=1] [ARGS+=-jX] [ARGS+="-E testgui"]
|
||||
|
||||
Building on Mac OS X:
|
||||
=====================
|
||||
Install macports and cmake
|
||||
Open /opt/local/etc/macports/macports.conf and set the architecture(s) you want to build for.
|
||||
Run: sudo port install qt4-mac libgcrypt zlib
|
||||
If you want to build a universal binary append " +universal" to the above command.
|
||||
Pass -DCMAKE_OSX_ARCHITECTURES="<ARCH1>;<ARCH2>" to cmake
|
||||
Run: make package
|
||||
OS specific instructions:
|
||||
=========================
|
||||
https://www.keepassx.org/dev/projects/keepassx/wiki/Install_instructions
|
||||
|
||||
23
LICENSE.BOOST-1.0
Normal file
@@ -0,0 +1,23 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
129
README.md
Normal file
@@ -0,0 +1,129 @@
|
||||
# KeePassX
|
||||
|
||||
## About
|
||||
|
||||
KeePassX is an application for people with extremely high demands on secure personal data management.
|
||||
It has a light interface, is cross platform and published under the terms of the GNU General Public License.
|
||||
|
||||
KeePassX saves many different information e.g. user names, passwords, urls, attachments and comments in one single database.
|
||||
For a better management user-defined titles and icons can be specified for each single entry.
|
||||
Furthermore the entries are sorted in groups, which are customizable as well. The integrated search function allows to search in a single group or the complete database.
|
||||
KeePassX offers a little utility for secure password generation. The password generator is very customizable, fast and easy to use.
|
||||
Especially someone who generates passwords frequently will appreciate this feature.
|
||||
|
||||
The complete database is always encrypted with the AES (aka Rijndael) encryption algorithm using a 256 bit key.
|
||||
Therefore the saved information can be considered as quite safe. KeePassX uses a database format that is compatible with [KeePass Password Safe](http://keepass.info/).
|
||||
This makes the use of that application even more favorable.
|
||||
|
||||
## Install
|
||||
|
||||
KeePassX can be downloaded and installed using an assortment of installers available on the main [KeePassX website](http://www.keepassx.org).
|
||||
KeePassX can also be installed from the official repositories of many Linux repositories.
|
||||
If you wish to build KeePassX from source, rather than rely on the pre-compiled binaries, you may wish to read up on the _From Source_ section.
|
||||
|
||||
### Debian
|
||||
|
||||
To install KeePassX from the Debian repository:
|
||||
|
||||
```bash
|
||||
sudo apt-get install keepassx
|
||||
```
|
||||
|
||||
### Red Hat
|
||||
|
||||
Install KeePassX from the Red Hat (or CentOS) repository:
|
||||
|
||||
```bash
|
||||
sudo yum install keepassx
|
||||
```
|
||||
|
||||
### Windows / Mac OS X
|
||||
|
||||
Download the installer from the KeePassX [download](https://www.keepassx.org/downloads) page.
|
||||
Once downloaded, double click on the file to execute the installer.
|
||||
|
||||
### From Source
|
||||
|
||||
#### Build Dependencies
|
||||
|
||||
The following tools must exist within your PATH:
|
||||
|
||||
* make
|
||||
* cmake (>= 2.6.4)
|
||||
* g++ or clang++
|
||||
|
||||
The following libraries are required:
|
||||
|
||||
* Qt 4 (>= 4.6)
|
||||
* libgcrypt
|
||||
* zlib
|
||||
* libxtst (optional for auto-type on X11)
|
||||
|
||||
On Debian you can install them with:
|
||||
|
||||
```bash
|
||||
sudo apt-get install build-essential cmake libqt4-dev libgcrypt11-dev zlib1g-dev
|
||||
```
|
||||
|
||||
#### Build Steps
|
||||
|
||||
To compile from source:
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make [-jX]
|
||||
```
|
||||
|
||||
You will have the compiled KeePassX binary inside the `./build/src/` directory.
|
||||
|
||||
To install this binary execute the following:
|
||||
|
||||
```bash
|
||||
sudo make install
|
||||
```
|
||||
|
||||
More detailed instructions available in the INSTALL file.
|
||||
|
||||
## Contribute
|
||||
|
||||
Coordination of work between developers is handled through the [KeePassX development](https://www.keepassx.org/dev/) site.
|
||||
Requests for enhancements, or reports of bugs encountered, can also be reported through the KeePassX development site.
|
||||
However, members of the open-source community are encouraged to submit pull requests directly through GitHub.
|
||||
|
||||
### Clone Repository
|
||||
|
||||
Clone the repository to a suitable location where you can extend and build this project.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/keepassx/keepassx.git
|
||||
```
|
||||
|
||||
**Note:** This will clone the entire contents of the repository at the HEAD revision.
|
||||
|
||||
To update the project from within the project's folder you can run the following command:
|
||||
|
||||
```bash
|
||||
git pull
|
||||
```
|
||||
|
||||
### Feature Requests
|
||||
|
||||
We're always looking for suggestions to improve our application. If you have a suggestion for improving an existing feature,
|
||||
or would like to suggest a completely new feature for KeePassX, please file a ticket on the [KeePassX development](https://www.keepassx.org/dev/) site.
|
||||
|
||||
### Bug Reports
|
||||
|
||||
Our software isn't always perfect, but we strive to always improve our work. You may file bug reports on the [KeePassX development](https://www.keepassx.org/dev/) site.
|
||||
|
||||
### Pull Requests
|
||||
|
||||
Along with our desire to hear your feedback and suggestions, we're also interested in accepting direct assistance in the form of code.
|
||||
|
||||
Issue merge requests against our [GitHub repository](https://github.com/keepassx/keepassx).
|
||||
|
||||
### Translations
|
||||
|
||||
Translations are managed on [Transifex](https://www.transifex.com/projects/p/keepassx/) which offers a web interface.
|
||||
Please join an existing language team or request a new one if there is none.
|
||||
@@ -17,7 +17,15 @@ find_path(GCRYPT_INCLUDE_DIR gcrypt.h)
|
||||
|
||||
find_library(GCRYPT_LIBRARIES gcrypt)
|
||||
|
||||
mark_as_advanced(GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
|
||||
|
||||
if(GCRYPT_INCLUDE_DIR AND EXISTS "${GCRYPT_INCLUDE_DIR}/gcrypt.h")
|
||||
file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" GCRYPT_H REGEX "^#define GCRYPT_VERSION \"[^\"]*\"$")
|
||||
string(REGEX REPLACE "^.*GCRYPT_VERSION \"([0-9]+).*$" "\\1" GCRYPT_VERSION_MAJOR "${GCRYPT_H}")
|
||||
string(REGEX REPLACE "^.*GCRYPT_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" GCRYPT_VERSION_MINOR "${GCRYPT_H}")
|
||||
string(REGEX REPLACE "^.*GCRYPT_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCRYPT_VERSION_PATCH "${GCRYPT_H}")
|
||||
set(GCRYPT_VERSION_STRING "${GCRYPT_VERSION_MAJOR}.${GCRYPT_VERSION_MINOR}.${GCRYPT_VERSION_PATCH}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Gcrypt DEFAULT_MSG GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
|
||||
|
||||
188
cmake/GNUInstallDirs.cmake
Normal file
@@ -0,0 +1,188 @@
|
||||
# - Define GNU standard installation directories
|
||||
# Provides install directory variables as defined for GNU software:
|
||||
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||
# Inclusion of this module defines the following variables:
|
||||
# CMAKE_INSTALL_<dir> - destination for files of a given type
|
||||
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
|
||||
# where <dir> is one of:
|
||||
# BINDIR - user executables (bin)
|
||||
# SBINDIR - system admin executables (sbin)
|
||||
# LIBEXECDIR - program executables (libexec)
|
||||
# SYSCONFDIR - read-only single-machine data (etc)
|
||||
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
|
||||
# LOCALSTATEDIR - modifiable single-machine data (var)
|
||||
# LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
|
||||
# INCLUDEDIR - C header files (include)
|
||||
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
|
||||
# DATAROOTDIR - read-only architecture-independent data root (share)
|
||||
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
|
||||
# INFODIR - info documentation (DATAROOTDIR/info)
|
||||
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
|
||||
# MANDIR - man documentation (DATAROOTDIR/man)
|
||||
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
|
||||
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
|
||||
# install() commands for the corresponding file type. If the includer does
|
||||
# not define a value the above-shown default will be used and the value will
|
||||
# appear in the cache for editing by the user.
|
||||
# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
|
||||
# from the corresponding destination by prepending (if necessary) the value
|
||||
# of CMAKE_INSTALL_PREFIX.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
|
||||
# Copyright 2011 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Installation directories
|
||||
#
|
||||
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
|
||||
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
|
||||
set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
|
||||
set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
|
||||
set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
|
||||
set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
|
||||
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(_LIBDIR_DEFAULT "lib")
|
||||
# Override this default 'lib' with 'lib64' iff:
|
||||
# - we are on Linux system but NOT cross-compiling
|
||||
# - we are NOT on debian
|
||||
# - we are on a 64 bits system
|
||||
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
|
||||
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
|
||||
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
|
||||
# See http://wiki.debian.org/Multiarch
|
||||
if((CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")
|
||||
AND NOT CMAKE_CROSSCOMPILING)
|
||||
if (EXISTS "/etc/debian_version") # is this a debian system ?
|
||||
if(CMAKE_LIBRARY_ARCHITECTURE)
|
||||
set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
endif()
|
||||
else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
|
||||
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
|
||||
message(AUTHOR_WARNING
|
||||
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
|
||||
"Please enable at least one language before including GNUInstallDirs.")
|
||||
else()
|
||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||
set(_LIBDIR_DEFAULT "lib64")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
|
||||
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
|
||||
set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
|
||||
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
|
||||
# the cache and store the defaults in local variables if the cache values are
|
||||
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
|
||||
|
||||
if(NOT CMAKE_INSTALL_DATADIR)
|
||||
set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
|
||||
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_INFODIR)
|
||||
set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
|
||||
set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_LOCALEDIR)
|
||||
set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
|
||||
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_MANDIR)
|
||||
set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
|
||||
set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_DOCDIR)
|
||||
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
|
||||
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_INSTALL_BINDIR
|
||||
CMAKE_INSTALL_SBINDIR
|
||||
CMAKE_INSTALL_LIBEXECDIR
|
||||
CMAKE_INSTALL_SYSCONFDIR
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR
|
||||
CMAKE_INSTALL_LOCALSTATEDIR
|
||||
CMAKE_INSTALL_LIBDIR
|
||||
CMAKE_INSTALL_INCLUDEDIR
|
||||
CMAKE_INSTALL_OLDINCLUDEDIR
|
||||
CMAKE_INSTALL_DATAROOTDIR
|
||||
CMAKE_INSTALL_DATADIR
|
||||
CMAKE_INSTALL_INFODIR
|
||||
CMAKE_INSTALL_LOCALEDIR
|
||||
CMAKE_INSTALL_MANDIR
|
||||
CMAKE_INSTALL_DOCDIR
|
||||
)
|
||||
|
||||
# Result directories
|
||||
#
|
||||
foreach(dir
|
||||
BINDIR
|
||||
SBINDIR
|
||||
LIBEXECDIR
|
||||
SYSCONFDIR
|
||||
SHAREDSTATEDIR
|
||||
LOCALSTATEDIR
|
||||
LIBDIR
|
||||
INCLUDEDIR
|
||||
OLDINCLUDEDIR
|
||||
DATAROOTDIR
|
||||
DATADIR
|
||||
INFODIR
|
||||
LOCALEDIR
|
||||
MANDIR
|
||||
DOCDIR
|
||||
)
|
||||
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
endforeach()
|
||||
130
cmake/GetGitRevisionDescription.cmake
Normal file
@@ -0,0 +1,130 @@
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.BOOST-1.0 or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
endwhile()
|
||||
# check if this is a submodule
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${GIT_DIR}/HEAD")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake"
|
||||
@ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
41
cmake/GetGitRevisionDescription.cmake.in
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.BOOST-1.0 or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
else()
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
||||
@@ -13,13 +13,19 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(translations)
|
||||
|
||||
file(GLOB DATABASE_ICONS icons/database/*.png)
|
||||
|
||||
install(FILES ${DATABASE_ICONS} DESTINATION ${DATA_INSTALL_DIR}/icons/database)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
install(DIRECTORY icons/application/ DESTINATION share/icons/hicolor
|
||||
install(DIRECTORY icons/application/ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor
|
||||
FILES_MATCHING PATTERN "keepassx.png" PATTERN "keepassx.svgz")
|
||||
install(DIRECTORY icons/application/ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor
|
||||
FILES_MATCHING PATTERN "application-x-keepassx.png" PATTERN "application-x-keepassx.svgz")
|
||||
install(FILES linux/keepassx.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||
install(FILES linux/keepassx.xml DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
if(APPLE)
|
||||
|
||||
|
After Width: | Height: | Size: 9.0 KiB |
BIN
share/icons/application/16x16/actions/password-copy.png
Normal file
|
After Width: | Height: | Size: 670 B |
BIN
share/icons/application/16x16/actions/password-show-off.png
Normal file
|
After Width: | Height: | Size: 783 B |
BIN
share/icons/application/16x16/actions/password-show-on.png
Normal file
|
After Width: | Height: | Size: 838 B |
BIN
share/icons/application/16x16/actions/username-copy.png
Normal file
|
After Width: | Height: | Size: 766 B |
|
After Width: | Height: | Size: 711 B |
BIN
share/icons/application/22x22/actions/document-encrypt.png
Normal file
|
After Width: | Height: | Size: 604 B |
BIN
share/icons/application/22x22/actions/document-open.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
share/icons/application/22x22/actions/document-save.png
Normal file
|
After Width: | Height: | Size: 798 B |
BIN
share/icons/application/22x22/actions/password-copy.png
Normal file
|
After Width: | Height: | Size: 966 B |
BIN
share/icons/application/22x22/actions/username-copy.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
BIN
share/icons/svg/application-x-keepassx-16.svgz
Normal file
BIN
share/icons/svg/application-x-keepassx.svgz
Normal file
BIN
share/icons/svg/password-copy.svgz
Normal file
BIN
share/icons/svg/username-copy.svgz
Normal file
13
share/linux/keepassx.desktop
Normal file
@@ -0,0 +1,13 @@
|
||||
[Desktop Entry]
|
||||
Name=KeePassX
|
||||
GenericName=Password Manager
|
||||
GenericName[de]=Passwortverwaltung
|
||||
GenericName[es]=Gestor de contraseñas
|
||||
GenericName[fr]=Gestionnaire de mot de passe
|
||||
GenericName[ru]=менеджер паролей
|
||||
Exec=keepassx %f
|
||||
Icon=keepassx
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Qt;Utility;
|
||||
MimeType=application/x-keepass2;
|
||||
8
share/linux/keepassx.xml
Normal file
@@ -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-keepass2">
|
||||
<comment>KeePass 2 database</comment>
|
||||
<glob pattern="*.kdbx"/>
|
||||
<icon name="application-x-keepassx"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
26
share/translations/CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2014 Felix Geyer <debfx@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, either version 2 or (at your option)
|
||||
# version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
file(GLOB TRANSLATION_FILES *.ts)
|
||||
get_filename_component(TRANSLATION_EN_ABS keepassx_en.ts ABSOLUTE)
|
||||
list(REMOVE_ITEM TRANSLATION_FILES keepassx_en.ts)
|
||||
list(REMOVE_ITEM TRANSLATION_FILES ${TRANSLATION_EN_ABS})
|
||||
message(STATUS ${TRANSLATION_FILES})
|
||||
|
||||
qt4_add_translation(QM_FILES ${TRANSLATION_FILES})
|
||||
|
||||
install(FILES ${QM_FILES} DESTINATION ${DATA_INSTALL_DIR}/translations)
|
||||
add_custom_target(translations DEPENDS ${QM_FILES})
|
||||
add_dependencies(${PROGNAME} translations)
|
||||
1284
share/translations/keepassx_cs.ts
Normal file
1279
share/translations/keepassx_da.ts
Normal file
1278
share/translations/keepassx_de.ts
Normal file
1291
share/translations/keepassx_en.ts
Normal file
41
share/translations/keepassx_en_plurals.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.0" language="en_US">
|
||||
<context>
|
||||
<name>DatabaseWidget</name>
|
||||
<message numerus="yes">
|
||||
<source>Do you really want to move %n entry(s) to the recycle bin?</source>
|
||||
<translation>
|
||||
<numerusform>Do you really want to move %n entry to the recycle bin?</numerusform>
|
||||
<numerusform>Do you really want to move %n entries to the recycle bin?</numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditEntryWidget</name>
|
||||
<message numerus="yes">
|
||||
<source>%n week(s)</source>
|
||||
<translation>
|
||||
<numerusform>%n week</numerusform>
|
||||
<numerusform>%n weeks</numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>%n month(s)</source>
|
||||
<translation>
|
||||
<numerusform>%n month</numerusform>
|
||||
<numerusform>%n months</numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditWidgetIcons</name>
|
||||
<message numerus="yes">
|
||||
<source>Can't delete icon. Still used by %n item(s).</source>
|
||||
<translation>
|
||||
<numerusform>Can't delete icon. Still used by %n item.</numerusform>
|
||||
<numerusform>Can't delete icon. Still used by %n items.</numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
1281
share/translations/keepassx_es.ts
Normal file
1281
share/translations/keepassx_fr.ts
Normal file
1274
share/translations/keepassx_id.ts
Normal file
1280
share/translations/keepassx_it.ts
Normal file
1275
share/translations/keepassx_ja.ts
Normal file
1281
share/translations/keepassx_nl_NL.ts
Normal file
1280
share/translations/keepassx_pt_PT.ts
Normal file
1275
share/translations/keepassx_ru.ts
Normal file
1274
share/translations/keepassx_sv.ts
Normal file
1280
share/translations/keepassx_zh_CN.ts
Normal file
1279
share/translations/keepassx_zh_TW.ts
Normal file
12
share/translations/update.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
BASEDIR=$(dirname $0)
|
||||
|
||||
cd $BASEDIR/../..
|
||||
|
||||
echo Updating source file
|
||||
lupdate -no-ui-lines -disable-heuristic similartext -locations none -no-obsolete src -ts share/translations/keepassx_en.ts
|
||||
lupdate -no-ui-lines -disable-heuristic similartext -locations none -pluralonly src -ts share/translations/keepassx_en_plurals.ts
|
||||
|
||||
echo Pulling translations from Transifex
|
||||
tx pull -a --minimum-perc=80
|
||||
@@ -17,14 +17,27 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
configure_file(config-keepassx.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-keepassx.h)
|
||||
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_HEAD)
|
||||
git_describe(GIT_DESCRIBE --long)
|
||||
|
||||
if (NOT GIT_HEAD OR NOT GIT_DESCRIBE)
|
||||
set(GIT_HEAD "")
|
||||
set(GIT_DESCRIBE "")
|
||||
endif()
|
||||
|
||||
configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
|
||||
|
||||
set(keepassx_SOURCES
|
||||
autotype/AutoType.cpp
|
||||
autotype/AutoTypeAction.cpp
|
||||
autotype/AutoTypePlatformPlugin.h
|
||||
autotype/AutoTypeSelectDialog.cpp
|
||||
autotype/AutoTypeSelectView.cpp
|
||||
autotype/ShortcutWidget.cpp
|
||||
autotype/WildcardMatcher.cpp
|
||||
autotype/WindowSelectComboBox.cpp
|
||||
autotype/test/AutoTypeTestInterface.h
|
||||
core/AutoTypeAssociations.cpp
|
||||
core/Config.cpp
|
||||
core/Database.cpp
|
||||
@@ -33,29 +46,33 @@ set(keepassx_SOURCES
|
||||
core/Entry.cpp
|
||||
core/EntryAttachments.cpp
|
||||
core/EntryAttributes.cpp
|
||||
core/EntrySearcher.cpp
|
||||
core/FilePath.cpp
|
||||
core/Global.h
|
||||
core/Group.cpp
|
||||
core/InactivityTimer.cpp
|
||||
core/ListDeleter.h
|
||||
core/Metadata.cpp
|
||||
core/PasswordGenerator.cpp
|
||||
core/qlockfile.cpp
|
||||
core/qsavefile.cpp
|
||||
core/qsavefile_p.h
|
||||
core/SignalMultiplexer.cpp
|
||||
core/TimeDelta.cpp
|
||||
core/TimeInfo.cpp
|
||||
core/ToDbExporter.cpp
|
||||
core/Tools.cpp
|
||||
core/Translator.cpp
|
||||
core/Uuid.cpp
|
||||
core/qcommandlineoption.cpp
|
||||
core/qcommandlineparser.cpp
|
||||
crypto/Crypto.cpp
|
||||
crypto/CryptoHash.cpp
|
||||
crypto/Random.cpp
|
||||
crypto/salsa20/ecrypt-config.h
|
||||
crypto/salsa20/ecrypt-machine.h
|
||||
crypto/salsa20/ecrypt-portable.h
|
||||
crypto/salsa20/ecrypt-sync.h
|
||||
crypto/salsa20/salsa20.c
|
||||
crypto/SymmetricCipher.cpp
|
||||
crypto/SymmetricCipherBackend.h
|
||||
crypto/SymmetricCipherGcrypt.cpp
|
||||
crypto/SymmetricCipherSalsa20.cpp
|
||||
format/CsvExporter.cpp
|
||||
format/KeePass1.h
|
||||
format/KeePass1Reader.cpp
|
||||
format/KeePass2.h
|
||||
@@ -72,6 +89,7 @@ set(keepassx_SOURCES
|
||||
gui/DatabaseSettingsWidget.cpp
|
||||
gui/DatabaseTabWidget.cpp
|
||||
gui/DatabaseWidget.cpp
|
||||
gui/DatabaseWidgetStateSync.cpp
|
||||
gui/DialogyWidget.cpp
|
||||
gui/DragTabBar.cpp
|
||||
gui/EditWidget.cpp
|
||||
@@ -82,13 +100,17 @@ set(keepassx_SOURCES
|
||||
gui/KeePass1OpenWidget.cpp
|
||||
gui/LineEdit.cpp
|
||||
gui/MainWindow.cpp
|
||||
gui/MessageBox.cpp
|
||||
gui/PasswordEdit.cpp
|
||||
gui/PasswordGeneratorWidget.cpp
|
||||
gui/PasswordComboBox.cpp
|
||||
gui/SettingsWidget.cpp
|
||||
gui/SortFilterHideProxyModel.cpp
|
||||
gui/UnlockDatabaseWidget.cpp
|
||||
gui/WelcomeWidget.cpp
|
||||
gui/entry/AutoTypeAssociationsModel.cpp
|
||||
gui/entry/EditEntryWidget.cpp
|
||||
gui/entry/EditEntryWidget_p.h
|
||||
gui/entry/EntryAttachmentsModel.cpp
|
||||
gui/entry/EntryAttributesModel.cpp
|
||||
gui/entry/EntryHistoryModel.cpp
|
||||
@@ -98,6 +120,7 @@ set(keepassx_SOURCES
|
||||
gui/group/GroupModel.cpp
|
||||
gui/group/GroupView.cpp
|
||||
keys/CompositeKey.cpp
|
||||
keys/CompositeKey_p.h
|
||||
keys/FileKey.cpp
|
||||
keys/Key.h
|
||||
keys/PasswordKey.cpp
|
||||
@@ -108,6 +131,30 @@ set(keepassx_SOURCES
|
||||
streams/SymmetricCipherStream.cpp
|
||||
)
|
||||
|
||||
if(NOT GCRYPT_HAS_SALSA20)
|
||||
set(keepassx_SOURCES
|
||||
${keepassx_SOURCES}
|
||||
crypto/salsa20/ecrypt-config.h
|
||||
crypto/salsa20/ecrypt-machine.h
|
||||
crypto/salsa20/ecrypt-portable.h
|
||||
crypto/salsa20/ecrypt-sync.h
|
||||
crypto/salsa20/salsa20.c
|
||||
crypto/SymmetricCipherSalsa20.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
set(keepassx_SOURCES
|
||||
${keepassx_SOURCES}
|
||||
core/qlockfile_unix.cpp
|
||||
)
|
||||
elseif(MINGW)
|
||||
set(keepassx_SOURCES
|
||||
${keepassx_SOURCES}
|
||||
core/qlockfile_win.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
set(keepassx_SOURCES_MAINEXE
|
||||
main.cpp
|
||||
)
|
||||
@@ -125,6 +172,7 @@ set(keepassx_MOC
|
||||
core/EntryAttachments.h
|
||||
core/EntryAttributes.h
|
||||
core/Group.h
|
||||
core/InactivityTimer.h
|
||||
core/Metadata.h
|
||||
core/qsavefile.h
|
||||
gui/AboutDialog.h
|
||||
@@ -135,6 +183,7 @@ set(keepassx_MOC
|
||||
gui/DatabaseSettingsWidget.h
|
||||
gui/DatabaseTabWidget.h
|
||||
gui/DatabaseWidget.h
|
||||
gui/DatabaseWidgetStateSync.h
|
||||
gui/DialogyWidget.h
|
||||
gui/DragTabBar.h
|
||||
gui/EditWidget.h
|
||||
@@ -144,7 +193,9 @@ set(keepassx_MOC
|
||||
gui/KeePass1OpenWidget.h
|
||||
gui/LineEdit.h
|
||||
gui/MainWindow.h
|
||||
gui/PasswordEdit.h
|
||||
gui/PasswordGeneratorWidget.h
|
||||
gui/PasswordComboBox.h
|
||||
gui/SettingsWidget.h
|
||||
gui/SortFilterHideProxyModel.h
|
||||
gui/UnlockDatabaseWidget.h
|
||||
@@ -208,10 +259,6 @@ target_link_libraries(${PROGNAME}
|
||||
${GCRYPT_LIBRARIES}
|
||||
${ZLIB_LIBRARIES})
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(${PROGNAME} ${QT_QTDBUS_LIBRARY})
|
||||
endif()
|
||||
|
||||
set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON)
|
||||
|
||||
if(APPLE)
|
||||
|
||||
@@ -17,18 +17,20 @@
|
||||
|
||||
#include "AutoType.h"
|
||||
|
||||
#include <QtCore/QPluginLoader>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QApplication>
|
||||
#include <QPluginLoader>
|
||||
|
||||
#include "autotype/AutoTypePlatformPlugin.h"
|
||||
#include "autotype/AutoTypeSelectDialog.h"
|
||||
#include "autotype/WildcardMatcher.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
#include "core/FilePath.h"
|
||||
#include "core/Group.h"
|
||||
#include "core/ListDeleter.h"
|
||||
#include "core/Tools.h"
|
||||
#include "gui/MessageBox.h"
|
||||
|
||||
AutoType* AutoType::m_instance = Q_NULLPTR;
|
||||
|
||||
@@ -40,6 +42,7 @@ AutoType::AutoType(QObject* parent, bool test)
|
||||
, m_pluginLoader(new QPluginLoader(this))
|
||||
, m_plugin(Q_NULLPTR)
|
||||
, m_executor(Q_NULLPTR)
|
||||
, m_windowFromGlobal(0)
|
||||
{
|
||||
// prevent crash when the plugin has unresolved symbols
|
||||
m_pluginLoader->setLoadHints(QLibrary::ResolveAllSymbolsHint);
|
||||
@@ -57,11 +60,16 @@ AutoType::AutoType(QObject* parent, bool test)
|
||||
if (!pluginPath.isEmpty()) {
|
||||
loadPlugin(pluginPath);
|
||||
}
|
||||
|
||||
connect(qApp, SIGNAL(aboutToQuit()), SLOT(unloadPlugin()));
|
||||
}
|
||||
|
||||
AutoType::~AutoType()
|
||||
{
|
||||
delete m_executor;
|
||||
if (m_executor) {
|
||||
delete m_executor;
|
||||
m_executor = Q_NULLPTR;
|
||||
}
|
||||
}
|
||||
|
||||
void AutoType::loadPlugin(const QString& pluginPath)
|
||||
@@ -140,6 +148,8 @@ void AutoType::performAutoType(const Entry* entry, QWidget* hideWindow, const QS
|
||||
window = m_plugin->activeWindow();
|
||||
}
|
||||
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 10);
|
||||
|
||||
Q_FOREACH (AutoTypeAction* action, actions) {
|
||||
if (m_plugin->activeWindow() != window) {
|
||||
qWarning("Active window changed, interrupting auto-type.");
|
||||
@@ -182,8 +192,12 @@ void AutoType::performGlobalAutoType(const QList<Database*>& dbList)
|
||||
|
||||
if (entryList.isEmpty()) {
|
||||
m_inAutoType = false;
|
||||
QString message = tr("Couldn't find an entry that matches the window title:");
|
||||
message.append("\n\n");
|
||||
message.append(windowTitle);
|
||||
MessageBox::information(Q_NULLPTR, tr("Auto-Type - KeePassX"), message);
|
||||
}
|
||||
else if (entryList.size() == 1) {
|
||||
else if ((entryList.size() == 1) && !config()->get("security/autotypeask").toBool()) {
|
||||
m_inAutoType = false;
|
||||
performAutoType(entryList.first(), Q_NULLPTR, sequenceHash[entryList.first()]);
|
||||
}
|
||||
@@ -215,6 +229,19 @@ void AutoType::resetInAutoType()
|
||||
m_inAutoType = false;
|
||||
}
|
||||
|
||||
void AutoType::unloadPlugin()
|
||||
{
|
||||
if (m_executor) {
|
||||
delete m_executor;
|
||||
m_executor = Q_NULLPTR;
|
||||
}
|
||||
|
||||
if (m_plugin) {
|
||||
m_plugin->unload();
|
||||
m_plugin = Q_NULLPTR;
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoType::registerGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
Q_ASSERT(key);
|
||||
@@ -450,7 +477,15 @@ QList<AutoTypeAction*> AutoType::createActionFromTemplate(const QString& tmpl, c
|
||||
QString resolved = entry->resolvePlaceholders(placeholder);
|
||||
if (placeholder != resolved) {
|
||||
Q_FOREACH (const QChar& ch, resolved) {
|
||||
list.append(new AutoTypeChar(ch));
|
||||
if (ch == '\n') {
|
||||
list.append(new AutoTypeKey(Qt::Key_Enter));
|
||||
}
|
||||
else if (ch == '\t') {
|
||||
list.append(new AutoTypeKey(Qt::Key_Tab));
|
||||
}
|
||||
else {
|
||||
list.append(new AutoTypeChar(ch));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,6 +515,12 @@ QString AutoType::autoTypeSequence(const Entry* entry, const QString& windowTitl
|
||||
}
|
||||
}
|
||||
|
||||
if (!match && config()->get("AutoTypeEntryTitleMatch").toBool() && !entry->title().isEmpty()
|
||||
&& windowTitle.contains(entry->title(), Qt::CaseInsensitive)) {
|
||||
sequence = entry->defaultAutoTypeSequence();
|
||||
match = true;
|
||||
}
|
||||
|
||||
if (!match) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#ifndef KEEPASSX_AUTOTYPE_H
|
||||
#define KEEPASSX_AUTOTYPE_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
@@ -59,6 +59,7 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
void performAutoTypeFromGlobal(Entry* entry, const QString& sequence);
|
||||
void resetInAutoType();
|
||||
void unloadPlugin();
|
||||
|
||||
private:
|
||||
explicit AutoType(QObject* parent = Q_NULLPTR, bool test = false);
|
||||
|
||||
@@ -89,5 +89,7 @@ void AutoTypeExecutor::execDelay(AutoTypeDelay* action)
|
||||
|
||||
void AutoTypeExecutor::execClearField(AutoTypeClearField* action)
|
||||
{
|
||||
Q_UNUSED(action);
|
||||
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#ifndef KEEPASSX_AUTOTYPEACTION_H
|
||||
#define KEEPASSX_AUTOTYPEACTION_H
|
||||
|
||||
#include <QtCore/QChar>
|
||||
#include <QtCore/Qt>
|
||||
#include <QChar>
|
||||
#include <Qt>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef KEEPASSX_AUTOTYPEPLATFORMPLUGIN_H
|
||||
#define KEEPASSX_AUTOTYPEPLATFORMPLUGIN_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QWidget>
|
||||
|
||||
#include "autotype/AutoTypeAction.h"
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
virtual void unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) = 0;
|
||||
virtual int platformEventFilter(void* event) = 0;
|
||||
virtual int initialTimeout() = 0;
|
||||
virtual void unload() {}
|
||||
|
||||
virtual AutoTypeExecutor* createExecutor() = 0;
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
#include "AutoTypeSelectDialog.h"
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QDesktopWidget>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "autotype/AutoTypeSelectView.h"
|
||||
#include "core/FilePath.h"
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#ifndef KEEPASSX_AUTOTYPESELECTDIALOG_H
|
||||
#define KEEPASSX_AUTOTYPESELECTDIALOG_H
|
||||
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDialog>
|
||||
#include <QHash>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "AutoTypeSelectView.h"
|
||||
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QMouseEvent>
|
||||
|
||||
AutoTypeSelectView::AutoTypeSelectView(QWidget* parent)
|
||||
: EntryView(parent)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
if(Q_WS_X11)
|
||||
find_package(X11)
|
||||
if(PRINT_SUMMARY)
|
||||
add_feature_info(libXtest X11_XTest_FOUND "The X11 XTEST Protocol library is required for auto-type")
|
||||
endif()
|
||||
|
||||
if(X11_FOUND AND X11_XTest_FOUND)
|
||||
add_subdirectory(x11)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "ShortcutWidget.h"
|
||||
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "autotype/AutoType.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef KEEPASSX_SHORTCUTWIDGET_H
|
||||
#define KEEPASSX_SHORTCUTWIDGET_H
|
||||
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "WildcardMatcher.h"
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QStringList>
|
||||
|
||||
const QChar WildcardMatcher::Wildcard = '*';
|
||||
const Qt::CaseSensitivity WildcardMatcher::Sensitivity = Qt::CaseInsensitive;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef KEEPASSX_WILDCARDMATCHER_H
|
||||
#define KEEPASSX_WILDCARDMATCHER_H
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QStringList>
|
||||
|
||||
class WildcardMatcher
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "WindowSelectComboBox.h"
|
||||
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "autotype/AutoType.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef KEEPASSX_WINDOWSELECTCOMBOBOX_H
|
||||
#define KEEPASSX_WINDOWSELECTCOMBOBOX_H
|
||||
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QComboBox>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef KEEPASSX_AUTOTYPETEST_H
|
||||
#define KEEPASSX_AUTOTYPETEST_H
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtPlugin>
|
||||
|
||||
#include "autotype/AutoTypePlatformPlugin.h"
|
||||
#include "autotype/AutoTypeAction.h"
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*/
|
||||
|
||||
#include "AutoTypeX11.h"
|
||||
#include "KeySymMap.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
bool AutoTypePlatformX11::m_catchXErrors = false;
|
||||
bool AutoTypePlatformX11::m_xErrorOccured = false;
|
||||
@@ -36,20 +39,41 @@ AutoTypePlatformX11::AutoTypePlatformX11()
|
||||
m_classBlacklist << "desktop_window" << "gnome-panel"; // Gnome
|
||||
m_classBlacklist << "kdesktop" << "kicker"; // KDE 3
|
||||
m_classBlacklist << "Plasma"; // KDE 4
|
||||
m_classBlacklist << "plasmashell"; // KDE 5
|
||||
m_classBlacklist << "xfdesktop" << "xfce4-panel"; // Xfce 4
|
||||
|
||||
m_currentGlobalKey = static_cast<Qt::Key>(0);
|
||||
m_currentGlobalModifiers = 0;
|
||||
|
||||
m_keysymTable = Q_NULLPTR;
|
||||
m_altMask = 0;
|
||||
m_metaMask = 0;
|
||||
m_altgrMask = 0;
|
||||
m_altgrKeysym = NoSymbol;
|
||||
m_xkb = Q_NULLPTR;
|
||||
m_remapKeycode = 0;
|
||||
m_currentRemapKeysym = NoSymbol;
|
||||
m_modifierMask = ControlMask | ShiftMask | Mod1Mask | Mod4Mask;
|
||||
|
||||
m_loaded = true;
|
||||
|
||||
updateKeymap();
|
||||
}
|
||||
|
||||
void AutoTypePlatformX11::unload()
|
||||
{
|
||||
// Restore the KeyboardMapping to its original state.
|
||||
if (m_currentRemapKeysym != NoSymbol) {
|
||||
AddKeysym(NoSymbol);
|
||||
}
|
||||
|
||||
if (m_keysymTable) {
|
||||
XFree(m_keysymTable);
|
||||
}
|
||||
|
||||
if (m_xkb) {
|
||||
XkbFreeKeyboard(m_xkb, XkbAllComponentsMask, True);
|
||||
}
|
||||
|
||||
m_loaded = false;
|
||||
}
|
||||
|
||||
QStringList AutoTypePlatformX11::windowTitles()
|
||||
{
|
||||
return windowTitlesRecursive(m_rootWindow);
|
||||
@@ -125,10 +149,10 @@ uint AutoTypePlatformX11::qtToNativeModifiers(Qt::KeyboardModifiers modifiers)
|
||||
nativeModifiers |= ControlMask;
|
||||
}
|
||||
if (modifiers & Qt::AltModifier) {
|
||||
nativeModifiers |= m_altMask;
|
||||
nativeModifiers |= Mod1Mask;
|
||||
}
|
||||
if (modifiers & Qt::MetaModifier) {
|
||||
nativeModifiers |= m_metaMask;
|
||||
nativeModifiers |= Mod4Mask;
|
||||
}
|
||||
|
||||
return nativeModifiers;
|
||||
@@ -136,7 +160,7 @@ uint AutoTypePlatformX11::qtToNativeModifiers(Qt::KeyboardModifiers modifiers)
|
||||
|
||||
void AutoTypePlatformX11::unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers)
|
||||
{
|
||||
KeyCode keycode = XKeysymToKeycode(m_dpy, keyToKeySym(key));
|
||||
KeyCode keycode = XKeysymToKeycode(m_dpy, charToKeySym(key));
|
||||
uint nativeModifiers = qtToNativeModifiers(modifiers);
|
||||
|
||||
XUngrabKey(m_dpy, keycode, nativeModifiers, m_rootWindow);
|
||||
@@ -158,13 +182,15 @@ int AutoTypePlatformX11::platformEventFilter(void* event)
|
||||
&& m_currentGlobalKey
|
||||
&& xevent->xkey.keycode == m_currentGlobalKeycode
|
||||
&& (xevent->xkey.state & m_modifierMask) == m_currentGlobalNativeModifiers
|
||||
&& !QApplication::focusWidget()) {
|
||||
&& !QApplication::focusWidget()
|
||||
&& m_loaded) {
|
||||
if (xevent->type == KeyPress) {
|
||||
Q_EMIT globalShortcutTriggered();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (xevent->type == MappingNotify) {
|
||||
if (xevent->type == MappingNotify && m_loaded) {
|
||||
XRefreshKeyboardMapping(reinterpret_cast<XMappingEvent*>(xevent));
|
||||
updateKeymap();
|
||||
}
|
||||
|
||||
@@ -186,23 +212,26 @@ QString AutoTypePlatformX11::windowTitle(Window window, bool useBlacklist)
|
||||
unsigned long after;
|
||||
unsigned char* data = Q_NULLPTR;
|
||||
|
||||
// the window manager spec says we should read _NET_WM_NAME first, then fall back to WM_NAME
|
||||
|
||||
int retVal = XGetWindowProperty(m_dpy, window, m_atomNetWmName, 0, 1000, false, m_atomUtf8String,
|
||||
&type, &format, &nitems, &after, &data);
|
||||
|
||||
if (retVal != 0 && data) {
|
||||
if ((retVal == 0) && data) {
|
||||
title = QString::fromUtf8(reinterpret_cast<char*>(data));
|
||||
}
|
||||
else {
|
||||
XTextProperty textProp;
|
||||
retVal = XGetTextProperty(m_dpy, window, &textProp, m_atomWmName);
|
||||
if (retVal != 0 && textProp.value) {
|
||||
if ((retVal != 0) && textProp.value) {
|
||||
char** textList = Q_NULLPTR;
|
||||
int count;
|
||||
|
||||
if (textProp.encoding == m_atomUtf8String) {
|
||||
title = QString::fromUtf8(reinterpret_cast<char*>(textProp.value));
|
||||
}
|
||||
else if (XmbTextPropertyToTextList(m_dpy, &textProp, &textList, &count) == 0 && textList && count > 0) {
|
||||
else if ((XmbTextPropertyToTextList(m_dpy, &textProp, &textList, &count) == 0)
|
||||
&& textList && (count > 0)) {
|
||||
title = QString::fromLocal8Bit(textList[0]);
|
||||
}
|
||||
else if (textProp.encoding == m_atomString) {
|
||||
@@ -326,12 +355,21 @@ KeySym AutoTypePlatformX11::charToKeySym(const QChar& ch)
|
||||
|| (unicode >= 0x00a0 && unicode <= 0x00ff)) {
|
||||
return unicode;
|
||||
}
|
||||
else if (unicode >= 0x0100) {
|
||||
|
||||
/* mapping table generated from keysymdef.h */
|
||||
const uint* match = qBinaryFind(m_unicodeToKeysymKeys,
|
||||
m_unicodeToKeysymKeys + m_unicodeToKeysymLen,
|
||||
unicode);
|
||||
int index = match - m_unicodeToKeysymKeys;
|
||||
if (index != m_unicodeToKeysymLen) {
|
||||
return m_unicodeToKeysymValues[index];
|
||||
}
|
||||
|
||||
if (unicode >= 0x0100) {
|
||||
return unicode | 0x01000000;
|
||||
}
|
||||
else {
|
||||
return NoSymbol;
|
||||
}
|
||||
|
||||
return NoSymbol;
|
||||
}
|
||||
|
||||
KeySym AutoTypePlatformX11::keyToKeySym(Qt::Key key)
|
||||
@@ -387,24 +425,85 @@ KeySym AutoTypePlatformX11::keyToKeySym(Qt::Key key)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the keyboard and modifier mapping.
|
||||
* We need the KeyboardMapping for AddKeysym.
|
||||
* Modifier mapping is required for clearing the modifiers.
|
||||
*/
|
||||
void AutoTypePlatformX11::updateKeymap()
|
||||
{
|
||||
ReadKeymap();
|
||||
int keycode, inx;
|
||||
int mod_index, mod_key;
|
||||
XModifierKeymap *modifiers;
|
||||
|
||||
if (!m_altgrMask) {
|
||||
AddModifier(XK_Mode_switch);
|
||||
}
|
||||
if (!m_metaMask) {
|
||||
m_metaMask = Mod4Mask;
|
||||
if (m_xkb != NULL) XkbFreeKeyboard(m_xkb, XkbAllComponentsMask, True);
|
||||
|
||||
XDeviceInfo* devices;
|
||||
int num_devices;
|
||||
XID keyboard_id = XkbUseCoreKbd;
|
||||
devices = XListInputDevices(m_dpy, &num_devices);
|
||||
|
||||
for (int i = 0; i < num_devices; i++) {
|
||||
if (QString(devices[i].name) == "Virtual core XTEST keyboard") {
|
||||
keyboard_id = devices[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_modifierMask = ControlMask | ShiftMask | m_altMask | m_metaMask;
|
||||
m_xkb = XkbGetKeyboard(m_dpy, XkbCompatMapMask | XkbGeometryMask, keyboard_id);
|
||||
|
||||
// TODO: figure out why this breaks after the first global auto-type
|
||||
/*if (m_currentGlobalKey && m_currentGlobalModifiers) {
|
||||
unregisterGlobalShortcut(m_currentGlobalKey, m_currentGlobalModifiers);
|
||||
registerGlobalShortcut(m_currentGlobalKey, m_currentGlobalModifiers);
|
||||
}*/
|
||||
XDisplayKeycodes(m_dpy, &m_minKeycode, &m_maxKeycode);
|
||||
if (m_keysymTable != NULL) XFree(m_keysymTable);
|
||||
m_keysymTable = XGetKeyboardMapping(m_dpy,
|
||||
m_minKeycode, m_maxKeycode - m_minKeycode + 1,
|
||||
&m_keysymPerKeycode);
|
||||
|
||||
/* determine the keycode to use for remapped keys */
|
||||
inx = (m_remapKeycode - m_minKeycode) * m_keysymPerKeycode;
|
||||
if (m_remapKeycode == 0 || !isRemapKeycodeValid()) {
|
||||
for (keycode = m_minKeycode; keycode <= m_maxKeycode; keycode++) {
|
||||
inx = (keycode - m_minKeycode) * m_keysymPerKeycode;
|
||||
if (m_keysymTable[inx] == NoSymbol) {
|
||||
m_remapKeycode = keycode;
|
||||
m_currentRemapKeysym = NoSymbol;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* determine the keycode to use for modifiers */
|
||||
modifiers = XGetModifierMapping(m_dpy);
|
||||
for (mod_index = ShiftMapIndex; mod_index <= Mod5MapIndex; mod_index ++) {
|
||||
m_modifier_keycode[mod_index] = 0;
|
||||
for (mod_key = 0; mod_key < modifiers->max_keypermod; mod_key++) {
|
||||
keycode = modifiers->modifiermap[mod_index * modifiers->max_keypermod + mod_key];
|
||||
if (keycode) {
|
||||
m_modifier_keycode[mod_index] = keycode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
XFreeModifiermap(modifiers);
|
||||
|
||||
/* Xlib needs some time until the mapping is distributed to
|
||||
all clients */
|
||||
// TODO: we should probably only sleep while in the middle of typing something
|
||||
timespec ts;
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 30 * 1000 * 1000;
|
||||
nanosleep(&ts, Q_NULLPTR);
|
||||
}
|
||||
|
||||
bool AutoTypePlatformX11::isRemapKeycodeValid()
|
||||
{
|
||||
int baseKeycode = (m_remapKeycode - m_minKeycode) * m_keysymPerKeycode;
|
||||
for (int i = 0; i < m_keysymPerKeycode; i++) {
|
||||
if (m_keysymTable[baseKeycode + i] == m_currentRemapKeysym) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AutoTypePlatformX11::startCatchXErrors()
|
||||
@@ -442,141 +541,24 @@ int AutoTypePlatformX11::x11ErrorHandler(Display* display, XErrorEvent* error)
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Insert a specified keysym to unused position in the keymap table.
|
||||
* This will be called to add required keysyms on-the-fly.
|
||||
* if the second parameter is TRUE, the keysym will be added to the
|
||||
* non-shifted position - this may be required for modifier keys
|
||||
* (e.g. Mode_switch) and some special keys (e.g. F20).
|
||||
* Insert a specified keysym on the dedicated position in the keymap
|
||||
* table.
|
||||
*/
|
||||
int AutoTypePlatformX11::AddKeysym(KeySym keysym, bool top)
|
||||
int AutoTypePlatformX11::AddKeysym(KeySym keysym)
|
||||
{
|
||||
int keycode, pos, max_pos, inx, phase;
|
||||
|
||||
if (top) {
|
||||
max_pos = 0;
|
||||
} else {
|
||||
max_pos = m_keysymPerKeycode - 1;
|
||||
if (4 <= max_pos) max_pos = 3;
|
||||
if (2 <= max_pos && m_altgrKeysym != XK_Mode_switch) max_pos = 1;
|
||||
if (m_remapKeycode == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (phase = 0; phase < 2; phase++) {
|
||||
for (keycode = m_maxKeycode; m_minKeycode <= keycode; keycode--) {
|
||||
for (pos = max_pos; 0 <= pos; pos--) {
|
||||
inx = (keycode - m_minKeycode) * m_keysymPerKeycode;
|
||||
if ((phase != 0 || m_keysymTable[inx] == NoSymbol) && m_keysymTable[inx] < 0xFF00) {
|
||||
/* In the first phase, to avoid modifing existing keys, */
|
||||
/* add the keysym only to the keys which has no keysym in the first position. */
|
||||
/* If no place fuond in the first phase, add the keysym for any keys except */
|
||||
/* for modifier keys and other special keys */
|
||||
if (m_keysymTable[inx + pos] == NoSymbol) {
|
||||
m_keysymTable[inx + pos] = keysym;
|
||||
XChangeKeyboardMapping(m_dpy, keycode, m_keysymPerKeycode, &m_keysymTable[inx], 1);
|
||||
XFlush(m_dpy);
|
||||
return keycode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
qWarning("Couldn't add \"%s\" to keymap", XKeysymToString(keysym));
|
||||
return NoSymbol;
|
||||
}
|
||||
int inx = (m_remapKeycode- m_minKeycode) * m_keysymPerKeycode;
|
||||
m_keysymTable[inx] = keysym;
|
||||
m_currentRemapKeysym = keysym;
|
||||
|
||||
/*
|
||||
* Add the specified key as a new modifier.
|
||||
* This is used to use Mode_switch (AltGr) as a modifier.
|
||||
*/
|
||||
void AutoTypePlatformX11::AddModifier(KeySym keysym)
|
||||
{
|
||||
XModifierKeymap *modifiers;
|
||||
int keycode, i, pos;
|
||||
XChangeKeyboardMapping(m_dpy, m_remapKeycode, m_keysymPerKeycode, &m_keysymTable[inx], 1);
|
||||
XFlush(m_dpy);
|
||||
updateKeymap();
|
||||
|
||||
keycode = XKeysymToKeycode(m_dpy, keysym);
|
||||
if (keycode == NoSymbol) keycode = AddKeysym(keysym, TRUE);
|
||||
|
||||
modifiers = XGetModifierMapping(m_dpy);
|
||||
for (i = 7; 3 < i; i--) {
|
||||
if (modifiers->modifiermap[i * modifiers->max_keypermod] == NoSymbol
|
||||
|| ((m_keysymTable[(modifiers->modifiermap[i * modifiers->max_keypermod]
|
||||
- m_minKeycode) * m_keysymPerKeycode]) == XK_ISO_Level3_Shift
|
||||
&& keysym == XK_Mode_switch))
|
||||
{
|
||||
for (pos = 0; pos < modifiers->max_keypermod; pos++) {
|
||||
if (modifiers->modifiermap[i * modifiers->max_keypermod + pos] == NoSymbol) {
|
||||
modifiers->modifiermap[i * modifiers->max_keypermod + pos] = keycode;
|
||||
XSetModifierMapping(m_dpy, modifiers);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
qWarning("Couldn't add \"%s\" as modifier", XKeysymToString(keysym));
|
||||
}
|
||||
|
||||
/*
|
||||
* Read keyboard mapping and modifier mapping.
|
||||
* Keyboard mapping is used to know what keys are in shifted position.
|
||||
* Modifier mapping is required because we should know Alt and Meta
|
||||
* key are used as which modifier.
|
||||
*/
|
||||
void AutoTypePlatformX11::ReadKeymap()
|
||||
{
|
||||
int i;
|
||||
int keycode, inx, pos;
|
||||
KeySym keysym;
|
||||
XModifierKeymap *modifiers;
|
||||
|
||||
XDisplayKeycodes(m_dpy, &m_minKeycode, &m_maxKeycode);
|
||||
if (m_keysymTable != NULL) XFree(m_keysymTable);
|
||||
m_keysymTable = XGetKeyboardMapping(m_dpy,
|
||||
m_minKeycode, m_maxKeycode - m_minKeycode + 1,
|
||||
&m_keysymPerKeycode);
|
||||
for (keycode = m_minKeycode; keycode <= m_maxKeycode; keycode++) {
|
||||
/* if the first keysym is alphabet and the second keysym is NoSymbol,
|
||||
it is equivalent to pair of lowercase and uppercase alphabet */
|
||||
inx = (keycode - m_minKeycode) * m_keysymPerKeycode;
|
||||
if (m_keysymTable[inx + 1] == NoSymbol
|
||||
&& ((XK_A <= m_keysymTable[inx] && m_keysymTable[inx] <= XK_Z)
|
||||
|| (XK_a <= m_keysymTable[inx] && m_keysymTable[inx] <= XK_z)))
|
||||
{
|
||||
if (XK_A <= m_keysymTable[inx] && m_keysymTable[inx] <= XK_Z)
|
||||
m_keysymTable[inx] = m_keysymTable[inx] - XK_A + XK_a;
|
||||
m_keysymTable[inx + 1] = m_keysymTable[inx] - XK_a + XK_A;
|
||||
}
|
||||
}
|
||||
|
||||
m_altMask = 0;
|
||||
m_metaMask = 0;
|
||||
m_altgrMask = 0;
|
||||
m_altgrKeysym = NoSymbol;
|
||||
modifiers = XGetModifierMapping(m_dpy);
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (pos = 0; pos < modifiers->max_keypermod; pos++) {
|
||||
keycode = modifiers->modifiermap[i * modifiers->max_keypermod + pos];
|
||||
if (keycode < m_minKeycode || m_maxKeycode < keycode) continue;
|
||||
|
||||
keysym = m_keysymTable[(keycode - m_minKeycode) * m_keysymPerKeycode];
|
||||
if (keysym == XK_Alt_L || keysym == XK_Alt_R) {
|
||||
m_altMask = 1 << i;
|
||||
} else if (keysym == XK_Meta_L || keysym == XK_Meta_R) {
|
||||
m_metaMask = 1 << i;
|
||||
} else if (keysym == XK_Mode_switch) {
|
||||
if (m_altgrKeysym == XK_ISO_Level3_Shift) {
|
||||
} else {
|
||||
m_altgrMask = 0x0101 << i;
|
||||
/* I don't know why, but 0x2000 was required for mod3 on my Linux box */
|
||||
m_altgrKeysym = keysym;
|
||||
}
|
||||
} else if (keysym == XK_ISO_Level3_Shift) {
|
||||
/* if no Mode_switch, try to use ISO_Level3_Shift instead */
|
||||
/* however, it may not work as intended - I don't know why */
|
||||
m_altgrMask = 1 << i;
|
||||
m_altgrKeysym = keysym;
|
||||
}
|
||||
}
|
||||
}
|
||||
XFreeModifiermap(modifiers);
|
||||
return m_remapKeycode;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -584,80 +566,101 @@ void AutoTypePlatformX11::ReadKeymap()
|
||||
* If input focus is specified explicitly, select the window
|
||||
* before send event to the window.
|
||||
*/
|
||||
void AutoTypePlatformX11::SendEvent(XKeyEvent* event)
|
||||
void AutoTypePlatformX11::SendEvent(XKeyEvent* event, int event_type)
|
||||
{
|
||||
XSync(event->display, FALSE);
|
||||
int (*oldHandler) (Display*, XErrorEvent*) = XSetErrorHandler(MyErrorHandler);
|
||||
|
||||
event->type = event_type;
|
||||
XTestFakeKeyEvent(event->display, event->keycode, event->type == KeyPress, 0);
|
||||
XFlush(event->display);
|
||||
|
||||
XSetErrorHandler(oldHandler);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a modifier press/release event for all modifiers
|
||||
* which are set in the mask variable.
|
||||
*/
|
||||
void AutoTypePlatformX11::SendModifier(XKeyEvent *event, unsigned int mask, int event_type)
|
||||
{
|
||||
int mod_index;
|
||||
for (mod_index = ShiftMapIndex; mod_index <= Mod5MapIndex; mod_index ++) {
|
||||
if (mask & (1 << mod_index)) {
|
||||
event->keycode = m_modifier_keycode[mod_index];
|
||||
SendEvent(event, event_type);
|
||||
if (event_type == KeyPress)
|
||||
event->state |= (1 << mod_index);
|
||||
else
|
||||
event->state &= (1 << mod_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Determines the keycode and modifier mask for the given
|
||||
* keysym.
|
||||
*/
|
||||
int AutoTypePlatformX11::GetKeycode(KeySym keysym, unsigned int *mask)
|
||||
{
|
||||
int keycode = XKeysymToKeycode(m_dpy, keysym);
|
||||
|
||||
if (keycode && keysymModifiers(keysym, keycode, mask)) {
|
||||
return keycode;
|
||||
}
|
||||
|
||||
/* no modifier matches => resort to remapping */
|
||||
keycode = AddKeysym(keysym);
|
||||
if (keycode && keysymModifiers(keysym, keycode, mask)) {
|
||||
return keycode;
|
||||
}
|
||||
|
||||
*mask = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AutoTypePlatformX11::keysymModifiers(KeySym keysym, int keycode, unsigned int *mask)
|
||||
{
|
||||
int shift, mod;
|
||||
unsigned int mods_rtrn;
|
||||
|
||||
/* determine whether there is a combination of the modifiers
|
||||
(Mod1-Mod5) with or without shift which returns keysym */
|
||||
for (shift = 0; shift < 2; shift ++) {
|
||||
for (mod = ControlMapIndex; mod <= Mod5MapIndex; mod ++) {
|
||||
KeySym keysym_rtrn;
|
||||
*mask = (mod == ControlMapIndex) ? shift : shift | (1 << mod);
|
||||
XkbTranslateKeyCode(m_xkb, keycode, *mask, &mods_rtrn, &keysym_rtrn);
|
||||
if (keysym_rtrn == keysym) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Send sequence of KeyPressed/KeyReleased events to the focused
|
||||
* window to simulate keyboard. If modifiers (shift, control, etc)
|
||||
* are set ON, many events will be sent.
|
||||
*/
|
||||
void AutoTypePlatformX11::SendKeyPressedEvent(KeySym keysym, unsigned int shift)
|
||||
void AutoTypePlatformX11::SendKeyPressedEvent(KeySym keysym)
|
||||
{
|
||||
Window cur_focus;
|
||||
int revert_to;
|
||||
XKeyEvent event;
|
||||
int keycode;
|
||||
int phase, inx;
|
||||
bool found;
|
||||
|
||||
if (keysym == NoSymbol) {
|
||||
qWarning("No such key: keysym=0x%lX", keysym);
|
||||
return;
|
||||
}
|
||||
|
||||
XGetInputFocus(m_dpy, &cur_focus, &revert_to);
|
||||
|
||||
found = FALSE;
|
||||
keycode = 0;
|
||||
if (keysym != NoSymbol) {
|
||||
for (phase = 0; phase < 2; phase++) {
|
||||
for (keycode = m_minKeycode; !found && (keycode <= m_maxKeycode); keycode++) {
|
||||
/* Determine keycode for the keysym: we use this instead
|
||||
of XKeysymToKeycode() because we must know shift_state, too */
|
||||
inx = (keycode - m_minKeycode) * m_keysymPerKeycode;
|
||||
if (m_keysymTable[inx] == keysym) {
|
||||
shift &= ~m_altgrMask;
|
||||
if (m_keysymTable[inx + 1] != NoSymbol) shift &= ~ShiftMask;
|
||||
found = TRUE;
|
||||
break;
|
||||
} else if (m_keysymTable[inx + 1] == keysym) {
|
||||
shift &= ~m_altgrMask;
|
||||
shift |= ShiftMask;
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && m_altgrMask && 3 <= m_keysymPerKeycode) {
|
||||
for (keycode = m_minKeycode; !found && (keycode <= m_maxKeycode); keycode++) {
|
||||
inx = (keycode - m_minKeycode) * m_keysymPerKeycode;
|
||||
if (m_keysymTable[inx + 2] == keysym) {
|
||||
shift &= ~ShiftMask;
|
||||
shift |= m_altgrMask;
|
||||
found = TRUE;
|
||||
break;
|
||||
} else if (4 <= m_keysymPerKeycode && m_keysymTable[inx + 3] == keysym) {
|
||||
shift |= ShiftMask | m_altgrMask;
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) break;
|
||||
|
||||
if (0xF000 <= keysym) {
|
||||
/* for special keys such as function keys,
|
||||
first try to add it in the non-shifted position of the keymap */
|
||||
if (AddKeysym(keysym, TRUE) == NoSymbol) AddKeysym(keysym, FALSE);
|
||||
} else {
|
||||
AddKeysym(keysym, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.display = m_dpy;
|
||||
event.window = cur_focus;
|
||||
event.root = m_rootWindow;
|
||||
@@ -671,107 +674,67 @@ void AutoTypePlatformX11::SendKeyPressedEvent(KeySym keysym, unsigned int shift)
|
||||
|
||||
Window root, child;
|
||||
int root_x, root_y, x, y;
|
||||
unsigned int mask;
|
||||
unsigned int wanted_mask = 0;
|
||||
unsigned int original_mask;
|
||||
|
||||
XQueryPointer(m_dpy, event.root, &root, &child, &root_x, &root_y, &x, &y, &mask);
|
||||
XQueryPointer(m_dpy, event.root, &root, &child, &root_x, &root_y, &x, &y, &original_mask);
|
||||
|
||||
event.type = KeyRelease;
|
||||
event.state = 0;
|
||||
if (mask & ControlMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Control_L);
|
||||
SendEvent(&event);
|
||||
}
|
||||
if (mask & m_altMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Alt_L);
|
||||
SendEvent(&event);
|
||||
}
|
||||
if (mask & m_metaMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Meta_L);
|
||||
SendEvent(&event);
|
||||
}
|
||||
if (mask & m_altgrMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, m_altgrKeysym);
|
||||
SendEvent(&event);
|
||||
}
|
||||
if (mask & ShiftMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Shift_L);
|
||||
SendEvent(&event);
|
||||
}
|
||||
if (mask & LockMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Caps_Lock);
|
||||
SendEvent(&event);
|
||||
/* determine keycode and mask for the given keysym */
|
||||
keycode = GetKeycode(keysym, &wanted_mask);
|
||||
if (keycode < 8 || keycode > 255) {
|
||||
qWarning("Unable to get valid keycode for key: keysym=0x%lX", keysym);
|
||||
return;
|
||||
}
|
||||
|
||||
event.type = KeyPress;
|
||||
event.state = 0;
|
||||
if (shift & ControlMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Control_L);
|
||||
SendEvent(&event);
|
||||
event.state |= ControlMask;
|
||||
}
|
||||
if (shift & m_altMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Alt_L);
|
||||
SendEvent(&event);
|
||||
event.state |= m_altMask;
|
||||
}
|
||||
if (shift & m_metaMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Meta_L);
|
||||
SendEvent(&event);
|
||||
event.state |= m_metaMask;
|
||||
}
|
||||
if (shift & m_altgrMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, m_altgrKeysym);
|
||||
SendEvent(&event);
|
||||
event.state |= m_altgrMask;
|
||||
}
|
||||
if (shift & ShiftMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Shift_L);
|
||||
SendEvent(&event);
|
||||
event.state |= ShiftMask;
|
||||
}
|
||||
event.state = original_mask;
|
||||
|
||||
if (keysym != NoSymbol) { /* send event for the key itself */
|
||||
event.keycode = found ? keycode : XKeysymToKeycode(m_dpy, keysym);
|
||||
if (event.keycode == NoSymbol) {
|
||||
if ((keysym & ~0x7f) == 0 && QChar(static_cast<char>(keysym)).isPrint())
|
||||
qWarning("No such key: %c", static_cast<char>(keysym));
|
||||
else if (XKeysymToString(keysym) != NULL)
|
||||
qWarning("No such key: keysym=%s (0x%lX)", XKeysymToString(keysym), static_cast<long>(keysym));
|
||||
else
|
||||
qWarning("No such key: keysym=0x%lX", static_cast<long>(keysym));
|
||||
} else {
|
||||
SendEvent(&event);
|
||||
event.type = KeyRelease;
|
||||
SendEvent(&event);
|
||||
// modifiers that need to be pressed but aren't
|
||||
unsigned int press_mask = wanted_mask & ~original_mask;
|
||||
|
||||
// modifiers that are pressed but maybe shouldn't
|
||||
unsigned int release_check_mask = original_mask & ~wanted_mask;
|
||||
|
||||
// modifiers we need to release before sending the keycode
|
||||
unsigned int release_mask = 0;
|
||||
|
||||
// check every release_check_mask individually if it affects the keysym we would generate
|
||||
// if it doesn't we probably don't need to release it
|
||||
for (int mod_index = ShiftMapIndex; mod_index <= Mod5MapIndex; mod_index ++) {
|
||||
if (release_check_mask & (1 << mod_index)) {
|
||||
unsigned int mods_rtrn;
|
||||
KeySym keysym_rtrn;
|
||||
XkbTranslateKeyCode(m_xkb, keycode, wanted_mask | (1 << mod_index), &mods_rtrn, &keysym_rtrn);
|
||||
|
||||
if (keysym_rtrn != keysym) {
|
||||
release_mask |= (1 << mod_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.type = KeyRelease;
|
||||
if (shift & ShiftMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Shift_L);
|
||||
SendEvent(&event);
|
||||
event.state &= ~ShiftMask;
|
||||
}
|
||||
if (shift & m_altgrMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, m_altgrKeysym);
|
||||
SendEvent(&event);
|
||||
event.state &= ~m_altgrMask;
|
||||
}
|
||||
if (shift & m_metaMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Meta_L);
|
||||
SendEvent(&event);
|
||||
event.state &= ~m_metaMask;
|
||||
}
|
||||
if (shift & m_altMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Alt_L);
|
||||
SendEvent(&event);
|
||||
event.state &= ~m_altMask;
|
||||
}
|
||||
if (shift & ControlMask) {
|
||||
event.keycode = XKeysymToKeycode(m_dpy, XK_Control_L);
|
||||
SendEvent(&event);
|
||||
event.state &= ~ControlMask;
|
||||
// finally check if the combination of pressed modifiers that we chose to ignore affects the keysym
|
||||
unsigned int mods_rtrn;
|
||||
KeySym keysym_rtrn;
|
||||
XkbTranslateKeyCode(m_xkb, keycode, wanted_mask | (release_check_mask & ~release_mask), &mods_rtrn, &keysym_rtrn);
|
||||
if (keysym_rtrn != keysym) {
|
||||
// oh well, release all the modifiers we don't want
|
||||
release_mask = release_check_mask;
|
||||
}
|
||||
|
||||
/* release all modifiers */
|
||||
SendModifier(&event, release_mask, KeyRelease);
|
||||
|
||||
SendModifier(&event, press_mask, KeyPress);
|
||||
|
||||
/* press and release key */
|
||||
event.keycode = keycode;
|
||||
SendEvent(&event, KeyPress);
|
||||
SendEvent(&event, KeyRelease);
|
||||
|
||||
/* release the modifiers */
|
||||
SendModifier(&event, press_mask, KeyRelease);
|
||||
|
||||
/* restore the old keyboard mask */
|
||||
SendModifier(&event, release_mask, KeyPress);
|
||||
}
|
||||
|
||||
int AutoTypePlatformX11::MyErrorHandler(Display* my_dpy, XErrorEvent* event)
|
||||
|
||||
@@ -19,19 +19,22 @@
|
||||
#ifndef KEEPASSX_AUTOTYPEX11_H
|
||||
#define KEEPASSX_AUTOTYPEX11_H
|
||||
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QX11Info>
|
||||
#include <QApplication>
|
||||
#include <QSet>
|
||||
#include <QtPlugin>
|
||||
#include <QWidget>
|
||||
#include <QX11Info>
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
#include <X11/XKBlib.h>
|
||||
|
||||
#include "autotype/AutoTypePlatformPlugin.h"
|
||||
#include "autotype/AutoTypeAction.h"
|
||||
#include "core/Global.h"
|
||||
|
||||
#define N_MOD_INDICES (Mod5MapIndex + 1)
|
||||
|
||||
class AutoTypePlatformX11 : public QObject, public AutoTypePlatformInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -39,6 +42,7 @@ class AutoTypePlatformX11 : public QObject, public AutoTypePlatformInterface
|
||||
|
||||
public:
|
||||
AutoTypePlatformX11();
|
||||
void unload() Q_DECL_OVERRIDE;
|
||||
QStringList windowTitles();
|
||||
WId activeWindow();
|
||||
QString activeWindowTitle();
|
||||
@@ -51,7 +55,7 @@ public:
|
||||
KeySym charToKeySym(const QChar& ch);
|
||||
KeySym keyToKeySym(Qt::Key key);
|
||||
|
||||
void SendKeyPressedEvent(KeySym keysym, unsigned int shift = 0);
|
||||
void SendKeyPressedEvent(KeySym keysym);
|
||||
|
||||
Q_SIGNALS:
|
||||
void globalShortcutTriggered();
|
||||
@@ -68,10 +72,14 @@ private:
|
||||
static int x11ErrorHandler(Display* display, XErrorEvent* error);
|
||||
|
||||
void updateKeymap();
|
||||
int AddKeysym(KeySym keysym, bool top);
|
||||
bool isRemapKeycodeValid();
|
||||
int AddKeysym(KeySym keysym);
|
||||
void AddModifier(KeySym keysym);
|
||||
void ReadKeymap();
|
||||
void SendEvent(XKeyEvent* event);
|
||||
void SendEvent(XKeyEvent* event, int event_type);
|
||||
void SendModifier(XKeyEvent *event, unsigned int mask, int event_type);
|
||||
int GetKeycode(KeySym keysym, unsigned int *mask);
|
||||
bool keysymModifiers(KeySym keysym, int keycode, unsigned int *mask);
|
||||
|
||||
static int MyErrorHandler(Display* my_dpy, XErrorEvent* event);
|
||||
|
||||
Display* m_dpy;
|
||||
@@ -91,14 +99,20 @@ private:
|
||||
static bool m_xErrorOccured;
|
||||
static int (*m_oldXErrorHandler)(Display*, XErrorEvent*);
|
||||
|
||||
static const int m_unicodeToKeysymLen;
|
||||
static const uint m_unicodeToKeysymKeys[];
|
||||
static const uint m_unicodeToKeysymValues[];
|
||||
|
||||
XkbDescPtr m_xkb;
|
||||
KeySym* m_keysymTable;
|
||||
int m_minKeycode;
|
||||
int m_maxKeycode;
|
||||
int m_keysymPerKeycode;
|
||||
int m_altMask;
|
||||
int m_metaMask;
|
||||
int m_altgrMask;
|
||||
KeySym m_altgrKeysym;
|
||||
/* dedicated keycode for remapped keys */
|
||||
unsigned int m_remapKeycode;
|
||||
KeySym m_currentRemapKeysym;
|
||||
KeyCode m_modifier_keycode[N_MOD_INDICES];
|
||||
bool m_loaded;
|
||||
};
|
||||
|
||||
class AutoTypeExecturorX11 : public AutoTypeExecutor
|
||||
|
||||
169
src/autotype/x11/KeySymMap.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Automatically generated by keysymmap.py from parsing keysymdef.h.
|
||||
*/
|
||||
|
||||
const int AutoTypePlatformX11::m_unicodeToKeysymLen = 632;
|
||||
|
||||
const uint AutoTypePlatformX11::m_unicodeToKeysymKeys[] = {
|
||||
0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107,
|
||||
0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, 0x010f,
|
||||
0x0110, 0x0111, 0x0112, 0x0113, 0x0116, 0x0117, 0x0118, 0x0119,
|
||||
0x011a, 0x011b, 0x011c, 0x011d, 0x011e, 0x011f, 0x0120, 0x0121,
|
||||
0x0122, 0x0123, 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129,
|
||||
0x012a, 0x012b, 0x012e, 0x012f, 0x0130, 0x0131, 0x0134, 0x0135,
|
||||
0x0136, 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d,
|
||||
0x013e, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0146, 0x0147,
|
||||
0x0148, 0x014a, 0x014b, 0x014c, 0x014d, 0x0150, 0x0151, 0x0152,
|
||||
0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x0159, 0x015a,
|
||||
0x015b, 0x015c, 0x015d, 0x015e, 0x015f, 0x0160, 0x0161, 0x0162,
|
||||
0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016a,
|
||||
0x016b, 0x016c, 0x016d, 0x016e, 0x016f, 0x0170, 0x0171, 0x0172,
|
||||
0x0173, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, 0x017e,
|
||||
0x0192, 0x02c7, 0x02d8, 0x02d9, 0x02db, 0x02dd, 0x0385, 0x0386,
|
||||
0x0388, 0x0389, 0x038a, 0x038c, 0x038e, 0x038f, 0x0390, 0x0391,
|
||||
0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399,
|
||||
0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1,
|
||||
0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa,
|
||||
0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03b0, 0x03b1, 0x03b2,
|
||||
0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba,
|
||||
0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c2,
|
||||
0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca,
|
||||
0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x0401, 0x0402, 0x0403, 0x0404,
|
||||
0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040a, 0x040b, 0x040c,
|
||||
0x040e, 0x040f, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415,
|
||||
0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d,
|
||||
0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425,
|
||||
0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d,
|
||||
0x042e, 0x042f, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435,
|
||||
0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d,
|
||||
0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445,
|
||||
0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d,
|
||||
0x044e, 0x044f, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456,
|
||||
0x0457, 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x045e, 0x045f,
|
||||
0x0490, 0x0491, 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5,
|
||||
0x05d6, 0x05d7, 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd,
|
||||
0x05de, 0x05df, 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5,
|
||||
0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0x060c, 0x061b, 0x061f,
|
||||
0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628,
|
||||
0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, 0x0630,
|
||||
0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638,
|
||||
0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645,
|
||||
0x0646, 0x0647, 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d,
|
||||
0x064e, 0x064f, 0x0650, 0x0651, 0x0652, 0x0e01, 0x0e02, 0x0e03,
|
||||
0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b,
|
||||
0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, 0x0e10, 0x0e11, 0x0e12, 0x0e13,
|
||||
0x0e14, 0x0e15, 0x0e16, 0x0e17, 0x0e18, 0x0e19, 0x0e1a, 0x0e1b,
|
||||
0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, 0x0e20, 0x0e21, 0x0e22, 0x0e23,
|
||||
0x0e24, 0x0e25, 0x0e26, 0x0e27, 0x0e28, 0x0e29, 0x0e2a, 0x0e2b,
|
||||
0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, 0x0e30, 0x0e31, 0x0e32, 0x0e33,
|
||||
0x0e34, 0x0e35, 0x0e36, 0x0e37, 0x0e38, 0x0e39, 0x0e3a, 0x0e3f,
|
||||
0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47,
|
||||
0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e50, 0x0e51,
|
||||
0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59,
|
||||
0x2002, 0x2003, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, 0x200a,
|
||||
0x2012, 0x2013, 0x2014, 0x2015, 0x2017, 0x2018, 0x2019, 0x201a,
|
||||
0x201c, 0x201d, 0x201e, 0x2020, 0x2021, 0x2025, 0x2026, 0x2030,
|
||||
0x2032, 0x2033, 0x2038, 0x203e, 0x20ac, 0x2105, 0x2116, 0x2117,
|
||||
0x211e, 0x2122, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158,
|
||||
0x2159, 0x215a, 0x215b, 0x215c, 0x215d, 0x215e, 0x2190, 0x2191,
|
||||
0x2192, 0x2193, 0x21d2, 0x21d4, 0x2202, 0x2207, 0x2218, 0x221a,
|
||||
0x221d, 0x221e, 0x2227, 0x2228, 0x2229, 0x222a, 0x222b, 0x2234,
|
||||
0x223c, 0x2243, 0x2260, 0x2261, 0x2264, 0x2265, 0x2282, 0x2283,
|
||||
0x22a2, 0x22a3, 0x22a4, 0x22a5, 0x2308, 0x230a, 0x2315, 0x2320,
|
||||
0x2321, 0x2395, 0x239b, 0x239d, 0x239e, 0x23a0, 0x23a1, 0x23a3,
|
||||
0x23a4, 0x23a6, 0x23a8, 0x23ac, 0x23b7, 0x23ba, 0x23bb, 0x23bc,
|
||||
0x23bd, 0x2409, 0x240a, 0x240b, 0x240c, 0x240d, 0x2424, 0x2500,
|
||||
0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, 0x252c,
|
||||
0x2534, 0x253c, 0x2592, 0x25c6, 0x25cb, 0x260e, 0x2640, 0x2642,
|
||||
0x2663, 0x2665, 0x2666, 0x266d, 0x266f, 0x2713, 0x2717, 0x271d,
|
||||
0x2720, 0x3001, 0x3002, 0x300c, 0x300d, 0x309b, 0x309c, 0x30a1,
|
||||
0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, 0x30a9,
|
||||
0x30aa, 0x30ab, 0x30ad, 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7,
|
||||
0x30b9, 0x30bb, 0x30bd, 0x30bf, 0x30c1, 0x30c3, 0x30c4, 0x30c6,
|
||||
0x30c8, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d2,
|
||||
0x30d5, 0x30d8, 0x30db, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2,
|
||||
0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea,
|
||||
0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f2, 0x30f3, 0x30fb, 0x30fc
|
||||
};
|
||||
|
||||
const uint AutoTypePlatformX11::m_unicodeToKeysymValues[] = {
|
||||
0x03c0, 0x03e0, 0x01c3, 0x01e3, 0x01a1, 0x01b1, 0x01c6, 0x01e6,
|
||||
0x02c6, 0x02e6, 0x02c5, 0x02e5, 0x01c8, 0x01e8, 0x01cf, 0x01ef,
|
||||
0x01d0, 0x01f0, 0x03aa, 0x03ba, 0x03cc, 0x03ec, 0x01ca, 0x01ea,
|
||||
0x01cc, 0x01ec, 0x02d8, 0x02f8, 0x02ab, 0x02bb, 0x02d5, 0x02f5,
|
||||
0x03ab, 0x03bb, 0x02a6, 0x02b6, 0x02a1, 0x02b1, 0x03a5, 0x03b5,
|
||||
0x03cf, 0x03ef, 0x03c7, 0x03e7, 0x02a9, 0x02b9, 0x02ac, 0x02bc,
|
||||
0x03d3, 0x03f3, 0x03a2, 0x01c5, 0x01e5, 0x03a6, 0x03b6, 0x01a5,
|
||||
0x01b5, 0x01a3, 0x01b3, 0x01d1, 0x01f1, 0x03d1, 0x03f1, 0x01d2,
|
||||
0x01f2, 0x03bd, 0x03bf, 0x03d2, 0x03f2, 0x01d5, 0x01f5, 0x13bc,
|
||||
0x13bd, 0x01c0, 0x01e0, 0x03a3, 0x03b3, 0x01d8, 0x01f8, 0x01a6,
|
||||
0x01b6, 0x02de, 0x02fe, 0x01aa, 0x01ba, 0x01a9, 0x01b9, 0x01de,
|
||||
0x01fe, 0x01ab, 0x01bb, 0x03ac, 0x03bc, 0x03dd, 0x03fd, 0x03de,
|
||||
0x03fe, 0x02dd, 0x02fd, 0x01d9, 0x01f9, 0x01db, 0x01fb, 0x03d9,
|
||||
0x03f9, 0x13be, 0x01ac, 0x01bc, 0x01af, 0x01bf, 0x01ae, 0x01be,
|
||||
0x08f6, 0x01b7, 0x01a2, 0x01ff, 0x01b2, 0x01bd, 0x07ae, 0x07a1,
|
||||
0x07a2, 0x07a3, 0x07a4, 0x07a7, 0x07a8, 0x07ab, 0x07b6, 0x07c1,
|
||||
0x07c2, 0x07c3, 0x07c4, 0x07c5, 0x07c6, 0x07c7, 0x07c8, 0x07c9,
|
||||
0x07ca, 0x07cb, 0x07cc, 0x07cd, 0x07ce, 0x07cf, 0x07d0, 0x07d1,
|
||||
0x07d2, 0x07d4, 0x07d5, 0x07d6, 0x07d7, 0x07d8, 0x07d9, 0x07a5,
|
||||
0x07a9, 0x07b1, 0x07b2, 0x07b3, 0x07b4, 0x07ba, 0x07e1, 0x07e2,
|
||||
0x07e3, 0x07e4, 0x07e5, 0x07e6, 0x07e7, 0x07e8, 0x07e9, 0x07ea,
|
||||
0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, 0x07f0, 0x07f1, 0x07f3,
|
||||
0x07f2, 0x07f4, 0x07f5, 0x07f6, 0x07f7, 0x07f8, 0x07f9, 0x07b5,
|
||||
0x07b9, 0x07b7, 0x07b8, 0x07bb, 0x06b3, 0x06b1, 0x06b2, 0x06b4,
|
||||
0x06b5, 0x06b6, 0x06b7, 0x06b8, 0x06b9, 0x06ba, 0x06bb, 0x06bc,
|
||||
0x06be, 0x06bf, 0x06e1, 0x06e2, 0x06f7, 0x06e7, 0x06e4, 0x06e5,
|
||||
0x06f6, 0x06fa, 0x06e9, 0x06ea, 0x06eb, 0x06ec, 0x06ed, 0x06ee,
|
||||
0x06ef, 0x06f0, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06e6, 0x06e8,
|
||||
0x06e3, 0x06fe, 0x06fb, 0x06fd, 0x06ff, 0x06f9, 0x06f8, 0x06fc,
|
||||
0x06e0, 0x06f1, 0x06c1, 0x06c2, 0x06d7, 0x06c7, 0x06c4, 0x06c5,
|
||||
0x06d6, 0x06da, 0x06c9, 0x06ca, 0x06cb, 0x06cc, 0x06cd, 0x06ce,
|
||||
0x06cf, 0x06d0, 0x06d2, 0x06d3, 0x06d4, 0x06d5, 0x06c6, 0x06c8,
|
||||
0x06c3, 0x06de, 0x06db, 0x06dd, 0x06df, 0x06d9, 0x06d8, 0x06dc,
|
||||
0x06c0, 0x06d1, 0x06a3, 0x06a1, 0x06a2, 0x06a4, 0x06a5, 0x06a6,
|
||||
0x06a7, 0x06a8, 0x06a9, 0x06aa, 0x06ab, 0x06ac, 0x06ae, 0x06af,
|
||||
0x06bd, 0x06ad, 0x0ce0, 0x0ce1, 0x0ce2, 0x0ce3, 0x0ce4, 0x0ce5,
|
||||
0x0ce6, 0x0ce7, 0x0ce8, 0x0ce9, 0x0cea, 0x0ceb, 0x0cec, 0x0ced,
|
||||
0x0cee, 0x0cef, 0x0cf0, 0x0cf1, 0x0cf2, 0x0cf3, 0x0cf4, 0x0cf5,
|
||||
0x0cf6, 0x0cf7, 0x0cf8, 0x0cf9, 0x0cfa, 0x05ac, 0x05bb, 0x05bf,
|
||||
0x05c1, 0x05c2, 0x05c3, 0x05c4, 0x05c5, 0x05c6, 0x05c7, 0x05c8,
|
||||
0x05c9, 0x05ca, 0x05cb, 0x05cc, 0x05cd, 0x05ce, 0x05cf, 0x05d0,
|
||||
0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8,
|
||||
0x05d9, 0x05da, 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5,
|
||||
0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x05ea, 0x05eb, 0x05ec, 0x05ed,
|
||||
0x05ee, 0x05ef, 0x05f0, 0x05f1, 0x05f2, 0x0da1, 0x0da2, 0x0da3,
|
||||
0x0da4, 0x0da5, 0x0da6, 0x0da7, 0x0da8, 0x0da9, 0x0daa, 0x0dab,
|
||||
0x0dac, 0x0dad, 0x0dae, 0x0daf, 0x0db0, 0x0db1, 0x0db2, 0x0db3,
|
||||
0x0db4, 0x0db5, 0x0db6, 0x0db7, 0x0db8, 0x0db9, 0x0dba, 0x0dbb,
|
||||
0x0dbc, 0x0dbd, 0x0dbe, 0x0dbf, 0x0dc0, 0x0dc1, 0x0dc2, 0x0dc3,
|
||||
0x0dc4, 0x0dc5, 0x0dc6, 0x0dc7, 0x0dc8, 0x0dc9, 0x0dca, 0x0dcb,
|
||||
0x0dcc, 0x0dcd, 0x0dce, 0x0dcf, 0x0dd0, 0x0dd1, 0x0dd2, 0x0dd3,
|
||||
0x0dd4, 0x0dd5, 0x0dd6, 0x0dd7, 0x0dd8, 0x0dd9, 0x0dda, 0x0ddf,
|
||||
0x0de0, 0x0de1, 0x0de2, 0x0de3, 0x0de4, 0x0de5, 0x0de6, 0x0de7,
|
||||
0x0de8, 0x0de9, 0x0dea, 0x0deb, 0x0dec, 0x0ded, 0x0df0, 0x0df1,
|
||||
0x0df2, 0x0df3, 0x0df4, 0x0df5, 0x0df6, 0x0df7, 0x0df8, 0x0df9,
|
||||
0x0aa2, 0x0aa1, 0x0aa3, 0x0aa4, 0x0aa5, 0x0aa6, 0x0aa7, 0x0aa8,
|
||||
0x0abb, 0x0aaa, 0x0aa9, 0x07af, 0x0cdf, 0x0ad0, 0x0ad1, 0x0afd,
|
||||
0x0ad2, 0x0ad3, 0x0afe, 0x0af1, 0x0af2, 0x0aaf, 0x0aae, 0x0ad5,
|
||||
0x0ad6, 0x0ad7, 0x0afc, 0x047e, 0x20ac, 0x0ab8, 0x06b0, 0x0afb,
|
||||
0x0ad4, 0x0ac9, 0x0ab0, 0x0ab1, 0x0ab2, 0x0ab3, 0x0ab4, 0x0ab5,
|
||||
0x0ab6, 0x0ab7, 0x0ac3, 0x0ac4, 0x0ac5, 0x0ac6, 0x08fb, 0x08fc,
|
||||
0x08fd, 0x08fe, 0x08ce, 0x08cd, 0x08ef, 0x08c5, 0x0bca, 0x08d6,
|
||||
0x08c1, 0x08c2, 0x08de, 0x08df, 0x08dc, 0x08dd, 0x08bf, 0x08c0,
|
||||
0x08c8, 0x08c9, 0x08bd, 0x08cf, 0x08bc, 0x08be, 0x08da, 0x08db,
|
||||
0x0bfc, 0x0bdc, 0x0bc2, 0x0bce, 0x0bd3, 0x0bc4, 0x0afa, 0x08a4,
|
||||
0x08a5, 0x0bcc, 0x08ab, 0x08ac, 0x08ad, 0x08ae, 0x08a7, 0x08a8,
|
||||
0x08a9, 0x08aa, 0x08af, 0x08b0, 0x08a1, 0x09ef, 0x09f0, 0x09f2,
|
||||
0x09f3, 0x09e2, 0x09e5, 0x09e9, 0x09e3, 0x09e4, 0x09e8, 0x09f1,
|
||||
0x09f8, 0x09ec, 0x09eb, 0x09ed, 0x09ea, 0x09f4, 0x09f5, 0x09f7,
|
||||
0x09f6, 0x09ee, 0x09e1, 0x09e0, 0x0bcf, 0x0af9, 0x0af8, 0x0af7,
|
||||
0x0aec, 0x0aee, 0x0aed, 0x0af6, 0x0af5, 0x0af3, 0x0af4, 0x0ad9,
|
||||
0x0af0, 0x04a4, 0x04a1, 0x04a2, 0x04a3, 0x04de, 0x04df, 0x04a7,
|
||||
0x04b1, 0x04a8, 0x04b2, 0x04a9, 0x04b3, 0x04aa, 0x04b4, 0x04ab,
|
||||
0x04b5, 0x04b6, 0x04b7, 0x04b8, 0x04b9, 0x04ba, 0x04bb, 0x04bc,
|
||||
0x04bd, 0x04be, 0x04bf, 0x04c0, 0x04c1, 0x04af, 0x04c2, 0x04c3,
|
||||
0x04c4, 0x04c5, 0x04c6, 0x04c7, 0x04c8, 0x04c9, 0x04ca, 0x04cb,
|
||||
0x04cc, 0x04cd, 0x04ce, 0x04cf, 0x04d0, 0x04d1, 0x04d2, 0x04d3,
|
||||
0x04ac, 0x04d4, 0x04ad, 0x04d5, 0x04ae, 0x04d6, 0x04d7, 0x04d8,
|
||||
0x04d9, 0x04da, 0x04db, 0x04dc, 0x04a6, 0x04dd, 0x04a5, 0x04b0
|
||||
};
|
||||
107
src/autotype/x11/keysymmap.py
Executable file
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
#
|
||||
# Copyright (C) 2013 Felix Geyer <debfx@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, either version 2 or (at your option)
|
||||
# version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#
|
||||
# Parses keysymdef.h to construct a unicode symbol -> keysym mapping table.
|
||||
#
|
||||
# The lines that are parsed look like this:
|
||||
# #define XK_Aogonek 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */
|
||||
#
|
||||
# This would create a 0x0104 -> 0x01a1 mapping.
|
||||
#
|
||||
|
||||
import sys
|
||||
import re
|
||||
import collections
|
||||
|
||||
cols = 8
|
||||
|
||||
if len(sys.argv) >= 2:
|
||||
keysymdef = sys.argv[1]
|
||||
else:
|
||||
keysymdef = "/usr/include/X11/keysymdef.h"
|
||||
|
||||
keysymMap = {}
|
||||
|
||||
f = open(keysymdef, "r")
|
||||
for line in f:
|
||||
match = re.search(r'0x([0-9a-fA-F]+)\s+/\* U\+([0-9a-fA-F]+)', line)
|
||||
if match:
|
||||
keysym = int(match.group(1), 16)
|
||||
unicodeVal = int(match.group(2), 16)
|
||||
|
||||
# ignore 1:1 mappings
|
||||
if keysym >= 0x0020 and keysym <= 0x007e:
|
||||
continue
|
||||
if keysym >= 0x00a0 and keysym <= 0x00ff:
|
||||
continue
|
||||
# ignore unicode | 0x01000000 mappings
|
||||
if keysym >= 0x1000000:
|
||||
continue
|
||||
|
||||
keysymMap[unicodeVal] = keysym
|
||||
|
||||
keysymMap = collections.OrderedDict(sorted(keysymMap.items(), key=lambda t: t[0]))
|
||||
|
||||
print("""/*
|
||||
* Automatically generated by keysymmap.py from parsing keysymdef.h.
|
||||
*/
|
||||
""")
|
||||
|
||||
print("const int AutoTypePlatformX11::m_unicodeToKeysymLen = " + str(len(keysymMap)) + ";")
|
||||
|
||||
print()
|
||||
|
||||
print("const uint AutoTypePlatformX11::m_unicodeToKeysymKeys[] = {")
|
||||
keys = keysymMap.keys()
|
||||
keyLen = len(keys)
|
||||
i = 1
|
||||
for val in keys:
|
||||
hexVal = "{0:#0{1}x}".format(val, 6)
|
||||
|
||||
if i == keyLen:
|
||||
print(hexVal)
|
||||
elif (i % cols) == 0:
|
||||
print(hexVal + ",")
|
||||
elif ((i - 1) % cols) == 0:
|
||||
print(" " + hexVal + ", ", end="")
|
||||
else:
|
||||
print(hexVal + ", ", end="")
|
||||
i += 1
|
||||
print("};")
|
||||
|
||||
print()
|
||||
|
||||
print("const uint AutoTypePlatformX11::m_unicodeToKeysymValues[] = {")
|
||||
values = keysymMap.values()
|
||||
valuesLen = len(values)
|
||||
i = 1
|
||||
for val in values:
|
||||
hexVal = "{0:#0{1}x}".format(val, 6)
|
||||
|
||||
if i == valuesLen:
|
||||
print(hexVal)
|
||||
elif (i % cols) == 0:
|
||||
print(hexVal + ",")
|
||||
elif ((i - 1) % cols) == 0:
|
||||
print(" " + hexVal + ", ", end="")
|
||||
else:
|
||||
print(hexVal + ", ", end="")
|
||||
i += 1
|
||||
print("};")
|
||||
@@ -1,14 +1,21 @@
|
||||
/* config-keepassx.h. Generated by cmake from config-keepassx.h.cmake */
|
||||
|
||||
#ifndef KEEPASSX_CONFIG_H
|
||||
#define KEEPASSX_CONFIG_H
|
||||
#ifndef KEEPASSX_CONFIG_KEEPASSX_H
|
||||
#define KEEPASSX_CONFIG_KEEPASSX_H
|
||||
|
||||
#define KEEPASSX_VERSION "${KEEPASSX_VERSION}"
|
||||
|
||||
#define KEEPASSX_SOURCE_DIR "${CMAKE_SOURCE_DIR}"
|
||||
#define KEEPASSX_BINARY_DIR "${CMAKE_BINARY_DIR}"
|
||||
|
||||
#define KEEPASSX_PREFIX_DIR "${CMAKE_INSTALL_PREFIX}"
|
||||
#define KEEPASSX_PLUGIN_DIR "${PLUGIN_INSTALL_DIR}"
|
||||
#define KEEPASSX_DATA_DIR "${DATA_INSTALL_DIR}"
|
||||
|
||||
#cmakedefine HAVE_PR_SET_DUMPABLE 1
|
||||
#cmakedefine HAVE_RLIMIT_CORE 1
|
||||
#cmakedefine HAVE_PT_DENY_ATTACH 1
|
||||
|
||||
#endif // KEEPASSX_CONFIG_H
|
||||
#cmakedefine GCRYPT_HAS_SALSA20
|
||||
|
||||
#endif // KEEPASSX_CONFIG_KEEPASSX_H
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef KEEPASSX_AUTOTYPEASSOCIATIONS_H
|
||||
#define KEEPASSX_AUTOTYPEASSOCIATIONS_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QObject>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QCoreApplication>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
Config* Config::m_instance(Q_NULLPTR);
|
||||
|
||||
@@ -71,7 +71,8 @@ Config::Config(QObject* parent)
|
||||
userPath += "/keepassx/";
|
||||
#else
|
||||
userPath = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
|
||||
userPath += "/keepassx/";
|
||||
// storageLocation() appends the application name ("/keepassx") to the end
|
||||
userPath += "/";
|
||||
#endif
|
||||
|
||||
userPath += "keepassx2.ini";
|
||||
@@ -88,12 +89,23 @@ void Config::init(const QString& fileName)
|
||||
m_settings.reset(new QSettings(fileName, QSettings::IniFormat));
|
||||
|
||||
m_defaults.insert("RememberLastDatabases", true);
|
||||
m_defaults.insert("ModifiedOnExpandedStateChanges", true);
|
||||
m_defaults.insert("RememberLastKeyFiles", true);
|
||||
m_defaults.insert("OpenPreviousDatabasesOnStartup", true);
|
||||
m_defaults.insert("AutoSaveAfterEveryChange", false);
|
||||
m_defaults.insert("AutoSaveOnExit", false);
|
||||
m_defaults.insert("ShowToolbar", true);
|
||||
m_defaults.insert("MinimizeOnCopy", false);
|
||||
m_defaults.insert("UseGroupIconOnEntryCreation", false);
|
||||
m_defaults.insert("AutoTypeEntryTitleMatch", true);
|
||||
m_defaults.insert("security/clearclipboard", true);
|
||||
m_defaults.insert("security/clearclipboardtimeout", 10);
|
||||
m_defaults.insert("security/lockdatabaseidle", false);
|
||||
m_defaults.insert("security/lockdatabaseidlesec", 10);
|
||||
m_defaults.insert("security/passwordscleartext", false);
|
||||
m_defaults.insert("security/autotypeask", true);
|
||||
m_defaults.insert("GUI/Language", "system");
|
||||
m_defaults.insert("GUI/ShowTrayIcon", false);
|
||||
m_defaults.insert("GUI/MinimizeToTray", false);
|
||||
}
|
||||
|
||||
Config* Config::instance()
|
||||
@@ -105,6 +117,12 @@ Config* Config::instance()
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
void Config::createConfigFromFile(const QString& file)
|
||||
{
|
||||
Q_ASSERT(!m_instance);
|
||||
m_instance = new Config(file, qApp);
|
||||
}
|
||||
|
||||
void Config::createTempFileInstance()
|
||||
{
|
||||
Q_ASSERT(!m_instance);
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#ifndef KEEPASSX_CONFIG_H
|
||||
#define KEEPASSX_CONFIG_H
|
||||
|
||||
#include <QtCore/QScopedPointer>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QScopedPointer>
|
||||
#include <QVariant>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
void set(const QString& key, const QVariant& value);
|
||||
|
||||
static Config* instance();
|
||||
static void createConfigFromFile(const QString& file);
|
||||
static void createTempFileInstance();
|
||||
|
||||
private:
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
#include "Database.h"
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QXmlStreamReader>
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
#include "core/Group.h"
|
||||
#include "core/Metadata.h"
|
||||
@@ -32,13 +32,14 @@ QHash<Uuid, Database*> Database::m_uuidMap;
|
||||
Database::Database()
|
||||
: m_metadata(new Metadata(this))
|
||||
, m_timer(new QTimer(this))
|
||||
, m_cipher(KeePass2::CIPHER_AES)
|
||||
, m_compressionAlgo(CompressionGZip)
|
||||
, m_transformRounds(50000)
|
||||
, m_hasKey(false)
|
||||
, m_emitModified(false)
|
||||
, m_uuid(Uuid::random())
|
||||
{
|
||||
m_data.cipher = KeePass2::CIPHER_AES;
|
||||
m_data.compressionAlgo = CompressionGZip;
|
||||
m_data.transformRounds = 100000;
|
||||
m_data.hasKey = false;
|
||||
|
||||
setRootGroup(new Group());
|
||||
rootGroup()->setUuid(Uuid::random());
|
||||
m_timer->setSingleShot(true);
|
||||
@@ -150,81 +151,100 @@ void Database::addDeletedObject(const Uuid& uuid)
|
||||
|
||||
Uuid Database::cipher() const
|
||||
{
|
||||
return m_cipher;
|
||||
return m_data.cipher;
|
||||
}
|
||||
|
||||
Database::CompressionAlgorithm Database::compressionAlgo() const
|
||||
{
|
||||
return m_compressionAlgo;
|
||||
return m_data.compressionAlgo;
|
||||
}
|
||||
|
||||
QByteArray Database::transformSeed() const
|
||||
{
|
||||
return m_transformSeed;
|
||||
return m_data.transformSeed;
|
||||
}
|
||||
|
||||
quint64 Database::transformRounds() const
|
||||
{
|
||||
return m_transformRounds;
|
||||
return m_data.transformRounds;
|
||||
}
|
||||
|
||||
QByteArray Database::transformedMasterKey() const
|
||||
{
|
||||
return m_transformedMasterKey;
|
||||
return m_data.transformedMasterKey;
|
||||
}
|
||||
|
||||
void Database::setCipher(const Uuid& cipher)
|
||||
{
|
||||
Q_ASSERT(!cipher.isNull());
|
||||
|
||||
m_cipher = cipher;
|
||||
m_data.cipher = cipher;
|
||||
}
|
||||
|
||||
void Database::setCompressionAlgo(Database::CompressionAlgorithm algo)
|
||||
{
|
||||
Q_ASSERT(static_cast<quint32>(algo) <= CompressionAlgorithmMax);
|
||||
|
||||
m_compressionAlgo = algo;
|
||||
m_data.compressionAlgo = algo;
|
||||
}
|
||||
|
||||
void Database::setTransformRounds(quint64 rounds)
|
||||
bool Database::setTransformRounds(quint64 rounds)
|
||||
{
|
||||
if (m_transformRounds != rounds) {
|
||||
m_transformRounds = rounds;
|
||||
if (m_data.transformRounds != rounds) {
|
||||
quint64 oldRounds = m_data.transformRounds;
|
||||
|
||||
if (m_hasKey) {
|
||||
setKey(m_key);
|
||||
m_data.transformRounds = rounds;
|
||||
|
||||
if (m_data.hasKey) {
|
||||
if (!setKey(m_data.key)) {
|
||||
m_data.transformRounds = oldRounds;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Database::setKey(const CompositeKey& key, const QByteArray& transformSeed, bool updateChangedTime)
|
||||
bool Database::setKey(const CompositeKey& key, const QByteArray& transformSeed,
|
||||
bool updateChangedTime)
|
||||
{
|
||||
m_key = key;
|
||||
m_transformSeed = transformSeed;
|
||||
m_transformedMasterKey = key.transform(transformSeed, transformRounds());
|
||||
m_hasKey = true;
|
||||
bool ok;
|
||||
QString errorString;
|
||||
|
||||
QByteArray transformedMasterKey =
|
||||
key.transform(transformSeed, transformRounds(), &ok, &errorString);
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_data.key = key;
|
||||
m_data.transformSeed = transformSeed;
|
||||
m_data.transformedMasterKey = transformedMasterKey;
|
||||
m_data.hasKey = true;
|
||||
if (updateChangedTime) {
|
||||
m_metadata->setMasterKeyChanged(Tools::currentDateTimeUtc());
|
||||
}
|
||||
Q_EMIT modifiedImmediate();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Database::setKey(const CompositeKey& key)
|
||||
bool Database::setKey(const CompositeKey& key)
|
||||
{
|
||||
setKey(key, Random::randomArray(32));
|
||||
return setKey(key, randomGen()->randomArray(32));
|
||||
}
|
||||
|
||||
bool Database::hasKey() const
|
||||
{
|
||||
return m_hasKey;
|
||||
return m_data.hasKey;
|
||||
}
|
||||
|
||||
bool Database::verifyKey(const CompositeKey& key) const
|
||||
{
|
||||
Q_ASSERT(hasKey());
|
||||
|
||||
return (m_key.rawKey() == key.rawKey());
|
||||
return (m_data.key.rawKey() == key.rawKey());
|
||||
}
|
||||
|
||||
void Database::createRecycleBin()
|
||||
@@ -269,6 +289,12 @@ void Database::setEmitModified(bool value)
|
||||
m_emitModified = value;
|
||||
}
|
||||
|
||||
void Database::copyAttributesFrom(const Database* other)
|
||||
{
|
||||
m_data = other->m_data;
|
||||
m_metadata->copyAttributesFrom(other->m_metadata);
|
||||
}
|
||||
|
||||
Uuid Database::uuid()
|
||||
{
|
||||
return m_uuid;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#ifndef KEEPASSX_DATABASE_H
|
||||
#define KEEPASSX_DATABASE_H
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QHash>
|
||||
#include <QDateTime>
|
||||
#include <QHash>
|
||||
|
||||
#include "core/Uuid.h"
|
||||
#include "keys/CompositeKey.h"
|
||||
@@ -49,6 +49,17 @@ public:
|
||||
};
|
||||
static const quint32 CompressionAlgorithmMax = CompressionGZip;
|
||||
|
||||
struct DatabaseData
|
||||
{
|
||||
Uuid cipher;
|
||||
CompressionAlgorithm compressionAlgo;
|
||||
QByteArray transformSeed;
|
||||
quint64 transformRounds;
|
||||
QByteArray transformedMasterKey;
|
||||
CompositeKey key;
|
||||
bool hasKey;
|
||||
};
|
||||
|
||||
Database();
|
||||
~Database();
|
||||
Group* rootGroup();
|
||||
@@ -58,7 +69,7 @@ public:
|
||||
* Sets group as the root group and takes ownership of it.
|
||||
* Warning: Be careful when calling this method as it doesn't
|
||||
* emit any notifications so e.g. models aren't updated.
|
||||
* The caller is responsible for cleaning up the pervious
|
||||
* The caller is responsible for cleaning up the previous
|
||||
root group.
|
||||
*/
|
||||
void setRootGroup(Group* group);
|
||||
@@ -79,18 +90,20 @@ public:
|
||||
|
||||
void setCipher(const Uuid& cipher);
|
||||
void setCompressionAlgo(Database::CompressionAlgorithm algo);
|
||||
void setTransformRounds(quint64 rounds);
|
||||
void setKey(const CompositeKey& key, const QByteArray& transformSeed, bool updateChangedTime = true);
|
||||
bool setTransformRounds(quint64 rounds);
|
||||
bool setKey(const CompositeKey& key, const QByteArray& transformSeed,
|
||||
bool updateChangedTime = true);
|
||||
|
||||
/**
|
||||
* Sets the database key and generates a random transform seed.
|
||||
*/
|
||||
void setKey(const CompositeKey& key);
|
||||
bool setKey(const CompositeKey& key);
|
||||
bool hasKey() const;
|
||||
bool verifyKey(const CompositeKey& key) const;
|
||||
void recycleEntry(Entry* entry);
|
||||
void recycleGroup(Group* group);
|
||||
void setEmitModified(bool value);
|
||||
void copyAttributesFrom(const Database* other);
|
||||
|
||||
/**
|
||||
* Returns a unique id that is only valid as long as the Database exists.
|
||||
@@ -124,15 +137,7 @@ private:
|
||||
Group* m_rootGroup;
|
||||
QList<DeletedObject> m_deletedObjects;
|
||||
QTimer* m_timer;
|
||||
|
||||
Uuid m_cipher;
|
||||
CompressionAlgorithm m_compressionAlgo;
|
||||
QByteArray m_transformSeed;
|
||||
quint64 m_transformRounds;
|
||||
QByteArray m_transformedMasterKey;
|
||||
|
||||
CompositeKey m_key;
|
||||
bool m_hasKey;
|
||||
DatabaseData m_data;
|
||||
bool m_emitModified;
|
||||
|
||||
Uuid m_uuid;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#ifndef KEEPASSX_DATABASEICONS_H
|
||||
#define KEEPASSX_DATABASEICONS_H
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPixmapCache>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
#include <QVector>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
#include "Endian.h"
|
||||
|
||||
#include <QtCore/QtEndian>
|
||||
#include <QtCore/QIODevice>
|
||||
#include <QtEndian>
|
||||
#include <QIODevice>
|
||||
|
||||
namespace Endian {
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#ifndef KEEPASSX_ENDIAN_H
|
||||
#define KEEPASSX_ENDIAN_H
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QSysInfo>
|
||||
#include <QByteArray>
|
||||
#include <QSysInfo>
|
||||
|
||||
class QIODevice;
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ Entry::Entry()
|
||||
, m_attachments(new EntryAttachments(this))
|
||||
, m_autoTypeAssociations(new AutoTypeAssociations(this))
|
||||
, m_tmpHistoryItem(Q_NULLPTR)
|
||||
, m_modifiedSinceBegin(false)
|
||||
, m_updateTimeinfo(true)
|
||||
{
|
||||
m_data.iconNumber = DefaultIconNumber;
|
||||
@@ -94,8 +95,14 @@ QImage Entry::icon() const
|
||||
return databaseIcons()->icon(m_data.iconNumber);
|
||||
}
|
||||
else {
|
||||
// TODO: check if database() is 0
|
||||
return database()->metadata()->customIcon(m_data.customIcon);
|
||||
Q_ASSERT(database());
|
||||
|
||||
if (database()) {
|
||||
return database()->metadata()->customIcon(m_data.customIcon);
|
||||
}
|
||||
else {
|
||||
return QImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,9 +112,10 @@ QPixmap Entry::iconPixmap() const
|
||||
return databaseIcons()->iconPixmap(m_data.iconNumber);
|
||||
}
|
||||
else {
|
||||
Q_ASSERT(database());
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
|
||||
// TODO: check if database() is 0
|
||||
if (database() && !QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
|
||||
pixmap = QPixmap::fromImage(database()->metadata()->customIcon(m_data.customIcon));
|
||||
m_pixmapCacheKey = QPixmapCache::insert(pixmap);
|
||||
}
|
||||
@@ -178,27 +186,27 @@ const AutoTypeAssociations* Entry::autoTypeAssociations() const
|
||||
|
||||
QString Entry::title() const
|
||||
{
|
||||
return m_attributes->value("Title");
|
||||
return m_attributes->value(EntryAttributes::TitleKey);
|
||||
}
|
||||
|
||||
QString Entry::url() const
|
||||
{
|
||||
return m_attributes->value("URL");
|
||||
return m_attributes->value(EntryAttributes::URLKey);
|
||||
}
|
||||
|
||||
QString Entry::username() const
|
||||
{
|
||||
return m_attributes->value("UserName");
|
||||
return m_attributes->value(EntryAttributes::UserNameKey);
|
||||
}
|
||||
|
||||
QString Entry::password() const
|
||||
{
|
||||
return m_attributes->value("Password");
|
||||
return m_attributes->value(EntryAttributes::PasswordKey);
|
||||
}
|
||||
|
||||
QString Entry::notes() const
|
||||
{
|
||||
return m_attributes->value("Notes");
|
||||
return m_attributes->value(EntryAttributes::NotesKey);
|
||||
}
|
||||
|
||||
bool Entry::isExpired() const
|
||||
@@ -304,27 +312,27 @@ void Entry::setDefaultAutoTypeSequence(const QString& sequence)
|
||||
|
||||
void Entry::setTitle(const QString& title)
|
||||
{
|
||||
m_attributes->set("Title", title, m_attributes->isProtected("Title"));
|
||||
m_attributes->set(EntryAttributes::TitleKey, title, m_attributes->isProtected(EntryAttributes::TitleKey));
|
||||
}
|
||||
|
||||
void Entry::setUrl(const QString& url)
|
||||
{
|
||||
m_attributes->set("URL", url, m_attributes->isProtected("URL"));
|
||||
m_attributes->set(EntryAttributes::URLKey, url, m_attributes->isProtected(EntryAttributes::URLKey));
|
||||
}
|
||||
|
||||
void Entry::setUsername(const QString& username)
|
||||
{
|
||||
m_attributes->set("UserName", username, m_attributes->isProtected("UserName"));
|
||||
m_attributes->set(EntryAttributes::UserNameKey, username, m_attributes->isProtected(EntryAttributes::UserNameKey));
|
||||
}
|
||||
|
||||
void Entry::setPassword(const QString& password)
|
||||
{
|
||||
m_attributes->set("Password", password, m_attributes->isProtected("Password"));
|
||||
m_attributes->set(EntryAttributes::PasswordKey, password, m_attributes->isProtected(EntryAttributes::PasswordKey));
|
||||
}
|
||||
|
||||
void Entry::setNotes(const QString& notes)
|
||||
{
|
||||
m_attributes->set("Notes", notes, m_attributes->isProtected("Notes"));
|
||||
m_attributes->set(EntryAttributes::NotesKey, notes, m_attributes->isProtected(EntryAttributes::NotesKey));
|
||||
}
|
||||
|
||||
void Entry::setExpires(const bool& value)
|
||||
@@ -432,26 +440,54 @@ void Entry::truncateHistory()
|
||||
}
|
||||
}
|
||||
|
||||
Entry* Entry::clone() const
|
||||
Entry* Entry::clone(CloneFlags flags) const
|
||||
{
|
||||
Entry* entry = new Entry();
|
||||
entry->setUpdateTimeinfo(false);
|
||||
entry->m_uuid = m_uuid;
|
||||
if (flags & CloneNewUuid) {
|
||||
entry->m_uuid = Uuid::random();
|
||||
}
|
||||
else {
|
||||
entry->m_uuid = m_uuid;
|
||||
}
|
||||
entry->m_data = m_data;
|
||||
entry->m_attributes->copyDataFrom(m_attributes);
|
||||
entry->m_attachments->copyDataFrom(m_attachments);
|
||||
entry->m_autoTypeAssociations->copyDataFrom(this->m_autoTypeAssociations);
|
||||
if (flags & CloneIncludeHistory) {
|
||||
Q_FOREACH (Entry* historyItem, m_history) {
|
||||
Entry* historyItemClone = historyItem->clone(flags & ~CloneIncludeHistory & ~CloneNewUuid);
|
||||
historyItemClone->setUpdateTimeinfo(false);
|
||||
historyItemClone->setUuid(entry->uuid());
|
||||
historyItemClone->setUpdateTimeinfo(true);
|
||||
entry->addHistoryItem(historyItemClone);
|
||||
}
|
||||
}
|
||||
entry->setUpdateTimeinfo(true);
|
||||
|
||||
QDateTime now = Tools::currentDateTimeUtc();
|
||||
entry->m_data.timeInfo.setCreationTime(now);
|
||||
entry->m_data.timeInfo.setLastModificationTime(now);
|
||||
entry->m_data.timeInfo.setLastAccessTime(now);
|
||||
entry->m_data.timeInfo.setLocationChanged(now);
|
||||
if (flags & CloneResetTimeInfo) {
|
||||
QDateTime now = Tools::currentDateTimeUtc();
|
||||
entry->m_data.timeInfo.setCreationTime(now);
|
||||
entry->m_data.timeInfo.setLastModificationTime(now);
|
||||
entry->m_data.timeInfo.setLastAccessTime(now);
|
||||
entry->m_data.timeInfo.setLocationChanged(now);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
void Entry::copyDataFrom(const Entry* other)
|
||||
{
|
||||
setUpdateTimeinfo(false);
|
||||
m_data = other->m_data;
|
||||
m_attributes->copyDataFrom(other->m_attributes);
|
||||
m_attachments->copyDataFrom(other->m_attachments);
|
||||
m_autoTypeAssociations->copyDataFrom(other->m_autoTypeAssociations);
|
||||
setUpdateTimeinfo(true);
|
||||
}
|
||||
|
||||
void Entry::beginUpdate()
|
||||
{
|
||||
Q_ASSERT(!m_tmpHistoryItem);
|
||||
@@ -543,25 +579,6 @@ const Database* Entry::database() const
|
||||
}
|
||||
}
|
||||
|
||||
bool Entry::match(const QString& searchTerm, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
QStringList wordList = searchTerm.split(QRegExp("\\s"), QString::SkipEmptyParts);
|
||||
Q_FOREACH (const QString& word, wordList) {
|
||||
if (!wordMatch(word, caseSensitivity)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Entry::wordMatch(const QString& word, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
return title().contains(word, caseSensitivity) ||
|
||||
username().contains(word, caseSensitivity) ||
|
||||
url().contains(word, caseSensitivity) ||
|
||||
notes().contains(word, caseSensitivity);
|
||||
}
|
||||
|
||||
QString Entry::resolvePlaceholders(const QString& str) const
|
||||
{
|
||||
QString result = str;
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
#ifndef KEEPASSX_ENTRY_H
|
||||
#define KEEPASSX_ENTRY_H
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtGui/QColor>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPixmapCache>
|
||||
#include <QColor>
|
||||
#include <QImage>
|
||||
#include <QMap>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/AutoTypeAssociations.h"
|
||||
#include "core/EntryAttachments.h"
|
||||
@@ -110,7 +110,23 @@ public:
|
||||
void addHistoryItem(Entry* entry);
|
||||
void removeHistoryItems(const QList<Entry*>& historyEntries);
|
||||
void truncateHistory();
|
||||
Entry* clone() const;
|
||||
|
||||
enum CloneFlag {
|
||||
CloneNoFlags = 0,
|
||||
CloneNewUuid = 1, // generate a random uuid for the clone
|
||||
CloneResetTimeInfo = 2, // set all TimeInfo attributes to the current time
|
||||
CloneIncludeHistory = 4 // clone the history items
|
||||
};
|
||||
Q_DECLARE_FLAGS(CloneFlags, CloneFlag)
|
||||
|
||||
/**
|
||||
* Creates a duplicate of this entry except that the returned entry isn't
|
||||
* part of any group.
|
||||
* Note that you need to copy the custom icons manually when inserting the
|
||||
* new entry into another database.
|
||||
*/
|
||||
Entry* clone(CloneFlags flags) const;
|
||||
void copyDataFrom(const Entry* other);
|
||||
QString resolvePlaceholders(const QString& str) const;
|
||||
|
||||
/**
|
||||
@@ -125,7 +141,6 @@ public:
|
||||
void setGroup(Group* group);
|
||||
|
||||
void setUpdateTimeinfo(bool value);
|
||||
bool match(const QString& searchTerm, Qt::CaseSensitivity caseSensitivity);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
@@ -141,7 +156,6 @@ private Q_SLOTS:
|
||||
void updateModifiedSinceBegin();
|
||||
|
||||
private:
|
||||
bool wordMatch(const QString& word, Qt::CaseSensitivity caseSensitivity);
|
||||
const Database* database() const;
|
||||
template <class T> bool set(T& property, const T& value);
|
||||
|
||||
@@ -159,4 +173,6 @@ private:
|
||||
bool m_updateTimeinfo;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Entry::CloneFlags)
|
||||
|
||||
#endif // KEEPASSX_ENTRY_H
|
||||
|
||||
@@ -27,6 +27,11 @@ QList<QString> EntryAttachments::keys() const
|
||||
return m_attachments.keys();
|
||||
}
|
||||
|
||||
bool EntryAttachments::hasKey(const QString& key) const
|
||||
{
|
||||
return m_attachments.keys().contains(key);
|
||||
}
|
||||
|
||||
QList<QByteArray> EntryAttachments::values() const
|
||||
{
|
||||
return m_attachments.values();
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#ifndef KEEPASSX_ENTRYATTACHMENTS_H
|
||||
#define KEEPASSX_ENTRYATTACHMENTS_H
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QObject>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
@@ -30,6 +30,7 @@ class EntryAttachments : public QObject
|
||||
public:
|
||||
explicit EntryAttachments(QObject* parent = Q_NULLPTR);
|
||||
QList<QString> keys() const;
|
||||
bool hasKey(const QString& key) const;
|
||||
QList<QByteArray> values() const;
|
||||
QByteArray value(const QString& key) const;
|
||||
void set(const QString& key, const QByteArray& value);
|
||||
|
||||
@@ -17,8 +17,13 @@
|
||||
|
||||
#include "EntryAttributes.h"
|
||||
|
||||
const QStringList EntryAttributes::DefaultAttributes(QStringList() << "Title" << "UserName"
|
||||
<< "Password" << "URL" << "Notes");
|
||||
const QString EntryAttributes::TitleKey = "Title";
|
||||
const QString EntryAttributes::UserNameKey = "UserName";
|
||||
const QString EntryAttributes::PasswordKey = "Password";
|
||||
const QString EntryAttributes::URLKey = "URL";
|
||||
const QString EntryAttributes::NotesKey = "Notes";
|
||||
const QStringList EntryAttributes::DefaultAttributes(QStringList() << TitleKey << UserNameKey
|
||||
<< PasswordKey << URLKey << NotesKey);
|
||||
|
||||
EntryAttributes::EntryAttributes(QObject* parent)
|
||||
: QObject(parent)
|
||||
@@ -31,6 +36,11 @@ QList<QString> EntryAttributes::keys() const
|
||||
return m_attributes.keys();
|
||||
}
|
||||
|
||||
bool EntryAttributes::hasKey(const QString& key) const
|
||||
{
|
||||
return m_attributes.keys().contains(key);
|
||||
}
|
||||
|
||||
QList<QString> EntryAttributes::customKeys()
|
||||
{
|
||||
QList<QString> customKeys;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#ifndef KEEPASSX_ENTRYATTRIBUTES_H
|
||||
#define KEEPASSX_ENTRYATTRIBUTES_H
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QStringList>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
@@ -32,6 +32,7 @@ class EntryAttributes : public QObject
|
||||
public:
|
||||
explicit EntryAttributes(QObject* parent = Q_NULLPTR);
|
||||
QList<QString> keys() const;
|
||||
bool hasKey(const QString& key) const;
|
||||
QList<QString> customKeys();
|
||||
QString value(const QString& key) const;
|
||||
bool isProtected(const QString& key) const;
|
||||
@@ -46,6 +47,11 @@ public:
|
||||
bool operator==(const EntryAttributes& other) const;
|
||||
bool operator!=(const EntryAttributes& other) const;
|
||||
|
||||
static const QString TitleKey;
|
||||
static const QString UserNameKey;
|
||||
static const QString PasswordKey;
|
||||
static const QString URLKey;
|
||||
static const QString NotesKey;
|
||||
static const QStringList DefaultAttributes;
|
||||
static bool isDefaultAttribute(const QString& key);
|
||||
|
||||
|
||||
65
src/core/EntrySearcher.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Florian Geyer <blueice@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, either version 2 or (at your option)
|
||||
* version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EntrySearcher.h"
|
||||
|
||||
#include "core/Group.h"
|
||||
|
||||
QList<Entry*> EntrySearcher::search(const QString &searchTerm, const Group* group, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
if (!group->resolveSearchingEnabled()) {
|
||||
return QList<Entry*>();
|
||||
}
|
||||
|
||||
return searchEntries(searchTerm, group, caseSensitivity);
|
||||
}
|
||||
|
||||
QList<Entry*> EntrySearcher::searchEntries(const QString& searchTerm, const Group* group, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
QList<Entry*> searchResult;
|
||||
|
||||
Q_FOREACH (Entry* entry, group->entries()) {
|
||||
searchResult.append(matchEntry(searchTerm, entry, caseSensitivity));
|
||||
}
|
||||
Q_FOREACH (Group* childGroup, group->children()) {
|
||||
if (childGroup->searchingEnabled() != Group::Disable) {
|
||||
searchResult.append(searchEntries(searchTerm, childGroup, caseSensitivity));
|
||||
}
|
||||
}
|
||||
|
||||
return searchResult;
|
||||
}
|
||||
|
||||
QList<Entry*> EntrySearcher::matchEntry(const QString& searchTerm, Entry* entry, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
QStringList wordList = searchTerm.split(QRegExp("\\s"), QString::SkipEmptyParts);
|
||||
Q_FOREACH (const QString& word, wordList) {
|
||||
if (!wordMatch(word, entry, caseSensitivity)) {
|
||||
return QList<Entry*>();
|
||||
}
|
||||
}
|
||||
|
||||
return QList<Entry*>() << entry;
|
||||
}
|
||||
|
||||
bool EntrySearcher::wordMatch(const QString& word, Entry* entry, Qt::CaseSensitivity caseSensitivity)
|
||||
{
|
||||
return entry->title().contains(word, caseSensitivity) ||
|
||||
entry->username().contains(word, caseSensitivity) ||
|
||||
entry->url().contains(word, caseSensitivity) ||
|
||||
entry->notes().contains(word, caseSensitivity);
|
||||
}
|
||||
37
src/core/EntrySearcher.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Florian Geyer <debfx@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, either version 2 or (at your option)
|
||||
* version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KEEPASSX_ENTRYSEARCHER_H
|
||||
#define KEEPASSX_ENTRYSEARCHER_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
class Group;
|
||||
class Entry;
|
||||
|
||||
class EntrySearcher
|
||||
{
|
||||
public:
|
||||
QList<Entry*> search(const QString& searchTerm, const Group* group, Qt::CaseSensitivity caseSensitivity);
|
||||
private:
|
||||
QList<Entry*> searchEntries(const QString& searchTerm, const Group* group, Qt::CaseSensitivity caseSensitivity);
|
||||
QList<Entry*> matchEntry(const QString& searchTerm, Entry* entry, Qt::CaseSensitivity caseSensitivity);
|
||||
bool wordMatch(const QString &word, Entry *entry, Qt::CaseSensitivity caseSensitivity);
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_ENTRYSEARCHER_H
|
||||
14
src/core/Exporter.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef KEEPASSX_EXPORTER_H
|
||||
#define KEEPASSX_EXPORTER_H
|
||||
|
||||
class Database;
|
||||
class Group;
|
||||
|
||||
class Exporter
|
||||
{
|
||||
public:
|
||||
virtual Database* exportGroup(Group* group) = 0;
|
||||
virtual ~Exporter() {}
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_EXPORTER_H
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
#include "FilePath.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QLibrary>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QLibrary>
|
||||
|
||||
#include "config-keepassx.h"
|
||||
|
||||
@@ -48,7 +48,22 @@ QString FilePath::pluginPath(const QString& name)
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/../src/autotype/test";
|
||||
|
||||
pluginPaths << QCoreApplication::applicationDirPath();
|
||||
pluginPaths << QCoreApplication::applicationDirPath() + "/../lib/keepassx";
|
||||
|
||||
QString configuredPluginDir = KEEPASSX_PLUGIN_DIR;
|
||||
if (configuredPluginDir != ".") {
|
||||
if (QDir(configuredPluginDir).isAbsolute()) {
|
||||
pluginPaths << configuredPluginDir;
|
||||
}
|
||||
else {
|
||||
QString relativePluginDir = QString("%1/../%2")
|
||||
.arg(QCoreApplication::applicationDirPath(), configuredPluginDir);
|
||||
pluginPaths << QDir(relativePluginDir).canonicalPath();
|
||||
|
||||
QString absolutePluginDir = QString("%1/%2")
|
||||
.arg(KEEPASSX_PREFIX_DIR, configuredPluginDir);
|
||||
pluginPaths << QDir(absolutePluginDir).canonicalPath();
|
||||
}
|
||||
}
|
||||
|
||||
QStringList dirFilter;
|
||||
dirFilter << QString("*%1*").arg(name);
|
||||
@@ -109,8 +124,57 @@ QIcon FilePath::icon(const QString& category, const QString& name, bool fromThem
|
||||
return icon;
|
||||
}
|
||||
|
||||
QIcon FilePath::onOffIcon(const QString& category, const QString& name)
|
||||
{
|
||||
QString combinedName = category + "/" + name;
|
||||
QString cacheName = "onoff/" + combinedName;
|
||||
|
||||
QIcon icon = m_iconCache.value(cacheName);
|
||||
|
||||
if (!icon.isNull()) {
|
||||
return icon;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
QIcon::State state;
|
||||
QString stateName;
|
||||
|
||||
if (i == 0) {
|
||||
state = QIcon::Off;
|
||||
stateName = "off";
|
||||
}
|
||||
else {
|
||||
state = QIcon::On;
|
||||
stateName = "on";
|
||||
}
|
||||
|
||||
QList<int> pngSizes;
|
||||
pngSizes << 16 << 22 << 24 << 32 << 48 << 64 << 128;
|
||||
QString filename;
|
||||
Q_FOREACH (int size, pngSizes) {
|
||||
filename = QString("%1/icons/application/%2x%2/%3-%4.png").arg(m_dataPath, QString::number(size),
|
||||
combinedName, stateName);
|
||||
if (QFile::exists(filename)) {
|
||||
icon.addFile(filename, QSize(size, size), QIcon::Normal, state);
|
||||
}
|
||||
}
|
||||
filename = QString("%1/icons/application/scalable/%3-%4.svgz").arg(m_dataPath, combinedName, stateName);
|
||||
if (QFile::exists(filename)) {
|
||||
icon.addFile(filename, QSize(), QIcon::Normal, state);
|
||||
}
|
||||
}
|
||||
|
||||
m_iconCache.insert(cacheName, icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
FilePath::FilePath()
|
||||
{
|
||||
const QString appDirPath = QCoreApplication::applicationDirPath();
|
||||
bool isDataDirAbsolute = QDir::isAbsolutePath(KEEPASSX_DATA_DIR);
|
||||
Q_UNUSED(isDataDirAbsolute);
|
||||
|
||||
if (false) {
|
||||
}
|
||||
#ifdef QT_DEBUG
|
||||
@@ -118,15 +182,19 @@ FilePath::FilePath()
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
|
||||
else if (testSetDir(QCoreApplication::applicationDirPath() + "/../share/keepassx")) {
|
||||
else if (isDataDirAbsolute && testSetDir(KEEPASSX_DATA_DIR)) {
|
||||
}
|
||||
else if (!isDataDirAbsolute && testSetDir(QString("%1/../%2").arg(appDirPath, KEEPASSX_DATA_DIR))) {
|
||||
}
|
||||
else if (!isDataDirAbsolute && testSetDir(QString("%1/%2").arg(KEEPASSX_PREFIX_DIR, KEEPASSX_DATA_DIR))) {
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
else if (testSetDir(QCoreApplication::applicationDirPath() + "/../Resources")) {
|
||||
else if (testSetDir(appDirPath + "/../Resources")) {
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
else if (testSetDir(QCoreApplication::applicationDirPath() + "/share")) {
|
||||
else if (testSetDir(appDirPath + "/share")) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#ifndef KEEPASSX_FILEPATH_H
|
||||
#define KEEPASSX_FILEPATH_H
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QString>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QHash>
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
QString pluginPath(const QString& name);
|
||||
QIcon applicationIcon();
|
||||
QIcon icon(const QString& category, const QString& name, bool fromTheme = true);
|
||||
QIcon onOffIcon(const QString& category, const QString& name);
|
||||
|
||||
static FilePath* instance();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
// mostly copied from qcompilerdetection.h which is part of Qt 5
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtGlobal>
|
||||
|
||||
#ifdef Q_CC_CLANG
|
||||
# if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
@@ -125,7 +125,11 @@ template <> class QStaticAssertFailure<true> {};
|
||||
# define KEEPASSX_EXPORT Q_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define KEEPASSX_EXPORT
|
||||
# define KEEPASSX_EXPORT Q_DECL_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef QUINT32_MAX
|
||||
#define QUINT32_MAX 4294967295U
|
||||
#endif
|
||||
|
||||
#endif // KEEPASSX_GLOBAL_H
|
||||
|
||||
@@ -26,12 +26,12 @@ const int Group::DefaultIconNumber = 48;
|
||||
const int Group::RecycleBinIconNumber = 43;
|
||||
|
||||
Group::Group()
|
||||
: m_iconNumber(DefaultIconNumber)
|
||||
, m_isExpanded(true)
|
||||
, m_autoTypeEnabled(Inherit)
|
||||
, m_searchingEnabled(Inherit)
|
||||
, m_updateTimeinfo(true)
|
||||
: m_updateTimeinfo(true)
|
||||
{
|
||||
m_data.iconNumber = DefaultIconNumber;
|
||||
m_data.isExpanded = true;
|
||||
m_data.autoTypeEnabled = Inherit;
|
||||
m_data.searchingEnabled = Inherit;
|
||||
}
|
||||
|
||||
Group::~Group()
|
||||
@@ -84,8 +84,8 @@ template <class P, class V> inline bool Group::set(P& property, const V& value)
|
||||
void Group::updateTimeinfo()
|
||||
{
|
||||
if (m_updateTimeinfo) {
|
||||
m_timeInfo.setLastModificationTime(Tools::currentDateTimeUtc());
|
||||
m_timeInfo.setLastAccessTime(Tools::currentDateTimeUtc());
|
||||
m_data.timeInfo.setLastModificationTime(Tools::currentDateTimeUtc());
|
||||
m_data.timeInfo.setLastAccessTime(Tools::currentDateTimeUtc());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,35 +101,42 @@ Uuid Group::uuid() const
|
||||
|
||||
QString Group::name() const
|
||||
{
|
||||
return m_name;
|
||||
return m_data.name;
|
||||
}
|
||||
|
||||
QString Group::notes() const
|
||||
{
|
||||
return m_notes;
|
||||
return m_data.notes;
|
||||
}
|
||||
|
||||
QImage Group::icon() const
|
||||
{
|
||||
if (m_customIcon.isNull()) {
|
||||
return databaseIcons()->icon(m_iconNumber);
|
||||
if (m_data.customIcon.isNull()) {
|
||||
return databaseIcons()->icon(m_data.iconNumber);
|
||||
}
|
||||
else {
|
||||
// TODO: check if m_db is 0
|
||||
return m_db->metadata()->customIcon(m_customIcon);
|
||||
Q_ASSERT(m_db);
|
||||
|
||||
if (m_db) {
|
||||
return m_db->metadata()->customIcon(m_data.customIcon);
|
||||
}
|
||||
else {
|
||||
return QImage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap Group::iconPixmap() const
|
||||
{
|
||||
if (m_customIcon.isNull()) {
|
||||
return databaseIcons()->iconPixmap(m_iconNumber);
|
||||
if (m_data.customIcon.isNull()) {
|
||||
return databaseIcons()->iconPixmap(m_data.iconNumber);
|
||||
}
|
||||
else {
|
||||
Q_ASSERT(m_db);
|
||||
|
||||
QPixmap pixmap;
|
||||
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
|
||||
// TODO: check if m_db is 0
|
||||
pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_customIcon));
|
||||
if (m_db && !QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
|
||||
pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_data.customIcon));
|
||||
m_pixmapCacheKey = QPixmapCache::insert(pixmap);
|
||||
}
|
||||
|
||||
@@ -139,37 +146,37 @@ QPixmap Group::iconPixmap() const
|
||||
|
||||
int Group::iconNumber() const
|
||||
{
|
||||
return m_iconNumber;
|
||||
return m_data.iconNumber;
|
||||
}
|
||||
|
||||
Uuid Group::iconUuid() const
|
||||
{
|
||||
return m_customIcon;
|
||||
return m_data.customIcon;
|
||||
}
|
||||
|
||||
TimeInfo Group::timeInfo() const
|
||||
{
|
||||
return m_timeInfo;
|
||||
return m_data.timeInfo;
|
||||
}
|
||||
|
||||
bool Group::isExpanded() const
|
||||
{
|
||||
return m_isExpanded;
|
||||
return m_data.isExpanded;
|
||||
}
|
||||
|
||||
QString Group::defaultAutoTypeSequence() const
|
||||
{
|
||||
return m_defaultAutoTypeSequence;
|
||||
return m_data.defaultAutoTypeSequence;
|
||||
}
|
||||
|
||||
Group::TriState Group::autoTypeEnabled() const
|
||||
{
|
||||
return m_autoTypeEnabled;
|
||||
return m_data.autoTypeEnabled;
|
||||
}
|
||||
|
||||
Group::TriState Group::searchingEnabled() const
|
||||
{
|
||||
return m_searchingEnabled;
|
||||
return m_data.searchingEnabled;
|
||||
}
|
||||
|
||||
Entry* Group::lastTopVisibleEntry() const
|
||||
@@ -179,7 +186,7 @@ Entry* Group::lastTopVisibleEntry() const
|
||||
|
||||
bool Group::isExpired() const
|
||||
{
|
||||
return m_timeInfo.expires() && m_timeInfo.expiryTime() < Tools::currentDateTimeUtc();
|
||||
return m_data.timeInfo.expires() && m_data.timeInfo.expiryTime() < Tools::currentDateTimeUtc();
|
||||
}
|
||||
|
||||
void Group::setUuid(const Uuid& uuid)
|
||||
@@ -189,23 +196,23 @@ void Group::setUuid(const Uuid& uuid)
|
||||
|
||||
void Group::setName(const QString& name)
|
||||
{
|
||||
if (set(m_name, name)) {
|
||||
if (set(m_data.name, name)) {
|
||||
Q_EMIT dataChanged(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Group::setNotes(const QString& notes)
|
||||
{
|
||||
set(m_notes, notes);
|
||||
set(m_data.notes, notes);
|
||||
}
|
||||
|
||||
void Group::setIcon(int iconNumber)
|
||||
{
|
||||
Q_ASSERT(iconNumber >= 0);
|
||||
|
||||
if (m_iconNumber != iconNumber || !m_customIcon.isNull()) {
|
||||
m_iconNumber = iconNumber;
|
||||
m_customIcon = Uuid();
|
||||
if (m_data.iconNumber != iconNumber || !m_data.customIcon.isNull()) {
|
||||
m_data.iconNumber = iconNumber;
|
||||
m_data.customIcon = Uuid();
|
||||
|
||||
m_pixmapCacheKey = QPixmapCache::Key();
|
||||
|
||||
@@ -219,9 +226,9 @@ void Group::setIcon(const Uuid& uuid)
|
||||
{
|
||||
Q_ASSERT(!uuid.isNull());
|
||||
|
||||
if (m_customIcon != uuid) {
|
||||
m_customIcon = uuid;
|
||||
m_iconNumber = 0;
|
||||
if (m_data.customIcon != uuid) {
|
||||
m_data.customIcon = uuid;
|
||||
m_data.iconNumber = 0;
|
||||
|
||||
m_pixmapCacheKey = QPixmapCache::Key();
|
||||
|
||||
@@ -233,33 +240,31 @@ void Group::setIcon(const Uuid& uuid)
|
||||
|
||||
void Group::setTimeInfo(const TimeInfo& timeInfo)
|
||||
{
|
||||
m_timeInfo = timeInfo;
|
||||
m_data.timeInfo = timeInfo;
|
||||
}
|
||||
|
||||
void Group::setExpanded(bool expanded)
|
||||
{
|
||||
if (m_isExpanded != expanded) {
|
||||
m_isExpanded = expanded;
|
||||
if (m_data.isExpanded != expanded) {
|
||||
m_data.isExpanded = expanded;
|
||||
updateTimeinfo();
|
||||
if (config()->get("ModifiedOnExpandedStateChanges").toBool()) {
|
||||
Q_EMIT modified();
|
||||
}
|
||||
Q_EMIT modified();
|
||||
}
|
||||
}
|
||||
|
||||
void Group::setDefaultAutoTypeSequence(const QString& sequence)
|
||||
{
|
||||
set(m_defaultAutoTypeSequence, sequence);
|
||||
set(m_data.defaultAutoTypeSequence, sequence);
|
||||
}
|
||||
|
||||
void Group::setAutoTypeEnabled(TriState enable)
|
||||
{
|
||||
set(m_autoTypeEnabled, enable);
|
||||
set(m_data.autoTypeEnabled, enable);
|
||||
}
|
||||
|
||||
void Group::setSearchingEnabled(TriState enable)
|
||||
{
|
||||
set(m_searchingEnabled, enable);
|
||||
set(m_data.searchingEnabled, enable);
|
||||
}
|
||||
|
||||
void Group::setLastTopVisibleEntry(Entry* entry)
|
||||
@@ -269,8 +274,8 @@ void Group::setLastTopVisibleEntry(Entry* entry)
|
||||
|
||||
void Group::setExpires(bool value)
|
||||
{
|
||||
if (m_timeInfo.expires() != value) {
|
||||
m_timeInfo.setExpires(value);
|
||||
if (m_data.timeInfo.expires() != value) {
|
||||
m_data.timeInfo.setExpires(value);
|
||||
updateTimeinfo();
|
||||
Q_EMIT modified();
|
||||
}
|
||||
@@ -278,8 +283,8 @@ void Group::setExpires(bool value)
|
||||
|
||||
void Group::setExpiryTime(const QDateTime& dateTime)
|
||||
{
|
||||
if (m_timeInfo.expiryTime() != dateTime) {
|
||||
m_timeInfo.setExpiryTime(dateTime);
|
||||
if (m_data.timeInfo.expiryTime() != dateTime) {
|
||||
m_data.timeInfo.setExpiryTime(dateTime);
|
||||
updateTimeinfo();
|
||||
Q_EMIT modified();
|
||||
}
|
||||
@@ -347,7 +352,7 @@ void Group::setParent(Group* parent, int index)
|
||||
}
|
||||
|
||||
if (m_updateTimeinfo) {
|
||||
m_timeInfo.setLocationChanged(Tools::currentDateTimeUtc());
|
||||
m_data.timeInfo.setLocationChanged(Tools::currentDateTimeUtc());
|
||||
}
|
||||
|
||||
Q_EMIT modified();
|
||||
@@ -429,6 +434,20 @@ QList<const Group*> Group::groupsRecursive(bool includeSelf) const
|
||||
groupList.append(this);
|
||||
}
|
||||
|
||||
Q_FOREACH (const Group* group, m_children) {
|
||||
groupList.append(group->groupsRecursive(true));
|
||||
}
|
||||
|
||||
return groupList;
|
||||
}
|
||||
|
||||
QList<Group*> Group::groupsRecursive(bool includeSelf)
|
||||
{
|
||||
QList<Group*> groupList;
|
||||
if (includeSelf) {
|
||||
groupList.append(this);
|
||||
}
|
||||
|
||||
Q_FOREACH (Group* group, m_children) {
|
||||
groupList.append(group->groupsRecursive(true));
|
||||
}
|
||||
@@ -436,6 +455,63 @@ QList<const Group*> Group::groupsRecursive(bool includeSelf) const
|
||||
return groupList;
|
||||
}
|
||||
|
||||
QSet<Uuid> Group::customIconsRecursive() const
|
||||
{
|
||||
QSet<Uuid> result;
|
||||
|
||||
if (!iconUuid().isNull()) {
|
||||
result.insert(iconUuid());
|
||||
}
|
||||
|
||||
Q_FOREACH (Entry* entry, entriesRecursive(true)) {
|
||||
if (!entry->iconUuid().isNull()) {
|
||||
result.insert(entry->iconUuid());
|
||||
}
|
||||
}
|
||||
|
||||
Q_FOREACH (Group* group, m_children) {
|
||||
result.unite(group->customIconsRecursive());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Group* Group::clone(Entry::CloneFlags entryFlags) const
|
||||
{
|
||||
Group* clonedGroup = new Group();
|
||||
|
||||
clonedGroup->setUpdateTimeinfo(false);
|
||||
|
||||
clonedGroup->setUuid(Uuid::random());
|
||||
clonedGroup->m_data = m_data;
|
||||
|
||||
Q_FOREACH (Entry* entry, entries()) {
|
||||
Entry* clonedEntry = entry->clone(entryFlags);
|
||||
clonedEntry->setGroup(clonedGroup);
|
||||
}
|
||||
|
||||
Q_FOREACH (Group* groupChild, children()) {
|
||||
Group* clonedGroupChild = groupChild->clone();
|
||||
clonedGroupChild->setParent(clonedGroup);
|
||||
}
|
||||
|
||||
clonedGroup->setUpdateTimeinfo(true);
|
||||
|
||||
QDateTime now = Tools::currentDateTimeUtc();
|
||||
clonedGroup->m_data.timeInfo.setCreationTime(now);
|
||||
clonedGroup->m_data.timeInfo.setLastModificationTime(now);
|
||||
clonedGroup->m_data.timeInfo.setLastAccessTime(now);
|
||||
clonedGroup->m_data.timeInfo.setLocationChanged(now);
|
||||
|
||||
return clonedGroup;
|
||||
}
|
||||
|
||||
void Group::copyDataFrom(const Group* other)
|
||||
{
|
||||
m_data = other->m_data;
|
||||
m_lastTopVisibleEntry = other->m_lastTopVisibleEntry;
|
||||
}
|
||||
|
||||
void Group::addEntry(Entry* entry)
|
||||
{
|
||||
Q_ASSERT(entry);
|
||||
@@ -532,37 +608,35 @@ void Group::recCreateDelObjects()
|
||||
}
|
||||
}
|
||||
|
||||
QList<Entry*> Group::search(const QString& searchTerm, Qt::CaseSensitivity caseSensitivity,
|
||||
bool resolveInherit)
|
||||
bool Group::resolveSearchingEnabled() const
|
||||
{
|
||||
QList<Entry*> searchResult;
|
||||
if (includeInSearch(resolveInherit)) {
|
||||
Q_FOREACH (Entry* entry, m_entries) {
|
||||
if (entry->match(searchTerm, caseSensitivity)) {
|
||||
searchResult.append(entry);
|
||||
}
|
||||
}
|
||||
Q_FOREACH (Group* group, m_children) {
|
||||
searchResult.append(group->search(searchTerm, caseSensitivity, false));
|
||||
}
|
||||
}
|
||||
return searchResult;
|
||||
}
|
||||
|
||||
bool Group::includeInSearch(bool resolveInherit)
|
||||
{
|
||||
switch (m_searchingEnabled) {
|
||||
switch (m_data.searchingEnabled) {
|
||||
case Inherit:
|
||||
if (!m_parent) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (resolveInherit) {
|
||||
return m_parent->includeInSearch(true);
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return m_parent->resolveSearchingEnabled();
|
||||
}
|
||||
case Enable:
|
||||
return true;
|
||||
case Disable:
|
||||
return false;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Group::resolveAutoTypeEnabled() const
|
||||
{
|
||||
switch (m_data.autoTypeEnabled) {
|
||||
case Inherit:
|
||||
if (!m_parent) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return m_parent->resolveAutoTypeEnabled();
|
||||
}
|
||||
case Enable:
|
||||
return true;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#ifndef KEEPASSX_GROUP_H
|
||||
#define KEEPASSX_GROUP_H
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPixmapCache>
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QPixmapCache>
|
||||
#include <QPointer>
|
||||
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
@@ -35,6 +35,19 @@ class Group : public QObject
|
||||
public:
|
||||
enum TriState { Inherit, Enable, Disable };
|
||||
|
||||
struct GroupData
|
||||
{
|
||||
QString name;
|
||||
QString notes;
|
||||
int iconNumber;
|
||||
Uuid customIcon;
|
||||
TimeInfo timeInfo;
|
||||
bool isExpanded;
|
||||
QString defaultAutoTypeSequence;
|
||||
Group::TriState autoTypeEnabled;
|
||||
Group::TriState searchingEnabled;
|
||||
};
|
||||
|
||||
Group();
|
||||
~Group();
|
||||
|
||||
@@ -52,6 +65,8 @@ public:
|
||||
QString defaultAutoTypeSequence() const;
|
||||
Group::TriState autoTypeEnabled() const;
|
||||
Group::TriState searchingEnabled() const;
|
||||
bool resolveSearchingEnabled() const;
|
||||
bool resolveAutoTypeEnabled() const;
|
||||
Entry* lastTopVisibleEntry() const;
|
||||
bool isExpired() const;
|
||||
|
||||
@@ -86,9 +101,17 @@ public:
|
||||
const QList<Entry*>& entries() const;
|
||||
QList<Entry*> entriesRecursive(bool includeHistoryItems = false) const;
|
||||
QList<const Group*> groupsRecursive(bool includeSelf) const;
|
||||
|
||||
QList<Entry*> search(const QString& searchTerm, Qt::CaseSensitivity caseSensitivity,
|
||||
bool resolveInherit = true);
|
||||
QList<Group*> groupsRecursive(bool includeSelf);
|
||||
QSet<Uuid> customIconsRecursive() const;
|
||||
/**
|
||||
* Creates a duplicate of this group including all child entries and groups.
|
||||
* The exceptions are that the returned group doesn't have a parent group
|
||||
* and all TimeInfo attributes are set to the current time.
|
||||
* Note that you need to copy the custom icons manually when inserting the
|
||||
* new group into another database.
|
||||
*/
|
||||
Group* clone(Entry::CloneFlags entryFlags = Entry::CloneNewUuid | Entry::CloneResetTimeInfo) const;
|
||||
void copyDataFrom(const Group* other);
|
||||
|
||||
Q_SIGNALS:
|
||||
void dataChanged(Group* group);
|
||||
@@ -123,19 +146,10 @@ private:
|
||||
void cleanupParent();
|
||||
void recCreateDelObjects();
|
||||
void updateTimeinfo();
|
||||
bool includeInSearch(bool resolveInherit);
|
||||
|
||||
QPointer<Database> m_db;
|
||||
Uuid m_uuid;
|
||||
QString m_name;
|
||||
QString m_notes;
|
||||
int m_iconNumber;
|
||||
Uuid m_customIcon;
|
||||
TimeInfo m_timeInfo;
|
||||
bool m_isExpanded;
|
||||
QString m_defaultAutoTypeSequence;
|
||||
TriState m_autoTypeEnabled;
|
||||
TriState m_searchingEnabled;
|
||||
GroupData m_data;
|
||||
QPointer<Entry> m_lastTopVisibleEntry;
|
||||
QList<Group*> m_children;
|
||||
QList<Entry*> m_entries;
|
||||
|
||||
80
src/core/InactivityTimer.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Felix Geyer <debfx@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, either version 2 or (at your option)
|
||||
* version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "InactivityTimer.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
|
||||
InactivityTimer::InactivityTimer(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_timer(new QTimer(this))
|
||||
, m_active(false)
|
||||
{
|
||||
m_timer->setSingleShot(true);
|
||||
connect(m_timer, SIGNAL(timeout()), SLOT(timeout()));
|
||||
}
|
||||
|
||||
void InactivityTimer::setInactivityTimeout(int inactivityTimeout)
|
||||
{
|
||||
Q_ASSERT(inactivityTimeout > 0);
|
||||
|
||||
m_timer->setInterval(inactivityTimeout);
|
||||
}
|
||||
|
||||
void InactivityTimer::activate()
|
||||
{
|
||||
if (!m_active) {
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
m_active = true;
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
void InactivityTimer::deactivate()
|
||||
{
|
||||
qApp->removeEventFilter(this);
|
||||
m_active = false;
|
||||
m_timer->stop();
|
||||
}
|
||||
|
||||
bool InactivityTimer::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
const QEvent::Type type = event->type();
|
||||
|
||||
if ( (type >= QEvent::MouseButtonPress && type <= QEvent::KeyRelease)
|
||||
|| (type >= QEvent::HoverEnter && type <= QEvent::HoverMove)
|
||||
|| (type == QEvent::Wheel) ) {
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void InactivityTimer::timeout()
|
||||
{
|
||||
// make sure we don't emit the signal a second time while it's still processed
|
||||
if (!m_emitMutx.tryLock()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_active && !m_timer->isActive()) {
|
||||
Q_EMIT inactivityDetected();
|
||||
}
|
||||
|
||||
m_emitMutx.unlock();
|
||||
}
|
||||
53
src/core/InactivityTimer.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Felix Geyer <debfx@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, either version 2 or (at your option)
|
||||
* version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KEEPASSX_INACTIVITYTIMER_H
|
||||
#define KEEPASSX_INACTIVITYTIMER_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
class QTimer;
|
||||
|
||||
class InactivityTimer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InactivityTimer(QObject* parent = Q_NULLPTR);
|
||||
void setInactivityTimeout(int inactivityTimeout);
|
||||
void activate();
|
||||
void deactivate();
|
||||
|
||||
Q_SIGNALS:
|
||||
void inactivityDetected();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event);
|
||||
|
||||
private Q_SLOTS:
|
||||
void timeout();
|
||||
|
||||
private:
|
||||
QTimer* m_timer;
|
||||
bool m_active;
|
||||
QMutex m_emitMutx;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_INACTIVITYTIMER_H
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef KEEPASSX_LISTDELETER_H
|
||||
#define KEEPASSX_LISTDELETER_H
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QList>
|
||||
|
||||
template <typename T>
|
||||
class ListDeleter
|
||||
|
||||