<commit_before>/*
* Copyright (C) 2008-2011 <NAME> <EMAIL>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

import QtQuick 1.1
import Communi 1.0
import com.nokia.meego 1.0

PageStackWindow {
    id: window

    initialPage: MainPage {
        id: page

        title: {
            if (connectionSheet.status === DialogStatus.Open)
                return qsTr("Add connection");
            if (channelSheet.status === DialogStatus.Open)
                return qsTr("Join channel");
            if (querySheet.status === DialogStatus.Open)
                return qsTr("Open query");
            return qsTr("Communi");
        }

        tools: ToolBarLayout {
            id: tools
            visible: sheet.status == DialogStatus.Closed
            ToolIcon {
                iconId: "toolbar-add"
                anchors.right: parent.right
                onClicked: SessionModel.length ? menu.open() : connectionSheet.open()
            }
        }
        obscured: connectionSheet.status == DialogStatus.Open || connectionSheet.status == DialogStatus.Opening
                  || channelSheet.status !== DialogStatus.Closed || channelSheet.status == DialogStatus.Opening
                  || querySheet.status !== DialogStatus.Closed || querySheet.status == DialogStatus.Opening

        Menu {
            id: menu
            MenuLayout {
                MenuItem {
                    text: qsTr("Add connection")
                    onClicked: connectionSheet.open()
                }
                MenuItem {
                    text: qsTr("Join channel")
                    onClicked: channelSheet.open()
                }
                MenuItem {
                    text: qsTr("Open query")
                    onClicked: querySheet.open()
                }
            }
        }

        IrcCommand {
            id: ircCommand
        }

        ConnectionSheet {
            id: connectionSheet

            Component.onCompleted: {
                connectionSheet.host = Settings.host;
                connectionSheet.port = Settings.port;
                connectionSheet.name = Settings.name;
                connectionSheet.channel = Settings.channel;
                connectionSheet.secure = Settings.secure;
            }

            Component {
                id: sessionComponent
                Session { }
            }

            onAccepted: {
                var session = sessionComponent.createObject(window);
                session.nickName = connectionSheet.name;
                session.userName = connectionSheet.user.length ? connectionSheet.user : "communi";
                session.realName = connectionSheet.real.length ? connectionSheet.real : connectionSheet.name;
                session.host = connectionSheet.host;
                session.port = connectionSheet.port;
                session.password = <PASSWORD>;
                session.secure = connectionSheet.secure;
                session.channels = connectionSheet.channel;
                SessionManager.addSession(session);<commit_msg>meego ex: store user & real name to settings<commit_after>/*
* Copyright (C) 2008-2011 <NAME> <EMAIL>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

import QtQuick 1.1
import Communi 1.0
import com.nokia.meego 1.0

PageStackWindow {
    id: window

    initialPage: MainPage {
        id: page

        title: {
            if (connectionSheet.status === DialogStatus.Open)
                return qsTr("Add connection");
            if (channelSheet.status === DialogStatus.Open)
                return qsTr("Join channel");
            if (querySheet.status === DialogStatus.Open)
                return qsTr("Open query");
            return qsTr("Communi");
        }

        tools: ToolBarLayout {
            id: tools
            visible: sheet.status == DialogStatus.Closed
            ToolIcon {
                iconId: "toolbar-add"
                anchors.right: parent.right
                onClicked: SessionModel.length ? menu.open() : connectionSheet.open()
            }
        }
        obscured: connectionSheet.status == DialogStatus.Open || connectionSheet.status == DialogStatus.Opening
                  || channelSheet.status !== DialogStatus.Closed || channelSheet.status == DialogStatus.Opening
                  || querySheet.status !== DialogStatus.Closed || querySheet.status == DialogStatus.Opening

        Menu {
            id: menu
            MenuLayout {
                MenuItem {
                    text: qsTr("Add connection")
                    onClicked: connectionSheet.open()
                }
                MenuItem {
                    text: qsTr("Join channel")
                    onClicked: channelSheet.open()
                }
                MenuItem {
                    text: qsTr("Open query")
                    onClicked: querySheet.open()
                }
            }
        }

        IrcCommand {
            id: ircCommand
        }

        ConnectionSheet {
            id: connectionSheet

            Component.onCompleted: {
                connectionSheet.host = Settings.host;
                connectionSheet.port = Settings.port;
                connectionSheet.name = Settings.name;
                connectionSheet.user = Settings.user;
                connectionSheet.real = Settings.real;
                connectionSheet.channel = Settings.channel;
                connectionSheet.secure = Settings.secure;
            }

            Component {
                id: sessionComponent
                Session { }
            }

            onAccepted: {
                var session = sessionComponent.createObject(window);
                session.nickName = connectionSheet.name;
                session.userName = connectionSheet.user.length ? connectionSheet.user : "communi";
                session.realName = connectionSheet.real.length ? connectionSheet.real : connectionSheet.name;
                session.host = connectionSheet.host;
                session.port = connectionSheet.port;
                session.password = <PASSWORD>;
                session.secure = connectionSheet.secure;
                session.channels = connectionSheet.channel;
                SessionManager.addSession(session);
{'fraction_non_alphanumeric': 0.08035839283214335, 'fraction_numerical': 0.004199916001679967, 'mean_word_length': 1.6726524504302283, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6869535', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1612, 'n_words': 448}