Pimcommon

verifynewversionwidget.cpp
1/*
2 SPDX-FileCopyrightText: 2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "verifynewversionwidget.h"
8#include "verifynewversionutils.h"
9#include <KLocalizedString>
10#include <QAction>
11#include <QDesktopServices>
12#include <QUrl>
13using namespace PimCommon;
14using namespace Qt::Literals::StringLiterals;
15VerifyNewVersionWidget::VerifyNewVersionWidget(QObject *parent)
16 : QObject{parent}
17{
18}
19
20VerifyNewVersionWidget::~VerifyNewVersionWidget() = default;
21
22bool VerifyNewVersionWidget::canVerifyNewVersion() const
23{
24 return VerifyNewVersionUtils::canVerifyNewVersion();
25}
26
27QAction *VerifyNewVersionWidget::verifyNewVersionAction()
28{
29 if (!mVerifyNewVersionAction) {
30 // TODO add icon
31 mVerifyNewVersionAction = new QAction(i18n("Check New Version"), this);
32 connect(mVerifyNewVersionAction, &QAction::triggered, this, &VerifyNewVersionWidget::slotVerifyNewVersion);
33 }
34 return mVerifyNewVersionAction;
35}
36
37void VerifyNewVersionWidget::addOsUrlInfo(OsVersion os, const QString &url)
38{
39 mUrls.insert(os, url);
40}
41
42void VerifyNewVersionWidget::slotVerifyNewVersion()
43{
44 QUrl url;
45#if defined(Q_OS_WIN)
46 url = QUrl(mUrls.value(VerifyNewVersionWidget::OsVersion::Windows));
47#endif
48
49#if defined(Q_OS_MACOS)
50#ifdef Q_PROCESSOR_ARM_64
51 url = QUrl(mUrls.value(VerifyNewVersionWidget::OsVersion::MacOsArm64));
52#else
53 url = QUrl(mUrls.value(VerifyNewVersionWidget::OsVersion::MacOs));
54#endif
55#endif
56 if (!url.isEmpty()) {
58 }
59}
60
61#include "moc_verifynewversionwidget.cpp"
QString i18n(const char *text, const TYPE &arg...)
folderdialogacltab.h
void triggered(bool checked)
bool openUrl(const QUrl &url)
iterator insert(const Key &key, const T &value)
T value(const Key &key, const T &defaultValue) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.