Logo Search packages:      
Sourcecode: facturalux version File versions  Download package

void FLFieldDB::initCursor (  )  [slot]

Inicia el cursor segun este campo sea de la tabla origen o de una tabla relacionada

Definition at line 202 of file FLFieldDB.cpp.

References FLSqlCursor::BROWSE, cursor_, cursorAux, cursorAuxInit, cursorInit, fieldRelation(), fieldRelation_, foreignField(), foreignField_, FLManager::metadata(), refresh(), FLTableMetaData::relation(), FLSqlCursor::setModeAccess(), tableName(), and tableName_.

Referenced by setFieldName(), setFieldRelation(), setForeignField(), and setTableName().

{
  if (!cursor_)
      return;

  if (tableName ().isEmpty () || foreignField ().isEmpty () || fieldRelation ().isEmpty ())
      {
         if (!foreignField ().isEmpty () && !fieldRelation ().isEmpty ())
            connect (cursor_, SIGNAL (bufferChanged (QString)), this, SLOT (refresh (QString)));

         if (cursorInit)
            return;
         connect (cursor_, SIGNAL (newBuffer ()), this, SLOT (refresh ()));
         cursorInit = true;
        return;
      }

  if (!cursorAux)
      {
         if (cursorAuxInit)
            return;

        FLTableMetaData *tMD = FLManager::metadata (tableName ());

        if (!tMD)
            return;

        disconnect (cursor_, SIGNAL (newBuffer ()), this, SLOT (refresh ()));
        cursorAux = cursor_;
        cursor_ = new FLSqlCursor (tableName_, true, 0, cursorAux, tMD->relation (fieldRelation_, foreignField_));
        if (!cursor_)
            {
              cursor_ = cursorAux;
              connect (cursor_, SIGNAL (newBuffer ()), this, SLOT (refresh ()));
              cursorAux = 0;
              return;
            }

        if (pushButtonDB)
            pushButtonDB->close ();
        if (textLabelDB)
            textLabelDB->close ();

        cursor_->setModeAccess (FLSqlCursor::BROWSE);
        connect (cursor_, SIGNAL (newBuffer ()), this, SLOT (refresh ()));

          cursorAuxInit = true;
      }
}


Generated by  Doxygen 1.6.0   Back to index