|
30 | 30 | #include "QSigner.h" |
31 | 31 | #include "Settings.h" |
32 | 32 | #include "Styles.h" |
33 | | -#include "sslConnect.h" |
34 | 33 | #include "TokenData.h" |
35 | 34 | #include "effects/ButtonHoverFilter.h" |
36 | 35 | #include "effects/FadeInNotification.h" |
@@ -165,19 +164,7 @@ MainWindow::MainWindow( QWidget *parent ) |
165 | 164 | connect(ui->accordion, &Accordion::changePin1Clicked, this, &MainWindow::changePin1Clicked); |
166 | 165 | connect(ui->accordion, &Accordion::changePin2Clicked, this, &MainWindow::changePin2Clicked); |
167 | 166 | connect(ui->accordion, &Accordion::changePukClicked, this, &MainWindow::changePukClicked); |
168 | | - connect(ui->infoStack, &InfoStack::photoClicked, this, &MainWindow::photoClicked); |
169 | | - connect(ui->cardInfo, &CardWidget::photoClicked, this, &MainWindow::photoClicked); // To load photo |
170 | 167 | connect(ui->cardInfo, &CardWidget::selected, ui->selector->selector, &DropdownButton::press); |
171 | | - connect(SSLConnect::instance(), &SSLConnect::error, this, [this](const QString &error) { |
172 | | - qWarning() << error; |
173 | | - showNotification(tr("Loading picture failed.")); |
174 | | - }); |
175 | | - connect(SSLConnect::instance(), &SSLConnect::image, this, [this] (const QImage &image) { |
176 | | - ui->infoStack->setProperty("PICTURE", image); |
177 | | - QPixmap pixmap = QPixmap::fromImage(image); |
178 | | - ui->cardInfo->showPicture(pixmap); |
179 | | - ui->infoStack->showPicture(pixmap); |
180 | | - }); |
181 | 168 |
|
182 | 169 | updateSelectorData(qApp->signer()->tokensign()); |
183 | 170 | updateMyEID(qApp->signer()->tokensign()); |
@@ -853,6 +840,8 @@ void MainWindow::showCardMenu(bool show) |
853 | 840 | { |
854 | 841 | if(show) |
855 | 842 | { |
| 843 | + if(ui->selector->list.isEmpty()) |
| 844 | + return; |
856 | 845 | auto *cardPopup = new CardPopup(ui->selector->list, this); |
857 | 846 | connect(cardPopup, &CardPopup::activated, qApp->signer(), &QSigner::selectCard, Qt::QueuedConnection); |
858 | 847 | connect(cardPopup, &CardPopup::activated, this, [this] { showCardMenu(false); }); // .. and hide card popup menu |
@@ -944,27 +933,6 @@ void MainWindow::sign(F &&sign) |
944 | 933 | adjustDrops(); |
945 | 934 | } |
946 | 935 |
|
947 | | -void MainWindow::photoClicked() |
948 | | -{ |
949 | | - if(!ui->infoStack->property("PICTURE").isValid()) |
950 | | - { |
951 | | - SSLConnect::instance()->fetch(); |
952 | | - return; |
953 | | - } |
954 | | - QString fileName = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation); |
955 | | - fileName += "/" + qApp->signer()->tokenauth().card(); |
956 | | - fileName = QFileDialog::getSaveFileName(this,tr("Save photo"), fileName, |
957 | | - tr("Photo (*.jpg *.jpeg);;All Files (*)")); |
958 | | - if(fileName.isEmpty()) |
959 | | - return; |
960 | | - static const QStringList exts{QStringLiteral("jpg"), QStringLiteral("jpeg")}; |
961 | | - if(!exts.contains(QFileInfo(fileName).suffix(), Qt::CaseInsensitive)) |
962 | | - fileName.append(QStringLiteral(".jpg")); |
963 | | - auto pix = ui->infoStack->property("PICTURE").value<QImage>(); |
964 | | - if(!pix.save(fileName)) |
965 | | - warnings->showWarning(DocumentModel::tr("Failed to save file '%1'").arg(fileName)); |
966 | | -} |
967 | | - |
968 | 936 | void MainWindow::removeAddress(int index) |
969 | 937 | { |
970 | 938 | if(cryptoDoc) |
|
0 commit comments