Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fcitx5-skk for openSUSE:Leap:16.0 checked in at 2025-07-15 17:54:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:16.0/fcitx5-skk (Old) and /work/SRC/openSUSE:Leap:16.0/.fcitx5-skk.new.7373 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fcitx5-skk" Tue Jul 15 17:54:57 2025 rev:2 rq:1293330 version:5.1.7 Changes: -------- --- /work/SRC/openSUSE:Leap:16.0/fcitx5-skk/fcitx5-skk.changes 2025-03-19 11:42:46.431774063 +0100 +++ /work/SRC/openSUSE:Leap:16.0/.fcitx5-skk.new.7373/fcitx5-skk.changes 2025-07-15 17:55:34.579696271 +0200 @@ -1,0 +2,31 @@ +Sun Jun 22 04:13:15 UTC 2025 - Marguerite Su <i...@marguerite.su> + +- update to 5.1.7 + * remove fcitx::getline usage + * interpret dictionary path starting with $XDG_DATA_DIRS + * update input panel on preedit clearing + * should always trigger ui update, no need to check last is empty + * port to StandardPaths and drop Qt5 +- upstream dropped qt5, move from _multibuild to single build + +------------------------------------------------------------------- +Wed Jan 29 07:17:14 UTC 2025 - Marguerite Su <i...@marguerite.su> + +- update to 5.1.6 + * use addon factory v2 + +------------------------------------------------------------------- +Sat Jan 11 11:44:47 UTC 2025 - Marguerite Su <i...@marguerite.su> + +- fix leap 15.6 build + * use g++-13 to workaround the <filesystem> include error + +------------------------------------------------------------------- +Sun Jan 5 08:12:32 UTC 2025 - Marguerite Su <i...@marguerite.su> + +- update to 5.1.5 + * translation update +- changes in 5.1.4 + * Rename icons to avoid XDG icon name fallback with breeze icon theme + +------------------------------------------------------------------- Old: ---- _multibuild fcitx5-skk-5.1.3.tar.zst New: ---- fcitx5-skk-5.1.7.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fcitx5-skk.spec ++++++ --- /var/tmp/diff_new_pack.5ZFfzD/_old 2025-07-15 17:55:34.803705627 +0200 +++ /var/tmp/diff_new_pack.5ZFfzD/_new 2025-07-15 17:55:34.803705627 +0200 @@ -1,7 +1,7 @@ # # spec file for package fcitx5-skk # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,42 +16,34 @@ # -%global flavor @BUILD_FLAVOR@%{nil} -%global sname fcitx5-skk -%if "%{flavor}" == "" -%global pname %sname -%else -%global pname %{sname}-%{flavor} -%endif - -Name: %{pname} -Version: 5.1.3 +Name: fcitx5-skk +Version: 5.1.7 Release: 0 Summary: Libskk input method engine for Fcitx5 License: GPL-3.0-or-later +Group: System/I18n/Japanese URL: https://github.com/fcitx/fcitx5-skk -Source: https://download.fcitx-im.org/fcitx5/%{sname}/%{sname}-%{version}.tar.zst +Source: https://download.fcitx-im.org/fcitx5/%{name}/%{name}-%{version}.tar.zst BuildRequires: cmake BuildRequires: extra-cmake-modules BuildRequires: fcitx5-devel BuildRequires: fcitx5-qt-devel -BuildRequires: gcc-c++ BuildRequires: hicolor-icon-theme BuildRequires: libskk-devel BuildRequires: pkgconfig -%if "%{flavor}" == "" -BuildRequires: libqt5-qtbase-devel -Conflicts: %{sname}-qt6 -Provides: fcitx-skk = %{version} -Obsoletes: fcitx-skk <= 0.1.4 -%endif -%if "%{flavor}" == "qt6" BuildRequires: qt6-base-devel -Conflicts: %{sname} Supplements: (fcitx5 and skkdic and plasma6-workspace) +Provides: fcitx-skk = %{version} +Obsoletes: fcitx-skk <= 0.1.4 +Obsoletes: fcitx5-skk-qt6 <= 5.1.6 +%if 0%{?suse_version} >= 1550 +BuildRequires: gcc-c++ +%else +BuildRequires: gcc13-c++ %endif BuildRequires: zstd Requires: fcitx5 + %if 0%{?suse_version} <= 1520 BuildRequires: appstream-glib-devel %endif @@ -60,35 +52,29 @@ fcitx-skk is an input method engine for Fcitx, which uses libskk as its backend. %prep -%setup -q -n %{sname}-%{version} +%autosetup %build -%if "%{flavor}" == "qt6" +%if 0%{?suse_version} == 1500 +%cmake -DCMAKE_CXX_COMPILER=%{_bindir}/g++-13 +%else %cmake %endif -%if "%{flavor}" == "" -%cmake -DUSE_QT6=OFF -%endif %make_build %install %cmake_install -%find_lang %{sname} +%find_lang %{name} -%files -f %{sname}.lang +%files -f %{name}.lang %license LICENSES %doc README.md %{_fcitx5_libdir}/skk.so -%if "%{flavor}" == "" -%{_fcitx5_qt5dir}/libfcitx5-skk-config.so -%endif -%if "%{flavor}" == "qt6" -%{_fcitx5_qt6dir}/libfcitx5-skk-config.so -%endif +%{_libdir}/fcitx5/qt6/libfcitx5-skk-config.so %{_fcitx5_addondir}/skk.conf %{_fcitx5_imconfdir}/skk.conf %{_fcitx5_datadir}/skk -%{_datadir}/icons/hicolor/*/apps/fcitx-skk* -%{_datadir}/icons/hicolor/*/apps/org.fcitx.Fcitx5.fcitx-skk* +%{_datadir}/icons/hicolor/*/apps/fcitx_skk* +%{_datadir}/icons/hicolor/*/apps/org.fcitx.Fcitx5.fcitx_skk* %{_datadir}/metainfo/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml ++++++ fcitx5-skk-5.1.3.tar.zst -> fcitx5-skk-5.1.7.tar.zst ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/.github/workflows/check.yml new/fcitx5-skk-5.1.7/.github/workflows/check.yml --- old/fcitx5-skk-5.1.3/.github/workflows/check.yml 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/.github/workflows/check.yml 2025-06-16 08:26:11.000000000 +0200 @@ -1,5 +1,4 @@ name: CI - on: push: branches: @@ -7,10 +6,21 @@ pull_request: branches: - master - jobs: + clang-format: + name: Check clang-format + runs-on: ubuntu-latest + container: archlinux:latest + steps: + - name: Install dependencies + run: | + pacman -Syu --noconfirm git clang diffutils + git config --global --add safe.directory $GITHUB_WORKSPACE + - uses: actions/checkout@v4 + - uses: fcitx/github-actions@clang-format check: name: Build and test + needs: clang-format runs-on: ubuntu-latest container: archlinux:latest strategy: @@ -43,14 +53,8 @@ with: path: fcitx5 cmake-option: >- - -DENABLE_KEYBOARD=Off - -DENABLE_X11=Off - -DENABLE_WAYLAND=Off - -DENABLE_ENCHANT=Off - -DENABLE_DBUS=Off - -DENABLE_SERVER=Off - -DENABLE_EMOJI=Off - -DUSE_SYSTEMD=Off + -DENABLE_KEYBOARD=Off -DENABLE_X11=Off -DENABLE_WAYLAND=Off -DENABLE_ENCHANT=Off + -DENABLE_DBUS=Off -DENABLE_SERVER=Off -DENABLE_EMOJI=Off -DUSE_SYSTEMD=Off -DENABLE_TEST=Off - uses: actions/checkout@v4 with: repository: fcitx/fcitx5-qt @@ -61,9 +65,7 @@ repository: fcitx/fcitx5-qt path: fcitx5-qt cmake-option: >- - -DENABLE_QT4=Off - -DENABLE_QT5=Off - -DENABLE_QT6=On + -DENABLE_QT4=Off -DENABLE_QT5=Off -DENABLE_QT6=On - uses: actions/checkout@v4 with: path: fcitx5-skk diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/CMakeLists.txt new/fcitx5-skk-5.1.7/CMakeLists.txt --- old/fcitx5-skk-5.1.3/CMakeLists.txt 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/CMakeLists.txt 2025-06-16 08:26:11.000000000 +0200 @@ -1,20 +1,24 @@ cmake_minimum_required(VERSION 3.6.0) -project(fcitx5-skk VERSION 5.1.3) +project(fcitx5-skk VERSION 5.1.7) +set(REQUIRED_FCITX_VERSION 5.1.13) find_package(ECM 1.0.0 REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) option(ENABLE_QT "Enable Qt for GUI configuration" On) -option(USE_QT6 "Build against Qt6" On) include(ECMUninstallTarget) include(FeatureSummary) find_package(PkgConfig REQUIRED) -find_package(Fcitx5Core 5.0.6 REQUIRED) +find_package(Fcitx5Core ${REQUIRED_FCITX_VERSION} REQUIRED) find_package(Gettext REQUIRED) pkg_check_modules(GObject2 IMPORTED_TARGET "gobject-2.0" REQUIRED) find_package(LibSKK REQUIRED) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake") set(SKK_DEFAULT_PATH "/usr/share/skk/SKK-JISYO.L" CACHE STRING "Default path of SKK") @@ -22,14 +26,9 @@ include(GNUInstallDirs) if (ENABLE_QT) -if (USE_QT6) - set(QT_MAJOR_VERSION 6) - find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) -else() - set(QT_MAJOR_VERSION 5) - find_package(Qt5 5.7 REQUIRED COMPONENTS Core Gui Widgets) -endif() -find_package(Fcitx5Qt${QT_MAJOR_VERSION}WidgetsAddons REQUIRED) + set(QT_MAJOR_VERSION 6) + find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) + find_package(Fcitx5Qt${QT_MAJOR_VERSION}WidgetsAddons REQUIRED) endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/16x16/apps/fcitx-skk.png new/fcitx5-skk-5.1.7/data/16x16/apps/fcitx-skk.png --- old/fcitx5-skk-5.1.3/data/16x16/apps/fcitx-skk.png 2025-07-15 17:55:34.871708468 +0200 +++ new/fcitx5-skk-5.1.7/data/16x16/apps/fcitx-skk.png 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to org.fcitx.Fcitx5.fcitx-skk.png diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/16x16/apps/fcitx_skk.png new/fcitx5-skk-5.1.7/data/16x16/apps/fcitx_skk.png --- old/fcitx5-skk-5.1.3/data/16x16/apps/fcitx_skk.png 1970-01-01 01:00:00.000000000 +0100 +++ new/fcitx5-skk-5.1.7/data/16x16/apps/fcitx_skk.png 2025-07-15 17:55:34.911710138 +0200 @@ -0,0 +1 @@ +symbolic link to org.fcitx.Fcitx5.fcitx_skk.png Binary files old/fcitx5-skk-5.1.3/data/16x16/apps/org.fcitx.Fcitx5.fcitx-skk.png and new/fcitx5-skk-5.1.7/data/16x16/apps/org.fcitx.Fcitx5.fcitx-skk.png differ Binary files old/fcitx5-skk-5.1.3/data/16x16/apps/org.fcitx.Fcitx5.fcitx_skk.png and new/fcitx5-skk-5.1.7/data/16x16/apps/org.fcitx.Fcitx5.fcitx_skk.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/22x22/apps/fcitx-skk.png new/fcitx5-skk-5.1.7/data/22x22/apps/fcitx-skk.png --- old/fcitx5-skk-5.1.3/data/22x22/apps/fcitx-skk.png 2025-07-15 17:55:34.903709804 +0200 +++ new/fcitx5-skk-5.1.7/data/22x22/apps/fcitx-skk.png 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to org.fcitx.Fcitx5.fcitx-skk.png diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/22x22/apps/fcitx_skk.png new/fcitx5-skk-5.1.7/data/22x22/apps/fcitx_skk.png --- old/fcitx5-skk-5.1.3/data/22x22/apps/fcitx_skk.png 1970-01-01 01:00:00.000000000 +0100 +++ new/fcitx5-skk-5.1.7/data/22x22/apps/fcitx_skk.png 2025-07-15 17:55:34.943711475 +0200 @@ -0,0 +1 @@ +symbolic link to org.fcitx.Fcitx5.fcitx_skk.png Binary files old/fcitx5-skk-5.1.3/data/22x22/apps/org.fcitx.Fcitx5.fcitx-skk.png and new/fcitx5-skk-5.1.7/data/22x22/apps/org.fcitx.Fcitx5.fcitx-skk.png differ Binary files old/fcitx5-skk-5.1.3/data/22x22/apps/org.fcitx.Fcitx5.fcitx_skk.png and new/fcitx5-skk-5.1.7/data/22x22/apps/org.fcitx.Fcitx5.fcitx_skk.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/24x24/apps/fcitx-skk.png new/fcitx5-skk-5.1.7/data/24x24/apps/fcitx-skk.png --- old/fcitx5-skk-5.1.3/data/24x24/apps/fcitx-skk.png 2025-07-15 17:55:34.875708635 +0200 +++ new/fcitx5-skk-5.1.7/data/24x24/apps/fcitx-skk.png 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to org.fcitx.Fcitx5.fcitx-skk.png diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/24x24/apps/fcitx_skk.png new/fcitx5-skk-5.1.7/data/24x24/apps/fcitx_skk.png --- old/fcitx5-skk-5.1.3/data/24x24/apps/fcitx_skk.png 1970-01-01 01:00:00.000000000 +0100 +++ new/fcitx5-skk-5.1.7/data/24x24/apps/fcitx_skk.png 2025-07-15 17:55:34.919710472 +0200 @@ -0,0 +1 @@ +symbolic link to org.fcitx.Fcitx5.fcitx_skk.png Binary files old/fcitx5-skk-5.1.3/data/24x24/apps/org.fcitx.Fcitx5.fcitx-skk.png and new/fcitx5-skk-5.1.7/data/24x24/apps/org.fcitx.Fcitx5.fcitx-skk.png differ Binary files old/fcitx5-skk-5.1.3/data/24x24/apps/org.fcitx.Fcitx5.fcitx_skk.png and new/fcitx5-skk-5.1.7/data/24x24/apps/org.fcitx.Fcitx5.fcitx_skk.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/48x48/apps/fcitx-skk.png new/fcitx5-skk-5.1.7/data/48x48/apps/fcitx-skk.png --- old/fcitx5-skk-5.1.3/data/48x48/apps/fcitx-skk.png 2025-07-15 17:55:34.895709470 +0200 +++ new/fcitx5-skk-5.1.7/data/48x48/apps/fcitx-skk.png 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to org.fcitx.Fcitx5.fcitx-skk.png diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/48x48/apps/fcitx_skk.png new/fcitx5-skk-5.1.7/data/48x48/apps/fcitx_skk.png --- old/fcitx5-skk-5.1.3/data/48x48/apps/fcitx_skk.png 1970-01-01 01:00:00.000000000 +0100 +++ new/fcitx5-skk-5.1.7/data/48x48/apps/fcitx_skk.png 2025-07-15 17:55:34.935711141 +0200 @@ -0,0 +1 @@ +symbolic link to org.fcitx.Fcitx5.fcitx_skk.png Binary files old/fcitx5-skk-5.1.3/data/48x48/apps/org.fcitx.Fcitx5.fcitx-skk.png and new/fcitx5-skk-5.1.7/data/48x48/apps/org.fcitx.Fcitx5.fcitx-skk.png differ Binary files old/fcitx5-skk-5.1.3/data/48x48/apps/org.fcitx.Fcitx5.fcitx_skk.png and new/fcitx5-skk-5.1.7/data/48x48/apps/org.fcitx.Fcitx5.fcitx_skk.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/64x64/apps/fcitx-skk.png new/fcitx5-skk-5.1.7/data/64x64/apps/fcitx-skk.png --- old/fcitx5-skk-5.1.3/data/64x64/apps/fcitx-skk.png 2025-07-15 17:55:34.883708969 +0200 +++ new/fcitx5-skk-5.1.7/data/64x64/apps/fcitx-skk.png 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to org.fcitx.Fcitx5.fcitx-skk.png diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/data/64x64/apps/fcitx_skk.png new/fcitx5-skk-5.1.7/data/64x64/apps/fcitx_skk.png --- old/fcitx5-skk-5.1.3/data/64x64/apps/fcitx_skk.png 1970-01-01 01:00:00.000000000 +0100 +++ new/fcitx5-skk-5.1.7/data/64x64/apps/fcitx_skk.png 2025-07-15 17:55:34.927710807 +0200 @@ -0,0 +1 @@ +symbolic link to org.fcitx.Fcitx5.fcitx_skk.png Binary files old/fcitx5-skk-5.1.3/data/64x64/apps/org.fcitx.Fcitx5.fcitx-skk.png and new/fcitx5-skk-5.1.7/data/64x64/apps/org.fcitx.Fcitx5.fcitx-skk.png differ Binary files old/fcitx5-skk-5.1.3/data/64x64/apps/org.fcitx.Fcitx5.fcitx_skk.png and new/fcitx5-skk-5.1.7/data/64x64/apps/org.fcitx.Fcitx5.fcitx_skk.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/gui/adddictdialog.cpp new/fcitx5-skk-5.1.7/gui/adddictdialog.cpp --- old/fcitx5-skk-5.1.3/gui/adddictdialog.cpp 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/gui/adddictdialog.cpp 2025-06-16 08:26:11.000000000 +0200 @@ -6,11 +6,24 @@ */ #include "adddictdialog.h" +#include <memory> +#include <QComboBox> #include <QDebug> +#include <QDialogButtonBox> +#include <QDir> #include <QFileDialog> -#include <fcitx-utils/standardpath.h> +#include <QFileInfo> +#include <QLabel> +#include <QLineEdit> +#include <QPushButton> +#include <QSpinBox> +#include <QWidget> +#include <fcitx-utils/fs.h> +#include <fcitx-utils/i18n.h> +#include <fcitx-utils/standardpaths.h> #include <fcitxqti18nhelper.h> #include "config.h" +#include "ui_adddictdialog.h" #define FCITX_CONFIG_DIR "$FCITX_CONFIG_DIR" @@ -104,9 +117,9 @@ path = QFileDialog::getOpenFileName(this, _("Select Dictionary File"), info.path()); } else { - auto fcitxBasePath = stringutils::joinPath( - StandardPath::global().userDirectory(StandardPath::Type::PkgData), - "skk"); + auto fcitxBasePath = + StandardPaths::global().userDirectory(StandardPathsType::PkgData) / + "skk"; fs::makePath(fcitxBasePath); QString basePath = QDir::cleanPath(QString::fromStdString(fcitxBasePath)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/gui/dictmodel.cpp new/fcitx5-skk-5.1.7/gui/dictmodel.cpp --- old/fcitx5-skk-5.1.3/gui/dictmodel.cpp 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/gui/dictmodel.cpp 2025-06-16 08:26:11.000000000 +0200 @@ -5,16 +5,18 @@ * */ +#include "dictmodel.h" +#include <QAbstractListModel> +#include <QByteArray> #include <QDebug> #include <QFile> +#include <QObject> #include <QSet> #include <QStringList> #include <QTemporaryFile> +#include <Qt> #include <QtGlobal> -#include <fcitx-utils/standardpath.h> - -#include <fcntl.h> -#include "dictmodel.h" +#include <fcitx-utils/standardpaths.h> namespace fcitx { @@ -28,17 +30,16 @@ } void SkkDictModel::defaults() { - auto path = - StandardPath::global().fcitxPath("pkgdatadir", "skk/dictionary_list"); - QFile f(path.data()); + auto path = StandardPaths::fcitxPath("pkgdatadir", "skk/dictionary_list"); + QFile f(path); if (f.open(QIODevice::ReadOnly)) { load(f); } } void SkkDictModel::load() { - auto file = StandardPath::global().open(StandardPath::Type::PkgData, - "skk/dictionary_list", O_RDONLY); + auto file = StandardPaths::global().open(StandardPathsType::PkgData, + "skk/dictionary_list"); if (file.fd() < 0) { return; } @@ -66,7 +67,7 @@ bool failed = false; QMap<QString, QString> dict; - Q_FOREACH (const QString &item, items) { + for (const QString &item : items) { if (!item.contains('=')) { failed = true; break; @@ -89,18 +90,18 @@ } bool SkkDictModel::save() { - return StandardPath::global().safeSave( - StandardPath::Type::PkgData, "skk/dictionary_list", [this](int fd) { + return StandardPaths::global().safeSave( + StandardPathsType::PkgData, "skk/dictionary_list", [this](int fd) { QFile tempFile; if (!tempFile.open(fd, QIODevice::WriteOnly)) { return false; } - typedef QMap<QString, QString> DictType; + using DictType = QMap<QString, QString>; - Q_FOREACH (const DictType &dict, m_dicts) { + for (const DictType &dict : m_dicts) { bool first = true; - Q_FOREACH (const QString &key, dict.keys()) { + for (const QString &key : dict.keys()) { if (first) { first = false; } else { @@ -141,11 +142,11 @@ QVariant SkkDictModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { - return QVariant(); + return {}; } if (index.row() >= m_dicts.size() || index.column() != 0) { - return QVariant(); + return {}; } switch (role) { @@ -156,18 +157,16 @@ return QString("%1:%2").arg(m_dicts[index.row()]["host"], m_dicts[index.row()]["port"]); } + default: + break; } - return QVariant(); + return {}; } bool SkkDictModel::moveUp(const QModelIndex ¤tIndex) { if (currentIndex.row() > 0 && currentIndex.row() < m_dicts.size()) { beginResetModel(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) - m_dicts.swap(currentIndex.row() - 1, currentIndex.row()); -#else m_dicts.swapItemsAt(currentIndex.row() - 1, currentIndex.row()); -#endif endResetModel(); return true; } @@ -177,11 +176,7 @@ bool SkkDictModel::moveDown(const QModelIndex ¤tIndex) { if (currentIndex.row() >= 0 && currentIndex.row() + 1 < m_dicts.size()) { beginResetModel(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 13, 0)) - m_dicts.swap(currentIndex.row() + 1, currentIndex.row()); -#else m_dicts.swapItemsAt(currentIndex.row() + 1, currentIndex.row()); -#endif endResetModel(); return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/gui/dictwidget.cpp new/fcitx5-skk-5.1.7/gui/dictwidget.cpp --- old/fcitx5-skk-5.1.3/gui/dictwidget.cpp 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/gui/dictwidget.cpp 2025-06-16 08:26:11.000000000 +0200 @@ -6,12 +6,21 @@ */ #include "dictwidget.h" #include <fcntl.h> +#include <memory> +#include <QDialog> +#include <QItemSelectionModel> +#include <QPushButton> +#include <QString> +#include <QWidget> #include <fcitx-utils/fs.h> -#include <fcitx-utils/standardpath.h> +#include <fcitx-utils/i18n.h> +#include <fcitx-utils/standardpaths.h> #include <fcitx-utils/stringutils.h> +#include <fcitxqtconfiguiwidget.h> #include <fcitxqti18nhelper.h> #include "adddictdialog.h" #include "dictmodel.h" +#include "ui_dictwidget.h" namespace fcitx { @@ -20,9 +29,9 @@ m_ui(std::make_unique<Ui::SkkDictWidget>()) { m_ui->setupUi(this); m_dictModel = new SkkDictModel(this); - auto fcitxBasePath = stringutils::joinPath( - StandardPath::global().userDirectory(StandardPath::Type::PkgData), - "skk"); + auto fcitxBasePath = + StandardPaths::global().userDirectory(StandardPathsType::PkgData) / + "skk"; fs::makePath(fcitxBasePath); m_ui->dictionaryView->setModel(m_dictModel); @@ -47,12 +56,12 @@ void SkkDictWidget::load() { m_dictModel->load(); - emit changed(false); + Q_EMIT changed(false); } void SkkDictWidget::save() { m_dictModel->save(); - emit changed(false); + Q_EMIT changed(false); } void SkkDictWidget::addDictClicked() { @@ -60,19 +69,19 @@ int result = dialog.exec(); if (result == QDialog::Accepted) { m_dictModel->add(dialog.dictionary()); - emit changed(true); + Q_EMIT changed(true); } } void SkkDictWidget::defaultDictClicked() { m_dictModel->defaults(); - emit changed(true); + Q_EMIT changed(true); } void SkkDictWidget::removeDictClicked() { if (m_ui->dictionaryView->currentIndex().isValid()) { m_dictModel->removeRow(m_ui->dictionaryView->currentIndex().row()); - emit changed(true); + Q_EMIT changed(true); } } @@ -81,7 +90,7 @@ if (m_dictModel->moveUp(m_ui->dictionaryView->currentIndex())) { m_ui->dictionaryView->selectionModel()->setCurrentIndex( m_dictModel->index(row - 1), QItemSelectionModel::ClearAndSelect); - emit changed(true); + Q_EMIT changed(true); } } @@ -90,7 +99,7 @@ if (m_dictModel->moveDown(m_ui->dictionaryView->currentIndex())) { m_ui->dictionaryView->selectionModel()->setCurrentIndex( m_dictModel->index(row + 1), QItemSelectionModel::ClearAndSelect); - emit changed(true); + Q_EMIT changed(true); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in new/fcitx5-skk-5.1.7/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in --- old/fcitx5-skk-5.1.3/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in 2025-06-16 08:26:11.000000000 +0200 @@ -14,6 +14,10 @@ <url type="vcs-browser">https://github.com/fcitx/fcitx5-skk</url> <project_group>Fcitx</project_group> <releases> + <release version="5.1.7" date="2025-06-15"/> + <release version="5.1.6" date="2025-01-22"/> + <release version="5.1.5" date="2024-10-08"/> + <release version="5.1.4" date="2024-05-30"/> <release version="5.1.3" date="2024-04-22"/> <release version="5.1.2" date="2024-02-28"/> <release version="5.1.1" date="2024-01-02"/> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/po/ru.po new/fcitx5-skk-5.1.7/po/ru.po --- old/fcitx5-skk-5.1.3/po/ru.po 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/po/ru.po 2025-06-16 08:26:11.000000000 +0200 @@ -4,15 +4,15 @@ # # Translators: # csslayer <wen...@gmail.com>, 2020 -# Dmitry <dmitrydmitry...@gmail.com>, 2023 +# Dmitry <dmitrydmitry...@gmail.com>, 2024 # msgid "" msgstr "" "Project-Id-Version: fcitx5-skk\n" "Report-Msgid-Bugs-To: fcitx-...@googlegroups.com\n" -"POT-Creation-Date: 2023-07-22 20:24+0000\n" +"POT-Creation-Date: 2024-05-31 20:25+0000\n" "PO-Revision-Date: 2020-05-22 22:25+0000\n" -"Last-Translator: Dmitry <dmitrydmitry...@gmail.com>, 2023\n" +"Last-Translator: Dmitry <dmitrydmitry...@gmail.com>, 2024\n" "Language-Team: Russian (https://app.transifex.com/fcitx/teams/12005/ru/)\n" "Language: ru\n" "MIME-Version: 1.0\n" @@ -70,7 +70,7 @@ #: src/skk.h:88 msgid "Candidate Key" -msgstr "Ключ-кандидат" +msgstr "Ключевое слово-кандидат" #: src/skk.h:80 msgid "Candidate Layout" @@ -78,11 +78,11 @@ #: src/skk.h:99 msgid "Candidates Page Down" -msgstr "Страница кандидатов вниз" +msgstr "Слово-кандидат на следующей странице" #: src/skk.h:93 msgid "Candidates Page Up" -msgstr "Страница кандидатов вверх" +msgstr "Слово-кандидат на предыдущей странице" #: src/skk.h:111 msgid "Cursor Down" @@ -177,7 +177,8 @@ #: src/skk.h:116 msgid "Number candidate of Triggers To Show Candidate Window" -msgstr "Число переключений кандидатов для отображения окна кандидатов" +msgstr "" +"Количество нажатий клавиш, которые запускают отображение окна слова-кандидата" #: src/skk.h:77 msgid "Page size" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/po/vi.po new/fcitx5-skk-5.1.7/po/vi.po --- old/fcitx5-skk-5.1.3/po/vi.po 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/po/vi.po 2025-06-16 08:26:11.000000000 +0200 @@ -3,16 +3,16 @@ # This file is distributed under the same license as the fcitx5-skk package. # # Translators: -# csslayer <wen...@gmail.com>, 2020 +# hoanghuy309 <hoanghuy...@gmail.com>, 2025 # msgid "" msgstr "" "Project-Id-Version: fcitx5-skk\n" "Report-Msgid-Bugs-To: fcitx-...@googlegroups.com\n" -"POT-Creation-Date: 2022-06-17 20:23+0000\n" +"POT-Creation-Date: 2025-04-22 20:25+0000\n" "PO-Revision-Date: 2020-05-22 22:25+0000\n" -"Last-Translator: csslayer <wen...@gmail.com>, 2020\n" -"Language-Team: Vietnamese (https://www.transifex.com/fcitx/teams/12005/vi/)\n" +"Last-Translator: hoanghuy309 <hoanghuy...@gmail.com>, 2025\n" +"Language-Team: Vietnamese (https://app.transifex.com/fcitx/teams/12005/vi/)\n" "Language: vi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -45,7 +45,7 @@ #: rc.cpp:36 #, kde-format msgid "&Port:" -msgstr "" +msgstr "Cổng:" #. i18n: file: gui/dictwidget.ui:98 #. i18n: ectx: property (text), widget (QToolButton, defaultDictButton) @@ -61,31 +61,31 @@ msgid "&Type:" msgstr "" -#: src/skk.h:32 +#: src/skk.h:44 msgid "ABC (a,b,c,...)" msgstr "" -#: src/skk.h:88 +#: src/skk.h:100 msgid "Candidate Key" msgstr "" -#: src/skk.h:80 +#: src/skk.h:92 msgid "Candidate Layout" msgstr "" -#: src/skk.h:99 +#: src/skk.h:111 msgid "Candidates Page Down" msgstr "" -#: src/skk.h:93 +#: src/skk.h:105 msgid "Candidates Page Up" msgstr "" -#: src/skk.h:111 +#: src/skk.h:123 msgid "Cursor Down" -msgstr "" +msgstr "Con Trỏ Xuống" -#: src/skk.h:105 +#: src/skk.h:117 msgid "Cursor Up" msgstr "" @@ -96,21 +96,21 @@ msgid "Dialog" msgstr "" -#: src/skk.h:118 +#: src/skk.h:130 msgid "Dictionary" msgstr "" #: gui/dictwidget.cpp:44 msgid "Dictionary Manager" -msgstr "" +msgstr "Trình Quản Lý Từ Điển" -#: src/skk.h:31 +#: src/skk.h:43 msgid "Digit (0,1,2,...)" msgstr "" -#: src/skk.cpp:69 +#: src/skk.cpp:103 msgid "Direct input" -msgstr "" +msgstr "Nhập trực tiếp" #. i18n: file: gui/adddictdialog.ui:126 #. i18n: ectx: property (text), widget (QLabel, encodingLabel) @@ -124,33 +124,33 @@ #: rc.cpp:3 #, kde-format msgid "Form" -msgstr "" +msgstr "Mẫu" -#: src/skk.cpp:66 src/skk.h:42 +#: src/skk.cpp:100 src/skk.h:54 msgid "Half width Katakana" msgstr "" -#: src/skk.cpp:64 src/skk.h:41 +#: src/skk.cpp:98 src/skk.h:53 msgid "Hiragana" msgstr "" -#: src/skk.h:36 +#: src/skk.h:48 msgid "Horizontal" -msgstr "" +msgstr "Nằm ngang" -#: src/skk.h:75 +#: src/skk.h:87 msgid "Initial Input Mode" -msgstr "" +msgstr "Kiểu Gõ Ban Đầu" -#: src/skk.h:38 +#: src/skk.h:50 msgid "Japanese" -msgstr "" +msgstr "Tiếng Nhật" -#: src/skk.cpp:65 src/skk.h:41 +#: src/skk.cpp:99 src/skk.h:53 msgid "Katakana" msgstr "" -#: src/skk.cpp:67 src/skk.h:38 src/skk.h:42 +#: src/skk.cpp:101 src/skk.h:50 src/skk.h:54 msgid "Latin" msgstr "" @@ -168,23 +168,23 @@ msgid "Move &Up" msgstr "" -#: src/skk.h:35 +#: src/skk.h:47 msgid "Not set" msgstr "" -#: src/skk.h:116 +#: src/skk.h:128 msgid "Number candidate of Triggers To Show Candidate Window" msgstr "" -#: src/skk.h:77 +#: src/skk.h:89 msgid "Page size" -msgstr "" +msgstr "Kích cỡ trang" -#: src/skk.h:72 +#: src/skk.h:84 msgid "Punctuation Style" msgstr "" -#: src/skk.h:33 +#: src/skk.h:45 msgid "Qwerty Center Row (a,s,d,...)" msgstr "" @@ -195,57 +195,56 @@ msgid "R&emove" msgstr "" -#: src/skk.h:84 +#: src/skk.h:96 msgid "Return-key does not insert new line on commit" msgstr "" -#: src/skk.h:70 +#: src/skk.h:82 msgid "Rule" -msgstr "" +msgstr "Quy tắc" -#: org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in:7 src/skk.conf.in:3 -#: src/skk-addon.conf.in.in:3 +#: org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in:7 src/skk.conf.in:2 +#: src/skk-addon.conf.in.in:2 msgid "SKK" msgstr "" -#: src/skk-addon.conf.in.in:4 -#, fuzzy +#: src/skk-addon.conf.in.in:3 msgid "SKK Input Method For Fcitx" -msgstr "Bộ nhập liệu Skk cho Fcitx" +msgstr "" #: org.fcitx.Fcitx5.Addon.Skk.metainfo.xml.in:8 msgid "SKK Japanese input method" -msgstr "" +msgstr "Kiểu gõ tiếng Nhật SKK" #: gui/adddictdialog.cpp:104 gui/adddictdialog.cpp:119 msgid "Select Dictionary File" -msgstr "" +msgstr "Chọn Tệp Từ Điển" #: gui/adddictdialog.cpp:26 msgid "Server" -msgstr "" +msgstr "Máy chủ" -#: src/skk.h:85 +#: src/skk.h:97 msgid "Show Annotation" msgstr "" #: gui/adddictdialog.cpp:24 msgid "System" -msgstr "" +msgstr "Hệ thống" #: gui/adddictdialog.cpp:25 msgid "User" -msgstr "" +msgstr "Người dùng" -#: src/skk.h:36 +#: src/skk.h:48 msgid "Vertical" -msgstr "" +msgstr "Thẳng đứng" -#: src/skk.cpp:68 src/skk.h:39 src/skk.h:43 +#: src/skk.cpp:102 src/skk.h:51 src/skk.h:55 msgid "Wide latin" msgstr "" -#: src/skk.h:39 +#: src/skk.h:51 msgid "Wide latin Japanese" msgstr "" @@ -255,6 +254,3 @@ #, kde-format msgid "localhost" msgstr "" - -#~ msgid "Skk" -#~ msgstr "Skk" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/src/CMakeLists.txt new/fcitx5-skk-5.1.7/src/CMakeLists.txt --- old/fcitx5-skk-5.1.3/src/CMakeLists.txt 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/src/CMakeLists.txt 2025-06-16 08:26:11.000000000 +0200 @@ -2,7 +2,7 @@ set(SKK_SOURCES skk.cpp ) -add_library(skk MODULE ${SKK_SOURCES}) +add_fcitx5_addon(skk ${SKK_SOURCES}) target_link_libraries(skk Fcitx5::Core Fcitx5::Config diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/src/skk-addon.conf.in.in new/fcitx5-skk-5.1.7/src/skk-addon.conf.in.in --- old/fcitx5-skk-5.1.3/src/skk-addon.conf.in.in 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/src/skk-addon.conf.in.in 2025-06-16 08:26:11.000000000 +0200 @@ -7,3 +7,6 @@ Type=SharedLibrary OnDemand=True Configurable=True + +[Addon/Dependencies] +0=core:@REQUIRED_FCITX_VERSION@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/src/skk.conf.in new/fcitx5-skk-5.1.7/src/skk.conf.in --- old/fcitx5-skk-5.1.3/src/skk.conf.in 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/src/skk.conf.in 2025-06-16 08:26:11.000000000 +0200 @@ -1,6 +1,6 @@ [InputMethod] Name=SKK -Icon=fcitx-skk +Icon=fcitx_skk LangCode=ja Addon=skk Label=SKK diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/src/skk.cpp new/fcitx5-skk-5.1.7/src/skk.cpp --- old/fcitx5-skk-5.1.3/src/skk.cpp 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/src/skk.cpp 2025-06-16 08:26:11.000000000 +0200 @@ -6,28 +6,65 @@ */ #include "skk.h" #include <fcntl.h> -#include <stddef.h> +#include <algorithm> +#include <array> +#include <cstddef> +#include <cstdint> +#include <cstdio> +#include <cstring> +#include <istream> +#include <memory> +#include <stdexcept> +#include <string> +#include <string_view> +#include <utility> +#include <vector> #include <fcitx-config/iniparser.h> +#include <fcitx-utils/capabilityflags.h> +#include <fcitx-utils/fdstreambuf.h> +#include <fcitx-utils/i18n.h> +#include <fcitx-utils/key.h> +#include <fcitx-utils/keysym.h> #include <fcitx-utils/log.h> +#include <fcitx-utils/macros.h> +#include <fcitx-utils/misc.h> +#include <fcitx-utils/standardpaths.h> +#include <fcitx-utils/stringutils.h> +#include <fcitx-utils/textformatflags.h> #include <fcitx-utils/utf8.h> +#include <fcitx/action.h> +#include <fcitx/addoninstance.h> +#include <fcitx/candidatelist.h> +#include <fcitx/event.h> +#include <fcitx/inputcontextproperty.h> +#include <fcitx/inputmethodentry.h> #include <fcitx/inputpanel.h> +#include <fcitx/instance.h> +#include <fcitx/menu.h> +#include <fcitx/statusarea.h> +#include <fcitx/text.h> +#include <fcitx/userinterface.h> #include <fcitx/userinterfacemanager.h> +#include <glib-object.h> +#include <glib.h> +#include <libskk/libskk.h> -FCITX_DEFINE_LOG_CATEGORY(skk_logcategory, "skk"); - -#define SKK_DEBUG() FCITX_LOGC(skk_logcategory, Debug) +#define SKK_DEBUG() FCITX_LOGC(::fcitx::skk_logcategory, Debug) namespace fcitx { namespace { +FCITX_DEFINE_LOG_CATEGORY(skk_logcategory, "skk"); + Text skkContextGetPreedit(SkkContext *context) { Text preedit; const gchar *preeditString = skk_context_get_preedit(context); size_t len = strlen(preeditString); if (len > 0) { - guint offset, nchars; + guint offset; + guint nchars; skk_context_get_preedit_underline(context, &offset, &nchars); if (nchars > 0) { @@ -54,8 +91,6 @@ return preedit; } -} // namespace - struct { const char *icon; const char *label; @@ -70,32 +105,34 @@ }; auto inputModeStatus(SkkEngine *engine, InputContext *ic) { - auto state = engine->state(ic); + auto *state = engine->state(ic); auto mode = skk_context_get_input_mode(state->context()); return (mode >= 0 && mode < FCITX_ARRAY_SIZE(input_mode_status)) ? &input_mode_status[mode] : nullptr; } +} // namespace + class SkkModeAction : public Action { public: SkkModeAction(SkkEngine *engine) : engine_(engine) {} std::string shortText(InputContext *ic) const override { - if (auto status = inputModeStatus(engine_, ic)) { + if (auto *status = inputModeStatus(engine_, ic)) { return stringutils::concat(status->label, " - ", _(status->description)); } return ""; } std::string longText(InputContext *ic) const override { - if (auto status = inputModeStatus(engine_, ic)) { + if (auto *status = inputModeStatus(engine_, ic)) { return _(status->description); } return ""; } std::string icon(InputContext *ic) const override { - if (auto status = inputModeStatus(engine_, ic)) { + if (auto *status = inputModeStatus(engine_, ic)) { return status->icon; } return ""; @@ -117,11 +154,11 @@ setCheckable(true); } bool isChecked(InputContext *ic) const override { - auto state = engine_->state(ic); + auto *state = engine_->state(ic); return mode_ == skk_context_get_input_mode(state->context()); } void activate(InputContext *ic) override { - auto state = engine_->state(ic); + auto *state = engine_->state(ic); skk_context_set_input_mode(state->context(), mode_); } @@ -133,13 +170,13 @@ class SkkCandidateWord : public CandidateWord { public: SkkCandidateWord(SkkEngine *engine, Text text, int idx) - : CandidateWord(), engine_(engine), idx_(idx) { + : engine_(engine), idx_(idx) { setText(std::move(text)); } void select(InputContext *inputContext) const override { - auto state = engine_->state(inputContext); - auto context = state->context(); + auto *state = engine_->state(inputContext); + auto *context = state->context(); SkkCandidateList *skkCandidates = skk_context_get_candidates(context); if (skk_candidate_list_select_at( skkCandidates, @@ -161,8 +198,8 @@ : engine_(engine), ic_(ic) { setPageable(this); setCursorMovable(this); - auto skkstate = engine_->state(ic_); - auto context = skkstate->context(); + auto *skkstate = engine_->state(ic_); + auto *context = skkstate->context(); SkkCandidateList *skkCandidates = skk_context_get_candidates(context); gint size = skk_candidate_list_get_size(skkCandidates); gint cursor_pos = skk_candidate_list_get_cursor_pos(skkCandidates); @@ -176,7 +213,7 @@ // 24~26 3nd page int currentPage = (cursor_pos - page_start) / page_size; int totalPage = (size - page_start + page_size - 1) / page_size; - int pageFirst = currentPage * page_size + page_start; + int pageFirst = (currentPage * page_size) + page_start; int pageLast = std::min(size, static_cast<int>(pageFirst + page_size)); for (int i = pageFirst; i < pageLast; i++) { @@ -185,7 +222,7 @@ Text text; text.append(skk_candidate_get_text(skkCandidate.get())); if (*engine->config().showAnnotation) { - auto annotation = + const auto *annotation = skk_candidate_get_annotation(skkCandidate.get()); // Make sure annotation is not null, empty, or equal to "?". // ? seems to be a special debug purpose value. @@ -224,15 +261,15 @@ bool hasNext() const override { return hasNext_; } - void prev() override { return paging(true); } + void prev() override { paging(true); } - void next() override { return paging(false); } + void next() override { paging(false); } bool usedNextBefore() const override { return true; } - void prevCandidate() override { return moveCursor(true); } + void prevCandidate() override { moveCursor(true); } - void nextCandidate() override { return moveCursor(false); } + void nextCandidate() override { moveCursor(false); } const Text &label(int idx) const override { return labels_[idx]; } @@ -250,8 +287,8 @@ private: void paging(bool prev) { - auto skkstate = engine_->state(ic_); - auto context = skkstate->context(); + auto *skkstate = engine_->state(ic_); + auto *context = skkstate->context(); SkkCandidateList *skkCandidates = skk_context_get_candidates(context); if (skk_candidate_list_get_page_visible(skkCandidates)) { if (prev) { @@ -263,8 +300,8 @@ } } void moveCursor(bool prev) { - auto skkstate = engine_->state(ic_); - auto context = skkstate->context(); + auto *skkstate = engine_->state(ic_); + auto *context = skkstate->context(); SkkCandidateList *skkCandidates = skk_context_get_candidates(context); if (skk_candidate_list_get_page_visible(skkCandidates)) { if (prev) { @@ -290,7 +327,7 @@ SkkEngine::SkkEngine(Instance *instance) : instance_{instance}, factory_([this](InputContext &ic) { - auto newState = new SkkState(this, &ic); + auto *newState = new SkkState(this, &ic); newState->applyConfig(); return newState; }) { @@ -327,7 +364,7 @@ instance_->inputContextManager().registerProperty("skkState", &factory_); instance_->inputContextManager().foreach([this](InputContext *ic) { - auto state = this->state(ic); + auto *state = this->state(ic); skk_context_set_input_mode(state->context(), *config_.inputMode); ic->updateProperty(&factory_); return true; @@ -345,8 +382,8 @@ void SkkEngine::deactivate(const InputMethodEntry &entry, InputContextEvent &event) { if (event.type() == EventType::InputContextSwitchInputMethod) { - auto skkstate = this->state(event.inputContext()); - auto context = skkstate->context(); + auto *skkstate = this->state(event.inputContext()); + auto *context = skkstate->context(); auto text = skkContextGetPreedit(context); auto str = text.toString(); if (!str.empty()) { @@ -359,8 +396,8 @@ void SkkEngine::keyEvent(const InputMethodEntry &entry, KeyEvent &keyEvent) { FCITX_UNUSED(entry); - auto ic = keyEvent.inputContext(); - auto state = ic->propertyFor(&factory_); + auto *ic = keyEvent.inputContext(); + auto *state = ic->propertyFor(&factory_); state->keyEvent(keyEvent); } @@ -372,7 +409,7 @@ if (factory_.registered()) { instance_->inputContextManager().foreach([this](InputContext *ic) { - auto state = this->state(ic); + auto *state = this->state(ic); state->applyConfig(); return true; }); @@ -380,21 +417,22 @@ } void SkkEngine::reset(const InputMethodEntry &entry, InputContextEvent &event) { FCITX_UNUSED(entry); - auto state = this->state(event.inputContext()); + auto *state = this->state(event.inputContext()); state->reset(); } void SkkEngine::save() {} -std::string SkkEngine::subMode(const InputMethodEntry &, InputContext &ic) { - if (auto status = inputModeStatus(this, &ic)) { +std::string SkkEngine::subMode(const InputMethodEntry & /*entry*/, + InputContext &ic) { + if (auto *status = inputModeStatus(this, &ic)) { return _(status->description); } return ""; } -std::string SkkEngine::subModeLabelImpl(const InputMethodEntry &, +std::string SkkEngine::subModeLabelImpl(const InputMethodEntry & /*unused*/, InputContext &ic) { - if (auto status = inputModeStatus(this, &ic)) { + if (auto *status = inputModeStatus(this, &ic)) { return _(status->label); } return ""; @@ -424,28 +462,23 @@ userRule_ = std::move(rule); } -typedef enum _FcitxSkkDictType { - FSDT_Invalid, - FSDT_File, - FSTD_Server -} FcitxSkkDictType; +enum class FcitxSkkDictType { FSDT_Invalid, FSDT_File, FSTD_Server }; void SkkEngine::loadDictionary() { dictionaries_.clear(); - auto file = StandardPath::global().open(StandardPath::Type::PkgData, - "skk/dictionary_list", O_RDONLY); + auto file = StandardPaths::global().open(StandardPathsType::PkgData, + "skk/dictionary_list"); - UniqueFilePtr fp(fdopen(file.fd(), "rb")); - if (!fp) { + if (!file.isValid()) { return; } - file.release(); - UniqueCPtr<char> buf; - size_t len = 0; + IFDStreamBuf buf(file.fd()); + std::istream in(&buf); + std::string line; - while (getline(buf, &len, fp.get()) != -1) { - const auto trimmed = stringutils::trim(buf.get()); + while (std::getline(in, line)) { + const auto trimmed = stringutils::trimView(line); const auto tokens = stringutils::split(trimmed, ","); if (tokens.size() < 3) { @@ -454,13 +487,13 @@ SKK_DEBUG() << "Load dictionary: " << trimmed; - FcitxSkkDictType type = FSDT_Invalid; + FcitxSkkDictType type = FcitxSkkDictType::FSDT_Invalid; int mode = 0; std::string path; std::string host; std::string port; std::string encoding; - for (auto &token : tokens) { + for (const auto &token : tokens) { auto equal = token.find('='); if (equal == std::string::npos) { continue; @@ -471,9 +504,9 @@ if (key == "type") { if (value == "file") { - type = FSDT_File; + type = FcitxSkkDictType::FSDT_File; } else if (value == "server") { - type = FSTD_Server; + type = FcitxSkkDictType::FSTD_Server; } } else if (key == "file") { path = value; @@ -494,13 +527,20 @@ encoding = !encoding.empty() ? encoding : "EUC-JP"; - if (type == FSDT_Invalid) { + if (type == FcitxSkkDictType::FSDT_Invalid) { continue; - } else if (type == FSDT_File) { + } + if (type == FcitxSkkDictType::FSDT_File) { if (path.empty() || mode == 0) { continue; } if (mode == 1) { + std::string_view partialpath = path; + if (stringutils::consumePrefix(partialpath, + "$XDG_DATA_DIRS/")) { + path = StandardPaths::global().locate( + StandardPathsType::Data, partialpath); + } if (stringutils::endsWith(path, ".cdb")) { SkkCdbDict *dict = skk_cdb_dict_new(path.data(), encoding.data(), nullptr); @@ -517,23 +557,21 @@ } } } else { - constexpr char configDir[] = "$FCITX_CONFIG_DIR/"; - constexpr auto len = sizeof(configDir) - 1; - std::string realpath = path; - if (stringutils::startsWith(path, configDir)) { - realpath = stringutils::joinPath( - StandardPath::global().userDirectory( - StandardPath::Type::PkgData), - path.substr(len)); + std::string_view partialpath = path; + if (stringutils::consumePrefix(partialpath, + "$FCITX_CONFIG_DIR/")) { + path = StandardPaths::global().userDirectory( + StandardPathsType::PkgData) / + partialpath; } - SkkUserDict *userdict = skk_user_dict_new( - realpath.data(), encoding.data(), nullptr); + SkkUserDict *userdict = + skk_user_dict_new(path.data(), encoding.data(), nullptr); if (userdict) { - SKK_DEBUG() << "Adding user dict: " << realpath; + SKK_DEBUG() << "Adding user dict: " << path; dictionaries_.emplace_back(SKK_DICT(userdict)); } } - } else if (type == FSTD_Server) { + } else if (type == FcitxSkkDictType::FSTD_Server) { host = !host.empty() ? host : "localhost"; port = !port.empty() ? port : "1178"; @@ -626,7 +664,7 @@ bool SkkState::handleCandidate(KeyEvent &keyEvent) { auto &config = engine_->config(); - auto context = context_.get(); + auto *context = context_.get(); SkkCandidateList *skkCandidates = skk_context_get_candidates(context); if (!skk_candidate_list_get_page_visible(skkCandidates) || keyEvent.isRelease()) { @@ -684,7 +722,7 @@ void SkkState::updateUI() { auto &inputPanel = ic_->inputPanel(); - auto context = context_.get(); + auto *context = context_.get(); SkkCandidateList *skkCandidates = skk_context_get_candidates(context); @@ -716,6 +754,7 @@ inputPanel.reset(); ic_->updatePreedit(); engine_->instance()->showInputMethodInformation(ic_); + ic_->updateUserInterface(UserInterfaceComponent::InputPanel); return; } @@ -750,13 +789,13 @@ std::vector<SkkDict *> dicts; dicts.reserve(engine_->dictionaries().size()); - for (auto &dict : engine_->dictionaries()) { + for (const auto &dict : engine_->dictionaries()) { dicts.push_back(dict.get()); } skk_context_set_dictionaries(context(), dicts.data(), dicts.size()); } void SkkState::copyTo(InputContextProperty *property) { - auto otherState = static_cast<SkkState *>(property); + auto *otherState = static_cast<SkkState *>(property); skk_context_set_input_mode(otherState->context(), skk_context_get_input_mode(context())); } @@ -777,21 +816,24 @@ updateUI(); } -void SkkState::input_mode_changed_cb(GObject *, GParamSpec *, SkkState *skk) { +void SkkState::input_mode_changed_cb(GObject * /*unused*/, + GParamSpec * /*unused*/, SkkState *skk) { skk->updateInputMode(); } -void SkkState::preedit_changed_cb(GObject *, GParamSpec *, SkkState *skk) { +void SkkState::preedit_changed_cb(GObject * /*unused*/, GParamSpec * /*unused*/, + SkkState *skk) { skk->updatePreedit(); } -gboolean SkkState::retrieve_surrounding_text_cb(GObject *, gchar **text, - guint *cursor_pos, +gboolean SkkState::retrieve_surrounding_text_cb(GObject * /*unused*/, + gchar **text, guint *cursor_pos, SkkState *skk) { InputContext *ic = skk->ic_; if (!ic->capabilityFlags().test(CapabilityFlag::SurroundingText) || - !ic->surroundingText().isValid()) + !ic->surroundingText().isValid()) { return false; + } *text = g_strdup(ic->surroundingText().text().c_str()); *cursor_pos = ic->surroundingText().cursor(); @@ -799,14 +841,15 @@ return true; } -gboolean SkkState::delete_surrounding_text_cb(GObject *, gint offset, +gboolean SkkState::delete_surrounding_text_cb(GObject * /*unused*/, gint offset, guint nchars, SkkState *skk) { InputContext *ic = skk->ic_; - if (!(ic->capabilityFlags().test(CapabilityFlag::SurroundingText))) + if (!(ic->capabilityFlags().test(CapabilityFlag::SurroundingText))) { return false; + } ic->deleteSurroundingText(offset, nchars); return true; } } // namespace fcitx -FCITX_ADDON_FACTORY(fcitx::SkkAddonFactory) +FCITX_ADDON_FACTORY_V2(skk, fcitx::SkkAddonFactory) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fcitx5-skk-5.1.3/src/skk.h new/fcitx5-skk-5.1.7/src/skk.h --- old/fcitx5-skk-5.1.3/src/skk.h 2024-04-22 09:58:14.000000000 +0200 +++ new/fcitx5-skk-5.1.7/src/skk.h 2025-06-16 08:26:11.000000000 +0200 @@ -8,20 +8,32 @@ #define _FCITX_SKK_SKK_H_ #include <memory> - +#include <string> +#include <vector> #include <fcitx-config/configuration.h> +#include <fcitx-config/enum.h> #include <fcitx-config/iniparser.h> +#include <fcitx-config/option.h> +#include <fcitx-config/rawconfig.h> #include <fcitx-utils/capabilityflags.h> #include <fcitx-utils/i18n.h> +#include <fcitx-utils/key.h> +#include <fcitx-utils/keysym.h> +#include <fcitx-utils/misc.h> #include <fcitx/action.h> #include <fcitx/addonfactory.h> +#include <fcitx/addoninstance.h> #include <fcitx/addonmanager.h> #include <fcitx/candidatelist.h> +#include <fcitx/event.h> #include <fcitx/inputcontextmanager.h> #include <fcitx/inputcontextproperty.h> #include <fcitx/inputmethodengine.h> #include <fcitx/instance.h> #include <fcitx/menu.h> +#include <fcitx/text.h> +#include <glib-object.h> +#include <glib.h> #include <libskk/libskk.h> namespace fcitx { @@ -46,14 +58,14 @@ struct NotEmpty { bool check(const std::string &value) const { return !value.empty(); } - void dumpDescription(RawConfig &) const {} + void dumpDescription(RawConfig & /*unused*/) const {} }; struct RuleAnnotation : public EnumAnnotation { void dumpDescription(RawConfig &config) const { EnumAnnotation::dumpDescription(config); int length; - auto rules = skk_rule_list(&length); + auto *rules = skk_rule_list(&length); for (int i = 0; i < length; i++) { config.setValueByPath("Enum/" + std::to_string(i), rules[i].name); config.setValueByPath("EnumI18n/" + std::to_string(i), @@ -138,10 +150,11 @@ void reset(const InputMethodEntry &entry, InputContextEvent &event) override; void save() override; - std::string subMode(const InputMethodEntry &, InputContext &) override; + std::string subMode(const InputMethodEntry & /*entry*/, + InputContext & /*inputContext*/) override; - std::string subModeLabelImpl(const fcitx::InputMethodEntry &, - fcitx::InputContext &) override; + std::string subModeLabelImpl(const fcitx::InputMethodEntry & /*unused*/, + fcitx::InputContext & /*unused*/) override; auto &factory() { return factory_; } auto &config() { return config_; } @@ -152,7 +165,7 @@ reloadConfig(); } void setSubConfig(const std::string &path, - const fcitx::RawConfig &) override { + const fcitx::RawConfig & /*unused*/) override { if (path == "dictionary_list") { reloadConfig(); } @@ -198,7 +211,7 @@ SkkContext *context() { return context_.get(); } void applyConfig(); bool needCopy() const override { return true; } - void copyTo(InputContextProperty *state) override; + void copyTo(InputContextProperty *property) override; void reset(); private: