~neon/kompare/master

« back to all changes in this revision

Viewing changes to src/dialogpages/filessettings.cpp

  • Committer: Friedrich W. H. Kossebau
  • Date: 2020-11-13 21:43:33 UTC
  • Revision ID: git-v1:79fce0df862602a8e2790d7d14f4037744a006f6
Reorganize sources into src/ subfolder

NO_CHANGELOG

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                                filessettings.cpp
 
3
                                -----------------
 
4
        begin                   : Sun Apr 18 2004
 
5
        Copyright 2004 Otto Bruggeman <otto.bruggeman@home.nl>
 
6
        Copyright 2007 Kevin Kofler   <kevin.kofler@chello.at>
 
7
****************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
**
 
11
**   This program is free software; you can redistribute it and/or modify
 
12
**   it under the terms of the GNU General Public License as published by
 
13
**   the Free Software Foundation; either version 2 of the License, or
 
14
**   (at your option) any later version.
 
15
**
 
16
****************************************************************************/
 
17
 
 
18
#include "filessettings.h"
 
19
 
 
20
#include <KConfig>
 
21
#include <KConfigGroup>
 
22
 
 
23
FilesSettings::FilesSettings(QWidget* parent)
 
24
    : SettingsBase(parent)
 
25
{
 
26
}
 
27
 
 
28
FilesSettings::~FilesSettings()
 
29
{
 
30
}
 
31
 
 
32
void FilesSettings::loadSettings(KConfig* config)
 
33
{
 
34
    KConfigGroup group(config, m_configGroupName);
 
35
 
 
36
    m_recentSources            = group.readEntry("Recent Sources", QStringList());
 
37
    m_lastChosenSourceURL      = group.readEntry("LastChosenSourceListEntry", QString());
 
38
    m_recentDestinations       = group.readEntry("Recent Destinations", QStringList());
 
39
    m_lastChosenDestinationURL = group.readEntry("LastChosenDestinationListEntry", QString());
 
40
    m_encoding                 = group.readEntry("Encoding", "default");
 
41
}
 
42
 
 
43
void FilesSettings::saveSettings(KConfig* config)
 
44
{
 
45
    KConfigGroup group(config, m_configGroupName);
 
46
    group.writeEntry("Recent Sources", m_recentSources);
 
47
    group.writeEntry("Recent Destinations", m_recentDestinations);
 
48
    group.writeEntry("LastChosenSourceListEntry", m_lastChosenSourceURL);
 
49
    group.writeEntry("LastChosenDestinationListEntry", m_lastChosenDestinationURL);
 
50
    group.writeEntry("Encoding", m_encoding);
 
51
    config->sync();
 
52
}
 
53
 
 
54
void FilesSettings::setGroup(const QString& groupName)
 
55
{
 
56
    m_configGroupName = groupName;
 
57
}