File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -691,6 +691,17 @@ void RPCConsole::WriteCommandHistory()
691691 settings.endArray ();
692692}
693693
694+ void RPCConsole::ClearCommandHistory ()
695+ {
696+ // Clear the history list
697+ history.clear ();
698+ historyPtr = 0 ;
699+ cmdBeforeBrowsing.clear ();
700+
701+ // Write empty history to settings
702+ WriteCommandHistory ();
703+ }
704+
694705RPCConsole::~RPCConsole ()
695706{
696707 QSettings settings;
@@ -1182,6 +1193,26 @@ void RPCConsole::on_lineEdit_returnPressed()
11821193 return ;
11831194 }
11841195
1196+ // Special command to clear command history
1197+ if (cmd == QLatin1String (" /clearhistory" )) {
1198+ QMessageBox::StandardButton reply = QMessageBox::question (this ,
1199+ tr (" Clear Command History" ),
1200+ tr (" This will permanently clear your command history and console output.<br><br>"
1201+ " While this action is irreversible, complete removal from memory and disk "
1202+ " cannot be guaranteed due to system limitations.<br><br>"
1203+ " Are you sure you want to proceed?" ),
1204+ QMessageBox::Yes | QMessageBox::No,
1205+ QMessageBox::No);
1206+
1207+ if (reply == QMessageBox::Yes) {
1208+ ClearCommandHistory ();
1209+ clear (false ); // Clear console output too
1210+ message (CMD_REPLY, tr (" Command history and console output cleared." ));
1211+ }
1212+ ui->lineEdit ->clear ();
1213+ return ;
1214+ }
1215+
11851216 if (m_is_executing) {
11861217 return ;
11871218 }
Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ public Q_SLOTS:
166166 void startExecutor ();
167167 void setTrafficGraphRange (int mins);
168168 void WriteCommandHistory ();
169+ void ClearCommandHistory ();
169170
170171 enum ColumnWidths
171172 {
You can’t perform that action at this time.
0 commit comments