License notise has been corrected.

This commit is contained in:
Serhii Hadzhilov 2020-09-25 21:26:54 +03:00
parent 2a8e696d53
commit 1d43ab0f7c
6 changed files with 297 additions and 285 deletions

View file

@ -33,13 +33,7 @@ void ActivationDialog::refreshSerialKey()
ui->m_pTextEditSerialKey->setText(m_appConfig->serialKey()); ui->m_pTextEditSerialKey->setText(m_appConfig->serialKey());
ui->m_pTextEditSerialKey->setFocus(); ui->m_pTextEditSerialKey->setFocus();
ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End); ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End);
ui->m_trialLabel->setText(tr("<html><head/><body><p>Your trial has " ui->m_trialLabel->setText(tr(m_LicenseManager->getLicenseNotice().toStdString().c_str()));
"expired. <a href=\"https://symless.com/"
"synergy/trial/thanks?id=%1\"><span "
"style=\"text-decoration: underline; "
"color:#0000ff;\">Buy now!</span></a>"
"</p></body></html>")
.arg (m_appConfig->serialKey()));
} }
ActivationDialog::~ActivationDialog() ActivationDialog::~ActivationDialog()

View file

@ -101,7 +101,8 @@ LicenseManager::serialKey() const
return m_serialKey; return m_serialKey;
} }
void LicenseManager::refresh() void
LicenseManager::refresh()
{ {
if (!m_AppConfig->serialKey().isEmpty()) { if (!m_AppConfig->serialKey().isEmpty()) {
try { try {
@ -116,7 +117,8 @@ void LicenseManager::refresh()
} }
} }
void LicenseManager::skipActivation() void
LicenseManager::skipActivation()
{ {
notifyActivation ("skip:unknown"); notifyActivation ("skip:unknown");
} }
@ -141,7 +143,8 @@ LicenseManager::getEditionName(Edition const edition, bool trial)
return QString::fromUtf8 (name.c_str(), static_cast<int>(name.size())); return QString::fromUtf8 (name.c_str(), static_cast<int>(name.size()));
} }
void LicenseManager::notifyActivation(QString identity) void
LicenseManager::notifyActivation(QString identity)
{ {
ActivationNotifier* notifier = new ActivationNotifier(); ActivationNotifier* notifier = new ActivationNotifier();
notifier->setIdentity(identity); notifier->setIdentity(identity);
@ -157,7 +160,8 @@ void LicenseManager::notifyActivation(QString identity)
QMetaObject::invokeMethod(notifier, "notify", Qt::QueuedConnection); QMetaObject::invokeMethod(notifier, "notify", Qt::QueuedConnection);
} }
QString LicenseManager::getLicenseNotice() const QString
LicenseManager::getLicenseNotice() const
{ {
QString Notice; QString Notice;
@ -173,67 +177,60 @@ QString LicenseManager::getLicenseNotice() const
return Notice; return Notice;
} }
QString LicenseManager::getTrialNotice() const QString
LicenseManager::getTrialNotice() const
{ {
QString Notice; QString Notice;
if (m_serialKey.isExpired(::time(0))){ if (m_serialKey.isExpired(::time(0))){
Notice = "<html><head/><body><p>Your %1 trial has expired. <a href=" Notice = "<html><head/><body><p>Your %1 trial has expired. <a href="
"\"https://symless.com/synergy/trial/thanks?id=%2\">" "\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;color:#0000ff;\">" "<span style=\"text-decoration: underline;color:#0000ff;\">"
"Buy now!</span></a></p></body></html>"; "Buy now!</span></a></p></body></html>";
Notice = Notice Notice = Notice.arg(LicenseManager::getEditionName(activeEdition()));
.arg(LicenseManager::getEditionName(activeEdition()))
.arg(QString::fromStdString(m_serialKey.toString()));
} }
else{ else{
time_t daysLeft = m_serialKey.daysLeft(::time(0));
Notice = "<html><head/><body><p><span style=\"" Notice = "<html><head/><body><p><span style=\""
"font-weight:600;\">%1</span> day%3 of " "font-weight:600;\">%1</span> day%3 of "
"your %2 trial remain%5. <a href=" "your %2 trial remain%5. <a href="
"\"https://symless.com/synergy/trial/thanks?id=%4\">" "\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;" "<span style=\"text-decoration: underline;"
" color:#0000ff;\">Buy now!</span></a>" " color:#0000ff;\">Buy now!</span></a>"
"</p></body></html>"; "</p></body></html>";
time_t daysLeft = m_serialKey.daysLeft(::time(0));
Notice = Notice Notice = Notice
.arg (daysLeft) .arg (daysLeft)
.arg (LicenseManager::getEditionName(activeEdition())) .arg (LicenseManager::getEditionName(activeEdition()))
.arg ((daysLeft == 1) ? "" : "s") .arg ((daysLeft == 1) ? "" : "s")
.arg (QString::fromStdString(m_serialKey.toString()))
.arg ((daysLeft == 1) ? "s" : ""); .arg ((daysLeft == 1) ? "s" : "");
} }
return Notice; return Notice;
} }
QString LicenseManager::getTemporaryNotice() const QString
LicenseManager::getTemporaryNotice() const
{ {
QString Notice; QString Notice;
if (m_serialKey.isExpired(::time(0))) { if (m_serialKey.isExpired(::time(0))) {
Notice = "<html><head/><body><p>Your %1 has expired. <a href=" Notice = "<html><head/><body><p>Your license has expired. <a href="
"\"https://symless.com/synergy/trial/thanks?id=%2\">" "\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;color:#0000ff;\">" "<span style=\"text-decoration: underline;color:#0000ff;\">"
"Buy now!</span></a></p></body></html>"; "Renew now!</span></a></p></body></html>";
Notice = Notice
.arg(LicenseManager::getEditionName(activeEdition()))
.arg(QString::fromStdString(m_serialKey.toString()));
} }
else if (m_serialKey.isExpiring(::time(0))) { else if (m_serialKey.isExpiring(::time(0))) {
time_t daysLeft = m_serialKey.daysLeft(::time(0));
Notice = "<html><head/><body><p><span style=\"" Notice = "<html><head/><body><p><span style=\""
"font-weight:600;\">%1</span> day%3 of " "font-weight:600;\">%1</span> day%2 / "
"your %2 remain%5. <a href=" "before your license expires.<a href="
"\"https://symless.com/synergy/trial/thanks?id=%4\">" "\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;" "<span style=\"text-decoration: underline;"
" color:#0000ff;\">Buy now!</span></a>" " color:#0000ff;\">Renew now!</span></a>"
"</p></body></html>"; "</p></body></html>";
Notice = Notice
.arg (daysLeft) time_t daysLeft = m_serialKey.daysLeft(::time(0));
.arg (LicenseManager::getEditionName(activeEdition())) Notice = Notice.arg (daysLeft).arg ((daysLeft == 1) ? "" : "s");
.arg ((daysLeft == 1) ? "" : "s")
.arg (QString::fromStdString(m_serialKey.toString()))
.arg ((daysLeft == 1) ? "s" : "");
} }
return Notice; return Notice;

View file

@ -27,6 +27,7 @@
#include <stdexcept> #include <stdexcept>
using namespace std; using namespace std;
static std::string hexEncode (std::string const& str);
SerialKey::SerialKey(Edition edition): SerialKey::SerialKey(Edition edition):
m_userLimit(1), m_userLimit(1),

View file

@ -1,3 +1,20 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Seamless Inc.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SerialKeyType.h" #include "SerialKeyType.h"
const std::string SerialKeyType::TRIAL = "trial"; const std::string SerialKeyType::TRIAL = "trial";
@ -10,7 +27,8 @@ SerialKeyType::SerialKeyType() :
} }
void SerialKeyType::setKeyType(const std::string& Type) void
SerialKeyType::setKeyType(const std::string& Type)
{ {
m_isTrial = false; m_isTrial = false;
m_isTemporary = false; m_isTemporary = false;
@ -24,17 +42,21 @@ void SerialKeyType::setKeyType(const std::string& Type)
} }
} }
bool SerialKeyType::isTrial() const bool
SerialKeyType::isTrial() const
{ {
return m_isTrial; return m_isTrial;
} }
bool SerialKeyType::isTemporary() const bool
SerialKeyType::isTemporary() const
{ {
return m_isTemporary; return m_isTemporary;
} }
bool SerialKeyType::isPermanent() const bool
SerialKeyType::isPermanent() const
{ {
return (!m_isTemporary); return (!m_isTemporary);
} }

View file

@ -14,8 +14,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef SERIALKEYTYPE_H #pragma once
#define SERIALKEYTYPE_H
#include <string> #include <string>
@ -50,4 +49,3 @@ operator!= (SerialKeyType const& lhs, SerialKeyType const& rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }
#endif // SERIALKEYTYPE_H