comparison ui/mainwindow.cpp @ 997:405c97ca4ab0

Save installation success independet of state. This fixes a bug that you can have a new list available but currently a transfer error. Now the actual saving / removal of the old list is only dependent on the list that is available in the settings.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 01 Sep 2014 16:18:10 +0200
parents 29783ef4da62
children db7e7156c824
comparison
equal deleted inserted replaced
996:29783ef4da62 997:405c97ca4ab0
1107 void MainWindow::installerError(const QString& errMsg) { 1107 void MainWindow::installerError(const QString& errMsg) {
1108 QMessageBox::warning(this, tr("Error executing update"), errMsg); 1108 QMessageBox::warning(this, tr("Error executing update"), errMsg);
1109 } 1109 }
1110 1110
1111 void MainWindow::installerSuccess() { 1111 void MainWindow::installerSuccess() {
1112 if (mCurState == NewListAvailable || mCurState == NewSoftwareAvailable) { 1112 if (mCurState == NewListAvailable ) {
1113 mCurState = NothingChanged; 1113 mCurState = NothingChanged;
1114 mCurMessage = QString(); 1114 mCurMessage = QString();
1115 1115 }
1116 QString listFileName = mSettings.value("List/available").toString(); 1116
1117 QDateTime listFileDate = mSettings.value("List/availableDate").toDateTime(); 1117 QString listFileName = mSettings.value("List/available").toString();
1118 1118 QDateTime listFileDate = mSettings.value("List/availableDate").toDateTime();
1119 if (!listFileName.isEmpty() && listFileDate.isValid()) {
1119 mSettings.remove("List/available"); 1120 mSettings.remove("List/available");
1120 mSettings.remove("List/availableDate"); 1121 mSettings.remove("List/availableDate");
1121 1122
1122 if (listFileName.isEmpty() || !listFileDate.isValid()) {
1123 qWarning() << "Error accessing settings";
1124 return; /* Try again with next check */
1125 }
1126 /* Rename the installed list to list-installed.txt so that external 1123 /* Rename the installed list to list-installed.txt so that external
1127 * programs (like the uninstaller can easily recognize it). */ 1124 * programs (like the uninstaller can easily recognize it). */
1128 QString dataLoc = 1125 QString dataLoc =
1129 QStandardPaths::writableLocation(QStandardPaths::DataLocation); 1126 QStandardPaths::writableLocation(QStandardPaths::DataLocation);
1130 QDir dataDir(dataLoc); 1127 QDir dataDir(dataLoc);
1157 mInstalledList = CertificateList(); 1154 mInstalledList = CertificateList();
1158 QFile::remove(oldList.filePath()); 1155 QFile::remove(oldList.filePath());
1159 mSettings.remove("List/installed"); 1156 mSettings.remove("List/installed");
1160 mSettings.remove("List/installedDate"); 1157 mSettings.remove("List/installedDate");
1161 } 1158 }
1162 mListToInstall = CertificateList(); 1159 }
1163 1160 mListToInstall = CertificateList();
1164 }
1165 mUpdatesManual->clear(); 1161 mUpdatesManual->clear();
1166 loadCertificateList(); 1162 loadCertificateList();
1167 } 1163 }
1168 1164
1169 void MainWindow::installCerts() { 1165 void MainWindow::installCerts() {

http://wald.intevation.org/projects/trustbridge/