In the name of Allaah, the Most Merciful, the Bestower of Mercy.
The Prophet (peace be upon him) was sat one day amongst his companions (may Allaah be pleased with them).
Suddenly he laughed and said,
Will you not ask me why I am laughing?
Of course, O Messenger of Allaah.
I am amazed at the state of a Mu’min (Believer); his situation is always good.
If he is blessed with something he likes, he praises Allaah, and therefore this is good for him.
If he is afflicted with something he dislikes, he remains patient, and therefore this is good for him.
There is no person whose situation is always good except a Mu’min (Believer). 
This is how the outlook of a Muslim should be – always optimistic and consistently realising the good in everything, whether blessed with goodness or afflicted by calamity.
The three keys to happiness
When bestowed with a blessing, show Shukr (gratitude) to your Lord.
When tested with a calamity, remember that the decree of Allaah comes only from His Infinite Wisdom, and therefore maintain Sabr (patience).
If you fall into a sin or oppression, then seek Forgiveness and know that your Lord is Al-Ghafoor (Most Forgiving)
Thus, Shukr (Gratitude), Sabr (Patience) and Istighfaar (Forgiveness) are the three keys to happiness. 
I ask Allaah (the Most Generous), the Lord of the Throne to protect us in this World and the Hereafter, and to make us blessed wherever we are.
Written by the one in need of Allaah,
Abul Abbaas Naveed Ayaaz
12th May 2015
23 Rajab 1436H
 Narrated by Suhaib; Collected by Ahmad. Another narration with slightly different wording has also been narrated in Saheeh Muslim
 Refer to al-Qawaa’id al-Arba’; Muhamaad Ibn AbdulWahhaab