Skip to content

Commit 34c80f2

Browse files
committed
Add support for tab encryption
Assisted-by: Claude Code Fixes #2617
1 parent 5bd157c commit 34c80f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3137
-433
lines changed

.claude/settings.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(cmake -B build *)",
5+
"Bash(build/copyq-tests *)",
6+
"Bash(build/copyq *)"
7+
]
8+
},
9+
"env": {
10+
"COPYQ_SESSION_NAME": "test",
11+
"COPYQ_SETTINGS_PATH": "build/copyq-test-conf",
12+
"COPYQ_ITEM_DATA_PATH": "build/copyq-test-data",
13+
"COPYQ_PLUGINS": "",
14+
"COPYQ_DEFAULT_ICON": "1",
15+
"COPYQ_SESSION_COLOR": "#f90",
16+
"COPYQ_THEME_PREFIX": "$PWD/shared/themes",
17+
"COPYQ_PASSWORD": "TEST123",
18+
"COPYQ_LOG_LEVEL": "DEBUG",
19+
"QT_LOGGING_RULES": "*.debug=true;qt.*.debug=false",
20+
"QT_QPA_PLATFORM": "minimal"
21+
}
22+
}

.github/workflows/build-linux.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ env:
4747
qt6-wayland
4848
qt6-wayland-dev
4949
qt6-wayland-dev-tools
50+
51+
libqca-qt6-dev
52+
libqca-qt6-2
53+
libqca-qt6-plugins
5054
qt5_packages: >-
5155
qtbase5-dev
5256
qtbase5-dev-tools
@@ -65,6 +69,10 @@ env:
6569
qtwayland5-dev-tools
6670
6771
libkf5notifications-dev
72+
73+
libqca-qt5-2-dev
74+
libqca-qt5-2
75+
libqca-qt5-2-plugins
6876
# FIXME: Sending signal to client process does not cause the process
6977
# to exit with non-zero code with GitHub Actions. Why?
7078
COPYQ_TESTS_SKIP_SIGNAL: '1'

.github/workflows/build-macos.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,11 @@ jobs:
7676
- name: Test
7777
working-directory: '${{runner.workspace}}/build/copyq/${{ matrix.cmake_preset }}'
7878
run: '${{github.workspace}}/utils/github/test-macos.sh'
79+
80+
- name: Upload crash reports
81+
if: failure()
82+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4
83+
with:
84+
name: 'crash-reports${{ matrix.bundle_suffix }}'
85+
path: '~/Library/Logs/DiagnosticReports/*'
86+
if-no-files-found: ignore

