# kdeprint Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmpropwidget.cpp

    00001 /*
    00002  *  This file is part of the KDE libraries
    00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
    00004  *
    00005  *  This library is free software; you can redistribute it and/or
    00006  *  modify it under the terms of the GNU Library General Public
    00007  *  License version 2 as published by the Free Software Foundation.
    00008  *
    00009  *  This library is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  *  Library General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Library General Public License
    00015  *  along with this library; see the file COPYING.LIB.  If not, write to
    00016  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  *  Boston, MA 02111-1307, USA.
    00018  **/
    00019
    00020 #include "kmpropwidget.h"
    00021 #include "kmwizard.h"
    00022 #include "kmfactory.h"
    00023 #include "kmmanager.h"
    00024 #include "kmtimer.h"
    00025
    00026 #include <kmessagebox.h>
    00027 #include <klocale.h>
    00028
    00029 KMPropWidget::KMPropWidget(QWidget *parent, const char *name)
    00030 : QWidget(parent,name)
    00031 {
    00032     m_pixmap = "folder";
    00033     m_title = m_header = "Title";
    00034     m_printer = 0;
    00035     m_canchange = ((KMFactory::self()->manager()->printerOperationMask() & KMManager::PrinterCreation) && KMFactory::self()->manager()->hasManagement());
    00036
    00037     connect(this,SIGNAL(enable(bool)),this,SIGNAL(enableChange(bool)));
    00038 }
    00039
    00040 KMPropWidget::~KMPropWidget()
    00041 {
    00042 }
    00043
    00044 void KMPropWidget::slotChange()
    00045 {
    00046     KMTimer::self()->hold();
    00047     int value = requestChange();
    00048     if (value == -1)
    00049     {
    00050         KMessageBox::error(this, i18n("<qt>Unable to change printer properties. Error received from manager:<p>%1</p></qt>").arg(KMManager::self()->errorMsg()));
    00051         KMManager::self()->setErrorMsg(QString::null);
    00052     }
    00053     KMTimer::self()->release((value == 1));
    00054 }
    00055
    00056 void KMPropWidget::setPrinterBase(KMPrinter *p)
    00057 {
    00058     m_printer = p;
    00059     setPrinter(p);
    00060 }
    00061
    00062 void KMPropWidget::setPrinter(KMPrinter*)
    00063 {
    00064 }
    00065
    00066 void KMPropWidget::configureWizard(KMWizard*)
    00067 {
    00068 }
    00069
    00070 // return status:
    00071 //   -1 : error
    00072 //    0 : nothing to be done (canceled)
    00073 //    1 : success
    00074 int KMPropWidget::requestChange()
    00075 {
    00076     if (m_printer)
    00077     {
    00078         KMWizard    dlg(this);
    00079         configureWizard(&dlg);
    00080         dlg.setPrinter(m_printer);
    00081         if (dlg.exec())
    00082             return (KMFactory::self()->manager()->modifyPrinter(m_printer,dlg.printer()) ? 1 : -1);
    00083     }
    00084     return 0;
    00085 }
    00086 #include "kmpropwidget.moc"

This file is part of the documentation for kdeprint Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:03 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003