androidmanifesteditorwidget.cpp 53.7 KB
Newer Older
1 2
/****************************************************************************
**
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
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
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/

#include "androidmanifesteditorwidget.h"
#include "androidmanifesteditor.h"
#include "androidconstants.h"
#include "androidmanifestdocument.h"
34
#include "androidmanager.h"
35
#include "androidqtsupport.h"
36

37
#include <coreplugin/coreconstants.h>
38
#include <coreplugin/icore.h>
39
#include <coreplugin/infobar.h>
40
#include <coreplugin/editormanager/ieditor.h>
41

42
#include <projectexplorer/project.h>
43
#include <projectexplorer/projectwindow.h>
44 45 46 47
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/kitinformation.h>
48

49
#include <texteditor/texteditoractionhandler.h>
50
#include <texteditor/texteditorsettings.h>
51
#include <texteditor/basetexteditor.h>
52
#include <utils/algorithm.h>
53 54 55 56 57

#include <QLineEdit>
#include <QFileInfo>
#include <QDomDocument>
#include <QDir>
58
#include <QGroupBox>
59 60 61 62 63 64 65 66
#include <QHBoxLayout>
#include <QLabel>
#include <QFormLayout>
#include <QComboBox>
#include <QSpinBox>
#include <QDebug>
#include <QToolButton>
#include <utils/fileutils.h>
67
#include <utils/stylehelper.h>
68 69 70 71
#include <QListView>
#include <QPushButton>
#include <QFileDialog>
#include <QTimer>
72
#include <QCheckBox>
73

74 75
#include <limits>

hjk's avatar
hjk committed
76
using namespace ProjectExplorer;
77 78 79
using namespace Android;
using namespace Android::Internal;

80
namespace {
81
const QLatin1String packageNameRegExp("^([a-z]{1}[a-z0-9_]+(\\.[a-zA-Z]{1}[a-zA-Z0-9_]*)*)$");
82
const char infoBarId[] = "Android.AndroidManifestEditor.InfoBar";
83
const char androidManifestEditorGeneralPaneContextId[] = "AndroidManifestEditorWidget.GeneralWidget";
84 85 86 87 88

bool checkPackageName(const QString &packageName)
{
    return QRegExp(packageNameRegExp).exactMatch(packageName);
}
89

hjk's avatar
hjk committed
90
Project *androidProject(const QString &file)
91 92
{
    Utils::FileName fileName = Utils::FileName::fromString(file);
hjk's avatar
hjk committed
93
    foreach (Project *project, SessionManager::projects()) {
94 95
        if (!project->activeTarget())
            continue;
hjk's avatar
hjk committed
96 97
        Kit *kit = project->activeTarget()->kit();
        if (DeviceTypeKitInformation::deviceTypeId(kit) == Android::Constants::ANDROID_DEVICE_TYPE
98
                && fileName.isChildOf(project->projectDirectory()))
99 100 101 102
            return project;
    }
    return 0;
}
103

104
} // anonymous namespace
105

106
AndroidManifestEditorWidget::AndroidManifestEditorWidget()
107
    : QScrollArea(),
108 109
      m_dirty(false),
      m_stayClean(false),
110 111
      m_setAppName(false),
      m_appNameInStringsXml(false)
112
{
113
    m_textEditorWidget = new AndroidManifestTextEditorWidget(this);
114
    m_textEditorWidget->setupAsPlainEditor();
115
    TextEditor::TextEditorSettings::initializeEditor(m_textEditorWidget);
116 117 118 119 120 121

    initializePage();

    m_timerParseCheck.setInterval(800);
    m_timerParseCheck.setSingleShot(true);

122 123
    m_editor = new AndroidManifestEditor(this);

124 125
    setWidgetResizable(true);

126 127 128
    connect(&m_timerParseCheck, SIGNAL(timeout()),
            this, SLOT(delayedParseCheck()));

129
    connect(m_textEditorWidget->document(), SIGNAL(contentsChanged()),
130 131 132 133 134
            this, SLOT(startParseCheck()));
}

void AndroidManifestEditorWidget::initializePage()
{
135 136
    m_stackedWidget = new QStackedWidget(this);
    setWidget(m_stackedWidget);
137 138

    Core::IContext *myContext = new Core::IContext(this);
139 140
    myContext->setWidget(m_stackedWidget);
    myContext->setContext(Core::Context(androidManifestEditorGeneralPaneContextId)); // where is the context used?
141
    Core::ICore::addContextObject(myContext);
142

143 144
    QWidget *mainWidget = new QWidget; // different name

145 146 147 148
    QVBoxLayout *topLayout = new QVBoxLayout(mainWidget);

    QGroupBox *packageGroupBox = new QGroupBox(mainWidget);
    topLayout->addWidget(packageGroupBox);
149

150 151 152
    packageGroupBox->setTitle(tr("Package"));
    {
        QFormLayout *formLayout = new QFormLayout();
153

154
        m_packageNameLineEdit = new QLineEdit(packageGroupBox);
155 156
        m_packageNameLineEdit->setToolTip(tr(
                    "<p align=\"justify\">Please choose a valid package name "
157
                    "for your application (for example, \"org.example.myapplication\").</p>"
158 159 160 161
                    "<p align=\"justify\">Packages are usually defined using a hierarchical naming pattern, "
                    "with levels in the hierarchy separated by periods (.) (pronounced \"dot\").</p>"
                    "<p align=\"justify\">In general, a package name begins with the top level domain name"
                    " of the organization and then the organization's domain and then any subdomains listed"
Robert Loehning's avatar
Robert Loehning committed
162
                    " in reverse order. The organization can then choose a specific name for their package."
163 164 165 166
                    " Package names should be all lowercase characters whenever possible.</p>"
                    "<p align=\"justify\">Complete conventions for disambiguating package names and rules for"
                    " naming packages when the Internet domain name cannot be directly used as a package name"
                    " are described in section 7.7 of the Java Language Specification.</p>"));
167 168 169 170 171 172 173
        formLayout->addRow(tr("Package name:"), m_packageNameLineEdit);

        m_packageNameWarning = new QLabel;
        m_packageNameWarning->setText(tr("The package name is not valid."));
        m_packageNameWarning->setVisible(false);

        m_packageNameWarningIcon = new QLabel;
174
        m_packageNameWarningIcon->setPixmap(QPixmap(QLatin1String(Core::Constants::ICON_WARNING)));
175 176 177 178 179 180 181 182 183 184 185
        m_packageNameWarningIcon->setVisible(false);
        m_packageNameWarningIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

        QHBoxLayout *warningRow = new QHBoxLayout;
        warningRow->setMargin(0);
        warningRow->addWidget(m_packageNameWarningIcon);
        warningRow->addWidget(m_packageNameWarning);

        formLayout->addRow(QString(), warningRow);


186
        m_versionCode = new QSpinBox(packageGroupBox);
187
        m_versionCode->setMaximum(std::numeric_limits<int>::max());
188
        m_versionCode->setValue(1);
189
        m_versionCode->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
190 191
        formLayout->addRow(tr("Version code:"), m_versionCode);

192
        m_versionNameLinedit = new QLineEdit(packageGroupBox);
193 194
        formLayout->addRow(tr("Version name:"), m_versionNameLinedit);

195 196 197 198 199 200 201 202 203
        m_androidMinSdkVersion = new QComboBox(packageGroupBox);
        m_androidMinSdkVersion->setToolTip(
                    tr("Sets the minimum required version on which this application can be run."));
        m_androidMinSdkVersion->addItem(tr("Not set"), 0);

        formLayout->addRow(tr("Minimum required SDK:"), m_androidMinSdkVersion);

        m_androidTargetSdkVersion = new QComboBox(packageGroupBox);
        m_androidTargetSdkVersion->setToolTip(
204
                  tr("Sets the target SDK. Set this to the highest tested version. "
205
                     "This disables compatibility behavior of the system for your application."));
206 207 208 209
        m_androidTargetSdkVersion->addItem(tr("Not set"), 0);

        formLayout->addRow(tr("Target SDK:"), m_androidTargetSdkVersion);

210
        packageGroupBox->setLayout(formLayout);
211 212 213 214 215 216 217

        connect(m_packageNameLineEdit, SIGNAL(textEdited(QString)),
                this, SLOT(setPackageName()));
        connect(m_versionCode, SIGNAL(valueChanged(int)),
                this, SLOT(setDirty()));
        connect(m_versionNameLinedit, SIGNAL(textEdited(QString)),
                this, SLOT(setDirty()));
218 219 220 221
        connect(m_androidMinSdkVersion, SIGNAL(currentIndexChanged(int)),
                this, SLOT(setDirty()));
        connect(m_androidTargetSdkVersion, SIGNAL(currentIndexChanged(int)),
                this, SLOT(setDirty()));
222 223 224 225

    }

    // Application
226 227 228 229
    QGroupBox *applicationGroupBox = new QGroupBox(mainWidget);
    topLayout->addWidget(applicationGroupBox);

    applicationGroupBox->setTitle(tr("Application"));
230
    {
231
        QFormLayout *formLayout = new QFormLayout();
232

233
        m_appNameLineEdit = new QLineEdit(applicationGroupBox);
234 235
        formLayout->addRow(tr("Application name:"), m_appNameLineEdit);

236 237 238 239
        m_targetLineEdit = new QComboBox(applicationGroupBox);
        m_targetLineEdit->setEditable(true);
        m_targetLineEdit->setDuplicatesEnabled(true);
        m_targetLineEdit->installEventFilter(this);
240 241 242
        formLayout->addRow(tr("Run:"), m_targetLineEdit);

        QHBoxLayout *iconLayout = new QHBoxLayout();
243
        m_lIconButton = new QToolButton(applicationGroupBox);
244 245
        m_lIconButton->setMinimumSize(QSize(48, 48));
        m_lIconButton->setMaximumSize(QSize(48, 48));
246
        m_lIconButton->setToolTip(tr("Select low DPI icon."));
247 248 249 250
        iconLayout->addWidget(m_lIconButton);

        iconLayout->addItem(new QSpacerItem(28, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));

251
        m_mIconButton = new QToolButton(applicationGroupBox);
252 253
        m_mIconButton->setMinimumSize(QSize(48, 48));
        m_mIconButton->setMaximumSize(QSize(48, 48));
254
        m_mIconButton->setToolTip(tr("Select medium DPI icon."));
255 256 257 258
        iconLayout->addWidget(m_mIconButton);

        iconLayout->addItem(new QSpacerItem(28, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));

259
        m_hIconButton = new QToolButton(applicationGroupBox);
260 261
        m_hIconButton->setMinimumSize(QSize(48, 48));
        m_hIconButton->setMaximumSize(QSize(48, 48));
262
        m_hIconButton->setToolTip(tr("Select high DPI icon."));
263 264 265 266
        iconLayout->addWidget(m_hIconButton);

        formLayout->addRow(tr("Application icon:"), iconLayout);

267
        applicationGroupBox->setLayout(formLayout);
268 269 270

        connect(m_appNameLineEdit, SIGNAL(textEdited(QString)),
                this, SLOT(setAppName()));
271
        connect(m_targetLineEdit, SIGNAL(currentTextChanged(QString)),
272 273 274 275 276 277 278 279 280
                this, SLOT(setDirty()));

        connect(m_lIconButton, SIGNAL(clicked()), SLOT(setLDPIIcon()));
        connect(m_mIconButton, SIGNAL(clicked()), SLOT(setMDPIIcon()));
        connect(m_hIconButton, SIGNAL(clicked()), SLOT(setHDPIIcon()));
    }


    // Permissions
281 282 283 284
    QGroupBox *permissionsGroupBox = new QGroupBox(mainWidget);
    topLayout->addWidget(permissionsGroupBox);

    permissionsGroupBox->setTitle(tr("Permissions"));
285
    {
286
        QGridLayout *layout = new QGridLayout(permissionsGroupBox);
287

288 289 290 291 292
        m_defaultPermissonsCheckBox = new QCheckBox(this);
        m_defaultPermissonsCheckBox->setText(tr("Include default permissions and features for Qt modules."));
        m_defaultPermissonsCheckBox->setTristate(true);
        layout->addWidget(m_defaultPermissonsCheckBox, 0, 0);

293 294
        m_permissionsModel = new PermissionsModel(this);

295
        m_permissionsListView = new QListView(permissionsGroupBox);
296 297
        m_permissionsListView->setModel(m_permissionsModel);
        m_permissionsListView->setMinimumSize(QSize(0, 200));
298
        layout->addWidget(m_permissionsListView, 1, 0, 3, 1);
299

300
        m_removePermissionButton = new QPushButton(permissionsGroupBox);
301
        m_removePermissionButton->setText(tr("Remove"));
302
        layout->addWidget(m_removePermissionButton, 1, 1);
303

304
        m_permissionsComboBox = new QComboBox(permissionsGroupBox);
305
        m_permissionsComboBox->insertItems(0, QStringList()
306 307 308 309 310 311 312 313 314
         << QLatin1String("android.permission.ACCESS_CHECKIN_PROPERTIES")
         << QLatin1String("android.permission.ACCESS_COARSE_LOCATION")
         << QLatin1String("android.permission.ACCESS_FINE_LOCATION")
         << QLatin1String("android.permission.ACCESS_LOCATION_EXTRA_COMMANDS")
         << QLatin1String("android.permission.ACCESS_MOCK_LOCATION")
         << QLatin1String("android.permission.ACCESS_NETWORK_STATE")
         << QLatin1String("android.permission.ACCESS_SURFACE_FLINGER")
         << QLatin1String("android.permission.ACCESS_WIFI_STATE")
         << QLatin1String("android.permission.ACCOUNT_MANAGER")
Daniel Teske's avatar
Daniel Teske committed
315
         << QLatin1String("com.android.voicemail.permission.ADD_VOICEMAIL")
316 317
         << QLatin1String("android.permission.AUTHENTICATE_ACCOUNTS")
         << QLatin1String("android.permission.BATTERY_STATS")
Daniel Teske's avatar
Daniel Teske committed
318
         << QLatin1String("android.permission.BIND_ACCESSIBILITY_SERVICE")
319 320 321 322
         << QLatin1String("android.permission.BIND_APPWIDGET")
         << QLatin1String("android.permission.BIND_DEVICE_ADMIN")
         << QLatin1String("android.permission.BIND_INPUT_METHOD")
         << QLatin1String("android.permission.BIND_REMOTEVIEWS")
Daniel Teske's avatar
Daniel Teske committed
323 324
         << QLatin1String("android.permission.BIND_TEXT_SERVICE")
         << QLatin1String("android.permission.BIND_VPN_SERVICE")
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
         << QLatin1String("android.permission.BIND_WALLPAPER")
         << QLatin1String("android.permission.BLUETOOTH")
         << QLatin1String("android.permission.BLUETOOTH_ADMIN")
         << QLatin1String("android.permission.BRICK")
         << QLatin1String("android.permission.BROADCAST_PACKAGE_REMOVED")
         << QLatin1String("android.permission.BROADCAST_SMS")
         << QLatin1String("android.permission.BROADCAST_STICKY")
         << QLatin1String("android.permission.BROADCAST_WAP_PUSH")
         << QLatin1String("android.permission.CALL_PHONE")
         << QLatin1String("android.permission.CALL_PRIVILEGED")
         << QLatin1String("android.permission.CAMERA")
         << QLatin1String("android.permission.CHANGE_COMPONENT_ENABLED_STATE")
         << QLatin1String("android.permission.CHANGE_CONFIGURATION")
         << QLatin1String("android.permission.CHANGE_NETWORK_STATE")
         << QLatin1String("android.permission.CHANGE_WIFI_MULTICAST_STATE")
         << QLatin1String("android.permission.CHANGE_WIFI_STATE")
         << QLatin1String("android.permission.CLEAR_APP_CACHE")
         << QLatin1String("android.permission.CLEAR_APP_USER_DATA")
         << QLatin1String("android.permission.CONTROL_LOCATION_UPDATES")
         << QLatin1String("android.permission.DELETE_CACHE_FILES")
         << QLatin1String("android.permission.DELETE_PACKAGES")
         << QLatin1String("android.permission.DEVICE_POWER")
         << QLatin1String("android.permission.DIAGNOSTIC")
         << QLatin1String("android.permission.DISABLE_KEYGUARD")
         << QLatin1String("android.permission.DUMP")
         << QLatin1String("android.permission.EXPAND_STATUS_BAR")
         << QLatin1String("android.permission.FACTORY_TEST")
         << QLatin1String("android.permission.FLASHLIGHT")
         << QLatin1String("android.permission.FORCE_BACK")
         << QLatin1String("android.permission.GET_ACCOUNTS")
         << QLatin1String("android.permission.GET_PACKAGE_SIZE")
         << QLatin1String("android.permission.GET_TASKS")
         << QLatin1String("android.permission.GLOBAL_SEARCH")
         << QLatin1String("android.permission.HARDWARE_TEST")
         << QLatin1String("android.permission.INJECT_EVENTS")
         << QLatin1String("android.permission.INSTALL_LOCATION_PROVIDER")
         << QLatin1String("android.permission.INSTALL_PACKAGES")
         << QLatin1String("android.permission.INTERNAL_SYSTEM_WINDOW")
         << QLatin1String("android.permission.INTERNET")
         << QLatin1String("android.permission.KILL_BACKGROUND_PROCESSES")
         << QLatin1String("android.permission.MANAGE_ACCOUNTS")
         << QLatin1String("android.permission.MANAGE_APP_TOKENS")
         << QLatin1String("android.permission.MASTER_CLEAR")
         << QLatin1String("android.permission.MODIFY_AUDIO_SETTINGS")
         << QLatin1String("android.permission.MODIFY_PHONE_STATE")
         << QLatin1String("android.permission.MOUNT_FORMAT_FILESYSTEMS")
         << QLatin1String("android.permission.MOUNT_UNMOUNT_FILESYSTEMS")
         << QLatin1String("android.permission.NFC")
         << QLatin1String("android.permission.PERSISTENT_ACTIVITY")
         << QLatin1String("android.permission.PROCESS_OUTGOING_CALLS")
         << QLatin1String("android.permission.READ_CALENDAR")
Daniel Teske's avatar
Daniel Teske committed
376
         << QLatin1String("android.permission.READ_CALL_LOG")
377
         << QLatin1String("android.permission.READ_CONTACTS")
Daniel Teske's avatar
Daniel Teske committed
378
         << QLatin1String("android.permission.READ_EXTERNAL_STORAGE")
379 380 381 382 383
         << QLatin1String("android.permission.READ_FRAME_BUFFER")
         << QLatin1String("com.android.browser.permission.READ_HISTORY_BOOKMARKS")
         << QLatin1String("android.permission.READ_INPUT_STATE")
         << QLatin1String("android.permission.READ_LOGS")
         << QLatin1String("android.permission.READ_PHONE_STATE")
Daniel Teske's avatar
Daniel Teske committed
384
         << QLatin1String("android.permission.READ_PROFILE")
385
         << QLatin1String("android.permission.READ_SMS")
Daniel Teske's avatar
Daniel Teske committed
386
         << QLatin1String("android.permission.READ_SOCIAL_STREAM")
387 388
         << QLatin1String("android.permission.READ_SYNC_SETTINGS")
         << QLatin1String("android.permission.READ_SYNC_STATS")
Daniel Teske's avatar
Daniel Teske committed
389
         << QLatin1String("android.permission.READ_USER_DICTIONARY")
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
         << QLatin1String("android.permission.REBOOT")
         << QLatin1String("android.permission.RECEIVE_BOOT_COMPLETED")
         << QLatin1String("android.permission.RECEIVE_MMS")
         << QLatin1String("android.permission.RECEIVE_SMS")
         << QLatin1String("android.permission.RECEIVE_WAP_PUSH")
         << QLatin1String("android.permission.RECORD_AUDIO")
         << QLatin1String("android.permission.REORDER_TASKS")
         << QLatin1String("android.permission.RESTART_PACKAGES")
         << QLatin1String("android.permission.SEND_SMS")
         << QLatin1String("android.permission.SET_ACTIVITY_WATCHER")
         << QLatin1String("com.android.alarm.permission.SET_ALARM")
         << QLatin1String("android.permission.SET_ALWAYS_FINISH")
         << QLatin1String("android.permission.SET_ANIMATION_SCALE")
         << QLatin1String("android.permission.SET_DEBUG_APP")
         << QLatin1String("android.permission.SET_ORIENTATION")
Daniel Teske's avatar
Daniel Teske committed
405
         << QLatin1String("android.permission.SET_POINTER_SPEED")
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423
         << QLatin1String("android.permission.SET_PREFERRED_APPLICATIONS")
         << QLatin1String("android.permission.SET_PROCESS_LIMIT")
         << QLatin1String("android.permission.SET_TIME")
         << QLatin1String("android.permission.SET_TIME_ZONE")
         << QLatin1String("android.permission.SET_WALLPAPER")
         << QLatin1String("android.permission.SET_WALLPAPER_HINTS")
         << QLatin1String("android.permission.SIGNAL_PERSISTENT_PROCESSES")
         << QLatin1String("android.permission.STATUS_BAR")
         << QLatin1String("android.permission.SUBSCRIBED_FEEDS_READ")
         << QLatin1String("android.permission.SUBSCRIBED_FEEDS_WRITE")
         << QLatin1String("android.permission.SYSTEM_ALERT_WINDOW")
         << QLatin1String("android.permission.UPDATE_DEVICE_STATS")
         << QLatin1String("android.permission.USE_CREDENTIALS")
         << QLatin1String("android.permission.USE_SIP")
         << QLatin1String("android.permission.VIBRATE")
         << QLatin1String("android.permission.WAKE_LOCK")
         << QLatin1String("android.permission.WRITE_APN_SETTINGS")
         << QLatin1String("android.permission.WRITE_CALENDAR")
Daniel Teske's avatar
Daniel Teske committed
424
         << QLatin1String("android.permission.WRITE_CALL_LOG")
425 426 427 428
         << QLatin1String("android.permission.WRITE_CONTACTS")
         << QLatin1String("android.permission.WRITE_EXTERNAL_STORAGE")
         << QLatin1String("android.permission.WRITE_GSERVICES")
         << QLatin1String("com.android.browser.permission.WRITE_HISTORY_BOOKMARKS")
Daniel Teske's avatar
Daniel Teske committed
429
         << QLatin1String("android.permission.WRITE_PROFILE")
430 431 432
         << QLatin1String("android.permission.WRITE_SECURE_SETTINGS")
         << QLatin1String("android.permission.WRITE_SETTINGS")
         << QLatin1String("android.permission.WRITE_SMS")
Daniel Teske's avatar
Daniel Teske committed
433
         << QLatin1String("android.permission.WRITE_SOCIAL_STREAM")
434
         << QLatin1String("android.permission.WRITE_SYNC_SETTINGS")
Daniel Teske's avatar
Daniel Teske committed
435
         << QLatin1String("android.permission.WRITE_USER_DICTIONARY")
436 437
        );
        m_permissionsComboBox->setEditable(true);
438
        layout->addWidget(m_permissionsComboBox, 5, 0);
439

440
        m_addPermissionButton = new QPushButton(permissionsGroupBox);
441
        m_addPermissionButton->setText(tr("Add"));
442
        layout->addWidget(m_addPermissionButton, 5, 1);
443

444
        permissionsGroupBox->setLayout(layout);
445

446 447 448
        connect(m_defaultPermissonsCheckBox, SIGNAL(stateChanged(int)),
                this, SLOT(defaultPermissionCheckBoxClicked()));

449 450 451 452 453 454 455 456
        connect(m_addPermissionButton, SIGNAL(clicked()),
                this, SLOT(addPermission()));
        connect(m_removePermissionButton, SIGNAL(clicked()),
                this, SLOT(removePermission()));
        connect(m_permissionsComboBox, SIGNAL(currentTextChanged(QString)),
                this, SLOT(updateAddRemovePermissionButtons()));
    }

457 458
    topLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding));

459 460
    m_stackedWidget->insertWidget(General, mainWidget);
    m_stackedWidget->insertWidget(Source, m_textEditorWidget);
461 462
}

463 464 465
bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
{
    if (obj == m_targetLineEdit) {
Orgad Shaneh's avatar
Orgad Shaneh committed
466
        if (event->type() == QEvent::FocusIn)
467 468 469
            QTimer::singleShot(0, this, SLOT(updateTargetComboBox()));
    }

470
    return QWidget::eventFilter(obj, event);
471 472 473 474
}

void AndroidManifestEditorWidget::updateTargetComboBox()
{
475
    const QString docPath(m_textEditorWidget->textDocument()->filePath());
476 477 478 479 480
    ProjectExplorer::Project *project = androidProject(docPath);
    QStringList items;
    if (project) {
        ProjectExplorer::Kit *kit = project->activeTarget()->kit();
        if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(kit) == Constants::ANDROID_DEVICE_TYPE)
481
            items = AndroidManager::androidQtSupport(project->activeTarget())->projectTargetApplications(project->activeTarget());
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
    }

    // QComboBox randomly resets what the user has entered
    // if all rows are removed, thus we ensure that the current text
    // is not removed by first adding it and then removing all old rows
    // and then adding the new rows
    QString text = m_targetLineEdit->currentText();
    m_targetLineEdit->addItem(text);
    while (m_targetLineEdit->count() > 1)
        m_targetLineEdit->removeItem(0);
    items.removeDuplicates();
    items.removeAll(text);
    m_targetLineEdit->addItems(items);
}

497 498
bool AndroidManifestEditorWidget::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
499
    bool result = m_textEditorWidget->open(errorString, fileName, realFileName);
500 501 502

    updateSdkVersions();

503 504 505 506 507 508 509
    if (!result)
        return result;

    QString error;
    int errorLine;
    int errorColumn;
    QDomDocument doc;
510
    if (doc.setContent(m_textEditorWidget->toPlainText(), &error, &errorLine, &errorColumn)) {
511 512 513 514 515 516
        if (checkDocument(doc, &error, &errorLine, &errorColumn)) {
            if (activePage() != Source)
                syncToWidgets(doc);
            return true;
        }
    }
Sergio Ahumada's avatar
Sergio Ahumada committed
517
    // some error occurred
518 519 520 521 522 523 524
    updateInfoBar(error, errorLine, errorColumn);
    setActivePage(Source);
    return true;
}

void AndroidManifestEditorWidget::setDirty(bool dirty)
{
525
    if (m_stayClean || dirty == m_dirty)
526 527
        return;
    m_dirty = dirty;
528
    emit guiChanged();
529 530 531 532 533 534 535 536 537 538 539 540 541
}

bool AndroidManifestEditorWidget::isModified() const
{
    return m_dirty
            || !m_hIconPath.isEmpty()
            || !m_mIconPath.isEmpty()
            || !m_lIconPath.isEmpty()
            || m_setAppName;
}

AndroidManifestEditorWidget::EditorPage AndroidManifestEditorWidget::activePage() const
{
542
    return AndroidManifestEditorWidget::EditorPage(m_stackedWidget->currentIndex());
543 544 545 546 547 548 549 550 551 552 553
}

bool AndroidManifestEditorWidget::setActivePage(EditorPage page)
{
    EditorPage prevPage = activePage();

    if (prevPage == page)
        return true;

    if (page == Source) {
        syncToEditor();
554 555
        setFocus();
    } else {
Orgad Shaneh's avatar
Orgad Shaneh committed
556
        if (!syncToWidgets())
557
            return false;
558 559 560 561 562 563
// TODO?
//        QWidget *fw = m_overlayWidget->focusWidget();
//        if (fw && fw != m_overlayWidget)
//            fw->setFocus();
//        else
//            m_packageNameLineEdit->setFocus();
564 565
    }

566
    m_stackedWidget->setCurrentIndex(page);
567 568 569 570 571 572 573 574
    return true;
}

void AndroidManifestEditorWidget::preSave()
{
    if (activePage() != Source)
        syncToEditor();

575
    if (m_setAppName && m_appNameInStringsXml) {
576
        QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
        QString fileName = baseDir + QLatin1String("/res/values/strings.xml");
        QFile f(fileName);
        if (f.open(QIODevice::ReadOnly)) {
            QDomDocument doc;
            if (doc.setContent(f.readAll())) {
                QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("string"));
                while (!metadataElem.isNull()) {
                    if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name")) {
                        metadataElem.removeChild(metadataElem.firstChild());
                        metadataElem.appendChild(doc.createTextNode(m_appNameLineEdit->text()));
                        break;
                    }
                    metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
                }

                f.close();
                f.open(QIODevice::WriteOnly);
                f.write(doc.toByteArray((4)));
            }
        }
        m_setAppName = false;
    }

600
    QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
    if (!m_lIconPath.isEmpty()) {
        copyIcon(LowDPI, baseDir, m_lIconPath);
        m_lIconPath.clear();
    }
    if (!m_mIconPath.isEmpty()) {
        copyIcon(MediumDPI, baseDir, m_mIconPath);
        m_mIconPath.clear();
    }
    if (!m_hIconPath.isEmpty()) {
        copyIcon(HighDPI, baseDir, m_hIconPath);
        m_hIconPath.clear();
    }
    // no need to emit changed() since this is called as part of saving

    updateInfoBar();
}

618 619 620 621 622
Core::IEditor *AndroidManifestEditorWidget::editor() const
{
    return m_editor;
}

623
TextEditor::BaseTextEditorWidget *AndroidManifestEditorWidget::textEditorWidget() const
624 625 626 627
{
    return m_textEditorWidget;
}

628 629 630 631 632
bool AndroidManifestEditorWidget::syncToWidgets()
{
    QDomDocument doc;
    QString errorMessage;
    int errorLine, errorColumn;
633
    if (doc.setContent(m_textEditorWidget->toPlainText(), &errorMessage, &errorLine, &errorColumn)) {
634 635 636 637 638 639 640 641 642 643 644 645 646 647 648
        if (checkDocument(doc, &errorMessage, &errorLine, &errorColumn)) {
            hideInfoBar();
            syncToWidgets(doc);
            return true;
        }
    }

    updateInfoBar(errorMessage, errorLine, errorColumn);
    return false;
}

bool AndroidManifestEditorWidget::checkDocument(QDomDocument doc, QString *errorMessage, int *errorLine, int *errorColumn)
{
    QDomElement manifest = doc.documentElement();
    if (manifest.tagName() != QLatin1String("manifest")) {
649
        *errorMessage = tr("The structure of the Android manifest file is corrupted. Expected a top level 'manifest' node.");
650 651 652 653 654
        *errorLine = -1;
        *errorColumn = -1;
        return false;
    } else if (manifest.firstChildElement(QLatin1String("application")).firstChildElement(QLatin1String("activity")).isNull()) {
        // missing either application or activity element
655
        *errorMessage = tr("The structure of the Android manifest file is corrupted. Expected an 'application' and 'activity' sub node.");
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681
        *errorLine = -1;
        *errorColumn = -1;
        return false;
    }
    return true;
}

void AndroidManifestEditorWidget::startParseCheck()
{
    m_timerParseCheck.start();
}

void AndroidManifestEditorWidget::delayedParseCheck()
{
    updateInfoBar();
}

void AndroidManifestEditorWidget::updateInfoBar()
{
    if (activePage() != Source) {
        m_timerParseCheck.stop();
        return;
    }
    QDomDocument doc;
    int errorLine, errorColumn;
    QString errorMessage;
682
    if (doc.setContent(m_textEditorWidget->toPlainText(), &errorMessage, &errorLine, &errorColumn)) {
683 684 685 686 687 688 689 690 691
        if (checkDocument(doc, &errorMessage, &errorLine, &errorColumn)) {
            hideInfoBar();
            return;
        }
    }

    updateInfoBar(errorMessage, errorLine, errorColumn);
}

692 693
void AndroidManifestEditorWidget::updateSdkVersions()
{
694
    const QString docPath(m_textEditorWidget->textDocument()->filePath());
695
    QPair<int, int> apiLevels = AndroidManager::apiLevelRange();
696 697 698 699 700 701 702 703 704 705 706 707 708
    for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
        m_androidMinSdkVersion->addItem(tr("API %1: %2")
                                        .arg(i)
                                        .arg(AndroidManager::androidNameForApiLevel(i)),
                                        i);

    for (int i = apiLevels.first; i < apiLevels.second + 1; ++i)
        m_androidTargetSdkVersion->addItem(tr("API %1: %2")
                                           .arg(i)
                                           .arg(AndroidManager::androidNameForApiLevel(i)),
                                           i);
}

709 710
void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int line, int column)
{
711
    Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
712 713
    QString text;
    if (line < 0)
714
        text = tr("Could not parse file: \"%1\".").arg(errorMessage);
715
    else
716
        text = tr("%2: Could not parse file: \"%1\".").arg(errorMessage).arg(line);
717 718 719 720 721 722 723 724 725 726 727 728
    Core::InfoBarEntry infoBarEntry(infoBarId, text);
    infoBarEntry.setCustomButtonInfo(tr("Goto error"), this, SLOT(gotoError()));
    infoBar->removeInfo(infoBarId);
    infoBar->addInfo(infoBarEntry);

    m_errorLine = line;
    m_errorColumn = column;
    m_timerParseCheck.stop();
}

void AndroidManifestEditorWidget::hideInfoBar()
{
729
    Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
730
        infoBar->removeInfo(infoBarId);
731 732 733 734 735
    m_timerParseCheck.stop();
}

void AndroidManifestEditorWidget::gotoError()
{
736
    m_textEditorWidget->gotoLine(m_errorLine, m_errorColumn);
737 738
}

739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
void setApiLevel(QComboBox *box, const QDomElement &element, const QString &attribute)
{
    if (!element.isNull() && element.hasAttribute(attribute)) {
        bool ok;
        int tmp = element.attribute(attribute).toInt(&ok);
        if (ok) {
            int index = box->findData(tmp);
            if (index != -1) {
                box->setCurrentIndex(index);
                return;
            }
        }
    }
    int index = box->findData(0);
    box->setCurrentIndex(index);
}

756 757 758 759 760 761 762 763
void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc)
{
    m_stayClean = true;
    QDomElement manifest = doc.documentElement();
    m_packageNameLineEdit->setText(manifest.attribute(QLatin1String("package")));
    m_versionCode->setValue(manifest.attribute(QLatin1String("android:versionCode")).toInt());
    m_versionNameLinedit->setText(manifest.attribute(QLatin1String("android:versionName")));

764 765 766 767
    QDomElement usesSdkElement = manifest.firstChildElement(QLatin1String("uses-sdk"));
    setApiLevel(m_androidMinSdkVersion, usesSdkElement, QLatin1String("android:minSdkVersion"));
    setApiLevel(m_androidTargetSdkVersion, usesSdkElement, QLatin1String("android:targetSdkVersion"));

768
    QString baseDir = QFileInfo(m_textEditorWidget->textDocument()->filePath()).absolutePath();
769 770
    QString fileName = baseDir + QLatin1String("/res/values/strings.xml");

771 772
    QDomElement applicationElement = manifest.firstChildElement(QLatin1String("application"));

773 774 775 776 777 778 779 780 781 782 783 784 785
    QFile f(fileName);
    if (f.exists() && f.open(QIODevice::ReadOnly)) {
        QDomDocument doc;
        if (doc.setContent(&f)) {
            QDomElement metadataElem = doc.documentElement().firstChildElement(QLatin1String("string"));
            while (!metadataElem.isNull()) {
                if (metadataElem.attribute(QLatin1String("name")) == QLatin1String("app_name")) {
                    m_appNameLineEdit->setText(metadataElem.text());
                    break;
                }
                metadataElem = metadataElem.nextSiblingElement(QLatin1String("string"));
            }
        }
786 787 788 789
        m_appNameInStringsXml = true;
    } else {
        m_appNameLineEdit->setText(applicationElement.attribute(QLatin1String("android:label")));
        m_appNameInStringsXml = false;
790 791
    }

792
    QDomElement metadataElem = applicationElement.firstChildElement(QLatin1String("activity")).firstChildElement(QLatin1String("meta-data"));
793 794
    while (!metadataElem.isNull()) {
        if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.lib_name")) {
795
            m_targetLineEdit->setEditText(metadataElem.attribute(QLatin1String("android:value")));
796 797 798 799 800 801 802 803 804 805 806 807
            break;
        }
        metadataElem = metadataElem.nextSiblingElement(QLatin1String("meta-data"));
    }

    m_lIconButton->setIcon(icon(baseDir, LowDPI));
    m_mIconButton->setIcon(icon(baseDir, MediumDPI));
    m_hIconButton->setIcon(icon(baseDir, HighDPI));
    m_lIconPath.clear();
    m_mIconPath.clear();
    m_hIconPath.clear();

808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830
    disconnect(m_defaultPermissonsCheckBox, SIGNAL(stateChanged(int)),
            this, SLOT(defaultPermissionCheckBoxClicked()));

    m_defaultPermissonsCheckBox->setChecked(false);
    QDomNodeList manifestChilds = manifest.childNodes();
    bool foundPermissionComment = false;
    bool foundFeatureComment = false;
    for (int i = 0; i < manifestChilds.size(); ++i) {
        const QDomNode &child = manifestChilds.at(i);
        if (child.isComment()) {
            QDomComment comment = child.toComment();
            if (comment.data().trimmed() == QLatin1String("%%INSERT_PERMISSIONS"))
                foundPermissionComment = true;
            else if (comment.data().trimmed() == QLatin1String("%%INSERT_FEATURES"))
                foundFeatureComment = true;
        }
    }

    m_defaultPermissonsCheckBox->setCheckState(Qt::CheckState(foundFeatureComment + foundPermissionComment));

    connect(m_defaultPermissonsCheckBox, SIGNAL(stateChanged(int)),
            this, SLOT(defaultPermissionCheckBoxClicked()));

831 832 833 834 835 836 837 838 839 840 841 842 843 844
    QStringList permissions;
    QDomElement permissionElem = manifest.firstChildElement(QLatin1String("uses-permission"));
    while (!permissionElem.isNull()) {
        permissions << permissionElem.attribute(QLatin1String("android:name"));
        permissionElem = permissionElem.nextSiblingElement(QLatin1String("uses-permission"));
    }

    m_permissionsModel->setPermissions(permissions);
    updateAddRemovePermissionButtons();

    m_stayClean = false;
    m_dirty = false;
}

845 846 847 848 849 850 851
int extractVersion(const QString &string)
{
    if (!string.startsWith(QLatin1String("API")))
        return 0;
    int index = string.indexOf(QLatin1Char(':'));
    if (index == -1)
        return 0;
852
#if QT_VERSION < 0x050100
853 854
    return string.mid(4, index - 4).toInt();
#else
855
    return string.midRef(4, index - 4).toInt();
856
#endif
857 858
}

859 860
void AndroidManifestEditorWidget::syncToEditor()
{
861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880
    QString result;
    QXmlStreamReader reader(m_textEditorWidget->toPlainText());
    reader.setNamespaceProcessing(false);
    QXmlStreamWriter writer(&result);
    writer.setAutoFormatting(true);
    writer.setAutoFormattingIndent(4);
    while (!reader.atEnd()) {
        reader.readNext();
        if (reader.hasError()) {
            // This should not happen
            updateInfoBar();
            return;
        } else {
            if (reader.name() == QLatin1String("manifest"))
                parseManifest(reader, writer);
            else if (reader.isStartElement())
                parseUnknownElement(reader, writer);
            else
                writer.writeCurrentToken(reader);
        }
881 882
    }

883 884
    if (result == m_textEditorWidget->toPlainText())
        return;
885

886 887
    m_textEditorWidget->setPlainText(result);
    m_textEditorWidget->document()->setModified(true);
888

889 890
    m_dirty = false;
}
891

892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909
namespace {
QXmlStreamAttributes modifyXmlStreamAttributes(const QXmlStreamAttributes &input, const QStringList &keys,
                                               const QStringList values, const QStringList &remove = QStringList())
{
    Q_ASSERT(keys.size() == values.size());
    QXmlStreamAttributes result;
    result.reserve(input.size());
    foreach (const QXmlStreamAttribute &attribute, input) {
        const QString &name = attribute.qualifiedName().toString();
        if (remove.contains(name))
            continue;
        int index = keys.indexOf(name);
        if (index == -1)
            result.push_back(attribute);
        else
            result.push_back(QXmlStreamAttribute(name,
                                                 values.at(index)));
    }
910

911 912 913
    for (int i = 0; i < keys.size(); ++i) {
        if (!result.hasAttribute(keys.at(i)))
            result.push_back(QXmlStreamAttribute(keys.at(i), values.at(i)));
914
    }
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939
    return result;
}
} // end namespace

void AndroidManifestEditorWidget::parseManifest(QXmlStreamReader &reader, QXmlStreamWriter &writer)
{
    Q_ASSERT(reader.isStartElement());
    writer.writeStartElement(reader.name().toString());

    QXmlStreamAttributes attributes = reader.attributes();
    QStringList keys = QStringList()
            << QLatin1String("package")
            << QLatin1String("android:versionCode")
            << QLatin1String("android:versionName");
    QStringList values = QStringList()
            << m_packageNameLineEdit->text()
            << QString::number(m_versionCode->value())
            << m_versionNameLinedit->text();

    QXmlStreamAttributes result = modifyXmlStreamAttributes(attributes, keys, values);
    writer.writeAttributes(result);

    QSet<QString> permissions = m_permissionsModel->permissions().toSet();

    bool foundUsesSdk = false;
940 941
    bool foundPermissionComment = false;
    bool foundFeatureComment = false;
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966
    reader.readNext();
    while (!reader.atEnd()) {
        if (reader.name() == QLatin1String("application")) {
            parseApplication(reader, writer);
        } else if (reader.name() == QLatin1String("uses-sdk")) {
            parseUsesSdk(reader, writer);
            foundUsesSdk = true;
        } else if (reader.name() == QLatin1String("uses-permission")) {
            permissions.remove(parseUsesPermission(reader, writer, permissions));
        } else if (reader.isEndElement()) {
            if (!foundUsesSdk) {
                int minimumSdk = extractVersion(m_androidMinSdkVersion->currentText());
                int targetSdk = extractVersion(m_androidTargetSdkVersion->currentText());
                if (minimumSdk == 0 && targetSdk == 0) {
                    // and doesn't need to exist
                } else {
                    writer.writeEmptyElement(QLatin1String("uses-sdk"));
                    if (minimumSdk != 0)
                        writer.writeAttribute(QLatin1String("android:minSdkVersion"),
                                              QString::number(minimumSdk));
                    if (targetSdk != 0)
                        writer.writeAttribute(QLatin1String("android:targetSdkVersion"),
                                              QString::number(targetSdk));
                }
            }
967 968 969 970 971 972 973

            if (!foundPermissionComment && m_defaultPermissonsCheckBox->checkState() == Qt::Checked)
                writer.writeComment(QLatin1String(" %%INSERT_PERMISSIONS "));

            if (!foundFeatureComment && m_defaultPermissonsCheckBox->checkState() == Qt::Checked)
                writer.writeComment(QLatin1String(" %%INSERT_FEATURES "));

974 975 976 977 978 979
            if (!permissions.isEmpty()) {
                foreach (const QString &permission, permissions) {
                    writer.writeEmptyElement(QLatin1String("uses-permission"));
                    writer.writeAttribute(QLatin1String("android:name"), permission);
                }
            }
980

981 982
            writer.writeCurrentToken(reader);
            return;
983 984 985 986 987 988
        } else if (reader.isComment()) {
            QString commentText = parseComment(reader, writer);
            if (commentText == QLatin1String("%%INSERT_PERMISSIONS"))
                foundPermissionComment = true;
            else if (commentText == QLatin1String("%%INSERT_FEATURES"))
                foundFeatureComment = true;
989 990 991 992 993 994
        } else if (reader.isStartElement()) {
            parseUnknownElement(reader, writer);
        } else {
            writer.writeCurrentToken(reader);
        }
        reader.readNext();
995
    }
996
}
997

998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009
void AndroidManifestEditorWidget::parseApplication(QXmlStreamReader &reader, QXmlStreamWriter &writer)
{
    Q_ASSERT(reader.isStartElement());
    writer.writeStartElement(reader.name().toString());

    QXmlStreamAttributes attributes = reader.attributes();
    QStringList keys;
    QStringList values;
    if (!m_appNameInStringsXml) {
        keys << QLatin1String("android:label");
        values << m_appNameLineEdit->text();
    }
1010 1011 1012 1013
    bool ensureIconAttribute =  !m_lIconPath.isEmpty()
            || !m_mIconPath.isEmpty()
            || !m_hIconPath.isEmpty();
    if (ensureIconAttribute) {
1014 1015
        keys << QLatin1String("android:icon");
        values << QLatin1String("@drawable/icon");
1016 1017
    }

1018 1019
    QXmlStreamAttributes result = modifyXmlStreamAttributes(attributes, keys, values);
    writer.writeAttributes(result);
1020

1021
    reader.readNext();
1022

1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
    while (!reader.atEnd()) {
        if (reader.isEndElement()) {
            writer.writeCurrentToken(reader);
            return;
        } else if (reader.isStartElement()) {
            if (reader.name() == QLatin1String("activity"))
                parseActivity(reader, writer);
            else
                parseUnknownElement(reader, writer);
        } else {
            writer.writeCurrentToken(reader);
        }
1035

1036 1037
        reader.readNext();
    }
1038 1039
}

1040
void AndroidManifestEditorWidget::parseActivity(QXmlStreamReader &reader, QXmlStreamWriter &writer)
1041
{
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060