File: x2gosettings.cpp

package info (click to toggle)
x2goclient 3.99.2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,596 kB
  • sloc: cpp: 21,625; perl: 512; makefile: 129; sh: 17
file content (67 lines) | stat: -rw-r--r-- 1,535 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// C++ Implementation: x2gosettings
//
// Description:
//
//
// Author: Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de>, (C) 2010
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "x2gosettings.h"
#include "x2goclientconfig.h"
#include "x2gologdebug.h"
#include "onmainwindow.h"
#include <QTemporaryFile>

X2goSettings::X2goSettings(QString fileContent, QSettings::Format format)
{
    cfgFile=new QTemporaryFile();
    cfgFile->open();
    QTextStream out(cfgFile);
    out<<fileContent;
    cfgFile->close();
    set=new QSettings ( cfgFile->fileName(),
                        format );
}


X2goSettings::X2goSettings ( QString group )
{
    cfgFile=0l;
    if (group=="sessions" && ONMainWindow::getSessionConf().length()>0)
    {
        set=new QSettings ( ONMainWindow::getSessionConf(),
                            QSettings::IniFormat );
        return;
    }
#ifndef Q_OS_WIN
    set=new QSettings ( ONMainWindow::getHomeDirectory() +
                        "/.x2goclient/"+group,
                        QSettings::NativeFormat );
#else
    if ( !ONMainWindow::getPortable() )
    {
        set=new QSettings ( "Obviously Nice","x2goclient" );
        set->beginGroup ( group );
    }
    else
    {
        set=new QSettings ( ONMainWindow::getHomeDirectory() +
                            "/.x2goclient/"+group,
                            QSettings::IniFormat );
    }
#endif

}


X2goSettings::~X2goSettings()
{
    delete set;
    if (cfgFile)
        delete cfgFile;
}