CLAUDE.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
## Commands
2+
3+
Always use the following environment variables for all `build/copyq` and
4+
`build/copyq-tests` commands:
5+
6+
export COPYQ_SESSION_NAME="test"
7+
export COPYQ_SETTINGS_PATH="build/copyq-test-conf"
8+
export COPYQ_ITEM_DATA_PATH="build/copyq-test-data"
9+
export COPYQ_PLUGINS=""
10+
export COPYQ_DEFAULT_ICON="1"
11+
export COPYQ_SESSION_COLOR="#f90"
12+
export COPYQ_THEME_PREFIX="$PWD/shared/themes"
13+
export COPYQ_PASSWORD="TEST123"
14+
export COPYQ_LOG_LEVEL="DEBUG"
15+
export QT_LOGGING_RULES="*.debug=true;qt.*.debug=false"
16+
export QT_QPA_PLATFORM="minimal"
17+
18+
Run CMake to configure build:
19+
20+
cmake -B build -G Ninja \
21+
-DCMAKE_BUILD_TYPE=Debug \
22+
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
23+
-DCMAKE_INSTALL_PREFIX=$PWD/build/install \
24+
-DCMAKE_CXX_FLAGS="-ggdb -fdiagnostics-color" \
25+
-DWITH_TESTS=ON \
26+
-DPEDANTIC=ON .
27+
28+
Build: `cmake -B build --build`
29+
30+
Install: `cmake -B build --target install`
31+
32+
Run tests after build: `build/copyq-tests $TEST_FUNCTIONS`
33+
34+
Run tests for specific plugin: `build/copyq-tests PLUGINS:sync $TEST_FUNCTIONS`
35+
36+
List tests function names: `build/copyq-tests -functions`
37+
38+
List tests function names for a plugin: `build/copyq-tests PLUGINS:image -functions`
39+
40+
Start the server process: `build/copyq`
41+
42+
In case any process exits with exit code 11 (SIGSEGV) use `coredumpctl` utility
43+
to find the root cause.
44+
45+
Stop the server process: `build/copyq exit`
46+
47+
List server and client logs (server process does not need to run): `build/copyq logs`
48+
49+
Run a script - requires server to be running:
50+
51+
build/copyq source script.js
52+
53+
# the above command is equivalent to
54+
build/copyq 'source("script.js")'
55+
56+
Scripting API documentation is in @docs/scripting-api.rst.
57+
58+
Useful scripts (omit the `tab(...)` call to use the default tab):
59+
60+
- `tab('TAB1'); add('ITEM')` - prepend ITEM text item to the TAB1 tab
61+
- `tab('TAB1'); size()` - item count in the TAB1 tab
62+
- `tab('TAB1'); read(0,1,2)` - read items at indexes 0, 1 and 2 in the TAB1 tab
63+
- `config()` - list configuration options with current value and description
64+
- `config('check_clipboard', 'false')` - set an option
65+
66+
## Project structure
67+
68+
- @plugins - code for various plugins build as dynamic modules loaded optionally by the app
69+
- @src - main app code
70+
- @src/app - wrappers for QCoreApplication object
71+
- @src/common - common functionality, client/server local socket handling, logging
72+
- @src/gui - GUI widgets and some helper modules
73+
- @src/item - tab and item data handling, serialization code
74+
- @src/platform - platform-specific code
75+
- @src/scriptable - scripting capabilities
76+
- @src/tests - tests for the main app
77+
- @src/ui - Qt widget definition files (XML)
78+
- @qxt - code to handle global system-wide shortcuts

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ OPTION(PEDANTIC "Enable all compiler warnings" OFF)
2323

2424
# Options (cmake -LH)
2525
OPTION(WITH_PLUGINS "Compile plugins" ON)
26+
OPTION(WITH_QCA_ENCRYPTION "Enable QCA-based tab encryption" ON)
2627

2728
add_definitions( -DQT_USE_STRINGBUILDER )
2829

@@ -60,6 +61,16 @@ endif()
6061

6162
list(APPEND copyq_LIBRARIES ${copyq_qt}::Widgets)
6263

64+
# QCA encryption support
65+
if (WITH_QCA_ENCRYPTION)
66+
find_package(Qca-qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED)
67+
list(APPEND copyq_LIBRARIES qca-qt${QT_DEFAULT_MAJOR_VERSION})
68+
add_definitions(-DWITH_QCA_ENCRYPTION)
69+
message(STATUS "QCA encryption support enabled")
70+
else()
71+
message(STATUS "QCA encryption support DISABLED")
72+
endif()
73+
6374
set(copyq_APP_ID com.github.hluk.copyq)
6475
set(copyq_ICON_PREFIX src/images/icon)
6576
set(copyq_ICON_NORMAL src/images/icon.svg)
@@ -73,7 +84,7 @@ set(copyq_MANPAGE debian/copyq.1)
7384
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
7485
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
7586
set(CMAKE_CXX_FLAGS_DEBUG
76-
"${CMAKE_CXX_FLAGS_DEBUG} -Wextra -Wall -pedantic -Wfloat-equal -Woverloaded-virtual -Wundef -Wno-inconsistent-missing-destructor-override")
87+
"${CMAKE_CXX_FLAGS_DEBUG} -Wextra -Wall -pedantic -Wfloat-equal -Woverloaded-virtual -Wundef -Wno-inconsistent-missing-destructor-override -Wno-variadic-macro-arguments-omitted")
7788
endif()
7889

