~ubuntu-branches/ubuntu/quantal/smb4k/quantal

« back to all changes in this revision

Viewing changes to core/smb4kprint_p.h

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2012-05-19 18:54:34 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20120519185434-duffny2n87214n1n
Tags: 1.0.1-1
* New upstream release.
* Update debian/compat: bump to 9.
* Update debian/control:
  - bump debhelper to 9.
  - bump kdelibs5-dev build dependency to 4:4.4.0.
  - bump Standards-Version to 3.9.3 (no changes needed).
  - Replace smbfs dependency by cifs-utils. (Closes: #638162)
* Update debian/copyright:
  - update upstream URL.
  - update upstream e-mail.
* Update debian/smb4k.lintian-overrides file.
* Update debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
    smb4kprint_p  -  This file contains private helpers for the
 
3
    Smb4KPrint class
 
4
                             -------------------
 
5
    begin                : Fr Okt 31 2008
 
6
    copyright            : (C) 2008-2011 by Alexander Reinholdt
 
7
    email                : alexander.reinholdt@kdemail.net
 
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
 *   This program is distributed in the hope that it will be useful, but   *
 
17
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 
18
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
 
19
 *   General Public License for more details.                              *
 
20
 *                                                                         *
 
21
 *   You should have received a copy of the GNU General Public License     *
 
22
 *   along with this program; if not, write to the                         *
 
23
 *   Free Software Foundation, 51 Franklin Street, Suite 500, Boston,      *
 
24
 *   MA 02110-1335, USA                                                    *
 
25
 ***************************************************************************/
 
26
 
 
27
#ifndef SMB4KPRINT_P_H
 
28
#define SMB4KPRINT_P_H
 
29
 
 
30
#ifdef HAVE_CONFIG_H
 
31
#include <config.h>
 
32
#endif
 
33
 
 
34
// Qt includes
 
35
#include <QPrinter>
 
36
 
 
37
// KDE includes
 
38
#include <kdialog.h>
 
39
#include <kurlrequester.h>
 
40
#include <knuminput.h>
 
41
#include <kurl.h>
 
42
#include <kjob.h>
 
43
#include <ktempdir.h>
 
44
 
 
45
// application specific includes
 
46
#include <smb4kprint.h>
 
47
#include <smb4kprocess.h>
 
48
 
 
49
// forward declarations
 
50
class Smb4KAuthInfo;
 
51
class Smb4KShare;
 
52
 
 
53
 
 
54
class Smb4KPrintJob : public KJob
 
55
{
 
56
  Q_OBJECT
 
57
  
 
58
  public:
 
59
    /**
 
60
     * The constructor
 
61
     */
 
62
    Smb4KPrintJob( QObject *parent = 0 );
 
63
    
 
64
    /**
 
65
     * The destructor
 
66
     */
 
67
    ~Smb4KPrintJob();
 
68
    
 
69
    /**
 
70
     * Returns TRUE if the job has been started and FALSE otherwise
 
71
     * 
 
72
     * @returns TRUE if the job has been started
 
73
     */
 
74
    bool isStarted() { return m_started; }
 
75
    
 
76
    /**
 
77
     * Starts the job
 
78
     */
 
79
    void start();
 
80
    
 
81
    /**
 
82
     * Setup the printing process. You need to set the printer, the parent
 
83
     * widget is optional.
 
84
     * 
 
85
     * You must run this function before start() is called.
 
86
     * 
 
87
     * @param printer       The printer
 
88
     * 
 
89
     * @param parentWidget  The parent widget
 
90
     */
 
91
    void setupPrinting( Smb4KShare *printer,
 
92
                        QWidget *parentWidget = 0 );
 
93
    
 
94
    /**
 
95
     * Returns the printer share object
 
96
     * 
 
97
     * @returns the printer share object
 
98
     */
 
99
    Smb4KShare *printer() { return m_share; }
 
100
    
 
101
    /**
 
102
     * Returns the parent widget
 
103
     * 
 
104
     * @returns the parent widget
 
105
     */
 
106
    QWidget *parentWidget() { return m_parent_widget; }
 
107
    
 
108
  signals:
 
109
    /**
 
110
     * Emitted when an authentication error happened.
 
111
     */
 
112
    void authError( Smb4KPrintJob *job );
 
113
    
 
114
    /**
 
115
     * Emitted when the printing is about to begin.
 
116
     */
 
117
    void aboutToStart( Smb4KShare *share );
 
118
    
 
119
    /**
 
120
     * Emitted after the printing finished.
 
121
     */
 
122
    void finished( Smb4KShare *share );
 
123
    
 
124
  protected:
 
125
    /**
 
126
     * Reimplemented from KJob. Kills the internal process and
 
127
     * then the job itself.
 
128
     */
 
129
    bool doKill();
 
130
    
 
131
  protected slots:
 
132
    void slotStartPrinting();
 
133
    void slotReadStandardOutput();
 
134
    void slotReadStandardError();
 
135
    void slotProcessFinished( int exitCode, QProcess::ExitStatus status );
 
136
    
 
137
  private:
 
138
    bool m_started;
 
139
    Smb4KProcess *m_proc;
 
140
    Smb4KShare *m_share;
 
141
    QWidget *m_parent_widget;
 
142
    QString m_temp_dir;
 
143
};
 
144
 
 
145
 
 
146
class Smb4KPrintDialog : public KDialog
 
147
{
 
148
  Q_OBJECT
 
149
 
 
150
  public:
 
151
    /**
 
152
     * The constructor.
 
153
     *
 
154
     * @param share       The Smb4KShare item representing the printer.
 
155
     *
 
156
     * @param parent      The parent widget of this dialog.P
 
157
     */
 
158
    Smb4KPrintDialog( Smb4KShare *share,
 
159
                      QPrinter *printer,
 
160
                      QWidget *parent = 0 );
 
161
 
 
162
    /**
 
163
     * The destructor
 
164
     */
 
165
    ~Smb4KPrintDialog();
 
166
    
 
167
    /**
 
168
     * Returns the URL of the file that was chosen to be printed.
 
169
     * 
 
170
     * @returns the URL of the file
 
171
     */
 
172
    const KUrl &fileURL() { return m_url; }
 
173
    
 
174
    /**
 
175
     * Returns the QPrinter object
 
176
     * 
 
177
     * @returns the QPrinter object
 
178
     */
 
179
    QPrinter *printer() { return m_printer; }
 
180
    
 
181
  protected slots:
 
182
    /**
 
183
     * This slot is called when the User1 (i.e. the "Close") button
 
184
     * has been clicked.
 
185
     */
 
186
    void slotUser1Clicked();
 
187
 
 
188
    /**
 
189
     * This slot is called when the User2 (i.e. the "Print") button has been clicked.
 
190
     */
 
191
    void slotUser2Clicked();
 
192
 
 
193
    /**
 
194
     * This slot is being enabled if there is input text.
 
195
     *
 
196
     * @param text        The input text.
 
197
     */
 
198
    void slotInputValueChanged( const QString &text );
 
199
 
 
200
  private:
 
201
    /**
 
202
     * Set up the view.
 
203
     */
 
204
    void setupView( Smb4KShare *share );
 
205
    
 
206
    /**
 
207
     * The printer object
 
208
     */
 
209
    QPrinter *m_printer;
 
210
 
 
211
    /**
 
212
     * The url requester
 
213
     */
 
214
    KUrlRequester *m_file;
 
215
 
 
216
    /**
 
217
     * The copies input
 
218
     */
 
219
    KIntNumInput *m_copies;
 
220
    
 
221
    /**
 
222
     * The file URL
 
223
     */
 
224
    KUrl m_url;
 
225
};
 
226
 
 
227
 
 
228
class Smb4KPrintPrivate
 
229
{
 
230
  public:
 
231
    Smb4KPrintPrivate();
 
232
    ~Smb4KPrintPrivate();
 
233
    Smb4KPrint instance;
 
234
};
 
235
 
 
236
#endif