- // Select the first entry in the list view.
- domainsListViewPointer->setCurrentIndex(domainsTableModelPointer->index(0, domainsTableModelPointer->fieldIndex(DomainsDatabaseHelper::DOMAIN_NAME)));
+ // Get the default palette.
+ defaultPalette = javaScriptWidgetPointer->palette();
+
+ // Populate the highlighted palette.
+ highlightedPalette = defaultPalette;
+
+ // Get the default highlight color.
+ QColor highlightColor = defaultPalette.color(QPalette::Highlight);
+
+ // Set the highlight color to be partially transparent.
+ highlightColor.setAlpha(64);
+
+ // Set highlighted background color.
+ highlightedPalette.setColor(QPalette::Window, highlightColor);
+
+ // Setup the dialog according to the start type.
+ switch (startType)
+ {
+ case SHOW_ALL_DOMAINS:
+ {
+ // Select the first entry in the list view.
+ domainsListViewPointer->setCurrentIndex(domainsTableModelPointer->index(0, domainsTableModelPointer->fieldIndex(DomainsDatabase::DOMAIN_NAME)));
+
+ break;
+ }
+
+ case EDIT_DOMAIN:
+ {
+ // Find the index for the new domain. `1` returns the first match.
+ QModelIndexList newDomainIndex = domainsTableModelPointer->match(domainsTableModelPointer->index(0, domainsTableModelPointer->fieldIndex(DomainsDatabase::DOMAIN_NAME)),
+ Qt::DisplayRole, domainName, 1, Qt::MatchWrap);
+
+ // Move to the new domain.
+ domainsListViewPointer->setCurrentIndex(newDomainIndex[0]);
+
+ break;
+ }
+ }