def setupActions(self): """Sets up all actions (signal/slot combinations).""" # standard action KStandardAction.quit(g_app.quit, self.actionCollection()) # dictionary actions self.dictionaryPage.registerGlobalActions(self.actionCollection()) # update dictionaries if self.updateDialog: self.updateAction = self.updateDialog.updateAction( self.actionCollection()) # optimise database self.updateDialog.optimiseAction(self.actionCollection()) else: self.updateAction = None # search bar self.characterCombo = KHistoryComboBox() self.characterCombo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) font = QFont() font.setPointSize(13) self.characterCombo.setFont(font) self.characterCombo.setObjectName("characterCombo") self.connect(self.characterCombo, SIGNAL("activated(const QString &)"), self.slotCharacterComboActivated) comboAction = KAction(self) comboAction.setText(i18n("Search bar")) comboAction.setShortcut(Qt.Key_F6) self.connect(comboAction, SIGNAL("triggered()"), self.slotSearchComboActivated) comboAction.setDefaultWidget(self.characterCombo) comboAction.setWhatsThis( i18n("<html>Search bar<br/><br/>Enter character of search string</html>")) self.actionCollection().addAction("searchbar", comboAction) goUrl = self.actionCollection().addAction("go_search") goUrl.setIcon(KIcon("go-jump-locationbar")) goUrl.setText(i18n("Go")) self.connect(goUrl, SIGNAL("triggered()"), lambda: self.slotCharacterComboActivated( self.characterCombo.currentText())) goUrl.setWhatsThis( i18n("<html>Go<br /><br />Searches for the string given in the search bar.</html>")) # clear search bar action clearLocationAction = KAction(KIcon("edit-clear-locationbar-ltr"), i18n("Clear &Location Bar"), self) clearLocationAction.setShortcut(Qt.CTRL + Qt.Key_L) clearLocationAction.setWhatsThis( i18n("Clears the location bar and places the cursor inside")) self.actionCollection().addAction("clearlocationbar", clearLocationAction) self.connect(clearLocationAction, SIGNAL("triggered(bool)"), self.characterCombo.clearEditText) self.connect(clearLocationAction, SIGNAL("triggered(bool)"), self.characterCombo.setFocus) # show/hide character page self.toggleToolboxAction = KToggleAction(KIcon("view-sidetree"), i18n("Show Character Toolbox"), self) self.toggleToolboxAction.setShortcut(Qt.Key_F9) self.toggleToolboxAction.setWhatsThis( i18n("Shows and Hides the character choosing toolbox")) self.actionCollection().addAction("showtoolbox", self.toggleToolboxAction) self.connect(self.toggleToolboxAction, SIGNAL("triggered(bool)"), self.slotToggleToolbox) # auto-lookup clipboard self.autoLookupAction = KToggleAction(i18n("&Auto-Lookup"), self) self.autoLookupAction.setToolTip( i18n("Automatically look up text selected by the mouse cursor.")) self.autoLookupAction.setWhatsThis( i18n("Automatically look up text selected by the mouse cursor.")) self.actionCollection().addAction("autolookup", self.autoLookupAction) self.connect(self.autoLookupAction, SIGNAL("triggered(bool)"), self.setAutoLookup) self.autoLookupAction.setIcon( QIcon(util.getIcon('auto-lookup-selection.png'))) self.connect(QApplication.clipboard(), SIGNAL("selectionChanged()"), self.slotSelectionChanged)