diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-12-24 20:52:56 -0600 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-12-24 20:52:56 -0600 |
| commit | 5f06da756e6d03dde85da6ddad5d8177f7410860 (patch) | |
| tree | e5fbda6acbb1ffa4facff92add770895d63761f2 /src/mainwindow.cpp | |
| parent | 7fa230411e3615e923f39fe85d9ccb985e3d4e5d (diff) | |
Allow "visit on Nexus" for multiple mods
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e3f12e39..de12cf05 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2865,12 +2865,33 @@ void MainWindow::markConverted_clicked() void MainWindow::visitOnNexus_clicked()
{
- int modID = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(m_ContextRow, 0), Qt::UserRole).toInt();
- QString gameName = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(m_ContextRow, 0), Qt::UserRole + 4).toString();
- if (modID > 0) {
- linkClicked(NexusInterface::instance(&m_PluginContainer)->getModURL(modID, gameName));
- } else {
- MessageDialog::showMessage(tr("Nexus ID for this Mod is unknown"), this);
+ QItemSelectionModel *selection = ui->modList->selectionModel();
+ if (selection->hasSelection() && selection->selectedRows().count() > 1) {
+ int count = selection->selectedRows().count();
+ if (count > 10) {
+ if (QMessageBox::question(this, tr("Opening Nexus Links"),
+ tr("You are trying to open %1 links to Nexus Mods. Are you sure you want to do this?").arg(count),
+ QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
+ return;
+ }
+ }
+
+ for (QModelIndex idx : selection->selectedRows()) {
+ int modID = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(idx.data(Qt::UserRole + 1).toInt(), 0), Qt::UserRole).toInt();
+ QString gameName = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(idx.data(Qt::UserRole + 1).toInt(), 0), Qt::UserRole + 4).toString();
+ if (modID > 0) {
+ linkClicked(NexusInterface::instance(&m_PluginContainer)->getModURL(modID, gameName));
+ }
+ }
+ }
+ else {
+ int modID = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(m_ContextRow, 0), Qt::UserRole).toInt();
+ QString gameName = m_OrganizerCore.modList()->data(m_OrganizerCore.modList()->index(m_ContextRow, 0), Qt::UserRole + 4).toString();
+ if (modID > 0) {
+ linkClicked(NexusInterface::instance(&m_PluginContainer)->getModURL(modID, gameName));
+ } else {
+ MessageDialog::showMessage(tr("Nexus ID for this Mod is unknown"), this);
+ }
}
}
|
