diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 024946f..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -build -lxqt-config.kdev4 -*/translations/lxqt-config diff --git a/CHANGELOG b/CHANGELOG index 9268a44..e880ef9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,28 @@ -lxqt-config-0.11.0 / 2016-09-24 +lxqt-config-0.11.1 / 2017-01-01 =============================== + * lxqt-config-monitor: remove unnecessary wait before settings load (#114) + * Fix self icontheme update (#113) + * liblxqt-config-cursor: Don't check for null pointer before deleting it + * liblxqt-config-cursor: Explicitly ignore function return value + * Updated and added *_da.desktop files and removed da_DK + * Use FindXCB CMake module + * Activate items on releasing Enter instead of pressing it. (#78) + * Update and rename lxqt-config_fr_FR.desktop to lxqt-config_fr.desktop + * Fix faulty link in README.md + * if not set, set the build type to Release + * Desktop entry files: Update French translation + * lxqt-config: Avoid multiple spawn on auto-repeat + * Fix loading of translations for brightness + * Create lxqt-config-brightness_it.desktop + * Remove cpack (#104) + * lxqt-config-brightness: Add GenericName and Comment to desktop entry + +0.11.0 / 2016-09-24 +=================== + + * Release 0.11.0: Add changelog * appearance: Avoid blocking when setting wallpaper * appearance: Do (not) change wallpaper with theme * all: Remove XdgIcon & XdgIconLoader usage diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c893be..3814b3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,11 @@ find_package(Qt5LinguistTools REQUIRED QUIET) find_package(lxqt REQUIRED QUIET) include(LXQtCompilerSettings NO_POLICY_SCOPE) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + include(LXQtTranslate) add_subdirectory(src) @@ -52,13 +57,3 @@ endif() if (WITH_LOCALE) add_subdirectory(lxqt-config-locale) endif() - -# building tarball with CPack ------------------------------------------------- -include(InstallRequiredSystemLibraries) -set(CPACK_PACKAGE_VERSION_MAJOR ${LXQT_MAJOR_VERSION}) -set(CPACK_PACKAGE_VERSION_MINOR ${LXQT_MINOR_VERSION}) -set(CPACK_PACKAGE_VERSION_PATCH ${LXQT_PATCH_VERSION}) -set(CPACK_GENERATOR TBZ2) -set(CPACK_SOURCE_GENERATOR TBZ2) -set(CPACK_SOURCE_IGNORE_FILES /build/;.gitignore;.*~;.git;.kdev4;temp) -include(CPack) diff --git a/README.md b/README.md index c5b0314..61bcde8 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ The "Configuration Center" (binary `lxqt-config`) is summarizing and providing v ![Configuration Center (lxqt-config)](lxqt-config.png) -First of all these are the ones belonging to repository lxqt-config described [above](https://github.com/pmattern/lxqt-config#configuration-gui-tools). Next, it is hosting counterparts of several other LXQt components like "Desktop Notifications" of [lxqt-notificationd](https://github.com/lxde/lxqt-notificationd), "Shortcut Keys" of [lxqt-globalkeyshortcuts](https://github.com/lxde/lxqt-globalkeyshortcuts) or the tools provided by [lxqt-admin](https://github.com/lxde/lxqt-admin). Third-party applications can include their configuration tools in "Configuration Center", too. This applies e. g. to "Connman UI Setup" of [cmst](https://github.com/andrew-bibb/cmst) or "SDDM Configuration" of [sddm-config-editor](https://github.com/hagabaka/sddm-config-editor). +First of all these are the ones belonging to repository lxqt-config described [above](https://github.com/lxde/lxqt-config#configuration-gui-tools). Next, it is hosting counterparts of several other LXQt components like "Desktop Notifications" of [lxqt-notificationd](https://github.com/lxde/lxqt-notificationd), "Shortcut Keys" of [lxqt-globalkeyshortcuts](https://github.com/lxde/lxqt-globalkeyshortcuts) or the tools provided by [lxqt-admin](https://github.com/lxde/lxqt-admin). Third-party applications can include their configuration tools in "Configuration Center", too. This applies e. g. to "Connman UI Setup" of [cmst](https://github.com/andrew-bibb/cmst) or "SDDM Configuration" of [sddm-config-editor](https://github.com/hagabaka/sddm-config-editor). ## Installation diff --git a/debian/changelog b/debian/changelog index e6d02e5..7fce263 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +lxqt-config (0.11.1-1) unstable; urgency=medium + + * Chery-picking new upstream release 0.11.1. + * Removed some build dependencies: + -cmake + -libqt5xdg-dev + -libqt5xdgiconloader-dev + -pkg-config + -qttools5-dev + -qttools5-dev-tools + * Bumped build dependency liblxqt0-dev (>= 0.11.1) + * Bumped years in d/copyright + * Added Recommends galternatives + + -- Alf Gaida Mon, 02 Jan 2017 12:36:49 +0100 + lxqt-config (0.11.0-2) unstable; urgency=medium * Chery-picking new upstream release 0.11.0 diff --git a/debian/control b/debian/control index 30698f4..8aae840 100644 --- a/debian/control +++ b/debian/control @@ -7,21 +7,15 @@ Uploaders: Alf Gaida , Section: x11 Priority: optional Build-Depends: debhelper (>= 10), - cmake (>= 3.0.2), libkf5screen-dev, libkf5windowsystem-dev, - liblxqt0-dev (>= 0.11.0), + liblxqt0-dev (>= 0.11.1), libqt5svg5-dev, libqt5x11extras5-dev, - libqt5xdg-dev (>= 2.0.0), - libqt5xdgiconloader-dev (>= 2.0.0), libx11-dev, libxcursor-dev, libxfixes-dev, - pkg-config, qtbase5-private-dev, - qttools5-dev, - qttools5-dev-tools, zlib1g-dev Standards-Version: 3.9.8 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lxqt/lxqt-config.git/?h=debian/sid @@ -32,7 +26,8 @@ Package: lxqt-config Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} -Recommends: lxqt-config-l10n +Recommends: galternatives, + lxqt-config-l10n Description: LXQt system settings center The LXQt system settings center . diff --git a/debian/copyright b/debian/copyright index 21b21b7..c454946 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,7 +3,7 @@ Upstream-Name: lxqt-config Source: https://github.com/lxde/lxqt-config Files: * -Copyright: 2012-2016 LXQt team +Copyright: 2012-2017 LXQt team 2010-2012 Razor team 2013 Christian Surlykke 2014 Hong Jen Yee (PCMan) @@ -84,7 +84,7 @@ Copyright: 2015 Kai Uwe Broulik License: LGPL-2.0+ Files: debian/* -Copyright: 2014-2016 Alf Gaida +Copyright: 2014-2017 Alf Gaida 2015 Andrew Lee (李健秋) License: LGPL-2.1+ diff --git a/debian/rules b/debian/rules index 6df5045..3dac20d 100755 --- a/debian/rules +++ b/debian/rules @@ -10,8 +10,8 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all override_dh_auto_configure: dh_auto_configure -- \ - -DPULL_TRANSLATIONS=OFF\ - -DUPDATE_TRANSLATIONS=OFF\ + -DPULL_TRANSLATIONS=OFF \ + -DUPDATE_TRANSLATIONS=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo override_dh_makeshlibs: diff --git a/liblxqt-config-cursor/CMakeLists.txt b/liblxqt-config-cursor/CMakeLists.txt index 51883f8..42e7f0d 100644 --- a/liblxqt-config-cursor/CMakeLists.txt +++ b/liblxqt-config-cursor/CMakeLists.txt @@ -1,9 +1,7 @@ project(lxqt-config-cursor) find_package(X11 REQUIRED) -find_package(PkgConfig REQUIRED) - -pkg_check_modules(XCB REQUIRED xcb) +find_package(XCB REQUIRED xcb) include_directories(${XCB_INCLUDE_DIRS}) link_libraries(${XCB_LIBRARIES}) diff --git a/liblxqt-config-cursor/xcr/xcrimg.cpp b/liblxqt-config-cursor/xcr/xcrimg.cpp index 3caa8d0..4d2ad28 100644 --- a/liblxqt-config-cursor/xcr/xcrimg.cpp +++ b/liblxqt-config-cursor/xcr/xcrimg.cpp @@ -59,9 +59,9 @@ void XCursorImage::convertARGB2PreMul (QImage &img) { switch (img.format()) { case QImage::Format_ARGB32_Premultiplied: return; case QImage::Format_ARGB32: break; - default: img.convertToFormat(QImage::Format_ARGB32/*_Premultiplied*/); + default: (void) img.convertToFormat(QImage::Format_ARGB32/*_Premultiplied*/); } - img.convertToFormat(QImage::Format_ARGB32_Premultiplied); // this shouldn't convert anything + (void) img.convertToFormat(QImage::Format_ARGB32_Premultiplied); // this shouldn't convert anything // so convert it! for (int y = img.height()-1; y >= 0; y--) { quint8 *line = (quint8 *)img.scanLine(y); @@ -150,7 +150,7 @@ void XCursorImage::genXCursorImg (QByteArray &res) const { baPutDW(res, (quint32)mDelay); // now put the pixels QImage i = mImage->copy(); - i.convertToFormat(QImage::Format_ARGB32_Premultiplied); + (void) i.convertToFormat(QImage::Format_ARGB32_Premultiplied); //i.convertToFormat(QImage::Format_ARGB32); for (int y = 0; y < i.height(); y++) { const uchar *sl = i.scanLine(y); diff --git a/liblxqt-config-cursor/xcr/xcrxcur.cpp b/liblxqt-config-cursor/xcr/xcrxcur.cpp index c1536c1..219b978 100644 --- a/liblxqt-config-cursor/xcr/xcrxcur.cpp +++ b/liblxqt-config-cursor/xcr/xcrxcur.cpp @@ -84,7 +84,8 @@ XCursorImageXCur::~XCursorImageXCur () { void XCursorImageXCur::parseImgData (const void *aImgData) { mIsValid = false; - if (mImage) delete mImage; mImage = 0; + delete mImage; // It's fine to delete a null pointer + mImage = 0; const quint32 *data = (const quint32 *)aImgData; if (getDW(data) != 36) return; // header size if (getDW(data+1) != 0xfffd0002L) return; // magic diff --git a/lxqt-config-appearance/iconthemeconfig.cpp b/lxqt-config-appearance/iconthemeconfig.cpp index ebcfd7a..faa1e03 100644 --- a/lxqt-config-appearance/iconthemeconfig.cpp +++ b/lxqt-config-appearance/iconthemeconfig.cpp @@ -138,9 +138,12 @@ IconThemeConfig::~IconThemeConfig() void IconThemeConfig::iconThemeSelected(QTreeWidgetItem *item, int column) { Q_UNUSED(column); - QString theme = item->data(0, Qt::UserRole).toString(); + const QString theme = item->data(0, Qt::UserRole).toString(); if (!theme.isEmpty()) { + // Ensure that this widget also updates it's own icons + QIcon::setThemeName(theme); + m_settings->setValue("icon_theme", theme); m_settings->sync(); } diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_da.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_da.desktop index 375f0b9..768abf6 100644 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_da.desktop +++ b/lxqt-config-appearance/translations/lxqt-config-appearance_da.desktop @@ -1,4 +1,4 @@ # Translations -Comment[da]=Indstilling af LXQt udseende -GenericName[da]=Indstilling af LXQt Udseende -Name[da]=Indstilling af LXQt Udseende +Name[da]=Udseende +GenericName[da]=Udseendeindstillinger +Comment[da]=Udseendeindstillinger for LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_da_DK.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_da_DK.desktop deleted file mode 100644 index cf332b5..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_da_DK.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[da_DK]=Indstil udseende på LXQt skrivebord -GenericName[da_DK]=Indstilling af LXQt Udseende -Name[da_DK]=Indstilling af LXQt Udseende diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_fr.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_fr.desktop new file mode 100644 index 0000000..2caea96 --- /dev/null +++ b/lxqt-config-appearance/translations/lxqt-config-appearance_fr.desktop @@ -0,0 +1,4 @@ +# Translations +Name[fr]=Apparence +GenericName[fr]=Configurer l'apparence +Comment[fr]=Configurer l'apparence de LXQt diff --git a/lxqt-config-appearance/translations/lxqt-config-appearance_fr_FR.desktop b/lxqt-config-appearance/translations/lxqt-config-appearance_fr_FR.desktop deleted file mode 100644 index ad84542..0000000 --- a/lxqt-config-appearance/translations/lxqt-config-appearance_fr_FR.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[fr_FR]=Configurer l'apparence du bureau LXQt -GenericName[fr_FR]=Configuration de l'apparence de LXQt -Name[fr_FR]=Configuration de l'apparence de LXQt diff --git a/lxqt-config-brightness/CMakeLists.txt b/lxqt-config-brightness/CMakeLists.txt index 7a584ce..c21ab45 100644 --- a/lxqt-config-brightness/CMakeLists.txt +++ b/lxqt-config-brightness/CMakeLists.txt @@ -3,16 +3,12 @@ project(lxqt-config-brightness) find_package(Qt5Widgets REQUIRED QUIET) find_package(Qt5X11Extras REQUIRED QUIET) -find_package(PkgConfig) - -pkg_check_modules(XRANDR xcb-randr) -pkg_check_modules(XCB xcb) +find_package(XCB REQUIRED xcb xcb-randr) set(QTX_LIBRARIES Qt5::Widgets Qt5::X11Extras) include_directories ( - ${XRANDR_INCLUDE_DIRS} ${XCB_INCLUDE_DIRS} ) @@ -65,13 +61,12 @@ lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME}) lxqt_translate_desktop(DESKTOP_FILES SOURCES "resources/${PROJECT_NAME}.desktop.in") -add_executable(${PROJECT_NAME} ${CPP_FILES} ${UI_FILES} ${QM_FILES} ${DESKTOP_FILES}) +add_executable(${PROJECT_NAME} ${CPP_FILES} ${UI_FILES} ${QM_FILES} ${DESKTOP_FILES} ${QM_LOADER}) target_link_libraries( ${PROJECT_NAME} ${QTX_LIBRARIES} - ${XRANDR_LDFLAGS} - ${XCB_LDFLAGS} + ${XCB_LIBRARIES} lxqt ) diff --git a/lxqt-config-brightness/outputwidget.ui b/lxqt-config-brightness/outputwidget.ui index 9e00a65..bd6427f 100644 --- a/lxqt-config-brightness/outputwidget.ui +++ b/lxqt-config-brightness/outputwidget.ui @@ -17,7 +17,7 @@ - Form + Form diff --git a/lxqt-config-brightness/resources/lxqt-config-brightness.desktop.in b/lxqt-config-brightness/resources/lxqt-config-brightness.desktop.in index f65ea0c..0bb2459 100644 --- a/lxqt-config-brightness/resources/lxqt-config-brightness.desktop.in +++ b/lxqt-config-brightness/resources/lxqt-config-brightness.desktop.in @@ -1,5 +1,7 @@ [Desktop Entry] -Name=Brightness Settings +Name=Brightness +GenericName=Brightness Settings +Comment=Configure brightness Exec=lxqt-config-brightness Terminal=false Type=Application @@ -7,4 +9,4 @@ Icon=brightnesssettings Categories=Settings;DesktopSettings;Qt;LXQt;HardwareSettings; OnlyShowIn=LXQt; -#TRANSLATIONS_DIR=translations \ No newline at end of file +#TRANSLATIONS_DIR=translations diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_da.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_da.desktop new file mode 100644 index 0000000..94c7345 --- /dev/null +++ b/lxqt-config-brightness/translations/lxqt-config-brightness_da.desktop @@ -0,0 +1,4 @@ +# Translations +Name[da]=Lysstyrke +GenericName[da]=Lysstyrkeindstillinger +Comment[da]=Konfigurér lysstyrke diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_fr.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_fr.desktop new file mode 100644 index 0000000..461e526 --- /dev/null +++ b/lxqt-config-brightness/translations/lxqt-config-brightness_fr.desktop @@ -0,0 +1,3 @@ +Name[fr]=Paramètres de luminosité +GenericName[fr]=Paramètres de luminosité de l'écran +Comment[fr]=Régler la luminosité et le contraste de l'écran diff --git a/lxqt-config-brightness/translations/lxqt-config-brightness_it.desktop b/lxqt-config-brightness/translations/lxqt-config-brightness_it.desktop new file mode 100644 index 0000000..3d589f3 --- /dev/null +++ b/lxqt-config-brightness/translations/lxqt-config-brightness_it.desktop @@ -0,0 +1,2 @@ +Name[it]=Luminosità +Comment[it]=Permette di cambiare la luminosità e il contrasto dello schermo diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_da.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_da.desktop new file mode 100644 index 0000000..41dc557 --- /dev/null +++ b/lxqt-config-file-associations/translations/lxqt-config-file-associations_da.desktop @@ -0,0 +1,4 @@ +# Translations +Name[da]=Filtilknytninger +GenericName[da]=Filtilknytningsindstillinger +Comment[da]=Konfigurér programmer tilknyttet kendte filtyper diff --git a/lxqt-config-file-associations/translations/lxqt-config-file-associations_fr.desktop b/lxqt-config-file-associations/translations/lxqt-config-file-associations_fr.desktop new file mode 100644 index 0000000..3d68e6c --- /dev/null +++ b/lxqt-config-file-associations/translations/lxqt-config-file-associations_fr.desktop @@ -0,0 +1,3 @@ +Name[fr]=Association des fichiers +GenericName[fr]=Paramètres d'association des fichiers +Comment[fr]=Configurer les applications associées avec les types de fichier diff --git a/lxqt-config-input/translations/lxqt-config-input_da.desktop b/lxqt-config-input/translations/lxqt-config-input_da.desktop new file mode 100644 index 0000000..681a16d --- /dev/null +++ b/lxqt-config-input/translations/lxqt-config-input_da.desktop @@ -0,0 +1,4 @@ +# Translations +Name[da]=Tastatur og mus +GenericName[da]=Input-indstillinger +Comment[da]=Konfigurér tastatur, mus og andre input-enheder diff --git a/lxqt-config-input/translations/lxqt-config-input_fr.desktop b/lxqt-config-input/translations/lxqt-config-input_fr.desktop new file mode 100644 index 0000000..84f9355 --- /dev/null +++ b/lxqt-config-input/translations/lxqt-config-input_fr.desktop @@ -0,0 +1,3 @@ +Name[fr]=Clavier et Souris +GenericName[fr]=Paramètres des périphériques d'entrée +Comment[fr]=Configurer les claviers, souris et les autres périphériques d'entrée diff --git a/lxqt-config-locale/translations/lxqt-config-locale_da.desktop b/lxqt-config-locale/translations/lxqt-config-locale_da.desktop new file mode 100644 index 0000000..c585032 --- /dev/null +++ b/lxqt-config-locale/translations/lxqt-config-locale_da.desktop @@ -0,0 +1,4 @@ +# Translations +Name[da]=Sprog +GenericName[da]=Sprogindstillinger +Comment[da]=Sprogindstillinger for LXQt diff --git a/lxqt-config-locale/translations/lxqt-config-locale_fr.desktop b/lxqt-config-locale/translations/lxqt-config-locale_fr.desktop new file mode 100644 index 0000000..250d44c --- /dev/null +++ b/lxqt-config-locale/translations/lxqt-config-locale_fr.desktop @@ -0,0 +1,3 @@ +Name[fr]=Région +GenericName[fr]=Paramètres de la région +Comment[fr]=Paramètres de la région pour LXQt diff --git a/lxqt-config-monitor/fastmenu.ui b/lxqt-config-monitor/fastmenu.ui index ee4ac03..b2bcc54 100644 --- a/lxqt-config-monitor/fastmenu.ui +++ b/lxqt-config-monitor/fastmenu.ui @@ -11,7 +11,7 @@ - Form + Form diff --git a/lxqt-config-monitor/loadsettings.cpp b/lxqt-config-monitor/loadsettings.cpp index 921162d..19dbc7b 100644 --- a/lxqt-config-monitor/loadsettings.cpp +++ b/lxqt-config-monitor/loadsettings.cpp @@ -26,13 +26,11 @@ #include #include #include -#include #include LoadSettings::LoadSettings(QObject *parent):QObject(parent) { - QThread::sleep(10); // KScreen is slow loading screen modes KScreen::GetConfigOperation *operation = new KScreen::GetConfigOperation(); connect(operation, &KScreen::GetConfigOperation::finished, [this, operation] (KScreen::ConfigOperation *op) { KScreen::GetConfigOperation *configOp = qobject_cast(op); diff --git a/lxqt-config-monitor/monitorpicture.ui b/lxqt-config-monitor/monitorpicture.ui index c0aa496..bdce68e 100644 --- a/lxqt-config-monitor/monitorpicture.ui +++ b/lxqt-config-monitor/monitorpicture.ui @@ -11,7 +11,7 @@ - Dialog + Dialog diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_da.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_da.desktop new file mode 100644 index 0000000..9f0e877 --- /dev/null +++ b/lxqt-config-monitor/translations/lxqt-config-monitor_da.desktop @@ -0,0 +1,4 @@ +# Translations +Name[da]=Skærmindstillinger +GenericName[da]=Skærmindstillinger +Comment[da]=Konfigurér skærme diff --git a/lxqt-config-monitor/translations/lxqt-config-monitor_fr.desktop b/lxqt-config-monitor/translations/lxqt-config-monitor_fr.desktop new file mode 100644 index 0000000..3d9f7ca --- /dev/null +++ b/lxqt-config-monitor/translations/lxqt-config-monitor_fr.desktop @@ -0,0 +1,3 @@ +Name[fr]=Paramètres de l'écran +GenericName[fr]=Paramètres de l'écran +Comment[fr]=Configurer les écrans diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a707c63..7641e79 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -213,6 +213,7 @@ private: LXQtConfig::MainWindow::MainWindow() : QMainWindow() { setupUi(this); + view->installEventFilter(this); /* To always have the intended layout on startup, the listview should be shown after it's fully formed. */ @@ -225,7 +226,7 @@ LXQtConfig::MainWindow::MainWindow() : QMainWindow() view->setUniformItemSizes(true); view->setCategoryDrawer(new QCategoryDrawerV3(view)); - connect(view, &QAbstractItemView::activated, this, &MainWindow::activateItem); + connect(view, &QAbstractItemView::activated, [this] (const QModelIndex & index) { pendingActivation = index; }); view->setFocus(); QTimer::singleShot(0, [this] { setSizing(); }); @@ -249,13 +250,50 @@ void LXQtConfig::MainWindow::load() QApplication::restoreOverrideCursor(); } -void LXQtConfig::MainWindow::activateItem(const QModelIndex &index) +void LXQtConfig::MainWindow::activateItem() { - if (!index.isValid()) - return; + if (pendingActivation.isValid()) + { + model->activateItem(pendingActivation); + pendingActivation = QModelIndex{}; + } +} - QModelIndex orig = proxyModel->mapToSource(index); - model->activateItem(orig); +/*Note: all this delayed activation is here to workaround the auto-repeated + * Enter/Return key activation -> if the user keeps pressing the enter/return + * we normaly will keep activating (spawning new processes) until the focus + * isn't stolen from our window. New process is not spawned until the + * (non-autorepeated) KeyRelease is delivered. + * + * ref https://github.com/lxde/lxqt/issues/965 + */ +bool LXQtConfig::MainWindow::eventFilter(QObject * watched, QEvent * event) +{ + if (view != watched) + return false; + switch (event->type()) + { + case QEvent::KeyPress: + case QEvent::KeyRelease: + { + QKeyEvent * ev = dynamic_cast(event); + switch (ev->key()) + { + case Qt::Key_Enter: + case Qt::Key_Return: + if (QEvent::KeyRelease == ev->type() && !ev->isAutoRepeat()) + activateItem(); + } + } + break; + case QEvent::MouseButtonRelease: + activateItem(); + break; + default: + //keep warnings quiet + break; + } + return false; } void LXQtConfig::MainWindow::setSizing() diff --git a/src/mainwindow.h b/src/mainwindow.h index ae97cc9..d768fed 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -52,18 +52,20 @@ public: protected: virtual bool event(QEvent * event) override; + virtual bool eventFilter(QObject * watched, QEvent * event) override; private: QCategorizedSortFilterProxyModel *proxyModel; ConfigPaneModel *model; + QPersistentModelIndex pendingActivation; private: void builGroup(const QDomElement& xml); void setSizing(); + void activateItem(); private slots: void load(); - void activateItem(const QModelIndex &index); }; }; // namespace diff --git a/src/qcategorizedview/qcategorizedview.cpp b/src/qcategorizedview/qcategorizedview.cpp index 238c782..7441a0b 100644 --- a/src/qcategorizedview/qcategorizedview.cpp +++ b/src/qcategorizedview/qcategorizedview.cpp @@ -516,6 +516,7 @@ void QCategorizedView::Private::_k_slotCollapseOrExpandClicked(QModelIndex) QCategorizedView::QCategorizedView(QWidget *parent) : QListView(parent) , d(new Private(this)) + , enterPressed(false) { } @@ -1536,6 +1537,45 @@ void QCategorizedView::slotLayoutChanged() } } +void QCategorizedView::keyPressEvent(QKeyEvent *event) +{ + // Don't emit activated() by pressing Enter! ... + switch (event->key()) { + case Qt::Key_Enter: + case Qt::Key_Return: + if (state() != EditingState) { + event->ignore(); + if (hasFocus() && !event->isAutoRepeat()) + enterPressed = true; // Pressed after getting focus. + return; + } + break; + default: break; + } + QAbstractItemView::keyPressEvent(event); +} + +void QCategorizedView::keyReleaseEvent(QKeyEvent *event) +{ + // ... Emit activated() by releasing Enter instead! + switch (event->key()) { + case Qt::Key_Enter: + case Qt::Key_Return: + if (hasFocus() && state() != EditingState + && !event->isAutoRepeat() // No multiple signals. + && enterPressed // No signal if Enter is pressed before getting focus. + && currentIndex().isValid()) { + emit activated(currentIndex()); + event->accept(); + enterPressed = false; + return; + } + break; + default: break; + } + QAbstractItemView::keyReleaseEvent(event); +} + //END: Public part #include "moc_qcategorizedview.cpp" diff --git a/src/qcategorizedview/qcategorizedview.h b/src/qcategorizedview/qcategorizedview.h index bc29ef3..323e012 100644 --- a/src/qcategorizedview/qcategorizedview.h +++ b/src/qcategorizedview/qcategorizedview.h @@ -318,6 +318,9 @@ protected: int start, int end); + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + protected Q_SLOTS: /** * @internal @@ -348,6 +351,11 @@ protected Q_SLOTS: private: class Private; Private *const d; + /** + * For knowing that Enter is pressed after + * the widget gets focus and not before that. + */ + bool enterPressed; Q_PRIVATE_SLOT(d, void _k_slotCollapseOrExpandClicked(QModelIndex)) }; diff --git a/src/translations/lxqt-config_da.desktop b/src/translations/lxqt-config_da.desktop index fd5493c..6ad9e88 100644 --- a/src/translations/lxqt-config_da.desktop +++ b/src/translations/lxqt-config_da.desktop @@ -1,4 +1,4 @@ # Translations -Comment[da]=Indstil LXQt moduler -GenericName[da]=LXQt Indstillingscenter -Name[da]=LXQt Indstillingscenter +Name[da]=LXQt-konfigurationscenter +GenericName[da]=Systemindstillinger +Comment[da]=Konfigurér dit system diff --git a/src/translations/lxqt-config_da_DK.desktop b/src/translations/lxqt-config_da_DK.desktop deleted file mode 100644 index ddb1d44..0000000 --- a/src/translations/lxqt-config_da_DK.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[da_DK]=Indstil LXQt moduler -GenericName[da_DK]=LXQt Indstillinger -Name[da_DK]=LXQt Konfigurationsstyring diff --git a/src/translations/lxqt-config_fr.desktop b/src/translations/lxqt-config_fr.desktop new file mode 100644 index 0000000..cc3dfa9 --- /dev/null +++ b/src/translations/lxqt-config_fr.desktop @@ -0,0 +1,4 @@ +# Translations +Comment[fr]=Configurer les modules de LXQt +GenericName[fr]=Configuration de LXQt +Name[fr]=Centre de configuration de LXQt diff --git a/src/translations/lxqt-config_fr_FR.desktop b/src/translations/lxqt-config_fr_FR.desktop deleted file mode 100644 index 81b31c2..0000000 --- a/src/translations/lxqt-config_fr_FR.desktop +++ /dev/null @@ -1,4 +0,0 @@ -# Translations -Comment[fr_FR]=Configurer les modules de LXQt -GenericName[fr_FR]=Configuration de LXQt -Name[fr_FR]=Centre de configuration de LXQt