Added support for handling Meta key as Alt key in konsolePart.

This relates to bug 1026.
pull/2/head
Michele Calgaro 10 years ago
parent c7a9fafe52
commit f69bb8df1d

@ -2953,21 +2953,21 @@ TQString Konsole::newSession(KSimpleConfig *co, TQString program, const TQStrLis
s->enableFullScripting(b_fullScripting); s->enableFullScripting(b_fullScripting);
// If you add any new signal-slot connection below, think about doing it in konsolePart too // If you add any new signal-slot connection below, think about doing it in konsolePart too
connect( s,TQT_SIGNAL(done(TESession*)), connect( s,TQT_SIGNAL(done(TESession*)),
this,TQT_SLOT(doneSession(TESession*)) ); this,TQT_SLOT(doneSession(TESession*)));
connect( s, TQT_SIGNAL( updateTitle(TESession*) ), connect( s, TQT_SIGNAL(updateTitle(TESession*)),
this, TQT_SLOT( updateTitle(TESession*) ) ); this, TQT_SLOT(updateTitle(TESession*)));
connect( s, TQT_SIGNAL( notifySessionState(TESession*, int) ), connect( s, TQT_SIGNAL(notifySessionState(TESession*, int)),
this, TQT_SLOT( notifySessionState(TESession*, int)) ); this, TQT_SLOT(notifySessionState(TESession*, int)));
connect( s, TQT_SIGNAL(disableMasterModeConnections()), connect( s, TQT_SIGNAL(disableMasterModeConnections()),
this, TQT_SLOT(disableMasterModeConnections()) ); this, TQT_SLOT(disableMasterModeConnections()));
connect( s, TQT_SIGNAL(enableMasterModeConnections()), connect( s, TQT_SIGNAL(enableMasterModeConnections()),
this, TQT_SLOT(enableMasterModeConnections()) ); this, TQT_SLOT(enableMasterModeConnections()));
connect( s, TQT_SIGNAL(renameSession(TESession*,const TQString&)), connect( s, TQT_SIGNAL(renameSession(TESession*,const TQString&)),
this, TQT_SLOT(slotRenameSession(TESession*, const TQString&)) ); this, TQT_SLOT(slotRenameSession(TESession*, const TQString&)));
connect( s->getEmulation(), TQT_SIGNAL(changeColumns(int)), connect( s->getEmulation(), TQT_SIGNAL(changeColumns(int)),
this, TQT_SLOT(changeColumns(int)) ); this, TQT_SLOT(changeColumns(int)) );
connect( s->getEmulation(), TQT_SIGNAL(changeColLin(int,int)), connect( s->getEmulation(), TQT_SIGNAL(changeColLin(int,int)),
this, TQT_SLOT(changeColLin(int,int)) ); this, TQT_SLOT(changeColLin(int,int)));
connect( s->getEmulation(), TQT_SIGNAL(ImageSizeChanged(int,int)), connect( s->getEmulation(), TQT_SIGNAL(ImageSizeChanged(int,int)),
this, TQT_SLOT(notifySize(int,int))); this, TQT_SLOT(notifySize(int,int)));
connect( s, TQT_SIGNAL(zmodemDetected(TESession*)), connect( s, TQT_SIGNAL(zmodemDetected(TESession*)),
@ -2983,7 +2983,7 @@ TQString Konsole::newSession(KSimpleConfig *co, TQString program, const TQStrLis
connect( s, TQT_SIGNAL(setSessionSchema(TESession*, const TQString &)), connect( s, TQT_SIGNAL(setSessionSchema(TESession*, const TQString &)),
this, TQT_SLOT(slotSetSessionSchema(TESession*, const TQString &))); this, TQT_SLOT(slotSetSessionSchema(TESession*, const TQString &)));
connect( s, TQT_SIGNAL(changeTabTextColor(TESession*, int)), connect( s, TQT_SIGNAL(changeTabTextColor(TESession*, int)),
this,TQT_SLOT(changeTabTextColor(TESession*, int)) ); this,TQT_SLOT(changeTabTextColor(TESession*, int)));
s->widget()->setVTFont(defaultFont);// Hack to set font again after newSession s->widget()->setVTFont(defaultFont);// Hack to set font again after newSession
s->setSchemaNo(schmno); s->setSchemaNo(schmno);

@ -105,6 +105,7 @@ konsolePart::konsolePart(TQWidget *_parentWidget, const char *widgetName, TQObje
,rootxpm(0) ,rootxpm(0)
,blinkingCursor(0) ,blinkingCursor(0)
,showFrame(0) ,showFrame(0)
,metaAsAlt(0)
,m_useKonsoleSettings(0) ,m_useKonsoleSettings(0)
,selectBell(0) ,selectBell(0)
,selectLineSpacing(0) ,selectLineSpacing(0)
@ -431,6 +432,11 @@ void konsolePart::makeGUI()
showFrame->setCheckedState(i18n("Hide Fr&ame")); showFrame->setCheckedState(i18n("Hide Fr&ame"));
showFrame->plug(m_options); showFrame->plug(m_options);
// Meta key as Alt key
metaAsAlt = new TDEToggleAction(i18n("Me&ta key as Alt key"), 0,
this, TQT_SLOT(slotToggleMetaAsAltMode()), settingsActions);
metaAsAlt->plug(m_options);
// Word Connectors // Word Connectors
TDEAction *WordSeps = new TDEAction(i18n("Wor&d Connectors..."), 0, this, TDEAction *WordSeps = new TDEAction(i18n("Wor&d Connectors..."), 0, this,
TQT_SLOT(slotWordSeps()), settingsActions); TQT_SLOT(slotWordSeps()), settingsActions);
@ -505,6 +511,8 @@ void konsolePart::applySettingsToGUI()
selectLineSpacing->setCurrentItem(te->lineSpacing()); selectLineSpacing->setCurrentItem(te->lineSpacing());
if (blinkingCursor) if (blinkingCursor)
blinkingCursor->setChecked(te->blinkingCursor()); blinkingCursor->setChecked(te->blinkingCursor());
if (metaAsAlt)
metaAsAlt->setChecked(b_metaAsAlt);
if (m_schema) if (m_schema)
m_schema->setItemChecked(curr_schema,true); m_schema->setItemChecked(curr_schema,true);
if (selectSetEncoding) if (selectSetEncoding)
@ -532,6 +540,8 @@ void konsolePart::applyProperties()
se->widget()->setVTFont( defaultFont ); se->widget()->setVTFont( defaultFont );
se->setSchemaNo( curr_schema ); se->setSchemaNo( curr_schema );
slotSetEncoding(); slotSetEncoding();
se->setMetaAsAltMode(b_metaAsAlt);
} }
void konsolePart::setSettingsMenuEnabled( bool enable ) void konsolePart::setSettingsMenuEnabled( bool enable )
@ -560,13 +570,13 @@ void konsolePart::readProperties()
config->setDesktopGroup(); config->setDesktopGroup();
b_framevis = config->readBoolEntry("has frame",false); b_framevis = config->readBoolEntry("has frame",false);
b_metaAsAlt = config->readBoolEntry("metaAsAltMode",false);
b_histEnabled = config->readBoolEntry("historyenabled",true); b_histEnabled = config->readBoolEntry("historyenabled",true);
n_bell = TQMIN(config->readUnsignedNumEntry("bellmode",TEWidget::BELLSYSTEM),3); n_bell = TQMIN(config->readUnsignedNumEntry("bellmode",TEWidget::BELLSYSTEM),3);
n_keytab=config->readNumEntry("keytab",0); // act. the keytab for this session n_keytab=config->readNumEntry("keytab",0); // act. the keytab for this session
n_scroll = TQMIN(config->readUnsignedNumEntry("scrollbar",TEWidget::SCRRIGHT),2); n_scroll = TQMIN(config->readUnsignedNumEntry("scrollbar",TEWidget::SCRRIGHT),2);
m_histSize = config->readNumEntry("history",DEFAULT_HISTORY_SIZE); m_histSize = config->readNumEntry("history",DEFAULT_HISTORY_SIZE);
s_word_seps= config->readEntry("wordseps",":@-./_~"); s_word_seps= config->readEntry("wordseps",":@-./_~");
n_encoding = config->readNumEntry("encoding",0); n_encoding = config->readNumEntry("encoding",0);
TQFont tmpFont = TDEGlobalSettings::fixedFont(); TQFont tmpFont = TDEGlobalSettings::fixedFont();
@ -637,6 +647,7 @@ void konsolePart::saveProperties()
config->writeEntry("historyenabled", b_histEnabled); config->writeEntry("historyenabled", b_histEnabled);
config->writeEntry("keytab",n_keytab); config->writeEntry("keytab",n_keytab);
config->writeEntry("has frame",b_framevis); config->writeEntry("has frame",b_framevis);
config->writeEntry("metaAsAltMode",b_metaAsAlt);
config->writeEntry("LineSpacing", te->lineSpacing()); config->writeEntry("LineSpacing", te->lineSpacing());
config->writeEntry("schema",s_tdeconfigSchema); config->writeEntry("schema",s_tdeconfigSchema);
config->writeEntry("scrollbar",n_scroll); config->writeEntry("scrollbar",n_scroll);
@ -914,14 +925,18 @@ void konsolePart::slotBlinkingCursor()
te->setBlinkingCursor(blinkingCursor->isChecked()); te->setBlinkingCursor(blinkingCursor->isChecked());
} }
void konsolePart::slotToggleMetaAsAltMode()
{
b_metaAsAlt ^= true;
if (!se) return;
se->setMetaAsAltMode(b_metaAsAlt);
}
void konsolePart::slotUseKonsoleSettings() void konsolePart::slotUseKonsoleSettings()
{ {
b_useKonsoleSettings = m_useKonsoleSettings->isChecked(); b_useKonsoleSettings = m_useKonsoleSettings->isChecked();
setSettingsMenuEnabled( !b_useKonsoleSettings ); setSettingsMenuEnabled( !b_useKonsoleSettings );
readProperties(); readProperties();
applySettingsToGUI(); applySettingsToGUI();
} }

@ -118,6 +118,7 @@ signals:
void slotSelectBell(); void slotSelectBell();
void slotSelectLineSpacing(); void slotSelectLineSpacing();
void slotBlinkingCursor(); void slotBlinkingCursor();
void slotToggleMetaAsAltMode();
void slotUseKonsoleSettings(); void slotUseKonsoleSettings();
void slotWordSeps(); void slotWordSeps();
void slotSetEncoding(); void slotSetEncoding();
@ -136,9 +137,9 @@ signals:
void setSchema(ColorSchema* s); void setSchema(ColorSchema* s);
void updateKeytabMenu(); void updateKeytabMenu();
bool doOpenStream( const TQString& ); bool doOpenStream( const TQString& );
bool doWriteStream( const TQByteArray& ); bool doWriteStream( const TQByteArray& );
bool doCloseStream(); bool doCloseStream();
TQWidget* parentWidget; TQWidget* parentWidget;
TEWidget* te; TEWidget* te;
@ -151,6 +152,7 @@ signals:
TDEToggleAction* blinkingCursor; TDEToggleAction* blinkingCursor;
TDEToggleAction* showFrame; TDEToggleAction* showFrame;
TDEToggleAction* metaAsAlt;
TDEToggleAction* m_useKonsoleSettings; TDEToggleAction* m_useKonsoleSettings;
TDESelectAction* selectBell; TDESelectAction* selectBell;
@ -174,6 +176,7 @@ signals:
TQString s_word_seps; // characters that are considered part of a word TQString s_word_seps; // characters that are considered part of a word
bool b_framevis:1; bool b_framevis:1;
bool b_metaAsAlt:1;
bool b_histEnabled:1; bool b_histEnabled:1;
bool b_useKonsoleSettings:1; bool b_useKonsoleSettings:1;
bool b_autoDestroy:1; bool b_autoDestroy:1;

@ -464,6 +464,12 @@ void TESession::setFontNo(int fn)
font_no = fn; font_no = fn;
} }
void TESession::setMetaAsAltMode(bool mode)
{
if (em)
em->setMetaKeyMode(mode);
}
void TESession::setTitle(const TQString& _title) void TESession::setTitle(const TQString& _title)
{ {
title = _title; title = _title;

@ -123,6 +123,7 @@ public:
void setSize(TQSize size); void setSize(TQSize size);
void setFont(const TQString &font); void setFont(const TQString &font);
TQString font(); TQString font();
void setMetaAsAltMode(bool mode);
public slots: public slots:

Loading…
Cancel
Save