Add options to include/exclude set name and collector number during clipboard import/export. (#5482)

* Add options to include/exclude set name and collector number during clipboard import/export.

* Missing parentheses in action label.

* Revert the silliest lint in the world.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-01-17 03:38:01 +01:00 committed by GitHub
parent 315c224f24
commit 80165c28a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 108 additions and 17 deletions

View file

@ -337,9 +337,17 @@ void TabDeckEditor::createMenus()
aSaveDeckToClipboard = new QAction(QString(), this);
connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard()));
aSaveDeckToClipboardNoSetNameAndNumber = new QAction(QString(), this);
connect(aSaveDeckToClipboardNoSetNameAndNumber, SIGNAL(triggered()), this,
SLOT(actSaveDeckToClipboardNoSetNameAndNumber()));
aSaveDeckToClipboardRaw = new QAction(QString(), this);
connect(aSaveDeckToClipboardRaw, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboardRaw()));
aSaveDeckToClipboardRawNoSetNameAndNumber = new QAction(QString(), this);
connect(aSaveDeckToClipboardRawNoSetNameAndNumber, SIGNAL(triggered()), this,
SLOT(actSaveDeckToClipboardRawNoSetNameAndNumber()));
aPrintDeck = new QAction(QString(), this);
connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck()));
@ -370,7 +378,9 @@ void TabDeckEditor::createMenus()
saveDeckToClipboardMenu = new QMenu(this);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboard);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboardNoSetNameAndNumber);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboardRaw);
saveDeckToClipboardMenu->addAction(aSaveDeckToClipboardRawNoSetNameAndNumber);
deckMenu = new QMenu(this);
deckMenu->addAction(aNewDeck);
@ -741,7 +751,9 @@ void TabDeckEditor::retranslateUi()
saveDeckToClipboardMenu->setTitle(tr("Save deck to clipboard"));
aSaveDeckToClipboard->setText(tr("Annotated"));
aSaveDeckToClipboardNoSetNameAndNumber->setText(tr("Annotated (No set name or number)"));
aSaveDeckToClipboardRaw->setText(tr("Not Annotated"));
aSaveDeckToClipboardRawNoSetNameAndNumber->setText(tr("Not Annotated (No set name or number)"));
aPrintDeck->setText(tr("&Print deck..."));
@ -1172,6 +1184,15 @@ void TabDeckEditor::actSaveDeckToClipboard()
QApplication::clipboard()->setText(buffer, QClipboard::Selection);
}
void TabDeckEditor::actSaveDeckToClipboardNoSetNameAndNumber()
{
QString buffer;
QTextStream stream(&buffer);
deckModel->getDeckList()->saveToStream_Plain(stream, true, false);
QApplication::clipboard()->setText(buffer, QClipboard::Clipboard);
QApplication::clipboard()->setText(buffer, QClipboard::Selection);
}
void TabDeckEditor::actSaveDeckToClipboardRaw()
{
QString buffer;
@ -1181,6 +1202,15 @@ void TabDeckEditor::actSaveDeckToClipboardRaw()
QApplication::clipboard()->setText(buffer, QClipboard::Selection);
}
void TabDeckEditor::actSaveDeckToClipboardRawNoSetNameAndNumber()
{
QString buffer;
QTextStream stream(&buffer);
deckModel->getDeckList()->saveToStream_Plain(stream, false, false);
QApplication::clipboard()->setText(buffer, QClipboard::Clipboard);
QApplication::clipboard()->setText(buffer, QClipboard::Selection);
}
void TabDeckEditor::actPrintDeck()
{
auto *dlg = new QPrintPreviewDialog(this);
@ -1723,7 +1753,9 @@ void TabDeckEditor::setSaveStatus(bool newStatus)
aSaveDeck->setEnabled(newStatus);
aSaveDeckAs->setEnabled(newStatus);
aSaveDeckToClipboard->setEnabled(newStatus);
aSaveDeckToClipboardNoSetNameAndNumber->setEnabled(newStatus);
aSaveDeckToClipboardRaw->setEnabled(newStatus);
aSaveDeckToClipboardRawNoSetNameAndNumber->setEnabled(newStatus);
saveDeckToClipboardMenu->setEnabled(newStatus);
aPrintDeck->setEnabled(newStatus);
analyzeDeckMenu->setEnabled(newStatus);