| 128 | } |
| 129 | |
| 130 | void 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 | } |
nothing calls this directly
no test coverage detected