File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -144,3 +144,28 @@ void SendRecipientsListModel::clear()
144144 Q_EMIT currentRecipientChanged ();
145145 Q_EMIT currentIndexChanged ();
146146}
147+
148+ void SendRecipientsListModel::clearToFront ()
149+ {
150+ bool count_changed = false ;
151+ while (m_recipients.size () > 1 ) {
152+ delete m_recipients.at (1 );
153+ m_recipients.removeAt (1 );
154+ count_changed = true ;
155+ }
156+
157+ if (count_changed) {
158+ Q_EMIT countChanged ();
159+ }
160+
161+ if (m_totalAmount != m_recipients[0 ]->amount ()->satoshi ()) {
162+ m_totalAmount = m_recipients[0 ]->amount ()->satoshi ();
163+ Q_EMIT totalAmountChanged ();
164+ }
165+
166+ if (m_current != 0 ) {
167+ m_current = 0 ;
168+ Q_EMIT currentRecipientChanged ();
169+ Q_EMIT currentIndexChanged ();
170+ }
171+ }
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ class SendRecipientsListModel : public QAbstractListModel
3838 Q_INVOKABLE void prev ();
3939 Q_INVOKABLE void remove ();
4040 Q_INVOKABLE void clear ();
41+ Q_INVOKABLE void clearToFront ();
4142
4243 int currentIndex () const { return m_current + 1 ; }
4344 void setCurrentIndex (int row);
Original file line number Diff line number Diff line change @@ -34,6 +34,12 @@ PageStack {
3434 id: settings
3535 property alias coinControlEnabled: sendOptionsPopup .coinControlEnabled
3636 property alias multipleRecipientsEnabled: sendOptionsPopup .multipleRecipientsEnabled
37+
38+ onMultipleRecipientsEnabledChanged: {
39+ if (! multipleRecipientsEnabled) {
40+ root .wallet .recipients .clearToFront ()
41+ }
42+ }
3743 }
3844
3945 ScrollView {
You can’t perform that action at this time.
0 commit comments