~x2go/x2go/x2goclient_master

« back to all changes in this revision

Viewing changes to src/printdialog.cpp

  • Committer: Mihai Moldovan
  • Date: 2015-03-04 20:15:47 UTC
  • Revision ID: git-v1:b7398771a7abd84ddcff407063edb95dd0a205d3
general: move *.cpp and *.h files to src/ and *.ts files to src/i18n/.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**************************************************************************
 
2
*   Copyright (C) 2005-2015 by Oleksandr Shneyder                         *
 
3
*   o.shneyder@phoca-gmbh.de                                              *
 
4
*                                                                         *
 
5
*   This program is free software; you can redistribute it and/or modify  *
 
6
*   it under the terms of the GNU General Public License as published by  *
 
7
*   the Free Software Foundation; either version 2 of the License, or     *
 
8
*   (at your option) any later version.                                   *
 
9
*   This program is distributed in the hope that it will be useful,       *
 
10
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
11
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
12
*   GNU General Public License for more details.                          *
 
13
*                                                                         *
 
14
*   You should have received a copy of the GNU General Public License     *
 
15
*   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
 
16
***************************************************************************/
 
17
 
 
18
#include "printdialog.h"
 
19
#include <QPushButton>
 
20
#include "printwidget.h"
 
21
#include <QBoxLayout>
 
22
#include "x2gologdebug.h"
 
23
#include <QMessageBox>
 
24
 
 
25
PrintDialog::PrintDialog ( QWidget* parent, Qt::WindowFlags f )
 
26
                : QDialog ( parent,f )
 
27
{
 
28
        x2goDebug<<"Starting print dialog."<<endl;
 
29
        ui.setupUi ( this );
 
30
        ui.buttonBox->button ( QDialogButtonBox::Ok )->setText (
 
31
            tr ( "Print" ) );
 
32
        pwidg=new PrintWidget ( this );
 
33
        ( ( QVBoxLayout* ) ( layout() ) )->insertWidget ( 0,pwidg );
 
34
 
 
35
        //x2goclient can stay under the nxagent window
 
36
        //we must start it as toplevel window and be shure
 
37
        //that x2goclient window will not be activated
 
38
        //so we must start print dialog as window
 
39
        setWindowFlags ( Qt::Window|Qt::WindowStaysOnTopHint );
 
40
        connect ( pwidg,SIGNAL ( dialogShowEnabled ( bool ) ),
 
41
                  this,SLOT ( slot_dlgShowEnabled ( bool ) ) );
 
42
}
 
43
 
 
44
 
 
45
PrintDialog::~PrintDialog()
 
46
{
 
47
        x2goDebug<<"Closing print dialog."<<endl;
 
48
}
 
49
 
 
50
 
 
51
 
 
52
void PrintDialog::accept()
 
53
{
 
54
        pwidg->saveSettings();
 
55
        QDialog::accept();
 
56
}
 
57
 
 
58
void PrintDialog::slot_dlgShowEnabled ( bool enable )
 
59
{
 
60
        if ( !enable )
 
61
                QMessageBox::warning ( this, tr ( "You've deactivated the x2go "
 
62
                                                  "client printing dialog." ),
 
63
                                       tr ( "You may reactivate this dialog "
 
64
                                            "using the x2goclient settings "
 
65
                                            "dialog (Menu -> Options -> "
 
66
                                            "Settings)" ) );
 
67
}