Example #1
0
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);
}
Example #2
0
void Settings::Shortcuts::apply()
{
  Config::Shortcuts* shortcutsConfig = Config::Shortcuts::instance();
  shortcutsConfig->blockUpdates(true);

  QMap<Config::Shortcuts::ShortcutType, ShortcutEdit*>::iterator i;
  for (i = myMainwinShortcuts.begin(); i != myMainwinShortcuts.end(); ++i)
    shortcutsConfig->setShortcut(i.key(), i.value()->keySequence());
  for (i = myChatShortcuts.begin(); i != myChatShortcuts.end(); ++i)
    shortcutsConfig->setShortcut(i.key(), i.value()->keySequence());

  shortcutsConfig->blockUpdates(false);
}
Example #3
0
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);
}
Example #4
0
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"));
}
Example #5
0
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);
}
Example #6
0
void Settings::ContactList::apply()
{
  Config::Chat* chatConfig = Config::Chat::instance();
  Config::ContactList* contactListConfig = Config::ContactList::instance();
  Config::General* generalConfig = Config::General::instance();
  Config::Shortcuts* shortcutConfig = Config::Shortcuts::instance();
  chatConfig->blockUpdates(true);
  contactListConfig->blockUpdates(true);
  generalConfig->blockUpdates(true);

  chatConfig->setManualNewUser(myManualNewUserCheck->isChecked());

  generalConfig->setShowGroupIfNoMsg(myShowGroupIfNoMsgCheck->isChecked());
  generalConfig->setMainwinDraggable(myEnableMainwinMouseMovementCheck->isChecked());
  generalConfig->setMainwinSticky(myMainWinStickyCheck->isChecked());

  contactListConfig->setShowGridLines(myGridLinesCheck->isChecked());
  contactListConfig->setMode2View(myMode2ViewCheck->isChecked());
  contactListConfig->setUseFontStyles(myFontStylesCheck->isChecked());
  contactListConfig->setShowExtendedIcons(myShowExtIconsCheck->isChecked());
  contactListConfig->setShowPhoneIcons(myShowPhoneIconsCheck->isChecked());
  contactListConfig->setShowHeader(myHeaderCheck->isChecked());
  contactListConfig->setShowDividers(myShowDividersCheck->isChecked());
  contactListConfig->setSortByStatus(mySortByCombo->currentIndex());
  contactListConfig->setAlwaysShowONU(myAlwaysShowONUCheck->isChecked());
  contactListConfig->setShowUserIcons(myShowUserIconsCheck->isChecked());
  contactListConfig->setAllowScrollBar(myScrollBarCheck->isChecked());
  contactListConfig->setUseSystemBackground(mySysBackCheck->isChecked());
  contactListConfig->setDragMovesUser(myDragMovesUserCheck->isChecked());

#ifdef Q_WS_X11
  shortcutConfig->setShortcut(Config::Shortcuts::GlobalShowMainwin, myHotKeyEdit->keySequence());
#endif

  for (int i = 0; i < MAX_COLUMNCOUNT; ++i)
  {
    contactListConfig->setColumn(i,
        myColTitleEdit[i]->text(),
        myColFormatEdit[i]->text().replace("\\n", "\n"),
        myColWidthSpin[i]->value(),
        static_cast<Config::ContactList::AlignmentMode>(myColAlignCombo[i]->currentIndex()));

    if (myColNumberRadio[i]->isChecked())
      contactListConfig->setColumnCount(i + 1);
  }

  contactListConfig->setPopupPicture(myPopupPictureCheck->isChecked());
  contactListConfig->setPopupAlias(myPopupAliasCheck->isChecked());
  contactListConfig->setPopupAuth(myPopupAuthCheck->isChecked());
  contactListConfig->setPopupName(myPopupNameCheck->isChecked());
  contactListConfig->setPopupEmail(myPopupEmailCheck->isChecked());
  contactListConfig->setPopupPhone(myPopupPhoneCheck->isChecked());
  contactListConfig->setPopupFax(myPopupFaxCheck->isChecked());
  contactListConfig->setPopupCellular(myPopupCellularCheck->isChecked());
  contactListConfig->setPopupIP(myPopupIpCheck->isChecked());
  contactListConfig->setPopupLastOnline(myPopupLastOnlineCheck->isChecked());
  contactListConfig->setPopupOnlineSince(myPopupOnlineSinceCheck->isChecked());
  contactListConfig->setPopupAwayTime(myPopupAwayTimeCheck->isChecked());
  contactListConfig->setPopupIdleTime(myPopupIdleTimeCheck->isChecked());
  contactListConfig->setPopupLocalTime(myPopupLocalTimeCheck->isChecked());
  contactListConfig->setPopupID(myPopupIdCheck->isChecked());

  gLicqDaemon->SetUseServerContactList(mySSListCheck->isChecked());
  Config::Skin::active()->setFrameTransparent(myTransparentCheck->isChecked());
  Config::Skin::active()->setFrameStyle(myFrameStyleEdit->text().toUShort());

#ifndef USE_KDE
  generalConfig->setGuiStyle(myGuiStyleCombo->currentText());
#endif

  gLicqDaemon->SetAutoUpdateInfo(myAutoUpdateInfoCheck->isChecked());
  gLicqDaemon->SetAutoUpdateInfoPlugins(myAutoUpdateInfoPluginsCheck->isChecked());
  gLicqDaemon->SetAutoUpdateStatusPlugins(myAutoUpdateStatusPluginsCheck->isChecked());

  chatConfig->blockUpdates(false);
  contactListConfig->blockUpdates(false);
  generalConfig->blockUpdates(false);
}
Example #7
0
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());
}