This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

#5657 Fix trial warning label and serial key serialisation

  • Loading branch information...
nlyan committed Oct 18, 2016
1 parent e5aae66 commit 020b7974dfc7778fb70a4bb63a56f30a06dc4d4c
Showing with 20 additions and 12 deletions.
  1. +11 −8 src/gui/src/MainWindow.cpp
  2. +9 −4 src/lib/shared/SerialKey.cpp
View
@@ -1061,15 +1061,18 @@ void MainWindow::setEdition(Edition edition)
void MainWindow::beginTrial(bool isExpiring)
{
if (isExpiring) {
- QString expiringNotice = "<html><head/><body><p><span style=\""
- "font-weight:600;\">%1</span> days of "
- "your Synergy Pro trial remain. <a href="
- "\"http://symless.com/pricing?src=gui\">"
- "<span style=\"text-decoration: underline;"
- " color:#0000ff;\">Buy now!</span></a>"
- "</p></body></html>";
+ QString expiringNotice ("<html><head/><body><p><span style=\""
+ "font-weight:600;\">%1</span> days of "
+ "your %2 trial remain. <a href="
+ "\"http://symless.com/synergy/trial/thanks?id=%3\">"
+ "<span style=\"text-decoration: underline;"
+ " color:#0000ff;\">Buy now!</span></a>"
+ "</p></body></html>");
expiringNotice = expiringNotice.arg
- (m_LicenseManager->serialKey().daysLeft(::time(0)));
+ (m_LicenseManager->serialKey().daysLeft(::time(0))).arg
+ (LicenseManager::getEditionName(m_LicenseManager->activeEdition())).arg
+ (QString::fromStdString(m_LicenseManager->serialKey().toString()));
+
this->m_trialLabel->setText(expiringNotice);
this->m_trialWidget->show();
}
@@ -126,15 +126,20 @@ std::string
SerialKey::toString() const
{
std::ostringstream oss;
- oss << "v2;";
- oss << (isTrial() ? "trial" : "lifetime") << ";";
+ oss << "{";
+ if (isTrial()) {
+ oss << "v2;trial;";
+ } else {
+ oss << "v1;";
+ }
oss << editionString() << ";";
oss << m_name << ";";
oss << m_userLimit << ";";
oss << m_email << ";";
oss << m_company << ";";
- oss << m_warnTime << ";";
- oss << m_expireTime;
+ oss << (isTrial() ? m_warnTime : 0) << ";";
+ oss << (isTrial() ? m_expireTime : 0);
+ oss << "}";
return hexEncode(oss.str());
}

0 comments on commit 020b797

Please sign in to comment.