//! Removes all items from the checked in table. void wndInventoryCheck::resetInventoryCheck( void ) { if ( QMessageBox::question( this, "Inventory Information: Confirm Reset", "Are you sure you would like to reset the inventory check?", QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { QSqlQuery qryDelete( "DELETE FROM inventorycheck WHERE 1=1" ); _pDB->query( qryDelete ); QSqlQuery copyQuery; // If the filter category is all, do not condition SELECT query if ( _pUI->cmbCategory->currentText() == "[All]" ) { copyQuery.prepare( "INSERT INTO inventorycheck (iid,name,description,category,checked)" "SELECT id,name,description,category,0 FROM inventory" ); } else // Otherwise, append the filter text to a condition in the query { copyQuery.prepare( "INSERT INTO inventorycheck (iid,name,description,category,checked)" "SELECT id,name,description,category,0 FROM inventory WHERE inventory.category=?" ); copyQuery.addBindValue( _pUI->cmbCategory->currentText() ); } if ( !_pDB->query( copyQuery ) ) { QMessageBox::warning( this, "Inventory Error", "Could not copy inventory into check table. See log for more information." ); qWarning( "Inventory Error: Could not copy inventory into check table. Database Error: %s", qPrintable( copyQuery.lastError().text() ) ); } refreshTables(); } }
/*! \param pDB Pointer to the database manager. */ wndInventoryCheck::wndInventoryCheck( QWidget *pParent, DatabaseManager *pDB ) : QMainWindow( pParent ), _pUI( new Ui::wndInventoryCheck ) { _pUI->setupUi(this); _pDB = pDB; populateCategory(); refreshTables(); }
void UAreaResultsTable::converterDeleteNote(int row) { QTableWidgetItem *item = tableRecycleBin->item(row, indexMainColumn); if(item) { QString nameFile = item->data(pointerOnDataItemNote).value<QString>(); emit deleteNote(nameFile); emit refreshTables(); } }
void UAreaResultsTable::converterHideNote() { QTableWidgetItem *currentItem = tableNotes->item(tableNotes->currentRow(), indexMainColumn); if(currentItem) { Note *note = currentItem->data(pointerOnDataItemNote).value<Note*>(); emit hideNote(note); emit refreshTables(); } }
bool SociContainer::connect(StdString const &oConnectString) { StdString con = getConnectString(); if(oConnectString.length() > 0) { if(con != oConnectString) { disconnect(); con = oConnectString; } } if(mSession != NULL) // Same connect string and session already exists. return true; if(con.length() == 0) return false; setConnectString(con); bool rc = true; Progress prg("Connecting to database"); prg->setLabelText("Connecting to database ..."); prg->setMaximum(prg->maximum()+1); QApplication::processEvents(); StdString connectStr = sociConnectString(con); try { mSession = new soci::session(sociFactory(), connectStr); mSociConnectString = connectStr; refreshTables(); } catch(std::runtime_error const &e) { mSociConnectString = ""; ErrorMessage(spt::logging::LoggingItem::LOG_ERROR, MODULENAME, e.what()); rc = false; } prg->setValue(prg->value()+1); return rc; }
SqlPlotChart::SqlPlotChart(QSqlDatabase *database, QWidget *parent, const QString &defaultName) : QDialog(parent), ui(new Ui::SqlPlotChart), m_database(database) { ui->setupUi(this); ui->tableComboBox->lineEdit()->setText(defaultName); if (database->driverName() == "QSQLITE") { QFileInfo info(database->databaseName()); setWindowTitle(QString("Plot : ") + info.completeBaseName()); } else { setWindowTitle(QString("Plot : ") + database->databaseName()); } ui->sqlFilter->setDatabase(m_database); ui->binSpinBox->setDisabled(true); connect(ui->sqlFilter, SIGNAL(returnPressed()), ui->plotButton, SLOT(click())); refreshTables(); }
//! Removes all items from the checked in table. void wndInventoryCheck::itemScanned( void ) { QSqlQuery updateQuery; updateQuery.prepare( "UPDATE inventorycheck SET checked=1 WHERE id=?" ); updateQuery.addBindValue( _pUI->txtScanID->text() ); if ( _pDB->query( updateQuery ) ) { if ( updateQuery.numRowsAffected() == 1 ) { refreshTables(); } else { QMessageBox::information( this, "Inventory Information", "Item with ID " + _pUI->txtScanID->text() + " not found in not-checked list." ); } } else { QMessageBox::warning( this, "Inventory Error", "There was a problem checking this item into inventory. See log for more information." ); } _pUI->txtScanID->clear(); _pUI->txtScanID->setFocus(); }