void KSlovar::registerButtons() { m_newDictionary = new KAction(i18n("&New dictionary"), "filenew", KShortcut(KKey("CTRL+n")), this, SLOT(slotNewDictionary()), actionCollection(), "newDictionary"); m_openDictionary = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection()); m_quit = KStdAction::quit(kapp, SLOT(quit()), actionCollection()); m_back=KStdAction::back(this, SLOT(slotPrevPhrase()), actionCollection()); m_forward=KStdAction::forward(this, SLOT(slotNextPhrase()), actionCollection()); m_home=KStdAction::home(this, SLOT(slotHome()), actionCollection()); m_editDictionary = new KAction(i18n("&Edit dictionary"), "edit", KShortcut(KKey("CTRL+e")), this, SLOT(slotEditDictionary()), actionCollection(), "editDictionary"); m_close=KStdAction::close(this, SLOT(slotClose()), actionCollection()); m_find = KStdAction::find(this, SLOT(slotFind()), actionCollection()); m_findNext = KStdAction::findNext(this, SLOT(slotFindNext()), actionCollection()); m_literalSearch = new KToggleAction(i18n("&Literal search"), "filter", KShortcut(KKey("CTRL+l")), this, SLOT(slotToggleLiteral()), actionCollection(), "literalSearch"); m_backSearch = new KToggleAction(i18n("Ba&ck search"), "previous", KShortcut(KKey("CTRL+b")), this, SLOT(slotToggleBack()), actionCollection(), "backSearch"); m_print=KStdAction::print(this, SLOT(slotPrint()), actionCollection()); m_selectAll=KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection()); m_addPhrase=new KAction(i18n("&Add phrase"), "filenew", KShortcut(KKey("CTRL+a")), this, SLOT(slotAddPhrase()), actionCollection(), "addPhrase"); m_editPhrase=new KAction(i18n("Edi&t phrase"), "edit", KShortcut(KKey("CTRL+t")), this, SLOT(slotEditPhrase()), actionCollection(), "editPhrase"); m_removePhrase=new KAction(i18n("&Remove phrase"), "editdelete", KShortcut(KKey("Delete")), this, SLOT(slotRemovePhrase()), actionCollection(), "removePhrase"); m_listPopup=new QPopupMenu; m_addPhrase->plug(m_listPopup); m_editPhrase->plug(m_listPopup); m_removePhrase->plug(m_listPopup); m_config = KStdAction::preferences(this, SLOT(slotConfigure()), actionCollection()); m_conversion = new KAction(i18n("Edit &conversion table"), "conversion", this, SLOT(slotConversionTable()), actionCollection(), "editConversion"); m_update = new KAction(i18n("Update &languages"), "ktalkd", KShortcut(KKey("")), this, SLOT(slotDownloadLanguage()), actionCollection(), "updateLanguages"); m_wizard = new KAction(i18n("Run &First-time wizard"), "wizard", KShortcut(KKey("")), this, SLOT(slotFirstRunWizard()), actionCollection(), "firstRunWizard"); }
SearchPopup::SearchPopup() : QWidget() { ui.setupUi(this); setMaximumHeight(65); collapsed_ = true; ui.closeBtn->setIcon(QIcon(":close")); ui.findPrevBtn->setIcon(QIcon(":find_prev")); ui.findNextBtn->setIcon(QIcon(":find_next")); ui.findPrevBtn->setText(""); ui.findNextBtn->setText(""); ui.replacePrevBtn->setIcon(QIcon(":replace_prev")); ui.replaceNextBtn->setIcon(QIcon(":replace_next")); ui.replaceAllBtn->setIcon(QIcon(":replace_all")); ui.replacePrevBtn->setText(""); ui.replaceNextBtn->setText(""); ui.replaceAllBtn->setText(""); ui.expandBtn->setText(""); ui.expandBtn->setIcon(Juff::Utils::iconManager()->icon(SEARCH_REPLACE)); ui.findCmb->setInsertPolicy(QComboBox::InsertAtTop); ui.replaceCmb->setInsertPolicy(QComboBox::InsertAtTop); connect(ui.closeBtn, SIGNAL(clicked()), SLOT(dismiss())); QLineEdit* findEdit = ui.findCmb->lineEdit(); QLineEdit* replaceEdit = ui.replaceCmb->lineEdit(); connect(findEdit, SIGNAL(textChanged(const QString&)), SLOT(onFindTextChanged(const QString&))); connect(ui.caseSensitiveChk, SIGNAL(toggled(bool)), SLOT(onCaseSensitiveChecked(bool))); connect(findEdit, SIGNAL(returnPressed()), SLOT(slotFindNext())); connect(replaceEdit, SIGNAL(returnPressed()), SLOT(slotReplaceNext())); connect(ui.findNextBtn, SIGNAL(clicked()), SLOT(slotFindNext())); connect(ui.findPrevBtn, SIGNAL(clicked()), SLOT(slotFindPrev())); connect(ui.replaceNextBtn, SIGNAL(clicked()), SLOT(slotReplaceNext())); connect(ui.replacePrevBtn, SIGNAL(clicked()), SLOT(slotReplacePrev())); connect(ui.replaceAllBtn, SIGNAL(clicked()), SLOT(slotReplaceAll())); connect(ui.expandBtn, SIGNAL(toggled(bool)), SLOT(expand(bool))); connect(ui.modeCmb, SIGNAL(currentIndexChanged(int)), SLOT(slotModeChanged(int))); bool caseSensitive = MainSettings::get(MainSettings::SearchCaseSensitive); int searchMode = MainSettings::get(MainSettings::SearchMode); ui.caseSensitiveChk->setChecked(caseSensitive); ui.modeCmb->setCurrentIndex(searchMode); }
Editor::Editor ( QWidget * parent, cs8LoggerWidget *mainimpl, QString name ) // : QWidget ( parent ), m_parent ( parent ), m_mainimpl ( cs8LoggerWidget ) { m_filename = name; int vposLayout = 0; m_textEdit = new TextEdit ( this, mainimpl ); m_backward = false; m_activeEditor = false; // QGridLayout *gridLayout = new QGridLayout ( this ); gridLayout->setSpacing ( 0 ); gridLayout->setMargin ( 0 ); gridLayout->setObjectName ( QString::fromUtf8 ( "gridLayout" ) ); // // // // connect ( m_textEdit, SIGNAL ( editorModified ( bool ) ), this, SLOT ( slotModifiedEditor ( bool ) ) ); connect ( m_textEdit, SIGNAL ( cursorPositionChanged() ), this, SLOT ( slotCursorPositionChanged() ) ); // m_findWidget = new QWidget; uiFind.setupUi ( m_findWidget ); connect ( uiFind.toolClose, SIGNAL ( clicked() ), m_findWidget, SLOT ( hide() ) ); connect ( uiFind.editFind, SIGNAL ( textChanged ( QString ) ), this, SLOT ( slotFindWidget_textChanged ( QString ) ) ); connect ( uiFind.editFind, SIGNAL ( returnPressed() ), this, SLOT ( slotFindNext() ) ); connect ( uiFind.toolPrevious, SIGNAL ( clicked() ), this, SLOT ( slotFindPrevious() ) ); connect ( uiFind.toolNext, SIGNAL ( clicked() ), this, SLOT ( slotFindNext() ) ); // autoHideTimer = new QTimer ( this ); autoHideTimer->setInterval ( 5000 ); autoHideTimer->setSingleShot ( true ); connect ( autoHideTimer, SIGNAL ( timeout() ), m_findWidget, SLOT ( hide() ) ); // gridLayout->addWidget ( m_textEdit, vposLayout++, 0, 1, 1 ); gridLayout->addWidget ( m_findWidget, vposLayout++, 0, 1, 1 ); uiFind.labelWrapped->setVisible ( false ); m_findWidget->hide(); // connect ( &m_timerCheckLastModified, SIGNAL ( timeout() ), this, SLOT ( slotTimerCheckIfModifiedOutside() ) ); setLineNumbers ( true ); setSyntaxHighlight ( true ); setHighlightCurrentLine ( true ); }
void KateSearch::createActions( TDEActionCollection* ac ) { KStdAction::find( this, TQT_SLOT(find()), ac )->setWhatsThis( i18n("Look up the first occurrence of a piece of text or regular expression.")); KStdAction::findNext( this, TQT_SLOT(slotFindNext()), ac )->setWhatsThis( i18n("Look up the next occurrence of the search phrase.")); KStdAction::findPrev( this, TQT_SLOT(slotFindPrev()), ac, "edit_find_prev" )->setWhatsThis( i18n("Look up the previous occurrence of the search phrase.")); KStdAction::replace( this, TQT_SLOT(replace()), ac )->setWhatsThis( i18n("Look up a piece of text or regular expression and replace the result with some given text.")); }
SearchBar::SearchBar(QWidget* parent) : SearchBarBase(parent) { m_searchFoward = false; m_matchCase = false; m_wholeWords = false; m_fromCursor = false; setFocusProxy(m_searchEdit); KIconLoader* iconLoader = kapp->iconLoader(); m_closeButton->setIconSet(iconLoader->loadIconSet("fileclose", KIcon::Toolbar, 16)); m_findNextButton->setIconSet(iconLoader->loadIconSet("up", KIcon::Toolbar, 16)); m_findPreviousButton->setIconSet(iconLoader->loadIconSet("down", KIcon::Toolbar, 16)); m_statusPixLabel->hide(); m_statusTextLabel->hide(); m_timer = new QTimer(this); QAccel* accel = new QAccel(this); accel->connectItem( accel->insertItem(Qt::Key_Escape), this, SLOT(hide())); connect(m_timer, SIGNAL(timeout()), SLOT(slotFind())); connect(m_searchEdit, SIGNAL(textChanged(const QString&)), SLOT(slotTextChanged())); connect(m_searchEdit, SIGNAL(returnPressed()), SLOT(slotFindNext())); connect(m_findNextButton, SIGNAL(clicked()), SLOT(slotFindNext())); connect(m_findPreviousButton, SIGNAL(clicked()), SLOT(slotFindPrevious())); connect(m_closeButton, SIGNAL(clicked()), SLOT(hide())); connect(m_optionsButton, SIGNAL(clicked()), this, SLOT(showOptionsMenu())); m_optionsMenu = new QPopupMenu(m_optionsButton, "options_menu"); m_optionsMenu->setCheckable(true); m_optionsMenu->insertItem(i18n("Find Forward"), this, SLOT(toggleSearchFoward()), 0, SEARCH_FORWARD_MENU); m_optionsMenu->insertItem(i18n("Case Sensitive"), this, SLOT(toggleMatchCase()), 0, MATCH_CASE_MENU); m_optionsMenu->insertItem(i18n("Whole Words Only"), this, SLOT(toggleWholeWords()), 0, WHOLE_WORDS_ONLY_MENU); m_optionsMenu->insertItem(i18n("From Cursor"), this, SLOT(toggleFromCursor()), 0, FROM_CURSOR_MENU); m_optionsButton->setPopup(m_optionsMenu); }
void JuffEd::initActions() { CommandStorageInt* st = Juff::Utils::commandStorage(); st->addAction(FILE_NEW, tr("&New"), this, SLOT(slotFileNew())); st->addAction(FILE_OPEN, tr("&Open"), this, SLOT(slotFileOpen())); st->addAction(FILE_SAVE, tr("&Save"), this, SLOT(slotFileSave())); st->addAction(FILE_SAVE_AS, tr("Save as"), this, SLOT(slotFileSaveAs())); st->addAction(FILE_SAVE_ALL, tr("Save all"), this, SLOT(slotFileSaveAll())); st->addAction(FILE_RELOAD, tr("&Reload"), this, SLOT(slotFileReload())); st->addAction(FILE_RENAME, tr("Rename"), this, SLOT(slotFileRename())); st->addAction(FILE_CLOSE, tr("Close"), this, SLOT(slotFileClose())); st->addAction(FILE_CLOSE_ALL, tr("Close All"), this, SLOT(slotFileCloseAll())); st->addAction(FILE_PRINT, tr("&Print"), this, SLOT(slotFilePrint())); st->addAction(FILE_EXIT, tr("Exit"), this, SLOT(slotFileExit())); st->addAction(SESSION_NEW, tr("New session"), this, SLOT(slotSessionNew())); st->addAction(SESSION_OPEN, tr("Open session"), this, SLOT(slotSessionOpen())); st->addAction(SESSION_SAVE, tr("Save session as..."), this, SLOT(slotSessionSaveAs())); st->addAction(EDIT_UNDO, tr("Undo"), this, SLOT(slotEditUndo())); st->addAction(EDIT_REDO, tr("Redo"), this, SLOT(slotEditRedo())); st->addAction(EDIT_CUT, tr("Cut"), this, SLOT(slotEditCut())); st->addAction(EDIT_COPY, tr("Copy"), this, SLOT(slotEditCopy())); st->addAction(EDIT_PASTE, tr("Paste"), this, SLOT(slotEditPaste())); st->addAction(SEARCH_FIND, tr("Find"), this, SLOT(slotFind())); st->addAction(SEARCH_FIND_NEXT, tr("Find next"), this, SLOT(slotFindNext())); st->addAction(SEARCH_FIND_PREV, tr("Find previous"), this, SLOT(slotFindPrev())); st->addAction(SEARCH_REPLACE, tr("Replace"), this, SLOT(slotReplace())); st->addAction(SEARCH_GOTO_LINE, tr("Go to line"), this, SLOT(slotGotoLine())); st->addAction(SEARCH_GOTO_FILE, tr("Go to file"), this, SLOT(slotGotoFile())); st->addAction(VIEW_ZOOM_IN, tr("Zoom In"), this, SLOT(slotZoomIn())); st->addAction(VIEW_ZOOM_OUT, tr("Zoom Out"), this, SLOT(slotZoomOut())); st->addAction(VIEW_ZOOM_100, tr("Zoom 100%"), this, SLOT(slotZoom100())); st->addAction(VIEW_FULLSCREEN, tr("Fullscreen"), this, SLOT(slotFullscreen())); st->addAction(TOOLS_SETTINGS, tr("Settings"), this, SLOT(slotSettings())); st->addAction(HELP_ABOUT, tr("About"), mw_, SLOT(slotAbout())); st->addAction(HELP_ABOUT_QT, tr("About Qt"), mw_, SLOT(slotAboutQt())); }
QssEditor::QssEditor(QWidget *parent) : QWidget(parent), ui(new Ui::QssEditor), m_changed(false) { ui->setupUi(this); // some default values QHash<QString, QVariant> defaultValues; defaultValues.insert(SETTING_PREVIEW_DELAY, 750); Settings::instance()->addDefaultValues(defaultValues); resetWindowTitle(); // icons ui->toolOpen->setIcon(QIcon::fromTheme("document-open", QIcon(":/images/open.png"))); ui->toolSave->setIcon(QIcon::fromTheme("document-save", QIcon(":/images/save.png"))); ui->toolSaveAs->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/saveas.png"))); ui->toolClose->setIcon(QIcon::fromTheme("window-close", QIcon(":/images/close.png"))); ui->toolUndo->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/images/undo.png"))); ui->toolRedo->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/images/redo.png"))); ui->toolOptions->setIcon(QIcon::fromTheme("preferences-system", QIcon(":/images/options.png"))); // application shortcuts new QShortcut(QKeySequence::Quit, this, SLOT(slotQuit())); new QShortcut(QKeySequence::Find, this, SLOT(slotFind())); new QShortcut(QKeySequence::FindNext, this, SLOT(slotFindNext())); new QShortcut(QKeySequence::HelpContents, this, SLOT(slotAbout())); // shortcuts ui->toolOpen->setShortcut(QKeySequence::Open); ui->toolSave->setShortcut(QKeySequence::Save); ui->toolSaveAs->setShortcut(QKeySequence::SaveAs); ui->toolClose->setShortcut(QKeySequence::Close); // built-in Qt icon ui->toolAboutQt->setIcon(QIcon( #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) ":/qt-project.org/qmessagebox/images/qtlogo-64.png" #else ":/trolltech/qmessagebox/images/qtlogo-64.png" #endif )); // menu for toolbutton QMenu *toolButtonMenu = new QMenu(this); toolButtonMenu->addAction("Item1"); toolButtonMenu->addSeparator(); toolButtonMenu->addAction("Item2"); ui->toolButton->setMenu(toolButtonMenu); m_timerDelayedApply = new QTimer(this); m_timerDelayedApply->setSingleShot(true); connect(m_timerDelayedApply, SIGNAL(timeout()), this, SLOT(slotApplyCss())); resetPreviewDelay(); QTimer *timerProgress = new QTimer(this); timerProgress->setInterval(500); connect(timerProgress, SIGNAL(timeout()), this, SLOT(slotProgress())); timerProgress->start(); ui->splitter->setCollapsible(0, false); ui->splitter->setStretchFactor(0, 1); // splitter size QList<int> list = QList<int>() << width()/2 << width()/2; ui->splitter->setSizes(list); // some MDI windows QMdiSubWindow *mdi = ui->mdiArea->addSubWindow(new QLabel("MDI", ui->mdiArea)); mdi->resize(160, 80); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) ui->tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); #else ui->tree->header()->setResizeMode(QHeaderView::ResizeToContents); ui->table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); #endif ui->tree->topLevelItem(0)->setExpanded(true); ui->text->setCaretLineVisible(true); ui->text->setCaretLineBackgroundColor(QColor("gainsboro")); ui->text->setAutoIndent(true); ui->text->setIndentationGuides(false); ui->text->setIndentationsUseTabs(true); ui->text->setIndentationWidth(4); ui->text->setMarginsBackgroundColor(QColor("gainsboro")); ui->text->setMarginLineNumbers(1, true); ui->text->setMarginWidth(1, 50); ui->text->setAutoCompletionSource(QsciScintilla::AcsAll); ui->text->setAutoCompletionReplaceWord(true); ui->text->setAutoCompletionCaseSensitivity(false); ui->text->setAutoCompletionUseSingle(QsciScintilla::AcusAlways); ui->text->setAutoCompletionThreshold(0); ui->text->setBraceMatching(QsciScintilla::SloppyBraceMatch); ui->text->setMatchedBraceBackgroundColor(Qt::yellow); ui->text->setUnmatchedBraceForegroundColor(Qt::blue); // QSS lexer QsciLexerQSS *lexQss = new QsciLexerQSS(this); ui->text->setLexer(lexQss); ui->text->setFocus(); ui->text->installEventFilter(this); restoreLastFiles(); QTimer::singleShot(0, this, SLOT(slotDelayedOpen())); }
HelpWidget::HelpWidget(QWidget * par, bool bIsStandalone) : QWidget(par) { setObjectName("help_widget"); setMinimumWidth(80); if(bIsStandalone)g_pHelpWidgetList->append(this); m_bIsStandalone = bIsStandalone; new QShortcut(QKeySequence::Copy,this,SLOT(slotCopy()),0,Qt::WidgetWithChildrenShortcut); new QShortcut(QKeySequence::Find,this,SLOT(slotShowHideFind()),0, bIsStandalone ? Qt::WidgetWithChildrenShortcut : Qt::WindowShortcut); // layout m_pLayout = new QVBoxLayout(this); m_pLayout->setMargin(0); m_pLayout->setSpacing(0); setLayout(m_pLayout); // upper toolbar m_pToolBar = new QToolBar(this); m_pLayout->addWidget(m_pToolBar); // webview m_pTextBrowser = new QWebView(this); m_pTextBrowser->setObjectName("text_browser"); m_pTextBrowser->setStyleSheet("QTextBrowser { background-color:white; color:black; }"); m_pLayout->addWidget(m_pTextBrowser); connect(m_pTextBrowser,SIGNAL(loadFinished(bool)),this,SLOT(slotLoadFinished(bool))); // lower toolbar m_pToolBarHighlight = new QToolBar(this); m_pLayout->addWidget(m_pToolBarHighlight); m_pToolBarHighlight->hide(); QLabel *pHighlightLabel = new QLabel(); pHighlightLabel->setText(__tr2qs("Highlight: ")); m_pToolBarHighlight->addWidget(pHighlightLabel); m_pFindText = new QLineEdit(); m_pToolBarHighlight->addWidget(m_pFindText); connect(m_pFindText,SIGNAL(textChanged(const QString )),this,SLOT(slotTextChanged(const QString))); m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Unrecognized), __tr2qs("Reset"), this, SLOT(slotResetFind())); m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Part), __tr2qs("Find previous"), this, SLOT(slotFindPrev())); m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Join), __tr2qs("Find next"), this, SLOT(slotFindNext())); // upper toolbar contents (depends on webview) QLabel *pBrowsingLabel = new QLabel(); pBrowsingLabel->setText(__tr2qs("Browsing: ")); m_pToolBar->addWidget(pBrowsingLabel); m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPINDEX), __tr2qs("Show index"), this, SLOT(showIndex())); m_pToolBar->addAction(m_pTextBrowser->pageAction(QWebPage::Back)); m_pToolBar->addAction(m_pTextBrowser->pageAction(QWebPage::Forward)); m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Plus)), __tr2qs("Zoom in"), this, SLOT(slotZoomIn())); m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Minus)), __tr2qs("Zoom out"), this, SLOT(slotZoomOut())); if(bIsStandalone) { setAttribute(Qt::WA_DeleteOnClose); m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPCLOSE), __tr2qs("Close"), this, SLOT(close())); } }
void KHelpMain::createMenu() { KStdAccel stdAccel; fileMenu = new QPopupMenu; CHECK_PTR( fileMenu ); fileMenu->insertItem( klocale->translate("&New Help Window"), this, SLOT( slotCloneWindow() ), stdAccel.openNew() ); fileMenu->insertSeparator(); fileMenu->insertItem( klocale->translate("&Open File..."), helpwin, SLOT(slotOpenFile()), stdAccel.open() ); // fileMenu->insertItem( klocale->translate("Open UR&L..."), helpwin, // SLOT(slotOpenURL()) ); fileMenu->insertItem( klocale->translate("&Reload"), helpwin, SLOT(slotReload()) ); fileMenu->insertSeparator(); fileMenu->insertItem( klocale->translate("&Search"), helpwin, SLOT(slotSearch()) ); fileMenu->insertSeparator(); fileMenu->insertItem( klocale->translate("&Print..."), helpwin, SLOT(slotPrint()), stdAccel.print() ); fileMenu->insertSeparator(); idClose = fileMenu->insertItem(klocale->translate("&Close"),this, SLOT(slotClose()), stdAccel.close()); // CC :!!!!! fileMenu->insertItem( klocale->translate("&Quit"), this, SLOT(slotQuit()), stdAccel.quit() ); editMenu = new QPopupMenu; CHECK_PTR( editMenu ); idCopy = editMenu->insertItem(klocale->translate("&Copy"), helpwin, SLOT(slotCopy()), stdAccel.copy() ); editMenu->insertItem(klocale->translate("&Find..."), helpwin, SLOT(slotFind()), stdAccel.find() ); editMenu->insertItem(klocale->translate("Find &next"), helpwin, SLOT(slotFindNext()), Key_F3 ); gotoMenu = new QPopupMenu; CHECK_PTR( gotoMenu ); idBack = gotoMenu->insertItem( klocale->translate("&Back"), helpwin, SLOT(slotBack()) ); idForward = gotoMenu->insertItem( klocale->translate("&Forward"), helpwin, SLOT(slotForward()) ); gotoMenu->insertSeparator(); idDir = gotoMenu->insertItem( klocale->translate("&Contents"), helpwin, SLOT(slotDir()) ); idTop = gotoMenu->insertItem( klocale->translate("&Top"), helpwin, SLOT(slotTop()) ); idUp = gotoMenu->insertItem( klocale->translate("&Up"), helpwin, SLOT(slotUp()) ); idPrev = gotoMenu->insertItem( klocale->translate("&Previous"), helpwin, SLOT(slotPrev()) ); idNext = gotoMenu->insertItem( klocale->translate("&Next"), helpwin, SLOT(slotNext()) ); bookmarkMenu = new QPopupMenu; CHECK_PTR( bookmarkMenu ); connect( bookmarkMenu, SIGNAL( activated( int ) ), helpwin, SLOT( slotBookmarkSelected( int ) ) ); connect( bookmarkMenu, SIGNAL( highlighted( int ) ), helpwin, SLOT( slotBookmarkHighlighted( int ) ) ); optionsMenu = new QPopupMenu; CHECK_PTR( optionsMenu ); optionsMenu->setCheckable( true ); optionsMenu->insertItem( klocale->translate("&General Preferences..."), this, SLOT(slotOptionsGeneral()) ); optionsMenu->insertSeparator(); optionsMenu->insertItem(klocale->translate( "Show &Toolbar"), this, SLOT(slotOptionsToolbar())); optionsMenu->insertItem( klocale->translate("Show &Location"), this, SLOT(slotOptionsLocation()) ); optionsMenu->insertItem( klocale->translate("Show Status&bar"), this, SLOT(slotOptionsStatusbar()) ); optionsMenu->insertSeparator(); optionsMenu->insertItem( klocale->translate("&Save Options"), this, SLOT(slotOptionsSave()) ); QString at = klocale->translate("KDE Help System\n"); at+= klocale->translate("Version "); at+= KDEHELP_VERSION; at+=klocale->translate("\n\nCopyright (c) 1997 Martin Jones <*****@*****.**>"\ "\n\nThis program is licensed under the GNU General Public License (GPL)."\ "\nKDEHelp comes with ABSOLUTELY NO WARRANY to the extent permitted by applicable law."); QPopupMenu *helpMenu = kapp->getHelpMenu( true, at ); /* QPopupMenu *helpMenu = new QPopupMenu; CHECK_PTR( helpMenu ); helpMenu->insertItem( klocale->translate("&Using KDE Help"), this, SLOT(slotUsingHelp()) ); helpMenu->insertSeparator(); helpMenu->insertItem( klocale->translate("&About"), this, SLOT(slotAbout()) ); */ menu = new KMenuBar( this ); CHECK_PTR( menu ); menu->insertItem( klocale->translate("&File"), fileMenu ); menu->insertItem( klocale->translate("&Edit"), editMenu ); menu->insertItem( klocale->translate("&Goto"), gotoMenu ); menu->insertItem( klocale->translate("&Bookmarks"), bookmarkMenu ); menu->insertItem( klocale->translate("&Options"), optionsMenu ); menu->insertSeparator(); menu->insertItem( klocale->translate("&Help"), helpMenu ); }
void Editor::findContinue() { //slotFindWidget_textChanged(uiFind.editFind->text(), true); slotFindNext(); }
void PdfViewer::createActions() { // File m_fileOpenAction = new QAction(Icon("document-open"), tr("&Open...", "Action: open file"), this); #ifndef QT_NO_SHORTCUT m_fileOpenAction->setShortcut(QKeySequence::Open); #endif // QT_NO_SHORTCUT m_fileOpenAction->setObjectName("file_open"); connect(m_fileOpenAction, SIGNAL(triggered()), this, SLOT(slotOpenFile())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_fileOpenAction); #endif // QT_NO_SHORTCUT m_ReloadDocAction = new QAction(Icon("reload3"), tr("Re&load...", "Action: reload file"), this); #ifndef QT_NO_SHORTCUT m_ReloadDocAction->setShortcut(tr("Ctrl+L")); #endif // QT_NO_SHORTCUT m_ReloadDocAction->setObjectName("file_reload"); connect(m_ReloadDocAction, SIGNAL(triggered()), this, SLOT(slotReload())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_ReloadDocAction); #endif // QT_NO_SHORTCUT m_fileSaveCopyAction = new QAction(Icon("document-save-as"), tr("&Save a Copy...", "Action: save a copy of the open file"), this); #ifndef QT_NO_SHORTCUT m_fileSaveCopyAction->setShortcut(tr("Ctrl+Shift+S")); #endif // QT_NO_SHORTCUT m_fileSaveCopyAction->setEnabled(false); m_fileSaveCopyAction->setObjectName("file_save_copy"); connect(m_fileSaveCopyAction, SIGNAL(triggered()), this, SLOT(slotSaveCopy())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_fileSaveCopyAction); #endif // QT_NO_SHORTCUT m_printAction = m_pdfView->action(PdfView::Print); m_printAction->setIcon(Icon("document-print")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_printAction); #endif // QT_NO_SHORTCUT m_quitAction = new QAction(Icon("application-exit"), tr("&Quit", "Action: quit the application"), this); #ifndef QT_NO_SHORTCUT m_quitAction->setShortcut(QKeySequence::Quit); #endif // QT_NO_SHORTCUT m_quitAction->setObjectName("application_exit"); // connect(m_quitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_quitAction); #endif // QT_NO_SHORTCUT // Edit m_findAction = new QAction(Icon("edit-find"), tr("&Find...", "Action"), this); #ifndef QT_NO_SHORTCUT m_findAction->setShortcut(QKeySequence::Find); #endif // QT_NO_SHORTCUT m_findAction->setEnabled(false); m_findAction->setObjectName("edit_find"); connect(m_findAction, SIGNAL(triggered()), this, SLOT(slotFind())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_findAction); #endif // QT_NO_SHORTCUT m_findNextAction = new QAction(tr("Find &Next", "Action"), this); #ifndef QT_NO_SHORTCUT m_findNextAction->setShortcut(QKeySequence::FindNext); #endif // QT_NO_SHORTCUT m_findNextAction->setEnabled(false); m_findNextAction->setObjectName("edit_find_next"); connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(slotFindNext())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_findNextAction); #endif // QT_NO_SHORTCUT m_findPreviousAction = new QAction(tr("Find &Previous", "Action"), this); #ifndef QT_NO_SHORTCUT m_findPreviousAction->setShortcut(QKeySequence::FindPrevious); #endif // QT_NO_SHORTCUT m_findPreviousAction->setEnabled(false); m_findPreviousAction->setObjectName("edit_find_previous"); connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(slotFindPrevious())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_findPreviousAction); #endif // QT_NO_SHORTCUT // View m_zoomInAction = m_pdfView->action(PdfView::ZoomIn); m_zoomInAction->setIcon(Icon("zoom-in")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_zoomInAction); #endif // QT_NO_SHORTCUT m_zoomOutAction = m_pdfView->action(PdfView::ZoomOut); m_zoomOutAction->setIcon(Icon("zoom-out")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_zoomOutAction); #endif // QT_NO_SHORTCUT m_zoomAction = m_pdfView->action(PdfView::Zoom); m_showPresentationAction = new QAction(Icon("view-presentation"), tr("P&resentation", "Action"), this); #ifndef QT_NO_SHORTCUT m_showPresentationAction->setShortcut(tr("Ctrl+Shift+P")); #endif // QT_NO_SHORTCUT m_showPresentationAction->setEnabled(false); m_showPresentationAction->setObjectName("view_presentation"); connect(m_showPresentationAction, SIGNAL(triggered()), this, SLOT(slotShowPresentation())); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_showPresentationAction); #endif // QT_NO_SHORTCUT // Go m_goToStartAction = m_pdfView->action(PdfView::GoToStartOfDocument); m_goToStartAction->setIcon(Icon("go-first")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_goToStartAction); #endif // QT_NO_SHORTCUT m_goToEndAction = m_pdfView->action(PdfView::GoToEndOfDocument); m_goToEndAction->setIcon(Icon("go-last")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_goToEndAction); #endif // QT_NO_SHORTCUT m_goToPreviousPageAction = m_pdfView->action(PdfView::GoToPreviousPage); m_goToPreviousPageAction->setIcon(Icon("go-previous")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_goToPreviousPageAction); #endif // QT_NO_SHORTCUT m_goToNextPageAction = m_pdfView->action(PdfView::GoToNextPage); m_goToNextPageAction->setIcon(Icon("go-next")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_goToNextPageAction); #endif // QT_NO_SHORTCUT m_goToPageAction = m_pdfView->action(PdfView::GoToPage); m_amkhlvDnAction = m_pdfView->action(PdfView::AmkhlvDn); m_amkhlvUpAction = m_pdfView->action(PdfView::AmkhlvUp); m_amkhlvDnFAction = m_pdfView->action(PdfView::AmkhlvDnF); m_amkhlvUpFAction = m_pdfView->action(PdfView::AmkhlvUpF); m_amkhlvRtAction = m_pdfView->action(PdfView::AmkhlvRt); m_amkhlvLtAction = m_pdfView->action(PdfView::AmkhlvLt); m_amkhlvRtFAction = m_pdfView->action(PdfView::AmkhlvRtF); m_amkhlvLtFAction = m_pdfView->action(PdfView::AmkhlvLtF); m_ReturnBackAction = m_pdfView->action(PdfView::ReturnBack); m_ReturnBackAction->setIcon(Icon("stock_undo")); #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_amkhlvDnAction); ShortcutHandler::instance()->addAction(m_amkhlvDnFAction); ShortcutHandler::instance()->addAction(m_amkhlvRtAction); ShortcutHandler::instance()->addAction(m_amkhlvRtFAction); #endif // QT_NO_SHORTCUT #ifndef QT_NO_SHORTCUT ShortcutHandler::instance()->addAction(m_amkhlvUpAction); ShortcutHandler::instance()->addAction(m_amkhlvUpFAction); ShortcutHandler::instance()->addAction(m_amkhlvLtAction); ShortcutHandler::instance()->addAction(m_amkhlvLtFAction); ShortcutHandler::instance()->addAction(m_ReturnBackAction); ShortcutHandler::instance()->addAction(m_ReloadDocAction); #endif // QT_NO_SHORTCUT // Tools m_mouseBrowseAction = m_pdfView->action(PdfView::MouseToolBrowse); m_mouseBrowseAction->setIcon(Icon("input-mouse")); #ifndef QT_NO_SHORTCUT m_mouseBrowseAction->setShortcut(tr("Ctrl+1")); ShortcutHandler::instance()->addAction(m_mouseBrowseAction); #endif // QT_NO_SHORTCUT m_mouseMagnifyAction = m_pdfView->action(PdfView::MouseToolMagnify); m_mouseMagnifyAction->setIcon(Icon("page-zoom")); #ifndef QT_NO_SHORTCUT m_mouseMagnifyAction->setShortcut(tr("Ctrl+2")); ShortcutHandler::instance()->addAction(m_mouseMagnifyAction); #endif // QT_NO_SHORTCUT m_mouseSelectionAction = m_pdfView->action(PdfView::MouseToolSelection); m_mouseSelectionAction->setIcon(Icon("select-rectangular")); #ifndef QT_NO_SHORTCUT m_mouseSelectionAction->setShortcut(tr("Ctrl+3")); ShortcutHandler::instance()->addAction(m_mouseSelectionAction); #endif // QT_NO_SHORTCUT m_mouseTextSelectionAction = m_pdfView->action(PdfView::MouseToolTextSelection); m_mouseTextSelectionAction->setIcon(Icon("draw-text")); #ifndef QT_NO_SHORTCUT m_mouseTextSelectionAction->setShortcut(tr("Ctrl+4")); ShortcutHandler::instance()->addAction(m_mouseTextSelectionAction); #endif // QT_NO_SHORTCUT // Settings m_settingsTextAAAction = new QAction(tr("&Text Antialias", "Action: enable/disable antialias"), this); m_settingsTextAAAction->setCheckable(true); connect(m_settingsTextAAAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleTextAA(bool))); m_settingsGfxAAAction = new QAction(tr("&Graphics Antialias", "Action: enable/disable antialias"), this); m_settingsGfxAAAction->setCheckable(true); connect(m_settingsGfxAAAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleGfxAA(bool))); QMenu *settingsRenderMenu = new QMenu(tr("&Render Backend", "Menu title"), this); m_settingsRenderBackendGrp = new QActionGroup(settingsRenderMenu); m_settingsRenderBackendGrp->setExclusive(true); QAction *action = settingsRenderMenu->addAction(tr("&Splash", "Action: select render backend")); action->setCheckable(true); action->setChecked(true); action->setData(qVariantFromValue(int(Poppler::Document::SplashBackend))); m_settingsRenderBackendGrp->addAction(action); action = settingsRenderMenu->addAction(tr("&Arthur", "Action: select render backend")); action->setCheckable(true); action->setData(qVariantFromValue(int(Poppler::Document::ArthurBackend))); m_settingsRenderBackendGrp->addAction(action); connect(m_settingsRenderBackendGrp, SIGNAL(triggered(QAction*)), this, SLOT(slotRenderBackend(QAction*))); m_renderBackendAction = new QAction(tr("&Render Backend", "Menu title"), this); m_renderBackendAction->setMenu(settingsRenderMenu); m_configureAction = new QAction(Icon("configure"), tr("&Configure %1...", "Action: show configuration dialog").arg(QCoreApplication::applicationName()), this); connect(m_configureAction, SIGNAL(triggered()), this, SLOT(slotConfigure())); }
void MainWindow::initUI() { // Build menu and tool bars setToolBarsMovable( false ); m_menuBar.setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( &m_menuBar ); mb->setMargin( 0 ); // Find toolbar addToolBar( &m_findBar, QMainWindow::Top, true ); m_findBar.setHorizontalStretchable( true ); m_findEdit = new QLineEdit( &m_findBar ); QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); m_findBar.setStretchableWidget( m_findEdit ); connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); // Packages menu QPopupMenu *popup = new QPopupMenu( this ); QAction *a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "packagemanager/update", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); a->addTo( popup ); a->addTo( &m_toolBar ); QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "packagemanager/upgrade", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); actionUpgrade->addTo( popup ); actionUpgrade->addTo( &m_toolBar ); QPixmap iconDownload = Opie::Core::OResource::loadPixmap( "packagemanager/download", Opie::Core::OResource::SmallIcon ); QPixmap iconRemove = Opie::Core::OResource::loadPixmap( "packagemanager/remove", Opie::Core::OResource::SmallIcon ); QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); #ifndef USE_LIBOPKG actionDownload->addTo( popup ); actionDownload->addTo( &m_toolBar ); #endif a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "packagemanager/apply", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); a->addTo( popup ); a->addTo( &m_toolBar ); a = new QAction( tr( "Install local package" ), Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); a->addTo( popup ); //a->addTo( &m_toolBar ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to configure this application." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); a->addTo( popup ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); m_actionShowNotInstalled->setToggleAction( true ); m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); m_actionShowNotInstalled->addTo( popup ); m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); m_actionShowInstalled->setToggleAction( true ); m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); m_actionShowInstalled->addTo( popup ); m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); m_actionShowUpdated->setToggleAction( true ); m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); m_actionShowUpdated->addTo( popup ); popup->insertSeparator(); m_actionFilter = new QAction( tr( "Filter" ), Opie::Core::OResource::loadPixmap( "packagemanager/filter", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_actionFilter->setToggleAction( true ); m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); m_actionFilter->addTo( popup ); a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); a->addTo( popup ); popup->insertSeparator(); a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); a->addTo( popup ); m_actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_actionFindNext->setEnabled( false ); m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); m_actionFindNext->addTo( popup ); m_actionFindNext->addTo( &m_findBar ); mb->insertItem( tr( "View" ), popup ); // Finish find toolbar creation a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); a->addTo( &m_findBar ); m_findBar.hide(); }