moved loginErrorBox code, so we can reuse the Dialog

This commit is contained in:
Hauke Schade 2012-11-21 17:41:09 +01:00
parent f0c0544807
commit a70e235c75
2 changed files with 49 additions and 27 deletions

46
qml/ttrss/ErrorDialog.qml Normal file
View file

@ -0,0 +1,46 @@
//Copyright Hauke Schade, 2012
//
//This file is part of TTRss.
//
//TTRss 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.
//TTRss 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 TTRss (on a Maemo/Meego system there is a copy
//in /usr/share/common-licenses. If not, see http://www.gnu.org/licenses/.
import QtQuick 1.1
import com.nokia.meego 1.0
import com.nokia.extras 1.1
Dialog {
id: errorDialog
property string text
title: Rectangle {
id: titleField
height: 2
width: parent.width
color: "red"
}
content:Item {
id: errorDialogContents
height: 50
width: parent.width
Text {
id: errorDialogText
font.pixelSize: constant.fontSizeSmall
anchors.centerIn: parent
color: "white"
text: errorDialog.text
}
}
buttons: ButtonRow {
style: ButtonStyle { }
anchors.horizontalCenter: parent.horizontalCenter
Button { text: qsTr("OK"); onClicked: errorDialog.accept() }
}
}

View file

@ -210,7 +210,7 @@ Page {
settings.set("dologin", "false");
//Let the user know
loginErrorDialogText.text = text;
loginErrorDialog.text = text;
loginErrorDialog.open();
} else {
//Login succeeded, auto login next Time
@ -222,33 +222,9 @@ Page {
}
//Dialog for login errors
Dialog {
ErrorDialog {
id: loginErrorDialog
title: Rectangle {
id: titleField
height: 2
width: parent.width
color: "red"
}
content:Item {
id: loginErrorDialogContents
height: 50
width: parent.width
Text {
id: loginErrorDialogText
font.pixelSize: 22
anchors.centerIn: parent
color: "white"
text: "Hello Dialog"
}
}
buttons: ButtonRow {
style: ButtonStyle { }
anchors.horizontalCenter: parent.horizontalCenter
Button { text: "OK"; onClicked: loginErrorDialog.accept() }
}
text: "pageTitle"
}
Component.onCompleted: {