This is based on the article http://arduino.cc/playground/Code/Kdevelop and http://www.tmpsantos.com.br/en/2010/12/arduino-uno-ubuntu-cmake/. But no need  to refer to these links.

Just download this file, and copy to /usr/share/kde4/apps/kdevappwizard/templates . Thats all, now in you kdevelop, create your arduino project from this template. Thus, you can able to do advanced projects with the help of cmake build system and keep you code under version control. This is perfectly works under ubuntu.

arduinocmake.tar.bz2
File Size: 2 kb
File Type: bz2
Download File

 
    Kdevelop is good IDE for c++ and other stuff. You can get more details at http://kdevelop.org/. 
    Mercurial version control plugin is not added by default. It is under development. You add this support to kdevelop IDE by compiling the plugin and make install. The actual procedure is as follows:   

1. Get the source code from https://projects.kde.org/projects/playground/devtools/plugins/kdev-mercurial/repository.     

2. Make a directory called build inside the source code. 

3. cd into the build directory    

4. cmake ../ 

5. make 

6. make install. 

    In some distributions, this may not add the plugin to kdevelop. This can be fixed by eidting cmakelist of root directory. 

Add the following to the CMakeLists.txt at top of the file. (For ubuntu, for other distribution you should locate the respective directroy)

set(SERVICES_INSTALL_DIR /usr/share/kde4/services)
set(DATA_INSTALL_DIR /usr/share/kde4/apps)
set(PLUGIN_INSTALL_DIR /usr/lib/kde4)

Now follow step 3 to 6. 

Thats all. You can now have the mercurial support for kdevelop.