From 22fe880628a2186ef4d66c3b0b670de93ea4bc6f Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 21 Jul 2014 21:55:01 +0200 Subject: Improve AndroidManifest.xml error dialog content Currently, if the AndroidManifest.xml file is not present in the installation folder (e.g. failed make install), the error message shown to the user just tells him that some operation failed. This patch tries to be more verbose to give the user some clues for the failure reason. Task-number: QTCREATORBUG-11503 Change-Id: I013de394c87b3adb53ec86dd97433567d7f63049 Reviewed-by: Daniel Teske --- .../createandroidmanifestwizard.cpp | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp') diff --git a/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp index 10849b8b01..8e2f16239a 100644 --- a/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp +++ b/src/plugins/qmakeandroidsupport/createandroidmanifestwizard.cpp @@ -213,14 +213,21 @@ void CreateAndroidManifestWizard::setDirectory(const QString &directory) m_directory = directory; } -QString CreateAndroidManifestWizard::sourceFileName() const +QString CreateAndroidManifestWizard::sourceFolder() const { - QString result; QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit()); if (!version) - return result; + return QString(); + return version->qmakeProperty("QT_INSTALL_PREFIX"); +} + +QString CreateAndroidManifestWizard::sourceFileName() const +{ + QString srcFolder = sourceFolder(); + if (srcFolder.isEmpty()) + return srcFolder; Utils::FileName srcPath - = Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX")) + = Utils::FileName::fromString(srcFolder) .appendPath(QLatin1String("src/android/java")); srcPath.appendPath(QLatin1String("AndroidManifest.xml")); return srcPath.toString(); @@ -250,9 +257,20 @@ void CreateAndroidManifestWizard::createAndroidManifestFile() } } - if (!QFile::copy(sourceFileName(), fileName)) { + QString srcFileName = sourceFileName(); + + if (!QFileInfo(srcFileName).exists()) { + QMessageBox::warning(this, tr("File Creation Error"), + tr("\"%1\" is missing.\n" + "Check your Qt installation here:\n" + "\"%2\"").arg(fileName).arg(sourceFolder())); + return; + } + + if (!QFile::copy(srcFileName, fileName)) { QMessageBox::warning(this, tr("File Creation Error"), - tr("Could not create file %1.").arg(fileName)); + tr("Could not create file %1.\n" + "Verify that you have writing rights in your project directory.").arg(fileName)); return; } -- cgit v1.2.1