Password authentication (stage 1 - without xosso-terminal)
[urpo] / src / urpoconnectionsettings.cpp
1 /**************************************************************************
2
3     URPO
4
5     Unix Remote Printing Operation
6     Copyright (c) Arto Hyvättinen 2010
7
8     This file is part of URPO.
9
10     URPO is free software: you can redistribute it and/or modify
11     it under the terms of the GNU General Public License as published by
12     the Free Software Foundation, either version 3 of the License, or
13     (at your option) any later version.
14
15     URPO is distributed in the hope that it will be useful,
16     but WITHOUT ANY WARRANTY; without even the implied warranty of
17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18     GNU General Public License for more details.
19
20
21 **************************************************************************/
22
23 #include "urpoconnectionsettings.h"
24 #include <QSettings>
25
26
27 UrpoConnectionSettings::UrpoConnectionSettings(const QString organization, const QString application)
28 {
29     storePassword_ = false;
30     organization_ = organization;
31     application_ = application;
32 }
33
34 QString UrpoConnectionSettings::getHost() const
35 {
36     return host_;
37 }
38
39 QString UrpoConnectionSettings::getIdentity() const
40 {
41     return identity_;
42 }
43
44 QString UrpoConnectionSettings::getUserid() const
45 {
46     return userid_;
47 }
48
49 void UrpoConnectionSettings::setHost(const QString &host)
50 {
51     host_ = host;
52     password_ = QString();
53 }
54
55 void UrpoConnectionSettings::setIdentity(const QString &identity)
56 {
57     identity_ = identity;
58     password_ = QString();
59 }
60
61 void UrpoConnectionSettings::setUserid(const QString &userid)
62 {
63     userid_ = userid;
64     password_ = QString();
65 }
66
67 QString UrpoConnectionSettings::getPassword() const
68 {
69     return password_;
70 }
71
72 void UrpoConnectionSettings::setPassword(QString &password)
73 {
74     password_ = password;
75 }
76
77 void UrpoConnectionSettings::store() const
78 {
79     // Store settings using QSettings
80     QSettings settings(organization_, application_);
81     settings.setValue("host",host_);
82     settings.setValue("userid",userid_);
83     settings.setValue("identity",identity_);
84
85 }
86
87 void UrpoConnectionSettings::load()
88 {
89     // Load settings using QSettings
90     QSettings settings(organization_,application_);
91
92     host_ = settings.value("host").toString();
93     userid_ = settings.value("userid").toString();
94     identity_ = settings.value("identity").toString();
95
96
97 }