Commit ba9b2f71 authored by David Jarvie's avatar David Jarvie

Add option to give alarms a name

parent 3b0afdbf
Pipeline #38881 passed with stage
in 24 minutes and 48 seconds
KAlarm Change Log
=== Version 3.1.0 (KDE Applications 20.12) --- 25 October 2020 ===
=== Version 3.1.0 (KDE Applications 20.12) --- 28 October 2020 ===
+ Add option to show alarm message as a notification instead of in a window [KDE Bug 345922]
+ Add option to give alarms a name.
+ Don't execute display alarms while desktop notifications are inhibited.
+ Cancel any screen saver when an alarm is displayed.
......
doc/editwindow-simple.png

47.8 KB | W: | H:

doc/editwindow-simple.png

49 KB | W: | H:

doc/editwindow-simple.png
doc/editwindow-simple.png
doc/editwindow-simple.png
doc/editwindow-simple.png
  • 2-up
  • Swipe
  • Onion skin
doc/editwindow.png

72.5 KB | W: | H:

doc/editwindow.png

73.5 KB | W: | H:

doc/editwindow.png
doc/editwindow.png
doc/editwindow.png
doc/editwindow.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -39,7 +39,7 @@
<!-- Don't change format of date and version of the documentation -->
<date>2020-10-22</date>
<date>2020-10-28</date>
<releaseinfo>3.1.0 (Applications 20.12)</releaseinfo>
<abstract>
......@@ -66,10 +66,10 @@
messages, the playing of sound files, the execution of commands and
the sending of emails.</para>
<para>In its default graphical mode, &kalarm; displays the list of
pending alarms, showing their times and details. You can create new
alarms, or you can select existing alarms for modification or
deletion. You can also optionally view expired alarms.</para>
<para>&kalarm; displays the list of pending alarms, showing their
times and details. You can create new alarms, or you can select
existing alarms for modification or deletion. You can also optionally
view expired alarms.</para>
<para>When configuring an alarm, you can choose whether it should
repeat, and whether the alarm should be canceled if it cannot be
......@@ -186,7 +186,7 @@ background.</para>
<title>Alarm List</title>
<para>The main &kalarm; window displays the current list of pending
alarms, showing their times, repetition intervals, colors, and
alarms, showing their times, repetition intervals, colors, names, and
message texts, names of files to play or display, commands to execute
or email subjects. (For a recurring alarm, the time shown is its next
scheduled trigger time. For an alarm with a reminder, the time shown
......@@ -194,6 +194,11 @@ is the time of the alarm proper, not the reminder time.) An icon at
the left of each alarm text/file/command/email subject indicates the
type of alarm.</para>
<para>Note that the <guilabel>Name</guilabel> column only exists if
the use of alarm names is enabled in the
<link linkend="preferences-general">General</link> tab of the
Configuration dialog.</para>
<screenshot>
<screeninfo>Screenshot of the &kalarm; main window</screeninfo>
<mediaobject>
......@@ -222,17 +227,19 @@ above.</para>
<title>Changing the Alarm List Appearance</title>
<para>The alarms may be ordered by date/time, repeat interval, color,
type or text by clicking on the titlebar for the appropriate column.
To reverse the sort order, click the column titlebar again.</para>
type, name or text by clicking on the titlebar for the appropriate
column. To reverse the sort order, click the column titlebar
again.</para>
<para>You can optionally show the remaining time until each alarm is
due, together with, or instead of, the alarm's scheduled time.</para>
<para>You can select which columns to display or hide by
<mousebutton>Right</mousebutton> clicking on the column headings and
using the context menu to set the columns to show. But note that the
<guilabel>Message, File or Command</guilabel> column, and at least one
of the <guilabel>Time</guilabel> or <guilabel>Time To</guilabel>
using the context menu to set the columns to show. But note that at
least one of the <guilabel>Name</guilabel> or
<guilabel>Message, File or Command</guilabel> columns, and at least
one of the <guilabel>Time</guilabel> or <guilabel>Time To</guilabel>
columns, are always shown.</para>
<para>If you use multiple alarm calendars, you can color code alarms
......@@ -1173,6 +1180,21 @@ the Alarm Edit dialog using the
</mediaobject>
</screenshot>
<sect2>
<title>Alarm Name</title>
<para>You can give a name to the alarm in the
<guilabel>Alarm name</guilabel> field. This is a convenience to help
you identify the alarm more easily. You do not have to enter a name,
and it need not be unique.</para>
<para>Note that this field is only displayed if the the use of alarm
names is enabled in the
<link linkend="preferences-general">General</link> tab of the
Configuration dialog.</para>
</sect2>
<sect2>
<title>Alarm Action</title>
......@@ -2549,6 +2571,14 @@ option is automatically re-enabled by default whenever you change run
mode.</para>
</listitem>
<listitem><para><guilabel>Use alarm names</guilabel>: Specify
whether each alarm can be given a name to help you to identify it.
This determines whether the <guilabel>Name</guilabel> column will be
shown in the <link linkend="alarm-list">alarm list</link>, and
whether the <guilabel>Alarm name</guilabel> field will appear in the
<link linkend="alarm-edit-dlg">Alarm Edit dialog</link>.</para>
</listitem>
<listitem><para><guilabel>Confirm alarm deletions</guilabel>: Specify
whether you should be prompted for confirmation each time you delete
an alarm.</para>
......@@ -3217,7 +3247,11 @@ time.</para>
with this option.</entry>
</row>
<row>
<entry><option>-n</option>, <option>--notify</option></entry>
<entry><option>-n</option>, <option>--name</option></entry>
<entry>Specify a name to help you to identify the alarm.</entry>
</row>
<row>
<entry><option>-N</option>, <option>--notify</option></entry>
<entry>Display the alarm as a notification, not in a window.
<option>--color</option>, <option>--colorfg</option>,
<option>--play</option>, <option>--ack-confirm</option> and
......@@ -3559,7 +3593,8 @@ unchanged.</para>
</refnamediv>
<refsynopsisdiv>
<synopsis>
bool scheduleMessage(const QString&amp; <replaceable>message</replaceable>,
bool scheduleMessage(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>message</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -3573,7 +3608,8 @@ bool scheduleMessage(const QString&amp; <replaceable>message</replaceable>,
int <replaceable>subRepeatCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleMessage(const QString&amp; <replaceable>message</replaceable>,
bool scheduleMessage(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>message</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -3587,7 +3623,8 @@ bool scheduleMessage(const QString&amp; <replaceable>message</replaceable>,
int <replaceable>recurCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleMessage(const QString&amp; <replaceable>message</replaceable>,
bool scheduleMessage(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>message</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -3604,6 +3641,13 @@ bool scheduleMessage(const QString&amp; <replaceable>message</replaceable>,
<refsect2>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>Specifies an optional name for the alarm.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>message</parameter></term>
<listitem>
......@@ -3819,7 +3863,8 @@ text or image file.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
bool scheduleFile(const QString&amp; <replaceable>URL</replaceable>,
bool scheduleFile(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>URL</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -3831,7 +3876,8 @@ bool scheduleFile(const QString&amp; <replaceable>URL</replaceable>,
int <replaceable>subRepeatCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleFile(const QString&amp; <replaceable>URL</replaceable>,
bool scheduleFile(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>URL</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -3843,7 +3889,8 @@ bool scheduleFile(const QString&amp; <replaceable>URL</replaceable>,
int <replaceable>recurCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleFile(const QString&amp; <replaceable>URL</replaceable>,
bool scheduleFile(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>URL</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -3858,6 +3905,13 @@ bool scheduleFile(const QString&amp; <replaceable>URL</replaceable>,
<refsect2>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>Specifies an optional name for the alarm.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>URL</parameter></term>
<listitem>
......@@ -4043,7 +4097,8 @@ command.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
bool scheduleCommand(const QString&amp; <replaceable>commandLine</replaceable>,
bool scheduleCommand(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>commandLine</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -4052,7 +4107,8 @@ bool scheduleCommand(const QString&amp; <replaceable>commandLine</replaceable>,
int <replaceable>subRepeatCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleCommand(const QString&amp; <replaceable>commandLine</replaceable>,
bool scheduleCommand(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>commandLine</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -4061,7 +4117,8 @@ bool scheduleCommand(const QString&amp; <replaceable>commandLine</replaceable>,
int <replaceable>recurCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleCommand(const QString&amp; <replaceable>commandLine</replaceable>,
bool scheduleCommand(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>commandLine</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
unsigned <replaceable>flags</replaceable>,
......@@ -4073,6 +4130,13 @@ bool scheduleCommand(const QString&amp; <replaceable>commandLine</replaceable>,
<refsect2>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>Specifies an optional name for the alarm.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>commandLine</parameter></term>
<listitem>
......@@ -4225,7 +4289,8 @@ parameters, its usage is identical to
</refnamediv>
<refsynopsisdiv>
<synopsis>
bool scheduleEmail(const QString&amp; <replaceable>fromID</replaceable>,
bool scheduleEmail(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>fromID</replaceable>,
const QString&amp; <replaceable>addresses</replaceable>,
const QString&amp; <replaceable>subject</replaceable>,
const QString&amp; <replaceable>message</replaceable>,
......@@ -4238,7 +4303,8 @@ bool scheduleEmail(const QString&amp; <replaceable>fromID</replaceable>,
int <replaceable>subRepeatCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleEmail(const QString&amp; <replaceable>fromID</replaceable>,
bool scheduleEmail(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>fromID</replaceable>,
const QString&amp; <replaceable>addresses</replaceable>,
const QString&amp; <replaceable>subject</replaceable>,
const QString&amp; <replaceable>message</replaceable>,
......@@ -4251,7 +4317,8 @@ bool scheduleEmail(const QString&amp; <replaceable>fromID</replaceable>,
int <replaceable>recurCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleEmail(const QString&amp; <replaceable>fromID</replaceable>,
bool scheduleEmail(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>fromID</replaceable>,
const QString&amp; <replaceable>addresses</replaceable>,
const QString&amp; <replaceable>subject</replaceable>,
const QString&amp; <replaceable>message</replaceable>,
......@@ -4267,6 +4334,13 @@ bool scheduleEmail(const QString&amp; <replaceable>fromID</replaceable>,
<refsect2>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>Specifies an optional name for the alarm.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fromID</parameter></term>
<listitem>
......@@ -4450,7 +4524,8 @@ command.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis>
bool scheduleAudio(const QString&amp; <replaceable>audioURL</replaceable>,
bool scheduleAudio(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>audioURL</replaceable>,
int <replaceable>volumePercent</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
......@@ -4460,7 +4535,8 @@ bool scheduleAudio(const QString&amp; <replaceable>audioURL</replaceable>,
int <replaceable>subRepeatCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleAudio(const QString&amp; <replaceable>audioURL</replaceable>,
bool scheduleAudio(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>audioURL</replaceable>,
int <replaceable>volumePercent</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
......@@ -4470,7 +4546,8 @@ bool scheduleAudio(const QString&amp; <replaceable>audioURL</replaceable>,
int <replaceable>recurCount</replaceable>)
</synopsis>
<synopsis>
bool scheduleAudio(const QString&amp; <replaceable>audioURL</replaceable>,
bool scheduleAudio(const QString&amp; <replaceable>name</replaceable>,
const QString&amp; <replaceable>audioURL</replaceable>,
int <replaceable>volumePercent</replaceable>,
const QString&amp; <replaceable>startDateTime</replaceable>,
int <replaceable>lateCancel</replaceable>,
......@@ -4483,6 +4560,13 @@ bool scheduleAudio(const QString&amp; <replaceable>audioURL</replaceable>,
<refsect2>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>Specifies an optional name for the alarm.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>audioURL</parameter></term>
<listitem>
......
doc/mainwindow-calendars.png

59 KB | W: | H:

doc/mainwindow-calendars.png

61.6 KB | W: | H:

doc/mainwindow-calendars.png
doc/mainwindow-calendars.png
doc/mainwindow-calendars.png
doc/mainwindow-calendars.png
  • 2-up
  • Swipe
  • Onion skin
doc/mainwindow.png

47.6 KB | W: | H:

doc/mainwindow.png

49.7 KB | W: | H:

doc/mainwindow.png
doc/mainwindow.png
doc/mainwindow.png
doc/mainwindow.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -28,37 +28,52 @@ AlarmListView::AlarmListView(const QByteArray& configGroup, QWidget* parent)
connect(header(), &QHeaderView::sectionMoved, this, &AlarmListView::saveColumnsState);
header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), &QWidget::customContextMenuRequested, this, &AlarmListView::headerContextMenuRequested);
Preferences::connect(&Preferences::useAlarmNameChanged, this, &AlarmListView::useAlarmNameChanged);
}
/******************************************************************************
* Return which of the optional columns are currently shown.
* Note that the column order must be the same as in setColumnsVisible().
* Reply = array of 5 columns if not using alarm names;
* = array of 6 columns if not using alarm names.
*/
QList<bool> AlarmListView::columnsVisible() const
{
if (!model())
return {};
return { !header()->isSectionHidden(AlarmListModel::TimeColumn),
!header()->isSectionHidden(AlarmListModel::TimeToColumn),
!header()->isSectionHidden(AlarmListModel::RepeatColumn),
!header()->isSectionHidden(AlarmListModel::ColourColumn),
!header()->isSectionHidden(AlarmListModel::TypeColumn) };
QList<bool> vis{ !header()->isSectionHidden(AlarmListModel::TimeColumn),
!header()->isSectionHidden(AlarmListModel::TimeToColumn),
!header()->isSectionHidden(AlarmListModel::RepeatColumn),
!header()->isSectionHidden(AlarmListModel::ColourColumn),
!header()->isSectionHidden(AlarmListModel::TypeColumn) };
if (Preferences::useAlarmName())
vis += !header()->isSectionHidden(AlarmListModel::TextColumn);
return vis;
}
/******************************************************************************
* Set which of the optional columns are to be shown.
* 'show' = array of 5 columns if not using alarm names;
* = array of 6 columns if not using alarm names.
* Note that the column order must be the same as in columnsVisible().
*/
void AlarmListView::setColumnsVisible(const QList<bool>& show)
{
if (!model())
return;
const QList<bool> vis = (show.size() < 5) ? QList<bool>{true, false, true, true, true} : show;
const bool useName = Preferences::useAlarmName();
QList<bool> vis{ true, false, true, true, true, !useName };
const int colCount = useName ? 6 : 5;
for (int i = 0; i < colCount; ++i)
vis[i] = show[i];
header()->setSectionHidden(AlarmListModel::TimeColumn, !vis[0]);
header()->setSectionHidden(AlarmListModel::TimeToColumn, !vis[1]);
header()->setSectionHidden(AlarmListModel::RepeatColumn, !vis[2]);
header()->setSectionHidden(AlarmListModel::ColourColumn, !vis[3]);
header()->setSectionHidden(AlarmListModel::TypeColumn, !vis[4]);
header()->setSectionHidden(AlarmListModel::NameColumn, !useName);
header()->setSectionHidden(AlarmListModel::TextColumn, !vis[5]);
setReplaceBlankName();
setSortingEnabled(false); // sortByColumn() won't work if sorting is already enabled!
sortByColumn(vis[0] ? AlarmListModel::TimeColumn : AlarmListModel::TimeToColumn, Qt::AscendingOrder);
}
......@@ -71,13 +86,23 @@ void AlarmListView::initSections()
KConfigGroup config(KSharedConfig::openConfig(), mConfigGroup.constData());
const QByteArray settings = config.readEntry("ListHead", QByteArray());
if (!settings.isEmpty())
{
header()->restoreState(settings);
const bool useName = Preferences::useAlarmName();
header()->setSectionHidden(AlarmListModel::NameColumn, !useName);
if (!useName)
{
header()->setSectionHidden(AlarmListModel::TextColumn, false);
setReplaceBlankName();
}
}
header()->setSectionsMovable(true);
header()->setSectionResizeMode(AlarmListModel::TimeColumn, QHeaderView::ResizeToContents);
header()->setSectionResizeMode(AlarmListModel::TimeToColumn, QHeaderView::ResizeToContents);
header()->setSectionResizeMode(AlarmListModel::RepeatColumn, QHeaderView::ResizeToContents);
header()->setSectionResizeMode(AlarmListModel::ColourColumn, QHeaderView::Fixed);
header()->setSectionResizeMode(AlarmListModel::TypeColumn, QHeaderView::Fixed);
header()->setSectionResizeMode(AlarmListModel::NameColumn, QHeaderView::ResizeToContents);
header()->setSectionResizeMode(AlarmListModel::TextColumn, QHeaderView::Stretch);
header()->setStretchLastSection(true); // necessary to ensure ResizeToContents columns do resize to contents!
const int minWidth = viewOptions().fontMetrics.lineSpacing() * 3 / 4;
......@@ -105,10 +130,12 @@ void AlarmListView::saveColumnsState()
void AlarmListView::headerContextMenuRequested(const QPoint& pt)
{
QAbstractItemModel* almodel = model();
int count = header()->count();
QMenu menu;
for (int col = 0; col < count; ++col)
const bool useName = Preferences::useAlarmName();
for (int col = 0, count = header()->count(); col < count; ++col)
{
if (col == AlarmListModel::NameColumn && !useName)
continue;
const QString title = almodel->headerData(col, Qt::Horizontal, ResourceDataModelBase::ColumnTitleRole).toString();
if (!title.isEmpty())
{
......@@ -116,8 +143,10 @@ void AlarmListView::headerContextMenuRequested(const QPoint& pt)
act->setData(col);
act->setCheckable(true);
act->setChecked(!header()->isSectionHidden(col));
if (col == AlarmListModel::TextColumn)
act->setEnabled(false); // don't allow text column to be hidden
if (col == AlarmListModel::NameColumn)
act->setEnabled(false); // don't allow name column to be hidden if name is used
else if (col == AlarmListModel::TextColumn && !useName)
act->setEnabled(false); // don't allow text column to be hidden if name not used
else
QObject::connect(act, &QAction::triggered,
this, [this, &menu, act] { showHideColumn(menu, act); });
......@@ -127,6 +156,16 @@ void AlarmListView::headerContextMenuRequested(const QPoint& pt)
menu.exec(header()->mapToGlobal(pt));
}
/******************************************************************************
* Called when the 'use alarm name' setting has changed.
*/
void AlarmListView::useAlarmNameChanged(bool use)
{
header()->setSectionHidden(AlarmListModel::NameColumn, !use);
header()->setSectionHidden(AlarmListModel::TextColumn, use);
setReplaceBlankName();
}
/******************************************************************************
* Show or hide a column according to the header context menu.
*/
......@@ -139,10 +178,23 @@ void AlarmListView::showHideColumn(QMenu& menu, QAction* act)
header()->setSectionHidden(col, !show);
if (col == AlarmListModel::TimeColumn || col == AlarmListModel::TimeToColumn)
enableTimeColumns(&menu);
if (col == AlarmListModel::TextColumn)
setReplaceBlankName();
saveColumnsState();
Q_EMIT columnsVisibleChanged();
}
/******************************************************************************
* Set whether to replace a blank alarm name with the alarm text.
*/
void AlarmListView::setReplaceBlankName()
{
bool textHidden = header()->isSectionHidden(AlarmListModel::TextColumn);
AlarmListModel* almodel = qobject_cast<AlarmListModel*>(model());
if (almodel)
almodel->setReplaceBlankName(textHidden);
}
/******************************************************************************
* Disable Time or Time To in the context menu if the other one is not
* selected to be displayed, to ensure that at least one is always shown.
......
......@@ -19,7 +19,10 @@ class AlarmListView : public EventListView
Q_OBJECT
public:
explicit AlarmListView(const QByteArray& configGroup, QWidget* parent = nullptr);
/** Return which of the optional columns are currently shown. */
QList<bool> columnsVisible() const;
void setColumnsVisible(const QList<bool>& show);
Q_SIGNALS:
......@@ -31,9 +34,11 @@ protected Q_SLOTS:
private Q_SLOTS:
void saveColumnsState();
void headerContextMenuRequested(const QPoint&);
void useAlarmNameChanged(bool);
private:
void showHideColumn(QMenu&, QAction*);
void setReplaceBlankName();
void enableTimeColumns(QMenu*);
QByteArray mConfigGroup;
......
......@@ -53,6 +53,21 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
QVBoxLayout* topLayout = new QVBoxLayout(this);
if (Preferences::useAlarmName())
{
QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
topLayout->addLayout(hlayout);
QLabel* label = new QLabel(i18nc("@label:textbox", "Alarm name:"), this);
label->setFixedSize(label->sizeHint());
hlayout->addWidget(label);
mName = new KLineEdit(this);
mName->setMinimumSize(mName->sizeHint());
label->setBuddy(mName);
mName->setWhatsThis(i18nc("@info:whatsthis", "Enter a name to help you identify this alarm. This is optional and need not be unique."));
hlayout->addWidget(mName);
}
// Prefix and suffix to the name in the alarm text
// Get default prefix and suffix texts from config file
KConfigGroup config(KSharedConfig::openConfig(), "General");
......@@ -264,6 +279,7 @@ QVector<KAEvent> BirthdayDlg::events() const
if (date <= today)
date.setDate(thisYear + 1, date.month(), date.day());
KAEvent event(KADateTime(date, KADateTime::LocalZone),
(mName ? mName->text() : QString()),
mPrefix->text() + name + mSuffix->text(),
mFontColourButton->bgColour(), mFontColourButton->fgColour(),
mFontColourButton->font(), KAEvent::MESSAGE, mLateCancel->minutes(),
......
/*
* birthdaydlg.h - dialog to pick birthdays from address book
* Program: kalarm
* SPDX-FileCopyrightText: 2002-2005, 2007-2011 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2002-2020 David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -10,9 +10,10 @@
#include <KAlarmCal/KAEvent>
#include <KLineEdit>
#include <QDialog>
#include <QVector>
#include <QLineEdit>
class QFocusEvent;
class QTreeView;
......@@ -31,51 +32,53 @@ using namespace KAlarmCal;
class BirthdayDlg : public QDialog
{
Q_OBJECT
public:
explicit BirthdayDlg(QWidget* parent = nullptr);
QVector<KAEvent> events() const;
Q_OBJECT
public:
explicit BirthdayDlg(QWidget* parent = nullptr);
QVector<KAEvent> events() const;
protected Q_SLOTS:
virtual void slotOk();
protected Q_SLOTS:
virtual void slotOk();
private Q_SLOTS:
void slotSelectionChanged();
void slotTextLostFocus();
void resizeViewColumns();
void setColours(const QColor& fg, const QColor& bg);
private Q_SLOTS:
void slotSelectionChanged();
void slotTextLostFocus();
void resizeViewColumns();
void setColours(const QColor& fg, const QColor& bg);
private:
BirthdaySortModel* mBirthdaySortModel;
QTreeView* mListView;
BLineEdit* mPrefix;
BLineEdit* mSuffix;
Reminder* mReminder;
SoundPicker* mSoundPicker;
FontColourButton* mFontColourButton;
CheckBox* mConfirmAck;
LateCancelSelector* mLateCancel;
SpecialActionsButton* mSpecialActionsButton {nullptr};
RepetitionButton* mSubRepetition;
QDialogButtonBox* mButtonBox;
QString mPrefixText; // last entered value of prefix text
QString mSuffixText; // last entered value of suffix text
KAEvent::Flags mFlags; // event flag bits
</