void KPrViewModeSlidesSorter::deactivate() { // Give the resources back to the canvas m_canvas->resourceManager()->setResource(KoCanvasResourceManager::ShowTextShapeOutlines, QVariant(false)); // Active the view as a basic but active one m_view->setActionEnabled(KoPAView::AllActions, true); m_view->doUpdateActivePage(m_view->activePage()); KoPAView *view = dynamic_cast<KoPAView *>(m_view); if (view) { view->restoreCentralWidget(); } //save zoom value saveZoomConfig(zoom()); //change zoom saving slot and restore normal view zoom values disconnect(m_view->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), this, SLOT(updateZoom(KoZoomMode::Mode,qreal))); m_view->zoomController()->zoomAction()->setZoomModes(KoZoomMode::ZOOM_PAGE | KoZoomMode::ZOOM_WIDTH); m_view->setActivePage(m_view->kopaDocument()->pageByIndex(m_slidesSorterView->currentIndex().row(), false)); KPrView *kPrview = dynamic_cast<KPrView *>(m_view); if (kPrview) { kPrview->restoreZoomConfig(); connect(kPrview->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), kPrview, SLOT(zoomChanged(KoZoomMode::Mode,qreal))); connect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), kPrview, SLOT(editDeleteSelection())); disconnect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), this, SLOT(deleteSlide())); } disableEditActions(); }
void KPrViewModeSlidesSorter::activate(KoPAViewMode *previousViewMode) { Q_UNUSED(previousViewMode); KoPAView *view = dynamic_cast<KoPAView *>(m_view); if (view) { view->replaceCentralWidget(m_centralWidget); } m_slidesSorterView->setFocus(Qt::ActiveWindowFocusReason); updateToActivePageIndex(); //setup signals connect(m_slidesSorterView,SIGNAL(indexChanged(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); connect(m_slidesSorterView, SIGNAL(pressed(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); connect(m_view->proxyObject, SIGNAL(activePageChanged()), this, SLOT(updateToActivePageIndex())); //change zoom saving slot connect(m_view->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), this, SLOT(updateZoom(KoZoomMode::Mode,qreal))); KPrView *kPrview = dynamic_cast<KPrView *>(m_view); if (kPrview) { disconnect(kPrview->zoomController(), SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), kPrview, SLOT(zoomChanged(KoZoomMode::Mode,qreal))); m_view->zoomController()->zoomAction()->setZoomModes(KoZoomMode::ZOOM_CONSTANT); loadZoomConfig(); disconnect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), kPrview, SLOT(editDeleteSelection())); connect(kPrview->deleteSelectionAction(), SIGNAL(triggered()), this, SLOT(deleteSlide())); } }
void KoPAView::initActions() { KAction *action = actionCollection()->addAction( KStandardAction::Cut, "edit_cut", 0, 0); new KoCutController(kopaCanvas(), action); action = actionCollection()->addAction( KStandardAction::Copy, "edit_copy", 0, 0 ); new KoCopyController(kopaCanvas(), action); d->editPaste = actionCollection()->addAction( KStandardAction::Paste, "edit_paste", proxyObject, SLOT( editPaste() ) ); connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); connect(d->canvas->toolProxy(), SIGNAL(toolChanged(const QString&)), this, SLOT(clipboardDataChanged())); clipboardDataChanged(); actionCollection()->addAction(KStandardAction::SelectAll, "edit_select_all", this, SLOT(editSelectAll())); actionCollection()->addAction(KStandardAction::Deselect, "edit_deselect_all", this, SLOT(editDeselectAll())); d->deleteSelectionAction = new KAction(KIcon("edit-delete"), i18n("D&elete"), this); actionCollection()->addAction("edit_delete", d->deleteSelectionAction ); d->deleteSelectionAction->setShortcut(QKeySequence("Del")); d->deleteSelectionAction->setEnabled(false); connect(d->deleteSelectionAction, SIGNAL(triggered()), this, SLOT(editDeleteSelection())); connect(d->canvas->toolProxy(), SIGNAL(selectionChanged(bool)), d->deleteSelectionAction, SLOT(setEnabled(bool))); KToggleAction *showGrid= d->doc->gridData().gridToggleAction(d->canvas); actionCollection()->addAction("view_grid", showGrid ); d->actionViewSnapToGrid = new KToggleAction(i18n("Snap to Grid"), this); d->actionViewSnapToGrid->setChecked(d->doc->gridData().snapToGrid()); actionCollection()->addAction("view_snaptogrid", d->actionViewSnapToGrid); connect( d->actionViewSnapToGrid, SIGNAL( triggered( bool ) ), this, SLOT (viewSnapToGrid( bool ))); KToggleAction *actionViewShowGuides = KoStandardAction::showGuides(this, SLOT(viewGuides(bool)), this); actionViewShowGuides->setChecked( d->doc->guidesData().showGuideLines() ); actionCollection()->addAction(KoStandardAction::name(KoStandardAction::ShowGuides), actionViewShowGuides ); d->actionViewShowMasterPages = new KToggleAction(i18n( "Show Master Pages" ), this ); actionCollection()->addAction( "view_masterpages", d->actionViewShowMasterPages ); connect( d->actionViewShowMasterPages, SIGNAL( triggered( bool ) ), this, SLOT( setMasterMode( bool ) ) ); d->viewRulers = new KToggleAction(i18n("Show Rulers"), this); actionCollection()->addAction("view_rulers", d->viewRulers ); d->viewRulers->setToolTip(i18n("Show/hide the view's rulers")); connect(d->viewRulers, SIGNAL(triggered(bool)), proxyObject, SLOT(setShowRulers(bool))); setShowRulers(d->doc->rulersVisible()); d->actionInsertPage = new KAction( KIcon("document-new"), i18n( "Insert Page" ), this ); actionCollection()->addAction( "page_insertpage", d->actionInsertPage ); d->actionInsertPage->setToolTip( i18n( "Insert a new page after the current one" ) ); d->actionInsertPage->setWhatsThis( i18n( "Insert a new page after the current one" ) ); connect( d->actionInsertPage, SIGNAL( triggered() ), proxyObject, SLOT( insertPage() ) ); d->actionCopyPage = new KAction( i18n( "Copy Page" ), this ); actionCollection()->addAction( "page_copypage", d->actionCopyPage ); d->actionCopyPage->setToolTip( i18n( "Copy the current page" ) ); d->actionCopyPage->setWhatsThis( i18n( "Copy the current page" ) ); connect( d->actionCopyPage, SIGNAL( triggered() ), this, SLOT( copyPage() ) ); d->actionDeletePage = new KAction( i18n( "Delete Page" ), this ); d->actionDeletePage->setEnabled( d->doc->pageCount() > 1 ); actionCollection()->addAction( "page_deletepage", d->actionDeletePage ); d->actionDeletePage->setToolTip( i18n( "Delete the current page" ) ); d->actionDeletePage->setWhatsThis( i18n( "Delete the current page" ) ); connect( d->actionDeletePage, SIGNAL( triggered() ), this, SLOT( deletePage() ) ); d->actionMasterPage = new KAction(i18n("Master Page..."), this); actionCollection()->addAction("format_masterpage", d->actionMasterPage); connect(d->actionMasterPage, SIGNAL(triggered()), this, SLOT(formatMasterPage())); d->actionPageLayout = new KAction( i18n( "Page Layout..." ), this ); actionCollection()->addAction( "format_pagelayout", d->actionPageLayout ); connect( d->actionPageLayout, SIGNAL( triggered() ), this, SLOT( formatPageLayout() ) ); actionCollection()->addAction(KStandardAction::Prior, "page_previous", this, SLOT(goToPreviousPage())); actionCollection()->addAction(KStandardAction::Next, "page_next", this, SLOT(goToNextPage())); actionCollection()->addAction(KStandardAction::FirstPage, "page_first", this, SLOT(goToFirstPage())); actionCollection()->addAction(KStandardAction::LastPage, "page_last", this, SLOT(goToLastPage())); KActionMenu *actionMenu = new KActionMenu(i18n("Variable"), this); foreach(QAction *action, d->doc->inlineTextObjectManager()->createInsertVariableActions(d->canvas)) actionMenu->addAction(action); actionCollection()->addAction("insert_variable", actionMenu); KAction * am = new KAction(i18n("Import Document..."), this); actionCollection()->addAction("import_document", am); connect(am, SIGNAL(triggered()), this, SLOT(importDocument())); d->actionConfigure = new KAction(KIcon("configure"), i18n("Configure..."), this); actionCollection()->addAction("configure", d->actionConfigure); connect(d->actionConfigure, SIGNAL(triggered()), this, SLOT(configure())); d->find = new KoFind( this, d->canvas->resourceManager(), actionCollection() ); actionCollection()->action( "object_group" )->setShortcut( QKeySequence( "Ctrl+G" ) ); actionCollection()->action( "object_ungroup" )->setShortcut( QKeySequence( "Ctrl+Shift+G" ) ); }