feat: add desktop start and native reminders

- Notify at schedule start and optionally N minutes before\n- Add reminder lead setting and TOML persistence\n- Use Linux DBus native notifications with action handling\n- Focus the matching block when a notification is clicked\n- Keep overdue reminders and update validation docs/screenshots
This commit is contained in:
Misaki
2026-10-26 21:16:07 +08:00
parent 121e66d527
commit 795f9730f8
23 changed files with 465 additions and 6 deletions
+42 -1
View File
@@ -25,7 +25,7 @@ SettingsDialog::SettingsDialog(ThemeManager& themeManager, AppSettings& settings
{
setWindowTitle(QStringLiteral("设置"));
setWindowButtonFlags(ElaAppBarType::CloseButtonHint);
resize(560, 720);
resize(560, 820);
setMinimumWidth(520);
auto* root = new QVBoxLayout(this);
@@ -155,6 +155,39 @@ SettingsDialog::SettingsDialog(ThemeManager& themeManager, AppSettings& settings
keyNote->setWordWrap(true);
root->addWidget(keyNote);
addDivider();
addSectionTitle(QStringLiteral("日程提醒"));
auto* reminderDescription = new ElaText(
QStringLiteral("日程开始时发送系统通知;可额外提前 N 分钟再提醒一次。"),
11,
this);
reminderDescription->setTextStyle(ElaTextType::Caption);
reminderDescription->setWordWrap(true);
root->addWidget(reminderDescription);
auto* reminderRow = new QHBoxLayout();
reminderRow->setSpacing(16);
auto* reminderLabel = new ElaText(QStringLiteral("提前提醒"), 13, this);
m_reminderLeadCombo = new ElaComboBox(this);
const QList<int> leadValues = {0, 5, 10, 15, 30, 60};
for (int minutes : leadValues)
{
m_reminderLeadCombo->addItem(minutes == 0 ? QStringLiteral("仅开始时")
: QStringLiteral("提前 %1 分钟").arg(minutes));
}
int leadIndex = leadValues.indexOf(m_settings.reminderLeadMinutes());
if (leadIndex < 0)
{
leadIndex = 2;
}
m_reminderLeadCombo->setCurrentIndex(leadIndex);
m_reminderLeadCombo->setFixedSize(180, 32);
reminderRow->addWidget(reminderLabel, 0, Qt::AlignVCenter);
reminderRow->addWidget(m_reminderLeadCombo, 0, Qt::AlignVCenter);
reminderRow->addStretch(1);
root->addLayout(reminderRow);
addDivider();
addSectionTitle(QStringLiteral("同步服务"));
@@ -238,6 +271,14 @@ SettingsDialog::SettingsDialog(ThemeManager& themeManager, AppSettings& settings
connect(m_modelEdit, &ElaLineEdit::editingFinished, this, &SettingsDialog::saveAiConfig);
connect(m_apiKeyEdit, &ElaLineEdit::editingFinished, this, &SettingsDialog::saveAiConfig);
connect(m_keyVisibilityButton, &ElaToolButton::clicked, this, &SettingsDialog::toggleKeyVisibility);
connect(m_reminderLeadCombo, &ElaComboBox::currentIndexChanged, this, [this](int index) {
static const int values[] = {0, 5, 10, 15, 30, 60};
if (index >= 0 && index < 6)
{
m_settings.setReminderLeadMinutes(values[index]);
Q_EMIT reminderSettingsChanged();
}
});
connect(m_syncUrlEdit, &ElaLineEdit::editingFinished, this, &SettingsDialog::saveSyncConfig);
connect(m_syncEnabledSwitch, &ElaToggleSwitch::toggled, this, [this](bool) { saveSyncConfig(); });
connect(doneButton, &ElaPushButton::clicked, this, [this]() {