src/versit/qversitwriter.cpp
changeset 5 603d3f8b6302
parent 0 876b1a06bc25
equal deleted inserted replaced
3:e4ebb16b39ea 5:603d3f8b6302
    52 
    52 
    53 /*!
    53 /*!
    54   \class QVersitWriter
    54   \class QVersitWriter
    55   \brief The QVersitWriter class writes Versit documents such as vCards to a device.
    55   \brief The QVersitWriter class writes Versit documents such as vCards to a device.
    56   \ingroup versit
    56   \ingroup versit
       
    57   \inmodule QtVersit
    57 
    58 
    58   QVersitWriter converts a QVersitDocument into its textual representation.
    59   QVersitWriter converts a QVersitDocument into its textual representation.
    59   QVersitWriter supports writing to an abstract I/O device
    60   QVersitWriter supports writing to an abstract I/O device
    60   which can be for example a file or a memory buffer.
    61   which can be for example a file or a memory buffer.
    61   The writing can be done asynchronously and the waitForFinished()
    62   The writing can be done asynchronously and the waitForFinished()
   226 }
   227 }
   227 
   228 
   228 /*!
   229 /*!
   229  * If the state is ActiveState, blocks until the writer has finished writing or \a msec milliseconds
   230  * If the state is ActiveState, blocks until the writer has finished writing or \a msec milliseconds
   230  * has elapsed, returning true if it successfully finishes or is cancelled by the user.
   231  * has elapsed, returning true if it successfully finishes or is cancelled by the user.
       
   232  * If \m msec is negative or zero, the function blocks until the writer has finished, regardless of
       
   233  * how long it takes.
   231  * If the state is FinishedState, returns true immediately.
   234  * If the state is FinishedState, returns true immediately.
   232  * Otherwise, returns false immediately.
   235  * Otherwise, returns false immediately.
   233  */
   236  */
   234 bool QVersitWriter::waitForFinished(int msec)
   237 bool QVersitWriter::waitForFinished(int msec)
   235 {
   238 {
   236     State state = d->state();
   239     State state = d->state();
   237     if (state == ActiveState) {
   240     if (state == ActiveState) {
   238         return d->wait(msec);
   241         if (msec <= 0)
       
   242             return d->wait(ULONG_MAX);
       
   243         else
       
   244             return d->wait(msec);
   239     } else if (state == FinishedState) {
   245     } else if (state == FinishedState) {
   240         return true;
   246         return true;
   241     } else {
   247     } else {
   242         return false;
   248         return false;
   243     }
   249     }