diff --git a/irc-chatter.pro b/irc-chatter.pro index 6a191e1..bc58a7d 100644 --- a/irc-chatter.pro +++ b/irc-chatter.pro @@ -65,7 +65,9 @@ OTHER_FILES += \ qml/desktop/components/Dialog.qml \ qml/desktop/components/Menu.qml \ qml/desktop/components/MenuButton.qml \ - qml/desktop/dialogs/ServerSettingsDialog.qml + qml/desktop/dialogs/ServerSettingsDialog.qml \ + qml/desktop/dialogs/AboutDialog.qml \ + qml/desktop/components/QueryDialog.qml # User interface for MeeGo OTHER_FILES += \ diff --git a/qml/desktop/AppWindow.qml b/qml/desktop/AppWindow.qml index edadd81..97268a1 100644 --- a/qml/desktop/AppWindow.qml +++ b/qml/desktop/AppWindow.qml @@ -18,6 +18,7 @@ import QtQuick 2.0 import "./components" import "./pages" +import "./dialogs" Rectangle { id: appWindow @@ -30,4 +31,7 @@ Rectangle { id: chatPage visible: false } + AboutDialog { + id: aboutDialog + } } diff --git a/qml/desktop/components/Dialog.qml b/qml/desktop/components/Dialog.qml index 1367297..d41e176 100644 --- a/qml/desktop/components/Dialog.qml +++ b/qml/desktop/components/Dialog.qml @@ -38,6 +38,9 @@ Rectangle { visible = true; showHideAnimation.start(); } + function close() { + showHideAnimation.start(); + } onAccepted: { showHideAnimation.start(); diff --git a/qml/desktop/components/QueryDialog.qml b/qml/desktop/components/QueryDialog.qml new file mode 100644 index 0000000..f9d7ae3 --- /dev/null +++ b/qml/desktop/components/QueryDialog.qml @@ -0,0 +1,49 @@ +// This file is part of IRC Chatter, the first IRC Client for MeeGo. +// +// 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. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// Copyright (C) 2012, Timur Kristóf + +import QtQuick 2.0 +import "../components" + +Dialog { + id: queryDialog + + property alias text: theText.text + property alias textFormat: theText.textFormat + + title: "Are you sure?" + acceptButtonText: "Yes" + rejectButtonText: "No" + gradient: Gradient { + GradientStop { position: 0.0; color: "#cc222222" } + GradientStop { position: 0.4; color: "#dd444444" } + } + + Text { + id: theText + width: parent.width * 0.5 + wrapMode: Text.Wrap + color: "#fff" + onLinkActivated: { + if (link == "back://back") { + queryDialog.close(); + } + else { + Qt.openUrlExternally(link); + } + } + } +} diff --git a/qml/desktop/misc/ChannelSwitcherButton.qml b/qml/desktop/misc/ChannelSwitcherButton.qml index 747ecb9..a63f418 100644 --- a/qml/desktop/misc/ChannelSwitcherButton.qml +++ b/qml/desktop/misc/ChannelSwitcherButton.qml @@ -132,11 +132,6 @@ Button { color: "#fff" visible: !isConnected && !isConnecting } - MenuButton { - text: "View topic" - visible: isChannel && isConnected - // TODO: onClicked - } MenuButton { text: "User list (138)" visible: isChannel && isConnected @@ -147,11 +142,6 @@ Button { visible: isChannel && isConnected // TODO: onClicked } - MenuButton { - text: "View whois" - visible: isQuery && isConnected - // TODO: onClicked - } MenuButton { text: "Close" visible: isQuery && isConnected @@ -167,6 +157,11 @@ Button { visible: isServer && !isConnected && !isConnecting // TODO: onClicked } + MenuButton { + text: "Join / query" + visible: isServer && isConnected + // TODO: onClicked + } } } } diff --git a/qml/desktop/pages/ChatPage.qml b/qml/desktop/pages/ChatPage.qml index b858b60..5845eeb 100644 --- a/qml/desktop/pages/ChatPage.qml +++ b/qml/desktop/pages/ChatPage.qml @@ -171,10 +171,7 @@ Page { MenuButton { text: "Disconnect all" onClicked: { - // TODO: confirmation dialog - // TODO: actual disconnecting - startPage.animateIn(); - chatPage.animateOut(); + areYouSureToDisconnectAllDialog.open(); } } MenuButton { @@ -249,4 +246,15 @@ Page { } } } + + // Dialog for disconnecting from all servers + QueryDialog { + id: areYouSureToDisconnectAllDialog + text: "Do you want to disconnect from all servers?" + onAccepted: { + ircModel.disconnectFromServers(); + startPage.animateIn(); + chatPage.animateOut(); + } + } } diff --git a/ui-desktop.qrc b/ui-desktop.qrc index 190fae3..2668e09 100644 --- a/ui-desktop.qrc +++ b/ui-desktop.qrc @@ -17,5 +17,6 @@ qml/desktop/components/Dialog.qml qml/desktop/dialogs/ServerSettingsDialog.qml qml/desktop/dialogs/AboutDialog.qml + qml/desktop/components/QueryDialog.qml