VirtualBox

Changeset 71052 in vbox


Ignore:
Timestamp:
Feb 19, 2018 1:22:57 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120915
Message:

FE/Qt: bugref:6699 Only the last line of the guest control console is editable

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  
    7979void UIGuestControlConsole::keyPressEvent(QKeyEvent *pEvent)
    8080{
     81    /* Check if we at the bottom most line.*/
     82    bool lastLine = blockCount() == (textCursor().blockNumber() +1);
    8183
    8284    switch (pEvent->key()) {
     
    9092        case Qt::Key_Down:
    9193        {
    92             replaceLineContent(getNextCommandFromHistory(getCommandString()));
     94            if (lastLine)
     95                replaceLineContent(getNextCommandFromHistory(getCommandString()));
    9396            break;
    9497        }
     
    9699        {
    97100            QTextCursor cursor = textCursor();
    98             if (cursor.positionInBlock() > m_strPrompt.length())
     101            if (lastLine && cursor.positionInBlock() > m_strPrompt.length())
    99102                cursor.deletePreviousChar();
    100103            break;
     
    110113        case Qt::Key_Enter:
    111114        {
    112             QString strCommand(getCommandString());
    113             if (!strCommand.isEmpty())
     115            if (lastLine)
    114116            {
    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                }
    122128            }
    123129            break;
     
    132138        }
    133139        default:
    134             QPlainTextEdit::keyPressEvent(pEvent);
     140            if (lastLine)
     141                QPlainTextEdit::keyPressEvent(pEvent);
    135142            break;
    136143    }
     
    152159void UIGuestControlConsole::contextMenuEvent(QContextMenuEvent *pEvent)
    153160{
    154     //Q_UNUSED(pEvent);
    155     QPlainTextEdit::contextMenuEvent(pEvent);
     161    Q_UNUSED(pEvent);
     162    //QPlainTextEdit::contextMenuEvent(pEvent);
    156163}
    157164
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlTreeItem.cpp

    r71049 r71052  
    115115    return statusString;
    116116}
     117
     118
    117119/*********************************************************************************************************************************
    118120*   UIGuestControlTreeItem implementation.                                                                                       *
     
    277279    setText(2, QString("Session Status: %1").arg(sessionStatusString(m_comGuestSession.GetStatus())));
    278280}
     281
    279282
    280283/*********************************************************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette