File indexing completed on 2024-04-28 16:24:36

0001 /* This file is part of the KDE project
0002   Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org>
0003   Copyright (C) 2002 - 2011 Dag Andersen <danders@get2net.dk>
0004   Copyright (C) 2012 Dag Andersen <danders@get2net.dk>
0005 
0006   This library is free software; you can redistribute it and/or
0007   modify it under the terms of the GNU Library General Public
0008   License as published by the Free Software Foundation; either
0009   version 2 of the License, or (at your option) any later version.
0010 
0011   This library is distributed in the hope that it will be useful,
0012   but WITHOUT ANY WARRANTY; without even the implied warranty of
0013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014   Library General Public License for more details.
0015 
0016   You should have received a copy of the GNU Library General Public License
0017   along with this library; see the file COPYING.LIB.  If not, write to
0018   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019 * Boston, MA 02110-1301, USA.
0020 */
0021 
0022 // clazy:excludeall=qstring-arg
0023 #include "kptprintingcontrolprivate.h"
0024 
0025 #include <kptviewbase.h>
0026 
0027 #include <QSpinBox>
0028 #include <QPrintDialog>
0029 
0030 namespace KPlato
0031 {
0032 
0033 PrintingControlPrivate::PrintingControlPrivate(PrintingDialog *job, QPrintDialog *dia)
0034     : QObject(dia),
0035     m_job(job),
0036     m_dia(dia)
0037 {
0038     connect(job, SIGNAL(changed()), SLOT(slotChanged()));
0039 }
0040 
0041 void PrintingControlPrivate::slotChanged()
0042 {
0043     if (! m_job || ! m_dia) {
0044         return;
0045     }
0046     QSpinBox *to = m_dia->findChild<QSpinBox*>("to");
0047     QSpinBox *from = m_dia->findChild<QSpinBox*>("from");
0048     if (to && from) {
0049         from->setMinimum(m_job->documentFirstPage());
0050         from->setMaximum(m_job->documentLastPage());
0051         from->setValue(from->minimum());
0052         to->setMinimum(from->minimum());
0053         to->setMaximum(from->maximum());
0054         to->setValue(to->maximum());
0055     }
0056 }
0057 
0058 }  //KPlato namespace