2
* Copyright (C) 2019 KeePassXC Team <team@keepassxc.org>
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 2 or (at your option)
7
* version 3 of the License.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
#include "UpdateCheckDialog.h"
19
#include "ui_UpdateCheckDialog.h"
23
#include "config-keepassx.h"
25
#include "updatecheck/UpdateChecker.h"
27
UpdateCheckDialog::UpdateCheckDialog(QWidget* parent)
29
, m_ui(new Ui::UpdateCheckDialog())
32
setWindowFlags(Qt::Window);
33
setAttribute(Qt::WA_DeleteOnClose);
35
m_ui->iconLabel->setPixmap(icons()->applicationIcon().pixmap(48));
37
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
38
connect(UpdateChecker::instance(),
39
SIGNAL(updateCheckFinished(bool, QString, bool)),
40
SLOT(showUpdateCheckResponse(bool, QString)));
43
void UpdateCheckDialog::showUpdateCheckResponse(bool hasUpdate, const QString& version)
45
m_ui->progressBar->setVisible(false);
46
m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
48
setWindowTitle(tr("Software Update"));
50
if (version == UpdateChecker::ErrorVersion) {
51
m_ui->statusLabel->setText(
52
tr("An error occurred when trying to retrieve update information, please try again later."));
53
} else if (hasUpdate) {
54
m_ui->statusLabel->setText(
55
tr("<strong>A new version is available.</strong><br/>"
56
"KeePassXC %1 can be <a href=\"https://keepassxc.org/download/\">downloaded here</a>.")
57
.arg(version, KEEPASSXC_VERSION));
59
m_ui->statusLabel->setText(tr("You have the latest version of KeePassXC"));
63
UpdateCheckDialog::~UpdateCheckDialog()