Home 

Chapter 5. Settings

Alvaro Soliverez

Table of Contents

How to create a settings page
How to add the setting items
References
Hints

How to create a settings page

  • Create the view using designer, name it XxxDecl and store it in kmymoney2/dialogs/settings/xxxdecl.ui. See more information about naming the items further down

  • Create the class that contains the logic for the settings page, name it Xxx and store it in kmymoney2/dialogs/settings/xxx.[cpp|h].

    Don't forget the Q_OBJECT macro at the beginning of the class declaration in the .h file and make the class a public derivative of XxxDecl

  • Add the xxxdecl.ui and xxx.cpp filename to the libsettings_a_SOURCES label in kmymoney2/dialogs/settings/Makefile.am

  • Add the xxxdecl.ui filename to the EXTRA_DIST label in kmymoney2/dialogs/settings/Makefile.am

  • Add the xxxdecl.cpp and xxxdecl.h filename to the DISTCLEANFILES label in kmymoney2/dialogs/settings/Makefile.am

  • Add the xxx.h filename to the noinst_HEADERS label in kmymoney2/dialogs/settings/Makefile.am

  • Add the construction code to KMyMoney2App::slotSettings() as

    Xxx* xxxPage = new Xxx();
    dlg->addPage(xxxPage, i18n("text"), "icon-name");
    

    where you replace "text" with a short text that shows up under the icon in the settings view and "icon-name" with the name of the icon for that settings page

  • Make sure to include xxx.h in kmymoney/kmymoney2.cpp