It's actually not done by slots.
Generally, the knife goes to melee weapons, the tranq goes to the class's special weapon, the SSG goes to SG/SSG, and the nailgun goes to the nailgun.
I'll try to get a list or something.
Code:
Class/Weapon | Knife | Tranquilizer | Super Shotgun | Nailgun
-----------------------------------------------------------------
Scout | Crowbar | Nailgun* | Shotgun | Nailgun
Sniper | Crowbar | Sniper Rifle | Autorifle* | Nailgun
Soldier | Crowbar | RPG | Super Shotgun | Shotgun
Demoman | Crowbar | PL* | Shotgun* | GL*
Medic | Medkit | SNG | Super Shotgun | Nailgun
HWGuy | Crowbar | AC | Super Shotgun | Shotgun
Pyro | Crowbar | Flamethrower*| Shotgun* | IC*
Spy | Knife | Tranquilizer | Super Shotgun | Nailgun
Engineer | Wrench | Railgun | Super Shotgun | Railgun*
*needs confirmation