keepassxc

Форк
0
/
UpdateCheckDialog.cpp 
65 строк · 2.2 Кб
1
/*
2
 *  Copyright (C) 2019 KeePassXC Team <team@keepassxc.org>
3
 *
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.
8
 *
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.
13
 *
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/>.
16
 */
17

18
#include "UpdateCheckDialog.h"
19
#include "ui_UpdateCheckDialog.h"
20

21
#include <QPushButton>
22

23
#include "config-keepassx.h"
24
#include "gui/Icons.h"
25
#include "updatecheck/UpdateChecker.h"
26

27
UpdateCheckDialog::UpdateCheckDialog(QWidget* parent)
28
    : QDialog(parent)
29
    , m_ui(new Ui::UpdateCheckDialog())
30
{
31
    m_ui->setupUi(this);
32
    setWindowFlags(Qt::Window);
33
    setAttribute(Qt::WA_DeleteOnClose);
34

35
    m_ui->iconLabel->setPixmap(icons()->applicationIcon().pixmap(48));
36

37
    connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
38
    connect(UpdateChecker::instance(),
39
            SIGNAL(updateCheckFinished(bool, QString, bool)),
40
            SLOT(showUpdateCheckResponse(bool, QString)));
41
}
42

43
void UpdateCheckDialog::showUpdateCheckResponse(bool hasUpdate, const QString& version)
44
{
45
    m_ui->progressBar->setVisible(false);
46
    m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
47

48
    setWindowTitle(tr("Software Update"));
49

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));
58
    } else {
59
        m_ui->statusLabel->setText(tr("You have the latest version of KeePassXC"));
60
    }
61
}
62

63
UpdateCheckDialog::~UpdateCheckDialog()
64
{
65
}
66

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.