VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/networkmanager/UIDetailsWidgetCloudNetwork.cpp@ 103977

Last change on this file since 103977 was 101563, checked in by vboxsync, 14 months ago

FE/Qt: bugref:10450: Get rid of Qt5 stuff; This one is about signal connection ambiguity stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.4 KB
Line 
1/* $Id: UIDetailsWidgetCloudNetwork.cpp 101563 2023-10-23 23:36:38Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIDetailsWidgetCloudNetwork class implementation.
4 */
5
6/*
7 * Copyright (C) 2009-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28/* Qt includes: */
29#include <QCheckBox>
30#include <QComboBox>
31#include <QFontMetrics>
32#include <QGroupBox>
33#include <QLabel>
34#include <QPushButton>
35#include <QRadioButton>
36#include <QStyleOption>
37#include <QVBoxLayout>
38
39/* GUI includes: */
40#include "QIDialogButtonBox.h"
41#include "QILineEdit.h"
42#include "QITabWidget.h"
43#include "QIToolButton.h"
44#include "UICloudNetworkingStuff.h"
45#include "UIDetailsWidgetCloudNetwork.h"
46#include "UIFormEditorWidget.h"
47#include "UIIconPool.h"
48#include "UIMessageCenter.h"
49#include "UINetworkManager.h"
50#include "UINetworkManagerUtils.h"
51#include "UINotificationCenter.h"
52
53
54UISubnetSelectionDialog::UISubnetSelectionDialog(QWidget *pParent,
55 const QString &strShortProviderName,
56 const QString &strProfileName,
57 const QString &strSubnetId)
58 : QIWithRetranslateUI<QDialog>(pParent)
59 , m_strProviderShortName(strShortProviderName)
60 , m_strProfileName(strProfileName)
61 , m_strSubnetId(strSubnetId)
62 , m_pFormEditor(0)
63 , m_pButtonBox(0)
64 , m_pNotificationCenter(0)
65{
66 prepare();
67}
68
69UISubnetSelectionDialog::~UISubnetSelectionDialog()
70{
71 cleanup();
72}
73
74void UISubnetSelectionDialog::accept()
75{
76 /* Get altered description back: */
77 m_comForm.GetVirtualSystemDescription();
78 QVector<KVirtualSystemDescriptionType> aTypes;
79 QVector<QString> aRefs, aOVFValues, aVBoxValues, aExtraConfigValues;
80 m_comDescription.GetDescriptionByType(KVirtualSystemDescriptionType_CloudOCISubnet,
81 aTypes, aRefs, aOVFValues, aVBoxValues, aExtraConfigValues);
82 if (!m_comDescription.isOk())
83 {
84 UINotificationMessage::cannotAcquireVirtualSystemDescriptionParameter(m_comDescription,
85 m_pNotificationCenter);
86 return;
87 }
88 AssertReturnVoid(!aVBoxValues.isEmpty());
89 m_strSubnetId = aVBoxValues.first();
90
91 /* Call to base-class: */
92 return QIWithRetranslateUI<QDialog>::accept();
93}
94
95int UISubnetSelectionDialog::exec()
96{
97 /* Request to init dialog _after_ being executed: */
98 QMetaObject::invokeMethod(this, "sltInit", Qt::QueuedConnection);
99
100 /* Call to base-class: */
101 return QIWithRetranslateUI<QDialog>::exec();
102}
103
104void UISubnetSelectionDialog::retranslateUi()
105{
106 setWindowTitle(UINetworkManager::tr("Select Subnet"));
107}
108
109void UISubnetSelectionDialog::sltInit()
110{
111 /* Create description: */
112 m_comDescription = createVirtualSystemDescription(m_pNotificationCenter);
113 if (m_comDescription.isNull())
114 return;
115 /* Update it with current subnet value: */
116 m_comDescription.AddDescription(KVirtualSystemDescriptionType_CloudOCISubnet, m_strSubnetId, QString());
117
118 /* Create cloud client: */
119 CCloudClient comCloudClient = cloudClientByName(m_strProviderShortName, m_strProfileName, m_pNotificationCenter);
120 if (comCloudClient.isNull())
121 return;
122
123 /* Create subnet selection VSD form: */
124 UINotificationProgressSubnetSelectionVSDFormCreate *pNotification = new UINotificationProgressSubnetSelectionVSDFormCreate(comCloudClient,
125 m_comDescription,
126 m_strProviderShortName,
127 m_strProfileName);
128 connect(pNotification, &UINotificationProgressSubnetSelectionVSDFormCreate::sigVSDFormCreated,
129 this, &UISubnetSelectionDialog::sltHandleVSDFormCreated);
130 m_pNotificationCenter->append(pNotification);
131}
132
133void UISubnetSelectionDialog::sltHandleVSDFormCreated(const CVirtualSystemDescriptionForm &comForm)
134{
135 m_comForm = comForm;
136 m_pFormEditor->setVirtualSystemDescriptionForm(m_comForm);
137}
138
139void UISubnetSelectionDialog::prepare()
140{
141 /* Prepare main layout: */
142 QVBoxLayout *pLayoutMain = new QVBoxLayout(this);
143 if (pLayoutMain)
144 {
145 /* Prepare form editor: */
146 m_pFormEditor = new UIFormEditorWidget(this);
147 if (m_pFormEditor)
148 pLayoutMain->addWidget(m_pFormEditor);
149
150 /* Prepare button-box: */
151 m_pButtonBox = new QIDialogButtonBox(this);
152 if (m_pButtonBox)
153 {
154 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
155 connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &QDialog::accept);
156 connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &QDialog::reject);
157
158 pLayoutMain->addWidget(m_pButtonBox);
159 }
160 }
161
162 /* Prepare local notification-center: */
163 m_pNotificationCenter = new UINotificationCenter(this);
164 if (m_pNotificationCenter && m_pFormEditor)
165 m_pFormEditor->setNotificationCenter(m_pNotificationCenter);
166
167 /* Apply language settings: */
168 retranslateUi();
169}
170
171void UISubnetSelectionDialog::cleanup()
172{
173 /* Cleanup local notification-center: */
174 delete m_pNotificationCenter;
175 m_pNotificationCenter = 0;
176}
177
178
179UIDetailsWidgetCloudNetwork::UIDetailsWidgetCloudNetwork(EmbedTo enmEmbedding, QWidget *pParent /* = 0 */)
180 : QIWithRetranslateUI<QWidget>(pParent)
181 , m_enmEmbedding(enmEmbedding)
182 , m_pLabelNetworkName(0)
183 , m_pEditorNetworkName(0)
184 , m_pLabelProviderName(0)
185 , m_pComboProviderName(0)
186 , m_pLabelProfileName(0)
187 , m_pComboProfileName(0)
188 , m_pLabelNetworkId(0)
189 , m_pEditorNetworkId(0)
190 , m_pButtonNetworkId(0)
191 , m_pButtonBoxOptions(0)
192{
193 prepare();
194}
195
196void UIDetailsWidgetCloudNetwork::setData(const UIDataCloudNetwork &data,
197 const QStringList &busyNames /* = QStringList() */)
198{
199 /* Cache old/new data: */
200 m_oldData = data;
201 m_newData = m_oldData;
202 m_busyNames = busyNames;
203
204 /* Load data: */
205 loadData();
206}
207
208bool UIDetailsWidgetCloudNetwork::revalidate() const
209{
210 /* Make sure network name isn't empty: */
211 if (m_newData.m_strName.isEmpty())
212 {
213 UINotificationMessage::warnAboutNoNameSpecified(m_oldData.m_strName);
214 return false;
215 }
216 else
217 {
218 /* Make sure item names are unique: */
219 if (m_busyNames.contains(m_newData.m_strName))
220 {
221 UINotificationMessage::warnAboutNameAlreadyBusy(m_newData.m_strName);
222 return false;
223 }
224 }
225
226 return true;
227}
228
229void UIDetailsWidgetCloudNetwork::updateButtonStates()
230{
231// if (m_oldData != m_newData)
232// printf("Network: %s, %s, %s, %d, %d, %d\n",
233// m_newData.m_strName.toUtf8().constData(),
234// m_newData.m_strPrefixIPv4.toUtf8().constData(),
235// m_newData.m_strPrefixIPv6.toUtf8().constData(),
236// m_newData.m_fSupportsDHCP,
237// m_newData.m_fSupportsIPv6,
238// m_newData.m_fAdvertiseDefaultIPv6Route);
239
240 /* Update 'Apply' / 'Reset' button states: */
241 if (m_pButtonBoxOptions)
242 {
243 m_pButtonBoxOptions->button(QDialogButtonBox::Cancel)->setEnabled(m_oldData != m_newData);
244 m_pButtonBoxOptions->button(QDialogButtonBox::Ok)->setEnabled(m_oldData != m_newData);
245 }
246
247 /* Notify listeners as well: */
248 emit sigDataChanged(m_oldData != m_newData);
249}
250
251void UIDetailsWidgetCloudNetwork::retranslateUi()
252{
253 if (m_pLabelNetworkName)
254 m_pLabelNetworkName->setText(UINetworkManager::tr("N&ame:"));
255 if (m_pEditorNetworkName)
256 m_pEditorNetworkName->setToolTip(UINetworkManager::tr("Holds the name for this network."));
257 if (m_pLabelProviderName)
258 m_pLabelProviderName->setText(UINetworkManager::tr("&Provider:"));
259 if (m_pComboProviderName)
260 m_pComboProviderName->setToolTip(UINetworkManager::tr("Holds the cloud provider for this network."));
261 if (m_pLabelProfileName)
262 m_pLabelProfileName->setText(UINetworkManager::tr("P&rofile:"));
263 if (m_pComboProfileName)
264 m_pComboProfileName->setToolTip(UINetworkManager::tr("Holds the cloud profile for this network."));
265 if (m_pLabelNetworkId)
266 m_pLabelNetworkId->setText(UINetworkManager::tr("&Id:"));
267 if (m_pEditorNetworkId)
268 m_pEditorNetworkId->setToolTip(UINetworkManager::tr("Holds the id for this network."));
269 if (m_pButtonNetworkId)
270 m_pButtonNetworkId->setToolTip(UINetworkManager::tr("Selects the id for this network."));
271 if (m_pButtonBoxOptions)
272 {
273 m_pButtonBoxOptions->button(QDialogButtonBox::Cancel)->setText(UINetworkManager::tr("Reset"));
274 m_pButtonBoxOptions->button(QDialogButtonBox::Ok)->setText(UINetworkManager::tr("Apply"));
275 m_pButtonBoxOptions->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape);
276 m_pButtonBoxOptions->button(QDialogButtonBox::Ok)->setShortcut(QString("Ctrl+Return"));
277 m_pButtonBoxOptions->button(QDialogButtonBox::Cancel)->setStatusTip(UINetworkManager::tr("Reset changes in current "
278 "interface details"));
279 m_pButtonBoxOptions->button(QDialogButtonBox::Ok)->setStatusTip(UINetworkManager::tr("Apply changes in current "
280 "interface details"));
281 m_pButtonBoxOptions->button(QDialogButtonBox::Cancel)->
282 setToolTip(UINetworkManager::tr("Reset Changes (%1)").arg(m_pButtonBoxOptions->button(QDialogButtonBox::Cancel)->shortcut().toString()));
283 m_pButtonBoxOptions->button(QDialogButtonBox::Ok)->
284 setToolTip(UINetworkManager::tr("Apply Changes (%1)").arg(m_pButtonBoxOptions->button(QDialogButtonBox::Ok)->shortcut().toString()));
285 }
286}
287
288void UIDetailsWidgetCloudNetwork::sltNetworkNameChanged(const QString &strText)
289{
290 m_newData.m_strName = strText;
291 updateButtonStates();
292}
293
294void UIDetailsWidgetCloudNetwork::sltCloudProviderNameChanged(int iIndex)
295{
296 /* Store provider: */
297 m_newData.m_strProvider = m_pComboProviderName->itemData(iIndex).toString();
298
299 /* Update profiles: */
300 prepareProfiles();
301 /* And store selected profile: */
302 sltCloudProfileNameChanged(m_pComboProfileName->currentIndex());
303
304 /* Update button states finally: */
305 updateButtonStates();
306}
307
308void UIDetailsWidgetCloudNetwork::sltCloudProfileNameChanged(int iIndex)
309{
310 /* Store profile: */
311 m_newData.m_strProfile = m_pComboProfileName->itemData(iIndex).toString();
312
313 /* Update button states finally: */
314 updateButtonStates();
315}
316
317void UIDetailsWidgetCloudNetwork::sltNetworkIdChanged(const QString &strText)
318{
319 m_newData.m_strId = strText;
320 updateButtonStates();
321}
322
323void UIDetailsWidgetCloudNetwork::sltNetworkIdListRequested()
324{
325 /* Create subnet selection dialog: */
326 QPointer<UISubnetSelectionDialog> pDialog = new UISubnetSelectionDialog(this,
327 m_pComboProviderName->currentData().toString(),
328 m_pComboProfileName->currentData().toString(),
329 m_pEditorNetworkId->text());
330
331 /* Execute dialog to ask user for subnet: */
332 if (pDialog->exec() == QDialog::Accepted)
333 m_pEditorNetworkId->setText(pDialog->subnetId());
334
335 /* Cleanup subnet dialog finally: */
336 delete pDialog;
337}
338
339void UIDetailsWidgetCloudNetwork::sltHandleButtonBoxClick(QAbstractButton *pButton)
340{
341 /* Make sure button-box exist: */
342 if (!m_pButtonBoxOptions)
343 return;
344
345 /* Disable buttons first of all: */
346 m_pButtonBoxOptions->button(QDialogButtonBox::Cancel)->setEnabled(false);
347 m_pButtonBoxOptions->button(QDialogButtonBox::Ok)->setEnabled(false);
348
349 /* Compare with known buttons: */
350 if (pButton == m_pButtonBoxOptions->button(QDialogButtonBox::Cancel))
351 emit sigDataChangeRejected();
352 else
353 if (pButton == m_pButtonBoxOptions->button(QDialogButtonBox::Ok))
354 emit sigDataChangeAccepted();
355}
356
357void UIDetailsWidgetCloudNetwork::prepare()
358{
359 /* Prepare everything: */
360 prepareThis();
361 prepareProviders();
362 prepareProfiles();
363
364 /* Apply language settings: */
365 retranslateUi();
366
367 /* Update button states finally: */
368 updateButtonStates();
369}
370
371void UIDetailsWidgetCloudNetwork::prepareThis()
372{
373 /* Prepare options widget layout: */
374 QGridLayout *pLayout = new QGridLayout(this);
375 if (pLayout)
376 {
377#ifdef VBOX_WS_MAC
378 pLayout->setSpacing(10);
379 pLayout->setContentsMargins(10, 10, 10, 10);
380#endif
381
382 /* Prepare network name label: */
383 m_pLabelNetworkName = new QLabel(this);
384 if (m_pLabelNetworkName)
385 {
386 m_pLabelNetworkName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
387 pLayout->addWidget(m_pLabelNetworkName, 0, 0);
388 }
389 /* Prepare network name editor: */
390 m_pEditorNetworkName = new QLineEdit(this);
391 if (m_pEditorNetworkName)
392 {
393 if (m_pLabelNetworkName)
394 m_pLabelNetworkName->setBuddy(m_pEditorNetworkName);
395 connect(m_pEditorNetworkName, &QLineEdit::textEdited,
396 this, &UIDetailsWidgetCloudNetwork::sltNetworkNameChanged);
397 pLayout->addWidget(m_pEditorNetworkName, 0, 1, 1, 2);
398 }
399
400 /* Prepare cloud provider name label: */
401 m_pLabelProviderName = new QLabel(this);
402 if (m_pLabelProviderName)
403 {
404 m_pLabelProviderName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
405 pLayout->addWidget(m_pLabelProviderName, 1, 0);
406 }
407 /* Prepare cloud provider name combo: */
408 m_pComboProviderName = new QComboBox(this);
409 if (m_pComboProviderName)
410 {
411 if (m_pLabelProviderName)
412 m_pLabelProviderName->setBuddy(m_pComboProviderName);
413 connect(m_pComboProviderName, &QComboBox::currentIndexChanged,
414 this, &UIDetailsWidgetCloudNetwork::sltCloudProviderNameChanged);
415 pLayout->addWidget(m_pComboProviderName, 1, 1, 1, 2);
416 }
417
418 /* Prepare cloud profile name label: */
419 m_pLabelProfileName = new QLabel(this);
420 if (m_pLabelProfileName)
421 {
422 m_pLabelProfileName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
423 pLayout->addWidget(m_pLabelProfileName, 2, 0);
424 }
425 /* Prepare cloud profile name combo: */
426 m_pComboProfileName = new QComboBox(this);
427 if (m_pComboProfileName)
428 {
429 if (m_pLabelProfileName)
430 m_pLabelProfileName->setBuddy(m_pComboProfileName);
431 connect(m_pComboProfileName, &QComboBox::currentIndexChanged,
432 this, &UIDetailsWidgetCloudNetwork::sltCloudProfileNameChanged);
433 pLayout->addWidget(m_pComboProfileName, 2, 1, 1, 2);
434 }
435
436 /* Prepare network id label: */
437 m_pLabelNetworkId = new QLabel(this);
438 if (m_pLabelNetworkId)
439 {
440 m_pLabelNetworkId->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
441 pLayout->addWidget(m_pLabelNetworkId, 3, 0);
442 }
443 /* Prepare network id editor: */
444 m_pEditorNetworkId = new QLineEdit(this);
445 if (m_pEditorNetworkId)
446 {
447 if (m_pLabelNetworkId)
448 m_pLabelNetworkId->setBuddy(m_pEditorNetworkId);
449 connect(m_pEditorNetworkId, &QLineEdit::textChanged,
450 this, &UIDetailsWidgetCloudNetwork::sltNetworkIdChanged);
451 pLayout->addWidget(m_pEditorNetworkId, 3, 1);
452 }
453 /* Prepare network id button: */
454 m_pButtonNetworkId = new QIToolButton(this);
455 if (m_pButtonNetworkId)
456 {
457 m_pButtonNetworkId->setIcon(UIIconPool::iconSet(":/subnet_16px.png"));
458 connect(m_pButtonNetworkId, &QIToolButton::clicked,
459 this, &UIDetailsWidgetCloudNetwork::sltNetworkIdListRequested);
460 pLayout->addWidget(m_pButtonNetworkId, 3, 2);
461 }
462
463 /* If parent embedded into stack: */
464 if (m_enmEmbedding == EmbedTo_Stack)
465 {
466 /* Prepare button-box: */
467 m_pButtonBoxOptions = new QIDialogButtonBox(this);
468 if (m_pButtonBoxOptions)
469 {
470 m_pButtonBoxOptions->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
471 connect(m_pButtonBoxOptions, &QIDialogButtonBox::clicked, this, &UIDetailsWidgetCloudNetwork::sltHandleButtonBoxClick);
472 pLayout->addWidget(m_pButtonBoxOptions, 4, 0, 1, 2);
473 }
474 }
475 }
476}
477
478void UIDetailsWidgetCloudNetwork::prepareProviders()
479{
480 /* Sanity check: */
481 AssertPtrReturnVoid(m_pComboProviderName);
482
483 /* Remember current item data to be able to restore it: */
484 QString strOldData;
485 if (m_pComboProviderName->currentIndex() != -1)
486 strOldData = m_pComboProviderName->currentData().toString();
487
488 /* Block signals while updating: */
489 m_pComboProviderName->blockSignals(true);
490
491 /* Clear combo initially: */
492 m_pComboProviderName->clear();
493
494 /* Add empty item: */
495 m_pComboProviderName->addItem("--");
496
497 /* Iterate through existing providers: */
498 foreach (const CCloudProvider &comProvider, listCloudProviders())
499 {
500 /* Skip if we have nothing to populate (file missing?): */
501 if (comProvider.isNull())
502 continue;
503 /* Acquire provider name: */
504 QString strProviderName;
505 if (!cloudProviderName(comProvider, strProviderName))
506 continue;
507 /* Acquire provider short name: */
508 QString strProviderShortName;
509 if (!cloudProviderShortName(comProvider, strProviderShortName))
510 continue;
511
512 /* Compose empty item, fill the data: */
513 m_pComboProviderName->addItem(strProviderName);
514 m_pComboProviderName->setItemData(m_pComboProviderName->count() - 1, strProviderShortName);
515 }
516
517 /* Set previous/default item if possible: */
518 int iNewIndex = -1;
519 if ( iNewIndex == -1
520 && !strOldData.isNull())
521 iNewIndex = m_pComboProviderName->findData(strOldData);
522 if ( iNewIndex == -1
523 && m_pComboProviderName->count() > 0)
524 iNewIndex = 0;
525 if (iNewIndex != -1)
526 m_pComboProviderName->setCurrentIndex(iNewIndex);
527
528 /* Unblock signals after update: */
529 m_pComboProviderName->blockSignals(false);
530}
531
532void UIDetailsWidgetCloudNetwork::prepareProfiles()
533{
534 /* Sanity check: */
535 AssertPtrReturnVoid(m_pComboProfileName);
536
537 /* Remember current item data to be able to restore it: */
538 QString strOldData;
539 if (m_pComboProfileName->currentIndex() != -1)
540 strOldData = m_pComboProfileName->currentData().toString();
541
542 /* Block signals while updating: */
543 m_pComboProfileName->blockSignals(true);
544
545 /* Clear combo initially: */
546 m_pComboProfileName->clear();
547
548 /* Add empty item: */
549 m_pComboProfileName->addItem("--");
550
551 /* Acquire provider short name: */
552 const QString strProviderShortName = m_pComboProviderName->currentData().toString();
553 if (!strProviderShortName.isEmpty())
554 {
555 /* Acquire provider: */
556 CCloudProvider comProvider = cloudProviderByShortName(strProviderShortName);
557 if (comProvider.isNotNull())
558 {
559 /* Iterate through existing profiles: */
560 foreach (const CCloudProfile &comProfile, listCloudProfiles(comProvider))
561 {
562 /* Skip if we have nothing to populate (wtf happened?): */
563 if (comProfile.isNull())
564 continue;
565 /* Acquire current profile name: */
566 QString strProfileName;
567 if (!cloudProfileName(comProfile, strProfileName))
568 continue;
569
570 /* Compose item, fill the data: */
571 m_pComboProfileName->addItem(strProfileName);
572 m_pComboProfileName->setItemData(m_pComboProfileName->count() - 1, strProfileName);
573 }
574
575 /* Set previous/default item if possible: */
576 int iNewIndex = -1;
577 if ( iNewIndex == -1
578 && !strOldData.isNull())
579 iNewIndex = m_pComboProfileName->findData(strOldData);
580 if ( iNewIndex == -1
581 && m_pComboProfileName->count() > 0)
582 iNewIndex = 0;
583 if (iNewIndex != -1)
584 m_pComboProfileName->setCurrentIndex(iNewIndex);
585 }
586 }
587
588 /* Unblock signals after update: */
589 m_pComboProfileName->blockSignals(false);
590}
591
592void UIDetailsWidgetCloudNetwork::loadData()
593{
594 /* Check whether network exists and enabled: */
595 const bool fIsNetworkExists = m_newData.m_fExists;
596
597 /* Update field availability: */
598 m_pLabelNetworkName->setEnabled(fIsNetworkExists);
599 m_pEditorNetworkName->setEnabled(fIsNetworkExists);
600 m_pLabelProviderName->setEnabled(fIsNetworkExists);
601 m_pComboProviderName->setEnabled(fIsNetworkExists);
602 m_pLabelProfileName->setEnabled(fIsNetworkExists);
603 m_pComboProfileName->setEnabled(fIsNetworkExists);
604 m_pLabelNetworkId->setEnabled(fIsNetworkExists);
605 m_pEditorNetworkId->setEnabled(fIsNetworkExists);
606 m_pButtonNetworkId->setEnabled(fIsNetworkExists);
607
608 /* Load fields: */
609 m_pEditorNetworkName->setText(m_newData.m_strName);
610 const int iProviderIndex = m_pComboProviderName->findData(m_newData.m_strProvider);
611 m_pComboProviderName->setCurrentIndex(iProviderIndex == -1 ? 0 : iProviderIndex);
612 const int iProfileIndex = m_pComboProfileName->findData(m_newData.m_strProfile);
613 m_pComboProfileName->setCurrentIndex(iProfileIndex == -1 ? 0 : iProfileIndex);
614 m_pEditorNetworkId->setText(m_newData.m_strId);
615}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette