diff --git a/qml.qrc b/qml.qrc
index e6f7b8c6..06ff4914 100644
--- a/qml.qrc
+++ b/qml.qrc
@@ -61,7 +61,6 @@
src/commoncomponents/LookupStatusLabel.qml
src/commoncomponents/ListViewJami.qml
src/commoncomponents/DeleteAccountDialog.qml
- src/commoncomponents/MessageBox.qml
src/wizardview/WizardView.qml
src/wizardview/components/WelcomePage.qml
src/wizardview/components/CreateAccountPage.qml
@@ -140,5 +139,6 @@
src/mainview/components/UserInfoCallPage.qml
src/commoncomponents/BaseDialog.qml
src/commoncomponents/ModalPopup.qml
+ src/commoncomponents/SimpleMessageDialog.qml
diff --git a/src/commoncomponents/MessageBox.qml b/src/commoncomponents/MessageBox.qml
deleted file mode 100644
index 16225a0c..00000000
--- a/src/commoncomponents/MessageBox.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2020 by Savoir-faire Linux
- * Author: Yang Wang
- *
- * 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 3 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 .
- */
-
-import QtQuick 2.15
-import QtQuick.Controls 2.14
-import QtQuick.Layouts 1.14
-import QtQuick.Controls.Styles 1.4
-import QtQuick.Dialogs 1.3
-
-MessageDialog {
- id: messageBox
-
- visible: false
- modality: Qt.NonModal
- width: 300
- height: 200
-
- function openWithParameters(titleToDisplay, infoToDisplay, infoIconMode = StandardIcon.Information, buttons = StandardButton.Ok){
- title = titleToDisplay
- text = infoToDisplay
- icon = infoIconMode
- standardButtons = buttons
- messageBox.open()
- }
-}
diff --git a/src/commoncomponents/SimpleMessageDialog.qml b/src/commoncomponents/SimpleMessageDialog.qml
new file mode 100644
index 00000000..01a0c72b
--- /dev/null
+++ b/src/commoncomponents/SimpleMessageDialog.qml
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2020 by Savoir-faire Linux
+ * Author: Mingrui Zhang
+ *
+ * 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 3 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 .
+ */
+
+import QtQuick 2.15
+import QtQuick.Controls 2.14
+import QtQuick.Layouts 1.14
+import net.jami.Models 1.0
+import net.jami.Adapters 1.0
+
+BaseDialog {
+ id: root
+
+ // TODO: make MaterialButton ButtonStyle
+ enum ButtonStyle {
+ TintedBlue,
+ TintedBlack,
+ TintedRed
+ }
+
+ property var buttonTitles: []
+ property var buttonCallBacks: []
+ property var buttonStyles: []
+ property alias description: descriptionText.text
+
+ function openWithParameters(title, info) {
+ root.title = title
+ descriptionText.text = info
+ open()
+ }
+
+ contentItem: Rectangle {
+ id: simpleMessageDialogContentRect
+
+ implicitWidth: Math.max(JamiTheme.preferredDialogWidth,
+ buttonTitles.length * (JamiTheme.preferredFieldWidth / 2
+ + JamiTheme.preferredMarginSize))
+ implicitHeight: JamiTheme.preferredDialogHeight / 2
+
+ ColumnLayout {
+ anchors.fill: parent
+
+ Label {
+ id: descriptionText
+
+ Layout.alignment: Qt.AlignCenter
+ Layout.preferredWidth: JamiTheme.preferredDialogWidth - JamiTheme.preferredMarginSize
+ Layout.topMargin: JamiTheme.preferredMarginSize
+
+ font.pointSize: JamiTheme.menuFontSize - 2
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ RowLayout {
+ spacing: JamiTheme.preferredMarginSize
+
+ Layout.fillWidth: true
+ Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
+ Layout.bottomMargin: JamiTheme.preferredMarginSize
+
+ Repeater {
+ model: buttonTitles.length
+ MaterialButton {
+ Layout.alignment: Qt.AlignVCenter
+ Layout.preferredWidth: JamiTheme.preferredFieldWidth / 2
+ Layout.preferredHeight: JamiTheme.preferredFieldHeight
+
+ color: {
+ switch(buttonStyles[modelData]) {
+ case SimpleMessageDialog.ButtonStyle.TintedBlue:
+ return JamiTheme.buttonTintedBlue
+ case SimpleMessageDialog.ButtonStyle.TintedBlack:
+ return JamiTheme.buttonTintedBlack
+ case SimpleMessageDialog.ButtonStyle.TintedRed:
+ return JamiTheme.buttonTintedRed
+ }
+ }
+ hoveredColor: {
+ switch(buttonStyles[modelData]) {
+ case SimpleMessageDialog.ButtonStyle.TintedBlue:
+ return JamiTheme.buttonTintedBlueHovered
+ case SimpleMessageDialog.ButtonStyle.TintedBlack:
+ return JamiTheme.buttonTintedBlackHovered
+ case SimpleMessageDialog.ButtonStyle.TintedRed:
+ return JamiTheme.buttonTintedRedHovered
+ }
+ }
+ pressedColor: {
+ switch(buttonStyles[modelData]) {
+ case SimpleMessageDialog.ButtonStyle.TintedBlue:
+ return JamiTheme.buttonTintedBluePressed
+ case SimpleMessageDialog.ButtonStyle.TintedBlack:
+ return JamiTheme.buttonTintedBlackPressed
+ case SimpleMessageDialog.ButtonStyle.TintedRed:
+ return JamiTheme.buttonTintedRedPressed
+ }
+ }
+ outlined: true
+
+ text: buttonTitles[modelData]
+
+ onClicked: {
+ if (buttonCallBacks[modelData])
+ buttonCallBacks[modelData]()
+ close()
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/mainapplication.cpp b/src/mainapplication.cpp
index 1c37de9e..e27965c1 100644
--- a/src/mainapplication.cpp
+++ b/src/mainapplication.cpp
@@ -113,6 +113,8 @@ MainApplication::MainApplication(int& argc, char** argv)
void
MainApplication::init()
{
+ setWindowIcon(QIcon(":images/jami.ico"));
+
#ifdef Q_OS_LINUX
if (!getenv("QT_QPA_PLATFORMTHEME"))
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
diff --git a/src/mainview/MainView.qml b/src/mainview/MainView.qml
index 13a3acf7..195e38c0 100644
--- a/src/mainview/MainView.qml
+++ b/src/mainview/MainView.qml
@@ -549,7 +549,7 @@ Window {
onSettingsViewWindowNeedToShowMainViewWindow: {
mainViewWindowSidePanel.refreshAccountComboBox(0)
- AccountAdapter.accountChanged(index)
+ AccountAdapter.accountChanged(0)
toggleSettingsView()
}
diff --git a/src/settingsview/components/CurrentAccountSettings.qml b/src/settingsview/components/CurrentAccountSettings.qml
index a286317a..13846c09 100644
--- a/src/settingsview/components/CurrentAccountSettings.qml
+++ b/src/settingsview/components/CurrentAccountSettings.qml
@@ -98,12 +98,12 @@ Rectangle {
JamiStrings.setPassword
}
- MessageBox {
+ SimpleMessageDialog {
id: msgDialog
- onAccepted: {
- setPasswordButtonText()
- }
+ buttonTitles: [qsTr("Ok")]
+ buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue]
+ buttonCallBacks: [setPasswordButtonText]
}
DeleteAccountDialog {
@@ -125,7 +125,6 @@ Rectangle {
onDoneSignal: {
var title = success ? qsTr("Success") : qsTr("Error")
- var iconMode = success ? StandardIcon.Information : StandardIcon.Critical
var info
switch(currentPurpose) {
@@ -141,7 +140,7 @@ Rectangle {
break
}
- msgDialog.openWithParameters(title,info, iconMode, StandardButton.Ok)
+ msgDialog.openWithParameters(title, info)
}
}
@@ -166,9 +165,9 @@ Rectangle {
if (exportPath.length > 0) {
var isSuccessful = AccountAdapter.model.exportToFile(UtilsAdapter.getCurrAccId(), exportPath,"")
var title = isSuccessful ? qsTr("Success") : qsTr("Error")
- var iconMode = isSuccessful ? StandardIcon.Information : StandardIcon.Critical
var info = isSuccessful ? JamiStrings.backupSuccessful : JamiStrings.backupFailed
- msgDialog.openWithParameters(title,info, iconMode, StandardButton.Ok)
+
+ msgDialog.openWithParameters(title,info)
}
}
}
diff --git a/src/settingsview/components/LinkedDevices.qml b/src/settingsview/components/LinkedDevices.qml
index 76e4127c..759843d2 100644
--- a/src/settingsview/components/LinkedDevices.qml
+++ b/src/settingsview/components/LinkedDevices.qml
@@ -88,17 +88,18 @@ ColumnLayout {
onRevokeDeviceWithPassword: revokeDeviceWithIDAndPassword(idOfDevice, password)
}
- MessageBox {
+ SimpleMessageDialog {
id: revokeDeviceMessageBox
property string idOfDev: ""
- title:qsTr("Remove Device")
- text :qsTr("Are you sure you wish to remove this device?")
- icon :StandardIcon.Information
- standardButtons: StandardButton.Ok | StandardButton.Cancel
+ title: qsTr("Remove Device")
+ description: qsTr("Are you sure you wish to remove this device?")
- onAccepted: revokeDeviceWithIDAndPassword(idOfDev,"")
+ buttonTitles: [qsTr("Ok"), qsTr("Cancel")]
+ buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue,
+ SimpleMessageDialog.ButtonStyle.TintedBlack]
+ buttonCallBacks: [function() {revokeDeviceWithIDAndPassword(idOfDev, "")}]
}
Label {
diff --git a/src/settingsview/components/PluginListPreferencesView.qml b/src/settingsview/components/PluginListPreferencesView.qml
index ec066e28..54c88078 100644
--- a/src/settingsview/components/PluginListPreferencesView.qml
+++ b/src/settingsview/components/PluginListPreferencesView.qml
@@ -46,7 +46,10 @@ Rectangle {
signal uninstalled
function resetPluginSlot() {
- resetPluginMessageBox.open()
+ msgDialog.buttonCallBacks = [function () {resetPlugin()}]
+ msgDialog.openWithParameters(qsTr("Reset preferences"),
+ qsTr("Are you sure you wish to reset "+ pluginName +
+ " preferences?"))
}
function resetPlugin() {
@@ -61,7 +64,12 @@ Rectangle {
}
function uninstallPluginSlot() {
- uninstallPluginMessageBox.open()
+ msgDialog.buttonCallBacks = [function () {
+ uninstallPlugin()
+ root.visible = false
+ }]
+ msgDialog.openWithParameters(qsTr("Uninstall plugin"),
+ qsTr("Are you sure you wish to uninstall " + pluginName + " ?"))
}
function uninstallPlugin() {
@@ -79,13 +87,12 @@ Rectangle {
PluginModel.setPluginPreference(pluginId, preferenceKey, preferenceNewValue)
}
- MessageDialog {
- id: uninstallPluginMessageBox
+ SimpleMessageDialog {
+ id: msgDialog
- title:qsTr("Uninstall plugin")
- text :qsTr("Are you sure you wish to uninstall " + pluginName + " ?")
- icon: StandardIcon.Warning
- standardButtons: StandardButton.Ok | StandardButton.Cancel
+ buttonTitles: [qsTr("Ok"), qsTr("Cancel")]
+ buttonStyles: [SimpleMessageDialog.ButtonStyle.TintedBlue,
+ SimpleMessageDialog.ButtonStyle.TintedBlack]
onAccepted: {
uninstallPlugin()
@@ -93,17 +100,6 @@ Rectangle {
}
}
- MessageDialog {
- id: resetPluginMessageBox
-
- title:qsTr("Reset preferences")
- text :qsTr("Are you sure you wish to reset "+ pluginName + " preferences?")
- icon: StandardIcon.Warning
- standardButtons: StandardButton.Ok | StandardButton.Cancel
-
- onAccepted: resetPlugin()
- }
-
ColumnLayout {
anchors.left: root.left
anchors.right: root.right