/****************************************************************************
**
-** Copyright (C) 2011 Takumi Asaki
+** Copyright (C) 2012 Takumi Asaki
** All rights reserved.
** Contact: Takumi Asaki (takumi.asaki@gmail.com)
**
}
}
- QueryDialog {
- id: confirmDialog
- property int fontcount: 1
- property variant fontlist
- titleText: qsTr("Delete Font?")
- message: fontcount > 1 ?
- qsTr("This Font has %1 families(%2). Do you really want to remove these fonts now?").arg(fontcount).arg(fontlist.join(qsTr(', '))) :
- qsTr("Do you really want to remove this font now?")
- acceptButtonText: qsTr("OK")
- rejectButtonText: qsTr("Cancel")
- onAccepted: {
- controller.uninstallFont(fontInfo.file)
- }
+ function openDeleteConfirmDialog(fontcount, fontlist)
+ {
+ queryDialog.titleText = qsTr("Delete Font?")
+ if (fontcount > 1)
+ queryDialog.message = qsTr("This Font has %1 families(%2). Do you really want to remove these fonts now?").arg(fontcount).arg(fontlist ? fontlist.join(qsTr(', ')) : qsTr("Unknown"))
+ else
+ queryDialog.message = qsTr("Do you really want to remove this font now?")
+ queryDialog.acceptButtonText = qsTr("OK")
+ queryDialog.rejectButtonText = qsTr("Cancel")
+ queryDialog.accepted.connect(uninstallFont)
+ queryDialog.open()
+ }
+
+ function uninstallFont()
+ {
+ queryDialog.accepted.disconnect(uninstallFont)
+ controller.uninstallFont(fontInfo.file)
}
ToolBarLayout {
}
ToolIcon {
platformIconId: "toolbar-delete"
+ anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
var fontlist = controller.fontCount(fontInfo.file)
- confirmDialog.fontcount = fontlist.length
- confirmDialog.fontlist = fontlist
- confirmDialog.open()
+ openDeleteConfirmDialog(fontlist.length, fontlist)
}
}
}