VirtualBox

Changeset 79641 in vbox


Ignore:
Timestamp:
Jul 9, 2019 12:58:12 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6143

-Checking the file size before parsing the xml files.
-Centering the keyboard to the machine window in case there are no saved geometry around

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r79387 r79641  
    16091609        return;
    16101610    }
    1611     m_pSoftKeyboardDialog = new UISoftKeyboard(0, uisession(), machine().GetName());
     1611    QWidget *pCenterWidget = windowManager().realParentWindow(activeMachineWindow());
     1612    m_pSoftKeyboardDialog = new UISoftKeyboard(0, uisession(), pCenterWidget, machine().GetName());
    16121613    if (m_pSoftKeyboardDialog)
    16131614    {
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp

    r79636 r79641  
    7272const int iScrollLockPosition = 125;
    7373
     74/** Set a generous file size limit. */
     75const qint64 iFileSizeLimit = _256K;
    7476
    7577const QString strSubDirectorName("keyboardLayouts");
     
    23162318    {
    23172319        if (!msgCenter().questionBinary(this, MessageType_Question,
    2318                                         QString(UISoftKeyboard::tr("This will delete the keyboard layout file as well, Proceed?")),
     2320                                        QString(UISoftKeyboard::tr("This will delete the keyboard layout file as well. Proceed?")),
    23192321                                        0 /* auto-confirm id */,
    23202322                                        QString("Delete") /* ok button text */,
     
    28122814    QFile xmlFile(strFileName);
    28132815    if (!xmlFile.exists())
     2816        return false;
     2817
     2818    if (xmlFile.size() >= iFileSizeLimit)
    28142819        return false;
    28152820
     
    30403045        return false;
    30413046
     3047    if (xmlFile.size() >= iFileSizeLimit)
     3048        return false;
     3049
    30423050    if (!xmlFile.open(QIODevice::ReadOnly))
    30433051        return false;
     
    33233331
    33243332UISoftKeyboard::UISoftKeyboard(QWidget *pParent,
    3325                                UISession *pSession, QString strMachineName /* = QString()*/)
     3333                               UISession *pSession, QWidget *pCenterWidget, QString strMachineName /* = QString()*/)
    33263334    :QIWithRetranslateUI<QMainWindow>(pParent)
    33273335    , m_pSession(pSession)
     3336    , m_pCenterWidget(pCenterWidget)
    33283337    , m_pMainLayout(0)
    33293338    , m_pKeyboardWidget(0)
     
    36323641    QRect defaultGeometry(0, 0, iDefaultWidth, iDefaultHeight);
    36333642
    3634     QWidget *pParentWidget = qobject_cast<QWidget*>(parent());
    3635     if (pParentWidget)
    3636         defaultGeometry.moveCenter(pParentWidget->geometry().center());
    3637 
     3643
     3644    if (m_pCenterWidget)
     3645        defaultGeometry.moveCenter(m_pCenterWidget->geometry().center());
    36383646    /* Load geometry from extradata: */
    36393647    QRect geometry = gEDataManager->softKeyboardDialogGeometry(this, defaultGeometry);
  • trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.h

    r79456 r79641  
    5555public:
    5656
    57     UISoftKeyboard(QWidget *pParent, UISession *pSession,
     57    UISoftKeyboard(QWidget *pParent, UISession *pSession, QWidget *pCenterWidget,
    5858                   QString strMachineName = QString());
    5959    ~UISoftKeyboard();
     
    102102
    103103    UISession     *m_pSession;
     104    QWidget       *m_pCenterWidget;
    104105    QHBoxLayout   *m_pMainLayout;
    105106    UISoftKeyboardWidget       *m_pKeyboardWidget;
Note: See TracChangeset for help on using the changeset viewer.

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