diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2014-09-15 18:37:36 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2014-09-15 18:37:36 +0900 |
commit | 3e7f4492e641b36751e356dcefb059be4bc823cb (patch) | |
tree | 5b85cc2260faa1803522bb956df5ba713ca8fcec /konsole | |
parent | 60d2edfb8529ef76f0a17892d48cc2bc02928b42 (diff) | |
parent | efdf0bbcd37d5aaa05649437b286aeecfd38c617 (diff) | |
download | tdebase-3e7f4492e641b36751e356dcefb059be4bc823cb.tar.gz tdebase-3e7f4492e641b36751e356dcefb059be4bc823cb.zip |
Merge changes related to bug1026 from local branch
Diffstat (limited to 'konsole')
-rw-r--r-- | konsole/konsole/TEWidget.cpp | 27 | ||||
-rw-r--r-- | konsole/konsole/TEWidget.h | 2 | ||||
-rw-r--r-- | konsole/konsole/TEmuVt102.cpp | 54 | ||||
-rw-r--r-- | konsole/konsole/TEmuVt102.h | 3 | ||||
-rw-r--r-- | konsole/konsole/TEmulation.cpp | 69 | ||||
-rw-r--r-- | konsole/konsole/TEmulation.h | 13 | ||||
-rw-r--r-- | konsole/konsole/konsole.cpp | 60 | ||||
-rw-r--r-- | konsole/konsole/konsole.h | 1 | ||||
-rw-r--r-- | konsole/konsole/konsole_part.cpp | 23 | ||||
-rw-r--r-- | konsole/konsole/konsole_part.h | 9 | ||||
-rw-r--r-- | konsole/konsole/session.cpp | 6 | ||||
-rw-r--r-- | konsole/konsole/session.h | 1 |
12 files changed, 207 insertions, 61 deletions
diff --git a/konsole/konsole/TEWidget.cpp b/konsole/konsole/TEWidget.cpp index 75545a1e0..f16d97aac 100644 --- a/konsole/konsole/TEWidget.cpp +++ b/konsole/konsole/TEWidget.cpp @@ -1901,7 +1901,7 @@ bool TEWidget::eventFilter( TQObject *obj, TQEvent *e ) return false; // not us if ( e->type() == TQEvent::KeyPress ) { - TQKeyEvent* ke = (TQKeyEvent*)e; + TQKeyEvent *ke = TQT_TQKEYEVENT(e); actSel=0; // Key stroke implies a screen update, so TEWidget won't // know where the current selection is. @@ -1914,17 +1914,24 @@ bool TEWidget::eventFilter( TQObject *obj, TQEvent *e ) cursorBlinking = false; } - emit keyPressedSignal(ke); // expose - - // in Qt2 when key events were propagated up the tree - // (unhandled? -> parent widget) they passed the event filter only once at - // the beginning. in qt3 this has changed, that is, the event filter is - // called each time the event is sent (see loop in TQApplication::notify, - // when internalNotify() is called for KeyPress, whereas internalNotify - // activates also the global event filter) . That's why we stop propagation - // here. + emit keyPressedSignal(ke); return true; } + if ( e->type() == TQEvent::KeyRelease ) + { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); + emit keyReleasedSignal(ke); + return true; + } + if ( e->type() == TQEvent::FocusIn ) + { + TQFocusEvent *fe = TQT_TQFOCUSEVENT(e); + if (fe->gotFocus()) + { + emit focusInSignal(fe); + return true; + } + } if ( e->type() == TQEvent::Enter ) { TQObject::disconnect( (TQObject*)cb, TQT_SIGNAL(dataChanged()), diff --git a/konsole/konsole/TEWidget.h b/konsole/konsole/TEWidget.h index 1e2c36d87..2baa2531c 100644 --- a/konsole/konsole/TEWidget.h +++ b/konsole/konsole/TEWidget.h @@ -153,6 +153,8 @@ public slots: signals: void keyPressedSignal(TQKeyEvent *e); + void keyReleasedSignal(TQKeyEvent *e); + void focusInSignal(TQFocusEvent *e); void mouseSignal(int cb, int cx, int cy); void changedFontMetricSignal(int height, int width); void changedContentSizeSignal(int height, int width); diff --git a/konsole/konsole/TEmuVt102.cpp b/konsole/konsole/TEmuVt102.cpp index c460693cd..e0efab745 100644 --- a/konsole/konsole/TEmuVt102.cpp +++ b/konsole/konsole/TEmuVt102.cpp @@ -927,37 +927,38 @@ void TEmuVt102::onScrollLock() the complications towards a configuration file [see KeyTrans class]. */ -void TEmuVt102::onKeyPress( TQKeyEvent* ev ) +void TEmuVt102::doKeyPress( TQKeyEvent* ev ) { - if (!listenToKeyPress) return; // someone else gets the keys emit notifySessionState(NOTIFYNORMAL); -//printf("State/Key: 0x%04x 0x%04x (%d,%d)\n",ev->state(),ev->key(),ev->text().length(),ev->text().length()?ev->text().ascii()[0]:0); + //printf("State/Key: 0x%04x 0x%04x (%d,%d)\n", ev->state(),ev->key(), + // ev->text().length(),ev->text().length()?ev->text().ascii()[0]:0); // lookup in keyboard translation table ... int cmd = CMD_none; - const char* txt; + const char *txt; int len; bool metaspecified; - if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD, - encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE, - encodeMode(MODE_AppCuKeys , BITS_AppCuKeys ) + // VT100 stuff - encodeMode(MODE_AppScreen , BITS_AppScreen ) + // VT100 stuff - encodeStat(TQt::ControlButton , BITS_Control ) + - encodeStat(TQt::ShiftButton , BITS_Shift ) + - encodeStat(TQt::AltButton , BITS_Alt ), - &cmd, &txt, &len, &metaspecified )) -//printf("cmd: %d, %s, %d\n",cmd,txt,len); + int bits = encodeMode(MODE_NewLine , BITS_NewLine ) + // OLD, + encodeMode(MODE_Ansi , BITS_Ansi ) + // OBSOLETE, + encodeMode(MODE_AppCuKeys , BITS_AppCuKeys ) + // VT100 stuff + encodeMode(MODE_AppScreen , BITS_AppScreen ) + // VT100 stuff + encodeStat(TQt::ControlButton, BITS_Control ) + + encodeStat(TQt::ShiftButton , BITS_Shift ) + + encodeStat(TQt::AltButton , BITS_Alt ); + if (metaKeyMode) + bits += encodeStat(TQt::MetaButton , BITS_Alt); + keytrans->findEntry(ev->key(), bits, &cmd, &txt, &len, &metaspecified); if (connected) { - switch(cmd) // ... and execute if found. - { - case CMD_scrollPageUp : gui->doScroll(-gui->Lines()/2); return; - case CMD_scrollPageDown : gui->doScroll(+gui->Lines()/2); return; - case CMD_scrollLineUp : gui->doScroll(-1 ); return; - case CMD_scrollLineDown : gui->doScroll(+1 ); return; - case CMD_scrollLock : onScrollLock( ); return; - } + switch(cmd) // ... and execute if found. + { + case CMD_scrollPageUp : gui->doScroll(-gui->Lines()/2); return; + case CMD_scrollPageDown : gui->doScroll(+gui->Lines()/2); return; + case CMD_scrollLineUp : gui->doScroll(-1 ); return; + case CMD_scrollLineDown : gui->doScroll(+1 ); return; + case CMD_scrollLock : onScrollLock( ); return; + } } if (holdScreen) { @@ -976,8 +977,11 @@ void TEmuVt102::onKeyPress( TQKeyEvent* ev ) || ev->key()==Qt::Key_PageUp || ev->key()==Qt::Key_PageDown)) scr->setHistCursor(scr->getHistLines()); - if (cmd==CMD_send) { - if ((ev->state() & TQt::AltButton) && !metaspecified ) sendString("\033"); + if (cmd==CMD_send) + { + if ((ev->state() & TQt::AltButton) || + (metaKeyMode && ((ev->state() & TQt::MetaButton) || metaIsPressed) && !metaspecified)) + sendString("\033"); emit sndBlock(txt,len); return; } @@ -985,7 +989,9 @@ void TEmuVt102::onKeyPress( TQKeyEvent* ev ) // fall back handling if (!ev->text().isEmpty()) { - if (ev->state() & TQt::AltButton) sendString("\033"); // ESC, this is the ALT prefix + if ((ev->state() & TQt::AltButton) || + (metaKeyMode && ((ev->state() & TQt::MetaButton) || metaIsPressed))) + sendString("\033"); // ESC, this is the ALT prefix TQCString s = m_codec->fromUnicode(ev->text()); // encode for application // FIXME: In Qt 2, TQKeyEvent::text() would return "\003" for Ctrl-C etc. // while in Qt 3 it returns the actual key ("c" or "C") which caused diff --git a/konsole/konsole/TEmuVt102.h b/konsole/konsole/TEmuVt102.h index 05f30ac04..8832a73d8 100644 --- a/konsole/konsole/TEmuVt102.h +++ b/konsole/konsole/TEmuVt102.h @@ -60,7 +60,8 @@ public: void changeGUI(TEWidget* newgui); ~TEmuVt102(); - virtual void onKeyPress(TQKeyEvent*); + virtual void doKeyPress(TQKeyEvent*); + public slots: // signals incoming from TEWidget void onMouse(int cb, int cx, int cy); diff --git a/konsole/konsole/TEmulation.cpp b/konsole/konsole/TEmulation.cpp index 939139d03..7576e9688 100644 --- a/konsole/konsole/TEmulation.cpp +++ b/konsole/konsole/TEmulation.cpp @@ -98,6 +98,8 @@ TEmulation::TEmulation(TEWidget* w) scr(0), connected(false), listenToKeyPress(false), + metaKeyMode(false), + metaIsPressed(false), m_codec(0), decoder(0), keytrans(0), @@ -123,6 +125,10 @@ void TEmulation::connectGUI() this,TQT_SLOT(onHistoryCursorChange(int))); TQObject::connect(gui,TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), this,TQT_SLOT(onKeyPress(TQKeyEvent*))); + TQObject::connect(gui,TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), + this,TQT_SLOT(onKeyReleased(TQKeyEvent*))); + TQObject::connect(gui,TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + this,TQT_SLOT(onFocusIn(TQFocusEvent*))); TQObject::connect(gui,TQT_SIGNAL(beginSelectionSignal(const int,const int,const bool)), this,TQT_SLOT(onSelectionBegin(const int,const int,const bool)) ); TQObject::connect(gui,TQT_SIGNAL(extendSelectionSignal(const int,const int)), @@ -151,6 +157,10 @@ void TEmulation::changeGUI(TEWidget* newgui) this,TQT_SLOT(onHistoryCursorChange(int))); TQObject::disconnect(gui,TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), this,TQT_SLOT(onKeyPress(TQKeyEvent*))); + TQObject::disconnect(gui,TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), + this,TQT_SLOT(onKeyReleased(TQKeyEvent*))); + TQObject::disconnect(gui,TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + this,TQT_SLOT(onFocusIn(TQFocusEvent*))); TQObject::disconnect(gui,TQT_SIGNAL(beginSelectionSignal(const int,const int,const bool)), this,TQT_SLOT(onSelectionBegin(const int,const int,const bool)) ); TQObject::disconnect(gui,TQT_SIGNAL(extendSelectionSignal(const int,const int)), @@ -275,11 +285,30 @@ void TEmulation::onRcvChar(int c) /*! */ - void TEmulation::onKeyPress( TQKeyEvent* ev ) { if (!listenToKeyPress) return; // someone else gets the keys + + // HACK - workaround for what looks like a bug in Qt. + // Specifically keep track of when the meta button is pressed or released. + // Upon restarting TDE, restored windows do not received the correct KeyEvent state + // when multiple keys are pressed: the MetaButton is missing. + // Instead on new created window, MetaButton information is correct. + // Ex: + // Meta is pressed --> the state is correct, both before and after + // State: Before=0x0000/After=0x0800 Key: 0x1022 + // Then h is presed --> the state does not contain the MetaButton anymore + // State: Before=0x0000/After=0x0000 Key: 0x0048 + if (ev->key() == TQt::Key_Meta) + metaIsPressed = true; + + doKeyPress(ev); +} + +void TEmulation::doKeyPress( TQKeyEvent* ev ) +{ emit notifySessionState(NOTIFYNORMAL); + if (scr->getHistCursor() != scr->getHistLines() && !ev->text().isEmpty()) scr->setHistCursor(scr->getHistLines()); if (!ev->text().isEmpty()) @@ -296,6 +325,44 @@ void TEmulation::onKeyPress( TQKeyEvent* ev ) } } +void TEmulation::onKeyReleased( TQKeyEvent* ev ) +{ + if (!listenToKeyPress) return; // someone else gets the keys + + // HACK - workaround for what looks like a bug in Qt. + // Specifically keep track of when the meta button is pressed or released. + // Upon restarting TDE, restored windows do not received the correct KeyEvent state + // when multiple keys are pressed: the MetaButton is missing. + // Instead on new created window, MetaButton information is correct. + // Ex: + // Meta is pressed --> the state is correct, both before and after + // State: Before=0x0000/After=0x0800 Key: 0x1022 + // Then h is presed --> the state does not contain the MetaButton anymore + // State: Before=0x0000/After=0x0000 Key: 0x0048 + if (ev->key() == TQt::Key_Meta || !(ev->stateAfter() & TQt::MetaButton)) + metaIsPressed = false; + + doKeyReleased(ev); +} + +void TEmulation::doKeyReleased( TQKeyEvent* ke ) +{ +} + +void TEmulation::onFocusIn( TQFocusEvent* fe ) +{ + // HACK - workaround for what looks like a bug in Qt. + // Always reset the status of 'metaIsPressed' when the emulation gets the focus, + // to avoid pending cases. A pending case is a case where the emulation lost the + // focus while Meta was pressed but gets the focus when Meta is no longer pressed. + metaIsPressed = false; + doFocusIn(fe); +} + +void TEmulation::doFocusIn( TQFocusEvent* fe ) +{ +} + // Unblocking, Byte to Unicode translation --------------------------------- -- /* diff --git a/konsole/konsole/TEmulation.h b/konsole/konsole/TEmulation.h index a5f432175..9ddc2a4c7 100644 --- a/konsole/konsole/TEmulation.h +++ b/konsole/konsole/TEmulation.h @@ -55,7 +55,15 @@ public slots: // signals incoming from TEWidget virtual void onImageSizeChange(int lines, int columns); virtual void onHistoryCursorChange(int cursor); - virtual void onKeyPress(TQKeyEvent*); + + // HACK - start + void onKeyPress(TQKeyEvent*); // This should not be overwritten by derived classes + virtual void doKeyPress(TQKeyEvent*); // Instead this function should be overwritten if necessary + void onKeyReleased(TQKeyEvent*); // This should not be overwritten by derived classes + virtual void doKeyReleased(TQKeyEvent*); // Instead this function should be overwritten if necessary + void onFocusIn(TQFocusEvent*); // This should not be overwritten by derived classes + virtual void doFocusIn(TQFocusEvent*); // Instead this function should be overwritten if necessary + // HACK - end virtual void clearSelection(); virtual void copySelection(); @@ -89,6 +97,7 @@ public: virtual void setMode (int) = 0; virtual void resetMode(int) = 0; + void setMetaKeyMode(bool mode) { metaKeyMode = mode; } virtual void sendString(const char*) = 0; @@ -119,6 +128,8 @@ protected: bool connected; // communicate with widget bool listenToKeyPress; // listen to input + bool metaKeyMode; // true -> meta key is handled as Alt + bool metaIsPressed; // true -> the meta key has been pressed down - HACK void setCodec(int c); // codec number, 0 = locale, 1=utf8 diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp index a7d3d7333..569110b08 100644 --- a/konsole/konsole/konsole.cpp +++ b/konsole/konsole/konsole.cpp @@ -273,6 +273,7 @@ Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bo ,b_autoResizeTabs(false) ,b_installBitmapFonts(false) ,b_framevis(true) +,b_metaAsAlt(false) ,b_fullscreen(false) ,m_menuCreated(false) ,b_warnQuit(false) @@ -1622,6 +1623,7 @@ void Konsole::readProperties(TDEConfig* config, const TQString &schema, bool glo b_bidiEnabled = config->readBoolEntry("EnableBidi",false); s_word_seps= config->readEntry("wordseps",":@-./_~"); b_framevis = config->readBoolEntry("has frame",true); + b_metaAsAlt = config->readBoolEntry("metaAsAltMode",false); TQPtrList<TEWidget> tes = activeTEs(); for (TEWidget *_te = tes.first(); _te; _te = tes.next()) { _te->setWordCharacters(s_word_seps); @@ -1636,7 +1638,10 @@ void Konsole::readProperties(TDEConfig* config, const TQString &schema, bool glo monitorSilenceSeconds=config->readUnsignedNumEntry("SilenceSeconds", 10); for (TESession *ses = sessions.first(); ses; ses = sessions.next()) + { + ses->setMetaAsAltMode(b_metaAsAlt); ses->setMonitorSilenceSeconds(monitorSilenceSeconds); + } b_xonXoff = config->readBoolEntry("XonXoff",false); b_matchTabWinTitle = config->readBoolEntry("MatchTabWinTitle",false); @@ -2187,7 +2192,9 @@ void Konsole::reparseConfiguration() curr_schema = sch->numb(); pmPath = sch->imagePath(); - for (TESession *_se = sessions.first(); _se; _se = sessions.next()) { + for (TESession *_se = sessions.first(); _se; _se = sessions.next()) + { + _se->setMetaAsAltMode(b_metaAsAlt); ColorSchema* s = colors->find( _se->schemaNo() ); if (s) { if (s->hasSchemaFileChanged()) @@ -2369,8 +2376,14 @@ void Konsole::disableMasterModeConnections() for (; to_it.current(); ++to_it) { TESession *to = to_it.current(); if (to!=from) - disconnect(from->widget(),TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), - to->getEmulation(),TQT_SLOT(onKeyPress(TQKeyEvent*))); + { + disconnect(from->widget(), TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyPress(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyReleased(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + to->getEmulation(), TQT_SLOT(onFocusIn(TQFocusEvent*))); + } } } } @@ -2385,9 +2398,14 @@ void Konsole::enableMasterModeConnections() TQPtrListIterator<TESession> to_it(sessions); for (; to_it.current(); ++to_it) { TESession *to = to_it.current(); - if (to!=from) { - connect(from->widget(),TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), - to->getEmulation(),TQT_SLOT(onKeyPress(TQKeyEvent*))); + if (to!=from) + { + connect(from->widget(), TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyPress(TQKeyEvent*))); + connect(from->widget(), TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), + to->getEmulation(), TQT_SLOT(onKeyReleased(TQKeyEvent*))); + connect(from->widget(), TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + to->getEmulation(), TQT_SLOT(onFocusIn(TQFocusEvent*))); } } } @@ -2951,23 +2969,25 @@ TQString Konsole::newSession(KSimpleConfig *co, TQString program, const TQStrLis s->setProgram(TQFile::encodeName(program),cmdArgs); s->setMonitorSilenceSeconds(monitorSilenceSeconds); s->enableFullScripting(b_fullScripting); + s->setMetaAsAltMode(b_metaAsAlt); + // If you add any new signal-slot connection below, think about doing it in konsolePart too connect( s,TQT_SIGNAL(done(TESession*)), - this,TQT_SLOT(doneSession(TESession*)) ); - connect( s, TQT_SIGNAL( updateTitle(TESession*) ), - this, TQT_SLOT( updateTitle(TESession*) ) ); - connect( s, TQT_SIGNAL( notifySessionState(TESession*, int) ), - this, TQT_SLOT( notifySessionState(TESession*, int)) ); + this,TQT_SLOT(doneSession(TESession*))); + connect( s, TQT_SIGNAL(updateTitle(TESession*)), + this, TQT_SLOT(updateTitle(TESession*))); + connect( s, TQT_SIGNAL(notifySessionState(TESession*, int)), + this, TQT_SLOT(notifySessionState(TESession*, int))); connect( s, TQT_SIGNAL(disableMasterModeConnections()), - this, TQT_SLOT(disableMasterModeConnections()) ); + this, TQT_SLOT(disableMasterModeConnections())); connect( s, TQT_SIGNAL(enableMasterModeConnections()), - this, TQT_SLOT(enableMasterModeConnections()) ); + this, TQT_SLOT(enableMasterModeConnections())); 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)), this, TQT_SLOT(changeColumns(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)), this, TQT_SLOT(notifySize(int,int))); connect( s, TQT_SIGNAL(zmodemDetected(TESession*)), @@ -2983,7 +3003,7 @@ TQString Konsole::newSession(KSimpleConfig *co, TQString program, const TQStrLis connect( s, TQT_SIGNAL(setSessionSchema(TESession*, const TQString &)), this, TQT_SLOT(slotSetSessionSchema(TESession*, const TQString &))); 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->setSchemaNo(schmno); @@ -3727,8 +3747,14 @@ void Konsole::detachSession(TESession* _se) { for(; from_it.current(); ++from_it) { TESession *from = from_it.current(); if(from->isMasterMode()) + { disconnect(from->widget(), TQT_SIGNAL(keyPressedSignal(TQKeyEvent*)), - _se->getEmulation(), TQT_SLOT(onKeyPress(TQKeyEvent*))); + _se->getEmulation(), TQT_SLOT(onKeyPress(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(keyReleasedSignal(TQKeyEvent*)), + _se->getEmulation(), TQT_SLOT(onKeyReleased(TQKeyEvent*))); + disconnect(from->widget(), TQT_SIGNAL(focusInSignal(TQFocusEvent*)), + _se->getEmulation(), TQT_SLOT(onFocusIn(TQFocusEvent*))); + } } } diff --git a/konsole/konsole/konsole.h b/konsole/konsole/konsole.h index 6bd3a2e81..976ac5cf8 100644 --- a/konsole/konsole/konsole.h +++ b/konsole/konsole/konsole.h @@ -435,6 +435,7 @@ private: bool b_installBitmapFonts; bool b_framevis:1; + bool b_metaAsAlt:1; bool b_fullscreen:1; bool m_menuCreated:1; bool b_warnQuit:1; diff --git a/konsole/konsole/konsole_part.cpp b/konsole/konsole/konsole_part.cpp index f1b2f28d8..87cd2b373 100644 --- a/konsole/konsole/konsole_part.cpp +++ b/konsole/konsole/konsole_part.cpp @@ -105,6 +105,7 @@ konsolePart::konsolePart(TQWidget *_parentWidget, const char *widgetName, TQObje ,rootxpm(0) ,blinkingCursor(0) ,showFrame(0) +,metaAsAlt(0) ,m_useKonsoleSettings(0) ,selectBell(0) ,selectLineSpacing(0) @@ -431,6 +432,11 @@ void konsolePart::makeGUI() showFrame->setCheckedState(i18n("Hide Fr&ame")); 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 TDEAction *WordSeps = new TDEAction(i18n("Wor&d Connectors..."), 0, this, TQT_SLOT(slotWordSeps()), settingsActions); @@ -505,6 +511,8 @@ void konsolePart::applySettingsToGUI() selectLineSpacing->setCurrentItem(te->lineSpacing()); if (blinkingCursor) blinkingCursor->setChecked(te->blinkingCursor()); + if (metaAsAlt) + metaAsAlt->setChecked(b_metaAsAlt); if (m_schema) m_schema->setItemChecked(curr_schema,true); if (selectSetEncoding) @@ -532,6 +540,8 @@ void konsolePart::applyProperties() se->widget()->setVTFont( defaultFont ); se->setSchemaNo( curr_schema ); slotSetEncoding(); + + se->setMetaAsAltMode(b_metaAsAlt); } void konsolePart::setSettingsMenuEnabled( bool enable ) @@ -560,13 +570,13 @@ void konsolePart::readProperties() config->setDesktopGroup(); b_framevis = config->readBoolEntry("has frame",false); + b_metaAsAlt = config->readBoolEntry("metaAsAltMode",false); b_histEnabled = config->readBoolEntry("historyenabled",true); n_bell = TQMIN(config->readUnsignedNumEntry("bellmode",TEWidget::BELLSYSTEM),3); n_keytab=config->readNumEntry("keytab",0); // act. the keytab for this session n_scroll = TQMIN(config->readUnsignedNumEntry("scrollbar",TEWidget::SCRRIGHT),2); m_histSize = config->readNumEntry("history",DEFAULT_HISTORY_SIZE); s_word_seps= config->readEntry("wordseps",":@-./_~"); - n_encoding = config->readNumEntry("encoding",0); TQFont tmpFont = TDEGlobalSettings::fixedFont(); @@ -637,6 +647,7 @@ void konsolePart::saveProperties() config->writeEntry("historyenabled", b_histEnabled); config->writeEntry("keytab",n_keytab); config->writeEntry("has frame",b_framevis); + config->writeEntry("metaAsAltMode",b_metaAsAlt); config->writeEntry("LineSpacing", te->lineSpacing()); config->writeEntry("schema",s_tdeconfigSchema); config->writeEntry("scrollbar",n_scroll); @@ -914,14 +925,18 @@ void konsolePart::slotBlinkingCursor() te->setBlinkingCursor(blinkingCursor->isChecked()); } +void konsolePart::slotToggleMetaAsAltMode() +{ + b_metaAsAlt ^= true; + if (!se) return; + se->setMetaAsAltMode(b_metaAsAlt); +} + void konsolePart::slotUseKonsoleSettings() { b_useKonsoleSettings = m_useKonsoleSettings->isChecked(); - setSettingsMenuEnabled( !b_useKonsoleSettings ); - readProperties(); - applySettingsToGUI(); } diff --git a/konsole/konsole/konsole_part.h b/konsole/konsole/konsole_part.h index 1fd2ac95f..766e4e5d5 100644 --- a/konsole/konsole/konsole_part.h +++ b/konsole/konsole/konsole_part.h @@ -118,6 +118,7 @@ signals: void slotSelectBell(); void slotSelectLineSpacing(); void slotBlinkingCursor(); + void slotToggleMetaAsAltMode(); void slotUseKonsoleSettings(); void slotWordSeps(); void slotSetEncoding(); @@ -136,9 +137,9 @@ signals: void setSchema(ColorSchema* s); void updateKeytabMenu(); - bool doOpenStream( const TQString& ); - bool doWriteStream( const TQByteArray& ); - bool doCloseStream(); + bool doOpenStream( const TQString& ); + bool doWriteStream( const TQByteArray& ); + bool doCloseStream(); TQWidget* parentWidget; TEWidget* te; @@ -151,6 +152,7 @@ signals: TDEToggleAction* blinkingCursor; TDEToggleAction* showFrame; + TDEToggleAction* metaAsAlt; TDEToggleAction* m_useKonsoleSettings; TDESelectAction* selectBell; @@ -174,6 +176,7 @@ signals: TQString s_word_seps; // characters that are considered part of a word bool b_framevis:1; + bool b_metaAsAlt:1; bool b_histEnabled:1; bool b_useKonsoleSettings:1; bool b_autoDestroy:1; diff --git a/konsole/konsole/session.cpp b/konsole/konsole/session.cpp index 8ecf469af..a6103da4f 100644 --- a/konsole/konsole/session.cpp +++ b/konsole/konsole/session.cpp @@ -464,6 +464,12 @@ void TESession::setFontNo(int fn) font_no = fn; } +void TESession::setMetaAsAltMode(bool mode) +{ + if (em) + em->setMetaKeyMode(mode); +} + void TESession::setTitle(const TQString& _title) { title = _title; diff --git a/konsole/konsole/session.h b/konsole/konsole/session.h index d15b8b5bd..bfcafdf47 100644 --- a/konsole/konsole/session.h +++ b/konsole/konsole/session.h @@ -123,6 +123,7 @@ public: void setSize(TQSize size); void setFont(const TQString &font); TQString font(); + void setMetaAsAltMode(bool mode); public slots: |