Commit 22fe8806 authored by Samuel Gaist's avatar Samuel Gaist
Browse files

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: default avatarDaniel Teske <daniel.teske@digia.com>
parent f130c3c7
...@@ -213,14 +213,21 @@ void CreateAndroidManifestWizard::setDirectory(const QString &directory) ...@@ -213,14 +213,21 @@ void CreateAndroidManifestWizard::setDirectory(const QString &directory)
m_directory = directory; m_directory = directory;
} }
QString CreateAndroidManifestWizard::sourceFileName() const QString CreateAndroidManifestWizard::sourceFolder() const
{ {
QString result;
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit()); QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit());
if (!version) 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 srcPath
= Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX")) = Utils::FileName::fromString(srcFolder)
.appendPath(QLatin1String("src/android/java")); .appendPath(QLatin1String("src/android/java"));
srcPath.appendPath(QLatin1String("AndroidManifest.xml")); srcPath.appendPath(QLatin1String("AndroidManifest.xml"));
return srcPath.toString(); return srcPath.toString();
...@@ -250,9 +257,20 @@ void CreateAndroidManifestWizard::createAndroidManifestFile() ...@@ -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"), 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; return;
} }
......
...@@ -92,6 +92,7 @@ public: ...@@ -92,6 +92,7 @@ public:
QmakeProjectManager::QmakeProFileNode *node() const; QmakeProjectManager::QmakeProFileNode *node() const;
void setNode(QmakeProjectManager::QmakeProFileNode *node); void setNode(QmakeProjectManager::QmakeProFileNode *node);
QString sourceFolder() const;
QString sourceFileName() const; QString sourceFileName() const;
void accept(); void accept();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment