diff options
author | Alex Zolotarev <alex@maps.me> | 2016-03-10 16:49:28 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:52:50 +0300 |
commit | 7595deba8d87d049cc02f282234981c0712beb24 (patch) | |
tree | 6aa6bf8222b8911c7dbcbab0eada10c6ca7f139b /qt/update_dialog.cpp | |
parent | e879df635b6e877c59902b59d7062cdc1c3474a2 (diff) |
[qt] Integrated check for not uploaded edits when deleting downloaded maps.
Diffstat (limited to 'qt/update_dialog.cpp')
-rw-r--r-- | qt/update_dialog.cpp | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/qt/update_dialog.cpp b/qt/update_dialog.cpp index 1426b621aa..e7f6794e9a 100644 --- a/qt/update_dialog.cpp +++ b/qt/update_dialog.cpp @@ -11,28 +11,15 @@ #include "std/bind.hpp" #include <QtCore/QDateTime> - -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - #include <QtGui/QVBoxLayout> - #include <QtGui/QHBoxLayout> - #include <QtGui/QLabel> - #include <QtGui/QPushButton> - #include <QtGui/QTreeWidget> - #include <QtGui/QHeaderView> - #include <QtGui/QMessageBox> - #include <QtGui/QProgressBar> - #include <QtGui/QLineEdit> -#else - #include <QtWidgets/QVBoxLayout> - #include <QtWidgets/QHBoxLayout> - #include <QtWidgets/QLabel> - #include <QtWidgets/QPushButton> - #include <QtWidgets/QTreeWidget> - #include <QtWidgets/QHeaderView> - #include <QtWidgets/QMessageBox> - #include <QtWidgets/QProgressBar> - #include <QtWidgets/QLineEdit> -#endif +#include <QtWidgets/QHBoxLayout> +#include <QtWidgets/QHeaderView> +#include <QtWidgets/QLabel> +#include <QtWidgets/QLineEdit> +#include <QtWidgets/QMessageBox> +#include <QtWidgets/QProgressBar> +#include <QtWidgets/QPushButton> +#include <QtWidgets/QTreeWidget> +#include <QtWidgets/QVBoxLayout> #define CHECK_FOR_UPDATE "Check for update" #define LAST_UPDATE_CHECK "Last update check: " @@ -58,6 +45,18 @@ enum #define COLOR_OUTOFDATE Qt::magenta #define COLOR_MIXED Qt::yellow +namespace +{ +bool DeleteNotUploadedEditsConfirmation() +{ + QMessageBox msb; + msb.setText("Some map edits are not uploaded yet. Are you sure you want to delete map anyway?"); + msb.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); + msb.setDefaultButton(QMessageBox::Cancel); + return QMessageBox::Yes == msb.exec(); +} +} // namespace + namespace qt { /// adds custom sorting for "Size" column @@ -153,7 +152,10 @@ namespace qt if (res == btnUpdate) st.DownloadNode(countryId); else if (res == btnDelete) - st.DeleteNode(countryId); + { + if (!m_framework.HasUnsavedEdits(countryId) || DeleteNotUploadedEditsConfirmation()) + st.DeleteNode(countryId); + } } break; @@ -172,7 +174,10 @@ namespace qt QAbstractButton * const res = ask.clickedButton(); if (res == btnDelete) - st.DeleteNode(countryId); + { + if (!m_framework.HasUnsavedEdits(countryId) || DeleteNotUploadedEditsConfirmation()) + st.DeleteNode(countryId); + } } break; |