summaryrefslogtreecommitdiffstats
path: root/smb4k/core/smb4kprintinfo.h
blob: d9ccabbe1dca53589def5db3aac16d3b73aefe5e (plain)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/***************************************************************************
                          smb4kprintinfo  -  description
                             -------------------
    begin                : Mo Apr 19 2004
    copyright            : (C) 2004 by Alexander Reinholdt
    email                : dustpuppy@mail.berlios.de
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful, but   *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 *   General Public License for more details.                              *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,   *
 *   MA  02110-1301 USA                                                    *
 ***************************************************************************/

#ifndef SMB4KPRINTINFO_H
#define SMB4KPRINTINFO_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// TQt includes
#include <tqstring.h>

// application specific includes
#include "smb4knetworkitems.h"

/**
 * This class provides a container that holds all the info
 * that is needed to print a file.
 */

class Smb4KPrintInfo
{
  public:
    /**
     * The constructor.
     *
     * @param item          The Smb4KShareItem that represents the printer
     *
     * @param ip            The IP address of the host
     *
     * @param filepath      The path of the file to print
     *
     * @param copies        The number of copies
     */
    Smb4KPrintInfo( Smb4KShareItem *item, const TQString &ip, const TQString &filepath = TQString(), int copies = 1 );
    /**
     * Empty constructor.
     */
    Smb4KPrintInfo() {}
    /**
     * The destructor.
     */
    ~Smb4KPrintInfo();
    /**
     * Returns the path of the file.
     */
    const TQString &path() const { return m_path; }
    /**
     * Returns the host where the printer is located.
     */
    const TQString &host() const { return m_host; }
    /**
     * Returns the workgroup in which the host located.
     */
    const TQString &workgroup() const { return m_workgroup; }
    /**
     * Returns the name of the printer.
     */
    const TQString &printer() const { return m_printer; }
    /**
     * Returns the IP address of the host.
     */
    const TQString &ip() const { return m_ip; }
    /**
     * Sets the path to the file to print.
     */
    void setPath( const TQString &path );
    /**
     * Returns the number of copies the user wants to have.
     */
    int copies() const { return m_copies; }
    /**
     * Sets the number of copies.
     */
    void setCopies( int num );
    /**
     * Returns the comment.
     */
    const TQString &comment() const { return m_comment; }

  private:
    /**
     * The workgroup.
     */
    TQString m_workgroup;
    /**
     * The host.
     */
    TQString m_host;
    /**
     * The IP address.
     */
    TQString m_ip;
    /**
     * The printer name.
     */
    TQString m_printer;
    /**
     * The path to the file to print.
     */
    TQString m_path;
    /**
     * Holds the number of copies the user wants to have.
     */
    int m_copies;
    /**
     * The comment
     */
    TQString m_comment;

    /**
     * This function checks if the IP address is valid, i.e. the
     * IP address is either IP v4 or IP v6. It returns either TRUE
     * or FALSE.
     *
     * @param ip            The IP address that's going to be checked.
     *
     * @returns TRUE if the IP address is valid and FALSE otherwise.
     */
    bool ipIsValid( const TQString &ip );
};

#endif