We propose a new model within the ''quark nova'' scenario to interpret the recent observations of early afterglows of long gamma-ray bursts (GRBs) with the Swift satellite. This is a three-stage model within the context of a corecollapse supernova. Stage 1 is an accreting ( protoY)neutron star leading to a possible delay between the core collapse and the GRB. Stage 2 is an accreting quark star, generating the prompt GRB. Stage 3, which occurs only if the quark star collapses to form a black hole, consists of an accreting black hole. The jet launched in this accretion process interacts with the ejecta from stage 2, and could generate the flaring activity frequently seen in X-ray afterglows. This model may be able to account for both the energies and the timescales of GRBs, in addition to the newly discovered early X-ray afterglow features.