Sébastien Blin | 1f91576 | 2020-08-03 13:27:42 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2019-2020 by Savoir-faire Linux |
| 3 | * Author: Yang Wang <yang.wang@savoirfairelinux.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | import QtQuick 2.15 |
| 20 | import QtQuick.Window 2.14 |
| 21 | import QtQuick.Controls 2.14 |
| 22 | import QtQuick.Controls.Universal 2.12 |
| 23 | import QtQuick.Layouts 1.3 |
| 24 | import QtGraphicalEffects 1.14 |
| 25 | import QtQuick.Controls.Styles 1.4 |
| 26 | import QtQuick.Dialogs 1.3 |
| 27 | import Qt.labs.platform 1.1 |
| 28 | import net.jami.Models 1.0 |
| 29 | |
| 30 | import "../../commoncomponents" |
| 31 | |
| 32 | Rectangle { |
| 33 | id: accountViewRect |
| 34 | |
| 35 | enum RegName { |
| 36 | BLANK, |
| 37 | INVALIDFORM, |
| 38 | TAKEN, |
| 39 | FREE, |
| 40 | SEARCHING |
| 41 | } |
| 42 | |
| 43 | property int regNameUi: CurrentAccountSettingsScrollPage.BLANK |
| 44 | property string registeredName: "" |
| 45 | property bool registeredIdNeedsSet: false |
| 46 | |
| 47 | property int refreshVariable : 0 |
| 48 | |
| 49 | signal navigateToMainView |
| 50 | signal navigateToNewWizardView |
| 51 | |
| 52 | function refreshRelevantUI(){ |
| 53 | refreshVariable++ |
| 54 | refreshVariable-- |
| 55 | } |
| 56 | |
| 57 | Connections { |
| 58 | id: btnRegisterNameClickConnection |
| 59 | target: btnRegisterName |
| 60 | |
| 61 | enabled: { |
| 62 | refreshVariable |
| 63 | switch (regNameUi) { |
| 64 | case CurrentAccountSettingsScrollPage.FREE: |
| 65 | return true |
| 66 | default: |
| 67 | return false |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | function onClicked() { |
| 72 | slotRegisterName() |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | function updateAccountInfoDisplayed() { |
| 77 | setAvatar() |
| 78 | |
| 79 | accountEnableCheckBox.checked = ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_Enabled() |
| 80 | displayNameLineEdit.text = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Alias() |
| 81 | |
| 82 | var showLocalAccountConfig = (ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === "") |
| 83 | passwdPushButton.visible = showLocalAccountConfig |
| 84 | btnExportAccount.visible = showLocalAccountConfig |
| 85 | linkDevPushButton.visible = showLocalAccountConfig |
| 86 | |
| 87 | registeredIdNeedsSet = (ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() === "") |
| 88 | |
| 89 | if(!registeredIdNeedsSet){ |
| 90 | currentRegisteredID.text = ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() |
| 91 | } else { |
| 92 | currentRegisteredID.text = "" |
| 93 | } |
| 94 | |
| 95 | currentRingID.text = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri() |
| 96 | |
| 97 | // update device list view |
| 98 | updateAndShowDevicesSlot() |
| 99 | |
| 100 | bannedContactsListWidget.visible = false |
| 101 | bannedContactsLayoutWidget.visible = (bannedListModel.rowCount() > 0) |
| 102 | |
| 103 | if (advanceSettingsView.visible) { |
| 104 | advanceSettingsView.updateAccountInfoDisplayedAdvance() |
| 105 | } |
| 106 | refreshRelevantUI() |
| 107 | } |
| 108 | |
| 109 | function connectCurrentAccount() { |
| 110 | accountConnections_ContactModel.enabled = true |
| 111 | accountConnections_DeviceModel.enabled = true |
| 112 | } |
| 113 | |
| 114 | function disconnectAccountConnections() { |
| 115 | accountConnections_ContactModel.enabled = false |
| 116 | accountConnections_DeviceModel.enabled = false |
| 117 | } |
| 118 | |
| 119 | function isPhotoBoothOpened() { |
| 120 | return currentAccountAvatar.takePhotoState |
| 121 | } |
| 122 | |
| 123 | function setAvatar() { |
| 124 | currentAccountAvatar.setAvatarPixmap( |
| 125 | ClientWrapper.settingsAdaptor.getAvatarImage_Base64( |
| 126 | currentAccountAvatar.boothWidht), |
| 127 | ClientWrapper.settingsAdaptor.getIsDefaultAvatar()) |
| 128 | } |
| 129 | |
| 130 | function stopBooth() { |
| 131 | currentAccountAvatar.stopBooth() |
| 132 | } |
| 133 | |
| 134 | function toggleBannedContacts(){ |
| 135 | var bannedContactsVisible = bannedContactsListWidget.visible |
| 136 | bannedContactsListWidget.visible = !bannedContactsVisible |
| 137 | updateAndShowBannedContactsSlot() |
| 138 | } |
| 139 | |
| 140 | function unban(index){ |
| 141 | ClientWrapper.settingsAdaptor.unbanContact(index) |
| 142 | updateAndShowBannedContactsSlot() |
| 143 | } |
| 144 | |
| 145 | Connections { |
| 146 | id: accountConnections_ContactModel |
| 147 | target: ClientWrapper.contactModel |
| 148 | |
| 149 | function onModelUpdated(uri, needsSorted) { |
| 150 | updateAndShowBannedContactsSlot() |
| 151 | } |
| 152 | |
| 153 | function onContactAdded(contactUri){ |
| 154 | updateAndShowBannedContactsSlot() |
| 155 | } |
| 156 | |
| 157 | function onContactRemoved(contactUri){ |
| 158 | updateAndShowBannedContactsSlot() |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | Connections { |
| 163 | id: accountConnections_DeviceModel |
| 164 | target: ClientWrapper.deviceModel |
| 165 | |
| 166 | function onDeviceAdded(id) { |
| 167 | updateAndShowDevicesSlot() |
| 168 | } |
| 169 | |
| 170 | function onDeviceRevoked(id, status) { |
| 171 | updateAndShowDevicesSlot() |
| 172 | } |
| 173 | |
| 174 | function onDeviceUpdated(id) { |
| 175 | updateAndShowDevicesSlot() |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // slots |
| 180 | function verifyRegisteredNameSlot() { |
| 181 | if (ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() !== "") { |
| 182 | regNameUi = CurrentAccountSettingsScrollPage.BLANK |
| 183 | } else { |
| 184 | registeredName = ClientWrapper.utilsAdaptor.stringSimplifier( |
| 185 | currentRegisteredID.text) |
| 186 | if (registeredName !== "") { |
| 187 | if (ClientWrapper.utilsAdaptor.validateRegNameForm(registeredName)) { |
| 188 | regNameUi = CurrentAccountSettingsScrollPage.SEARCHING |
| 189 | lookUpLabelTimer.restart() |
| 190 | } else { |
| 191 | regNameUi = CurrentAccountSettingsScrollPage.INVALIDFORM |
| 192 | } |
| 193 | } else { |
| 194 | regNameUi = CurrentAccountSettingsScrollPage.BLANK |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | Timer { |
| 200 | id: lookUpLabelTimer |
| 201 | |
| 202 | interval: 300 |
| 203 | onTriggered: { |
| 204 | beforeNameLookup() |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | function beforeNameLookup() { |
| 209 | ClientWrapper.nameDirectory.lookupName("", registeredName) |
| 210 | } |
| 211 | |
| 212 | Connections { |
| 213 | target: ClientWrapper.nameDirectory |
| 214 | enabled: true |
| 215 | |
| 216 | function onRegisteredNameFound(status, address, name) { |
| 217 | afterNameLookup(status, name) |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | function afterNameLookup(status, regName) { |
| 222 | if (registeredName === regName && regName.length > 2) { |
| 223 | switch (status) { |
| 224 | case NameDirectory.LookupStatus.NOT_FOUND: |
| 225 | regNameUi = CurrentAccountSettingsScrollPage.FREE |
| 226 | break |
| 227 | default: |
| 228 | regNameUi = CurrentAccountSettingsScrollPage.TAKEN |
| 229 | break |
| 230 | } |
| 231 | } else { |
| 232 | regNameUi = CurrentAccountSettingsScrollPage.BLANK |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | function setAccEnableSlot(state) { |
| 237 | ClientWrapper.accountModel.setAccountEnabled(ClientWrapper.utilsAdaptor.getCurrAccId(), state) |
| 238 | } |
| 239 | |
| 240 | /* |
| 241 | * JamiFileDialog for exporting account |
| 242 | */ |
| 243 | JamiFileDialog { |
| 244 | id: exportBtn_Dialog |
| 245 | |
| 246 | mode: JamiFileDialog.SaveFile |
| 247 | |
| 248 | title: qsTr("Export Account Here") |
| 249 | folder: StandardPaths.writableLocation(StandardPaths.DesktopLocation) |
| 250 | |
| 251 | nameFilters: [qsTr("Jami archive files") + " (*.gz)", qsTr( |
| 252 | "All files") + " (*)"] |
| 253 | |
| 254 | onAccepted: { |
| 255 | // is there password? If so, go to password dialog, else, go to following directly |
| 256 | var exportPath = ClientWrapper.utilsAdaptor.getAbsPath(file.toString()) |
| 257 | if (ClientWrapper.accountAdaptor.hasPassword()) { |
| 258 | passwordDialog.openDialog(PasswordDialog.ExportAccount,exportPath) |
| 259 | return |
| 260 | } else { |
| 261 | if (exportPath.length > 0) { |
| 262 | var isSuccessful = ClientWrapper.accountAdaptor.accoundModel().exportToFile(ClientWrapper.utilsAdaptor.getCurrAccId(), exportPath,"") |
| 263 | var title = isSuccessful ? qsTr("Success") : qsTr("Error") |
| 264 | var iconMode = isSuccessful ? StandardIcon.Information : StandardIcon.Critical |
| 265 | var info = isSuccessful ? qsTr("Export Successful") : qsTr("Export Failed") |
| 266 | msgDialog.openWithParameters(title,info, iconMode, StandardButton.Ok) |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | onRejected: {} |
| 272 | |
| 273 | onVisibleChanged: { |
| 274 | if (!visible) { |
| 275 | rejected() |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | function exportAccountSlot() { |
| 281 | exportBtn_Dialog.open() |
| 282 | } |
| 283 | |
| 284 | PasswordDialog { |
| 285 | id: passwordDialog |
| 286 | |
| 287 | onDoneSignal: { |
| 288 | var success = (code === successCode) |
| 289 | var title = success ? qsTr("Success") : qsTr("Error") |
| 290 | var iconMode = success ? StandardIcon.Information : StandardIcon.Critical |
| 291 | |
| 292 | var info |
| 293 | switch(currentPurpose){ |
| 294 | case PasswordDialog.ExportAccount: |
| 295 | info = success ? qsTr("Export Successful") : qsTr("Export Failed") |
| 296 | break |
| 297 | case PasswordDialog.ChangePassword: |
| 298 | info = success ? qsTr("Password Changed Successfully") : qsTr("Password Change Failed") |
| 299 | break |
| 300 | case PasswordDialog.SetPassword: |
| 301 | info = success ? qsTr("Password Set Successfully") : qsTr("Password Set Failed") |
| 302 | passwdPushButton.text = success ? qsTr("Change Password") : qsTr("Set Password") |
| 303 | break |
| 304 | } |
| 305 | |
| 306 | msgDialog.openWithParameters(title,info, iconMode, StandardButton.Ok) |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | MessageBox { |
| 311 | id: msgDialog |
| 312 | } |
| 313 | |
| 314 | function passwordClicked() { |
| 315 | if (ClientWrapper.accountAdaptor.hasPassword()){ |
| 316 | passwordDialog.openDialog(PasswordDialog.ChangePassword) |
| 317 | } else { |
| 318 | passwordDialog.openDialog(PasswordDialog.SetPassword) |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | function delAccountSlot() { |
| 323 | deleteAccountDialog.open() |
| 324 | } |
| 325 | |
| 326 | DeleteAccountDialog{ |
| 327 | id: deleteAccountDialog |
| 328 | |
| 329 | anchors.centerIn: parent.Center |
| 330 | x: (parent.width - width) / 2 |
| 331 | y: (parent.height - height) / 2 |
| 332 | |
| 333 | onAccepted: { |
| 334 | ClientWrapper.accountAdaptor.setSelectedAccountId() |
| 335 | ClientWrapper.accountAdaptor.setSelectedConvId() |
| 336 | |
| 337 | if(ClientWrapper.utilsAdaptor.getAccountListSize() > 0){ |
| 338 | navigateToMainView() |
| 339 | } else { |
| 340 | navigateToNewWizardView() |
| 341 | } |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | NameRegistrationDialog{ |
| 346 | id : nameRegistrationDialog |
| 347 | |
| 348 | onAccepted: { |
| 349 | registeredIdNeedsSet = false |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | function slotRegisterName() { |
| 354 | refreshRelevantUI() |
| 355 | nameRegistrationDialog.openNameRegistrationDialog(registeredName) |
| 356 | } |
| 357 | |
| 358 | LinkDeviceDialog{ |
| 359 | id: linkDeviceDialog |
| 360 | |
| 361 | onAccepted: { |
| 362 | updateAndShowDevicesSlot() |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | function showLinkDevSlot() { |
| 367 | linkDeviceDialog.openLinkDeviceDialog() |
| 368 | } |
| 369 | |
| 370 | RevokeDevicePasswordDialog{ |
| 371 | id: revokeDevicePasswordDialog |
| 372 | |
| 373 | onRevokeDeviceWithPassword:{ |
| 374 | revokeDeviceWithIDAndPassword(idOfDevice, password) |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | MessageBox{ |
| 379 | id: revokeDeviceMessageBox |
| 380 | |
| 381 | property string idOfDev: "" |
| 382 | |
| 383 | title:qsTr("Remove Device") |
| 384 | text :qsTr("Are you sure you wish to remove this device?") |
| 385 | icon :StandardIcon.Information |
| 386 | standardButtons: StandardButton.Ok | StandardButton.Cancel |
| 387 | |
| 388 | onYes: { |
| 389 | accepted() |
| 390 | } |
| 391 | |
| 392 | onNo:{ |
| 393 | rejected() |
| 394 | } |
| 395 | |
| 396 | onDiscard: { |
| 397 | rejected() |
| 398 | } |
| 399 | |
| 400 | onAccepted: { |
| 401 | revokeDeviceWithIDAndPassword(idOfDev,"") |
| 402 | } |
| 403 | |
| 404 | onRejected: {} |
| 405 | } |
| 406 | |
| 407 | function removeDeviceSlot(index){ |
| 408 | var idOfDevice = deviceItemListModel.data(deviceItemListModel.index(index,0), DeviceItemListModel.DeviceID) |
| 409 | if(ClientWrapper.accountAdaptor.hasPassword()){ |
| 410 | revokeDevicePasswordDialog.openRevokeDeviceDialog(idOfDevice) |
| 411 | } else { |
| 412 | revokeDeviceMessageBox.idOfDev = idOfDevice |
| 413 | revokeDeviceMessageBox.open() |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | function revokeDeviceWithIDAndPassword(idDevice, password){ |
| 418 | ClientWrapper.deviceModel.revokeDevice(idDevice, password) |
| 419 | updateAndShowDevicesSlot() |
| 420 | } |
| 421 | |
| 422 | function updateAndShowBannedContactsSlot() { |
| 423 | if(bannedListModel.rowCount() <= 0){ |
| 424 | bannedContactsLayoutWidget.visible = false |
| 425 | return |
| 426 | } |
| 427 | |
| 428 | bannedListModel.reset() |
| 429 | } |
| 430 | |
| 431 | function updateAndShowDevicesSlot() { |
| 432 | if(ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === ""){ |
| 433 | linkDevPushButton.visible = true |
| 434 | } |
| 435 | |
| 436 | deviceItemListModel.reset() |
| 437 | } |
| 438 | |
| 439 | DeviceItemListModel { |
| 440 | id: deviceItemListModel |
| 441 | } |
| 442 | |
| 443 | BannedListModel{ |
| 444 | id: bannedListModel |
| 445 | } |
| 446 | |
| 447 | Layout.fillHeight: true |
| 448 | Layout.fillWidth: true |
| 449 | |
| 450 | ColumnLayout { |
| 451 | anchors.fill: parent |
| 452 | spacing: 0 |
| 453 | |
| 454 | Item { |
| 455 | Layout.fillWidth: true |
| 456 | |
| 457 | Layout.maximumHeight: 10 |
| 458 | Layout.minimumHeight: 10 |
| 459 | Layout.preferredHeight: 10 |
| 460 | |
| 461 | Layout.alignment: Qt.AlignTop |
| 462 | } |
| 463 | |
| 464 | RowLayout { |
| 465 | spacing: 6 |
| 466 | |
| 467 | Layout.alignment: Qt.AlignTop |
| 468 | |
| 469 | Layout.fillWidth: true |
| 470 | Layout.maximumHeight: 30 |
| 471 | Layout.minimumHeight: 30 |
| 472 | Layout.preferredHeight: accountPageTitle.height |
| 473 | |
| 474 | Item { |
| 475 | Layout.fillHeight: true |
| 476 | |
| 477 | Layout.maximumWidth: 30 |
| 478 | Layout.preferredWidth: 30 |
| 479 | Layout.minimumWidth: 30 |
| 480 | } |
| 481 | |
| 482 | Label { |
| 483 | id: accountPageTitle |
| 484 | |
| 485 | Layout.preferredWidth: 117 |
| 486 | |
| 487 | Layout.maximumHeight: 25 |
| 488 | Layout.preferredHeight: 25 |
| 489 | Layout.minimumHeight: 25 |
| 490 | |
| 491 | text: qsTr("Jami Account") |
| 492 | |
| 493 | font.pointSize: 15 |
| 494 | font.kerning: true |
| 495 | |
| 496 | horizontalAlignment: Text.AlignLeft |
| 497 | verticalAlignment: Text.AlignVCenter |
| 498 | } |
| 499 | |
| 500 | Item { |
| 501 | Layout.fillWidth: true |
| 502 | Layout.fillHeight: true |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | ScrollView { |
| 507 | id: accoutScrollView |
| 508 | |
| 509 | property ScrollBar hScrollBar: ScrollBar.horizontal |
| 510 | property ScrollBar vScrollBar: ScrollBar.vertical |
| 511 | |
| 512 | Layout.fillHeight: true |
| 513 | Layout.fillWidth: true |
| 514 | |
| 515 | ScrollBar.horizontal.policy: ScrollBar.AsNeeded |
| 516 | ScrollBar.vertical.policy: ScrollBar.AsNeeded |
| 517 | |
| 518 | font.pointSize: 8 |
| 519 | font.kerning: true |
| 520 | clip: true |
| 521 | |
| 522 | ColumnLayout { |
| 523 | id: accoutnViewLayout |
| 524 | |
| 525 | Layout.fillHeight: true |
| 526 | Layout.maximumWidth: 625 |
| 527 | |
| 528 | Item { |
| 529 | Layout.fillHeight: true |
| 530 | |
| 531 | Layout.maximumWidth: 30 |
| 532 | Layout.preferredWidth: 30 |
| 533 | Layout.minimumWidth: 30 |
| 534 | } |
| 535 | |
| 536 | ColumnLayout { |
| 537 | spacing: 6 |
| 538 | Layout.fillHeight: true |
| 539 | Layout.fillWidth: true |
| 540 | |
| 541 | Layout.leftMargin: 30 |
| 542 | |
| 543 | Item { |
| 544 | Layout.fillHeight: true |
| 545 | |
| 546 | Layout.maximumWidth: 24 |
| 547 | Layout.preferredWidth: 24 |
| 548 | Layout.minimumWidth: 24 |
| 549 | } |
| 550 | |
| 551 | ToggleSwitch { |
| 552 | id: accountEnableCheckBox |
| 553 | |
| 554 | labelText: qsTr("Enable") |
| 555 | fontPointSize: 11 |
| 556 | |
| 557 | onSwitchToggled: { |
| 558 | setAccEnableSlot(checked) |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | Item { |
| 563 | Layout.fillHeight: true |
| 564 | |
| 565 | Layout.maximumWidth: 20 |
| 566 | Layout.preferredWidth: 20 |
| 567 | Layout.minimumWidth: 20 |
| 568 | } |
| 569 | |
| 570 | ColumnLayout { |
| 571 | Layout.fillWidth: true |
| 572 | |
| 573 | Label { |
| 574 | Layout.fillWidth: true |
| 575 | |
| 576 | Layout.maximumHeight: 21 |
| 577 | Layout.preferredHeight: 21 |
| 578 | Layout.minimumHeight: 21 |
| 579 | |
| 580 | text: qsTr("Profile") |
| 581 | font.pointSize: 13 |
| 582 | font.kerning: true |
| 583 | |
| 584 | horizontalAlignment: Text.AlignLeft |
| 585 | verticalAlignment: Text.AlignVCenter |
| 586 | } |
| 587 | |
| 588 | Item { |
| 589 | Layout.fillWidth: true |
| 590 | |
| 591 | Layout.maximumHeight: 10 |
| 592 | Layout.preferredHeight: 10 |
| 593 | Layout.minimumHeight: 10 |
| 594 | } |
| 595 | |
| 596 | ColumnLayout { |
| 597 | Layout.fillWidth: true |
| 598 | layoutDirection: Qt.LeftToRight |
| 599 | |
| 600 | spacing: 6 |
| 601 | |
| 602 | PhotoboothView { |
| 603 | id: currentAccountAvatar |
| 604 | |
| 605 | Layout.alignment: Qt.AlignHCenter |
| 606 | |
| 607 | Layout.maximumWidth: 261 |
| 608 | Layout.preferredWidth: 261 |
| 609 | Layout.minimumWidth: 261 |
| 610 | Layout.maximumHeight: 261 |
| 611 | Layout.preferredHeight: 261 |
| 612 | Layout.minimumHeight: 261 |
| 613 | |
| 614 | Layout.leftMargin: 20 |
| 615 | |
| 616 | onImageAcquired: { |
| 617 | ClientWrapper.settingsAdaptor.setCurrAccAvatar(imgBase64) |
| 618 | } |
| 619 | |
| 620 | onImageCleared: { |
| 621 | ClientWrapper.settingsAdaptor.clearCurrentAvatar() |
| 622 | setAvatar() |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | InfoLineEdit { |
| 627 | id: displayNameLineEdit |
| 628 | |
| 629 | fieldLayoutWidth: 261 |
| 630 | |
| 631 | Layout.leftMargin: 20 |
| 632 | |
| 633 | font.pointSize: 10 |
| 634 | font.kerning: true |
| 635 | |
| 636 | horizontalAlignment: Text.AlignHCenter |
| 637 | verticalAlignment: Text.AlignVCenter |
| 638 | |
| 639 | onEditingFinished: { |
| 640 | ClientWrapper.accountAdaptor.setCurrAccDisplayName( |
| 641 | displayNameLineEdit.text) |
| 642 | } |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | |
| 647 | Item { |
| 648 | Layout.fillHeight: true |
| 649 | |
| 650 | Layout.maximumWidth: 20 |
| 651 | Layout.preferredWidth: 20 |
| 652 | Layout.minimumWidth: 20 |
| 653 | } |
| 654 | |
| 655 | ColumnLayout { |
| 656 | Layout.fillWidth: true |
| 657 | |
| 658 | Label { |
| 659 | Layout.fillWidth: true |
| 660 | |
| 661 | Layout.maximumHeight: 21 |
| 662 | Layout.preferredHeight: 21 |
| 663 | Layout.minimumHeight: 21 |
| 664 | |
| 665 | text: qsTr("Identity") |
| 666 | font.pointSize: 13 |
| 667 | font.kerning: true |
| 668 | |
| 669 | horizontalAlignment: Text.AlignLeft |
| 670 | verticalAlignment: Text.AlignVCenter |
| 671 | } |
| 672 | |
| 673 | Item { |
| 674 | Layout.fillHeight: true |
| 675 | |
| 676 | Layout.maximumWidth: 10 |
| 677 | Layout.preferredWidth: 10 |
| 678 | Layout.minimumWidth: 10 |
| 679 | } |
| 680 | |
| 681 | ColumnLayout { |
| 682 | spacing: 7 |
| 683 | |
| 684 | Layout.fillWidth: true |
| 685 | |
| 686 | RowLayout { |
| 687 | spacing: 6 |
| 688 | Layout.fillWidth: true |
| 689 | Layout.maximumHeight: 30 |
| 690 | |
| 691 | Layout.leftMargin: 20 |
| 692 | |
| 693 | Layout.maximumWidth: 625 |
| 694 | |
| 695 | Label { |
| 696 | Layout.maximumWidth: 13 |
| 697 | Layout.preferredWidth: 13 |
| 698 | Layout.minimumWidth: 13 |
| 699 | |
| 700 | Layout.minimumHeight: 30 |
| 701 | Layout.preferredHeight: 30 |
| 702 | Layout.maximumHeight: 30 |
| 703 | |
| 704 | text: qsTr("Id") |
| 705 | font.pointSize: 10 |
| 706 | font.kerning: true |
| 707 | |
| 708 | horizontalAlignment: Text.AlignLeft |
| 709 | verticalAlignment: Text.AlignVCenter |
| 710 | } |
| 711 | |
| 712 | TextField { |
| 713 | id: currentRingID |
| 714 | |
| 715 | property var backgroundColor: "transparent" |
| 716 | property var borderColor: "transparent" |
| 717 | |
| 718 | Layout.fillWidth: true |
| 719 | |
| 720 | Layout.minimumHeight: 30 |
| 721 | Layout.preferredHeight: 30 |
| 722 | Layout.maximumHeight: 30 |
| 723 | |
| 724 | font.pointSize: 10 |
| 725 | font.kerning: true |
| 726 | font.bold: true |
| 727 | |
| 728 | readOnly: true |
| 729 | selectByMouse: true |
| 730 | |
| 731 | text: { refreshVariable |
| 732 | return ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri()} |
| 733 | |
| 734 | horizontalAlignment: Text.AlignLeft |
| 735 | verticalAlignment: Text.AlignVCenter |
| 736 | |
| 737 | background: Rectangle { |
| 738 | anchors.fill: parent |
| 739 | radius: 0 |
| 740 | border.color: currentRingID.borderColor |
| 741 | border.width: 0 |
| 742 | color: currentRingID.backgroundColor |
| 743 | } |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | RowLayout { |
| 748 | spacing: 6 |
| 749 | Layout.fillWidth: true |
| 750 | Layout.maximumHeight: 32 |
| 751 | |
| 752 | Layout.leftMargin: 20 |
| 753 | |
| 754 | layoutDirection: Qt.LeftToRight |
| 755 | |
| 756 | Label { |
| 757 | id: lblRegisteredName |
| 758 | |
| 759 | Layout.maximumWidth: 127 |
| 760 | Layout.preferredWidth: 127 |
| 761 | Layout.minimumWidth: 127 |
| 762 | |
| 763 | Layout.minimumHeight: 32 |
| 764 | Layout.preferredHeight: 32 |
| 765 | Layout.maximumHeight: 32 |
| 766 | |
| 767 | text: qsTr("Registered name") |
| 768 | |
| 769 | font.pointSize: 10 |
| 770 | font.kerning: true |
| 771 | |
| 772 | horizontalAlignment: Text.AlignLeft |
| 773 | verticalAlignment: Text.AlignVCenter |
| 774 | } |
| 775 | |
| 776 | RowLayout { |
| 777 | spacing: 6 |
| 778 | Layout.fillWidth: true |
| 779 | Layout.maximumHeight: 30 |
| 780 | Layout.alignment: Qt.AlignVCenter |
| 781 | |
| 782 | TextField { |
| 783 | id: currentRegisteredID |
| 784 | |
| 785 | Layout.maximumWidth: 300 |
| 786 | Layout.preferredWidth: 300 |
| 787 | Layout.minimumWidth: 300 |
| 788 | |
| 789 | Layout.minimumHeight: 30 |
| 790 | Layout.preferredHeight: 30 |
| 791 | Layout.maximumHeight: 30 |
| 792 | |
| 793 | placeholderText: { refreshVariable |
| 794 | var result = registeredIdNeedsSet ? qsTr("Type here to register a username") : "" |
| 795 | return result} |
| 796 | |
| 797 | text: { |
| 798 | refreshVariable |
| 799 | if (!registeredIdNeedsSet){ |
| 800 | return ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() |
| 801 | } else { |
| 802 | return "" |
| 803 | } |
| 804 | } |
| 805 | selectByMouse: true |
| 806 | readOnly: { refreshVariable |
| 807 | return !registeredIdNeedsSet} |
| 808 | |
| 809 | font.pointSize: 10 |
| 810 | font.kerning: true |
| 811 | font.bold: { refreshVariable |
| 812 | return !registeredIdNeedsSet} |
| 813 | |
| 814 | horizontalAlignment: Text.AlignLeft |
| 815 | verticalAlignment: Text.AlignVCenter |
| 816 | |
| 817 | background: Rectangle { |
| 818 | anchors.fill: parent |
| 819 | radius: {refreshVariable |
| 820 | var result = registeredIdNeedsSet ? height / 2 : 0 |
| 821 | return result} |
| 822 | border.color: "transparent" |
| 823 | border.width: {refreshVariable |
| 824 | var result = registeredIdNeedsSet ? 2 : 0 |
| 825 | return result} |
| 826 | color: {refreshVariable |
| 827 | var result = registeredIdNeedsSet ? Qt.rgba( |
| 828 | 240 / 256, 240 / 256, |
| 829 | 240 / 256, |
| 830 | 1.0) : "transparent" |
| 831 | return result} |
| 832 | } |
| 833 | |
| 834 | onTextEdited: { |
| 835 | verifyRegisteredNameSlot() |
| 836 | } |
| 837 | |
| 838 | onEditingFinished: { |
| 839 | verifyRegisteredNameSlot() |
| 840 | } |
| 841 | } |
| 842 | |
| 843 | LookupStatusLabel { |
| 844 | id: lookupStatusLabel |
| 845 | |
| 846 | visible:{refreshVariable |
| 847 | var result = registeredIdNeedsSet |
| 848 | && (regNameUi |
| 849 | !== CurrentAccountSettingsScrollPage.BLANK) |
| 850 | return result} |
| 851 | |
| 852 | MouseArea { |
| 853 | id: lookupStatusLabelArea |
| 854 | anchors.fill: parent |
| 855 | property bool isHovering: false |
| 856 | |
| 857 | onEntered: isHovering = true |
| 858 | onExited: isHovering = false |
| 859 | |
| 860 | hoverEnabled: true |
| 861 | } |
| 862 | |
| 863 | ToolTip.visible: lookupStatusLabelArea.isHovering |
| 864 | ToolTip.text: { |
| 865 | switch (regNameUi) { |
| 866 | case CurrentAccountSettingsScrollPage.BLANK: |
| 867 | return qsTr("") |
| 868 | case CurrentAccountSettingsScrollPage.INVALIDFORM: |
| 869 | return qsTr("A registered name should not have any spaces and must be at least three letters long") |
| 870 | case CurrentAccountSettingsScrollPage.TAKEN: |
| 871 | return qsTr("This name is already taken") |
| 872 | case CurrentAccountSettingsScrollPage.FREE: |
| 873 | return qsTr("Register this name") |
| 874 | case CurrentAccountSettingsScrollPage.SEARCHING: |
| 875 | return qsTr("") |
| 876 | default: |
| 877 | return qsTr("") |
| 878 | } |
| 879 | } |
| 880 | |
| 881 | lookupStatusState: { |
| 882 | switch (regNameUi) { |
| 883 | case CurrentAccountSettingsScrollPage.BLANK: |
| 884 | return "Blank" |
| 885 | case CurrentAccountSettingsScrollPage.INVALIDFORM: |
| 886 | return "Invalid" |
| 887 | case CurrentAccountSettingsScrollPage.TAKEN: |
| 888 | return "Taken" |
| 889 | case CurrentAccountSettingsScrollPage.FREE: |
| 890 | return "Free" |
| 891 | case CurrentAccountSettingsScrollPage.SEARCHING: |
| 892 | return "Searching" |
| 893 | default: |
| 894 | return "Blank" |
| 895 | } |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | HoverableRadiusButton { |
| 900 | id: btnRegisterName |
| 901 | |
| 902 | visible: {refreshVariable |
| 903 | var result = registeredIdNeedsSet |
| 904 | && (regNameUi |
| 905 | === CurrentAccountSettingsScrollPage.FREE) |
| 906 | return result} |
| 907 | |
| 908 | Layout.maximumWidth: 80 |
| 909 | Layout.preferredWidth: 80 |
| 910 | Layout.minimumWidth: 80 |
| 911 | |
| 912 | Layout.minimumHeight: 30 |
| 913 | Layout.preferredHeight: 30 |
| 914 | Layout.maximumHeight: 30 |
| 915 | |
| 916 | text: qsTr("Register") |
| 917 | font.pointSize: 10 |
| 918 | font.kerning: true |
| 919 | |
| 920 | radius: height / 2 |
| 921 | } |
| 922 | |
| 923 | Item { |
| 924 | Layout.fillHeight: true |
| 925 | Layout.fillWidth: true |
| 926 | } |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | RowLayout { |
| 931 | spacing: 6 |
| 932 | Layout.fillWidth: true |
| 933 | Layout.maximumHeight: 30 |
| 934 | |
| 935 | Layout.leftMargin: 20 |
| 936 | |
| 937 | HoverableButtonTextItem { |
| 938 | id: passwdPushButton |
| 939 | |
| 940 | visible: ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === "" |
| 941 | |
| 942 | Layout.maximumWidth: 261 |
| 943 | Layout.preferredWidth: 261 |
| 944 | Layout.minimumWidth: 261 |
| 945 | |
| 946 | Layout.minimumHeight: 30 |
| 947 | Layout.preferredHeight: 30 |
| 948 | Layout.maximumHeight: 30 |
| 949 | text: ClientWrapper.accountAdaptor.hasPassword() ? qsTr("Change Password") : qsTr("Set Password") |
| 950 | |
| 951 | font.pointSize: 10 |
| 952 | font.kerning: true |
| 953 | |
| 954 | radius: height / 2 |
| 955 | |
| 956 | onClicked: { |
| 957 | passwordClicked() |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | Item { |
| 962 | Layout.fillHeight: true |
| 963 | Layout.fillWidth: true |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | RowLayout { |
| 968 | spacing: 6 |
| 969 | Layout.fillWidth: true |
| 970 | Layout.maximumHeight: 30 |
| 971 | |
| 972 | Layout.leftMargin: 20 |
| 973 | |
| 974 | HoverableButtonTextItem { |
| 975 | id: btnExportAccount |
| 976 | |
| 977 | visible: ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === "" |
| 978 | |
| 979 | Layout.maximumWidth: 261 |
| 980 | Layout.preferredWidth: 261 |
| 981 | Layout.minimumWidth: 261 |
| 982 | |
| 983 | Layout.minimumHeight: 30 |
| 984 | Layout.preferredHeight: 30 |
| 985 | Layout.maximumHeight: 30 |
| 986 | |
| 987 | text: qsTr("Export Account") |
| 988 | font.pointSize: 10 |
| 989 | font.kerning: true |
| 990 | |
| 991 | radius: height / 2 |
| 992 | |
| 993 | onClicked: { |
| 994 | exportAccountSlot() |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | Item { |
| 999 | Layout.fillHeight: true |
| 1000 | Layout.fillWidth: true |
| 1001 | } |
| 1002 | } |
| 1003 | |
| 1004 | RowLayout { |
| 1005 | spacing: 6 |
| 1006 | Layout.fillWidth: true |
| 1007 | Layout.maximumHeight: 30 |
| 1008 | |
| 1009 | Layout.leftMargin: 20 |
| 1010 | |
| 1011 | HoverableButtonTextItem { |
| 1012 | id: btnDeletAccount |
| 1013 | |
| 1014 | backgroundColor: "red" |
| 1015 | onEnterColor: Qt.rgba(150 / 256, 0, 0, 0.7) |
| 1016 | onDisabledBackgroundColor: Qt.rgba( |
| 1017 | 255 / 256, |
| 1018 | 0, 0, 0.8) |
| 1019 | onPressColor: backgroundColor |
| 1020 | textColor: "white" |
| 1021 | |
| 1022 | Layout.maximumWidth: 261 |
| 1023 | Layout.preferredWidth: 261 |
| 1024 | Layout.minimumWidth: 261 |
| 1025 | |
| 1026 | Layout.minimumHeight: 30 |
| 1027 | Layout.preferredHeight: 30 |
| 1028 | Layout.maximumHeight: 30 |
| 1029 | |
| 1030 | text: qsTr("Delete Account") |
| 1031 | font.pointSize: 10 |
| 1032 | font.kerning: true |
| 1033 | |
| 1034 | radius: height / 2 |
| 1035 | |
| 1036 | onClicked: { |
| 1037 | delAccountSlot() |
| 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | Item { |
| 1042 | Layout.fillHeight: true |
| 1043 | Layout.fillWidth: true |
| 1044 | } |
| 1045 | } |
| 1046 | } |
| 1047 | } |
| 1048 | |
| 1049 | Item { |
| 1050 | Layout.fillWidth: true |
| 1051 | |
| 1052 | Layout.minimumHeight: 20 |
| 1053 | Layout.preferredHeight: 20 |
| 1054 | Layout.maximumHeight: 20 |
| 1055 | } |
| 1056 | |
| 1057 | ColumnLayout { |
| 1058 | Layout.fillWidth: true |
| 1059 | |
| 1060 | Label { |
| 1061 | Layout.fillWidth: true |
| 1062 | |
| 1063 | Layout.maximumHeight: 27 |
| 1064 | Layout.preferredHeight: 27 |
| 1065 | Layout.minimumHeight: 27 |
| 1066 | |
| 1067 | text: qsTr("Linked Device") |
| 1068 | font.pointSize: 13 |
| 1069 | font.kerning: true |
| 1070 | |
| 1071 | horizontalAlignment: Text.AlignLeft |
| 1072 | verticalAlignment: Text.AlignVCenter |
| 1073 | } |
| 1074 | |
| 1075 | Item { |
| 1076 | Layout.fillHeight: true |
| 1077 | |
| 1078 | Layout.maximumWidth: 10 |
| 1079 | Layout.preferredWidth: 10 |
| 1080 | Layout.minimumWidth: 10 |
| 1081 | } |
| 1082 | |
| 1083 | ColumnLayout { |
| 1084 | spacing: 7 |
| 1085 | |
| 1086 | Layout.fillWidth: true |
| 1087 | |
| 1088 | ListViewJami { |
| 1089 | id: settingsListView |
| 1090 | |
| 1091 | Layout.leftMargin: 20 |
| 1092 | |
| 1093 | Layout.fillWidth: true |
| 1094 | |
| 1095 | Layout.minimumWidth: 580 |
| 1096 | Layout.preferredWidth: 605 |
| 1097 | |
| 1098 | Layout.minimumHeight: 164 |
| 1099 | Layout.preferredHeight: 164 |
| 1100 | Layout.maximumHeight: 164 |
| 1101 | |
| 1102 | model: deviceItemListModel |
| 1103 | |
| 1104 | delegate: DeviceItemDelegate{ |
| 1105 | id: settingsListDelegate |
| 1106 | |
| 1107 | width: settingsListView.width |
| 1108 | height: 85 |
| 1109 | |
| 1110 | deviceName : DeviceName |
| 1111 | deviceId: DeviceID |
| 1112 | isCurrent: IsCurrent |
| 1113 | |
| 1114 | onClicked: { |
| 1115 | settingsListView.currentIndex = index |
| 1116 | } |
| 1117 | |
| 1118 | onBtnRemoveDeviceClicked:{ |
| 1119 | removeDeviceSlot(index) |
| 1120 | } |
| 1121 | } |
| 1122 | } |
| 1123 | |
| 1124 | HoverableRadiusButton { |
| 1125 | id: linkDevPushButton |
| 1126 | |
| 1127 | visible: ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === "" |
| 1128 | |
| 1129 | Layout.leftMargin: 20 |
| 1130 | |
| 1131 | Layout.fillWidth: true |
| 1132 | |
| 1133 | Layout.maximumHeight: 30 |
| 1134 | Layout.preferredHeight: 30 |
| 1135 | Layout.minimumHeight: 30 |
| 1136 | |
| 1137 | radius: height / 2 |
| 1138 | |
| 1139 | text: qsTr("+Link Another Device") |
| 1140 | font.pointSize: 10 |
| 1141 | font.kerning: true |
| 1142 | |
| 1143 | onClicked: { |
| 1144 | showLinkDevSlot() |
| 1145 | } |
| 1146 | } |
| 1147 | } |
| 1148 | } |
| 1149 | |
| 1150 | Item { |
| 1151 | Layout.fillWidth: true |
| 1152 | |
| 1153 | Layout.minimumHeight: 20 |
| 1154 | Layout.preferredHeight: 20 |
| 1155 | Layout.maximumHeight: 20 |
| 1156 | } |
| 1157 | |
| 1158 | // banned list view |
| 1159 | ColumnLayout { |
| 1160 | id: bannedContactsLayoutWidget |
| 1161 | |
| 1162 | Layout.fillWidth: true |
| 1163 | spacing: 6 |
| 1164 | |
| 1165 | RowLayout { |
| 1166 | Layout.leftMargin: 9 |
| 1167 | Layout.rightMargin: 8 |
| 1168 | Layout.topMargin: 1 |
| 1169 | |
| 1170 | Layout.fillWidth: true |
| 1171 | Layout.maximumHeight: 30 |
| 1172 | |
| 1173 | Label { |
| 1174 | Layout.preferredWidth: 164 |
| 1175 | Layout.minimumWidth: 164 |
| 1176 | |
| 1177 | Layout.minimumHeight: 30 |
| 1178 | Layout.preferredHeight: 30 |
| 1179 | Layout.maximumHeight: 30 |
| 1180 | |
| 1181 | text: qsTr("Banned Contact") |
| 1182 | font.pointSize: 13 |
| 1183 | font.kerning: true |
| 1184 | |
| 1185 | horizontalAlignment: Text.AlignLeft |
| 1186 | verticalAlignment: Text.AlignVCenter |
| 1187 | } |
| 1188 | |
| 1189 | Item { |
| 1190 | Layout.fillHeight: true |
| 1191 | |
| 1192 | Layout.maximumWidth: 10 |
| 1193 | Layout.preferredWidth: 10 |
| 1194 | Layout.minimumWidth: 10 |
| 1195 | } |
| 1196 | |
| 1197 | HoverableRadiusButton { |
| 1198 | id: bannedContactsBtn |
| 1199 | |
| 1200 | Layout.maximumWidth: 30 |
| 1201 | Layout.preferredWidth: 30 |
| 1202 | Layout.minimumWidth: 30 |
| 1203 | |
| 1204 | Layout.minimumHeight: 30 |
| 1205 | Layout.preferredHeight: 30 |
| 1206 | Layout.maximumHeight: 30 |
| 1207 | |
| 1208 | buttonImageHeight: height |
| 1209 | buttonImageWidth: height |
| 1210 | |
| 1211 | radius: height / 2 |
| 1212 | |
| 1213 | icon.source: bannedContactsListWidget.visible? "qrc:/images/icons/round-arrow_drop_up-24px.svg" : "qrc:/images/icons/round-arrow_drop_down-24px.svg" |
| 1214 | icon.height: 32 |
| 1215 | icon.width: 32 |
| 1216 | |
| 1217 | onClicked: { |
| 1218 | toggleBannedContacts() |
| 1219 | } |
| 1220 | } |
| 1221 | |
| 1222 | Item { |
| 1223 | Layout.fillHeight: true |
| 1224 | Layout.fillWidth: true |
| 1225 | } |
| 1226 | } |
| 1227 | |
| 1228 | ColumnLayout { |
| 1229 | id: bannedContactsListWidget |
| 1230 | |
| 1231 | spacing: 6 |
| 1232 | |
| 1233 | Layout.leftMargin: 9 |
| 1234 | Layout.rightMargin: 8 |
| 1235 | Layout.bottomMargin: 9 |
| 1236 | Item { |
| 1237 | Layout.fillWidth: true |
| 1238 | |
| 1239 | Layout.minimumHeight: 10 |
| 1240 | Layout.preferredHeight: 10 |
| 1241 | Layout.maximumHeight: 10 |
| 1242 | } |
| 1243 | |
| 1244 | ListViewJami { |
| 1245 | id: bannedListWidget |
| 1246 | |
| 1247 | Layout.leftMargin: 20 |
| 1248 | Layout.fillWidth: true |
| 1249 | |
| 1250 | Layout.minimumWidth: 580 |
| 1251 | |
| 1252 | Layout.minimumHeight: 150 |
| 1253 | Layout.preferredHeight: 150 |
| 1254 | Layout.maximumHeight: 150 |
| 1255 | |
| 1256 | model: bannedListModel |
| 1257 | |
| 1258 | delegate: BannedItemDelegate{ |
| 1259 | id: bannedListDelegate |
| 1260 | |
| 1261 | width: bannedListWidget.width |
| 1262 | height: 74 |
| 1263 | |
| 1264 | contactName : ContactName |
| 1265 | contactID: ContactID |
| 1266 | contactPicture_base64: ContactPicture |
| 1267 | |
| 1268 | onClicked: { |
| 1269 | bannedListWidget.currentIndex = index |
| 1270 | } |
| 1271 | |
| 1272 | onBtnReAddContactClicked: { |
| 1273 | unban(index) |
| 1274 | } |
| 1275 | } |
| 1276 | } |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | Item { |
| 1281 | Layout.fillWidth: true |
| 1282 | |
| 1283 | Layout.minimumHeight: 20 |
| 1284 | Layout.preferredHeight: 20 |
| 1285 | Layout.maximumHeight: 20 |
| 1286 | } |
| 1287 | |
| 1288 | RowLayout { |
| 1289 | Layout.fillWidth: true |
| 1290 | |
| 1291 | Layout.minimumHeight: 30 |
| 1292 | Layout.preferredHeight: 30 |
| 1293 | Layout.maximumHeight: 30 |
| 1294 | |
| 1295 | Item { |
| 1296 | Layout.fillWidth: true |
| 1297 | Layout.fillHeight: true |
| 1298 | } |
| 1299 | |
| 1300 | HoverableRadiusButton { |
| 1301 | id: advancedAccountSettingsPButton |
| 1302 | |
| 1303 | Layout.minimumWidth: 180 |
| 1304 | |
| 1305 | Layout.minimumHeight: 30 |
| 1306 | Layout.preferredHeight: 30 |
| 1307 | Layout.maximumHeight: 30 |
| 1308 | |
| 1309 | radius: height / 2 |
| 1310 | |
| 1311 | text: qsTr("Advanced Account Settings") |
| 1312 | font.pointSize: 10 |
| 1313 | font.kerning: true |
| 1314 | |
| 1315 | icon.source: { |
| 1316 | if (advanceSettingsView.visible) { |
| 1317 | return "qrc:/images/icons/round-arrow_drop_up-24px.svg" |
| 1318 | } else { |
| 1319 | return "qrc:/images/icons/round-arrow_drop_down-24px.svg" |
| 1320 | } |
| 1321 | } |
| 1322 | |
| 1323 | icon.height: 24 |
| 1324 | icon.width: 24 |
| 1325 | |
| 1326 | onClicked: { |
| 1327 | advanceSettingsView.visible = !advanceSettingsView.visible |
| 1328 | if (advanceSettingsView.visible) { |
| 1329 | advanceSettingsView.updateAccountInfoDisplayedAdvance() |
| 1330 | var mappedCoor = advancedAccountSettingsPButton.mapToItem(accoutnViewLayout,advancedAccountSettingsPButton.x,advancedAccountSettingsPButton.y) |
| 1331 | accoutScrollView.vScrollBar.position = mappedCoor.y / accoutnViewLayout.height |
| 1332 | } else { |
| 1333 | accoutScrollView.vScrollBar.position = 0 |
| 1334 | } |
| 1335 | } |
| 1336 | } |
| 1337 | |
| 1338 | Item { |
| 1339 | Layout.fillWidth: true |
| 1340 | Layout.fillHeight: true |
| 1341 | } |
| 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | Item { |
| 1346 | Layout.fillWidth: true |
| 1347 | |
| 1348 | Layout.minimumHeight: 48 |
| 1349 | Layout.preferredHeight: 48 |
| 1350 | Layout.maximumHeight: 48 |
| 1351 | } |
| 1352 | |
| 1353 | ColumnLayout { |
| 1354 | spacing: 6 |
| 1355 | Layout.fillHeight: true |
| 1356 | Layout.fillWidth: true |
| 1357 | |
| 1358 | Layout.leftMargin: 30 |
| 1359 | |
| 1360 | // instantiate advance setting page |
| 1361 | AdvancedSettingsView { |
| 1362 | id: advanceSettingsView |
| 1363 | |
| 1364 | Layout.leftMargin: 10 |
| 1365 | visible: false |
| 1366 | } |
| 1367 | } |
| 1368 | } |
| 1369 | } |
| 1370 | |
| 1371 | Item { |
| 1372 | Layout.fillHeight: true |
| 1373 | Layout.fillWidth: true |
| 1374 | } |
| 1375 | } |
| 1376 | } |