MCPcopy Create free account
hub / github.com/KDE/labplot / checkOkButton

Method checkOkButton

src/frontend/datasources/ImportSQLDatabaseDialog.cpp:130–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void ImportSQLDatabaseDialog::checkOkButton() {
131 DEBUG("ImportSQLDatabaseDialog::checkOkButton()");
132
133 AbstractAspect* aspect = static_cast<AbstractAspect*>(cbAddTo->currentModelIndex().internalPointer());
134 if (!aspect) {
135 okButton->setEnabled(false);
136 okButton->setToolTip(i18n("Select a data container where the data has to be imported into."));
137 cbPosition->setEnabled(false);
138 return;
139 }
140
141 // check whether a valid connection and an object to import were selected
142 if (!importSQLDatabaseWidget->isValid()) {
143 okButton->setEnabled(false);
144 okButton->setToolTip(i18n("Select a valid database object (table or query result set) that has to be imported."));
145 cbPosition->setEnabled(false);
146 return;
147 }
148
149 // for matrix containers allow to import only numerical data
150 if (dynamic_cast<const Matrix*>(aspect) && !importSQLDatabaseWidget->isNumericData()) {
151 okButton->setEnabled(false);
152 okButton->setToolTip(i18n("Cannot import into a matrix since the data contains non-numerical data."));
153 cbPosition->setEnabled(false);
154 return;
155 }
156
157 okButton->setEnabled(true);
158 okButton->setToolTip(i18n("Close the dialog and import the data."));
159 cbPosition->setEnabled(true);
160}

Callers

nothing calls this directly

Calls 5

currentModelIndexMethod · 0.80
setToolTipMethod · 0.80
isNumericDataMethod · 0.80
setEnabledMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected