+! Check printer validity before entering Page Setup - this fixes

fault when no printer is installed.
This commit is contained in:
Konstantin Isakov 2009-05-24 18:51:45 +00:00
parent afb9c0d5a5
commit 62a36598c2
2 changed files with 23 additions and 7 deletions

View file

@ -2221,27 +2221,37 @@
<translation>Пропустить данную версию</translation> <translation>Пропустить данную версию</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cc" line="1379"/> <location filename="../mainwindow.cc" line="1367"/>
<source>Page Setup</source>
<translation>Параметры страницы</translation>
</message>
<message>
<location filename="../mainwindow.cc" line="1368"/>
<source>No printer is available. Please install one first.</source>
<translation>В системе не установлено ни одного принтера.</translation>
</message>
<message>
<location filename="../mainwindow.cc" line="1385"/>
<source>Print Article</source> <source>Print Article</source>
<translation>Печать статьи</translation> <translation>Печать статьи</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cc" line="1400"/> <location filename="../mainwindow.cc" line="1406"/>
<source>Save Article As</source> <source>Save Article As</source>
<translation>Сохранить статью как</translation> <translation>Сохранить статью как</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cc" line="1400"/> <location filename="../mainwindow.cc" line="1406"/>
<source>Html files (*.html *.htm)</source> <source>Html files (*.html *.htm)</source>
<translation>Файлы Html (*.html *.htm)</translation> <translation>Файлы Html (*.html *.htm)</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cc" line="1415"/> <location filename="../mainwindow.cc" line="1421"/>
<source>Error</source> <source>Error</source>
<translation>Ошибка</translation> <translation>Ошибка</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cc" line="1416"/> <location filename="../mainwindow.cc" line="1422"/>
<source>Can&apos;t save article: %1</source> <source>Can&apos;t save article: %1</source>
<translation>Невозможно сохранить статью: %1</translation> <translation>Невозможно сохранить статью: %1</translation>
</message> </message>

View file

@ -1356,11 +1356,17 @@ void MainWindow::on_actionCloseToTray_activated()
} }
void MainWindow::on_pageSetup_activated() void MainWindow::on_pageSetup_activated()
{
if ( printer.isValid() )
{ {
QPageSetupDialog dialog( &printer, this ); QPageSetupDialog dialog( &printer, this );
dialog.exec(); dialog.exec();
} }
else
QMessageBox::critical( this, tr( "Page Setup" ),
tr( "No printer is available. Please install one first." ) );
}
void MainWindow::on_printPreview_activated() void MainWindow::on_printPreview_activated()
{ {