1 /****************************************************************************
3 ** Copyright (C) 2012 Takumi Asaki
4 ** All rights reserved.
5 ** Contact: Takumi Asaki (takumi.asaki@gmail.com)
7 ** This file is part of the fontmanager application.
9 ** You may use this file under the terms of the BSD license as follows:
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
14 ** * Redistributions of source code must retain the above copyright
15 ** notice, this list of conditions and the following disclaimer.
16 ** * Redistributions in binary form must reproduce the above copyright
17 ** notice, this list of conditions and the following disclaimer in
18 ** the documentation and/or other materials provided with the
20 ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
21 ** the names of its contributors may be used to endorse or promote
22 ** products derived from this software without specific prior written
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
37 ****************************************************************************/
40 import com.nokia.meego 1.0
41 import 'UIConstants.js' as UI
52 property string filePath
53 property string alertMessage
58 alertMessage = message
64 openInstallFinishedDialog()
67 onUninstallFinished: {
69 openUninstallFinishedDialog()
72 onBackupConfigFinished: {
74 openBackupConfigFinishedDialog()
77 onRestoreConfigFinished: {
79 openRestoreConfigFinishedDialog()
82 onClearInstallableFamilyListFor: {
83 installableFamilyListModel.clear()
84 installableFamilyListModel.family = family;
87 onAppendInstallableFamily: {
88 installableFamilyListModel.append( { "name": family, "enfamily": enfamily, "systemFont": systemFont } )
93 id: installableFamilyListModel
94 property string family
103 function openAlertDialog()
105 queryDialog.statusChanged.disconnect(openAlertDialog)
106 if (queryDialog.status !== DialogStatus.Closed) {
107 queryDialog.statusChanged.connect(openAlertDialog)
110 queryDialog.titleText = qsTr("Alert")
111 queryDialog.message = alertMessage
112 queryDialog.acceptButtonText = qsTr("Close")
113 queryDialog.rejectButtonText = ""
117 function openFinishedDialog()
119 queryDialog.acceptButtonText = qsTr("Close")
120 queryDialog.rejectButtonText = ""
121 queryDialog.accepted.connect(popToMainPage)
122 queryDialog.rejected.connect(popToMainPage)
126 function openInstallFinishedDialog()
128 queryDialog.statusChanged.disconnect(openInstallFinishedDialog)
129 if (queryDialog.status !== DialogStatus.Closed) {
130 queryDialog.statusChanged.connect(openInstallFinishedDialog)
133 queryDialog.titleText = qsTr("Install finished")
134 queryDialog.message = qsTr("Font '%1' is installed successfully.").arg(filePath)
138 function openUninstallFinishedDialog()
140 queryDialog.statusChanged.disconnect(openUninstallFinishedDialog)
141 if (queryDialog.status !== DialogStatus.Closed) {
142 queryDialog.statusChanged.connect(openUninstallFinishedDialog)
145 queryDialog.titleText = qsTr("Uninstall finished")
146 queryDialog.message = qsTr("Font '%1' is uninstalled successfully.").arg(filePath)
150 function openBackupConfigFinishedDialog()
152 queryDialog.statusChanged.disconnect(openBackupConfigFinishedDialog)
153 if (queryDialog.status !== DialogStatus.Closed) {
154 queryDialog.statusChanged.connect(openBackupConfigFinishedDialog)
157 queryDialog.titleText = qsTr("Backup finished")
158 queryDialog.message = qsTr("Fonts Config is backuped as '%1' successfully.").arg(controller.path4display(filePath))
162 function openRestoreConfigFinishedDialog()
164 queryDialog.statusChanged.disconnect(openRestoreConfigFinishedDialog)
165 if (queryDialog.status !== DialogStatus.Closed) {
166 queryDialog.statusChanged.connect(openRestoreConfigFinishedDialog)
169 queryDialog.titleText = qsTr("Restore finished")
170 queryDialog.message = qsTr("Fonts Config is restored from '%1' successfully.").arg(controller.path4display(filePath))
174 function popToMainPage()
176 queryDialog.accepted.disconnect(popToMainPage)
177 queryDialog.rejected.disconnect(popToMainPage)
178 if (pageStack.currentPage !== mainPage)
179 pageStack.pop(mainPage)