void MapViewer::updateViewer(bool isForward) { if ( isForward ) { if (actionData[currentRecord]){ addMarker(currentRecord); } currentRecord != 0 ? addLine(currentRecord) : removeAllLines(); } else { if (actionData[currentRecord]){ removeMarker(currentRecord); } currentRecord != recordCounter - 1 ? removeLine(currentRecord) : addAllLines(); } }
//============================================================================= // Load the detail communication information of the person. //============================================================================= void CCommunication::loadData (QString id, bool readonly) { QString DBnull = "?", tip; unsigned int row = 0; //---------------------------------------------------------------------------- // Disconnect the slots during data load. //---------------------------------------------------------------------------- removeAllLines(); slotAddLine(); disconnectSlots(); //---------------------------------------------------------------------------- // Load the communication types. //---------------------------------------------------------------------------- QSqlQuery query ("SELECT comm_id, type, number, created, last_modified " "FROM contacts_communications " "WHERE person_id = " + id + " ORDER BY type"); if (!query.isActive()) { SHOW_DB_ERROR(tr ("Error during database query"), query); return; } while (query.next()) { if (row >= mLine.count()) { slotAddLine(); disconnectSlots(); } mIDs << query.value(0).toString(); mLine.at(row)->setID (query.value(0).toString()); mLine.at(row)->setType (query.value(1).toInt()); mLine.at(row)->setValue (query.value(2).toString()); mLine.at(row)->setToolTip (tr ("Created:\t\t\t") + formatDateTime (query.value(3).toString()) + tr ("\nLast Modified:\t\t") + formatDateTime (query.value(4).toString())); mLine.at(row)->setChanged (false); row++; } //---------------------------------------------------------------------------- // Store the ID of the currently loaded person. //---------------------------------------------------------------------------- mCurrent = id; mReadonly = readonly; //---------------------------------------------------------------------------- // Connect the slots after data load is complete. //---------------------------------------------------------------------------- connectSlots(); setReadonly (readonly); emit contentLoaded (true); emit contentChanged (false); }
void MapViewer::onCleanMapPressed() { removeAllLines(); }