void CCommentaryReadWindow::initActions() { CLexiconReadWindow::initActions(); //make sure the predefined actions are available BtActionCollection* ac = actionCollection(); insertKeyboardActions(ac); //cleanup, not a clean oo-solution QAction *qaction = ac->action("nextEntry"); Q_ASSERT(qaction != 0); qaction->setEnabled(false); qaction = ac->action("previousEntry"); Q_ASSERT(qaction != 0); qaction->setEnabled(false); qaction = ac->action("nextBook"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextBook())); addAction(qaction); qaction = ac->action("previousBook"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousBook())); addAction(qaction); qaction = ac->action("nextChapter"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextChapter())); addAction(qaction); qaction = ac->action("previousChapter"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousChapter())); addAction(qaction); qaction = ac->action("nextVerse"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextVerse())); addAction(qaction); qaction = ac->action("previousVerse"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousVerse())); addAction(qaction); qaction = ac->action(CResMgr::displaywindows::commentaryWindow::syncWindow::actionName); Q_ASSERT(qaction != 0); m_syncButton = qaction; addAction(qaction); actionCollection()->readShortcuts("Commentary shortcuts"); }
void CBibleReadWindow::initActions() { BtActionCollection* ac = actionCollection(); CLexiconReadWindow::initActions(); //make sure the predefined actions are available CBibleReadWindow::insertKeyboardActions(ac); QAction * qaction; //cleanup, not a clean oo-solution qaction = ac->action("nextEntry"); Q_ASSERT(qaction != 0); qaction->setEnabled(false); qaction = ac->action("previousEntry"); Q_ASSERT(qaction != 0); qaction->setEnabled(false); qaction = m_actionCollection->action("nextBook"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextBook()) ); addAction(qaction); qaction = m_actionCollection->action("previousBook"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousBook()) ); addAction(qaction); qaction = m_actionCollection->action("nextChapter"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextChapter()) ); addAction(qaction); qaction = m_actionCollection->action("previousChapter"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousChapter()) ); addAction(qaction); qaction = m_actionCollection->action("nextVerse"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(nextVerse()) ); addAction(qaction); qaction = m_actionCollection->action("previousVerse"); Q_ASSERT(qaction != 0); QObject::connect(qaction, SIGNAL(triggered()), this, SLOT(previousVerse()) ); addAction(qaction); m_actions.selectAll = ac->action("selectAll"); Q_ASSERT(m_actions.selectAll != 0); m_actions.findText = ac->action("findText"); Q_ASSERT(m_actions.findText != 0); m_actions.findStrongs = m_actionCollection->action(CResMgr::displaywindows::general::findStrongs::actionName); Q_ASSERT(m_actions.findStrongs != 0); m_actions.copy.referenceOnly = m_actionCollection->action("copyReferenceOnly"); Q_ASSERT(m_actions.copy.referenceOnly != 0); m_actions.copy.referenceTextOnly = m_actionCollection->action("copyTextOfReference"); Q_ASSERT(m_actions.copy.referenceTextOnly != 0); QObject::connect(m_actions.copy.referenceTextOnly, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorTextOnly())); addAction(m_actions.copy.referenceTextOnly); m_actions.copy.referenceAndText = m_actionCollection->action("copyReferenceWithText"); Q_ASSERT(m_actions.copy.referenceAndText != 0); QObject::connect(m_actions.copy.referenceAndText, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(copyAnchorWithText())); addAction(m_actions.copy.referenceAndText); m_actions.copy.chapter = m_actionCollection->action("copyChapter"); Q_ASSERT(m_actions.copy.chapter != 0); QObject::connect(m_actions.copy.chapter, SIGNAL(triggered()), this, SLOT(copyDisplayedText())); addAction(m_actions.copy.chapter); m_actions.copy.selectedText = ac->action("copySelectedText"); Q_ASSERT(m_actions.copy.selectedText != 0); m_actions.save.referenceAndText = m_actionCollection->action("saveReferenceWithText"); Q_ASSERT(m_actions.save.referenceAndText != 0); QObject::connect(m_actions.save.referenceAndText, SIGNAL(triggered()), displayWidget()->connectionsProxy(), SLOT(saveAnchorWithText())); addAction(m_actions.copy.chapter); m_actions.save.chapterAsPlain = m_actionCollection->action("saveChapterAsPlainText"); Q_ASSERT(m_actions.save.chapterAsPlain != 0); QObject::connect(m_actions.save.chapterAsPlain, SIGNAL(triggered()), this, SLOT(saveChapterPlain())); addAction(m_actions.save.referenceAndText); m_actions.save.chapterAsHTML = m_actionCollection->action("saveChapterAsHTML"); Q_ASSERT(m_actions.save.chapterAsHTML != 0); QObject::connect(m_actions.save.chapterAsHTML, SIGNAL(triggered()), this, SLOT(saveChapterHTML())); addAction(m_actions.save.chapterAsHTML); m_actions.print.reference = m_actionCollection->action("printReferenceWithText"); Q_ASSERT(m_actions.print.reference != 0); QObject::connect(m_actions.print.reference, SIGNAL(triggered()), this, SLOT(printAnchorWithText())); addAction(m_actions.print.reference); m_actions.print.chapter = m_actionCollection->action("printChapter"); Q_ASSERT(m_actions.print.chapter != 0); QObject::connect(m_actions.print.chapter, SIGNAL(triggered()), this, SLOT(printAll())); addAction(m_actions.print.chapter); ac->readShortcuts("Bible shortcuts"); }
//---------------------------------------------------------------------- // 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())); }