void BookmarkGui::fillFavoriteInfo( const QString& id , const QString& Id_f ) { this->fillFavoriteInfo( id ) ; this->current_favorite_id = Id_f ; Bookmark bk ; QueryResult res ; bk.getComment( res , Id_f ) ; if ( res.empty() ) ui->Comments->setHtml( "" ) ; else ui->Comments->setHtml( res.getField(0,0) ) ; ui->SaveComment->setDisabled( true ); res.clear() ; bk.getState( res , Id_f ) ; if ( !res.empty() ) { int index = ui->State->findText( res.getField(0,0) ) ; ui->State->setCurrentIndex( index ); } else ui->State->setCurrentIndex( 0 ); res.clear() ; bk.getEvaluation( res , Id_f ) ; if ( !res.empty() ) { int index = ui->Evaluation->findData( res.getField(0,0) ) ; ui->Evaluation->setCurrentIndex( index ); } else ui->Evaluation->setCurrentIndex( 0 ); }
bool LeScienze500::fillQListWidget( QListWidget *w_list , QueryResult &r_list ) { if ( r_list.empty() ) return false ; w_list->clear(); QString col_name = r_list.getFirstColumnName() ; QueryResult::iterator it; for( it = r_list.begin() ; it < r_list.end() ; it++ ) { w_list->addItem( r_list.getField( col_name , it ) ); } return true ; }
bool Bookmark::getEvaluation( QueryResult& query_r , QString favorite_id ) { if ( favorite_id.isEmpty() ) return false ; QString query ; query = "select Evaluation from Evaluations where Id in ( " ; query += " select IdEvaluation from Evaluations_BookmarkEntries where " ; query += " IdBookmarkEntry = " ; query += favorite_id ; query += " ) " ; this->execQuery( query , query_r ) ; if ( query_r.empty() ) return false ; else return true ; }
bool Bookmark::getState( QueryResult& query_r , QString favorite_id ) { if ( favorite_id.isEmpty() ) return false ; QString query ; query = "select StateName from UserStates where Id in ( " ; query += " select IdUserState from UserStates_BookmarkEntries where " ; query += " IdBookmarkEntry = " ; query += favorite_id ; query += " ) " ; this->execQuery( query , query_r ) ; if ( query_r.empty() ) return false ; else return true ; }
bool Bookmark::getComment( QueryResult& query_r , QString favorite_id ) { if ( favorite_id.isEmpty() ) return false ; query_r.clear(); QString query ; query = "select Comment from Comments where Id in ( " ; query += " select IdComment from Comments_BookmarkEntries where " ; query += " IdBookmarkEntry = " ; query += favorite_id ; query += " ) " ; this->execQuery( query , query_r ) ; if ( query_r.empty() ) return false ; else return true ; }
bool Bookmark::getFavoritesByEvaluation( QueryResult& query_r , const QString& stars ) { if ( stars.isEmpty() ) return false ; QString query ; query = " select * from BookmarkEntries where Id in ( select IdBookmarkEntry " ; query += " from Evaluations_BookmarkEntries where IdEvaluation in " ; query += " ( select Id from Evaluations where Evaluation = " ; query += stars ; query += " ) ) " ; this->execQuery( query , query_r ) ; qDebug() << query ; if ( query_r.empty() ) return false ; else return true ; }
bool Bookmark::getFavoritesByState( QueryResult& query_r , const QString& state_name ) { if ( state_name.isEmpty() ) return false ; QString query ; query = " select * from BookmarkEntries where Id in ( select IdBookmarkEntry " ; query += " from UserStates_BookmarkEntries where IdUserState in " ; query += " ( select Id from UserStates where StateName = \"" ; query += state_name ; query += "\" ) ) " ; this->execQuery( query , query_r ) ; qDebug() << query ; if ( query_r.empty() ) return false ; else return true ; }