Commit b361ef6f authored by David Jarvie's avatar David Jarvie
Browse files

Disable modal alarm messages config setting on Wayland

Can't bypass window manager hints on Wayland.
parent d2949e63
Pipeline #70571 failed with stage
in 4 minutes and 7 seconds
......@@ -139,7 +139,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<whatsthis context="@info:whatsthis">&lt;p>When saving a new alarm or alarm template, prompt for which calendar to store it in, if there is more than one active calendar.&lt;/p>&lt;p>Note that archived alarms are always stored in the default archived alarm calendar.&lt;/p></whatsthis>
<default>true</default>
</entry>
<entry name="ModalMessages" type="Bool">
<entry name="Base_ModalMessages" key="ModalMessages" type="Bool">
<label context="@label">Message windows have a title bar and take keyboard focus</label>
<whatsthis context="@info:whatsthis">&lt;p>Specify the characteristics of alarm message windows:&lt;ul>&lt;li>If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.&lt;/li>&lt;li>If unchecked, the window does not interfere with your typing when it is displayed, but it has no title bar and cannot be moved or resized.&lt;/li>&lt;/ul>&lt;/p></whatsthis>
<default>true</default>
......
......@@ -57,8 +57,8 @@ using namespace KHolidays;
#include <QIcon>
#if KDEPIM_HAVE_X11
#include <KWindowInfo>
#include <KWindowSystem>
#endif
#include <KWindowSystem>
#include <KHelpClient>
#include <QLabel>
......@@ -1852,16 +1852,19 @@ ViewPrefTab::ViewPrefTab(StackedScrollGroup* scrollGroup)
box->setStretchFactor(new QWidget(widget), 1); // left adjust the controls
grid->addWidget(widget, 2, 1, Qt::AlignLeft);
grid->setRowMinimumHeight(3, style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mModalMessages = new QCheckBox(i18nc("@option:check", "Message windows have a title bar and take keyboard focus"), group);
mModalMessages->setMinimumSize(mModalMessages->sizeHint());
mModalMessages->setWhatsThis(xi18nc("@info:whatsthis",
"<para>Specify the characteristics of alarm message windows:"
"<list><item>If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.</item>"
"<item>If unchecked, the window does not interfere with your typing when "
"it is displayed, but it has no title bar and cannot be moved or resized.</item></list></para>"));
grid->addWidget(mModalMessages, 4, 0, 1, 2, Qt::AlignLeft);
if (KWindowSystem::isPlatformX11())
{
grid->setRowMinimumHeight(3, style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mModalMessages = new QCheckBox(i18nc("@option:check", "Message windows have a title bar and take keyboard focus"), group);
mModalMessages->setMinimumSize(mModalMessages->sizeHint());
mModalMessages->setWhatsThis(xi18nc("@info:whatsthis",
"<para>Specify the characteristics of alarm message windows:"
"<list><item>If checked, the window is a normal window with a title bar, which grabs keyboard input when it is displayed.</item>"
"<item>If unchecked, the window does not interfere with your typing when "
"it is displayed, but it has no title bar and cannot be moved or resized.</item></list></para>"));
grid->addWidget(mModalMessages, 4, 0, 1, 2, Qt::AlignLeft);
}
if (topWindows)
topWindows->addStretch(); // top adjust the widgets
......@@ -1910,7 +1913,8 @@ void ViewPrefTab::restore(bool, bool allTabs)
{
mWindowPosition->setButton(Preferences::messageButtonDelay() ? 1 : 0);
mWindowButtonDelay->setValue(Preferences::messageButtonDelay());
mModalMessages->setChecked(Preferences::modalMessages());
if (mModalMessages)
mModalMessages->setChecked(Preferences::modalMessages());
}
}
......@@ -1957,9 +1961,12 @@ void ViewPrefTab::apply(bool syncToDisc)
n = mWindowButtonDelay->value();
if (n != Preferences::messageButtonDelay())
Preferences::setMessageButtonDelay(n);
b = mModalMessages->isChecked();
if (b != Preferences::modalMessages())
Preferences::setModalMessages(b);
if (mModalMessages)
{
b = mModalMessages->isChecked();
if (b != Preferences::modalMessages())
Preferences::setModalMessages(b);
}
PrefsTabBase::apply(syncToDisc);
}
......
......@@ -270,7 +270,7 @@ private:
ButtonGroup* mWindowPosition;
QSpinBox* mWindowButtonDelay;
QLabel* mWindowButtonDelayLabel;
QCheckBox* mModalMessages;
QCheckBox* mModalMessages {nullptr};
int mTabGeneral; // index of General tab
int mTabWindows; // index of Alarm Windows tab
};
......
......@@ -23,6 +23,7 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <KMessageBox>
#include <KWindowSystem>
#include <QFile>
#include <QSaveFile>
......@@ -263,6 +264,23 @@ void Preferences::setNoAutoStart(bool yes)
self()->setBase_NoAutoStart(yes);
}
/******************************************************************************
* Get whether message windows should have a title bar and take keyboard focus.
*/
bool Preferences::modalMessages()
{
return !KWindowSystem::isPlatformX11() || self()->base_ModalMessages();
}
/******************************************************************************
* Set whether message windows should have a title bar and take keyboard focus.
*/
void Preferences::setModalMessages(bool yes)
{
if (KWindowSystem::isPlatformX11())
self()->setBase_ModalMessages(yes);
}
/******************************************************************************
* Get the user's time zone, or if none has been chosen, the system time zone.
* Reply = time zone, or invalid to use the local time zone.
......
/*
* preferences.h - program preference settings
* Program: kalarm
* SPDX-FileCopyrightText: 2001-2020 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2001-2021 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -48,6 +48,8 @@ public:
static void setAskAutoStart(bool yes);
static bool noAutoStart() { return self()->base_NoAutoStart(); }
static void setNoAutoStart(bool yes);
static bool modalMessages();
static void setModalMessages(bool yes);
static KADateTime::Spec timeSpec();
static QTimeZone timeSpecAsZone();
static void setTimeSpec(const KADateTime::Spec&);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment