You have three options:
1. Create different configurations and load them manually depending on your circumstances.
2. Create a script that detects what the specific circumstances are
3. Use a "third-party" network manager (like Networkmanager in KDE, or Wicd if it is wireless etc.) to create different profiles.
But I'm not sure this is actually a solution.
When you say "enable ssh" you mean enabling SSH _into_ your machine? If so, setup SSH keys and disable root and password logins to permit ONLY your approved SSH clients. This way you don't have to enable/disable SSH all the time. Also, install fail2ban to ban repeated attempts to login by others.