aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/android/androidmanifestdocument.cpp
blob: 294379cddeb68b1d4d9c45db988526290580cca9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "androidmanifestdocument.h"
#include "androidmanifesteditorwidget.h"
#include "androidconstants.h"

#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/idocument.h>

#include <utils/fileutils.h>

#include <QFileInfo>

using namespace Android;
using namespace Android::Internal;

AndroidManifestDocument::AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget)
    : m_editorWidget(editorWidget)
{
    setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
    setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
    setSuspendAllowed(false);
    connect(editorWidget, &AndroidManifestEditorWidget::guiChanged,
            this, &Core::IDocument::changed);
}

bool AndroidManifestDocument::save(QString *errorString, const Utils::FilePath &filePath, bool autoSave)
{
    m_editorWidget->preSave();
    bool result = TextDocument::save(errorString, filePath, autoSave);
    m_editorWidget->postSave();
    return result;
}

bool AndroidManifestDocument::isModified() const
{
    return TextDocument::isModified() ||  m_editorWidget->isModified();
}

bool AndroidManifestDocument::isSaveAsAllowed() const
{
    return false;
}