<commit_before>/* * This file is part of dui-keyboard *
 *
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * Contact: Nokia Corporation (<EMAIL>)
 *
 * If you have questions regarding the use of this file, please contact
 * Nokia at <EMAIL>.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation
 * and appearing in the file LICENSE.LGPL included in the packaging
 * of this file.
 */



#include "layoutmenu.h"
#include "duivirtualkeyboardstyle.h"

#include <DuiButtonGroup>

#ifndef NOCONTROLPANEL
#include <DuiControlPanelIf>
#endif

#include <DuiButton>
#include <DuiDialog>
#include <DuiGridLayoutPolicy>
#include <DuiLabel>
#include <DuiLayout>
#include <DuiLinearLayoutPolicy>
#include <DuiLocale>
#include <DuiPopupList>
#include <DuiSceneManager>
#include <DuiTheme>
#include <DuiNamespace>
#include <DuiWidget>
#include <duireactionmap.h>
#include <duiplainwindow.h>

#include <QDebug>
#include <QGraphicsItemAnimation>
#include <QGraphicsLinearLayout>
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
#include <QStringListModel>

namespace
{
    //! spacing for language menue items
    const int Spacing = 10;

    //! Control panel language page name
    const QString CpLanguagePage("Language");
};

// FIXME: when menu is shown and a click is made outside it (that is, on the keyboard)
// the menu disappears and bottom button isn't shown

// FIXME: parent

LayoutMenu::LayoutMenu(DuiVirtualKeyboardStyleContainer *style,
                       QGraphicsWidget */* parent */)
    : styleContainer(style),
      active(false),
      savedActive(false),
      centralWidget(0),
      titleLabel(0),
      errorCorrectionLabel(0),
      errorCorrectionButton(0),
      layoutListLabel(0),
      layoutListHeader(0),
      layoutList(0),
      languageSettingLabel(0),
      languageSettingButton(0),
      keyboardOptionDialog(0),
      menuWidget(0),
      mainLayout(0),
      correctionAndLanguageLandscapeLayout(0)
{
    setObjectName("LayoutMenu");
    getStyleValues();

    loadLanguageMenu();
}


void LayoutMenu::loadLanguageMenu()
{
    //create dialog and widgets
    centralWidget = new DuiWidget;
    centralWidget->setGeometry(0, 0, baseSize.width(), baseSize.height() + buttonSize.height());

    //% "Keyboard options"
    keyboardOptionDialog = new DuiDialog(qtTrId("qtn_vkb_keyboard_options"), Dui::NoButton);
    keyboardOptionDialog->setCentralWidget(centralWidget);

    connect(keyboardOptionDialog, SIGNAL(visibleChanged()), SLOT(visibleChangeHandler()));<commit_msg>Changes: explicitly hide layoutmenu after construction<commit_after>/* * This file is part of dui-keyboard *
 *
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * Contact: Nokia Corporation (<EMAIL>)
 *
 * If you have questions regarding the use of this file, please contact
 * Nokia at <EMAIL>.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation
 * and appearing in the file LICENSE.LGPL included in the packaging
 * of this file.
 */



#include "layoutmenu.h"
#include "duivirtualkeyboardstyle.h"

#include <DuiButtonGroup>

#ifndef NOCONTROLPANEL
#include <DuiControlPanelIf>
#endif

#include <DuiButton>
#include <DuiDialog>
#include <DuiGridLayoutPolicy>
#include <DuiLabel>
#include <DuiLayout>
#include <DuiLinearLayoutPolicy>
#include <DuiLocale>
#include <DuiPopupList>
#include <DuiSceneManager>
#include <DuiTheme>
#include <DuiNamespace>
#include <DuiWidget>
#include <duireactionmap.h>
#include <duiplainwindow.h>

#include <QDebug>
#include <QGraphicsItemAnimation>
#include <QGraphicsLinearLayout>
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
#include <QStringListModel>

namespace
{
    //! spacing for language menue items
    const int Spacing = 10;

    //! Control panel language page name
    const QString CpLanguagePage("Language");
};

// FIXME: when menu is shown and a click is made outside it (that is, on the keyboard)
// the menu disappears and bottom button isn't shown

// FIXME: parent

LayoutMenu::LayoutMenu(DuiVirtualKeyboardStyleContainer *style,
                       QGraphicsWidget */* parent */)
    : styleContainer(style),
      active(false),
      savedActive(false),
      centralWidget(0),
      titleLabel(0),
      errorCorrectionLabel(0),
      errorCorrectionButton(0),
      layoutListLabel(0),
      layoutListHeader(0),
      layoutList(0),
      languageSettingLabel(0),
      languageSettingButton(0),
      keyboardOptionDialog(0),
      menuWidget(0),
      mainLayout(0),
      correctionAndLanguageLandscapeLayout(0)
{
    setObjectName("LayoutMenu");
    getStyleValues();

    loadLanguageMenu();
}


void LayoutMenu::loadLanguageMenu()
{
    //create dialog and widgets
    centralWidget = new DuiWidget;
    centralWidget->setGeometry(0, 0, baseSize.width(), baseSize.height() + buttonSize.height());

    //% "Keyboard options"
    keyboardOptionDialog = new DuiDialog(qtTrId("qtn_vkb_keyboard_options"), Dui::NoButton);
    keyboardOptionDialog->setCentralWidget(centralWidget);
    // Note: current (pre 0.20) libdui doesn't have dialog hidden on construction.
    // do that explicitly here so the signals are emitted correctly
    keyboardOptionDialog->hide();

    connect(keyboardOptionDialog, SIGNAL(visibleChanged()), SLOT(visibleChangeHandler()));
{'fraction_non_alphanumeric': 0.10384068278805121, 'fraction_numerical': 0.008712660028449502, 'mean_word_length': 4.382775119617225, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2629916', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1622, 'n_words': 474}