From cf94ad8f731a5698d2f8c80e22310fb1e7e457ab Mon Sep 17 00:00:00 2001 From: Be Date: Fri, 12 Feb 2021 12:06:39 -0600 Subject: use Sandbox::askForAccess for all external library features --- src/library/banshee/bansheefeature.cpp | 2 +- src/library/rhythmbox/rhythmboxfeature.cpp | 3 ++- src/library/serato/seratofeature.cpp | 4 ++-- src/library/traktor/traktorfeature.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/library') diff --git a/src/library/banshee/bansheefeature.cpp b/src/library/banshee/bansheefeature.cpp index 182cee18f6..d7b565ec02 100644 --- a/src/library/banshee/bansheefeature.cpp +++ b/src/library/banshee/bansheefeature.cpp @@ -79,7 +79,7 @@ void BansheeFeature::activate() { qDebug() << m_databaseFile << "does not exist"; } - if (!m_connection.open(m_databaseFile)) { + if (!Sandbox::askForAccess(m_databaseFile) || !m_connection.open(m_databaseFile)) { QMessageBox::warning( nullptr, tr("Error loading Banshee database"), diff --git a/src/library/rhythmbox/rhythmboxfeature.cpp b/src/library/rhythmbox/rhythmboxfeature.cpp index 89e2990e44..d0b54b57b5 100644 --- a/src/library/rhythmbox/rhythmboxfeature.cpp +++ b/src/library/rhythmbox/rhythmboxfeature.cpp @@ -150,7 +150,8 @@ TreeItem* RhythmboxFeature::importMusicCollection() { } } - if (!db.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (!Sandbox::askForAccess(QFileInfo(db).absoluteFilePath()) || + !db.open(QIODevice::ReadOnly | QIODevice::Text)) { return nullptr; } diff --git a/src/library/serato/seratofeature.cpp b/src/library/serato/seratofeature.cpp index be6c26d56d..9d38b551c0 100644 --- a/src/library/serato/seratofeature.cpp +++ b/src/library/serato/seratofeature.cpp @@ -353,7 +353,7 @@ QString parseCrate( } QFile crateFile(crateFilePath); - if (!crateFile.open(QIODevice::ReadOnly)) { + if (!Sandbox::askForAccess(crateFilePath) || !crateFile.open(QIODevice::ReadOnly)) { qWarning() << "Failed to open file " << crateFilePath << " for reading."; @@ -534,7 +534,7 @@ QString parseDatabase(mixxx::DbConnectionPoolPtr dbConnectionPool, TreeItem* dat ")"); QFile databaseFile(databaseFilePath); - if (!databaseFile.open(QIODevice::ReadOnly)) { + if (!Sandbox::askForAccess(databaseFilePath) || !databaseFile.open(QIODevice::ReadOnly)) { qWarning() << "Failed to open file " << databaseFilePath << " for reading."; diff --git a/src/library/traktor/traktorfeature.cpp b/src/library/traktor/traktorfeature.cpp index 9ab5e2afe7..5dda60f5cb 100644 --- a/src/library/traktor/traktorfeature.cpp +++ b/src/library/traktor/traktorfeature.cpp @@ -216,7 +216,7 @@ TreeItem* TraktorFeature::importLibrary(const QString& file) { //Parse Trakor XML file using SAX (for performance) QFile traktor_file(file); - if (!traktor_file.open(QIODevice::ReadOnly | QIODevice::Text)) { + if (!Sandbox::askForAccess(file) || !traktor_file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "Cannot open Traktor music collection"; return nullptr; } -- cgit v1.2.3