Electric dipole moments in two-Higgs-doublet models