Skip to content

Commit 3b92fff

Browse files
UdjinM6claude
andcommitted
refactor(qt): remove redundant "toggle lock state" button
The new "(un)lock all" button supersedes "toggle lock state": it works in both tree and list modes without requiring a mode-switch dialog. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f007a77 commit 3b92fff

File tree

3 files changed

+1
-58
lines changed

3 files changed

+1
-58
lines changed

src/qt/coincontroldialog.cpp

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ CoinControlDialog::CoinControlDialog(CCoinControl& coin_control, WalletModel* _m
114114
// (un)select all
115115
connect(ui->pushButtonSelectAll, &QPushButton::clicked, this, &CoinControlDialog::buttonSelectAllClicked);
116116

117-
// Toggle lock state
118-
connect(ui->pushButtonToggleLock, &QPushButton::clicked, this, &CoinControlDialog::buttonToggleLockClicked);
119-
120-
// Unlock all locked coins
117+
// (un)lock all
121118
connect(ui->pushButtonUnlockAll, &QPushButton::clicked, this, &CoinControlDialog::buttonUnlockAllClicked);
122119

123120
ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 94);
@@ -189,43 +186,6 @@ void CoinControlDialog::buttonSelectAllClicked()
189186
CoinControlDialog::updateLabels(m_coin_control, model, this);
190187
}
191188

192-
// Toggle lock state
193-
void CoinControlDialog::buttonToggleLockClicked()
194-
{
195-
QTreeWidgetItem *item;
196-
// Works in list-mode only
197-
if(ui->radioListMode->isChecked()){
198-
ui->treeWidget->setEnabled(false);
199-
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++){
200-
item = ui->treeWidget->topLevelItem(i);
201-
COutPoint outpt(uint256S(item->data(COLUMN_ADDRESS, TxHashRole).toString().toStdString()), item->data(COLUMN_ADDRESS, VOutRole).toUInt());
202-
// Don't toggle the lock state of partially mixed coins if they are not hidden in CoinJoin mode
203-
if (m_coin_control.IsUsingCoinJoin() && !fHideAdditional && !model->isFullyMixed(outpt)) {
204-
continue;
205-
}
206-
if (model->wallet().isLockedCoin(outpt)) {
207-
model->wallet().unlockCoin(outpt);
208-
item->setDisabled(false);
209-
item->setIcon(COLUMN_CHECKBOX, QIcon());
210-
}
211-
else{
212-
model->wallet().lockCoin(outpt, /*write_to_db=*/true);
213-
item->setDisabled(true);
214-
item->setIcon(COLUMN_CHECKBOX, GUIUtil::getIcon("lock_closed", GUIUtil::ThemedColor::RED));
215-
}
216-
updateLabelLocked();
217-
}
218-
ui->treeWidget->setEnabled(true);
219-
CoinControlDialog::updateLabels(m_coin_control, model, this);
220-
}
221-
else{
222-
QMessageBox msgBox(this);
223-
msgBox.setObjectName("lockMessageBox");
224-
msgBox.setText(tr("Please switch to \"List mode\" to use this function."));
225-
msgBox.exec();
226-
}
227-
}
228-
229189
// (un)lock all
230190
void CoinControlDialog::buttonUnlockAllClicked()
231191
{

src/qt/coincontroldialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ private Q_SLOTS:
108108
void headerSectionClicked(int);
109109
void buttonBoxClicked(QAbstractButton*);
110110
void buttonSelectAllClicked();
111-
void buttonToggleLockClicked();
112111
void buttonUnlockAllClicked();
113112
void updateLabelLocked();
114113
void on_hideButton_clicked();

src/qt/forms/coincontroldialog.ui

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -290,22 +290,6 @@
290290
</property>
291291
</widget>
292292
</item>
293-
<item>
294-
<widget class="QPushButton" name="pushButtonToggleLock">
295-
<property name="sizePolicy">
296-
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
297-
<horstretch>0</horstretch>
298-
<verstretch>0</verstretch>
299-
</sizepolicy>
300-
</property>
301-
<property name="text">
302-
<string>toggle lock state</string>
303-
</property>
304-
<property name="autoDefault">
305-
<bool>false</bool>
306-
</property>
307-
</widget>
308-
</item>
309293
<item>
310294
<widget class="QPushButton" name="hideButton">
311295
<property name="sizePolicy">

0 commit comments

Comments
 (0)