Skip to content

Commit

Permalink
General: don't ask to confirm the overwriting of a file when on macOS…
Browse files Browse the repository at this point in the history
… 10.15 (closes #2261).
  • Loading branch information
agarny committed Dec 18, 2019
2 parents a1e8dd9 + 6416776 commit 80ad6e4
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 78 deletions.
1 change: 1 addition & 0 deletions doc/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>General:</strong> don't ask to confirm the overwriting of a file when on macOS 10.15 (see issue <a href=\"https://github.com/opencor/opencor/issues/2261\">#2261</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> can now reopen a remote <a href=\"https://cellml.org/\">CellML</a> file from a <a href=\"https://sed-ml.github.io/\">SED-ML</a> file (see issue <a href=\"https://github.com/opencor/opencor/issues/2191\">#2191</a>)." },
{ "change": "<strong>Third-party libraries:</strong> upgraded <a href=\"https://github.com/qtwebkit/qtwebkit/wiki\">QtWebKit</a> to v5.212.0-alpha3 (see issue <a href=\"https://github.com/opencor/opencor/issues/2252\">#2252</a>)." }
]
Expand Down
2 changes: 1 addition & 1 deletion src/checkforupdatesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void CheckForUpdatesEngine::check()
// Check whether the version is newer and, if so, add it to our
// list

if (mApplicationDate.compare(versionDate) < 0) {
if (mApplicationDate < versionDate) {
mNewerVersions << versionVersion;
}
}
Expand Down
37 changes: 37 additions & 0 deletions src/misc/plugincategoryitem.cpp.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Return the given category item, after having created it, if it didn't
// already exist

QStandardItem *res = mCategoryItems.value(pCategory);

if (res == nullptr) {
// No category item exists for the given category, so create one and add
// it to our data model (and this in the right place)

bool inserted = false;
QStandardItem *rootItem = mModel->invisibleRootItem();
QString categoryName = pluginCategoryName(pCategory);
QString nonDiacriticCategoryName = nonDiacriticString(categoryName);

res = new QStandardItem(categoryName);

for (int i = 0, iMax = rootItem->rowCount(); i < iMax; ++i) {
if (nonDiacriticCategoryName < nonDiacriticString(rootItem->child(i)->text())) {
inserted = true;

mModel->invisibleRootItem()->insertRow(i, res);

break;
}
}

if (!inserted) {
mModel->invisibleRootItem()->appendRow(res);
}

// Keep track of the relationship between our new item and its category

mCategoryItems.insert(pCategory, res);
mItemCategories.insert(res, pCategory);
}

return res;
2 changes: 2 additions & 0 deletions src/plugins/miscellaneous/Core/src/coreguiutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ QString getSaveFileName(const QString &pCaption, const QString &pFileName,
// Check whether the save file already exists

if ( resInfo.exists()
&& ( (QSysInfo::productType() != "osx")
|| (QSysInfo::productVersion() < "10.15"))
&& questionMessageBox(pCaption,
QObject::tr("<strong>%1</strong> already exists. Do you want to overwrite it?").arg(QDir::toNativeSeparators(res))) == QMessageBox::No) {
continue;
Expand Down
43 changes: 3 additions & 40 deletions src/pluginsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,52 +595,15 @@ void PluginsDialog::apply()

QStandardItem * PluginsDialog::pluginCategoryItem(PluginInfo::Category pCategory)
{
// Return the given category item, after having created it, if it didn't
// already exist

QStandardItem *res = mCategoryItems.value(pCategory);

if (res == nullptr) {
// No category item exists for the given category, so create one and add
// it to our data model (and this in the right place)

bool inserted = false;
QStandardItem *rootItem = mModel->invisibleRootItem();
QString categoryName = pluginCategoryName(pCategory);
QString nonDiacriticCategoryName = nonDiacriticString(categoryName);

res = new QStandardItem(categoryName);

for (int i = 0, iMax = rootItem->rowCount(); i < iMax; ++i) {
QStandardItem *categoryItem = rootItem->child(i);

if (nonDiacriticCategoryName.compare(nonDiacriticString(categoryItem->text())) < 0) {
inserted = true;

mModel->invisibleRootItem()->insertRow(i, res);

break;
}
}

if (!inserted) {
mModel->invisibleRootItem()->appendRow(res);
}

// Keep track of the relationship between our new item and its category

mCategoryItems.insert(pCategory, res);
mItemCategories.insert(res, pCategory);
}

return res;
#include "plugincategoryitem.cpp.inl"
}

//==============================================================================

void PluginsDialog::treeViewCollapsed(const QModelIndex &pIndex)
{
// We don't want plugin categories to be collapse, so cancel all collapsings
// We don't want plugin categories to be collapsed, so cancel all
// collapsings

mGui->treeView->expand(pIndex);
}
Expand Down
38 changes: 1 addition & 37 deletions src/preferencesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,43 +285,7 @@ QStringList PreferencesDialog::pluginNames() const

QStandardItem * PreferencesDialog::pluginCategoryItem(PluginInfo::Category pCategory)
{
// Return the given category item, after having created it, if it didn't
// already exist

QStandardItem *res = mCategoryItems.value(pCategory);

if (res == nullptr) {
// No category item exists for the given category, so create one and add
// it to our data model (and this in the right place)

bool inserted = false;
QStandardItem *rootItem = mModel->invisibleRootItem();
QString categoryName = pluginCategoryName(pCategory);
QString nonDiacriticCategoryName = nonDiacriticString(categoryName);

res = new QStandardItem(categoryName);

for (int i = 0, iMax = rootItem->rowCount(); i < iMax; ++i) {
if (nonDiacriticCategoryName.compare(nonDiacriticString(rootItem->child(i)->text())) < 0) {
inserted = true;

mModel->invisibleRootItem()->insertRow(i, res);

break;
}
}

if (!inserted) {
mModel->invisibleRootItem()->appendRow(res);
}

// Keep track of the relationship between our new item and its category

mCategoryItems.insert(pCategory, res);
mItemCategories.insert(res, pCategory);
}

return res;
#include "plugincategoryitem.cpp.inl"
}

//==============================================================================
Expand Down

0 comments on commit 80ad6e4

Please sign in to comment.