kmpropbanners.cpp
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <tdeprint@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., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 **/ 00019 00020 #include "kmpropbanners.h" 00021 #include "kmprinter.h" 00022 #include "kmwizard.h" 00023 #include "kmwbanners.h" 00024 00025 #include <tqlabel.h> 00026 #include <tqlayout.h> 00027 #include <tdelocale.h> 00028 00029 KMPropBanners::KMPropBanners(TQWidget *parent, const char *name) 00030 : KMPropWidget(parent,name) 00031 { 00032 m_startbanner = new TQLabel(this); 00033 m_stopbanner = new TQLabel(this); 00034 00035 TQLabel *l1 = new TQLabel(i18n("&Starting banner:"), this); 00036 TQLabel *l2 = new TQLabel(i18n("&Ending banner:"), this); 00037 00038 l1->setBuddy(m_startbanner); 00039 l2->setBuddy(m_stopbanner); 00040 00041 TQGridLayout *main_ = new TQGridLayout(this, 3, 2, 10, 10); 00042 main_->setColStretch(1,1); 00043 main_->setRowStretch(2,1); 00044 main_->addWidget(l1,0,0); 00045 main_->addWidget(l2,1,0); 00046 main_->addWidget(m_startbanner,0,1); 00047 main_->addWidget(m_stopbanner,1,1); 00048 00049 m_title = i18n("Banners"); 00050 m_header = i18n("Banner Settings"); 00051 m_pixmap = "edit-copy"; 00052 } 00053 00054 KMPropBanners::~KMPropBanners() 00055 { 00056 } 00057 00058 void KMPropBanners::setPrinter(KMPrinter *p) 00059 { 00060 if (p && p->isPrinter()) 00061 { 00062 TQStringList l = TQStringList::split(',',p->option("kde-banners"),false); 00063 while ( l.count() < 2 ) 00064 l.append( "none" ); 00065 m_startbanner->setText(i18n(mapBanner(l[0]).utf8())); 00066 m_stopbanner->setText(i18n(mapBanner(l[1]).utf8())); 00067 emit enable(true); 00068 emit enableChange(p->isLocal()); 00069 } 00070 else 00071 { 00072 emit enable(false); 00073 m_startbanner->setText(""); 00074 m_stopbanner->setText(""); 00075 } 00076 } 00077 00078 void KMPropBanners::configureWizard(KMWizard *w) 00079 { 00080 w->configure(KMWizard::Banners,KMWizard::Banners,true); 00081 }