[DCShannon](http://gaming.stackexchange.com/users/108003/dcshannon) gave me a hint to look in the tooltip appearing when I hover over the attack button, and indeed, if the fleet is able to attack it will be:

[!["Cannot attack: there are no enemy fleets in this star system"][1]][1]

While if the fleet has already attacked, it will be:

[!["Cannot attack: your fleet has no ships suitable for an attack"][2]][2]


  [1]: https://i.sstatic.net/m2Nhh.png
  [2]: https://i.sstatic.net/93rkT.png