KoPADocumentStructureDocker::KoPADocumentStructureDocker(KoDocumentSectionView::DisplayMode mode, KoPageApp::PageType pageType, QWidget* parent) : QDockWidget(parent) , KoCanvasObserverBase() , m_doc(0) , m_model(0) { setWindowTitle(i18n("Document")); QWidget *mainWidget = new QWidget(this); QGridLayout* layout = new QGridLayout(mainWidget); layout->addWidget(m_sectionView = new KoDocumentSectionView(mainWidget), 0, 0, 1, -1); QToolButton *button = new QToolButton(mainWidget); button->setIcon(koIcon("list-add")); if (pageType == KoPageApp::Slide) { button->setToolTip(i18n("Add a new slide or layer")); } else { button->setToolTip(i18n("Add a new page or layer")); } layout->addWidget(button, 1, 0); QMenu *menu = new QMenu(button); button->setMenu(menu); button->setPopupMode(QToolButton::InstantPopup); menu->addAction(koIcon("document-new"), (pageType == KoPageApp::Slide) ? i18n("Slide") : i18n("Page"), this, SLOT(addPage())); m_addLayerAction = menu->addAction(koIcon("layer-new"), i18n("Layer"), this, SLOT(addLayer())); m_buttonGroup = new QButtonGroup(mainWidget); m_buttonGroup->setExclusive(false); button = new QToolButton(mainWidget); button->setIcon(koIcon("list-remove")); button->setToolTip(i18n("Delete selected objects")); m_buttonGroup->addButton(button, Button_Delete); layout->addWidget(button, 1, 1); button = new QToolButton(mainWidget); button->setIcon(koIcon("arrow-up")); button->setToolTip(i18n("Raise selected objects")); m_buttonGroup->addButton(button, Button_Raise); layout->addWidget(button, 1, 3); button = new QToolButton(mainWidget); button->setIcon(koIcon("arrow-down")); button->setToolTip(i18n("Lower selected objects")); m_buttonGroup->addButton(button, Button_Lower); layout->addWidget(button, 1, 4); button = new QToolButton(mainWidget); menu = new QMenu(this); QActionGroup *group = new QActionGroup(this); m_viewModeActions.insert(KoDocumentSectionView::MinimalMode, menu->addAction(koIcon("view-list-text"), i18n("Minimal View"), this, SLOT(minimalView()))); m_viewModeActions.insert(KoDocumentSectionView::DetailedMode, menu->addAction(koIcon("view-list-details"), i18n("Detailed View"), this, SLOT(detailedView()))); m_viewModeActions.insert(KoDocumentSectionView::ThumbnailMode, menu->addAction(koIcon("view-preview"), i18n("Thumbnail View"), this, SLOT(thumbnailView()))); foreach (QAction* action, m_viewModeActions) { action->setCheckable(true); action->setActionGroup(group); }
KarbonLayerDocker::KarbonLayerDocker() : m_doc(0), m_model(0), m_updateTimer(this) { setWindowTitle(i18n("Layer view")); QWidget *mainWidget = new QWidget(this); QGridLayout* layout = new QGridLayout(mainWidget); layout->addWidget(m_layerView = new KoDocumentSectionView(mainWidget), 0, 0, 1, 6); QButtonGroup *buttonGroup = new QButtonGroup(mainWidget); buttonGroup->setExclusive(false); QPushButton *button = new QPushButton(mainWidget); button->setIcon(koIcon("list-add")); button->setToolTip(i18n("Add a new layer")); buttonGroup->addButton(button, Button_New); layout->addWidget(button, 1, 0); button = new QPushButton(mainWidget); button->setIcon(koIcon("list-remove")); button->setToolTip(i18n("Delete selected objects")); buttonGroup->addButton(button, Button_Delete); layout->addWidget(button, 1, 1); button = new QPushButton(mainWidget); button->setIcon(koIcon("go-up")); button->setToolTip(i18n("Raise selected objects")); buttonGroup->addButton(button, Button_Raise); layout->addWidget(button, 1, 2); button = new QPushButton(mainWidget); button->setIcon(koIcon("go-down")); button->setToolTip(i18n("Lower selected objects")); buttonGroup->addButton(button, Button_Lower); layout->addWidget(button, 1, 3); QToolButton * toolButton = new QToolButton(mainWidget); KMenu * menu = new KMenu(this); QActionGroup *group = new QActionGroup(this); m_viewModeActions.insert(KoDocumentSectionView::MinimalMode, menu->addAction(koIcon("view-list-text"), i18n("Minimal View"), this, SLOT(minimalView()))); m_viewModeActions.insert(KoDocumentSectionView::DetailedMode, menu->addAction(koIcon("view-list-details"), i18n("Detailed View"), this, SLOT(detailedView()))); m_viewModeActions.insert(KoDocumentSectionView::ThumbnailMode, menu->addAction(koIcon("view-preview"), i18n("Thumbnail View"), this, SLOT(thumbnailView()))); foreach(QAction* action, m_viewModeActions) { action->setCheckable(true); action->setActionGroup(group); }