Make RecipientsPanel::recipients() return selected recipients, not all.
authorCarl Hetherington <cth@carlh.net>
Wed, 26 Mar 2025 23:26:43 +0000 (00:26 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 26 Mar 2025 23:30:25 +0000 (00:30 +0100)
src/wx/recipients_panel.cc
src/wx/recipients_panel.h

index ff19c02273de4dde685407c965ee5546ad9565cf..ff4b12c362f85238b2b0c6731217f15885ad4b6f 100644 (file)
@@ -177,14 +177,18 @@ RecipientsPanel::remove_recipient_clicked ()
 
 
 list<DKDMRecipient>
-RecipientsPanel::recipients () const
+RecipientsPanel::recipients() const
 {
-       list<DKDMRecipient> all;
        DKDMRecipientList recipients;
-       for (auto const& recipient: recipients.dkdm_recipients()) {
-               all.push_back(recipient.second);
+
+       list<DKDMRecipient> result;
+       for (auto sel: _selected) {
+               if (auto recipient = recipients.dkdm_recipient(sel.second)) {
+                       result.push_back(*recipient);
+               }
        }
-       return all;
+
+       return result;
 }
 
 
index d252b8d061cbb7bcd1775c955fcbbf61a726abe5..cecfa3d33c90176d09122d5674867b6cbcc3b54e 100644 (file)
@@ -44,7 +44,9 @@ public:
 
        void setup_sensitivity ();
 
+       /** @return List of selected recipients */
        std::list<DKDMRecipient> recipients() const;
+
        boost::signals2::signal<void ()> RecipientsChanged;
 
 private: