Changeset 71052 in vbox
- Timestamp:
- Feb 19, 2018 1:22:57 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 120915
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlConsole.cpp
r71049 r71052 79 79 void UIGuestControlConsole::keyPressEvent(QKeyEvent *pEvent) 80 80 { 81 /* Check if we at the bottom most line.*/ 82 bool lastLine = blockCount() == (textCursor().blockNumber() +1); 81 83 82 84 switch (pEvent->key()) { … … 90 92 case Qt::Key_Down: 91 93 { 92 replaceLineContent(getNextCommandFromHistory(getCommandString())); 94 if (lastLine) 95 replaceLineContent(getNextCommandFromHistory(getCommandString())); 93 96 break; 94 97 } … … 96 99 { 97 100 QTextCursor cursor = textCursor(); 98 if ( cursor.positionInBlock() > m_strPrompt.length())101 if (lastLine && cursor.positionInBlock() > m_strPrompt.length()) 99 102 cursor.deletePreviousChar(); 100 103 break; … … 110 113 case Qt::Key_Enter: 111 114 { 112 QString strCommand(getCommandString()); 113 if (!strCommand.isEmpty()) 115 if (lastLine) 114 116 { 115 emit commandEntered(strCommand); 116 if (!m_tCommandHistory.contains(strCommand)) 117 m_tCommandHistory.push_back(strCommand); 118 m_uCommandHistoryIndex = m_tCommandHistory.size()-1; 119 moveCursor(QTextCursor::End); 120 QPlainTextEdit::keyPressEvent(pEvent); 121 startNextLine(); 117 QString strCommand(getCommandString()); 118 if (!strCommand.isEmpty()) 119 { 120 emit commandEntered(strCommand); 121 if (!m_tCommandHistory.contains(strCommand)) 122 m_tCommandHistory.push_back(strCommand); 123 m_uCommandHistoryIndex = m_tCommandHistory.size()-1; 124 moveCursor(QTextCursor::End); 125 QPlainTextEdit::keyPressEvent(pEvent); 126 startNextLine(); 127 } 122 128 } 123 129 break; … … 132 138 } 133 139 default: 134 QPlainTextEdit::keyPressEvent(pEvent); 140 if (lastLine) 141 QPlainTextEdit::keyPressEvent(pEvent); 135 142 break; 136 143 } … … 152 159 void UIGuestControlConsole::contextMenuEvent(QContextMenuEvent *pEvent) 153 160 { 154 //Q_UNUSED(pEvent);155 QPlainTextEdit::contextMenuEvent(pEvent);161 Q_UNUSED(pEvent); 162 //QPlainTextEdit::contextMenuEvent(pEvent); 156 163 } 157 164 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.cpp
r71049 r71052 115 115 return statusString; 116 116 } 117 118 117 119 /********************************************************************************************************************************* 118 120 * UIGuestControlTreeItem implementation. * … … 277 279 setText(2, QString("Session Status: %1").arg(sessionStatusString(m_comGuestSession.GetStatus()))); 278 280 } 281 279 282 280 283 /*********************************************************************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.