File: printdialog.cpp

package info (click to toggle)
x2goclient 3.99.2.1-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,596 kB
  • sloc: cpp: 21,625; perl: 512; makefile: 129; sh: 17
file content (60 lines) | stat: -rw-r--r-- 1,610 bytes parent folder | download
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
//
// C++ Implementation: printdialog
//
// Description:
//
//
// Author: Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de>, (C) 2009
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "printdialog.h"
#include <QPushButton>
#include "printwidget.h"
#include <QBoxLayout>
#include "x2gologdebug.h"
#include <QMessageBox>

PrintDialog::PrintDialog ( QWidget* parent, Qt::WindowFlags f )
		: QDialog ( parent,f )
{
	x2goDebug<<"starting print dialog"<<endl;
	ui.setupUi ( this );
	ui.buttonBox->button ( QDialogButtonBox::Ok )->setText (
	    tr ( "Print" ) );
	pwidg=new PrintWidget ( this );
	( ( QVBoxLayout* ) ( layout() ) )->insertWidget ( 0,pwidg );

	//x2goclient can stay under the nxagent window
	//we must start it as toplevel window and be shure
	//that x2goclient window will not be activated
	//so we must start print dialog as window
	setWindowFlags ( Qt::Window|Qt::WindowStaysOnTopHint );
	connect ( pwidg,SIGNAL ( dialogShowEnabled ( bool ) ),
	          this,SLOT ( slot_dlgShowEnabled ( bool ) ) );
}


PrintDialog::~PrintDialog()
{
}



void PrintDialog::accept()
{
	pwidg->saveSettings();
	QDialog::accept();
}

void PrintDialog::slot_dlgShowEnabled ( bool enable )
{
	if ( !enable )
		QMessageBox::warning ( this, tr ( "You've deactivated the x2go "
		                                  "client printing dialog." ),
		                       tr ( "You may reactivate this dialog "
		                            "using the x2goclient settings "
		                            "dialog (Menu -> Options -> "
		                            "Settings)" ) );
}