KJotsMain::KJotsMain(const char* name) : KTopLevelWidget( name ) { //create widgets f_main = new QFrame( this, "Frame_0" ); f_main->move(0, 28); f_main->setMinimumSize( 500, 180 ); f_main->setFrameStyle( 0 ); f_text = new QFrame( f_main, "Frame_1" ); f_text->setGeometry( 8, 72, 452, 45 ); f_text->setFrameStyle( 50 ); f_labels = new QFrame( f_main, "Frame_2" ); f_labels->setMinimumSize( 436, 24 ); f_labels->setFrameStyle( 0 ); menubar = new KMenuBar( this, "MenuBar_1" ); // KMenubar is not a FRAME!!! (sven) //menubar->setFrameStyle( 34 ); //menubar->setLineWidth( 2 ); s_bar = new QScrollBar( f_main, "ScrollBar_1" ); s_bar->setMinimumSize( 452, 16 ); s_bar->setOrientation( QScrollBar::Horizontal ); me_text = new MyMultiEdit( f_text, "me_text" ); me_text->setMinimumSize( 436, 30 ); me_text->insertLine( "" ); l_folder = new QLabel( f_labels, "Label_4" ); l_folder->setMinimumSize( 68, 20 ); l_folder->setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); l_folder->setText( "" ); le_subject = new QLineEdit( f_labels, "le_subject" ); le_subject->setMinimumSize( 56, 20 ); le_subject->setText( "" ); le_subject->setFocusPolicy(QWidget::ClickFocus); bg_top = new MyButtonGroup( f_main, "ButtonGroup_2" ); bg_top->setMinimumSize( 452, 32 ); bg_top->setFrameStyle( 49 ); bg_top->setTitle( "" ); bg_top->setAlignment( 1 ); bg_top->lower(); this->setMinimumSize(500, 211); KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup("kjots"); entrylist.setAutoDelete(TRUE); button_list.setAutoDelete(TRUE); folderOpen = FALSE; entrylist.append(new TextEntry); confdiag = NULL; subj_list = new SubjList; connect( this, SIGNAL(folderChanged(QList<TextEntry> *)), subj_list, SLOT(rebuildList( QList<TextEntry> *)) ); connect( this, SIGNAL(entryMoved(int)), subj_list, SLOT( select(int)) ); connect( subj_list, SIGNAL(entryMoved(int)), this, SLOT( barMoved(int)) ); connect( le_subject, SIGNAL(textChanged(const char *)), subj_list, SLOT(entryChanged(const char*)) ); me_text->setEnabled(FALSE); le_subject->setEnabled(FALSE); current = 0; connect( s_bar, SIGNAL(valueChanged(int)), this, SLOT(barMoved(int)) ); top2bottom = new QGridLayout( f_main, 4, 1, 4 ); top2bottom->addWidget( f_text, 0, 0, AlignCenter ); top2bottom->setRowStretch( 0, 1 ); top2bottom->addWidget( s_bar, 1, 0, AlignCenter ); top2bottom->addWidget( bg_top, 2, 0, AlignCenter ); top2bottom->addWidget( f_labels, 3, 0, AlignCenter ); top2bottom->activate(); labels_layout = new QGridLayout( f_labels, 1, 2, 0 ); labels_layout->addWidget( l_folder, 0, 0, AlignVCenter | AlignLeft ); labels_layout->addWidget( le_subject, 0, 1, AlignVCenter | AlignLeft ); labels_layout->setColStretch( 1, 1 ); labels_layout->activate(); QFont font_label(l_folder->fontInfo().family()); font_label.setBold(TRUE); l_folder->setFont(font_label); f_text_layout = new QGridLayout( f_text, 2, 1, 4 ); f_text_layout->addWidget( me_text, 0, 0, AlignCenter ); f_text_layout->setRowStretch( 0, 1 ); f_text_layout->activate(); s_bar->setRange(0,0); s_bar->setValue(0); s_bar->setSteps(1,1); bg_top->setExclusive(TRUE); me_text->setFocusPolicy(QWidget::StrongFocus); // read hotlist config->readListEntry( "Hotlist", hotlist ); while( hotlist.count() > HOT_LIST_SIZE ) hotlist.removeLast(); // read list of folders config->readListEntry( "Folders", folder_list ); QString temp; folders = new QPopupMenu; int i = 0; QPushButton *temp_button; for( temp = folder_list.first(); !temp.isEmpty(); temp = folder_list.next(), i++ ) { folders->insertItem(temp, i); if( hotlist.contains(temp) ) { temp_button = new QPushButton(temp, bg_top); temp_button->setFocusPolicy(QWidget::ClickFocus); temp_button->setToggleButton(TRUE); temp_button->setFixedSize(BUTTON_WIDTH,24); bg_top->insert(temp_button, i); button_list.append(temp_button); } } unique_id = i+1; connect( folders, SIGNAL(activated(int)), this, SLOT(openFolder(int)) ); connect( bg_top, SIGNAL(clicked(int)), this, SLOT(openFolder(int)) ); updateConfiguration(); // creat keyboard shortcuts // CTRL+Key_J := previous page // CTRL+Key_K := next page // CTRL+Key_L := show subject list // CTRL+Key_A := add new page // CTRL+Key_M := move focus keys = new KAccel( this ); keys->insertStdItem( KAccel::New, klocale->translate("New Book") ); keys->connectItem( KAccel::New, this, SLOT(createFolder()) ); keys->connectItem( KAccel::Save , this, SLOT(saveFolder()) ); keys->connectItem( KAccel::Quit, qApp, SLOT(quit()) ); keys->connectItem( KAccel::Cut , me_text, SLOT(cut()) ); keys->connectItem( KAccel::Copy , me_text, SLOT(copyText()) ); keys->connectItem( KAccel::Paste , me_text, SLOT(paste()) ); keys->insertItem(i18n("PreviousPage"), "PreviousPage", CTRL+Key_J); keys->insertItem(i18n("NextPage"), "NextPage", CTRL+Key_K); keys->insertItem(i18n("ShowSubjectList"), "ShowSubjectList", CTRL+Key_L); keys->insertItem(i18n("AddNewPage"), "AddNewPage", CTRL+Key_A); keys->insertItem(i18n("MoveFocus"), "MoveFocus", CTRL+Key_M); keys->insertItem(i18n("CopySelection"), "CopySelection", CTRL+Key_Y); keys->connectItem( "PreviousPage", this, SLOT(prevEntry()) ); keys->connectItem( "NextPage", this, SLOT(nextEntry()) ); keys->connectItem( "ShowSubjectList", this, SLOT(toggleSubjList()) ); keys->connectItem( "AddNewPage", this, SLOT(newEntry()) ); keys->connectItem( "MoveFocus", this, SLOT(moveFocus()) ); keys->connectItem( "CopySelection", this, SLOT(copySelection()) ); keys->readSettings(); // create menu int id; QPopupMenu *file = new QPopupMenu; id = file->insertItem(klocale->translate("&New Book"), this, SLOT(createFolder())); keys->changeMenuAccel(file, id, KAccel::New); file->insertSeparator(); id = file->insertItem(klocale->translate("Save current book"), this, SLOT(saveFolder()) ); keys->changeMenuAccel(file, id, KAccel::Save); id = file->insertItem(klocale->translate("Save book to ascii file"), this, SLOT(writeBook()) ); id = file->insertItem(klocale->translate("Save page to ascii file"), this, SLOT(writePage()) ); file->insertSeparator(); id = file->insertItem(klocale->translate("Delete current book"), this, SLOT(deleteFolder()) ); file->insertSeparator(); id = file->insertItem(klocale->translate("&Quit"), qApp, SLOT( quit() )); keys->changeMenuAccel(file, id, KAccel::Quit); QPopupMenu *edit_menu = new QPopupMenu; id = edit_menu->insertItem(klocale->translate("C&ut"),me_text, SLOT(cut())); keys->changeMenuAccel(edit_menu, id, KAccel::Cut); id = edit_menu->insertItem(klocale->translate("&Copy") , me_text, SLOT(copyText()) ); keys->changeMenuAccel(edit_menu, id, KAccel::Copy); id = edit_menu->insertItem(klocale->translate("&Paste"), me_text, SLOT(paste())); keys->changeMenuAccel(edit_menu, id, KAccel::Paste); edit_menu->insertSeparator(); id = edit_menu->insertItem(klocale->translate("&New Page"), this, SLOT(newEntry()) ); keys->changeMenuAccel(edit_menu, id, "AddNewPage"); id = edit_menu->insertItem(klocale->translate("&Delete Page"), this, SLOT(deleteEntry()) ); QPopupMenu *options = new QPopupMenu; options->insertItem(klocale->translate("&Config"), this, SLOT(configure()) ); options->insertItem(klocale->translate("Configure &Keys"), this, SLOT(configureKeys()) ); QPopupMenu *hotlist = new QPopupMenu; hotlist->insertItem(klocale->translate("Add current book to hotlist"), this, SLOT(addToHotlist()) ); hotlist->insertItem(klocale->translate("Remove current book from hotlist"), this, SLOT(removeFromHotlist()) ); menubar->insertItem( klocale->translate("&File"), file ); menubar->insertItem( klocale->translate("&Edit"), edit_menu ); menubar->insertItem( klocale->translate("Hot&list"), hotlist ); menubar->insertItem( klocale->translate("&Options"), options ); menubar->insertItem( klocale->translate("&Books"), folders ); menubar->insertSeparator(); QString about = "KJots 0.3.1\n\r(C) "; about += (QString) klocale->translate("by") + " Christoph Neerfeld\n\[email protected]"; menubar->insertItem( klocale->translate("&Help"), KApplication::getKApplication()->getHelpMenu(TRUE, about ) ); config->setGroup("kjots"); // create toolbar toolbar = new KToolBar(this); QPixmap temp_pix; temp_pix = global_pix_loader->loadIcon("filenew.xpm"); toolbar->insertButton(temp_pix, 0, SIGNAL(clicked()), this, SLOT(newEntry()), TRUE, i18n("New")); temp_pix = global_pix_loader->loadIcon("filedel.xpm"); toolbar->insertButton(temp_pix, 1, SIGNAL(clicked()), this, SLOT(deleteEntry()), TRUE, i18n("Delete")); temp_pix = global_pix_loader->loadIcon("back.xpm"); toolbar->insertButton(temp_pix, 2, SIGNAL(clicked()), this, SLOT(prevEntry()), TRUE, i18n("Previous")); temp_pix = global_pix_loader->loadIcon("forward.xpm"); toolbar->insertButton(temp_pix, 3, SIGNAL(clicked()), this, SLOT(nextEntry()), TRUE, i18n("Next")); toolbar->insertSeparator(); temp_pix = global_pix_loader->loadIcon("openbook.xpm"); toolbar->insertButton(temp_pix, 4, SIGNAL(clicked()), this, SLOT(toggleSubjList()), TRUE, i18n("Subject List")); toolbar->insertSeparator(); temp_pix = global_pix_loader->loadIcon("exit.xpm"); toolbar->setBarPos( (KToolBar::BarPosition) config->readNumEntry("ToolBarPos") ); addToolBar(toolbar); setView(f_main, FALSE); setMenu(menubar); enableToolBar(KToolBar::Show); QString last_folder = config->readEntry("LastOpenFolder"); int nr; if( (nr = folder_list.find(last_folder)) >= 0 ) openFolder(nr); int width, height; width = config->readNumEntry("Width"); height = config->readNumEntry("Height"); if( width < minimumSize().width() ) width = minimumSize().width(); if( height < minimumSize().height() ) height = minimumSize().height(); resize(width, height); }
OutputWidget::OutputWidget(QWidget* parent, const ToolViewData* tvdata) : QWidget( parent ) , tabwidget(0) , stackwidget(0) , data(tvdata) , m_closeButton(0) , m_closeOthersAction(0) , nextAction(0) , previousAction(0) , activateOnSelect(0) , focusOnSelect(0) , filterInput(0) , filterAction(0) { setWindowTitle(i18n("Output View")); setWindowIcon(tvdata->icon); QVBoxLayout* layout = new QVBoxLayout(this); layout->setMargin(0); if( data->type & KDevelop::IOutputView::MultipleView ) { tabwidget = new QTabWidget(this); layout->addWidget( tabwidget ); m_closeButton = new QToolButton( this ); connect( m_closeButton, &QToolButton::clicked, this, &OutputWidget::closeActiveView ); m_closeButton->setIcon( QIcon::fromTheme( QStringLiteral( "tab-close") ) ); m_closeButton->setToolTip( i18n( "Close the currently active output view") ); m_closeOthersAction = new QAction( this ); connect(m_closeOthersAction, &QAction::triggered, this, &OutputWidget::closeOtherViews); m_closeOthersAction->setIcon(QIcon::fromTheme(QStringLiteral("tab-close-other"))); m_closeOthersAction->setToolTip( i18n( "Close all other output views" ) ); m_closeOthersAction->setText( m_closeOthersAction->toolTip() ); addAction(m_closeOthersAction); tabwidget->setCornerWidget(m_closeButton, Qt::TopRightCorner); } else if ( data->type == KDevelop::IOutputView::HistoryView ) { stackwidget = new QStackedWidget( this ); layout->addWidget( stackwidget ); previousAction = new QAction( QIcon::fromTheme( QStringLiteral( "arrow-left" ) ), i18n("Previous Output"), this ); connect(previousAction, &QAction::triggered, this, &OutputWidget::previousOutput); addAction(previousAction); nextAction = new QAction( QIcon::fromTheme( QStringLiteral( "arrow-right" ) ), i18n("Next Output"), this ); connect(nextAction, &QAction::triggered, this, &OutputWidget::nextOutput); addAction(nextAction); } addAction(dynamic_cast<QAction*>(data->plugin->actionCollection()->action(QStringLiteral("prev_error")))); addAction(dynamic_cast<QAction*>(data->plugin->actionCollection()->action(QStringLiteral("next_error")))); activateOnSelect = new KToggleAction( QIcon(), i18n("Select activated Item"), this ); activateOnSelect->setChecked( true ); focusOnSelect = new KToggleAction( QIcon(), i18n("Focus when selecting Item"), this ); focusOnSelect->setChecked( false ); if( data->option & KDevelop::IOutputView::ShowItemsButton ) { addAction(activateOnSelect); addAction(focusOnSelect); } QAction *separator = new QAction(this); separator->setSeparator(true); addAction(separator); QAction* action; action = new QAction(QIcon::fromTheme(QStringLiteral("go-first")), i18n("First Item"), this); connect(action, &QAction::triggered, this, &OutputWidget::selectFirstItem); addAction(action); action = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), i18n("Previous Item"), this); connect(action, &QAction::triggered, this, &OutputWidget::selectPreviousItem); addAction(action); action = new QAction(QIcon::fromTheme(QStringLiteral("go-next")), i18n("Next Item"), this); connect(action, &QAction::triggered, this, &OutputWidget::selectNextItem); addAction(action); action = new QAction(QIcon::fromTheme(QStringLiteral("go-last")), i18n("Last Item"), this); connect(action, &QAction::triggered, this, &OutputWidget::selectLastItem); addAction(action); QAction* selectAllAction = KStandardAction::selectAll(this, SLOT(selectAll()), this); selectAllAction->setShortcut(QKeySequence()); //FIXME: why does CTRL-A conflict with Katepart (while CTRL-Cbelow doesn't) ? selectAllAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); addAction(selectAllAction); QAction* copyAction = KStandardAction::copy(this, SLOT(copySelection()), this); copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); addAction(copyAction); if( data->option & KDevelop::IOutputView::AddFilterAction ) { QAction *separator = new QAction(this); separator->setSeparator(true); addAction(separator); filterInput = new QLineEdit(); filterInput->setMaximumWidth(150); filterInput->setMinimumWidth(100); filterInput->setPlaceholderText(i18n("Search...")); filterInput->setClearButtonEnabled(true); filterInput->setToolTip(i18n("Enter a wild card string to filter the output view")); filterAction = new QWidgetAction(this); filterAction->setDefaultWidget(filterInput); addAction(filterAction); connect(filterInput, &QLineEdit::textEdited, this, &OutputWidget::outputFilter ); if( data->type & KDevelop::IOutputView::MultipleView ) { connect(tabwidget, &QTabWidget::currentChanged, this, &OutputWidget::updateFilter); } else if ( data->type == KDevelop::IOutputView::HistoryView ) { connect(stackwidget, &QStackedWidget::currentChanged, this, &OutputWidget::updateFilter); } } addActions(data->actionList); connect( data, &ToolViewData::outputAdded, this, &OutputWidget::addOutput ); connect( this, &OutputWidget::outputRemoved, data->plugin, &StandardOutputView::outputRemoved ); foreach( int id, data->outputdata.keys() ) { changeModel( id ); changeDelegate( id ); } enableActions(); }
bool TxtBox::keyboardEvent (int key, int /* scancode */, int action, int modifiers) { if (mEditable && focused()) { if (action == PRESS || action == REPEAT) { if (key == KEY_LEFT) { if (modifiers == SHIFT_DOWN) { if (mSelectionPos == -1) mSelectionPos = mCursorPos; } else mSelectionPos = -1; if (mCursorPos > 0) mCursorPos--; } else if (key == KEY_RIGHT) { if (modifiers == SHIFT_DOWN) { if (mSelectionPos == -1) mSelectionPos = mCursorPos; } else mSelectionPos = -1; if (mCursorPos < (int) mValueTemp.length()) mCursorPos++; } else if (key == KEY_HOME) { if (modifiers == SHIFT_DOWN) { if (mSelectionPos == -1) mSelectionPos = mCursorPos; } else mSelectionPos = -1; mCursorPos = 0; } else if (key == KEY_END) { if (modifiers == SHIFT_DOWN) { if (mSelectionPos == -1) mSelectionPos = mCursorPos; } else mSelectionPos = -1; mCursorPos = (int) mValueTemp.size(); } else if (key == KEY_BACKSPACE) { if (!deleteSelection()) { if (mCursorPos > 0) { mValueTemp.erase (mValueTemp.begin() + mCursorPos - 1); mCursorPos--; } } } else if (key == KEY_DELETE) { if (!deleteSelection()) { if (mCursorPos < (int) mValueTemp.length()) mValueTemp.erase (mValueTemp.begin() + mCursorPos); } } else if (key == KEY_RETURN) { if (!mCommitted) focusEvent (false); } else if (key == KEY_a && modifiers == SYSTEM_COMMAND_MOD) { mCursorPos = (int) mValueTemp.length(); mSelectionPos = 0; } else if (key == KEY_x && modifiers == SYSTEM_COMMAND_MOD) { copySelection(); deleteSelection(); } else if (key == KEY_c && modifiers == SYSTEM_COMMAND_MOD) copySelection(); else if (key == KEY_v && modifiers == SYSTEM_COMMAND_MOD) { deleteSelection(); pasteFromClipboard(); } mValidFormat = (mValueTemp == "") || checkFormat (mValueTemp, mFormat); } return true; } return false; }
void Matrix::cutSelection() { copySelection(); clearSelection(); }
//---------------------------------------------------------------------- // 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())); }
void TermMainWindow::setup_ActionsMenu_Actions() { QSettings settings; settings.beginGroup("Shortcuts"); QKeySequence seq; Properties::Instance()->actions[CLEAR_TERMINAL] = new QAction(QIcon::fromTheme("edit-clear"), tr("Clear Current Tab"), this); seq = QKeySequence::fromString(settings.value(CLEAR_TERMINAL, CLEAR_TERMINAL_SHORTCUT).toString()); Properties::Instance()->actions[CLEAR_TERMINAL]->setShortcut(seq); connect(Properties::Instance()->actions[CLEAR_TERMINAL], SIGNAL(triggered()), consoleTabulator, SLOT(clearActiveTerminal())); menu_Actions->addAction(Properties::Instance()->actions[CLEAR_TERMINAL]); menu_Actions->addSeparator(); // Copy and Paste are only added to the table for the sake of bindings at the moment; there is no Edit menu, only a context menu. Properties::Instance()->actions[COPY_SELECTION] = new QAction(QIcon::fromTheme("edit-copy"), tr("Copy Selection"), this); seq = QKeySequence::fromString( settings.value(COPY_SELECTION, COPY_SELECTION_SHORTCUT).toString() ); Properties::Instance()->actions[COPY_SELECTION]->setShortcut(seq); connect(Properties::Instance()->actions[COPY_SELECTION], SIGNAL(triggered()), consoleTabulator, SLOT(copySelection())); menu_Edit->addAction(Properties::Instance()->actions[COPY_SELECTION]); Properties::Instance()->actions[PASTE_CLIPBOARD] = new QAction(QIcon::fromTheme("edit-paste"), tr("Paste Clipboard"), this); seq = QKeySequence::fromString( settings.value(PASTE_CLIPBOARD, PASTE_CLIPBOARD_SHORTCUT).toString() ); Properties::Instance()->actions[PASTE_CLIPBOARD]->setShortcut(seq); connect(Properties::Instance()->actions[PASTE_CLIPBOARD], SIGNAL(triggered()), consoleTabulator, SLOT(pasteClipboard())); menu_Edit->addAction(Properties::Instance()->actions[PASTE_CLIPBOARD]); Properties::Instance()->actions[PASTE_SELECTION] = new QAction(QIcon::fromTheme("edit-paste"), tr("Paste Selection"), this); seq = QKeySequence::fromString( settings.value(PASTE_SELECTION, PASTE_SELECTION_SHORTCUT).toString() ); Properties::Instance()->actions[PASTE_SELECTION]->setShortcut(seq); connect(Properties::Instance()->actions[PASTE_SELECTION], SIGNAL(triggered()), consoleTabulator, SLOT(pasteSelection())); menu_Edit->addAction(Properties::Instance()->actions[PASTE_SELECTION]); menu_Actions->addSeparator(); Properties::Instance()->actions[ZOOM_IN] = new QAction(QIcon::fromTheme("zoom-in"), tr("Zoom in"), this); seq = QKeySequence::fromString( settings.value(ZOOM_IN, ZOOM_IN_SHORTCUT).toString() ); Properties::Instance()->actions[ZOOM_IN]->setShortcut(seq); connect(Properties::Instance()->actions[ZOOM_IN], SIGNAL(triggered()), consoleTabulator, SLOT(zoomIn())); menu_Edit->addAction(Properties::Instance()->actions[ZOOM_IN]); Properties::Instance()->actions[ZOOM_OUT] = new QAction(QIcon::fromTheme("zoom-out"), tr("Zoom out"), this); seq = QKeySequence::fromString( settings.value(ZOOM_OUT, ZOOM_OUT_SHORTCUT).toString() ); Properties::Instance()->actions[ZOOM_OUT]->setShortcut(seq); connect(Properties::Instance()->actions[ZOOM_OUT], SIGNAL(triggered()), consoleTabulator, SLOT(zoomOut())); menu_Edit->addAction(Properties::Instance()->actions[ZOOM_OUT]); Properties::Instance()->actions[ZOOM_RESET] = new QAction(QIcon::fromTheme("zoom-original"), tr("Zoom reset"), this); seq = QKeySequence::fromString( settings.value(ZOOM_RESET, ZOOM_RESET_SHORTCUT).toString() ); Properties::Instance()->actions[ZOOM_RESET]->setShortcut(seq); connect(Properties::Instance()->actions[ZOOM_RESET], SIGNAL(triggered()), consoleTabulator, SLOT(zoomReset())); menu_Edit->addAction(Properties::Instance()->actions[ZOOM_RESET]); menu_Actions->addSeparator(); Properties::Instance()->actions[FIND] = new QAction(QIcon::fromTheme("edit-find"), tr("Find..."), this); seq = QKeySequence::fromString( settings.value(FIND, FIND_SHORTCUT).toString() ); Properties::Instance()->actions[FIND]->setShortcut(seq); connect(Properties::Instance()->actions[FIND], SIGNAL(triggered()), this, SLOT(find())); menu_Actions->addAction(Properties::Instance()->actions[FIND]); Properties::Instance()->actions[TOGGLE_MENU] = new QAction(tr("Toggle Menu"), this); seq = QKeySequence::fromString( settings.value(TOGGLE_MENU, TOGGLE_MENU_SHORTCUT).toString() ); Properties::Instance()->actions[TOGGLE_MENU]->setShortcut(seq); connect(Properties::Instance()->actions[TOGGLE_MENU], SIGNAL(triggered()), this, SLOT(toggleMenu())); // tis is correct - add action to main window - not to menu to keep toggle working settings.endGroup(); // apply props propertiesChanged(); }
void KfmView::slotCopy() { copySelection (); }