Add packeting directory
[urpo] / src / urpoconnection.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 "urpoconnection.h"
24
25
26 UrpoConnection::UrpoConnection()
27 {
28     debugMonitor_ = 0;
29 }
30
31 UrpoConnection::~UrpoConnection()
32 {
33
34 }
35
36
37 QObject* UrpoConnection::getDebugMonitor() const
38 {
39     return debugMonitor_;
40 }
41
42 void UrpoConnection::setDebugMonitor(QObject *monitor)
43 {
44     debugMonitor_ = monitor;
45 }
46
47 QString UrpoConnection::getHostString()
48 {
49     // Get string user@host OR host (if userid empty)
50     QString hostString;
51     if( !getUserid().isEmpty())
52         hostString=getUserid() + "@";
53     hostString.append( getHost());
54     return hostString;
55 }
56
57 QString UrpoConnection::getKeyOption()
58 {
59     if( getIdentity().isEmpty())
60         return QString();   // No identity
61     else
62         return QString("-i ").append(getIdentity() + " ");
63 }