def METHOD_NAME(self, new=None, old=None):
    """Called when the mainwindow changes the current document."""
    if old:
        old.contentsChanged.disconnect(self.startTimer)
        old.loaded.disconnect(self.startTimer)
        old.saved.disconnect(self.startTimer)
    if new:
        new.contentsChanged.connect(self.startTimer)
        new.loaded.connect(self.startTimer)
        new.saved.connect(self.startTimer)
        if self._enabled:
            self.startTimer()