Tweaked check-for-updates dialog.

This commit is contained in:
Martin Rotter 2014-03-05 07:40:42 +01:00
parent 04c2f3bcc6
commit df91d2a24f
4 changed files with 33 additions and 9 deletions

View File

@ -5,6 +5,8 @@
<li>[~] Message list optimizations.</li>
<li>[+] Feed list categories expand status is now persistent.</li>
<li>[+] System-wide external web browser can now be used.</li>
<li>[#] All datetimes fetched from feeds are now considered to be UTC.</li>
<li>[~] Tweaked "check for updates" dialog.</li>
</ul>
[1.9.9.6]

View File

@ -43,6 +43,10 @@ class UpdateInfo {
Evolution
};
explicit UpdateInfo() {
m_availableVersion = m_changes = "";
}
QString m_availableVersion;
QString m_changes;
UpdateType m_type;

View File

@ -38,7 +38,6 @@ FormUpdate::FormUpdate(QWidget *parent)
m_btnUpdate = m_ui->m_buttonBox->addButton(tr("Update"), QDialogButtonBox::ActionRole);
m_btnUpdate->setToolTip(tr("Download new installation files."));
m_btnUpdate->hide();
connect(m_btnUpdate, SIGNAL(clicked()), this, SLOT(startUpdate()));
@ -71,13 +70,15 @@ void FormUpdate::checkForUpdates() {
m_updateInfo = update.first;
if (update.second != QNetworkReply::NoError) {
//: Uknown release.
//: Unknown release.
m_ui->m_lblAvailableRelease->setText(tr("unknown"));
m_ui->m_txtChanges->clear();
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Error,
tr("Error: '%1'.").arg(NetworkFactory::networkErrorText(update.second)),
tr("List with updates was "
"not\ndownloaded successfully."));
m_btnUpdate->setEnabled(false);
m_btnUpdate->setToolTip(tr("Checking for updates failed."));
}
else {
m_ui->m_lblAvailableRelease->setText(update.first.m_availableVersion);
@ -92,19 +93,33 @@ void FormUpdate::checkForUpdates() {
// is available.
// TODO: Tady po stisku update tlacitka se provede
// stazeni archivu do tempu.
m_btnUpdate->setVisible(isUpdateForThisSystem());
m_btnUpdate->setEnabled(true);
m_btnUpdate->setToolTip(isUpdateForThisSystem() ?
tr("Download installation file for your OS.") :
tr("Installation file is not available directly.\n"
"Go to application website to obtain it manually."));
}
else {
m_ui->m_lblStatus->setStatus(WidgetWithStatus::Warning,
tr("No new release available."),
tr("This release is not newer than\ncurrently installed one."));
m_btnUpdate->show();
m_btnUpdate->setEnabled(true);
m_btnUpdate->setToolTip(tr("No new update available."));
}
}
}
void FormUpdate::startUpdate() {
if (!NetworkFactory::openUrlInExternalBrowser(m_updateInfo.m_urls.value(OS_ID).m_fileUrl)) {
QString url_file;
if (isUpdateForThisSystem()) {
url_file = m_updateInfo.m_urls.value(OS_ID).m_fileUrl;
}
else {
url_file = APP_URL;
}
if (!NetworkFactory::openUrlInExternalBrowser(url_file)) {
if (SystemTrayIcon::isSystemTrayActivated()) {
SystemTrayIcon::instance()->showMessage(tr("Cannot update application"),
tr("Cannot navigate to installation file. Check new installation downloads "

View File

@ -45,13 +45,13 @@
<property name="text">
<string>Changes</string>
</property>
<property name="buddy">
<cstring>m_txtChanges</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QTextEdit" name="m_txtChanges">
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
@ -69,7 +69,7 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
@ -85,6 +85,9 @@ p, li { white-space: pre-wrap; }
<property name="text">
<string>Status</string>
</property>
<property name="buddy">
<cstring>m_lblStatus</cstring>
</property>
</widget>
</item>
<item row="2" column="1">