Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/notification.cpp
Show First 20 Lines • Show All 382 Lines • ▼ Show 20 Line(s) | 348 | { | |||
---|---|---|---|---|---|
383 | userActionFeedback = hints.value(QStringLiteral("x-kde-user-action-feedback")).toBool(); | 383 | userActionFeedback = hints.value(QStringLiteral("x-kde-user-action-feedback")).toBool(); | ||
384 | if (userActionFeedback) { | 384 | if (userActionFeedback) { | ||
385 | // A confirmation of an explicit user interaction is assumed to have been seen by the user. | 385 | // A confirmation of an explicit user interaction is assumed to have been seen by the user. | ||
386 | read = true; | 386 | read = true; | ||
387 | } | 387 | } | ||
388 | 388 | | |||
389 | urls = QUrl::fromStringList(hints.value(QStringLiteral("x-kde-urls")).toStringList()); | 389 | urls = QUrl::fromStringList(hints.value(QStringLiteral("x-kde-urls")).toStringList()); | ||
390 | 390 | | |||
391 | replyPlaceholderText = hints.value(QStringLiteral("x-kde-reply-placeholder-text")).toString(); | ||||
392 | replySubmitButtonText = hints.value(QStringLiteral("x-kde-reply-submit-button-text")).toString(); | ||||
393 | replySubmitButtonIconName = hints.value(QStringLiteral("x-kde-reply-submit-button-icon-name")).toString(); | ||||
394 | | ||||
391 | // Underscored hints was in use in version 1.1 of the spec but has been | 395 | // Underscored hints was in use in version 1.1 of the spec but has been | ||
392 | // replaced by dashed hints in version 1.2. We need to support it for | 396 | // replaced by dashed hints in version 1.2. We need to support it for | ||
393 | // users of the 1.2 version of the spec. | 397 | // users of the 1.2 version of the spec. | ||
394 | auto it = hints.find(QStringLiteral("image-data")); | 398 | auto it = hints.find(QStringLiteral("image-data")); | ||
395 | if (it == end) { | 399 | if (it == end) { | ||
396 | it = hints.find(QStringLiteral("image_data")); | 400 | it = hints.find(QStringLiteral("image_data")); | ||
397 | } | 401 | } | ||
398 | if (it == end) { | 402 | if (it == end) { | ||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Line(s) | |||||
610 | { | 614 | { | ||
611 | if (actions.count() % 2 != 0) { | 615 | if (actions.count() % 2 != 0) { | ||
612 | qCWarning(NOTIFICATIONMANAGER) << "List of actions must contain an even number of items, tried to set actions to" << actions; | 616 | qCWarning(NOTIFICATIONMANAGER) << "List of actions must contain an even number of items, tried to set actions to" << actions; | ||
613 | return; | 617 | return; | ||
614 | } | 618 | } | ||
615 | 619 | | |||
616 | d->hasDefaultAction = false; | 620 | d->hasDefaultAction = false; | ||
617 | d->hasConfigureAction = false; | 621 | d->hasConfigureAction = false; | ||
622 | d->hasReplyAction = false; | ||||
618 | 623 | | |||
619 | QStringList names; | 624 | QStringList names; | ||
620 | QStringList labels; | 625 | QStringList labels; | ||
621 | 626 | | |||
622 | for (int i = 0; i < actions.count(); i += 2) { | 627 | for (int i = 0; i < actions.count(); i += 2) { | ||
623 | const QString &name = actions.at(i); | 628 | const QString &name = actions.at(i); | ||
624 | const QString &label = actions.at(i + 1); | 629 | const QString &label = actions.at(i + 1); | ||
625 | 630 | | |||
626 | if (!d->hasDefaultAction && name == QLatin1String("default")) { | 631 | if (!d->hasDefaultAction && name == QLatin1String("default")) { | ||
627 | d->hasDefaultAction = true; | 632 | d->hasDefaultAction = true; | ||
628 | d->defaultActionLabel = label; | 633 | d->defaultActionLabel = label; | ||
629 | continue; | 634 | continue; | ||
630 | } | 635 | } | ||
631 | 636 | | |||
632 | if (!d->hasConfigureAction && name == QLatin1String("settings")) { | 637 | if (!d->hasConfigureAction && name == QLatin1String("settings")) { | ||
633 | d->hasConfigureAction = true; | 638 | d->hasConfigureAction = true; | ||
634 | d->configureActionLabel = label; | 639 | d->configureActionLabel = label; | ||
635 | continue; | 640 | continue; | ||
636 | } | 641 | } | ||
637 | 642 | | |||
643 | if (!d->hasReplyAction && name == QLatin1String("inline-reply")) { | ||||
broulik: I'll change that to "inline-reply" to avoid potential clashes | |||||
644 | d->hasReplyAction = true; | ||||
645 | d->replyActionLabel = label; | ||||
646 | continue; | ||||
647 | } | ||||
648 | | ||||
638 | names << name; | 649 | names << name; | ||
639 | labels << label; | 650 | labels << label; | ||
640 | } | 651 | } | ||
641 | 652 | | |||
642 | d->actionNames = names; | 653 | d->actionNames = names; | ||
643 | d->actionLabels = labels; | 654 | d->actionLabels = labels; | ||
644 | } | 655 | } | ||
645 | 656 | | |||
Show All 32 Lines | 688 | { | |||
678 | return d->hasConfigureAction || d->configurableNotifyRc || d->configurableService; | 689 | return d->hasConfigureAction || d->configurableNotifyRc || d->configurableService; | ||
679 | } | 690 | } | ||
680 | 691 | | |||
681 | QString Notification::configureActionLabel() const | 692 | QString Notification::configureActionLabel() const | ||
682 | { | 693 | { | ||
683 | return d->configureActionLabel; | 694 | return d->configureActionLabel; | ||
684 | } | 695 | } | ||
685 | 696 | | |||
697 | bool Notification::hasReplyAction() const | ||||
698 | { | ||||
699 | return d->hasReplyAction; | ||||
700 | } | ||||
701 | | ||||
702 | QString Notification::replyActionLabel() const | ||||
703 | { | ||||
704 | return d->replyActionLabel; | ||||
705 | } | ||||
706 | | ||||
707 | QString Notification::replyPlaceholderText() const | ||||
708 | { | ||||
709 | return d->replyPlaceholderText; | ||||
710 | } | ||||
711 | | ||||
712 | QString Notification::replySubmitButtonText() const | ||||
713 | { | ||||
714 | return d->replySubmitButtonText; | ||||
715 | } | ||||
716 | | ||||
717 | QString Notification::replySubmitButtonIconName() const | ||||
718 | { | ||||
719 | return d->replySubmitButtonIconName; | ||||
720 | } | ||||
721 | | ||||
686 | bool Notification::expired() const | 722 | bool Notification::expired() const | ||
687 | { | 723 | { | ||
688 | return d->expired; | 724 | return d->expired; | ||
689 | } | 725 | } | ||
690 | 726 | | |||
691 | void Notification::setExpired(bool expired) | 727 | void Notification::setExpired(bool expired) | ||
692 | { | 728 | { | ||
693 | d->expired = expired; | 729 | d->expired = expired; | ||
Show All 16 Lines |
I'll change that to "inline-reply" to avoid potential clashes