My programming skills are more than low so i did not read the code. But as far as i understand the fee is an reward and an motivation for users to calculate hashes to keep the network up.
Currently fees are used mostly to discourage 'spam' transactions which could flood the network. They are negligible compared to number of bitcoins mined.
For example, here is one of larger blocks: http://blockexplorer.com/block/00000000000010636a97e1aa823a6b2d60b5a964f087448857190093e014a5d5
Block 12931 has 99.155 kilobytes and it got 0.581 in fee (compared to 50 BTC generated).
Let's compare it to a smaller block: http://blockexplorer.com/block/0000000000000035d573e3a205d166de752a540dd30d59477d3526ec30d9006a
Size: 15.5 kilobytes
0.2 total fees
And the amount of the fee is calculated by the transactions/calculation power needed for this single transaction. Is this correct ?
As block size goes larger fees required by miner go large as well, so at some point if there are too many transactions they won't get into a current block (but they can go into a next one). So fees received by miner can be roughly proportional to block size, and so amount of computations needed to verify it.
But I think computational power required for verifications is negligible compared to computational power spent on mining.
A quick estimation: there would be like 4000 small transactions in 1 MB-large block. Let's say 3 msecs is spent on one verification (number from wiki). This means that one CPU core would verify the whole block in 15 seconds.
But it would take many _years_ for one CPU core to solve proof-of-work challenge. So it doesn't matter much until we'll get much larger blocks.
(It is not as simple because verification also requires IO operations, but you get the idea... At least with current block sizes like ~100 KB top it doesn't matter.)
But even if amount of CPU time required for verification is tiny miners could skip it altogether for whatever reasons. So fees, whatever tiny they are, still encourage miners to run official client but not something else.
On the other hand users who want to start an transaction can enter maximum fee value what they want to accept for an transaction.
The way it works now: client assigns a fixed fee. Miner sorts transactions by priority and goes through the list, verifying whether they have enough fees. (As block gets larger fees get more expensive.) If transaction is not accepted into block it might be accepted in some other block mined by another miner. So if you pay no fees or fees too small it would take more time until you'll get a confirmation.
So maybe an self-regulating system will grow automatically.
Definitely it will, when there will be larger number of transactions it would make sense to make fees configurable.
In a limited way it is now -- if you want your txn to be included into a larger block you might need to configure higher fee in your client (there is an RPC call for it now).
There is also a miner who accepts lower than default transaction fees and also non-standard transactions:https://en.bitcoin.it/wiki/Free_transaction_relay_policy