One button to serve different purpose

Sounds like you need a finite state machine. That sounds scary but it's not.

At any time the system will be in one of several states, each of which you give a number or a name. So, when in say, state 0

if (state == 0)
{
  //read the button and act accordingly for state 0
}

but when the state is different, say 1

if (state == 1)
{
  //read the button and act accordingly for state 1
}