1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #include "tizenmanifesteditor.h"
- #include "tizenconstants.h"
- #include "tizenmanifesteditorwidget.h"
- #include <texteditor/texteditorconstants.h>
- #include <QToolBar>
- #include <QActionGroup>
- namespace Tizen {
- TizenManifestEditor::TizenManifestEditor(TizenManifestEditorWidget * editorWidget) :
- TextEditor::BaseTextEditor(editorWidget)
- {
- m_document = new TizenManifestDocument(editorWidget);
- QToolBar * toolBar = new QToolBar();
- m_actionGroup = new QActionGroup(this);
- connect(m_actionGroup, SIGNAL(triggered(QAction*)), SLOT(changeEditorPage(QAction*)));
- QAction * generalAction = toolBar->addAction(tr("General"));
- generalAction->setCheckable(true);
- generalAction->setData(int(TizenManifestEditorWidget::GeneralPage));
- m_actionGroup->addAction(generalAction);
- QAction * sourceAction = toolBar->addAction(tr("XML Source"));
- sourceAction->setCheckable(true);
- sourceAction->setData(int(TizenManifestEditorWidget::SourcePage));
- m_actionGroup->addAction(sourceAction);
- generalAction->setChecked(true);
- insertExtraToolBarWidget(BaseTextEditor::Left, toolBar);
- setContext(Core::Context(Constants::TIZEN_MANIFEST_EDITOR_CONTEXT, TextEditor::Constants::C_TEXTEDITOR));
- }
- Core::Id TizenManifestEditor::id() const
- {
- return Core::Id(Constants::TIZEN_MANIFEST_EDITOR_ID);
- }
- void TizenManifestEditor::changeEditorPage(QAction * action)
- {
- TizenManifestEditorWidget * editorWidget = qobject_cast<TizenManifestEditorWidget *>(widget());
- if(!editorWidget->setActivePage(static_cast<TizenManifestEditorWidget::EditorPage>(action->data().toInt()))) {
- foreach(QAction * action, m_actionGroup->actions()) {
- if(action->data().toInt() == editorWidget->activePage()) {
- action->setChecked(true);
- break;
- }
- }
- }
- }
- bool TizenManifestEditor::isTemporary() const
- {
- return false;
- }
- }
|