7990
if (PEDANTIC)

CMakePresets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"installDir": "${sourceParentDir}/install/copyq/${presetName}",
99
"cacheVariables": {
1010
"WITH_TESTS": "TRUE",
11+
"WITH_QCA_ENCRYPTION": "TRUE",
1112
"PEDANTIC": "TRUE",
1213
"CMAKE_BUILD_TYPE": "Debug",
1314
"CMAKE_C_COMPILER_LAUNCHER": "ccache",

appveyor.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ environment:
1818
KF_BRANCH: stable
1919
KF_PATCH: 0
2020
SNORETOAST_VERSION: 0.9.0
21+
QCA_VERSION: 2.3.10
2122

2223
matrix:
2324
- QTDIR: /c/Qt/6.8/msvc2022_64
@@ -28,11 +29,13 @@ environment:
2829
BUILD_SUB_DIR: Release
2930
# https://wiki.qt.io/Qt_6.8_Tools_and_Versions
3031
# https://www.appveyor.com/docs/windows-images-software/#tools
31-
OPENSSL_PATH: /c/OpenSSL-v30-Win64/bin
32-
LIBSSL: libssl-3-x64.dll
33-
LIBCRYPTO: libcrypto-3-x64.dll
32+
LIBSSL: /c/OpenSSL-v30-Win64/bin/libssl-3-x64.dll
33+
LIBCRYPTO: /c/OpenSSL-v30-Win64/bin/libcrypto-3-x64.dll
34+
LIBSSL_FOR_QCA: /c/OpenSSL-Win64/bin/libssl-1_1-x64.dll
35+
LIBCRYPTO_FOR_QCA: /c/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll
3436
GPGPATH: /c/Program Files/Git/usr/bin
3537
WITH_NATIVE_NOTIFICATIONS: "ON"
38+
WITH_QCA_ENCRYPTION: "ON"
3639
WITH_QT6: "ON"
3740
WINDEPLOYQT_ARGS: >-
3841
--no-system-d3d-compiler

plugins/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ copyq_add_plugin_obj(copyq-plugin-common
5959
)
6060
copyq_add_plugin_obj(copyq-plugin-wrapper ../src/item/itemwidgetwrapper.cpp)
6161
copyq_add_plugin_obj(copyq-plugin-textdata ../src/common/textdata.cpp)
62+
copyq_add_plugin_obj(copyq-plugin-geometry ../src/gui/geometry.cpp)
6263
copyq_add_plugin_obj(copyq-plugin-screen ../src/gui/screen.cpp)
63-
copyq_add_plugin_obj(copyq-plugin-serialize ../src/item/serialize.cpp)
64+
copyq_add_plugin_obj(copyq-plugin-serialize
65+
../src/item/serialize.cpp
66+
../src/common/encryption.cpp
67+
)
6468
copyq_add_plugin_obj(copyq-plugin-config ../src/common/config.cpp)
6569
copyq_add_plugin_obj(copyq-plugin-iconfont ../src/gui/iconfont.cpp)
6670
copyq_add_plugin_obj(copyq-plugin-iconwidget ../src/gui/iconwidget.cpp)

plugins/itemimage/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
set(copyq_plugin_itemimage_SOURCES
2+
$<TARGET_OBJECTS:copyq-plugin-config>
23
$<TARGET_OBJECTS:copyq-plugin-serialize>
34
../../src/common/action.cpp
45
../../src/common/process.cpp

plugins/itemsync/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(copyq_plugin_itemsync_SOURCES
22
$<TARGET_OBJECTS:copyq-plugin-config>
3+
$<TARGET_OBJECTS:copyq-plugin-geometry>
34
$<TARGET_OBJECTS:copyq-plugin-iconfont>
45
$<TARGET_OBJECTS:copyq-plugin-iconwidget>
56
$<TARGET_OBJECTS:copyq-plugin-screen>

0 commit comments

Comments
 (0)