diff --git a/doc/kcontrol/cursortheme/index.docbook b/doc/kcontrol/cursortheme/index.docbook --- a/doc/kcontrol/cursortheme/index.docbook +++ b/doc/kcontrol/cursortheme/index.docbook @@ -53,7 +53,7 @@ -The size can be set to the Resolution dependent or one of the sizes available for your theme. +The size can be set to one of the sizes available for your theme. diff --git a/kcms/cursortheme/CMakeLists.txt b/kcms/cursortheme/CMakeLists.txt --- a/kcms/cursortheme/CMakeLists.txt +++ b/kcms/cursortheme/CMakeLists.txt @@ -54,6 +54,7 @@ ########### install files ############### install(FILES cursorthemesettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR}) +install(FILES delete_cursor_old_default_size.upd delete_cursor_old_default_size.pl DESTINATION ${KDE_INSTALL_DATADIR}/kconf_update) install( FILES kcm_cursortheme.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) install( FILES xcursor/xcursor.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR} ) diff --git a/kcms/cursortheme/cursorthemesettings.kcfg b/kcms/cursortheme/cursorthemesettings.kcfg --- a/kcms/cursortheme/cursorthemesettings.kcfg +++ b/kcms/cursortheme/cursorthemesettings.kcfg @@ -11,7 +11,7 @@ - 0 + 24 diff --git a/kcms/cursortheme/delete_cursor_old_default_size.pl b/kcms/cursortheme/delete_cursor_old_default_size.pl new file mode 100644 --- /dev/null +++ b/kcms/cursortheme/delete_cursor_old_default_size.pl @@ -0,0 +1,10 @@ +#! /usr/bin/perl + +use strict; + +while (<>) +{ + chomp; + s/cursorSize=0/# DELETE cursorSize/; + print "$_\n"; +} diff --git a/kcms/cursortheme/delete_cursor_old_default_size.upd b/kcms/cursortheme/delete_cursor_old_default_size.upd new file mode 100644 --- /dev/null +++ b/kcms/cursortheme/delete_cursor_old_default_size.upd @@ -0,0 +1,8 @@ +Version=5 + +# Delete cursor size if it's old default +Id=DeleteCursorOldDefaultSize +Options=overwrite +File=kcminputrc +Group=Mouse +Script=delete_cursor_old_default_size.pl,perl diff --git a/kcms/cursortheme/kcmcursortheme.cpp b/kcms/cursortheme/kcmcursortheme.cpp --- a/kcms/cursortheme/kcmcursortheme.cpp +++ b/kcms/cursortheme/kcmcursortheme.cpp @@ -217,11 +217,7 @@ if (m_pixmap.height() > maxIconHeight) { maxIconHeight = m_pixmap.height(); } - QStandardItem *item = new QStandardItem(QIcon(m_pixmap), - i18nc("@item:inlistbox size", "Resolution dependent")); - item->setData(0); - m_sizesModel->appendRow(item); - comboBoxList << 0; + foreach (i, sizes) { m_pixmap = theme->createIcon(i); if (m_pixmap.width() > maxIconWidth) { @@ -332,9 +328,6 @@ int CursorThemeConfig::cursorSizeIndex(int cursorSize) const { if (m_sizesModel->rowCount() > 0) { - if (cursorSize == 0) { - return 0; - } const auto items = m_sizesModel->findItems(QString::number(cursorSize)); if (items.count() == 1) { return items.first()->row(); diff --git a/kcms/krdb/krdb.cpp b/kcms/krdb/krdb.cpp --- a/kcms/krdb/krdb.cpp +++ b/kcms/krdb/krdb.cpp @@ -488,7 +488,7 @@ // Export the Xcursor theme & size settings KConfigGroup mousecfg(KSharedConfig::openConfig( QStringLiteral("kcminputrc") ), "Mouse" ); QString theme = mousecfg.readEntry("cursorTheme", QString("breeze_cursors")); - QString size = mousecfg.readEntry("cursorSize", QString("0")); + QString size = mousecfg.readEntry("cursorSize", QString("24")); QString contents; if (!theme.isNull()) diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp --- a/kcms/lookandfeel/kcm.cpp +++ b/kcms/lookandfeel/kcm.cpp @@ -478,7 +478,7 @@ // in previous versions the Xfixes code wasn't enabled due to a bug in the // build system (freedesktop bug #975). #if defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2 && XCURSOR_LIB_VERSION >= 10105 - const int cursorSize = cg.readEntry("cursorSize", 0); + const int cursorSize = cg.readEntry("cursorSize", 24); QDir themeDir = cursorThemeDir(themeName, 0); diff --git a/kcms/mouse/backends/x11/x11_backend.cpp b/kcms/mouse/backends/x11/x11_backend.cpp --- a/kcms/mouse/backends/x11/x11_backend.cpp +++ b/kcms/mouse/backends/x11/x11_backend.cpp @@ -127,30 +127,20 @@ auto config = KSharedConfig::openConfig("kcminputrc", KConfig::NoGlobals); KConfigGroup group = config->group("Mouse"); QString theme = group.readEntry("cursorTheme", QString()); - QString size = group.readEntry("cursorSize", QString()); - - int intSize = -1; - if (size.isEmpty()) { - bool ok; - uint value = size.toUInt(&ok); - if (ok) { - intSize = value; - } - } + const int size = group.readEntry("cursorSize", 24); + // Note: If you update this code, update kapplymousetheme as well. // use a default value for theme only if it's not configured at all, not even in X resources if (theme.isEmpty() && currentCursorTheme().isEmpty()) { theme = "breeze_cursors"; } - applyCursorTheme(theme, intSize); + applyCursorTheme(theme, size); // Tell klauncher to set the XCURSOR_THEME and XCURSOR_SIZE environment // variables when launching applications. if (!theme.isEmpty()) { UpdateLaunchEnvJob launchEnvJob(QStringLiteral("XCURSOR_THEME"), theme); } - if (!size.isEmpty()) { - UpdateLaunchEnvJob launchEnvJob(QStringLiteral("XCURSOR_SIZE"), size); - } + UpdateLaunchEnvJob launchEnvJob(QStringLiteral("XCURSOR_SIZE"), QByteArray::number(size)); }