void Settings::Shortcuts::load() { Config::Shortcuts* shortcutsConfig = Config::Shortcuts::instance(); QMap<Config::Shortcuts::ShortcutType, ShortcutEdit*>::iterator i; for (i = myMainwinShortcuts.begin(); i != myMainwinShortcuts.end(); ++i) i.value()->setKeySequence(shortcutsConfig->getShortcut(i.key())); myMainwinList->resizeColumnToContents(1); for (i = myChatShortcuts.begin(); i != myChatShortcuts.end(); ++i) i.value()->setKeySequence(shortcutsConfig->getShortcut(i.key())); myChatList->resizeColumnToContents(1); }
void InfoField::keyPressEvent(QKeyEvent* event) { Config::Shortcuts* shortcuts = Config::Shortcuts::instance(); QKeySequence ks = QKeySequence(event->key() | event->modifiers()); if (ks == shortcuts->getShortcut(Config::Shortcuts::InputClear)) clear(); QLineEdit::keyPressEvent(event); }
void UserEventCommon::updateShortcuts() { Config::Shortcuts* shortcuts = Config::Shortcuts::instance(); myPopupNextMessage->setShortcut(shortcuts->getShortcut(Config::Shortcuts::ChatPopupNextMessage)); myMenu->setShortcut(shortcuts->getShortcut(Config::Shortcuts::ChatUserMenu)); myHistory->setShortcut(shortcuts->getShortcut(Config::Shortcuts::ChatHistory)); myInfo->setShortcut(shortcuts->getShortcut(Config::Shortcuts::ChatUserInfo)); myEncoding->setShortcut(shortcuts->getShortcut(Config::Shortcuts::ChatEncodingMenu)); mySecure->setShortcut(shortcuts->getShortcut(Config::Shortcuts::ChatToggleSecure)); // Tooltips include shortcut so update them here as well pushToolTip(myMenu, tr("Open user menu")); pushToolTip(myHistory, tr("Show user history")); pushToolTip(myInfo, tr("Show user information")); pushToolTip(myEncoding, tr("Select the text encoding used for outgoing messages.")); pushToolTip(mySecure, tr("Open / Close secure channel")); }
void MLEdit::keyPressEvent(QKeyEvent* event) { // Get flag from last time and reset it before any possible returns bool lastKeyWasReturn = myLastKeyWasReturn; myLastKeyWasReturn = false; // Ctrl+Return will either trigger dialog or (if disabled) insert a normal line break if (event->modifiers() == Qt::ControlModifier && (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)) { if (Config::General::instance()->useDoubleReturn()) insertPlainText(QString("\n")); else emit ctrlEnterPressed(); return; } if (event->modifiers() == Qt::NoModifier) { switch (event->key()) { case Qt::Key_Return: case Qt::Key_Enter: if (lastKeyWasReturn && Config::General::instance()->useDoubleReturn()) { // Return pressed twice, remove the previous line break and emit signal QTextCursor cr = textCursor(); cr.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor); cr.removeSelectedText(); emit ctrlEnterPressed(); return; } else { // Return pressed once myLastKeyWasReturn = true; } break; case Qt::Key_Insert: if (overwriteMode()) { setOverwriteMode(false); setCursorWidth(1); } else { setOverwriteMode(true); setCursorWidth(2); } break; } } if (event->key() == Qt::Key_PageDown && event->modifiers() == Qt::ShiftModifier) { emit scrollDownPressed(); return; } if (event->key() == Qt::Key_PageUp && event->modifiers() == Qt::ShiftModifier) { emit scrollUpPressed(); return; } Config::Shortcuts* shortcuts = Config::Shortcuts::instance(); QKeySequence ks = QKeySequence(event->key() | event->modifiers()); if (ks == shortcuts->getShortcut(Config::Shortcuts::InputClear)) return clearKeepUndo(); if (ks == shortcuts->getShortcut(Config::Shortcuts::InputDeleteLine)) return deleteLine(); if (ks == shortcuts->getShortcut(Config::Shortcuts::InputDeleteLineBack)) return deleteLineBackwards(); if (ks == shortcuts->getShortcut(Config::Shortcuts::InputDeleteWordBack)) return deleteWordBackwards(); MLEDIT_BASE::keyPressEvent(event); }
void Settings::ContactList::load() { Config::Chat* chatConfig = Config::Chat::instance(); Config::ContactList* contactListConfig = Config::ContactList::instance(); Config::General* generalConfig = Config::General::instance(); Config::Shortcuts* shortcutConfig = Config::Shortcuts::instance(); myManualNewUserCheck->setChecked(chatConfig->manualNewUser()); myShowGroupIfNoMsgCheck->setChecked(generalConfig->showGroupIfNoMsg()); myEnableMainwinMouseMovementCheck->setChecked(generalConfig->mainwinDraggable()); myMainWinStickyCheck->setChecked(generalConfig->mainwinSticky()); myGridLinesCheck->setChecked(contactListConfig->showGridLines()); myMode2ViewCheck->setChecked(contactListConfig->mode2View()); myFontStylesCheck->setChecked(contactListConfig->useFontStyles()); myShowExtIconsCheck->setChecked(contactListConfig->showExtendedIcons()); myShowPhoneIconsCheck->setChecked(contactListConfig->showPhoneIcons()); myShowPhoneIconsCheck->setEnabled(contactListConfig->showExtendedIcons()); myHeaderCheck->setChecked(contactListConfig->showHeader()); myShowDividersCheck->setChecked(contactListConfig->showDividers()); mySortByCombo->setCurrentIndex(contactListConfig->sortByStatus()); myAlwaysShowONUCheck->setChecked(contactListConfig->alwaysShowONU()); myShowUserIconsCheck->setChecked(contactListConfig->showUserIcons()); myScrollBarCheck->setChecked(contactListConfig->allowScrollBar()); mySysBackCheck->setChecked(contactListConfig->useSystemBackground()); myDragMovesUserCheck->setChecked(contactListConfig->dragMovesUser()); #ifdef Q_WS_X11 myHotKeyEdit->setKeySequence(shortcutConfig->getShortcut(Config::Shortcuts::GlobalShowMainwin)); #endif int numColumns = contactListConfig->columnCount(); if(numColumns < 1) myColNumberRadio[0]->setChecked(true); else if(numColumns > MAX_COLUMNCOUNT) myColNumberRadio[MAX_COLUMNCOUNT - 1]->setChecked(true); else myColNumberRadio[numColumns - 1]->setChecked(true); for (int i = 0; i < MAX_COLUMNCOUNT; ++i) { myColTitleEdit[i]->setText(contactListConfig->columnHeading(i)); myColFormatEdit[i]->setText(QString(contactListConfig->columnFormat(i)).replace("\n", "\\n")); myColWidthSpin[i]->setValue(contactListConfig->columnWidth(i)); myColAlignCombo[i]->setCurrentIndex(contactListConfig->columnAlignment(i)); myColTitleEdit[i]->setEnabled(i < numColumns); myColFormatEdit[i]->setEnabled(i < numColumns); myColWidthSpin[i]->setEnabled(i < numColumns); myColAlignCombo[i]->setEnabled(i < numColumns); } myPopupPictureCheck->setChecked(contactListConfig->popupPicture()); myPopupAliasCheck->setChecked(contactListConfig->popupAlias()); myPopupAuthCheck->setChecked(contactListConfig->popupAuth()); myPopupNameCheck->setChecked(contactListConfig->popupName()); myPopupEmailCheck->setChecked(contactListConfig->popupEmail()); myPopupPhoneCheck->setChecked(contactListConfig->popupPhone()); myPopupFaxCheck->setChecked(contactListConfig->popupFax()); myPopupCellularCheck->setChecked(contactListConfig->popupCellular()); myPopupIpCheck->setChecked(contactListConfig->popupIP()); myPopupLastOnlineCheck->setChecked(contactListConfig->popupLastOnline()); myPopupOnlineSinceCheck->setChecked(contactListConfig->popupOnlineSince()); myPopupAwayTimeCheck->setChecked(contactListConfig->popupAwayTime()); myPopupIdleTimeCheck->setChecked(contactListConfig->popupIdleTime()); myPopupLocalTimeCheck->setChecked(contactListConfig->popupLocalTime()); myPopupIdCheck->setChecked(contactListConfig->popupID()); mySSListCheck->setChecked(gLicqDaemon->UseServerContactList()); myTransparentCheck->setChecked(Config::Skin::active()->frame.transparent); myFrameStyleEdit->setText(QString::number(static_cast<int>(Config::Skin::active()->frame.frameStyle))); #ifndef USE_KDE QString currentStyle = generalConfig->guiStyle(); for (int i = 0; i < myGuiStyleCombo->count(); ++i) if (myGuiStyleCombo->itemText(i).compare(currentStyle, Qt::CaseInsensitive) == 0) myGuiStyleCombo->setCurrentIndex(i); #endif myAutoUpdateInfoCheck->setChecked(gLicqDaemon->AutoUpdateInfo()); myAutoUpdateInfoPluginsCheck->setChecked(gLicqDaemon->AutoUpdateInfoPlugins()); myAutoUpdateStatusPluginsCheck->setChecked(gLicqDaemon->AutoUpdateStatusPlugins()); }