//--------------------------------------------------------------- void replaceNFU() // Not Frequently Used Replacement { h_node *hist = ( scope == 0 ? globalHist : localHists[currProcIdx] ); int min = -1; h_node *itr = hist, *minNode; while(itr != NULL){ if(itr->ctr < min || min == -1){ min = itr->ctr; minNode = itr; } itr = itr->next; } if(DBG) printf("evicted NFU: -[%d|%d](%d)-\n", minNode->procNum, minNode->vpn, minNode->ctr); deletePage(getValidProcIndex(minNode->procNum, 0), minNode->vpn); if(minNode->prev != NULL) minNode->prev->next = minNode->next; else hist = minNode->next; if(minNode->next != NULL) minNode->next->prev = minNode->prev; free(minNode); if(scope == 0) globalHist = hist; else localHists[currProcIdx] = hist; }
inline void* allocate (const size_t bytes) { const size_t headerBytes = Memory::sizeAdjustedForAlignment (sizeof (Header)); const size_t bytesNeeded = headerBytes + bytes; if (bytesNeeded > m_allocator.m_pages->getPageBytes ()) Throw (Error ().fail (__FILE__, __LINE__, TRANS ("the memory request was too large"))); Header* header; header = reinterpret_cast <Header*> (m_active->allocate (bytesNeeded)); if (!header) { if (m_active->release ()) deletePage (m_active); m_active = m_allocator.newPage (); header = reinterpret_cast <Header*> (m_active->allocate (bytesNeeded)); } header->page = m_active; return reinterpret_cast <char*> (header) + headerBytes; }
//--------------------------------------------------------------- void replaceRandom() // Random Replacement { h_node *hist = ( scope == 0 ? globalHist : localHists[currProcIdx] ); srand(time(NULL)); int randomIdx = rand() % getHistLength(); h_node *itr = hist; while(randomIdx > 0){ randomIdx--; itr = itr->next; } if(DBG) printf("evicted random: -[%d|%d](%d)-\n", itr->procNum, itr->vpn, itr->ctr); deletePage(getValidProcIndex(itr->procNum, 0), itr->vpn); if(itr->prev != NULL) itr->prev->next = itr->next; else hist = itr->next; if(itr->next != NULL) itr->next->prev = itr->prev; free(itr); if(scope == 0) globalHist = hist; else localHists[currProcIdx] = hist; }
void SpectralLibraryMatchResults::deletePage() { ResultsPage* pPage = dynamic_cast<ResultsPage*>(mpTabWidget->currentWidget()); if (pPage != NULL) { deletePage(getRasterElementForCurrentPage()); } }
void FifoFreeStoreWithTLS::deallocate (void* p) { const size_t headerBytes = Memory::sizeAdjustedForAlignment (sizeof (Header)); Header* const header = reinterpret_cast <Header*> (reinterpret_cast <char*> (p) - headerBytes); Page* const page = header->page; if (page->release ()) deletePage (page); }
void SpectralLibraryMatchResults::elementDeleted(Subject& subject, const std::string& signal, const boost::any& value) { RasterElement* pRaster = dynamic_cast<RasterElement*>(&subject); if (pRaster != NULL) { ResultsPage* pPage = getPage(pRaster); if (pPage != NULL) { deletePage(pRaster); } } }
void TffdshowPageDec::presetChanged(const char_t *presetName) { fillPresetsCbx(); int previd = page ? page->uniqueID() : 0, prevVisId = hti2page(TreeView_GetFirstVisible(htv))->uniqueID(); for (ThtiPages::iterator p = filterPages.begin(); p != filterPages.end(); p++) { deletePage(*p); } filterPages.clear(); deciD->createPresetPages(presetName, this); showShowHide(previd); InvalidateRect(htv, NULL, FALSE); sortOrder(); setFullHalf(); }
//--------------------------------------------------------------- void terminate(int procNum) { int i, procListIdx = getValidProcIndex(procNum, 0); //get address space size int size = getAddrSpaceSize(procListIdx); for(i = 1; i < size; i++){ //update free pages if(freePages < totalPages && pageInMem(procListIdx, i)){ deletePage(procListIdx, i); } } if(DBG) printf("Free pages: %d\n", freePages); }
/*-------------------------------------------------------------*\ |* Replacement Policies *| \*-------------------------------------------------------------*/ void replaceLRU() // Least Recently Used Replacement { h_node *hist = ( scope == 0 ? globalHist : localHists[currProcIdx] ); if(DBG) printf("evicted LRU: -[%d|%d](%d)-\n", hist->procNum, hist->vpn, hist->ctr); deletePage(getValidProcIndex(hist->procNum, 0), hist->vpn); h_node *tmp = hist; if(hist->next != NULL){ hist->next->prev = NULL; hist = hist->next; } free(tmp); if(scope == 0) globalHist = hist; else localHists[currProcIdx] = hist; }
void SpectralLibraryMatchResults::updateContextMenu(Subject& subject, const std::string& signal, const boost::any& value) { ContextMenu* pMenu = boost::any_cast<ContextMenu*>(value); if (pMenu == NULL) { return; } // only add actions if there are some results if (mpTabWidget->count() > 0) { bool isSessionItem(false); if (dynamic_cast<SessionExplorer*>(&subject) != NULL) { std::vector<SessionItem*> items = pMenu->getSessionItems(); if (items.size() > 1) // make sure only one item selected { return; } DockWindow* pWindow = getDockWindow(); if (items.front() != pWindow) // make sure it's the results window { return; } isSessionItem = true; } QObject* pParent = pMenu->getActionParent(); // add separator QAction* pSeparatorAction = new QAction(pParent); pSeparatorAction->setSeparator(true); pMenu->addAction(pSeparatorAction, SPECTRAL_LIBRARY_MATCH_RESULTS_SEPARATOR_ACTION); QAction* pClearAction = new QAction("&Clear", pParent); pClearAction->setAutoRepeat(false); pClearAction->setStatusTip("Clears the results from the current page"); VERIFYNR(connect(pClearAction, SIGNAL(triggered()), this, SLOT(clearPage()))); pMenu->addAction(pClearAction, SPECTRAL_LIBRARY_MATCH_RESULTS_CLEAR_RESULTS_ACTION); QAction* pAutoClearAction = new QAction("&AutoClear", pParent); pAutoClearAction->setAutoRepeat(false); pAutoClearAction->setCheckable(true); pAutoClearAction->setStatusTip("Enable/disable clearing existing results before adding new results"); ResultsPage* pPage = dynamic_cast<ResultsPage*>(mpTabWidget->currentWidget()); if (pPage != NULL) { pAutoClearAction->setChecked(pPage->getAutoClear()); VERIFYNR(connect(pAutoClearAction, SIGNAL(toggled(bool)), pPage, SLOT(setAutoClear(bool)))); pMenu->addAction(pAutoClearAction, SPECTRAL_LIBRARY_MATCH_RESULTS_AUTOCLEAR_ACTION); } QAction* pExpandAllAction = new QAction("&Expand All", pParent); pExpandAllAction->setAutoRepeat(false); pExpandAllAction->setStatusTip("Expands all the results nodes on the current page"); VERIFYNR(connect(pExpandAllAction, SIGNAL(triggered()), this, SLOT(expandAllPage()))); pMenu->addAction(pExpandAllAction, SPECTRAL_LIBRARY_MATCH_RESULTS_EXPAND_ALL_ACTION); QAction* pCollapseAllAction = new QAction("&Collapse All", pParent); pCollapseAllAction->setAutoRepeat(false); pCollapseAllAction->setStatusTip("Collapses all the results nodes on the current page"); VERIFYNR(connect(pCollapseAllAction, SIGNAL(triggered()), this, SLOT(collapseAllPage()))); pMenu->addAction(pCollapseAllAction, SPECTRAL_LIBRARY_MATCH_RESULTS_COLLAPSE_ALL_ACTION); QAction* pDeleteTabAction = new QAction("&Delete Page", pParent); pDeleteTabAction->setAutoRepeat(false); pDeleteTabAction->setStatusTip("Deletes the current page"); VERIFYNR(connect(pDeleteTabAction, SIGNAL(triggered()), this, SLOT(deletePage()))); pMenu->addAction(pDeleteTabAction, SPECTRAL_LIBRARY_MATCH_RESULTS_DELETE_PAGE_ACTION); if (isSessionItem == false) { QAction* pLocateAction = new QAction("&Locate Signatures", pParent); pLocateAction->setAutoRepeat(false); pLocateAction->setStatusTip("Locates the selected Signatures in the spatial data view"); VERIFYNR(connect(pLocateAction, SIGNAL(triggered()), this, SLOT(locateSignaturesInScene()))); pMenu->addAction(pLocateAction, SPECTRAL_LIBRARY_MATCH_RESULTS_LOCATE_ACTION); QAction* pCreateAverageAction = new QAction("&Create average Signature", pParent); pCreateAverageAction->setAutoRepeat(false); pCreateAverageAction->setStatusTip("Creates an average Signature from the selected " "Signatures in the spatial data view"); VERIFYNR(connect(pCreateAverageAction, SIGNAL(triggered()), this, SLOT(createAverageSignature()))); pMenu->addAction(pCreateAverageAction, SPECTRAL_LIBRARY_MATCH_RESULTS_CREATE_AVERAGE_ACTION); } } }
//when delete current page, we should jump to another page. //defaultly, jump to the first page. //when there is only one page ,it is not permitted for del. int deleteCurrPage(PFileManager pFM) { return deletePage( pFM,getCurrPageNo(pFM) ); }
//---------------------------------------------------------------------- // KJOTSMAIN //---------------------------------------------------------------------- KJotsComponent::KJotsComponent(QWidget* parent, KActionCollection *collection) : QWidget(parent) { actionCollection = collection; searchDialog = 0; activeAnchor.clear(); QDBusConnection dbus = QDBusConnection::sessionBus(); dbus.registerObject("/KJotsComponent", this, QDBusConnection::ExportScriptableSlots); // // Main widget // splitter = new QSplitter(this); splitter->setOpaqueResize( KGlobalSettings::opaqueResize() ); bookshelf = new Bookshelf(splitter); stackedWidget = new QStackedWidget(splitter); editor = new KJotsEdit(stackedWidget); editor->createActions(actionCollection); editor->setEnabled(false); stackedWidget->addWidget(editor); browser = new KJotsBrowser(stackedWidget); browser->setEnabled(false); stackedWidget->addWidget(browser); QVBoxLayout *bookGrid = new QVBoxLayout(this); bookGrid->setMargin(KDialog::marginHint()); bookGrid->setSpacing(KDialog::spacingHint()); bookGrid->addWidget(splitter, 0, 0); bookGrid->setMargin(0); splitter->setStretchFactor(1, 1); // I've moved as much I could into DelayedInitialization(), but the XML // gui builder won't insert things properly if they don't get in there early. KAction *action; action = actionCollection->addAction( "go_next_book"); action->setText( i18n("Next Book") ); action->setIcon(KIcon("go-down")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); connect(action, SIGNAL(triggered()), bookshelf, SLOT(nextBook())); action = actionCollection->addAction( "go_prev_book"); action->setText( i18n("Previous Book") ); action->setIcon(KIcon("go-up")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D)); connect(action, SIGNAL(triggered()), bookshelf, SLOT(prevBook())); action = actionCollection->addAction( "go_next_page"); action->setText( i18n("Next Page") ); action->setIcon(KIcon("go-next")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageDown)); connect(action, SIGNAL(triggered()), bookshelf, SLOT(nextPage())); action = actionCollection->addAction( "go_prev_page" ); action->setText( i18n("Previous Page") ); action->setIcon(KIcon("go-previous")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageUp)); connect(action, SIGNAL(triggered()), bookshelf, SLOT(prevPage())); action = actionCollection->addAction( "new_page"); action->setText( i18n("&New Page") ); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); action->setIcon(KIcon("document-new")); connect(action, SIGNAL(triggered()), SLOT(newPage())); action = actionCollection->addAction("new_book"); action->setText(i18n("New &Book...")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N)); action->setIcon(KIcon("address-book-new")); connect(action, SIGNAL(triggered()), SLOT(createNewBook())); exportMenu = actionCollection->add<KActionMenu>("save_to"); exportMenu->setText(i18n("Export")); exportMenu->setIcon(KIcon("document-export")); action = actionCollection->addAction("save_to_ascii"); action->setText(i18n("To Text File...")); action->setIcon(KIcon("text-plain")); connect(action, SIGNAL(triggered()), SLOT(saveAscii())); exportMenu->menu()->addAction( action ); action = actionCollection->addAction("save_to_html"); action->setText(i18n("To HTML File...")); action->setIcon(KIcon("text-html")); connect(action, SIGNAL(triggered()), SLOT(saveHtml())); exportMenu->menu()->addAction( action ); action = actionCollection->addAction("save_to_book"); action->setText(i18n("To Book File...")); action->setIcon(KIcon("x-office-address-book")); connect(action, SIGNAL(triggered()), SLOT(saveNative())); exportMenu->menu()->addAction( action ); action = actionCollection->addAction("import"); action->setText(i18n("Import...")); action->setIcon(KIcon("document-import")); connect(action, SIGNAL(triggered()), SLOT(importBook())); action = actionCollection->addAction("del_page"); action->setText(i18n("&Delete Page")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Delete)); action->setIcon(KIcon("edit-delete-page")); connect(action, SIGNAL(triggered()), SLOT(deletePage())); action = actionCollection->addAction("del_folder"); action->setText(i18n("Delete Boo&k")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Delete)); action->setIcon(KIcon("edit-delete")); connect(action, SIGNAL(triggered()), SLOT(deleteBook())); action = actionCollection->addAction("del_mult"); action->setText(i18n("Delete Selected")); action->setIcon(KIcon("edit-delete")); connect(action, SIGNAL(triggered()), SLOT(deleteMultiple())); action = actionCollection->addAction("manual_save"); action->setText(i18n("Manual Save")); action->setIcon(KIcon("document-save")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); connect(action, SIGNAL(triggered()), SLOT(saveAll())); action = actionCollection->addAction("auto_bullet"); action->setText(i18n("Auto Bullets")); action->setIcon(KIcon("format-list-unordered")); action->setCheckable(true); action = actionCollection->addAction("auto_decimal"); action->setText(i18n("Auto Decimal List")); action->setIcon(KIcon("format-list-ordered")); action->setCheckable(true); action = actionCollection->addAction("manage_link"); action->setText(i18n("Link")); action->setIcon(KIcon("insert-link")); action = actionCollection->addAction("insert_checkmark"); action->setText(i18n("Insert Checkmark")); action->setIcon(KIcon("checkmark")); action->setEnabled(false); KStandardAction::print(this, SLOT(onPrint()), actionCollection); action = KStandardAction::cut(editor, SLOT(cut()), actionCollection); connect(editor, SIGNAL(copyAvailable(bool)), action, SLOT(setEnabled(bool))); action->setEnabled(false); action = KStandardAction::copy(this, SLOT(copy()), actionCollection); connect(editor, SIGNAL(copyAvailable(bool)), action, SLOT(setEnabled(bool))); connect(browser, SIGNAL(copyAvailable(bool)), action, SLOT(setEnabled(bool))); action->setEnabled(false); action = actionCollection->addAction("copyIntoTitle"); action->setText(i18n("Copy &into Page Title")); action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_T)); action->setIcon(KIcon("edit-copy")); connect(action, SIGNAL(triggered()), SLOT(copySelection())); connect(editor, SIGNAL(copyAvailable(bool)), action, SLOT(setEnabled(bool))); action->setEnabled(false); KStandardAction::pasteText(editor, SLOT(paste()), actionCollection); KStandardAction::find( this, SLOT( onShowSearch() ), actionCollection ); action = KStandardAction::findNext( this, SLOT( onRepeatSearch() ), actionCollection ); action->setEnabled(false); KStandardAction::replace( this, SLOT( onShowReplace() ), actionCollection ); action = actionCollection->addAction("rename_entry"); action->setText(i18n("Rename...")); action->setIcon(KIcon("edit-rename")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); connect(action, SIGNAL(triggered()), SLOT(onRenameEntry())); action = actionCollection->addAction("insert_date"); action->setText(i18n("Insert Date")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); action->setIcon(KIcon("view-calendar-time-spent")); connect(action, SIGNAL(triggered()), SLOT(insertDate())); action = actionCollection->addAction("change_color"); action->setIcon(KIcon("format-fill-color")); action->setText(i18n("Change Color...")); // connected to protected slot in bookshelf.cpp action = actionCollection->addAction("copy_link_address"); action->setText(i18n("Copy Link Address")); // connected to protected slot in bookshelf.cpp action = actionCollection->addAction("paste_plain_text"); action->setText(i18nc("@action Paste the text in the clipboard without rich text formatting.", "Paste Plain Text")); connect(action, SIGNAL(triggered()), editor, SLOT(pastePlainText())); KStandardAction::preferences(this, SLOT(configure()), actionCollection); bookmarkMenu = actionCollection->add<KActionMenu>("bookmarks"); bookmarkMenu->setText(i18n("&Bookmarks")); KJotsBookmarks* bookmarks = new KJotsBookmarks(bookshelf); /*KBookmarkMenu *bmm =*/ new KBookmarkMenu( KBookmarkManager::managerForFile(KStandardDirs::locateLocal("data","kjots/bookmarks.xml"), "kjots"), bookmarks, bookmarkMenu->menu(), actionCollection); m_autosaveTimer = new QTimer(this); // // Set startup size. // if (!KJotsSettings::splitterSizes().isEmpty()) { splitter->setSizes(KJotsSettings::splitterSizes()); } updateConfiguration(); QTimer::singleShot(0, this, SLOT(DelayedInitialization())); //connect new slots connect(bookshelf, SIGNAL(itemSelectionChanged()), SLOT(updateCaption())); connect(bookshelf, SIGNAL(itemSelectionChanged()), SLOT(updateMenu())); connect(bookshelf, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onItemRenamed(QTreeWidgetItem*, int))); connect(m_autosaveTimer, SIGNAL(timeout()), SLOT(autoSave())); }
KPageWidgetTest::KPageWidgetTest( QWidget *parent ) : QWidget( parent ) { QGridLayout *layout = new QGridLayout( this ); mWidget = new KPageWidget( this ); layout->addWidget( mWidget, 0, 0, 7, 1 ); connect( mWidget, SIGNAL( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ), this, SLOT( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ) ); connect( mWidget, SIGNAL( pageToggled( KPageWidgetItem*, bool ) ), this, SLOT( pageToggled( KPageWidgetItem*, bool ) ) ); int rowCount = 0; QPushButton *button = new QPushButton( "Auto", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( setAutoFace() ) ); rowCount++; button = new QPushButton( "Plain", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( setPlainFace() ) ); rowCount++; button = new QPushButton( "List", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( setListFace() ) ); rowCount++; button = new QPushButton( "Tree", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( setTreeFace() ) ); rowCount++; button = new QPushButton( "Tabbed", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( setTabbedFace() ) ); rowCount++; button = new QPushButton( "Add Page", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( addPage() ) ); rowCount++; button = new QPushButton( "Add Sub Page", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( addSubPage() ) ); rowCount++; button = new QPushButton( "Insert Page", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( insertPage() ) ); rowCount++; button = new QPushButton( "Delete Page", this ); layout->addWidget( button, rowCount, 1 ); connect( button, SIGNAL( clicked() ), this, SLOT( deletePage() ) ); rowCount++; KPageWidgetItem *item = mWidget->addPage( new QPushButton( "folder" ), "folder" ); item->setIcon( KIcon( "folder" ) ); item = mWidget->addSubPage( item, new QPushButton( "subfolder" ), "subfolder" ); item->setIcon( KIcon( "folder" ) ); item = mWidget->addPage( new QLabel( "second folder" ), "second folder" ); item->setIcon( KIcon( "folder" ) ); }
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" ) ); }