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

Initially show alarms in time order; fix alarm & template sorting

Default to showing alarms in order of their next trigger time.
Allow alarm list and template list to be sorted by clicking on headers.
parent dce6b631
Pipeline #35496 passed with stage
in 14 minutes and 32 seconds
KAlarm Change Log
=== Version 3.0.2 (KDE Applications 20.08.2) --- 16 September 2020 ===
=== Version 3.0.2 (KDE Applications 20.08.2) --- 25 September 2020 ===
+ Fix repeat-at-login alarms not triggering when KAlarm starts.
+ If command generating text for display alarm fails, only display error message,
not the display alarm, and don't redisplay the alarm on every restart.
+ Fix next trigger time shown as "Never" after using Try button for command display alarm, if command fails.
+ Display alarms in time order on startup (fixes regression).
+ Allow alarm list and template list to be sorted by clicking headers.
=== Version 3.0.1 (KDE Applications 20.08.1) --- 24 August 2020 ===
+ Fix inability to create alarms from templates, or load templates in edit dialogue [KDE Bug 425751]
......
......@@ -71,6 +71,7 @@ void AlarmListView::setColumnsVisible(const QList<bool>& show)
header()->setSectionHidden(AlarmListModel::RepeatColumn, !vis[2]);
header()->setSectionHidden(AlarmListModel::ColourColumn, !vis[3]);
header()->setSectionHidden(AlarmListModel::TypeColumn, !vis[4]);
setSortingEnabled(false); // sortByColumn() won't work if sorting is already enabled!
sortByColumn(vis[0] ? AlarmListModel::TimeColumn : AlarmListModel::TimeToColumn, Qt::AscendingOrder);
}
......
......@@ -27,6 +27,7 @@
#include <KLocalizedString>
#include <QHeaderView>
#include <QMouseEvent>
#include <QToolTip>
#include <QApplication>
......@@ -36,13 +37,15 @@ EventListView::EventListView(QWidget* parent)
: QTreeView(parent)
{
setRootIsDecorated(false); // don't show expander icons for child-less items
setSortingEnabled(true);
setAllColumnsShowFocus(true);
setSelectionMode(ExtendedSelection);
setSelectionBehavior(SelectRows);
setTextElideMode(Qt::ElideRight);
// Set default WhatsThis text to be displayed when no actual item is clicked on
setWhatsThis(i18nc("@info:whatsthis", "List of scheduled alarms"));
header()->setSortIndicatorShown(true);
connect(header(), &QHeaderView::sortIndicatorChanged, this, &EventListView::sortChanged);
header()->setSectionsClickable(true);
}
void EventListView::setModel(QAbstractItemModel* model)
......@@ -156,6 +159,14 @@ void EventListView::findNext(bool forward)
mFind->findNext(forward);
}
/******************************************************************************
* Called when the user has changed the sort order in a column.
*/
void EventListView::sortChanged(int column, Qt::SortOrder order)
{
sortByColumn(column, order);
}
void EventListView::resizeEvent(QResizeEvent* se)
{
QTreeView::resizeEvent(se);
......
......@@ -64,6 +64,7 @@ protected:
protected Q_SLOTS:
virtual void initSections() = 0;
void sortChanged(int column, Qt::SortOrder);
private:
void findNext(bool forward);
......
......@@ -74,7 +74,6 @@ TemplateDlg::TemplateDlg(QWidget* parent)
mListFilterModel->setAlarmActionFilter(static_cast<KAEvent::Actions>(KAEvent::ACT_ALL & ~KAEvent::ACT_COMMAND));
mListView = new TemplateListView(this);
mListView->setModel(mListFilterModel);
mListView->sortByColumn(TemplateListModel::TemplateNameColumn, Qt::AscendingOrder);
mListView->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
mListView->setWhatsThis(i18nc("@info:whatsthis", "The list of alarm templates"));
mListView->setItemDelegate(new TemplateListDelegate(mListView));
......
......@@ -48,6 +48,7 @@ void TemplateListView::initSections()
header()->setMinimumSectionSize(minWidth);
const int margin = QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin);
header()->resizeSection(TemplateListModel::TypeColumn, EventListModel::iconWidth() + 2*margin + 2);
sortByColumn(TemplateListModel::TemplateNameColumn, Qt::AscendingOrder);
}
void TemplateListDelegate::edit(KAEvent* event, EventListView* view)
......
Supports Markdown
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