~blue-shell/blue-shell/kfilebox

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "configuration.h"

Configuration::Configuration(QObject *parent) :
    QObject(parent)
{
    settings = new KConfig("kfileboxrc");
    generalGroup = new KConfigGroup(settings, "General");

    if(!generalGroup->hasKey("DropboxDir")) {
        initConfigurationFile();
    }
}

Configuration::~Configuration()
{
    settings->sync();

    delete generalGroup;
    generalGroup = 0;
    delete settings;
    settings = 0;
}

void Configuration::initConfigurationFile()
{
    generalGroup->writeEntry("Browser", "rekonq");
    generalGroup->writeEntry("FileManager", "dolphin");
    generalGroup->writeEntry("IconSet", "default");
    generalGroup->writeEntry("ShowNotifications", true);            //! @todo use from config.db
    generalGroup->writeEntry("AutoStart", true);
    generalGroup->writeEntry("StartDaemon", true);
    generalGroup->writeEntry("GtkUiDisabled", false);
    generalGroup->writeEntry("DropboxDir", QDir::homePath().append("/.dropbox-dist/"));
    //! @todo add more pairs

    settings->sync();
}