summaryrefslogtreecommitdiffstats
path: root/kdeprint/management
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-06 15:56:40 -0600
commite16866e072f94410321d70daedbcb855ea878cac (patch)
treeee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /kdeprint/management
parenta58c20c1a7593631a1b50213c805507ebc16adaf (diff)
downloadtdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz
tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'kdeprint/management')
-rw-r--r--kdeprint/management/CMakeLists.txt111
-rw-r--r--kdeprint/management/Makefile.am52
-rw-r--r--kdeprint/management/cjanuswidget.cpp265
-rw-r--r--kdeprint/management/cjanuswidget.h64
-rw-r--r--kdeprint/management/jobitem.cpp74
-rw-r--r--kdeprint/management/jobitem.h55
-rw-r--r--kdeprint/management/kaddprinterwizard.cpp39
-rw-r--r--kdeprint/management/kdeprint_management_module.cpp56
-rw-r--r--kdeprint/management/kiconselectaction.cpp118
-rw-r--r--kdeprint/management/kiconselectaction.h49
-rw-r--r--kdeprint/management/kmconfigcommand.cpp53
-rw-r--r--kdeprint/management/kmconfigcommand.h31
-rw-r--r--kdeprint/management/kmconfigdialog.cpp89
-rw-r--r--kdeprint/management/kmconfigdialog.h43
-rw-r--r--kdeprint/management/kmconfigfilter.cpp159
-rw-r--r--kdeprint/management/kmconfigfilter.h52
-rw-r--r--kdeprint/management/kmconfigfonts.cpp182
-rw-r--r--kdeprint/management/kmconfigfonts.h54
-rw-r--r--kdeprint/management/kmconfiggeneral.cpp142
-rw-r--r--kdeprint/management/kmconfiggeneral.h50
-rw-r--r--kdeprint/management/kmconfigjobs.cpp63
-rw-r--r--kdeprint/management/kmconfigjobs.h40
-rw-r--r--kdeprint/management/kmconfigpage.cpp36
-rw-r--r--kdeprint/management/kmconfigpage.h53
-rw-r--r--kdeprint/management/kmconfigpreview.cpp74
-rw-r--r--kdeprint/management/kmconfigpreview.h41
-rw-r--r--kdeprint/management/kmdbcreator.cpp187
-rw-r--r--kdeprint/management/kmdbcreator.h58
-rw-r--r--kdeprint/management/kmdriverdb.cpp244
-rw-r--r--kdeprint/management/kmdriverdb.h67
-rw-r--r--kdeprint/management/kmdriverdbwidget.cpp273
-rw-r--r--kdeprint/management/kmdriverdbwidget.h74
-rw-r--r--kdeprint/management/kmdriverdialog.cpp55
-rw-r--r--kdeprint/management/kmdriverdialog.h44
-rw-r--r--kdeprint/management/kmiconview.cpp237
-rw-r--r--kdeprint/management/kmiconview.h78
-rw-r--r--kdeprint/management/kminfopage.cpp143
-rw-r--r--kdeprint/management/kminfopage.h42
-rw-r--r--kdeprint/management/kminstancepage.cpp276
-rw-r--r--kdeprint/management/kminstancepage.h58
-rw-r--r--kdeprint/management/kmjobviewer.cpp742
-rw-r--r--kdeprint/management/kmjobviewer.h127
-rw-r--r--kdeprint/management/kmlistview.cpp268
-rw-r--r--kdeprint/management/kmlistview.h59
-rw-r--r--kdeprint/management/kmmainview.cpp920
-rw-r--r--kdeprint/management/kmmainview.h133
-rw-r--r--kdeprint/management/kmpages.cpp74
-rw-r--r--kdeprint/management/kmpages.h44
-rw-r--r--kdeprint/management/kmprinterpage.h42
-rw-r--r--kdeprint/management/kmprinterview.cpp113
-rw-r--r--kdeprint/management/kmprinterview.h62
-rw-r--r--kdeprint/management/kmpropbackend.cpp86
-rw-r--r--kdeprint/management/kmpropbackend.h45
-rw-r--r--kdeprint/management/kmpropcontainer.cpp77
-rw-r--r--kdeprint/management/kmpropcontainer.h50
-rw-r--r--kdeprint/management/kmpropdriver.cpp83
-rw-r--r--kdeprint/management/kmpropdriver.h46
-rw-r--r--kdeprint/management/kmpropertypage.cpp94
-rw-r--r--kdeprint/management/kmpropertypage.h53
-rw-r--r--kdeprint/management/kmpropgeneral.cpp83
-rw-r--r--kdeprint/management/kmpropgeneral.h44
-rw-r--r--kdeprint/management/kmpropmembers.cpp70
-rw-r--r--kdeprint/management/kmpropmembers.h42
-rw-r--r--kdeprint/management/kmpropwidget.cpp86
-rw-r--r--kdeprint/management/kmpropwidget.h63
-rw-r--r--kdeprint/management/kmspecialprinterdlg.cpp222
-rw-r--r--kdeprint/management/kmspecialprinterdlg.h57
-rw-r--r--kdeprint/management/kmtimer.cpp96
-rw-r--r--kdeprint/management/kmtimer.h62
-rw-r--r--kdeprint/management/kmwbackend.cpp177
-rw-r--r--kdeprint/management/kmwbackend.h54
-rw-r--r--kdeprint/management/kmwclass.cpp141
-rw-r--r--kdeprint/management/kmwclass.h46
-rw-r--r--kdeprint/management/kmwdriver.cpp116
-rw-r--r--kdeprint/management/kmwdriver.h40
-rw-r--r--kdeprint/management/kmwdriverselect.cpp116
-rw-r--r--kdeprint/management/kmwdriverselect.h48
-rw-r--r--kdeprint/management/kmwdrivertest.cpp172
-rw-r--r--kdeprint/management/kmwdrivertest.h53
-rw-r--r--kdeprint/management/kmwend.cpp119
-rw-r--r--kdeprint/management/kmwend.h38
-rw-r--r--kdeprint/management/kmwfile.cpp77
-rw-r--r--kdeprint/management/kmwfile.h39
-rw-r--r--kdeprint/management/kmwinfobase.cpp90
-rw-r--r--kdeprint/management/kmwinfobase.h51
-rw-r--r--kdeprint/management/kmwinfopage.cpp48
-rw-r--r--kdeprint/management/kmwinfopage.h31
-rw-r--r--kdeprint/management/kmwizard.cpp262
-rw-r--r--kdeprint/management/kmwizard.h101
-rw-r--r--kdeprint/management/kmwizardpage.cpp48
-rw-r--r--kdeprint/management/kmwizardpage.h52
-rw-r--r--kdeprint/management/kmwlocal.cpp206
-rw-r--r--kdeprint/management/kmwlocal.h58
-rw-r--r--kdeprint/management/kmwlpd.cpp102
-rw-r--r--kdeprint/management/kmwlpd.h34
-rw-r--r--kdeprint/management/kmwname.cpp96
-rw-r--r--kdeprint/management/kmwname.h35
-rw-r--r--kdeprint/management/kmwpassword.cpp133
-rw-r--r--kdeprint/management/kmwpassword.h43
-rw-r--r--kdeprint/management/kmwsmb.cpp119
-rw-r--r--kdeprint/management/kmwsmb.h50
-rw-r--r--kdeprint/management/kmwsocket.cpp151
-rw-r--r--kdeprint/management/kmwsocket.h51
-rw-r--r--kdeprint/management/kmwsocketutil.cpp219
-rw-r--r--kdeprint/management/kmwsocketutil.h76
-rw-r--r--kdeprint/management/kxmlcommanddlg.cpp1059
-rw-r--r--kdeprint/management/kxmlcommanddlg.h127
-rw-r--r--kdeprint/management/kxmlcommandselector.cpp285
-rw-r--r--kdeprint/management/kxmlcommandselector.h68
-rw-r--r--kdeprint/management/networkscanner.cpp421
-rw-r--r--kdeprint/management/networkscanner.h95
-rw-r--r--kdeprint/management/pluginaction.cpp34
-rw-r--r--kdeprint/management/pluginaction.h42
-rw-r--r--kdeprint/management/side.pngbin50353 -> 0 bytes
-rw-r--r--kdeprint/management/sidepixmap.cpp69
-rw-r--r--kdeprint/management/sidepixmap.h42
-rw-r--r--kdeprint/management/smbview.cpp292
-rw-r--r--kdeprint/management/smbview.h67
-rw-r--r--kdeprint/management/tiledown.pngbin323 -> 0 bytes
-rw-r--r--kdeprint/management/tileup.pngbin241 -> 0 bytes
120 files changed, 0 insertions, 13717 deletions
diff --git a/kdeprint/management/CMakeLists.txt b/kdeprint/management/CMakeLists.txt
deleted file mode 100644
index 0e12299e6..000000000
--- a/kdeprint/management/CMakeLists.txt
+++ /dev/null
@@ -1,111 +0,0 @@
-#################################################
-#
-# (C) 2010 Serghei Amelian
-# serghei (DOT) amelian (AT) gmail.com
-#
-# Improvements and feedback are welcome
-#
-# This file is released under GPL >= 2
-#
-#################################################
-
-add_definitions(
- -D_KDEPRINT_COMPILE
-)
-
-include_directories(
- ${TQT_INCLUDE_DIRS}
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_BINARY_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_BINARY_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/dcop
- ${CMAKE_SOURCE_DIR}/tdefx
- ${CMAKE_SOURCE_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}/tdeui
- ${CMAKE_SOURCE_DIR}/kio
- ${CMAKE_SOURCE_DIR}/kio/kio
- ${CMAKE_SOURCE_DIR}/kio/kfile
- ${CMAKE_SOURCE_DIR}/tdeprint
-)
-
-link_directories(
- ${TQT_LIBRARY_DIRS}
-)
-
-
-##### headers ###################################
-
-install( FILES
- kmmainview.h kmjobviewer.h kmprinterpage.h
- kiconselectaction.h kmtimer.h
- DESTINATION ${INCLUDE_INSTALL_DIR}/tdeprint )
-
-
-##### other data ################################
-
-install( FILES
- tileup.png tiledown.png side.png
- DESTINATION ${DATA_INSTALL_DIR}/tdeprint )
-
-
-#### tdeprint_management ########################
-
-set( target tdeprint_management )
-
-set( ${target}_SRCS
- kmdbcreator.cpp kmdriverdb.cpp kmdriverdbwidget.cpp
- kmiconview.cpp kminfopage.cpp kmmainview.cpp kmpages.cpp
- kmprinterview.cpp kmjobviewer.cpp jobitem.cpp kmpropwidget.cpp
- kmpropcontainer.cpp kmpropertypage.cpp kmpropgeneral.cpp
- cjanuswidget.cpp kmpropmembers.cpp kmpropbackend.cpp
- kmpropdriver.cpp kmlistview.cpp kminstancepage.cpp
- kmtimer.cpp kmwizard.cpp kmwizardpage.cpp kmwinfopage.cpp
- kmwpassword.cpp kmwsocketutil.cpp kmwbackend.cpp
- kmwsocket.cpp kmwdriver.cpp kmwdriverselect.cpp
- kmwdrivertest.cpp kmwinfobase.cpp kmwname.cpp kmwend.cpp
- kmwclass.cpp kmwlpd.cpp kmwfile.cpp kmdriverdialog.cpp
- kmwsmb.cpp smbview.cpp kmconfigdialog.cpp kmconfigpage.cpp
- kmconfiggeneral.cpp kmspecialprinterdlg.cpp kmwlocal.cpp
- kiconselectaction.cpp kmconfigpreview.cpp sidepixmap.cpp
- pluginaction.cpp kxmlcommanddlg.cpp kxmlcommandselector.cpp
- kmconfigcommand.cpp kmconfigfilter.cpp kmconfigfonts.cpp
- kmconfigjobs.cpp networkscanner.cpp
-)
-
-tde_add_library( ${target} SHARED AUTOMOC
- SOURCES ${${target}_SRCS}
- VERSION 4.2.0
- LINK tdeprint-shared
- DESTINATION ${LIB_INSTALL_DIR}
-)
-
-
-#### libtdeprint_management_module ##############
-
-set( target libtdeprint_management_module )
-
-set( ${target}_SRCS
- tdeprint_management_module.cpp
-)
-
-tde_add_kpart( ${target} AUTOMOC
- SOURCES ${${target}_SRCS}
- LINK tdeprint_management-shared
- DESTINATION ${PLUGIN_INSTALL_DIR}
-)
-
-
-#### kaddprinterwizard ##########################
-
-set( target kaddprinterwizard )
-
-set( ${target}_SRCS
- kaddprinterwizard.cpp
-)
-
-tde_add_tdeinit_executable( ${target} AUTOMOC
- SOURCES ${${target}_SRCS}
- LINK tdeprint-shared
-)
diff --git a/kdeprint/management/Makefile.am b/kdeprint/management/Makefile.am
deleted file mode 100644
index 34f8de935..000000000
--- a/kdeprint/management/Makefile.am
+++ /dev/null
@@ -1,52 +0,0 @@
-AM_CPPFLAGS = -D_KDEPRINT_COMPILE
-
-INCLUDES= -I$(top_srcdir)/tdefx -I$(top_srcdir)/tdeprint -I$(top_builddir)/tdeprint -I$(top_srcdir)/kio -I$(top_srcdir)/kfile -I$(top_srcdir) $(all_includes)
-
-lib_LTLIBRARIES = libtdeprint_management.la
-kde_module_LTLIBRARIES = libtdeprint_management_module.la
-tdeinit_LTLIBRARIES = kaddprinterwizard.la
-bin_PROGRAMS =
-
-kaddprinterwizard_la_SOURCES = kaddprinterwizard.cpp
-kaddprinterwizard_la_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEPRINT) $(LIB_KDEUI)
-kaddprinterwizard_la_LDFLAGS = -module -avoid-version $(all_libraries) $(KDE_RPATH)
-
-libtdeprint_management_la_SOURCES = \
- kmdbcreator.cpp kmdriverdb.cpp kmdriverdbwidget.cpp \
- kmiconview.cpp kminfopage.cpp kmmainview.cpp \
- kmpages.cpp kmprinterview.cpp kmjobviewer.cpp \
- jobitem.cpp kmpropwidget.cpp kmpropcontainer.cpp kmpropertypage.cpp \
- kmpropgeneral.cpp cjanuswidget.cpp kmpropmembers.cpp kmpropbackend.cpp kmpropdriver.cpp \
- kmlistview.cpp kminstancepage.cpp kmtimer.cpp \
- kmwizard.cpp kmwizardpage.cpp kmwinfopage.cpp kmwpassword.cpp kmwsocketutil.cpp \
- kmwbackend.cpp kmwsocket.cpp kmwdriver.cpp kmwdriverselect.cpp kmwdrivertest.cpp \
- kmwinfobase.cpp kmwname.cpp kmwend.cpp kmwclass.cpp kmwlpd.cpp kmwfile.cpp kmdriverdialog.cpp \
- kmwsmb.cpp smbview.cpp kmconfigdialog.cpp kmconfigpage.cpp kmconfiggeneral.cpp kmspecialprinterdlg.cpp \
- kmwlocal.cpp kiconselectaction.cpp kmconfigpreview.cpp sidepixmap.cpp \
- pluginaction.cpp kxmlcommanddlg.cpp kxmlcommandselector.cpp kmconfigcommand.cpp \
- kmconfigfilter.cpp kmconfigfonts.cpp kmconfigjobs.cpp networkscanner.cpp
-libtdeprint_management_la_LDFLAGS = $(all_libraries) -version-info 6:0:2 -no-undefined
-libtdeprint_management_la_LIBADD = ../libtdeprint.la $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KFILE)
-libtdeprint_management_la_METASOURCES = AUTO
-
-libtdeprint_management_module_la_SOURCES = tdeprint_management_module.cpp
-libtdeprint_management_module_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined
-libtdeprint_management_module_la_LIBADD = libtdeprint_management.la $(LIB_QT) $(LIB_KDEUI) $(LIB_KDECORE)
-
-tdeprint_HEADERS = kmmainview.h kmjobviewer.h kmprinterpage.h kiconselectaction.h kmtimer.h
-tdeprintdir = $(includedir)/tdeprint
-
-noinst_HEADERS = kmdbcreator.h kmdriverdb.h kmdriverdbwidget.h kmiconview.h \
- kminfopage.h kmmainview.h kmpages.h \
- kmprinterpage.h kmprinterview.h kmjobviewer.h jobitem.h kmpropwidget.h kmpropcontainer.h \
- kmpropertypage.h kmpropgeneral.h cjanuswidget.h kmpropmembers.h kmpropbackend.h kmpropdriver.h \
- kmlistview.h kminstancepage.h kmwizard.h kmwizardpage.h kmwinfopage.h kmwpassword.h kmwsocketutil.h \
- kmwbackend.h kmwsocket.h kmwdriver.h kmwdriverselect.h kmwdrivertest.h kmwinfobase.h kmwname.h kmwend.h \
- kmwclass.h kmwlpd.h kmwfile.h kmdriverdialog.h kmwsmb.h smbview.h kmconfigdialog.h kmconfigpage.h \
- kmconfiggeneral.h kmspecialprinterdlg.h kmwlocal.h kmconfigpreview.h sidepixmap.h \
- pluginaction.h kxmlcommanddlg.h kxmlcommandselector.h kmconfigcommand.h \
- kmconfigfilter.h kmconfigfonts.h kmconfigjobs.h networkscanner.h
-
-dataicon_DATA = tileup.png tiledown.png side.png
-dataicondir = $(kde_datadir)/tdeprint
-
diff --git a/kdeprint/management/cjanuswidget.cpp b/kdeprint/management/cjanuswidget.cpp
deleted file mode 100644
index af04ee170..000000000
--- a/kdeprint/management/cjanuswidget.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "cjanuswidget.h"
-
-#include <tqwidgetstack.h>
-#include <tqlabel.h>
-#include <tqpainter.h>
-#include <klistbox.h>
-#include <tqlayout.h>
-#include <kseparator.h>
-
-class CJanusWidget::CPage
-{
-public:
- TQWidget *m_widget;
- TQString m_text;
- TQString m_header;
- TQPixmap m_pixmap;
- CListBoxItem *m_item;
-};
-
-//***********************************************************************************
-
-class CJanusWidget::CListBoxItem : public TQListBoxItem
-{
-public:
- CListBoxItem(TQListBox *lb, TQListBoxItem *after, const TQPixmap& pix, const TQString& text);
- int height(const TQListBox*) const;
- int width(const TQListBox*) const;
-
-protected:
- void paint(TQPainter*);
-
-private:
- TQPixmap m_pix;
-};
-
-CJanusWidget::CListBoxItem::CListBoxItem(TQListBox *lb, TQListBoxItem *after, const TQPixmap& pix, const TQString& text)
-: TQListBoxItem(lb, after), m_pix(pix)
-{
- setText(text);
-}
-
-int CJanusWidget::CListBoxItem::height(const TQListBox *lb) const
-{
- return (m_pix.height() + lb->fontMetrics().lineSpacing() + 12);
-}
-
-int CJanusWidget::CListBoxItem::width(const TQListBox *lb) const
-{
- int w = TQMAX(lb->fontMetrics().width(text()),m_pix.width());
- return (w + 10);
-}
-
-void CJanusWidget::CListBoxItem::paint(TQPainter *p)
-{
- int w1 = (listBox()->contentsWidth()-m_pix.width())/2;
-
- p->drawPixmap(w1,5,m_pix);
- p->drawText(0,7+m_pix.height(),listBox()->contentsWidth(),p->fontMetrics().lineSpacing(),Qt::AlignHCenter,text());
-}
-
-//***********************************************************************************
-
-class CJanusWidget::CListBox : public KListBox
-{
-public:
- CListBox(TQWidget *parent = 0, const char *name = 0);
- ~CListBox();
-
- void computeWidth();
-
-protected:
- virtual bool eventFilter(TQObject*, TQEvent*);
-};
-
-CJanusWidget::CListBox::CListBox(TQWidget *parent, const char *name)
-: KListBox(parent,name)
-{
- verticalScrollBar()->installEventFilter(this);
-}
-
-CJanusWidget::CListBox::~CListBox()
-{
-}
-
-bool CJanusWidget::CListBox::eventFilter(TQObject *o, TQEvent *e)
-{
- if (e->type() == TQEvent::Show || e->type() == TQEvent::Hide)
- computeWidth();
- return KListBox::eventFilter(o,e);
-}
-
-void CJanusWidget::CListBox::computeWidth()
-{
- TQListBoxItem *item = firstItem();
- int w(40);
- while (item)
- {
- w = TQMAX(w,item->width(this));
- item = item->next();
- }
- if (verticalScrollBar()->isVisible())
- w += verticalScrollBar()->tqsizeHint().width();
- w += (frameWidth()*2);
- setFixedWidth(w);
-}
-
-//***********************************************************************************
-
-CJanusWidget::CJanusWidget(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- m_pages.setAutoDelete(true);
-
- m_stack = new TQWidgetStack(this);
- m_header = new TQLabel(this);
- TQFont f(m_header->font());
- f.setBold(true);
- m_header->setFont(f);
-
- KSeparator* sep = new KSeparator( KSeparator::HLine, this);
- sep->setFixedHeight(5);
-
- m_iconlist = new CListBox(this);
- f = m_iconlist->font();
- f.setBold(true);
- m_iconlist->setFont(f);
- connect(m_iconlist,TQT_SIGNAL(selectionChanged(TQListBoxItem*)),TQT_SLOT(slotSelected(TQListBoxItem*)));
-
- m_empty = new TQWidget(this, "Empty");
- m_stack->addWidget(m_empty,0);
-
- TQHBoxLayout *main_ = new TQHBoxLayout(this, 0, 10);
- TQVBoxLayout *sub_ = new TQVBoxLayout(0, 0, 5);
- main_->addWidget(m_iconlist,0);
- main_->addLayout(sub_,1);
- sub_->addWidget(m_header,0);
- sub_->addWidget(sep,0);
- sub_->addWidget(m_stack,1);
-}
-
-CJanusWidget::~CJanusWidget()
-{
-}
-
-void CJanusWidget::addPage(TQWidget *w, const TQString& text, const TQString& header, const TQPixmap& pix)
-{
- CPage *page = new CPage();
- m_pages.append(page);
- page->m_widget = w;
- page->m_text = text;
- page->m_header = header;
- page->m_pixmap = pix;
- page->m_item = new CListBoxItem(m_iconlist,findPrevItem(page),pix,text);
- m_iconlist->computeWidth();
- m_stack->addWidget(w,m_pages.count());
-
- if (m_iconlist->count() == 1)
- m_iconlist->setSelected(page->m_item,true);
-}
-
-void CJanusWidget::enablePage(TQWidget *w)
-{
- CPage *page = findPage(w);
- if (page && !page->m_item)
- {
- page->m_item = new CListBoxItem(m_iconlist,findPrevItem(page),page->m_pixmap,page->m_text);
- m_iconlist->computeWidth();
- if (m_iconlist->count() == 1)
- m_iconlist->setSelected(page->m_item,true);
- }
-}
-
-void CJanusWidget::disablePage(TQWidget *w)
-{
- CPage *page = findPage(w);
- if (page && page->m_item)
- {
- bool needReselect(m_iconlist->isSelected(page->m_item));
- delete page->m_item;
- page->m_item = 0;
- m_iconlist->computeWidth();
- if (needReselect)
- if (m_iconlist->count() > 0)
- m_iconlist->setSelected(m_iconlist->firstItem(),true);
- else
- slotSelected(0);
- }
-}
-
-void CJanusWidget::slotSelected(TQListBoxItem *item)
-{
- CPage *page = findPage(item);
- if (page)
- {
- m_stack->raiseWidget(page->m_widget);
- m_header->setText(page->m_header);
- }
- else
- {
- m_header->setText("");
- m_stack->raiseWidget(m_empty);
- }
-}
-
-CJanusWidget::CPage* CJanusWidget::findPage(TQWidget *w)
-{
- TQPtrListIterator<CPage> it(m_pages);
- for (;it.current();++it)
- if (it.current()->m_widget == w)
- return it.current();
- return 0;
-}
-
-CJanusWidget::CPage* CJanusWidget::findPage(TQListBoxItem *i)
-{
- TQPtrListIterator<CPage> it(m_pages);
- for (;it.current();++it)
- if (it.current()->m_item == i)
- return it.current();
- return 0;
-}
-
-TQListBoxItem* CJanusWidget::findPrevItem(CPage *p)
-{
- if (m_pages.findRef(p) == -1)
- m_pages.last();
- else
- m_pages.prev();
- for (;m_pages.current();m_pages.prev())
- if (m_pages.current()->m_item)
- return m_pages.current()->m_item;
- return 0;
-}
-
-void CJanusWidget::clearPages()
-{
- TQPtrListIterator<CPage> it(m_pages);
- for (;it.current(); ++it)
- {
- delete it.current()->m_widget;
- delete it.current()->m_item;
- }
- m_pages.clear();
-}
-
-#include "cjanuswidget.moc"
diff --git a/kdeprint/management/cjanuswidget.h b/kdeprint/management/cjanuswidget.h
deleted file mode 100644
index d33be1499..000000000
--- a/kdeprint/management/cjanuswidget.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef CJANUSWIDGET_H
-#define CJANUSWIDGET_H
-
-#include <tqwidget.h>
-#include <tqpixmap.h>
-#include <tqptrlist.h>
-
-class TQWidgetStack;
-class TQLabel;
-class TQListBoxItem;
-
-class CJanusWidget : public TQWidget
-{
- Q_OBJECT
-public:
- CJanusWidget(TQWidget *parent, const char *name);
- ~CJanusWidget();
-
- void addPage(TQWidget *w, const TQString& text, const TQString& header, const TQPixmap& pix);
- void enablePage(TQWidget *w);
- void disablePage(TQWidget *w);
- void clearPages();
-
-protected slots:
- void slotSelected(TQListBoxItem*);
-
-public:
- class CPage;
- class CListBox;
- class CListBoxItem;
-
-private:
- CPage* findPage(TQWidget *w);
- CPage* findPage(TQListBoxItem *i);
- TQListBoxItem* findPrevItem(CPage*);
-
-private:
- TQPtrList<CPage> m_pages;
- CListBox *m_iconlist;
- TQLabel *m_header;
- TQWidgetStack *m_stack;
- TQWidget *m_empty;
-};
-
-#endif
diff --git a/kdeprint/management/jobitem.cpp b/kdeprint/management/jobitem.cpp
deleted file mode 100644
index a9ce2fe85..000000000
--- a/kdeprint/management/jobitem.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "jobitem.h"
-#include "kmjob.h"
-
-#include <kiconloader.h>
-
-JobItem::JobItem(TQListView *parent, KMJob *job)
-: TQListViewItem(parent)
-{
- m_job = new KMJob;
- init(job);
-}
-
-JobItem::~JobItem()
-{
- delete m_job;
-}
-
-void JobItem::init(KMJob *job)
-{
- m_job->copy(job ? *job : KMJob());
-
- setPixmap(0,SmallIcon(m_job->pixmap()));
- setText(0,TQString::number(m_job->id()));
- //setText(6,m_job->printer());
- setText(2,m_job->name());
- setText(1,m_job->owner());
- setText(3,m_job->stateString());
- setText(4,TQString::number(m_job->size()));
- setText(5,TQString::number(m_job->processedPages()));
- m_ID = m_job->id();
- m_uri = m_job->uri();
-
- // additional attributes
- for (int i=0; i<m_job->attributeCount(); i++)
- setText(6+i, m_job->attribute(i));
-
- widthChanged();
-}
-
-int JobItem::compare(TQListViewItem *item, int col, bool asc) const
-{
- switch (col)
- {
- case 0:
- case 4:
- case 5:
- {
- int i1(this->text(col).toInt()), i2(item->text(col).toInt());
- return (i1 < i2 ? -1 : (i1 > i2 ? 1 : 0));
- break;
- }
- default:
- return TQListViewItem::compare(item, col, asc);
- }
-}
diff --git a/kdeprint/management/jobitem.h b/kdeprint/management/jobitem.h
deleted file mode 100644
index 580a1b84f..000000000
--- a/kdeprint/management/jobitem.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef JOBITEM_H
-#define JOBITEM_H
-
-#include <tqlistview.h>
-#include "kmobject.h"
-
-class KMJob;
-
-class JobItem : public TQListViewItem, public KMObject
-{
-public:
- JobItem(TQListView *parent, KMJob *job = 0);
- ~JobItem();
- void init(KMJob *job);
- int compare(TQListViewItem*, int, bool) const;
-
- int jobID() const;
- TQString jobUri() const;
- KMJob* job() const;
-
-private:
- KMJob *m_job;
- int m_ID;
- QString m_uri;
-};
-
-inline int JobItem::jobID() const
-{ return m_ID; }
-
-inline KMJob* JobItem::job() const
-{ return m_job; }
-
-inline TQString JobItem::jobUri() const
-{ return m_uri; }
-
-#endif
diff --git a/kdeprint/management/kaddprinterwizard.cpp b/kdeprint/management/kaddprinterwizard.cpp
deleted file mode 100644
index 65d355a8f..000000000
--- a/kdeprint/management/kaddprinterwizard.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "kmmanager.h"
-#include <kcmdlineargs.h>
-#include <kapplication.h>
-#include <kmessagebox.h>
-#include <klocale.h>
-#include <kglobal.h>
-
-static KCmdLineOptions options[] =
-{
- { "kdeconfig", I18N_NOOP("Configure KDE Print"), 0 },
- { "serverconfig", I18N_NOOP("Configure print server"), 0 },
- KCmdLineLastOption
-};
-
-extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
-{
- KCmdLineArgs::init(argc, argv, "kaddprinterwizard",
- I18N_NOOP("Start the add printer wizard"),
- "0.1");
- KCmdLineArgs::addCmdLineOptions(options);
-
- KGlobal::locale()->setMainCatalogue("kdelibs");
-
- KApplication app;
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
- bool doConfig = args->isSet("kdeconfig");
- bool doSrvConfig = args->isSet("serverconfig");
-
- if (doConfig)
- KMManager::self()->invokeOptionsDialog();
- else if (doSrvConfig)
- KMManager::self()->configureServer();
- else if (KMManager::self()->addPrinterWizard() == -1)
- {
- KMessageBox::error(0, KMManager::self()->errorMsg().prepend("<qt>").append("</qt>"));
- }
-
- return 0;
-}
diff --git a/kdeprint/management/kdeprint_management_module.cpp b/kdeprint/management/kdeprint_management_module.cpp
deleted file mode 100644
index 8d4027f75..000000000
--- a/kdeprint/management/kdeprint_management_module.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- * Copyright (C) 2004 Dominique Devriese <devriese@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kxmlcommandselector.h"
-#include "kmconfigdialog.h"
-#include "kmwizard.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-#include "kmprinter.h"
-#include "kmmainview.h"
-
-#include <kmessagebox.h>
-#include <kdialogbase.h>
-#include <klocale.h>
-
-extern "C"
-{
- KDEPRINT_EXPORT int add_printer_wizard(TQWidget *parent)
- {
- return tdeprint_management_add_printer_wizard( parent );
- }
-
- KDEPRINT_EXPORT bool config_dialog(TQWidget *parent)
- {
- KMConfigDialog dlg(parent);
- return dlg.exec();
- }
-
- KDEPRINT_EXPORT TQString select_command( TQWidget* parent )
- {
- KDialogBase dlg( parent, 0, true, i18n( "Select Command" ), KDialogBase::Ok|KDialogBase::Cancel );
- KXmlCommandSelector *xmlSel = new KXmlCommandSelector( false, &dlg, "CommandSelector", &dlg );
- dlg.setMainWidget( xmlSel );
- if ( dlg.exec() )
- return xmlSel->command();
- return TQString::null;
- }
-}
-
diff --git a/kdeprint/management/kiconselectaction.cpp b/kdeprint/management/kiconselectaction.cpp
deleted file mode 100644
index 8bf4d5a10..000000000
--- a/kdeprint/management/kiconselectaction.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kiconselectaction.h"
-
-#include <tqpopupmenu.h>
-#include <kiconloader.h>
-#include <kdebug.h>
-#include <ktoolbar.h>
-#include <ktoolbarbutton.h>
-
-class KIconSelectActionPrivate
-{
-public:
- KIconSelectActionPrivate()
- {
- m_menu = 0;
- }
- TQStringList m_iconlst;
- TQPopupMenu* m_menu;
-};
-
-KIconSelectAction::KIconSelectAction(const TQString& text, int accel, TQObject* parent, const char* name)
-: KSelectAction(text, accel, parent, name)
-{
- d = new KIconSelectActionPrivate;
-}
-
-KIconSelectAction::~KIconSelectAction()
-{
- delete d;
-}
-
-void KIconSelectAction::updateIcons()
-{
- if (d->m_menu)
- {
- TQStringList lst = items();
- for (uint id=0; id<lst.count(); ++id)
- d->m_menu->changeItem(id, SmallIconSet(d->m_iconlst[id]), lst[id]);
- }
-}
-
-void KIconSelectAction::createPopupMenu()
-{
- if (!d->m_menu)
- {
- d->m_menu = popupMenu();
- updateIcons();
- }
-}
-
-void KIconSelectAction::setItems(const TQStringList& lst, const TQStringList& iconlst)
-{
- KSelectAction::setItems(lst);
- d->m_iconlst = iconlst;
- updateIcons();
-}
-
-int KIconSelectAction::plug(TQWidget* widget, int index)
-{
- int value(-1);
- if (widget->inherits(TQPOPUPMENU_OBJECT_NAME_STRING))
- {
- createPopupMenu();
- value = KSelectAction::plug(widget, index);
- }
- else if (widget->inherits("KToolBar"))
- {
- KToolBar* bar = static_cast<KToolBar*>(widget);
- int id = KAction::getToolButtonID();
- // To have a correct layout in the toolbar, a non
- // empty icon has to be used. Use "unknown" by default.
- TQString iconName = (currentItem() != -1 ? d->m_iconlst[currentItem()] : "unknown");
-
- createPopupMenu();
- bar->insertButton(iconName, id, true, plainText(), index);
- bar->getButton(id)->setPopup(d->m_menu, true);
- bar->setItemEnabled(id, isEnabled());
- addContainer(bar, id);
- connect(bar, TQT_SIGNAL(destroyed()), TQT_SLOT(slotDestroyed()));
-
- value = containerCount()-1;
- }
- return value;
-}
-
-void KIconSelectAction::updateCurrentItem(int id)
-{
- TQWidget* w = container(id);
- if (w->inherits("KToolBar"))
- static_cast<KToolBar*>(w)->getButton(itemId(id))->setIcon(d->m_iconlst[currentItem()]);
- else
- KSelectAction::updateCurrentItem(id);
-}
-
-void KIconSelectAction::setCurrentItem(int index)
-{
- KSelectAction::setCurrentItem(index);
-}
-
-#include "kiconselectaction.moc"
diff --git a/kdeprint/management/kiconselectaction.h b/kdeprint/management/kiconselectaction.h
deleted file mode 100644
index 84bef60d2..000000000
--- a/kdeprint/management/kiconselectaction.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KICONSELECTACTION_H
-#define KICONSELECTACTION_H
-
-#include <kaction.h>
-
-class KIconSelectActionPrivate;
-
-class KIconSelectAction : public KSelectAction
-{
- Q_OBJECT
-public:
- KIconSelectAction(const TQString& text, int accel = 0, TQObject* parent = 0, const char* name = 0);
- virtual ~KIconSelectAction();
-
- virtual int plug(TQWidget* widget, int index = -1);
-
-public slots:
- virtual void setItems(const TQStringList& lst, const TQStringList& iconlst);
- virtual void setCurrentItem(int index);
-
-protected:
- void createPopupMenu();
- void updateIcons();
- virtual void updateCurrentItem(int id);
-
-private:
- KIconSelectActionPrivate* d;
-};
-
-#endif
diff --git a/kdeprint/management/kmconfigcommand.cpp b/kdeprint/management/kmconfigcommand.cpp
deleted file mode 100644
index 32fb7db11..000000000
--- a/kdeprint/management/kmconfigcommand.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfigcommand.h"
-#include "kxmlcommandselector.h"
-
-#include <tqlabel.h>
-#include <tqgroupbox.h>
-#include <tqlayout.h>
-
-#include <klocale.h>
-#include <kdialog.h>
-
-KMConfigCommand::KMConfigCommand(TQWidget *parent, const char *name)
-: KMConfigPage(parent, name)
-{
- setPageName(i18n("Commands"));
- setPageHeader(i18n("Command Settings"));
- setPagePixmap("exec");
-
- TQGroupBox *gb = new TQGroupBox(0, Qt::Horizontal, i18n("Edit/Create Commands"), this);
- TQLabel *lab = new TQLabel(i18n(
- "<p>Command objects perform a conversion from input to output.<br>"
- "They are used as the basis to build both print filters "
- "and special printers. They are described by a command string, a "
- "set of options, a set of requirements and associated mime types. "
- "Here you can create new command objects and edit existing ones. All "
- "changes will only be effective for you."), gb);
- KXmlCommandSelector *sel = new KXmlCommandSelector(false, gb);
-
- TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- l0->addWidget(gb);
- l0->addStretch(1);
- TQVBoxLayout *l2 = new TQVBoxLayout(TQT_TQLAYOUT(gb->layout()), KDialog::spacingHint());
- l2->addWidget(lab);
- l2->addWidget(sel);
-}
diff --git a/kdeprint/management/kmconfigcommand.h b/kdeprint/management/kmconfigcommand.h
deleted file mode 100644
index 203e6fd3a..000000000
--- a/kdeprint/management/kmconfigcommand.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGCOMMAND_H
-#define KMCONFIGCOMMAND_H
-
-#include "kmconfigpage.h"
-
-class KMConfigCommand : public KMConfigPage
-{
-public:
- KMConfigCommand(TQWidget *parent = 0, const char *name = 0);
-};
-
-#endif
diff --git a/kdeprint/management/kmconfigdialog.cpp b/kdeprint/management/kmconfigdialog.cpp
deleted file mode 100644
index 3bd89a751..000000000
--- a/kdeprint/management/kmconfigdialog.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfigdialog.h"
-#include "kmconfigpage.h"
-#include "kmfactory.h"
-#include "kmuimanager.h"
-
-#include "kmconfiggeneral.h"
-#include "kmconfigpreview.h"
-#include "kmconfigcommand.h"
-#include "kmconfigfilter.h"
-#include "kmconfigfonts.h"
-#include "kmconfigjobs.h"
-
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kconfig.h>
-
-KMConfigDialog::KMConfigDialog(TQWidget *parent, const char *name)
-: KDialogBase(IconList,i18n("KDE Print Configuration"),Ok|Cancel,Ok,parent,name,true,true)
-{
- m_pages.setAutoDelete(false);
- addConfigPage(new KMConfigGeneral(this));
- addConfigPage(new KMConfigPreview(this));
- addConfigPage(new KMConfigFonts(this));
- addConfigPage(new KMConfigCommand(this));
- addConfigPage(new KMConfigFilter(this));
- addConfigPage(new KMConfigJobs(this));
- KMFactory::self()->uiManager()->setupConfigDialog(this);
-
- // initialize pages
- KConfig *conf = KMFactory::self()->printConfig();
- TQPtrListIterator<KMConfigPage> it(m_pages);
- for (;it.current();++it)
- it.current()->loadConfig(conf);
-
- // resize dialog
- resize(450,400);
-}
-
-void KMConfigDialog::addConfigPage(KMConfigPage *page)
-{
- if (page)
- {
- TQPixmap icon = KGlobal::instance()->iconLoader()->loadIcon(
- page->pagePixmap(),
- KIcon::NoGroup,
- KIcon::SizeMedium
- );
-
- TQFrame *frame = addPage(page->pageName(),page->pageHeader(),icon);
- page->reparent(frame,TQPoint(0,0));
- TQVBoxLayout *lay = new TQVBoxLayout(frame, 0, 0);
- lay->addWidget(page);
- m_pages.append(page);
- }
-}
-
-void KMConfigDialog::slotOk()
-{
- // save configuration
- KConfig *conf = KMFactory::self()->printConfig();
- TQPtrListIterator<KMConfigPage> it(m_pages);
- for (;it.current();++it)
- it.current()->saveConfig(conf);
- KMFactory::self()->saveConfig();
-
- // close the dialog
- KDialogBase::slotOk();
-}
-#include "kmconfigdialog.moc"
diff --git a/kdeprint/management/kmconfigdialog.h b/kdeprint/management/kmconfigdialog.h
deleted file mode 100644
index de04bc154..000000000
--- a/kdeprint/management/kmconfigdialog.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGDIALOG_H
-#define KMCONFIGDIALOG_H
-
-#include <kdialogbase.h>
-#include <tqptrlist.h>
-
-#include "kmconfigpage.h"
-
-class KDEPRINT_EXPORT KMConfigDialog : public KDialogBase
-{
- Q_OBJECT
-public:
- KMConfigDialog(TQWidget *parent = 0, const char *name = 0);
-
- void addConfigPage(KMConfigPage*);
-
-protected slots:
- void slotOk();
-
-private:
- TQPtrList<KMConfigPage> m_pages;
-};
-
-#endif
diff --git a/kdeprint/management/kmconfigfilter.cpp b/kdeprint/management/kmconfigfilter.cpp
deleted file mode 100644
index 29d5107e0..000000000
--- a/kdeprint/management/kmconfigfilter.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfigfilter.h"
-#include "kmmanager.h"
-#include "kmfactory.h"
-
-#include <tqgroupbox.h>
-#include <tqlineedit.h>
-#include <tqtoolbutton.h>
-#include <tqlayout.h>
-#include <tqlabel.h>
-#include <tqapplication.h>
-
-#include <klocale.h>
-#include <kconfig.h>
-#include <kiconloader.h>
-#include <klistbox.h>
-#include <kdialog.h>
-
-KMConfigFilter::KMConfigFilter(TQWidget *parent, const char *name)
-: KMConfigPage(parent, name)
-{
- setPageName(i18n("Filter"));
- setPageHeader(i18n("Printer Filtering Settings"));
- setPagePixmap("filter");
-
- TQGroupBox *box = new TQGroupBox(0, Qt::Vertical, i18n("Printer Filter"), this);
-
- m_list1 = new KListBox(box);
- m_list1->setSelectionMode(KListBox::Extended);
- m_list2 = new KListBox(box);
- m_list2->setSelectionMode(KListBox::Extended);
- m_add = new TQToolButton( box );
- m_add->setIconSet(TQApplication::reverseLayout() ? SmallIconSet( "back" ) : SmallIconSet( "forward" ));
- m_remove = new TQToolButton( box );
- m_remove->setIconSet(TQApplication::reverseLayout() ? SmallIconSet( "forward" ) : SmallIconSet( "back" ));
- m_locationre = new TQLineEdit(box);
- TQLabel *lab = new TQLabel(box);
- lab->setText(i18n("The printer filtering allows you to view only a specific set of "
- "printers instead of all of them. This may be useful when there are a "
- "lot of printers available but you only use a few ones. Select the "
- "printers you want to see from the list on the left or enter a <b>Location</b> "
- "filter (ex: Group_1*). Both are cumulative and ignored if empty."));
- lab->setTextFormat(TQt::RichText);
- TQLabel *lab1 = new TQLabel(i18n("Location filter:"), box);
-
- TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- l0->addWidget(box, 1);
- TQVBoxLayout *l1 = new TQVBoxLayout(TQT_TQLAYOUT(box->layout()), KDialog::spacingHint());
- l1->addWidget(lab);
- TQGridLayout *l2 = new TQGridLayout(0, 4, 3, 0, KDialog::spacingHint());
- l1->addLayout(TQT_TQLAYOUT(l2));
- l2->setRowStretch(0, 1);
- l2->setRowStretch(3, 1);
- l2->setColStretch(0, 1);
- l2->setColStretch(2, 1);
- l2->addMultiCellWidget(m_list1, 0, 3, 0, 0);
- l2->addMultiCellWidget(m_list2, 0, 3, 2, 2);
- l2->addWidget(m_add, 1, 1);
- l2->addWidget(m_remove, 2, 1);
- TQHBoxLayout *l3 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
- l1->addLayout(l3, 0);
- l3->addWidget(lab1, 0);
- l3->addWidget(m_locationre, 1);
-
- connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddClicked()));
- connect(m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveClicked()));
- connect(m_list1, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelectionChanged()));
- connect(m_list2, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelectionChanged()));
- m_add->setEnabled(false);
- m_remove->setEnabled(false);
-}
-
-void KMConfigFilter::loadConfig(KConfig *conf)
-{
- conf->setGroup("Filter");
- TQStringList m_plist = conf->readListEntry("Printers");
- TQPtrListIterator<KMPrinter> it(*(KMManager::self()->printerListComplete(false)));
- for (; it.current(); ++it)
- {
- if (!it.current()->isSpecial() && !it.current()->isVirtual())
- {
- KListBox *lb = (m_plist.find(it.current()->printerName()) == m_plist.end() ? m_list1 : m_list2);
- lb->insertItem(SmallIcon(it.current()->pixmap()), it.current()->printerName());
- }
- }
- m_list1->sort();
- m_list2->sort();
- m_locationre->setText(conf->readEntry("LocationRe"));
-}
-
-void KMConfigFilter::saveConfig(KConfig *conf)
-{
- conf->setGroup("Filter");
- TQStringList plist;
- for (uint i=0; i<m_list2->count(); i++)
- plist << m_list2->text(i);
- conf->writeEntry("Printers", plist);
- conf->writeEntry("LocationRe", m_locationre->text());
-}
-
-void KMConfigFilter::transfer(KListBox *from, KListBox *to)
-{
- for (uint i=0; i<from->count();)
- {
- if (from->isSelected(i))
- {
- to->insertItem(*(from->pixmap(i)), from->text(i));
- from->removeItem(i);
- }
- else
- i++;
- }
- to->sort();
-}
-
-void KMConfigFilter::slotAddClicked()
-{
- transfer(m_list1, m_list2);
-}
-
-void KMConfigFilter::slotRemoveClicked()
-{
- transfer(m_list2, m_list1);
-}
-
-void KMConfigFilter::slotSelectionChanged()
-{
- const KListBox *lb = static_cast<const KListBox*>(sender());
- if (!lb)
- return;
- TQToolButton *pb = (lb == m_list1 ? m_add : m_remove);
- for (uint i=0; i<lb->count(); i++)
- if (lb->isSelected(i))
- {
- pb->setEnabled(true);
- return;
- }
- pb->setEnabled(false);
-}
-
-#include "kmconfigfilter.moc"
diff --git a/kdeprint/management/kmconfigfilter.h b/kdeprint/management/kmconfigfilter.h
deleted file mode 100644
index 9571f0d54..000000000
--- a/kdeprint/management/kmconfigfilter.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGFILTER_H
-#define KMCONFIGFILTER_H
-
-#include "kmconfigpage.h"
-
-class KListBox;
-class TQToolButton;
-class TQLineEdit;
-
-class KMConfigFilter : public KMConfigPage
-{
- Q_OBJECT
-public:
- KMConfigFilter(TQWidget *parent = 0, const char *name = 0);
-
- void loadConfig(KConfig*);
- void saveConfig(KConfig*);
-
-protected slots:
- void slotSelectionChanged();
- void slotAddClicked();
- void slotRemoveClicked();
-
-protected:
- void transfer(KListBox *from, KListBox *to);
-
-private:
- KListBox *m_list1, *m_list2;
- TQToolButton *m_add, *m_remove;
- TQLineEdit *m_locationre;
-};
-
-#endif
diff --git a/kdeprint/management/kmconfigfonts.cpp b/kdeprint/management/kmconfigfonts.cpp
deleted file mode 100644
index 183d0b621..000000000
--- a/kdeprint/management/kmconfigfonts.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfigfonts.h"
-
-#include <tqgroupbox.h>
-#include <kpushbutton.h>
-#include <tqlayout.h>
-#include <tqheader.h>
-#include <tqlabel.h>
-#include <tqcheckbox.h>
-#include <tqsettings.h>
-#include <tqwhatsthis.h>
-
-#include <klocale.h>
-#include <kconfig.h>
-#include <kiconloader.h>
-#include <kurlrequester.h>
-#include <kfile.h>
-#include <klistview.h>
-#include <kdialog.h>
-
-KMConfigFonts::KMConfigFonts(TQWidget *parent, const char *name)
-: KMConfigPage(parent, name)
-{
- setPageName(i18n("Fonts"));
- setPageHeader(i18n("Font Settings"));
- setPagePixmap("fonts");
-
- TQGroupBox *box = new TQGroupBox(0, Qt::Vertical, i18n("Fonts Embedding"), this);
- TQGroupBox *box2 = new TQGroupBox(0, Qt::Vertical, i18n("Fonts Path"), this);
-
- m_embedfonts = new TQCheckBox(i18n("&Embed fonts in PostScript data when printing"), box);
- m_fontpath = new KListView(box2);
- m_fontpath->addColumn("");
- m_fontpath->header()->setStretchEnabled(true, 0);
- m_fontpath->header()->hide();
- m_fontpath->setSorting(-1);
- m_addpath = new KURLRequester(box2);
- m_addpath->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly);
- m_up = new KPushButton(KGuiItem(i18n("&Up"), "up"), box2);
- m_down = new KPushButton(KGuiItem(i18n("&Down"), "down"), box2);
- m_add = new KPushButton(KGuiItem(i18n("&Add"), "add"), box2);
- m_remove = new KPushButton(KGuiItem(i18n("&Remove"), "editdelete"), box2);
- TQLabel *lab0 = new TQLabel(i18n("Additional director&y:"), box2);
- lab0->setBuddy(m_addpath);
-
- TQVBoxLayout *l0 = new TQVBoxLayout(TQT_TQLAYOUT(box->layout()), KDialog::spacingHint());
- l0->addWidget(m_embedfonts);
- TQVBoxLayout *l1 = new TQVBoxLayout(TQT_TQLAYOUT(box2->layout()), KDialog::spacingHint());
- l1->addWidget(m_fontpath);
- TQHBoxLayout *l2 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
- l1->addLayout(l2);
- l2->addWidget(m_up);
- l2->addWidget(m_down);
- l2->addWidget(m_remove);
- l1->addSpacing(10);
- l1->addWidget(lab0);
- l1->addWidget(m_addpath);
- TQHBoxLayout *l3 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
- l1->addLayout(l3);
- l3->addStretch(1);
- l3->addWidget(m_add);
- TQVBoxLayout *l4 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- l4->addWidget(box);
- l4->addWidget(box2);
-
- TQWhatsThis::add(m_embedfonts,
- i18n("These options will automatically put fonts in the PostScript file "
- "which are not present on the printer. Font embedding usually produces better print results "
- "(closer to what you see on the screen), but larger print data as well."));
- TQWhatsThis::add(m_fontpath,
- i18n("When using font embedding you can select additional directories where "
- "KDE should search for embeddable font files. By default, the X server "
- "font path is used, so adding those directories is not needed. The default "
- "search path should be sufficient in most cases."));
-
- connect(m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemove()));
- connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAdd()));
- connect(m_up, TQT_SIGNAL(clicked()), TQT_SLOT(slotUp()));
- connect(m_down, TQT_SIGNAL(clicked()), TQT_SLOT(slotDown()));
- connect(m_fontpath, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelected()));
- connect(m_addpath, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotTextChanged(const TQString&)));
- m_add->setEnabled(false);
- m_remove->setEnabled(false);
- m_up->setEnabled(false);
- m_down->setEnabled(false);
-}
-
-void KMConfigFonts::loadConfig(KConfig *)
-{
- TQSettings settings;
- m_embedfonts->setChecked(settings.readBoolEntry("/qt/embedFonts", true));
- TQStringList paths = settings.readListEntry("/qt/fontPath", ':');
- TQListViewItem *item(0);
- for (TQStringList::ConstIterator it=paths.begin(); it!=paths.end(); ++it)
- item = new TQListViewItem(m_fontpath, item, *it);
-}
-
-void KMConfigFonts::saveConfig(KConfig *)
-{
- TQSettings settings;
- settings.writeEntry("/qt/embedFonts", m_embedfonts->isChecked());
- TQStringList l;
- TQListViewItem *item = m_fontpath->firstChild();
- while (item)
- {
- l << item->text(0);
- item = item->nextSibling();
- }
- settings.writeEntry("/qt/fontPath", l, ':');
-}
-
-void KMConfigFonts::slotSelected()
-{
- TQListViewItem *item = m_fontpath->selectedItem();
- m_remove->setEnabled(item);
- m_up->setEnabled(item && item->itemAbove());
- m_down->setEnabled(item && item->itemBelow());
-}
-
-void KMConfigFonts::slotAdd()
-{
- if (m_addpath->url().isEmpty())
- return;
- TQListViewItem *lastItem(m_fontpath->firstChild());
- while (lastItem && lastItem->nextSibling())
- lastItem = lastItem->nextSibling();
- TQListViewItem *item = new TQListViewItem(m_fontpath, lastItem, m_addpath->url());
- m_fontpath->setSelected(item, true);
-}
-
-void KMConfigFonts::slotRemove()
-{
- delete m_fontpath->selectedItem();
- if (m_fontpath->currentItem())
- m_fontpath->setSelected(m_fontpath->currentItem(), true);
- slotSelected();
-}
-
-void KMConfigFonts::slotUp()
-{
- TQListViewItem *citem = m_fontpath->selectedItem(), *nitem = 0;
- if (!citem || !citem->itemAbove())
- return;
- nitem = new TQListViewItem(m_fontpath, citem->itemAbove()->itemAbove(), citem->text(0));
- delete citem;
- m_fontpath->setSelected(nitem, true);
-}
-
-void KMConfigFonts::slotDown()
-{
- TQListViewItem *citem = m_fontpath->selectedItem(), *nitem = 0;
- if (!citem || !citem->itemBelow())
- return;
- nitem = new TQListViewItem(m_fontpath, citem->itemBelow(), citem->text(0));
- delete citem;
- m_fontpath->setSelected(nitem, true);
-}
-
-void KMConfigFonts::slotTextChanged(const TQString& t)
-{
- m_add->setEnabled(!t.isEmpty());
-}
-
-#include "kmconfigfonts.moc"
diff --git a/kdeprint/management/kmconfigfonts.h b/kdeprint/management/kmconfigfonts.h
deleted file mode 100644
index a93a26d75..000000000
--- a/kdeprint/management/kmconfigfonts.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGFONTS_H
-#define KMCONFIGFONTS_H
-
-#include "kmconfigpage.h"
-
-class KListView;
-class KURLRequester;
-class TQPushButton;
-class TQCheckBox;
-
-class KMConfigFonts : public KMConfigPage
-{
- Q_OBJECT
-public:
- KMConfigFonts(TQWidget *parent = 0, const char *name = 0);
-
- void loadConfig(KConfig*);
- void saveConfig(KConfig*);
-
-protected slots:
- void slotUp();
- void slotDown();
- void slotRemove();
- void slotAdd();
- void slotSelected();
- void slotTextChanged(const TQString&);
-
-private:
- TQCheckBox *m_embedfonts;
- KListView *m_fontpath;
- KURLRequester *m_addpath;
- TQPushButton *m_up, *m_down, *m_add, *m_remove;
-};
-
-#endif
diff --git a/kdeprint/management/kmconfiggeneral.cpp b/kdeprint/management/kmconfiggeneral.cpp
deleted file mode 100644
index 40d187c3c..000000000
--- a/kdeprint/management/kmconfiggeneral.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfiggeneral.h"
-
-#include <tqlayout.h>
-#include <tqgroupbox.h>
-#include <tqcheckbox.h>
-#include <tqlabel.h>
-#include <tqwhatsthis.h>
-
-#include <kpushbutton.h>
-#include <klocale.h>
-#include <kurlrequester.h>
-#include <krun.h>
-#include <kmimemagic.h>
-#include <kconfig.h>
-#include <knuminput.h>
-#include <kmessagebox.h>
-#include <kcursor.h>
-#include <klineedit.h>
-#include <kguiitem.h>
-#include <kdialog.h>
-
-KMConfigGeneral::KMConfigGeneral(TQWidget *parent)
-: KMConfigPage(parent,"ConfigTimer")
-{
- setPageName(i18n("General"));
- setPageHeader(i18n("General Settings"));
- setPagePixmap("fileprint");
-
- TQGroupBox *m_timerbox = new TQGroupBox(0, Qt::Vertical, i18n("Refresh Interval"), this);
- m_timer = new KIntNumInput(m_timerbox,"Timer");
- m_timer->setRange(0,30);
- m_timer->setSuffix( i18n( " sec" ) );
- m_timer->setSpecialValueText(i18n("Disabled"));
- TQWhatsThis::add(m_timer, i18n("This time setting controls the refresh rate of various "
- "<b>KDE Print</b> components like the print manager "
- "and the job viewer."));
-
- TQGroupBox *m_testpagebox = new TQGroupBox(0, Qt::Vertical, i18n("Test Page"), this);
- m_defaulttestpage = new TQCheckBox(i18n("&Specify personal test page"), m_testpagebox, "TestPageCheck");
- m_testpage = new KURLRequester(m_testpagebox,"TestPage");
- m_preview = new KPushButton(KGuiItem(i18n("Preview..."), "filefind"), m_testpagebox);
- connect(m_defaulttestpage,TQT_SIGNAL(toggled(bool)),m_testpage,TQT_SLOT(setEnabled(bool)));
- connect(m_defaulttestpage,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(setEnabledPreviewButton(bool)));
- connect(m_preview,TQT_SIGNAL(clicked()),TQT_SLOT(slotTestPagePreview()));
- connect(m_testpage->lineEdit(),TQT_SIGNAL(textChanged ( const TQString & )),this,TQT_SLOT(testPageChanged(const TQString & )));
- m_testpage->setDisabled(true);
- m_preview->setDisabled(true);
- m_defaulttestpage->setCursor(KCursor::handCursor());
-
- TQGroupBox *m_statusbox = new TQGroupBox(0, Qt::Vertical, i18n("Miscellaneous"), this);
- m_statusmsg = new TQCheckBox(i18n("Sho&w printing status message box"), m_statusbox);
- m_uselast = new TQCheckBox(i18n("De&faults to the last printer used in the application"), m_statusbox);
-
- //layout
- TQVBoxLayout *lay0 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- lay0->addWidget(m_timerbox);
- lay0->addWidget(m_testpagebox);
- lay0->addWidget(m_statusbox);
- lay0->addStretch(1);
- TQVBoxLayout *lay1 = new TQVBoxLayout(TQT_TQLAYOUT(m_timerbox->layout()),
- KDialog::spacingHint());
- lay1->addWidget(m_timer);
- TQVBoxLayout *lay2 = new TQVBoxLayout(TQT_TQLAYOUT(m_testpagebox->layout()),
- KDialog::spacingHint());
- TQHBoxLayout *lay3 = new TQHBoxLayout(0, 0, 0);
- lay2->addWidget(m_defaulttestpage);
- lay2->addWidget(m_testpage);
- lay2->addLayout(lay3);
- lay3->addStretch(1);
- lay3->addWidget(m_preview);
- TQVBoxLayout *lay4 = new TQVBoxLayout(TQT_TQLAYOUT(m_statusbox->layout()),
- KDialog::spacingHint());
- lay4->addWidget(m_statusmsg);
- lay4->addWidget(m_uselast);
- m_preview->setEnabled( !m_testpage->url().isEmpty());
-}
-
-void KMConfigGeneral::testPageChanged(const TQString &test )
-{
- m_preview->setEnabled( !test.isEmpty());
-}
-
-void KMConfigGeneral::setEnabledPreviewButton(bool b)
-{
- m_preview->setEnabled(!m_testpage->url().isEmpty() && b);
-}
-
-void KMConfigGeneral::loadConfig(KConfig *conf)
-{
- conf->setGroup("General");
- m_timer->setValue(conf->readNumEntry("TimerDelay",5));
- TQString tpage = conf->readPathEntry("TestPage");
- if (!tpage.isEmpty())
- {
- m_defaulttestpage->setChecked(true);
- m_testpage->setURL(tpage);
- }
- m_statusmsg->setChecked(conf->readBoolEntry("ShowStatusMsg", true));
- m_uselast->setChecked(conf->readBoolEntry("UseLast", true));
-}
-
-void KMConfigGeneral::saveConfig(KConfig *conf)
-{
- conf->setGroup("General");
- conf->writeEntry("TimerDelay",m_timer->value());
- conf->writePathEntry("TestPage",(m_defaulttestpage->isChecked() ? m_testpage->url() : TQString::null));
- if (m_defaulttestpage->isChecked() && KMimeMagic::self()->findFileType(m_testpage->url())->mimeType() != "application/postscript")
- KMessageBox::sorry(this, i18n("The selected test page is not a PostScript file. You may not "
- "be able to test your printer anymore."));
- conf->writeEntry("ShowStatusMsg", m_statusmsg->isChecked());
- conf->writeEntry("UseLast", m_uselast->isChecked());
-}
-
-void KMConfigGeneral::slotTestPagePreview()
-{
- TQString tpage = m_testpage->url();
- if (tpage.isEmpty())
- KMessageBox::error(this, i18n("Empty file name."));
- else
- KRun::runURL(KURL( tpage ), KMimeMagic::self()->findFileType(tpage)->mimeType());
-}
-
-#include "kmconfiggeneral.moc"
diff --git a/kdeprint/management/kmconfiggeneral.h b/kdeprint/management/kmconfiggeneral.h
deleted file mode 100644
index 8fc6fa5ab..000000000
--- a/kdeprint/management/kmconfiggeneral.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGGENERAL_H
-#define KMCONFIGGENERAL_H
-
-#include "kmconfigpage.h"
-
-class KIntNumInput;
-class KURLRequester;
-class TQCheckBox;
-class TQPushButton;
-class KMConfigGeneral : public KMConfigPage
-{
- Q_OBJECT
-public:
- KMConfigGeneral(TQWidget *parent = 0);
-
- void loadConfig(KConfig*);
- void saveConfig(KConfig*);
-
-protected slots:
- void slotTestPagePreview();
- void testPageChanged(const TQString & );
- void setEnabledPreviewButton(bool b);
-private:
- KIntNumInput *m_timer;
- KURLRequester *m_testpage;
- TQCheckBox *m_defaulttestpage;
- TQPushButton *m_preview;
- TQCheckBox *m_statusmsg, *m_uselast;
-};
-
-#endif
diff --git a/kdeprint/management/kmconfigjobs.cpp b/kdeprint/management/kmconfigjobs.cpp
deleted file mode 100644
index 1088e1b3a..000000000
--- a/kdeprint/management/kmconfigjobs.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfigjobs.h"
-
-#include <tqgroupbox.h>
-#include <tqlayout.h>
-
-#include <knuminput.h>
-#include <klocale.h>
-#include <kconfig.h>
-#include <kdialog.h>
-
-KMConfigJobs::KMConfigJobs(TQWidget *parent, const char *name)
-: KMConfigPage(parent, name)
-{
- setPageName(i18n("Jobs"));
- setPageHeader(i18n("Print Job Settings"));
- setPagePixmap("exec");
-
- TQGroupBox *box = new TQGroupBox(0, Qt::Vertical, i18n("Jobs Shown"), this);
-
- m_limit = new KIntNumInput(box);
- m_limit->setRange(0, 9999, 1, true);
- m_limit->setSpecialValueText(i18n("Unlimited"));
- m_limit->setLabel(i18n("Maximum number of jobs shown:"));
-
- TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- l0->addWidget(box, 0);
- l0->addStretch(1);
- TQVBoxLayout *l1 = new TQVBoxLayout(TQT_TQLAYOUT(box->layout()), KDialog::spacingHint());
- l1->addWidget(m_limit);
-}
-
-void KMConfigJobs::loadConfig(KConfig *conf)
-{
- conf->setGroup("Jobs");
- m_limit->setValue(conf->readNumEntry("Limit", 0));
-}
-
-void KMConfigJobs::saveConfig(KConfig *conf)
-{
- conf->setGroup("Jobs");
- conf->writeEntry("Limit", m_limit->value());
-}
-
-#include "kmconfigjobs.moc"
diff --git a/kdeprint/management/kmconfigjobs.h b/kdeprint/management/kmconfigjobs.h
deleted file mode 100644
index 34be5b1ef..000000000
--- a/kdeprint/management/kmconfigjobs.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGJOBS_H
-#define KMCONFIGJOBS_H
-
-#include "kmconfigpage.h"
-
-class KIntNumInput;
-
-class KMConfigJobs : public KMConfigPage
-{
- Q_OBJECT
-public:
- KMConfigJobs(TQWidget *parent = 0, const char *name = 0);
-
- void loadConfig(KConfig*);
- void saveConfig(KConfig*);
-
-private:
- KIntNumInput *m_limit;
-};
-
-#endif
diff --git a/kdeprint/management/kmconfigpage.cpp b/kdeprint/management/kmconfigpage.cpp
deleted file mode 100644
index fb967e05d..000000000
--- a/kdeprint/management/kmconfigpage.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfigpage.h"
-
-KMConfigPage::KMConfigPage(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- m_name = "Name";
- m_header = "Header";
-}
-
-void KMConfigPage::loadConfig(KConfig*)
-{
-}
-
-void KMConfigPage::saveConfig(KConfig*)
-{
-}
-#include "kmconfigpage.moc"
diff --git a/kdeprint/management/kmconfigpage.h b/kdeprint/management/kmconfigpage.h
deleted file mode 100644
index d56fbde8b..000000000
--- a/kdeprint/management/kmconfigpage.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGPAGE_H
-#define KMCONFIGPAGE_H
-
-#include <tqwidget.h>
-
-#include <kdelibs_export.h>
-
-class KConfig;
-
-class KDEPRINT_EXPORT KMConfigPage : public TQWidget
-{
- Q_OBJECT
-public:
- KMConfigPage(TQWidget *parent = 0, const char *name = 0);
-
- virtual void loadConfig(KConfig*);
- virtual void saveConfig(KConfig*);
-
- TQString pageName() const { return m_name; }
- TQString pageHeader() const { return m_header; }
- TQString pagePixmap() const { return m_pixmap; }
-
-protected:
- void setPageName(const TQString& s) { m_name = s; }
- void setPageHeader(const TQString& s) { m_header = s; }
- void setPagePixmap(const TQString& s) { m_pixmap = s; }
-
-protected:
- QString m_name;
- QString m_header;
- QString m_pixmap;
-};
-
-#endif
diff --git a/kdeprint/management/kmconfigpreview.cpp b/kdeprint/management/kmconfigpreview.cpp
deleted file mode 100644
index cd777ec7a..000000000
--- a/kdeprint/management/kmconfigpreview.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmconfigpreview.h"
-
-#include <tqcheckbox.h>
-#include <tqlayout.h>
-#include <tqgroupbox.h>
-#include <tqlabel.h>
-
-#include <klocale.h>
-#include <kurlrequester.h>
-#include <kconfig.h>
-#include <kdialog.h>
-
-KMConfigPreview::KMConfigPreview(TQWidget *parent, const char *name)
-: KMConfigPage(parent, name)
-{
- setPageName(i18n("Preview"));
- setPageHeader(i18n("Preview Settings"));
- setPagePixmap("filefind");
-
- TQGroupBox *box = new TQGroupBox(0, Qt::Vertical, i18n("Preview Program"), this);
-
- m_useext = new TQCheckBox(i18n("&Use external preview program"), box);
- m_program = new KURLRequester(box);
- TQLabel *lab = new TQLabel(box);
- lab->setText(i18n("You can use an external preview program (PS viewer) instead of the "
- "KDE built-in preview system. Note that if the KDE default PS viewer "
- "(KGhostView) cannot be found, KDE tries automatically to find another "
- "external PostScript viewer"));
- lab->setTextFormat(TQt::RichText);
-
- TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- l0->addWidget(box);
- l0->addStretch(1);
- TQVBoxLayout *l1 = new TQVBoxLayout(TQT_TQLAYOUT(box->layout()), KDialog::spacingHint());
- l1->addWidget(lab);
- l1->addWidget(m_useext);
- l1->addWidget(m_program);
-
- connect(m_useext, TQT_SIGNAL(toggled(bool)), m_program, TQT_SLOT(setEnabled(bool)));
- m_program->setEnabled(false);
-}
-
-void KMConfigPreview::loadConfig(KConfig *conf)
-{
- conf->setGroup("General");
- m_useext->setChecked(conf->readBoolEntry("ExternalPreview", false));
- m_program->setURL(conf->readPathEntry("PreviewCommand", "gv"));
-}
-
-void KMConfigPreview::saveConfig(KConfig *conf)
-{
- conf->setGroup("General");
- conf->writeEntry("ExternalPreview", m_useext->isChecked());
- conf->writePathEntry("PreviewCommand", m_program->url());
-}
diff --git a/kdeprint/management/kmconfigpreview.h b/kdeprint/management/kmconfigpreview.h
deleted file mode 100644
index a9c826c98..000000000
--- a/kdeprint/management/kmconfigpreview.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMCONFIGPREVIEW_H
-#define KMCONFIGPREVIEW_H
-
-#include "kmconfigpage.h"
-
-class TQCheckBox;
-class KURLRequester;
-
-class KMConfigPreview : public KMConfigPage
-{
-public:
- KMConfigPreview(TQWidget *parent = 0, const char *name = 0);
-
- void loadConfig(KConfig*);
- void saveConfig(KConfig*);
-
-private:
- TQCheckBox *m_useext;
- KURLRequester *m_program;
-};
-
-#endif
diff --git a/kdeprint/management/kmdbcreator.cpp b/kdeprint/management/kmdbcreator.cpp
deleted file mode 100644
index 1a89d0a8e..000000000
--- a/kdeprint/management/kmdbcreator.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmdbcreator.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-
-#include <tqprogressdialog.h>
-#include <tqfileinfo.h>
-#include <tqdir.h>
-#include <klocale.h>
-#include <kapplication.h>
-#include <kstandarddirs.h>
-#include <kdebug.h>
-
-KMDBCreator::KMDBCreator(TQObject *parent, const char *name)
-: TQObject(parent,name)
-{
- m_dlg = 0;
- m_status = true;
-
- connect(&m_proc,TQT_SIGNAL(receivedStdout(KProcess*,char*,int)),TQT_SLOT(slotReceivedStdout(KProcess*,char*,int)));
- connect(&m_proc,TQT_SIGNAL(receivedStderr(KProcess*,char*,int)),TQT_SLOT(slotReceivedStderr(KProcess*,char*,int)));
- connect(&m_proc,TQT_SIGNAL(processExited(KProcess*)),TQT_SLOT(slotProcessExited(KProcess*)));
-}
-
-KMDBCreator::~KMDBCreator()
-{
- if (m_proc.isRunning())
- m_proc.kill();
- // do not delete the progress dialog anymore: it's persistent and owned by
- // it's parent. It will be destroyed along with its parent.
-}
-
-bool KMDBCreator::checkDriverDB(const TQString& dirname, const TQDateTime& d)
-{
- // don't block GUI
- kapp->processEvents();
-
- // first check current directory
- TQFileInfo dfi(dirname);
- if (dfi.lastModified() > d)
- return false;
-
- // then check most recent file in current directory
- TQDir dir(dirname);
- const TQFileInfoList *list = dir.entryInfoList(TQDir::Files,TQDir::Time);
- if (list && list->count() > 0 && list->getFirst()->lastModified() > d)
- return false;
-
- // then loop into subdirs
- TQStringList slist = dir.entryList(TQDir::Dirs,TQDir::Time);
- for (TQStringList::ConstIterator it=slist.begin(); it!=slist.end(); ++it)
- if ((*it) != "." && (*it) != ".." && !checkDriverDB(dir.absFilePath(*it),d))
- return false;
-
- // everything is OK
- return true;
-}
-
-bool KMDBCreator::createDriverDB(const TQString& dirname, const TQString& filename, TQWidget *parent)
-{
- bool started(true);
-
- // initialize status
- m_status = false;
- m_firstflag = true;
-
- // start the child process
- m_proc.clearArguments();
- TQString exestr = KMFactory::self()->manager()->driverDbCreationProgram();
- m_proc << exestr << dirname << filename;
- kdDebug() << "executing : " << exestr << " " << dirname << " " << filename << endl;
- TQString msg;
- if (exestr.isEmpty())
- msg = i18n("No executable defined for the creation of the "
- "driver database. This operation is not implemented.");
- else if (KStandardDirs::findExe(exestr).isEmpty())
- msg = i18n("The executable %1 could not be found in your "
- "PATH. Check that this program exists and is "
- "accessible in your PATH variable.").arg(exestr);
- else if (!m_proc.start(KProcess::NotifyOnExit, KProcess::AllOutput))
- msg = i18n("Unable to start the creation of the driver "
- "database. The execution of %1 failed.").arg(exestr);
- if (!msg.isEmpty())
- {
- KMManager::self()->setErrorMsg(msg);
- started = false;
- }
-
- // Create the dialog if the process is running and if needed
- if (started)
- {
- if (!m_dlg)
- {
- m_dlg = new TQProgressDialog(parent->tqtopLevelWidget(),"progress-dialog",true);
- m_dlg->setLabelText(i18n("Please wait while KDE rebuilds a driver database."));
- m_dlg->setCaption(i18n("Driver Database"));
- connect(m_dlg,TQT_SIGNAL(canceled()),TQT_SLOT(slotCancelled()));
- }
- m_dlg->setMinimumDuration(0); // always show the dialog
- m_dlg->setProgress(0); // to force showing
- }
- else
- // be sure to emit this signal otherwise the DB widget won't never be notified
- emit dbCreated();
-
- return started;
-}
-
-void KMDBCreator::slotReceivedStdout(KProcess*, char *buf, int len)
-{
- // save buffer
- TQString str( TQCString(buf, len) );
-
- // get the number, cut the string at the first '\n' otherwise
- // the toInt() will return 0. If that occurs for the first number,
- // then the number of steps will be also 0.
- bool ok;
- int p = str.find('\n');
- int n = str.mid(0, p).toInt(&ok);
-
- // process the number received
- if (ok && m_dlg)
- {
- if (m_firstflag)
- {
- m_dlg->setTotalSteps(n);
- m_firstflag = false;
- }
- else
- {
- m_dlg->setProgress(n);
- }
- }
-}
-
-void KMDBCreator::slotReceivedStderr(KProcess*, char*, int)
-{
- // just discard it for the moment
-}
-
-void KMDBCreator::slotProcessExited(KProcess*)
-{
- // delete the progress dialog
- if (m_dlg)
- {
- m_dlg->reset();
- }
-
- // set exit status
- m_status = (m_proc.normalExit() && m_proc.exitStatus() == 0);
- if (!m_status)
- {
- KMFactory::self()->manager()->setErrorMsg(i18n("Error while creating driver database: abnormal child-process termination."));
- // remove the incomplete driver DB file so that, it will be
- // reconstructed on next check
- TQFile::remove(m_proc.args()[2]);
- }
- //else
- emit dbCreated();
-}
-
-void KMDBCreator::slotCancelled()
-{
- if (m_proc.isRunning())
- m_proc.kill();
- else
- emit dbCreated();
-}
-#include "kmdbcreator.moc"
diff --git a/kdeprint/management/kmdbcreator.h b/kdeprint/management/kmdbcreator.h
deleted file mode 100644
index 319d270c0..000000000
--- a/kdeprint/management/kmdbcreator.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMDBCREATOR_H
-#define KMDBCREATOR_H
-
-#include <tqobject.h>
-#include <tqstring.h>
-#include <tqdatetime.h>
-#include <kprocess.h>
-
-class TQWidget;
-class TQProgressDialog;
-
-class KMDBCreator : public TQObject
-{
- Q_OBJECT
-public:
- KMDBCreator(TQObject *parent = 0, const char *name = 0);
- ~KMDBCreator();
-
- bool checkDriverDB(const TQString& dirname, const TQDateTime& d);
- bool createDriverDB(const TQString& dirname, const TQString& filename, TQWidget *parent = 0);
- bool status() const { return m_status; }
-
-protected slots:
- void slotReceivedStdout(KProcess *p, char *bufm, int len);
- void slotReceivedStderr(KProcess *p, char *bufm, int len);
- void slotProcessExited(KProcess *p);
- void slotCancelled();
-
-signals:
- void dbCreated();
-
-private:
- KProcess m_proc;
- TQProgressDialog *m_dlg;
- bool m_status;
- bool m_firstflag;
-};
-
-#endif
diff --git a/kdeprint/management/kmdriverdb.cpp b/kdeprint/management/kmdriverdb.cpp
deleted file mode 100644
index 6fbab45ec..000000000
--- a/kdeprint/management/kmdriverdb.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmdriverdb.h"
-#include "kmdbentry.h"
-#include "kmdbcreator.h"
-#include "kmmanager.h"
-#include "kmfactory.h"
-#include <kdebug.h>
-
-#include <tqfile.h>
-#include <tqtextstream.h>
-#include <tqfileinfo.h>
-#include <kstandarddirs.h>
-#include <kapplication.h>
-#include <kmessagebox.h>
-
-KMDriverDB* KMDriverDB::m_self = 0;
-
-KMDriverDB* KMDriverDB::self()
-{
- if (!m_self)
- {
- m_self = new KMDriverDB();
- Q_CHECK_PTR(m_self);
- }
- return m_self;
-}
-
-KMDriverDB::KMDriverDB(TQObject *parent, const char *name)
-: TQObject(parent,name)
-{
- m_creator = new KMDBCreator(this,"db-creator");
- connect(m_creator,TQT_SIGNAL(dbCreated()),TQT_SLOT(slotDbCreated()));
-
- m_entries.setAutoDelete(true);
- m_pnpentries.setAutoDelete(true);
-}
-
-KMDriverDB::~KMDriverDB()
-{
-}
-
-TQString KMDriverDB::dbFile()
-{
- // this calls insure missing directories creation
- TQString filename = locateLocal("data",TQString::tqfromLatin1("tdeprint/printerdb_%1.txt").arg(KMFactory::self()->printSystem()));
- return filename;
-}
-
-void KMDriverDB::init(TQWidget *parent)
-{
- TQFileInfo dbfi(dbFile());
- TQString dirname = KMFactory::self()->manager()->driverDirectory();
- TQStringList dbDirs = TQStringList::split(':', dirname, false);
- bool createflag(false);
-
- for (TQStringList::ConstIterator it=dbDirs.begin(); it!=dbDirs.end() && !createflag; ++it)
- if (!(*it).startsWith("module:") && !m_creator->checkDriverDB(*it, dbfi.lastModified()))
- createflag = true;
-
- if (createflag)
- {
- // starts DB creation and wait for creator signal
- if (!m_creator->createDriverDB(dirname,dbfi.absFilePath(),parent))
- KMessageBox::error(parent, KMFactory::self()->manager()->errorMsg().prepend("<qt>").append("</qt>"));
- }
- else if (m_entries.count() == 0)
- {
- // call directly the slot as the DB won't be re-created
- // this will (re)load the driver DB
- slotDbCreated();
- }
- else
- // no need to refresh, and already loaded, just emit signal
- emit dbLoaded(false);
-}
-
-void KMDriverDB::slotDbCreated()
-{
- // DB should be created, check creator status
- if (m_creator->status())
- {
- // OK, load DB and emit signal
- loadDbFile();
- emit dbLoaded(true);
- }
- else
- // error while creating DB, notify the DB widget
- emit error(KMManager::self()->errorMsg());
- // be sure to emit this signal to notify the DB widget
- //emit dbLoaded(true);
-}
-
-KMDBEntryList* KMDriverDB::findEntry(const TQString& manu, const TQString& model)
-{
- TQDict<KMDBEntryList> *models = m_entries.find(manu);
- if (models)
- return models->find(model);
- return 0;
-}
-
-KMDBEntryList* KMDriverDB::findPnpEntry(const TQString& manu, const TQString& model)
-{
- TQDict<KMDBEntryList> *models = m_pnpentries.find(manu);
- if (models)
- return models->find(model);
- return 0;
-}
-
-TQDict<KMDBEntryList>* KMDriverDB::findModels(const TQString& manu)
-{
- return m_entries.find(manu);
-}
-
-void KMDriverDB::insertEntry(KMDBEntry *entry)
-{
- // first check entry
- if (!entry->validate())
- {
- kdDebug() << "Incorrect entry, skipping...(" << entry->file << ")" << endl;
- delete entry;
- return;
- }
-
- // insert it in normal entries
- TQDict<KMDBEntryList> *models = m_entries.find(entry->manufacturer);
- if (!models)
- {
- models = new TQDict<KMDBEntryList>(17,false);
- models->setAutoDelete(true);
- m_entries.insert(entry->manufacturer,models);
- }
- KMDBEntryList *list = models->find(entry->model);
- if (!list)
- {
- list = new KMDBEntryList;
- list->setAutoDelete(true);
- models->insert(entry->model,list);
- }
- list->append(entry);
-
- if (!entry->pnpmanufacturer.isEmpty() && !entry->pnpmodel.isEmpty())
- {
- // insert it in PNP entries
- models = m_pnpentries.find(entry->manufacturer);
- if (!models)
- {
- models = new TQDict<KMDBEntryList>(17,false);
- models->setAutoDelete(true);
- m_pnpentries.insert(entry->manufacturer,models);
- }
- list = models->find(entry->model);
- if (!list)
- {
- list = new KMDBEntryList;
- list->setAutoDelete(true);
- models->insert(entry->model,list);
- }
- list->append(entry);
- }
-
- // don't block GUI
- kapp->processEvents();
-}
-
-/*
- Driver DB file format:
- FILE=<path>
- MANUFACTURER=<string>
- MODEL=<string>
- PNPMANUFACTURER=<string>
- PNPMODEL=<string>
- DESCRIPTION=<string>
-*/
-
-void KMDriverDB::loadDbFile()
-{
- // first clear everything
- m_entries.clear();
- m_pnpentries.clear();
-
- TQFile f(dbFile());
- if (f.exists() && f.open(IO_ReadOnly))
- {
- TQTextStream t(&f);
- TQString line;
- TQStringList words;
- KMDBEntry *entry(0);
-
- while (!t.eof())
- {
- line = t.readLine().stripWhiteSpace();
- if (line.isEmpty())
- continue;
- int p = line.find('=');
- if (p == -1)
- continue;
- words.clear();
- words << line.left(p) << line.mid(p+1);
- if (words[0] == "FILE")
- {
- if (entry) insertEntry(entry);
- entry = new KMDBEntry;
- entry->file = words[1];
- }
- else if (words[0] == "MANUFACTURER" && entry)
- entry->manufacturer = words[1].upper();
- else if (words[0] == "MODEL" && entry)
- entry->model = words[1];
- else if (words[0] == "MODELNAME" && entry)
- entry->modelname = words[1];
- else if (words[0] == "PNPMANUFACTURER" && entry)
- entry->pnpmanufacturer = words[1].upper();
- else if (words[0] == "PNPMODEL" && entry)
- entry->pnpmodel = words[1];
- else if (words[0] == "DESCRIPTION" && entry)
- entry->description = words[1];
- else if (words[0] == "RECOMMANDED" && entry && words[1].lower() == "yes")
- entry->recommended = true;
- else if (words[0] == "DRIVERCOMMENT" && entry)
- entry->drivercomment = ("<qt>"+words[1].replace("&lt;", "<").replace("&gt;", ">")+"</qt>");
- }
- if (entry)
- insertEntry(entry);
- }
-}
-#include "kmdriverdb.moc"
diff --git a/kdeprint/management/kmdriverdb.h b/kdeprint/management/kmdriverdb.h
deleted file mode 100644
index c5af6d53e..000000000
--- a/kdeprint/management/kmdriverdb.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMDRIVERDB_H
-#define KMDRIVERDB_H
-
-#include <tqobject.h>
-#include <tqptrlist.h>
-#include <tqdict.h>
-#include <tqstring.h>
-
-#include "kmdbentry.h"
-
-class KMDBCreator;
-
-class KMDriverDB : public TQObject
-{
- Q_OBJECT
-public:
- static KMDriverDB* self();
-
- KMDriverDB(TQObject *parent = 0, const char *name = 0);
- ~KMDriverDB();
-
- void init(TQWidget *parent = 0);
- KMDBEntryList* findEntry(const TQString& manu, const TQString& model);
- KMDBEntryList* findPnpEntry(const TQString& manu, const TQString& model);
- TQDict<KMDBEntryList>* findModels(const TQString& manu);
- const TQDict< TQDict<KMDBEntryList> >& manufacturers() const { return m_entries; }
-
-protected:
- void loadDbFile();
- void insertEntry(KMDBEntry *entry);
- TQString dbFile();
-
-protected slots:
- void slotDbCreated();
-
-signals:
- void dbLoaded(bool reloaded);
- void error(const TQString&);
-
-private:
- KMDBCreator *m_creator;
- TQDict< TQDict<KMDBEntryList> > m_entries;
- TQDict< TQDict<KMDBEntryList> > m_pnpentries;
-
- static KMDriverDB *m_self;
-};
-
-#endif
diff --git a/kdeprint/management/kmdriverdbwidget.cpp b/kdeprint/management/kmdriverdbwidget.cpp
deleted file mode 100644
index e9c490206..000000000
--- a/kdeprint/management/kmdriverdbwidget.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmdriverdbwidget.h"
-#include "kmdriverdb.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-#include "driver.h"
-
-#include <klistbox.h>
-#include <kpushbutton.h>
-#include <tqcheckbox.h>
-#include <kcursor.h>
-#include <tqapplication.h>
-#include <kmessagebox.h>
-#include <tqlayout.h>
-#include <tqlabel.h>
-#include <tqstrlist.h>
-
-#include <klocale.h>
-#include <kcursor.h>
-#include <kfiledialog.h>
-#include <kguiitem.h>
-#include <kio/netaccess.h>
-
-KMDriverDbWidget::KMDriverDbWidget(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- m_external = TQString::null;
- m_valid = false;
-
- // build widget
- m_manu = new KListBox(this);
- m_model = new KListBox(this);
- m_postscript = new TQCheckBox(i18n("&PostScript printer"),this);
- m_raw = new TQCheckBox(i18n("&Raw printer (no driver needed)"),this);
- m_postscript->setCursor(KCursor::handCursor());
- m_raw->setCursor(KCursor::handCursor());
- m_other = new KPushButton(KGuiItem(i18n("&Other..."), "fileopen"), this);
- TQLabel *l1 = new TQLabel(i18n("&Manufacturer:"), this);
- TQLabel *l2 = new TQLabel(i18n("Mo&del:"), this);
- l1->setBuddy(m_manu);
- l2->setBuddy(m_model);
-
- // build layout
- TQVBoxLayout *main_ = new TQVBoxLayout(this, 0, 10);
- TQGridLayout *sub1_ = new TQGridLayout(0, 2, 3, 0, 0);
- TQHBoxLayout *sub2_ = new TQHBoxLayout(0, 0, 10);
- main_->addLayout(TQT_TQLAYOUT(sub1_));
- main_->addLayout(sub2_);
- main_->addWidget(m_raw);
- sub1_->addWidget(l1,0,0);
- sub1_->addWidget(l2,0,2);
- sub1_->addWidget(m_manu,1,0);
- sub1_->addWidget(m_model,1,2);
- sub1_->addColSpacing(1,20);
- sub2_->addWidget(m_postscript,1);
- sub2_->addWidget(m_other,0);
-
- // build connections
- connect(KMDriverDB::self(),TQT_SIGNAL(dbLoaded(bool)),TQT_SLOT(slotDbLoaded(bool)));
- connect(KMDriverDB::self(), TQT_SIGNAL(error(const TQString&)), TQT_SLOT(slotError(const TQString&)));
- connect(m_manu,TQT_SIGNAL(highlighted(const TQString&)),TQT_SLOT(slotManufacturerSelected(const TQString&)));
- connect(m_raw,TQT_SIGNAL(toggled(bool)),m_manu,TQT_SLOT(setDisabled(bool)));
- connect(m_raw,TQT_SIGNAL(toggled(bool)),m_model,TQT_SLOT(setDisabled(bool)));
- connect(m_raw,TQT_SIGNAL(toggled(bool)),m_other,TQT_SLOT(setDisabled(bool)));
- connect(m_raw,TQT_SIGNAL(toggled(bool)),m_postscript,TQT_SLOT(setDisabled(bool)));
- connect(m_postscript,TQT_SIGNAL(toggled(bool)),m_manu,TQT_SLOT(setDisabled(bool)));
- connect(m_postscript,TQT_SIGNAL(toggled(bool)),m_model,TQT_SLOT(setDisabled(bool)));
- connect(m_postscript,TQT_SIGNAL(toggled(bool)),m_other,TQT_SLOT(setDisabled(bool)));
- connect(m_postscript,TQT_SIGNAL(toggled(bool)),m_raw,TQT_SLOT(setDisabled(bool)));
- connect(m_postscript,TQT_SIGNAL(toggled(bool)),TQT_SLOT(slotPostscriptToggled(bool)));
- connect(m_other,TQT_SIGNAL(clicked()),TQT_SLOT(slotOtherClicked()));
-}
-
-KMDriverDbWidget::~KMDriverDbWidget()
-{
-}
-
-void KMDriverDbWidget::setDriver(const TQString& manu, const TQString& model)
-{
- TQListBoxItem *item = m_manu->findItem(manu);
- TQString model_(model);
- if (item)
- {
- m_manu->setCurrentItem(item);
- item = m_model->findItem(model_);
- if (!item)
- // try by stripping the manufacturer name from
- // the beginning of the model string. This is
- // often the case with PPD files
- item = m_model->findItem(model_.replace(0,manu.length()+1,TQString::tqfromLatin1("")));
- if (item)
- m_model->setCurrentItem(item);
- }
-}
-
-void KMDriverDbWidget::setHaveRaw(bool on)
-{
- if (on)
- m_raw->show();
- else
- m_raw->hide();
-}
-
-void KMDriverDbWidget::setHaveOther(bool on)
-{
- if (on)
- m_other->show();
- else
- m_other->hide();
-}
-
-TQString KMDriverDbWidget::manufacturer()
-{
- return m_manu->currentText();
-}
-
-TQString KMDriverDbWidget::model()
-{
- return m_model->currentText();
-}
-
-KMDBEntryList* KMDriverDbWidget::drivers()
-{
- return KMDriverDB::self()->findEntry(manufacturer(),model());
-}
-
-bool KMDriverDbWidget::isRaw()
-{
- return m_raw->isChecked();
-}
-
-void KMDriverDbWidget::init()
-{
- if (!m_valid)
- {
- TQApplication::setOverrideCursor(KCursor::waitCursor());
- m_manu->clear();
- m_model->clear();
- m_manu->insertItem(i18n("Loading..."));
- KMDriverDB::self()->init(this);
- }
-}
-
-void KMDriverDbWidget::slotDbLoaded(bool reloaded)
-{
- TQApplication::restoreOverrideCursor();
- m_valid = true;
- if (reloaded || m_manu->count() == 0 || (m_manu->count() == 1 && m_manu->text(0) == i18n("Loading...")))
- { // do something only if DB reloaded
- m_manu->clear();
- m_model->clear();
- TQDictIterator< TQDict<KMDBEntryList> > it(KMDriverDB::self()->manufacturers());
- for (;it.current();++it)
- m_manu->insertItem(it.currentKey());
- m_manu->sort();
- m_manu->setCurrentItem(0);
- }
-}
-
-void KMDriverDbWidget::slotError(const TQString& msg)
-{
- TQApplication::restoreOverrideCursor();
- m_valid = false;
- m_manu->clear();
- KMessageBox::error(this, "<qt>"+msg+"</qt>");
-}
-
-void KMDriverDbWidget::slotManufacturerSelected(const TQString& name)
-{
- m_model->clear();
- TQDict<KMDBEntryList> *models = KMDriverDB::self()->findModels(name);
- if (models)
- {
- TQStrIList ilist(true);
- TQDictIterator<KMDBEntryList> it(*models);
- for (;it.current();++it)
- ilist.append(it.currentKey().latin1());
- ilist.sort();
- m_model->insertStrList(&ilist);
- m_model->setCurrentItem(0);
- }
-}
-
-void KMDriverDbWidget::slotPostscriptToggled(bool on)
-{
- if (on)
- {
- TQListBoxItem *item = m_manu->findItem("GENERIC");
- if (item)
- {
- m_manu->setCurrentItem(item);
- item = m_model->findItem( "POSTSCRIPT PRINTER" );
- if ( item )
- {
- m_model->setCurrentItem( item );
- return;
- }
- }
- KMessageBox::error(this,i18n("Unable to find the PostScript driver."));
- m_postscript->setChecked(false);
- }
-}
-
-void KMDriverDbWidget::slotOtherClicked()
-{
- if (m_external.isEmpty())
- {
- KFileDialog dlg( TQString::null, TQString::null, this, 0, true );
- KURL url;
-
- dlg.setMode( KFile::File );
- dlg.setCaption( i18n( "Select Driver" ) );
- if ( dlg.exec() )
- url = dlg.selectedURL();
-
- if ( !url.isEmpty() )
- {
- TQString filename;
- if ( KIO::NetAccess::download( url, filename, this ) )
- {
- DrMain *driver = KMFactory::self()->manager()->loadFileDriver(filename);
- if (driver)
- {
- m_external = filename;
- disconnect(m_manu,TQT_SIGNAL(highlighted(const TQString&)),this,TQT_SLOT(slotManufacturerSelected(const TQString&)));
- m_manu->clear();
- m_model->clear();
- TQString s = driver->get("manufacturer");
- m_manu->insertItem((s.isEmpty() ? i18n("<Unknown>") : s));
- s = driver->get("model");
- m_model->insertItem((s.isEmpty() ? i18n("<Unknown>") : s));
- m_manu->setCurrentItem(0);
- m_model->setCurrentItem(0);
- m_other->setText(i18n("Database"));
- m_desc = driver->get("description");
- delete driver;
- }
- else
- {
- KIO::NetAccess::removeTempFile( filename );
- KMessageBox::error(this,"<qt>"+i18n("Wrong driver format.")+"<p>"+KMManager::self()->errorMsg()+"</p></qt>");
- }
- }
- }
- }
- else
- {
- m_external = TQString::null;
- connect(m_manu,TQT_SIGNAL(highlighted(const TQString&)),this,TQT_SLOT(slotManufacturerSelected(const TQString&)));
- m_other->setText(i18n("Other"));
- m_desc = TQString::null;
- slotDbLoaded(true);
- }
-}
-#include "kmdriverdbwidget.moc"
diff --git a/kdeprint/management/kmdriverdbwidget.h b/kdeprint/management/kmdriverdbwidget.h
deleted file mode 100644
index 05b50536d..000000000
--- a/kdeprint/management/kmdriverdbwidget.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMDRIVERDBWIDGET_H
-#define KMDRIVERDBWIDGET_H
-
-#include <tqwidget.h>
-#include "kmdbentry.h"
-
-class TQListBox;
-class TQCheckBox;
-class TQPushButton;
-
-class KMDriverDbWidget : public TQWidget
-{
- Q_OBJECT
-public:
- KMDriverDbWidget(TQWidget *parent = 0, const char *name = 0);
- ~KMDriverDbWidget();
-
- void init();
- void setHaveRaw(bool on);
- void setHaveOther(bool on);
- void setDriver(const TQString& manu, const TQString& model);
-
- TQString manufacturer();
- TQString model();
- TQString description() { return m_desc; }
- KMDBEntryList* drivers();
- TQString driverFile();
- bool isRaw();
- bool isExternal();
-
-protected slots:
- void slotDbLoaded(bool reloaded);
- void slotManufacturerSelected(const TQString& name);
- void slotPostscriptToggled(bool);
- void slotOtherClicked();
- void slotError(const TQString&);
-
-private:
- TQListBox *m_manu;
- TQListBox *m_model;
- TQCheckBox *m_postscript;
- TQCheckBox *m_raw;
- TQPushButton *m_other;
- TQString m_external;
- TQString m_desc;
- bool m_valid;
-};
-
-inline TQString KMDriverDbWidget::driverFile()
-{ return m_external; }
-
-inline bool KMDriverDbWidget::isExternal()
-{ return !(m_external.isEmpty()); }
-
-#endif
diff --git a/kdeprint/management/kmdriverdialog.cpp b/kdeprint/management/kmdriverdialog.cpp
deleted file mode 100644
index ef37e333c..000000000
--- a/kdeprint/management/kmdriverdialog.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmdriverdialog.h"
-#include "driverview.h"
-
-#include <klocale.h>
-#include <kmessagebox.h>
-
-KMDriverDialog::KMDriverDialog(TQWidget *parent, const char *name)
-: KDialogBase(KDialogBase::Swallow,i18n("Configure"),KDialogBase::Ok|KDialogBase::Cancel,KDialogBase::Ok,parent,name,true,false)
-{
- m_view = new DriverView(0);
- setMainWidget(m_view);
-
- resize(400,450);
-}
-
-KMDriverDialog::~KMDriverDialog()
-{
-}
-
-void KMDriverDialog::setDriver(DrMain *d)
-{
- m_view->setDriver(d);
-}
-
-void KMDriverDialog::slotOk()
-{
- if (m_view->hasConflict())
- {
- KMessageBox::error(this, "<qt>"+i18n("Some options are in conflict. You must resolve those conflicts "
- "before continuing.")+"</qt>");
- return;
- }
- KDialogBase::slotOk();
-}
-
-#include "kmdriverdialog.moc"
diff --git a/kdeprint/management/kmdriverdialog.h b/kdeprint/management/kmdriverdialog.h
deleted file mode 100644
index 8b7b01c45..000000000
--- a/kdeprint/management/kmdriverdialog.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMDRIVERDIALOG_H
-#define KMDRIVERDIALOG_H
-
-#include <kdialogbase.h>
-
-class DriverView;
-class DrMain;
-
-class KMDriverDialog : public KDialogBase
-{
- Q_OBJECT
-public:
- KMDriverDialog(TQWidget *parent = 0, const char *name = 0);
- ~KMDriverDialog();
-
- void setDriver(DrMain*);
-
-protected slots:
- void slotOk();
-
-private:
- DriverView *m_view;
-};
-
-#endif
diff --git a/kdeprint/management/kmiconview.cpp b/kdeprint/management/kmiconview.cpp
deleted file mode 100644
index 1fa5a6da9..000000000
--- a/kdeprint/management/kmiconview.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmiconview.h"
-#include "kmprinter.h"
-
-#include <tqpainter.h>
-#include <kiconloader.h>
-#include <kdebug.h>
-
-KMIconViewItem::KMIconViewItem(TQIconView *parent, KMPrinter *p)
-: TQIconViewItem(parent)
-{
- m_state = 0;
- m_mode = parent->itemTextPos();
- m_pixmap = TQString();
- m_isclass = false;
- updatePrinter(p, m_mode);
-}
-
-void KMIconViewItem::paintItem(TQPainter *p, const TQColorGroup& cg)
-{
- if (m_state != 0)
- {
- QFont f(p->font());
- if (m_state & 0x1) f.setBold(true);
- if (m_state & 0x2) f.setItalic(true);
- p->setFont(f);
- }
- TQIconViewItem::paintItem(p,cg);
-}
-
-void KMIconViewItem::calcRect(const TQString&)
-{
- QRect ir(rect()), pr, tr;
-
- // pixmap rect
- pr.setWidth(pixmap()->width());
- pr.setHeight(pixmap()->height());
-
- // text rect
- QFont f(iconView()->font());
- if (m_state & 0x1) f.setBold(true);
- if (m_state & 0x2) f.setItalic(true);
- QFontMetrics fm(f);
- if (m_mode == TQIconView::Bottom)
- tr = fm.boundingRect(0, 0, iconView()->maxItemWidth(), 0xFFFFFF, AlignHCenter|AlignTop|WordBreak|BreakAnywhere, text()+"X");
- else
- tr = fm.boundingRect(0, 0, 0xFFFFFF, 0xFFFFFF, AlignLeft|AlignTop, text()+"X");
-
- // item rect
- if (m_mode == TQIconView::Bottom)
- {
- ir.setHeight(pr.height() + tr.height() + 15);
- ir.setWidth(QMAX(pr.width(), tr.width()) + 10);
- pr = TQRect((ir.width()-pr.width())/2, 5, pr.width(), pr.height());
- tr = TQRect((ir.width()-tr.width())/2, 10+pr.height(), tr.width(), tr.height());
- }
- else
- {
- ir.setHeight(QMAX(pr.height(), tr.height()) + 4);
- ir.setWidth(pr.width() + tr.width() + 6);
- pr = TQRect(2, (ir.height()-pr.height())/2, pr.width(), pr.height());
- tr = TQRect(4+pr.width(), (ir.height()-tr.height())/2, tr.width(), tr.height());
- }
-
- // set rects
- setItemRect(ir);
- setTextRect(tr);
- setPixmapRect(pr);
-}
-
-void KMIconViewItem::updatePrinter(KMPrinter *p, int mode)
-{
- bool update(false);
- int oldstate = m_state;
- if (p)
- {
- m_state = ((p->isHardDefault() ? 0x1 : 0x0) | (p->ownSoftDefault() ? 0x2 : 0x0) | (p->isValid() ? 0x4 : 0x0));
- update = (oldstate != m_state);
- if (p->name() != text() || update)
- {
- setText(TQString::null);
- setText(p->name());
- }
- setKey(TQString::tqfromLatin1("%1_%2").arg((p->isSpecial() ? "special" : (p->isClass(false) ? "class" : "printer"))).arg(p->name()));
- m_isclass = p->isClass(false);
- }
- if (mode != m_mode || ((oldstate&0x4) != (m_state&0x4)) || (p && p->pixmap() != m_pixmap))
- {
- int iconstate = (m_state&0x4 ? (int)KIcon::DefaultState : (int)KIcon::LockOverlay);
- if (p)
- m_pixmap = p->pixmap();
- m_mode = mode;
- if (m_mode == TQIconView::Bottom)
- setPixmap(DesktopIcon(m_pixmap, 0, iconstate));
- else
- setPixmap(SmallIcon(m_pixmap, 0, iconstate));
- }
- //if (update)
- // tqrepaint();
- setDiscarded(false);
-}
-
-KMIconView::KMIconView(TQWidget *parent, const char *name)
-: KIconView(parent,name)
-{
- setMode(KIconView::Select);
- setSelectionMode(TQIconView::Single);
- setItemsMovable(false);
- setResizeMode(TQIconView::Adjust);
-
- m_items.setAutoDelete(false);
- setViewMode(KMIconView::Big);
-
- connect(this,TQT_SIGNAL(contextMenuRequested(TQIconViewItem*,const TQPoint&)),TQT_SLOT(slotRightButtonClicked(TQIconViewItem*,const TQPoint&)));
- connect(this,TQT_SIGNAL(selectionChanged()),TQT_SLOT(slotSelectionChanged()));
-}
-
-KMIconView::~KMIconView()
-{
-}
-
-KMIconViewItem* KMIconView::findItem(KMPrinter *p)
-{
- if (p)
- {
- TQPtrListIterator<KMIconViewItem> it(m_items);
- for (;it.current();++it)
- if (it.current()->text() == p->name()
- && it.current()->isClass() == p->isClass())
- return it.current();
- }
- return 0;
-}
-
-void KMIconView::setPrinterList(TQPtrList<KMPrinter> *list)
-{
- bool changed(false);
-
- TQPtrListIterator<KMIconViewItem> it(m_items);
- for (;it.current();++it)
- it.current()->setDiscarded(true);
-
- if (list)
- {
- TQPtrListIterator<KMPrinter> it(*list);
- KMIconViewItem *item(0);
- for (;it.current();++it)
- {
- // only keep real printers (no instances)
- if (!it.current()->instanceName().isEmpty())
- continue;
- item = findItem(it.current());
- if (!item)
- {
- item = new KMIconViewItem(this,it.current());
- m_items.append(item);
- changed = true;
- }
- else
- item->updatePrinter(it.current(), itemTextPos());
- }
- }
-
- for (uint i=0; i<m_items.count(); i++)
- if (m_items.tqat(i)->isDiscarded())
- {
- delete m_items.take(i);
- i--;
- changed = true;
- }
-
- if (changed) sort();
- emit selectionChanged();
-}
-
-void KMIconView::setViewMode(ViewMode m)
-{
- m_mode = m;
- bool big = (m == KMIconView::Big);
- int mode = (big ? TQIconView::Bottom : TQIconView::Right);
-
- TQPtrListIterator<KMIconViewItem> it(m_items);
- for (;it.current();++it)
- it.current()->updatePrinter(0, mode);
-
- setArrangement((big ? TQIconView::LeftToRight : TQIconView::TopToBottom));
- setItemTextPos((TQIconView::ItemTextPos)mode);
- //setGridX((big ? 60 : -1));
- setWordWrapIconText(true);
-}
-
-void KMIconView::slotRightButtonClicked(TQIconViewItem *item, const TQPoint& p)
-{
- emit rightButtonClicked(item ? item->text() : TQString::null, p);
-}
-
-void KMIconView::slotSelectionChanged()
-{
- KMIconViewItem *item = static_cast<KMIconViewItem*>(currentItem());
- emit printerSelected((item && !item->isDiscarded() && item->isSelected() ? item->text() : TQString::null));
-}
-
-void KMIconView::setPrinter(const TQString& prname)
-{
- TQPtrListIterator<KMIconViewItem> it(m_items);
- for (; it.current(); ++it)
- if (it.current()->text() == prname)
- {
- setSelected(it.current(), true);
- break;
- }
-}
-
-void KMIconView::setPrinter(KMPrinter *p)
-{
- setPrinter(p ? p->name() : TQString::null);
-}
-
-#include "kmiconview.moc"
diff --git a/kdeprint/management/kmiconview.h b/kdeprint/management/kmiconview.h
deleted file mode 100644
index 1fd6fbbda..000000000
--- a/kdeprint/management/kmiconview.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMICONVIEW_H
-#define KMICONVIEW_H
-
-#include <kiconview.h>
-#include <tqptrlist.h>
-
-#include "kmobject.h"
-
-class KMPrinter;
-
-class KMIconViewItem : public TQIconViewItem, public KMObject
-{
-public:
- KMIconViewItem(TQIconView *parent, KMPrinter *p);
- void updatePrinter(KMPrinter *printer = 0, int mode = TQIconView::Bottom);
- bool isClass() const { return m_isclass; }
-
-protected:
- virtual void paintItem(TQPainter*, const TQColorGroup&);
- virtual void calcRect(const TQString& text_ = TQString::null);
-
-private:
- int m_mode;
- QString m_pixmap;
- char m_state;
- bool m_isclass;
-};
-
-class KMIconView : public KIconView
-{
- Q_OBJECT
-public:
- enum ViewMode { Big, Small };
-
- KMIconView(TQWidget *parent = 0, const char *name = 0);
- ~KMIconView();
-
- void setPrinterList(TQPtrList<KMPrinter> *list);
- void setPrinter(const TQString&);
- void setPrinter(KMPrinter*);
- void setViewMode(ViewMode);
-
-signals:
- void rightButtonClicked(const TQString&, const TQPoint&);
- void printerSelected(const TQString&);
-
-protected slots:
- void slotRightButtonClicked(TQIconViewItem*, const TQPoint&);
- void slotSelectionChanged();
-
-private:
- KMIconViewItem* findItem(KMPrinter *p);
-
-private:
- TQPtrList<KMIconViewItem> m_items;
- ViewMode m_mode;
-};
-
-#endif
diff --git a/kdeprint/management/kminfopage.cpp b/kdeprint/management/kminfopage.cpp
deleted file mode 100644
index ad43f1ccb..000000000
--- a/kdeprint/management/kminfopage.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kminfopage.h"
-#include "kmprinter.h"
-
-#include <tqpixmap.h>
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kseparator.h>
-
-KMInfoPage::KMInfoPage(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- m_title = new TQLabel(this);
- m_titlepixmap = new TQLabel(this);
- m_titlepixmap->tqsetAlignment(Qt::AlignCenter);
- KSeparator* sep = new KSeparator( KSeparator::HLine, this);
- m_type = new TQLabel(this);
- m_description = new TQLabel(this);
- m_state = new TQLabel(this);
- m_location = new TQLabel(this);
- m_model = new TQLabel(this);
- m_uri = new TQLabel(this);
- m_device = new TQLabel(this);
- TQLabel *m_loclabel = new TQLabel(i18n("Physical Location", "Location:"), this);
- m_loclabel->tqsetAlignment(Qt::AlignRight|Qt::AlignVCenter);
- TQLabel *m_desclabel = new TQLabel(i18n("Description:"), this);
- m_desclabel->tqsetAlignment(Qt::AlignRight|Qt::AlignVCenter);
- TQLabel *m_typelabel = new TQLabel(i18n("Type:"), this);
- m_typelabel->tqsetAlignment(Qt::AlignRight|Qt::AlignVCenter);
- TQLabel *m_statelabel = new TQLabel(i18n("Status", "State:"), this);
- m_statelabel->tqsetAlignment(Qt::AlignRight|Qt::AlignVCenter);
- TQLabel *m_urilabel = new TQLabel(i18n("URI:"), this);
- m_urilabel->tqsetAlignment(Qt::AlignRight|Qt::AlignVCenter);
- m_devlabel = new TQLabel(i18n("Device:"), this);
- m_devlabel->tqsetAlignment(Qt::AlignRight|Qt::AlignVCenter);
- TQLabel *m_modellabel = new TQLabel(i18n("Model:"), this);
- m_modellabel->tqsetAlignment(Qt::AlignRight|Qt::AlignVCenter);
-
- TQGridLayout *lay0 = new TQGridLayout(this, 11, 2, 0, 5);
- TQHBoxLayout *lay1 = new TQHBoxLayout(0, 0, 10);
- lay0->addRowSpacing(7,20);
- lay0->setRowStretch(7,0);
- lay0->setRowStretch(10,1);
- lay0->setColStretch(1,1);
- lay0->addMultiCellLayout(lay1, 0, 0, 0, 1);
- lay0->addMultiCellWidget(sep, 1, 1, 0, 1);
- lay0->addWidget(m_typelabel, 2, 0);
- lay0->addWidget(m_statelabel, 3, 0);
- lay0->addWidget(m_loclabel, 4, 0);
- lay0->addWidget(m_desclabel, 5, 0);
- lay0->addWidget(m_urilabel, 6, 0);
- lay0->addWidget(m_devlabel, 8, 0);
- lay0->addWidget(m_modellabel, 9, 0);
- lay0->addWidget(m_type, 2, 1);
- lay0->addWidget(m_state, 3, 1);
- lay0->addWidget(m_location, 4, 1);
- lay0->addWidget(m_description, 5, 1);
- lay0->addWidget(m_uri, 6, 1);
- lay0->addWidget(m_device, 8, 1);
- lay0->addWidget(m_model, 9, 1);
- lay1->addWidget(m_title, 1);
- lay1->addWidget(m_titlepixmap, 0);
-}
-
-KMInfoPage::~KMInfoPage()
-{
-}
-
-void KMInfoPage::setPrinter(KMPrinter *p)
-{
- // change "Device" label if it's a real class (not true for implicit classes)
- if (p && p->isClass(false)) m_devlabel->setText(i18n("Members:"));
- else m_devlabel->setText(i18n("Device:"));
-
- // clear everything if p == 0
- if (!p)
- {
- m_title->setText(TQString::null);
- m_titlepixmap->setPixmap(TQPixmap());
- m_type->setText(TQString::null);
- m_state->setText(TQString::null);
- m_location->setText(TQString::null);
- m_description->setText(TQString::null);
- m_uri->setText(TQString::null);
- m_device->setText(TQString::null);
- m_model->setText(TQString::null);
- }
- else
- {
- m_title->setText(TQString::tqfromLatin1("<b>%1</b>").arg(p->name()));
- m_titlepixmap->setPixmap(SmallIcon(p->pixmap()));
- if (p->isImplicit()) m_type->setText(i18n("Implicit class"));
- else if (p->isClass(false))
- if (p->isRemote()) m_type->setText(i18n("Remote class"));
- else m_type->setText(i18n("Local class"));
- else if (p->isPrinter())
- if (p->isRemote()) m_type->setText(i18n("Remote printer"));
- else m_type->setText(i18n("Local printer"));
- else if (p->isSpecial())
- m_type->setText(i18n("Special (pseudo) printer"));
- else m_type->setText(i18n("Unknown class of printer", "Unknown"));
- m_state->setText(p->stateString());
- m_location->setText(p->location());
- m_description->setText(p->description());
- m_uri->setText(p->uri().prettyURL());
- if (p->isClass(false))
- {
- QString s;
- for (TQStringList::ConstIterator it=p->members().begin(); it!=p->members().end(); ++it)
- s.append(KURL(*it).prettyURL() + ", ");
- s.truncate(s.length()-2);
- m_device->setText(s);
- }
- else
- {
- // double decoding in case printer name contains
- // annoying chars like '#'
- KURL dev(p->device());
- m_device->setText(KURL::decode_string(dev.prettyURL()));
- }
- m_model->setText(p->driverInfo());
- }
-}
diff --git a/kdeprint/management/kminfopage.h b/kdeprint/management/kminfopage.h
deleted file mode 100644
index 591fdbfe8..000000000
--- a/kdeprint/management/kminfopage.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMINFOPAGE_H
-#define KMINFOPAGE_H
-
-#include "kmprinterpage.h"
-#include <tqwidget.h>
-
-class TQLabel;
-
-class KMInfoPage : public TQWidget, public KMPrinterPage
-{
-public:
- KMInfoPage(TQWidget *parent = 0, const char *name = 0);
- ~KMInfoPage();
-
- void setPrinter(KMPrinter *p);
-
-protected:
- TQLabel *m_title, *m_titlepixmap;
- TQLabel *m_location, *m_description, *m_uri, *m_model, *m_type, *m_state, *m_device;
- TQLabel *m_devlabel;
-};
-
-#endif
diff --git a/kdeprint/management/kminstancepage.cpp b/kdeprint/management/kminstancepage.cpp
deleted file mode 100644
index 25c037516..000000000
--- a/kdeprint/management/kminstancepage.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kminstancepage.h"
-#include "kmprinter.h"
-#include "kmfactory.h"
-#include "kmvirtualmanager.h"
-#include "kmmanager.h"
-#include "kprinterpropertydialog.h"
-#include "kprinter.h"
-#include "kmtimer.h"
-
-#include <tqlayout.h>
-#include <tqregexp.h>
-#include <tqwhatsthis.h>
-#include <tqpushbutton.h>
-#include <kmessagebox.h>
-#include <kinputdialog.h>
-#include <klistbox.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kstandarddirs.h>
-#include <kdebug.h>
-
-KMInstancePage::KMInstancePage(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- m_view = new KListBox(this);
- m_printer = 0;
-
- initActions();
-
- TQHBoxLayout *main_ = new TQHBoxLayout(this, 0, 0);
- main_->addWidget(m_view);
- TQVBoxLayout *sub_ = new TQVBoxLayout(0, 0, 0);
- main_->addLayout(sub_);
- for (TQValueList<TQButton*>::Iterator it=m_buttons.begin(); it!=m_buttons.end(); ++it)
- if (*it)
- sub_->addWidget(*it);
- else
- sub_->addSpacing(10);
- sub_->addStretch(1);
-
- TQWhatsThis::add(this,
- i18n("Define/Edit here instances for the current selected "
- "printer. An instance is a combination of a real "
- "(physical) printer and a set of predefined options. "
- "For a single InkJet printer, you could define different "
- "print formats like <i>DraftQuality</i>, <i>PhotoQuality</i> "
- "or <i>TwoSided</i>. Those instances appear as normal "
- "printers in the print dialog and allow you to quickly "
- "select the print format you want."));
-}
-
-KMInstancePage::~KMInstancePage()
-{
-}
-
-void KMInstancePage::addButton(const TQString& txt, const TQString& pixmap, const char *receiver)
-{
- TQPushButton *btn = new TQPushButton(this, 0L);
- btn->setText(txt);
- btn->setIconSet(BarIconSet(pixmap));
- btn->setFlat(true);
- connect(btn, TQT_SIGNAL(clicked()), receiver);
- m_buttons.append(btn);
-}
-
-void KMInstancePage::initActions()
-{
- addButton(i18n("New..."), "filenew", TQT_SLOT(slotNew()));
- addButton(i18n("Copy..."), "editcopy", TQT_SLOT(slotCopy()));
- addButton(i18n("Remove"), "edittrash", TQT_SLOT(slotRemove()));
- m_buttons.append(0);
- addButton(i18n("Set as Default"), "exec", TQT_SLOT(slotDefault()));
- addButton(i18n("Settings"), "configure", TQT_SLOT(slotSettings()));
- m_buttons.append(0);
- addButton(i18n("Test..."), "fileprint", TQT_SLOT(slotTest()));
-}
-
-void KMInstancePage::setPrinter(KMPrinter *p)
-{
- TQString oldText = m_view->currentText();
-
- m_view->clear();
- m_printer = p;
- //bool ok = (p && !p->isSpecial());
- bool ok = (p != 0);
- if (ok)
- {
- TQPtrList<KMPrinter> list;
- KMFactory::self()->virtualManager()->virtualList(list,p->name());
- TQPtrListIterator<KMPrinter> it(list);
- for (;it.current();++it)
- {
- TQStringList pair = TQStringList::split('/',it.current()->name(),false);
- m_view->insertItem(SmallIcon((it.current()->isSoftDefault() ? "exec" : "fileprint")),(pair.count() > 1 ? pair[1] : i18n("(Default)")));
- }
- m_view->sort();
- }
-
- for (TQValueList<TQButton*>::ConstIterator it=m_buttons.begin(); it!=m_buttons.end(); ++it)
- if (*it)
- (*it)->setEnabled(ok);
-
- //iif (!oldText.isEmpty())
- //{
- TQListBoxItem *item = m_view->findItem(oldText);
- if (!item)
- item = m_view->findItem(i18n("(Default)"));
- if (item)
- m_view->setSelected(item,true);
- //}
-}
-
-void KMInstancePage::slotNew()
-{
- KMTimer::self()->hold();
-
- bool ok(false);
- TQString name = KInputDialog::getText(i18n("Instance Name"),i18n("Enter name for new instance (leave untouched for default):"),
- i18n("(Default)"),&ok,this);
- if (ok)
- {
- if (name.find(TQRegExp("[/\\s]")) != -1)
- KMessageBox::error(this, i18n("Instance name must not contain any spaces or slashes."));
- else
- {
- if (name == i18n("(Default)"))
- name = TQString();
- KMFactory::self()->virtualManager()->create(m_printer,name);
- setPrinter(m_printer);
- }
- }
-
- KMTimer::self()->release();
-}
-
-void KMInstancePage::slotRemove()
-{
- KMTimer::self()->hold();
- bool reload(false);
-
- TQString src = m_view->currentText();
- TQString msg = (src != i18n("(Default)") ? i18n("Do you really want to remove instance %1?") : i18n("You can't remove the default instance. However all settings of %1 will be discarded. Continue?"));
- if (!src.isEmpty() && KMessageBox::warningContinueCancel(this,msg.arg(src),TQString(),KStdGuiItem::del()) == KMessageBox::Continue)
- {
- if (src == i18n("(Default)"))
- src = TQString();
- reload = KMFactory::self()->virtualManager()->isDefault(m_printer,src);
- KMFactory::self()->virtualManager()->remove(m_printer,src);
- setPrinter(m_printer);
- }
-
- KMTimer::self()->release(reload);
-}
-
-void KMInstancePage::slotCopy()
-{
- KMTimer::self()->hold();
-
- TQString src = m_view->currentText();
- if (!src.isEmpty())
- {
- bool ok(false);
- TQString name = KInputDialog::getText(i18n("Instance Name"),i18n("Enter name for new instance (leave untouched for default):"),
- i18n("(Default)"),&ok,this);
- if (ok)
- {
- if (name.find(TQRegExp("[/\\s]")) != -1)
- KMessageBox::error(this, i18n("Instance name must not contain any spaces or slashes."));
- else
- {
- if (src == i18n("(Default)"))
- src = TQString();
- if (name == i18n("(Default)"))
- name = TQString();
- KMFactory::self()->virtualManager()->copy(m_printer,src,name);
- setPrinter(m_printer);
- }
- }
- }
-
- KMTimer::self()->release();
-}
-
-void KMInstancePage::slotSettings()
-{
- KMTimer::self()->hold();
-
- TQString src = m_view->currentText();
- if (!src.isEmpty())
- {
- if (src == i18n("(Default)")) src = TQString();
- KMPrinter *pr = KMFactory::self()->virtualManager()->findInstance(m_printer,src);
- if ( !pr )
- KMessageBox::error( this, i18n( "Unable to find instance %1." ).arg( m_view->currentText() ) );
- else if ( !pr->isSpecial() && !KMFactory::self()->manager()->completePrinterShort( pr ) )
- KMessageBox::error( this, i18n( "Unable to retrieve printer information. Message from printing system: %1." ).arg( KMFactory::self()->manager()->errorMsg() ) );
- else
- {
- int oldAppType = KMFactory::self()->settings()->application;
- KMFactory::self()->settings()->application = -1;
- KPrinterPropertyDialog::setupPrinter(pr, this);
- KMFactory::self()->settings()->application = oldAppType;
- if (pr->isEdited())
- { // printer edited, need to save changes
- pr->setDefaultOptions(pr->editedOptions());
- pr->setEditedOptions(TQMap<TQString,TQString>());
- pr->setEdited(false);
- KMFactory::self()->virtualManager()->triggerSave();
- }
- }
- }
- else
- KMessageBox::error( this, i18n( "The instance name is empty. Please select an instance." ) );
-
- KMTimer::self()->release();
-}
-
-void KMInstancePage::slotDefault()
-{
- KMTimer::self()->hold();
-
- TQString src = m_view->currentText();
- if (!src.isEmpty())
- {
- if (src == i18n("(Default)"))
- src = TQString();
- KMFactory::self()->virtualManager()->setAsDefault(m_printer,src);
- setPrinter(m_printer);
- }
-
- KMTimer::self()->release(true);
-}
-
-void KMInstancePage::slotTest()
-{
- KMTimer::self()->hold();
-
- TQString src = m_view->currentText();
- if (!src.isEmpty())
- {
- if (src == i18n("(Default)"))
- src = TQString();
- KMPrinter *mpr = KMFactory::self()->virtualManager()->findInstance(m_printer,src);
- if (!mpr)
- KMessageBox::error(this,i18n("Internal error: printer not found."));
- else if (KMessageBox::warningContinueCancel(this, i18n("You are about to print a test page on %1. Do you want to continue?").arg(mpr->printerName()), TQString(), i18n("Print Test Page"), "printTestPage") == KMessageBox::Continue)
- {
- if (!KMFactory::self()->virtualManager()->testInstance(mpr))
- KMessageBox::error(this, i18n("Unable to send test page to %1.").arg(mpr->printerName()));
- else
- KMessageBox::information(this,i18n("Test page successfully sent to printer %1.").arg(mpr->printerName()));
- }
- }
-
- KMTimer::self()->release(false);
-}
-#include "kminstancepage.moc"
diff --git a/kdeprint/management/kminstancepage.h b/kdeprint/management/kminstancepage.h
deleted file mode 100644
index 7a3075d73..000000000
--- a/kdeprint/management/kminstancepage.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMINSTANCEPAGE_H
-#define KMINSTANCEPAGE_H
-
-#include "kmprinterpage.h"
-#include <tqvaluelist.h>
-#include <tqwidget.h>
-
-class KListBox;
-class KMPrinter;
-class TQButton;
-
-class KMInstancePage : public TQWidget, public KMPrinterPage
-{
- Q_OBJECT
-public:
- KMInstancePage(TQWidget *parent = 0, const char *name = 0);
- ~KMInstancePage();
-
- void setPrinter(KMPrinter*);
-
-protected slots:
- void slotNew();
- void slotCopy();
- void slotRemove();
- void slotDefault();
- void slotTest();
- void slotSettings();
-
-protected:
- void initActions();
- void addButton(const TQString& text, const TQString& pixmap, const char *receiver);
-
-private:
- KListBox *m_view;
- TQValueList<TQButton*> m_buttons;
- KMPrinter *m_printer;
-};
-
-#endif
diff --git a/kdeprint/management/kmjobviewer.cpp b/kdeprint/management/kmjobviewer.cpp
deleted file mode 100644
index 7f168faed..000000000
--- a/kdeprint/management/kmjobviewer.cpp
+++ /dev/null
@@ -1,742 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmjobviewer.h"
-#include "kmjobmanager.h"
-#include "kmfactory.h"
-#include "kmjob.h"
-#include "kmprinter.h"
-#include "kmmanager.h"
-#include "kmuimanager.h"
-#include "jobitem.h"
-#include "kmtimer.h"
-#include "kmconfigjobs.h"
-#include "kmconfigpage.h"
-#include "kprinter.h"
-
-#include <klistview.h>
-#include <kstatusbar.h>
-#include <tqpopupmenu.h>
-#include <kmessagebox.h>
-#include <klocale.h>
-#include <kpopupmenu.h>
-#include <kaction.h>
-#include <kstdaction.h>
-#include <kiconloader.h>
-#include <kapplication.h>
-#include <kcursor.h>
-#include <kmenubar.h>
-#include <kdebug.h>
-#include <kwin.h>
-#include <kio/netaccess.h>
-#include <tqtimer.h>
-#include <tqlayout.h>
-#include <stdlib.h>
-#include <tqlineedit.h>
-#include <kdialogbase.h>
-#include <tqcheckbox.h>
-#include <kurldrag.h>
-#include <kconfig.h>
-
-#undef m_manager
-#define m_manager KMFactory::self()->jobManager()
-
-class KJobListView : public KListView
-{
-public:
- KJobListView( TQWidget *parent = 0, const char *name = 0 );
-
-protected:
- bool acceptDrag( TQDropEvent* ) const;
-};
-
-KJobListView::KJobListView( TQWidget *parent, const char *name )
- : KListView( parent, name )
-{
- setAcceptDrops( true );
- setDropVisualizer( false );
-}
-
-bool KJobListView::acceptDrag( TQDropEvent *e ) const
-{
- if ( KURLDrag::canDecode( e ) )
- return true;
- else
- return KListView::acceptDrag( e );
-}
-
-KMJobViewer::KMJobViewer(TQWidget *parent, const char *name)
-: KMainWindow(parent,name)
-{
- m_view = 0;
- m_pop = 0;
- m_jobs.setAutoDelete(false);
- m_items.setAutoDelete(false);
- m_printers.setAutoDelete(false);
- m_type = KMJobManager::ActiveJobs;
- m_stickybox = 0;
- m_standalone = ( parent == NULL );
-
- setToolBarsMovable(false);
- init();
-
- if (m_standalone)
- {
- setCaption(i18n("No Printer"));
- KConfig *conf = KMFactory::self()->printConfig();
- TQSize defSize( 550, 250 );
- conf->setGroup( "Jobs" );
- resize( conf->readSizeEntry( "Size", &defSize ) );
- }
-}
-
-KMJobViewer::~KMJobViewer()
-{
- if (m_standalone)
- {
- kdDebug( 500 ) << "Destroying stand-alone job viewer window" << endl;
- KConfig *conf = KMFactory::self()->printConfig();
- conf->setGroup( "Jobs" );
- conf->writeEntry( "Size", size() );
- emit viewerDestroyed(this);
- }
- removeFromManager();
-}
-
-void KMJobViewer::setPrinter(KMPrinter *p)
-{
- setPrinter((p ? p->printerName() : TQString::null));
-}
-
-void KMJobViewer::setPrinter(const TQString& prname)
-{
- // We need to trigger a refresh even if the printer
- // has not changed, some jobs may have been canceled
- // outside tdeprint. We can't return simply if
- // prname == m_prname.
- if (m_prname != prname)
- {
- removeFromManager();
- m_prname = prname;
- addToManager();
- m_view->setAcceptDrops( prname != i18n( "All Printers" ) );
- }
- triggerRefresh();
-}
-
-void KMJobViewer::updateCaption()
-{
- if (!m_standalone)
- return;
-
- TQString pixname("fileprint");
- if (!m_prname.isEmpty())
- {
- setCaption(i18n("Print Jobs for %1").arg(m_prname));
- KMPrinter *prt = KMManager::self()->findPrinter(m_prname);
- if (prt)
- pixname = prt->pixmap();
- }
- else
- {
- setCaption(i18n("No Printer"));
- }
- KWin::setIcons(winId(), DesktopIcon(pixname), SmallIcon(pixname));
-}
-
-void KMJobViewer::updateStatusBar()
-{
- if (!m_standalone)
- return;
-
- int limit = m_manager->limit();
- if (limit == 0)
- statusBar()->changeItem(i18n("Max.: %1").arg(i18n("Unlimited")), 0);
- else
- statusBar()->changeItem(i18n("Max.: %1").arg(limit), 0);
-}
-
-void KMJobViewer::addToManager()
-{
- if (m_prname == i18n("All Printers"))
- {
- loadPrinters();
- TQPtrListIterator<KMPrinter> it(m_printers);
- for (; it.current(); ++it)
- m_manager->addPrinter(it.current()->printerName(), (KMJobManager::JobType)m_type, it.current()->isSpecial());
- }
- else if (!m_prname.isEmpty())
- {
- KMPrinter *prt = KMManager::self()->findPrinter( m_prname );
- bool isSpecial = ( prt ? prt->isSpecial() : false );
- m_manager->addPrinter(m_prname, (KMJobManager::JobType)m_type, isSpecial);
- }
-}
-
-void KMJobViewer::removeFromManager()
-{
- if (m_prname == i18n("All Printers"))
- {
- TQPtrListIterator<KMPrinter> it(m_printers);
- for (; it.current(); ++it)
- m_manager->removePrinter(it.current()->printerName(), (KMJobManager::JobType)m_type);
- }
- else if (!m_prname.isEmpty())
- {
- m_manager->removePrinter(m_prname, (KMJobManager::JobType)m_type);
- }
-}
-
-void KMJobViewer::refresh(bool reload)
-{
- m_jobs.clear();
- TQPtrListIterator<KMJob> it(m_manager->jobList(reload));
- bool all = (m_prname == i18n("All Printers")), active = (m_type == KMJobManager::ActiveJobs);
- for (; it.current(); ++it)
- if ((all || it.current()->printer() == m_prname)
- && ((it.current()->state() >= KMJob::Cancelled && !active)
- || (it.current()->state() < KMJob::Cancelled && active))
- && (m_username.isEmpty() || m_username == it.current()->owner()))
- m_jobs.append(it.current());
- updateJobs();
-
-
- // update the caption and icon (doesn't do anything if it has a parent widget)
- updateCaption();
-
- updateStatusBar();
-
- // do it last as this signal can cause this view to be destroyed. No
- // code can be executed safely after that
- emit jobsShown(this, (m_jobs.count() != 0));
-}
-
-void KMJobViewer::init()
-{
- if (!m_view)
- {
- m_view = new KJobListView(this);
- m_view->addColumn(i18n("Job ID"));
- m_view->addColumn(i18n("Owner"));
- m_view->addColumn(i18n("Name"), 150);
- m_view->addColumn(i18n("Status", "State"));
- m_view->addColumn(i18n("Size (KB)"));
- m_view->addColumn(i18n("Page(s)"));
- m_view->setColumnAlignment(5,Qt::AlignRight|Qt::AlignVCenter);
- connect( m_view, TQT_SIGNAL( dropped( TQDropEvent*, TQListViewItem* ) ), TQT_SLOT( slotDropped( TQDropEvent*, TQListViewItem* ) ) );
- //m_view->addColumn(i18n("Printer"));
- //m_view->setColumnAlignment(6,Qt::AlignRight|Qt::AlignVCenter);
- KMFactory::self()->uiManager()->setupJobViewer(m_view);
- m_view->setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
- m_view->setLineWidth(1);
- m_view->setSorting(0);
- m_view->setAllColumnsShowFocus(true);
- m_view->setSelectionMode(TQListView::Extended);
- connect(m_view,TQT_SIGNAL(selectionChanged()),TQT_SLOT(slotSelectionChanged()));
- connect(m_view,TQT_SIGNAL(rightButtonPressed(TQListViewItem*,const TQPoint&,int)),TQT_SLOT(slotRightClicked(TQListViewItem*,const TQPoint&,int)));
- setCentralWidget(m_view);
- }
-
- initActions();
-}
-
-void KMJobViewer::initActions()
-{
- // job actions
- KAction *hact = new KAction(i18n("&Hold"),"stop",0,TQT_TQOBJECT(this),TQT_SLOT(slotHold()),actionCollection(),"job_hold");
- KAction *ract = new KAction(i18n("&Resume"),"run",0,TQT_TQOBJECT(this),TQT_SLOT(slotResume()),actionCollection(),"job_resume");
- KAction *dact = new KAction(i18n("Remo&ve"),"edittrash",Qt::Key_Delete,TQT_TQOBJECT(this),TQT_SLOT(slotRemove()),actionCollection(),"job_remove");
- KAction *sact = new KAction(i18n("Res&tart"),"redo",0,TQT_TQOBJECT(this),TQT_SLOT(slotRestart()),actionCollection(),"job_restart");
- KActionMenu *mact = new KActionMenu(i18n("&Move to Printer"),"fileprint",actionCollection(),"job_move");
- mact->setDelayed(false);
- connect(mact->popupMenu(),TQT_SIGNAL(activated(int)),TQT_SLOT(slotMove(int)));
- connect(mact->popupMenu(),TQT_SIGNAL(aboutToShow()),KMTimer::self(),TQT_SLOT(hold()));
- connect(mact->popupMenu(),TQT_SIGNAL(aboutToHide()),KMTimer::self(),TQT_SLOT(release()));
- connect(mact->popupMenu(),TQT_SIGNAL(aboutToShow()),TQT_SLOT(slotShowMoveMenu()));
- KToggleAction *tact = new KToggleAction(i18n("&Toggle Completed Jobs"),"history",0,actionCollection(),"view_completed");
- tact->setEnabled(m_manager->actions() & KMJob::ShowCompleted);
- connect(tact,TQT_SIGNAL(toggled(bool)),TQT_SLOT(slotShowCompleted(bool)));
- KToggleAction *uact = new KToggleAction(i18n("Show Only User Jobs"), "personal", 0, actionCollection(), "view_user_jobs");
- uact->setCheckedState(KGuiItem(i18n("Hide Only User Jobs"),"personal"));
- connect(uact, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotUserOnly(bool)));
- m_userfield = new TQLineEdit(0);
- m_userfield->setText(getenv("USER"));
- connect(m_userfield, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotUserChanged()));
- connect(uact, TQT_SIGNAL(toggled(bool)), m_userfield, TQT_SLOT(setEnabled(bool)));
- m_userfield->setEnabled(false);
- m_userfield->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed));
- KWidgetAction *ufact = new KWidgetAction(m_userfield, i18n("User Name"), 0, 0, 0, actionCollection(), "view_username");
-
- if (!m_pop)
- {
- m_pop = new TQPopupMenu(this);
- connect(m_pop,TQT_SIGNAL(aboutToShow()),KMTimer::self(),TQT_SLOT(hold()));
- connect(m_pop,TQT_SIGNAL(aboutToHide()),KMTimer::self(),TQT_SLOT(release()));
- hact->plug(m_pop);
- ract->plug(m_pop);
- m_pop->insertSeparator();
- dact->plug(m_pop);
- mact->plug(m_pop);
- m_pop->insertSeparator();
- sact->plug(m_pop);
- }
-
- // Filter actions
- KActionMenu *fact = new KActionMenu(i18n("&Select Printer"), "tdeprint_printer", actionCollection(), "filter_modify");
- fact->setDelayed(false);
- connect(fact->popupMenu(),TQT_SIGNAL(activated(int)),TQT_SLOT(slotPrinterSelected(int)));
- connect(fact->popupMenu(),TQT_SIGNAL(aboutToShow()),KMTimer::self(),TQT_SLOT(hold()));
- connect(fact->popupMenu(),TQT_SIGNAL(aboutToHide()),KMTimer::self(),TQT_SLOT(release()));
- connect(fact->popupMenu(),TQT_SIGNAL(aboutToShow()),TQT_SLOT(slotShowPrinterMenu()));
-
- if (!m_standalone)
- {
- KToolBar *toolbar = toolBar();
- hact->plug(toolbar);
- ract->plug(toolbar);
- toolbar->insertSeparator();
- dact->plug(toolbar);
- mact->plug(toolbar);
- toolbar->insertSeparator();
- sact->plug(toolbar);
- toolbar->insertSeparator();
- tact->plug(toolbar);
- uact->plug(toolbar);
- ufact->plug(toolbar);
- }
- else
- {// stand-alone application
- KStdAction::quit(TQT_TQOBJECT(kapp),TQT_SLOT(quit()),actionCollection());
- KStdAction::close(TQT_TQOBJECT(this),TQT_SLOT(slotClose()),actionCollection());
- KStdAction::preferences(TQT_TQOBJECT(this), TQT_SLOT(slotConfigure()), actionCollection());
-
- // refresh action
- new KAction(i18n("Refresh"),"reload",0,TQT_TQOBJECT(this),TQT_SLOT(slotRefresh()),actionCollection(),"refresh");
-
- // create status bar
- KStatusBar *statusbar = statusBar();
- m_stickybox = new TQCheckBox( i18n( "Keep window permanent" ), statusbar );
- statusbar->addWidget( m_stickybox, 1, false );
- statusbar->insertItem(" " + i18n("Max.: %1").arg(i18n("Unlimited"))+ " ", 0, 0, true);
- statusbar->setItemFixed(0);
- updateStatusBar();
-
- createGUI();
- }
-
- loadPluginActions();
- slotSelectionChanged();
-}
-
-void KMJobViewer::buildPrinterMenu(TQPopupMenu *menu, bool use_all, bool use_specials)
-{
- loadPrinters();
- menu->clear();
-
- TQPtrListIterator<KMPrinter> it(m_printers);
- int i(0);
- if (use_all)
- {
- menu->insertItem(SmallIcon("fileprint"), i18n("All Printers"), i++);
- menu->insertSeparator();
- }
- for (; it.current(); ++it, i++)
- {
- if ( !it.current()->instanceName().isEmpty() ||
- ( it.current()->isSpecial() && !use_specials ) )
- continue;
- menu->insertItem(SmallIcon(it.current()->pixmap()), it.current()->printerName(), i);
- }
-}
-
-void KMJobViewer::slotShowMoveMenu()
-{
- TQPopupMenu *menu = static_cast<KActionMenu*>(actionCollection()->action("job_move"))->popupMenu();
- buildPrinterMenu(menu, false, false);
-}
-
-void KMJobViewer::slotShowPrinterMenu()
-{
- TQPopupMenu *menu = static_cast<KActionMenu*>(actionCollection()->action("filter_modify"))->popupMenu();
- buildPrinterMenu(menu, true, true);
-}
-
-void KMJobViewer::updateJobs()
-{
- TQPtrListIterator<JobItem> jit(m_items);
- for (;jit.current();++jit)
- jit.current()->setDiscarded(true);
-
- TQPtrListIterator<KMJob> it(m_jobs);
- for (;it.current();++it)
- {
- KMJob *j(it.current());
- JobItem *item = findItem(j->uri());
- if (item)
- {
- item->setDiscarded(false);
- item->init(j);
- }
- else
- m_items.append(new JobItem(m_view,j));
- }
-
- for (uint i=0; i<m_items.count(); i++)
- if (m_items.tqat(i)->isDiscarded())
- {
- delete m_items.take(i);
- i--;
- }
-
- slotSelectionChanged();
-}
-
-JobItem* KMJobViewer::findItem(const TQString& uri)
-{
- TQPtrListIterator<JobItem> it(m_items);
- for (;it.current();++it)
- if (it.current()->jobUri() == uri) return it.current();
- return 0;
-}
-
-void KMJobViewer::slotSelectionChanged()
-{
- int acts = m_manager->actions();
- int state(-1);
- int thread(0);
- bool completed(true), remote(false);
-
- TQPtrListIterator<JobItem> it(m_items);
- TQPtrList<KMJob> joblist;
-
- joblist.setAutoDelete(false);
- for (;it.current();++it)
- {
- if (it.current()->isSelected())
- {
- // check if threaded job. "thread" value will be:
- // 0 -> no jobs
- // 1 -> only thread jobs
- // 2 -> only system jobs
- // 3 -> thread and system jobs
- if (it.current()->job()->type() == KMJob::Threaded) thread |= 0x1;
- else thread |= 0x2;
-
- if (state == -1) state = it.current()->job()->state();
- else if (state != 0 && state != it.current()->job()->state()) state = 0;
-
- completed = (completed && it.current()->job()->isCompleted());
- joblist.append(it.current()->job());
- if (it.current()->job()->isRemote())
- remote = true;
- }
- }
- if (thread != 2)
- joblist.clear();
-
- actionCollection()->action("job_remove")->setEnabled((thread == 1) || (/*!remote &&*/ !completed && (state >= 0) && (acts & KMJob::Remove)));
- actionCollection()->action("job_hold")->setEnabled(/*!remote &&*/ !completed && (thread == 2) && (state > 0) && (state != KMJob::Held) && (acts & KMJob::Hold));
- actionCollection()->action("job_resume")->setEnabled(/*!remote &&*/ !completed && (thread == 2) && (state > 0) && (state == KMJob::Held) && (acts & KMJob::Resume));
- actionCollection()->action("job_move")->setEnabled(!remote && !completed && (thread == 2) && (state >= 0) && (acts & KMJob::Move));
- actionCollection()->action("job_restart")->setEnabled(!remote && (thread == 2) && (state >= 0) && (completed) && (acts & KMJob::Restart));
-
- m_manager->validatePluginActions(actionCollection(), joblist);
-}
-
-void KMJobViewer::jobSelection(TQPtrList<KMJob>& l)
-{
- l.setAutoDelete(false);
- TQPtrListIterator<JobItem> it(m_items);
- for (;it.current();++it)
- if (it.current()->isSelected())
- l.append(it.current()->job());
-}
-
-void KMJobViewer::send(int cmd, const TQString& name, const TQString& arg)
-{
- KMTimer::self()->hold();
-
- TQPtrList<KMJob> l;
- jobSelection(l);
- if (!m_manager->sendCommand(l,cmd,arg))
- {
- KMessageBox::error(this,"<qt>"+i18n("Unable to perform action \"%1\" on selected jobs. Error received from manager:").arg(name)+"<p>"+KMManager::self()->errorMsg()+"</p></qt>");
- // error reported, clean it
- KMManager::self()->setErrorMsg(TQString::null);
- }
-
- triggerRefresh();
-
- KMTimer::self()->release();
-}
-
-void KMJobViewer::slotHold()
-{
- send(KMJob::Hold,i18n("Hold"));
-}
-
-void KMJobViewer::slotResume()
-{
- send(KMJob::Resume,i18n("Resume"));
-}
-
-void KMJobViewer::slotRemove()
-{
- send(KMJob::Remove,i18n("Remove"));
-}
-
-void KMJobViewer::slotRestart()
-{
- send(KMJob::Restart,i18n("Restart"));
-}
-
-void KMJobViewer::slotMove(int prID)
-{
- if (prID >= 0 && prID < (int)(m_printers.count()))
- {
- KMPrinter *p = m_printers.tqat(prID);
- send(KMJob::Move,i18n("Move to %1").arg(p->printerName()),p->printerName());
- }
-}
-
-void KMJobViewer::slotRightClicked(TQListViewItem*,const TQPoint& p,int)
-{
- if (m_pop) m_pop->popup(p);
-}
-
-void KMJobViewer::loadPrinters()
-{
- m_printers.clear();
-
- // retrieve printer list without reloading it (faster)
- TQPtrListIterator<KMPrinter> it(*(KMFactory::self()->manager()->printerList(false)));
- for (;it.current();++it)
- {
- // keep only real printers (no instance, no implicit) and special printers
- if ((it.current()->isPrinter() || it.current()->isClass(false) ||
- ( it.current()->isSpecial() && it.current()->isValid() ) )
- && (it.current()->name() == it.current()->printerName()))
- m_printers.append(it.current());
- }
-}
-
-void KMJobViewer::slotPrinterSelected(int prID)
-{
- if (prID >= 0 && prID < (int)(m_printers.count()+1))
- {
- TQString prname = (prID == 0 ? i18n("All Printers") : m_printers.tqat(prID-1)->printerName());
- emit printerChanged(this, prname);
- }
-}
-
-void KMJobViewer::slotRefresh()
-{
- triggerRefresh();
-}
-
-void KMJobViewer::triggerRefresh()
-{
- // parent widget -> embedded in KControl and needs
- // to update itself. Otherwise, it's standalone
- // kjobviewer and we need to synchronize all possible
- // opened windows -> do the job on higher level.
- if (!m_standalone)
- refresh(true);
- else
- emit refreshClicked();
-}
-
-void KMJobViewer::slotShowCompleted(bool on)
-{
- removeFromManager();
- m_type = (on ? KMJobManager::CompletedJobs : KMJobManager::ActiveJobs);
- addToManager();
- triggerRefresh();
-}
-
-void KMJobViewer::slotClose()
-{
- delete this;
-}
-
-void KMJobViewer::loadPluginActions()
-{
- int mpopindex(7), toolbarindex(!m_standalone?7:8), menuindex(7);
- TQMenuData *menu(0);
-
- if (m_standalone)
- {
- // standalone window, insert actions into main menubar
- KAction *act = actionCollection()->action("job_restart");
- for (int i=0;i<act->containerCount();i++)
- {
- if (menuBar()->findItem(act->itemId(i), &menu))
- {
- menuindex = mpopindex = menu->indexOf(act->itemId(i))+1;
- break;
- }
- }
- }
-
- TQValueList<KAction*> acts = m_manager->createPluginActions(actionCollection());
- for (TQValueListIterator<KAction*> it=acts.begin(); it!=acts.end(); ++it)
- {
- // connect the action to this
- connect((*it), TQT_SIGNAL(activated(int)), TQT_SLOT(pluginActionActivated(int)));
-
- // should add it to the toolbar and menubar
- (*it)->plug(toolBar(), toolbarindex++);
- if (m_pop)
- (*it)->plug(m_pop, mpopindex++);
- if (menu)
- (*it)->plug(static_cast<TQPopupMenu*>(menu), menuindex++);
- }
-}
-
-void KMJobViewer::removePluginActions()
-{
- TQValueList<KAction*> acts = actionCollection()->actions("plugin");
- for (TQValueListIterator<KAction*> it=acts.begin(); it!=acts.end(); ++it)
- {
- (*it)->unplugAll();
- delete (*it);
- }
-}
-
-/*
-void KMJobViewer::aboutToReload()
-{
- if (m_view)
- {
- m_view->clear();
- m_items.clear();
- }
- m_jobs.clear();
-}
-*/
-
-void KMJobViewer::reload()
-{
- removePluginActions();
- loadPluginActions();
- // re-add the current printer to the job manager: the job
- // manager has been destroyed, so the new one doesn't know
- // which printer it has to list
- addToManager();
- // no refresh needed: view has been cleared before reloading
- // and the actual refresh will be triggered either by the KControl
- // module, or by KJobViewerApp using timer.
-
- // reload the columns needed: remove the old one
- for (int c=m_view->columns()-1; c>5; c--)
- m_view->removeColumn(c);
- KMFactory::self()->uiManager()->setupJobViewer(m_view);
-
- // update the "History" action state
- actionCollection()->action("view_completed")->setEnabled(m_manager->actions() & KMJob::ShowCompleted);
- static_cast<KToggleAction*>(actionCollection()->action("view_completed"))->setChecked(false);
-}
-
-void KMJobViewer::closeEvent(TQCloseEvent *e)
-{
- if (m_standalone && !kapp->sessionSaving())
- {
- hide();
- e->ignore();
- }
- else
- e->accept();
-}
-
-void KMJobViewer::pluginActionActivated(int ID)
-{
- KMTimer::self()->hold();
-
- TQPtrList<KMJob> joblist;
- jobSelection(joblist);
- if (!m_manager->doPluginAction(ID, joblist))
- KMessageBox::error(this, "<qt>"+i18n("Operation failed.")+"<p>"+KMManager::self()->errorMsg()+"</p></qt>");
-
- triggerRefresh();
- KMTimer::self()->release();
-}
-
-void KMJobViewer::slotUserOnly(bool on)
-{
- m_username = (on ? m_userfield->text() : TQString::null);
- refresh(false);
-}
-
-void KMJobViewer::slotUserChanged()
-{
- if (m_userfield->isEnabled())
- {
- m_username = m_userfield->text();
- refresh(false);
- }
-}
-
-void KMJobViewer::slotConfigure()
-{
- KMTimer::self()->hold();
-
- KDialogBase dlg(this, 0, true, i18n("Print Job Settings"), KDialogBase::Ok|KDialogBase::Cancel);
- KMConfigJobs *w = new KMConfigJobs(&dlg);
- dlg.setMainWidget(w);
- dlg.resize(300, 10);
- KConfig *conf = KMFactory::self()->printConfig();
- w->loadConfig(conf);
- if (dlg.exec())
- {
- w->saveConfig(conf);
- updateStatusBar();
- refresh(true);
- }
-
- KMTimer::self()->release();
-}
-
-bool KMJobViewer::isSticky() const
-{
- return ( m_stickybox ? m_stickybox->isChecked() : false );
-}
-
-void KMJobViewer::slotDropped( TQDropEvent *e, TQListViewItem* )
-{
- TQStringList files;
- TQString target;
-
- KURL::List uris;
- KURLDrag::decode( e, uris );
- for ( KURL::List::ConstIterator it = uris.begin();
- it != uris.end(); ++it)
- {
- if ( KIO::NetAccess::download( *it, target, 0 ) )
- files << target;
- }
-
- if ( files.count() > 0 )
- {
- KPrinter prt;
- if ( prt.autoConfigure( m_prname, this ) )
- prt.printFiles( files, false, false );
- }
-}
-
-#include "kmjobviewer.moc"
diff --git a/kdeprint/management/kmjobviewer.h b/kdeprint/management/kmjobviewer.h
deleted file mode 100644
index 650fe4b15..000000000
--- a/kdeprint/management/kmjobviewer.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMJOBVIEWER_H
-#define KMJOBVIEWER_H
-
-#if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
-#warning internal header, do not use except if you are a KDEPrint developer
-#endif
-
-#include <kmainwindow.h>
-#include "kmprinterpage.h"
-#include "kpreloadobject.h"
-
-class KMJobManager;
-class KMJob;
-class KListView;
-class JobItem;
-class TQPopupMenu;
-class TQListViewItem;
-class KMPrinter;
-class TQTimer;
-class TQLineEdit;
-class TQCheckBox;
-
-/**
- * @internal
- * This class is internal to KDEPrint and is not intended to be
- * used outside it. Please do not make use of this header, except
- * if you're a KDEPrint developer. The API might change in the
- * future and binary compatibility might be broken.
- */
-class KDEPRINT_EXPORT KMJobViewer : public KMainWindow, public KMPrinterPage, public KPReloadObject
-{
- Q_OBJECT
-public:
- KMJobViewer(TQWidget *parent = 0, const char *name = 0);
- ~KMJobViewer();
-
- void setPrinter(const TQString& prname);
- void setPrinter(KMPrinter *p);
- void refresh(bool reload = false);
- TQString printer() const;
- bool isSticky() const;
-
-signals:
- void jobsShown(KMJobViewer*, bool hasJobs);
- void refreshClicked();
- void printerChanged(KMJobViewer*, const TQString& prname);
- void viewerDestroyed(KMJobViewer*);
-
-public slots:
- void pluginActionActivated(int);
-
-protected slots:
- void slotSelectionChanged();
- void slotHold();
- void slotResume();
- void slotRemove();
- void slotRestart();
- void slotRightClicked(TQListViewItem*,const TQPoint&,int);
- void slotMove(int prID);
- void slotPrinterSelected(int);
- void slotShowCompleted(bool);
- void slotRefresh();
- void slotClose();
- void slotShowMoveMenu();
- void slotShowPrinterMenu();
- void slotUserOnly(bool);
- void slotUserChanged();
- void slotConfigure();
- void slotDropped( TQDropEvent*, TQListViewItem* );
-
-protected:
- void init();
- void updateJobs();
- void initActions();
- JobItem* findItem(const TQString& uri);
- void jobSelection(TQPtrList<KMJob>& l);
- void send(int cmd, const TQString& name, const TQString& arg = TQString::null);
- void loadPrinters();
- void loadPluginActions();
- void removePluginActions();
- void reload();
- //void aboutToReload();
- void closeEvent(TQCloseEvent*);
- void triggerRefresh();
- void addToManager();
- void removeFromManager();
- void buildPrinterMenu(TQPopupMenu *menu, bool use_all = false, bool use_specials = false);
- void updateCaption();
- void updateStatusBar();
-
-private:
- KListView *m_view;
- TQPtrList<KMJob> m_jobs;
- TQPtrList<JobItem> m_items;
- TQPopupMenu *m_pop;
- TQPtrList<KMPrinter> m_printers;
- TQString m_prname;
- int m_type;
- TQString m_username;
- TQLineEdit *m_userfield;
- TQCheckBox *m_stickybox;
- bool m_standalone;
-};
-
-inline TQString KMJobViewer::printer() const
-{ return m_prname; }
-
-#endif
diff --git a/kdeprint/management/kmlistview.cpp b/kdeprint/management/kmlistview.cpp
deleted file mode 100644
index 72d6872cb..000000000
--- a/kdeprint/management/kmlistview.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmlistview.h"
-#include "kmprinter.h"
-#include "kmobject.h"
-
-#include <tqheader.h>
-#include <tqpainter.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kcursor.h>
-
-class KMListViewItem : public TQListViewItem, public KMObject
-{
-public:
- KMListViewItem(TQListView *parent, const TQString& txt);
- KMListViewItem(TQListViewItem *parent, const TQString& txt);
- KMListViewItem(TQListViewItem *parent, KMPrinter *p);
-
- virtual void paintCell(TQPainter*, const TQColorGroup&, int, int, int);
- void updatePrinter(KMPrinter *p);
- bool isClass() const { return m_isclass; }
-
-protected:
- void init(KMPrinter *p = 0);
-
-private:
- int m_state;
- bool m_isclass;
-};
-
-KMListViewItem::KMListViewItem(TQListView *parent, const TQString& txt)
-: TQListViewItem(parent,txt)
-{
- init();
-}
-
-KMListViewItem::KMListViewItem(TQListViewItem *parent, const TQString& txt)
-: TQListViewItem(parent,txt)
-{
- init();
-}
-
-KMListViewItem::KMListViewItem(TQListViewItem *parent, KMPrinter *p)
-: TQListViewItem(parent)
-{
- init(p);
-}
-
-void KMListViewItem::init(KMPrinter *p)
-{
- m_state = 0;
- if (p)
- updatePrinter(p);
- setSelectable(depth() == 2);
-}
-
-void KMListViewItem::updatePrinter(KMPrinter *p)
-{
- bool update(false);
- if (p)
- {
- int oldstate = m_state;
- int st(p->isValid() ? (int)KIcon::DefaultState : (int)KIcon::LockOverlay);
- m_state = ((p->isHardDefault() ? 0x1 : 0x0) | (p->ownSoftDefault() ? 0x2 : 0x0) | (p->isValid() ? 0x4 : 0x0));
- update = (oldstate != m_state);
- QString name = (p->isVirtual() ? p->instanceName() : p->name());
- if (name != text(0))
- setText(0, name);
- setPixmap(0, SmallIcon(p->pixmap(), 0, st));
- m_isclass = p->isClass();
- }
- setDiscarded(false);
- if (update)
- tqrepaint();
-}
-
-void KMListViewItem::paintCell(TQPainter *p, const TQColorGroup& cg, int c, int w, int a)
-{
- if (m_state != 0)
- {
- QFont f(p->font());
- if (m_state & 0x1) f.setBold(true);
- if (m_state & 0x2) f.setItalic(true);
- p->setFont(f);
- }
- TQListViewItem::paintCell(p,cg,c,w,a);
-}
-
-//************************************************************************************************
-
-KMListView::KMListView(TQWidget *parent, const char *name)
-: TQListView(parent,name)
-{
- m_items.setAutoDelete(false);
-
- addColumn("");
- header()->hide();
- setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
- setLineWidth(1);
- setSorting(0);
-
- connect(this,TQT_SIGNAL(contextMenuRequested(TQListViewItem*,const TQPoint&,int)),TQT_SLOT(slotRightButtonClicked(TQListViewItem*,const TQPoint&,int)));
- connect(this,TQT_SIGNAL(selectionChanged()),TQT_SLOT(slotSelectionChanged()));
- connect(this,TQT_SIGNAL(onItem(TQListViewItem*)),TQT_SLOT(slotOnItem(TQListViewItem*)));
- connect(this,TQT_SIGNAL(onViewport()),TQT_SLOT(slotOnViewport()));
-
- m_root = new KMListViewItem(this,i18n("Print System"));
- m_root->setPixmap(0,SmallIcon("tdeprint_printer"));
- m_root->setOpen(true);
- m_classes = new KMListViewItem(m_root,i18n("Classes"));
- m_classes->setPixmap(0,SmallIcon("package"));
- m_classes->setOpen(true);
- m_printers = new KMListViewItem(m_root,i18n("Printers"));
- m_printers->setPixmap(0,SmallIcon("package"));
- m_printers->setOpen(true);
- m_specials = new KMListViewItem(m_root,i18n("Specials"));
- m_specials->setPixmap(0,SmallIcon("package"));
- m_specials->setOpen(true);
-
- sort();
-}
-
-KMListView::~KMListView()
-{
-}
-
-void KMListView::slotRightButtonClicked(TQListViewItem *item, const TQPoint& p, int)
-{
- emit rightButtonClicked(item && item->depth() == 2 ? item->text(0) : TQString::null, p);
-}
-
-KMListViewItem* KMListView::findItem(KMPrinter *p)
-{
- if (p)
- {
- TQPtrListIterator<KMListViewItem> it(m_items);
- bool isVirtual(p->isVirtual()), isClass(p->isClass());
- for (;it.current();++it)
- if (isVirtual)
- {
- if (it.current()->depth() == 3 && it.current()->text(0) == p->instanceName()
- && it.current()->parent()->text(0) == p->printerName())
- return it.current();
- }
- else
- {
- if (it.current()->isClass() == isClass && it.current()->text(0) == p->name())
- return it.current();
- }
- }
- return 0;
-}
-
-KMListViewItem* KMListView::findItem(const TQString& prname)
-{
- TQPtrListIterator<KMListViewItem> it(m_items);
- for (; it.current(); ++it)
- if (it.current()->depth() == 2 && it.current()->text(0) == prname)
- return it.current();
- return 0;
-}
-
-void KMListView::setPrinterList(TQPtrList<KMPrinter> *list)
-{
- bool changed(false);
-
- TQPtrListIterator<KMListViewItem> it(m_items);
- for (;it.current();++it)
- it.current()->setDiscarded(true);
-
- if (list)
- {
- TQPtrListIterator<KMPrinter> it(*list);
- KMListViewItem *item (0);
- for (;it.current();++it)
- {
- item = findItem(it.current());
- if (!item)
- {
- if (it.current()->isVirtual())
- {
- KMListViewItem *pItem = findItem(it.current()->printerName());
- if (!pItem)
- continue;
- item = new KMListViewItem(pItem, it.current());
- pItem->setOpen(true);
- }
- else
- item = new KMListViewItem((it.current()->isSpecial() ? m_specials : (it.current()->isClass(false) ? m_classes : m_printers)),it.current());
- m_items.append(item);
- changed = true;
- }
- else
- item->updatePrinter(it.current());
- }
- }
-
- TQPtrList<KMListViewItem> deleteList;
- deleteList.setAutoDelete(true);
- for (uint i=0; i<m_items.count(); i++)
- if (m_items.tqat(i)->isDiscarded())
- {
- // instance items are put in front of the list
- // so that they are destroyed first
- KMListViewItem *item = m_items.take(i);
- if (item->depth() == 2)
- deleteList.append(item);
- else
- deleteList.prepend(item);
- i--;
- changed = true;
- }
- deleteList.clear();
-
- if (changed) sort();
- emit selectionChanged();
-}
-
-void KMListView::slotSelectionChanged()
-{
- KMListViewItem *item = static_cast<KMListViewItem*>(currentItem());
- emit printerSelected((item && !item->isDiscarded() && item->depth() == 2 ? item->text(0) : TQString::null));
-}
-
-void KMListView::setPrinter(const TQString& prname)
-{
- TQPtrListIterator<KMListViewItem> it(m_items);
- for (;it.current();++it)
- if (it.current()->text(0) == prname)
- {
- setSelected(it.current(),true);
- break;
- }
-}
-
-void KMListView::setPrinter(KMPrinter *p)
-{
- setPrinter(p ? p->name() : TQString::null);
-}
-
-void KMListView::slotOnItem(TQListViewItem *)
-{
- setCursor(KCursor::handCursor());
-}
-
-void KMListView::slotOnViewport()
-{
- setCursor(KCursor::arrowCursor());
-}
-#include "kmlistview.moc"
diff --git a/kdeprint/management/kmlistview.h b/kdeprint/management/kmlistview.h
deleted file mode 100644
index 20ddc5731..000000000
--- a/kdeprint/management/kmlistview.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMLISTVIEW_H
-#define KMLISTVIEW_H
-
-#include <tqlistview.h>
-#include <tqptrlist.h>
-
-class KMListViewItem;
-class KMPrinter;
-
-class KMListView : public TQListView
-{
- Q_OBJECT
-public:
- KMListView(TQWidget *parent = 0, const char *name = 0);
- ~KMListView();
-
- void setPrinterList(TQPtrList<KMPrinter> *list);
- void setPrinter(const TQString&);
- void setPrinter(KMPrinter*);
-
-signals:
- void rightButtonClicked(const TQString&, const TQPoint&);
- void printerSelected(const TQString&);
-
-protected slots:
- void slotRightButtonClicked(TQListViewItem*, const TQPoint&, int);
- void slotSelectionChanged();
- void slotOnItem(TQListViewItem*);
- void slotOnViewport();
-
-protected:
- KMListViewItem* findItem(KMPrinter*);
- KMListViewItem* findItem(const TQString&);
-
-private:
- TQPtrList<KMListViewItem> m_items;
- KMListViewItem *m_root, *m_classes, *m_printers, *m_specials;
-};
-
-#endif
diff --git a/kdeprint/management/kmmainview.cpp b/kdeprint/management/kmmainview.cpp
deleted file mode 100644
index f5f905af3..000000000
--- a/kdeprint/management/kmmainview.cpp
+++ /dev/null
@@ -1,920 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmmainview.h"
-#include "kmtimer.h"
-#include "kmprinterview.h"
-#include "kmpages.h"
-#include "kmmanager.h"
-#include "kmuimanager.h"
-#include "kmfactory.h"
-#include "kmvirtualmanager.h"
-#include "kmprinter.h"
-#include "driver.h"
-#include "kmdriverdialog.h"
-#include "kmwizard.h"
-#include "kmconfigdialog.h"
-#include "kmspecialprinterdlg.h"
-#include "plugincombobox.h"
-#include "kiconselectaction.h"
-#include "messagewindow.h"
-
-#include <tqdockarea.h>
-#include <kmenubar.h>
-#include <tqtimer.h>
-#include <tqcombobox.h>
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <tqpopupmenu.h>
-#include <kmessagebox.h>
-#include <kaction.h>
-#include <klocale.h>
-#include <kconfig.h>
-#include <ktoolbar.h>
-#include <ktoolbarbutton.h>
-#include <kdebug.h>
-#include <kpopupmenu.h>
-#include <klibloader.h>
-#include <kdialogbase.h>
-#include <ksimpleconfig.h>
-#include <kstandarddirs.h>
-#include <kapplication.h>
-#include <kprocess.h>
-
-#undef m_manager
-#define m_manager KMFactory::self()->manager()
-
-int tdeprint_management_add_printer_wizard( TQWidget* parent )
-{
- KMWizard dlg(parent);
- int flag(0);
- if (dlg.exec())
- {
- flag = 1;
- // check if the printer already exists, and ask confirmation if needed.
- if (KMFactory::self()->manager()->findPrinter(dlg.printer()->name()) != 0)
- if (KMessageBox::warningContinueCancel(parent,i18n("The printer %1 already exists. Continuing will overwrite existing printer. Do you want to continue?").arg(dlg.printer()->name())) == KMessageBox::Cancel)
- flag = 0;
- // try to add printer only if flag is true.
- if (flag && !KMFactory::self()->manager()->createPrinter(dlg.printer()))
- flag = -1;
- }
- return flag;
-}
-
-KMMainView::KMMainView(TQWidget *parent, const char *name, KActionCollection *coll)
-: TQWidget(parent, name)
-{
- m_current = 0;
- m_first = true;
-
- // create widgets
- m_printerview = new KMPrinterView(this, "PrinterView");
- m_printerpages = new KMPages(this, "PrinterPages");
- m_pop = new TQPopupMenu(this);
- m_toolbar = new KToolBar(this, "ToolBar");
- m_toolbar->setMovingEnabled(false);
- m_plugin = new PluginComboBox(this, "Plugin");
- /*
- m_menubar = new KMenuBar( this );
- static_cast<KMenuBar*>( m_menubar )->setTopLevelMenu( false );
- */
- m_menubar = new KToolBar( this, "MenuBar", false, false );
- m_menubar->setIconText( KToolBar::IconTextRight );
- m_menubar->setMovingEnabled( false );
-
- // layout
- TQVBoxLayout *m_layout = new TQVBoxLayout(this, 0, 0);
- m_layout->addWidget(m_toolbar);
- m_layout->addWidget( m_menubar );
- m_boxlayout = new TQBoxLayout(TQBoxLayout::TopToBottom, 0, 0);
- m_layout->addLayout(m_boxlayout);
- m_boxlayout->addWidget(m_printerview);
- m_boxlayout->addWidget(m_printerpages);
- m_layout->addSpacing(5);
- m_layout->addWidget(m_plugin, 0);
-
- // connections
- connect(KMTimer::self(),TQT_SIGNAL(timeout()),TQT_SLOT(slotTimer()));
- connect(m_printerview,TQT_SIGNAL(printerSelected(const TQString&)),TQT_SLOT(slotPrinterSelected(const TQString&)));
- connect(m_printerview,TQT_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)),TQT_SLOT(slotRightButtonClicked(const TQString&,const TQPoint&)));
- connect(m_pop,TQT_SIGNAL(aboutToShow()),KMTimer::self(),TQT_SLOT(hold()));
- connect(m_pop,TQT_SIGNAL(aboutToHide()),KMTimer::self(),TQT_SLOT(release()));
- connect( m_manager, TQT_SIGNAL( updatePossible( bool ) ), TQT_SLOT( slotUpdatePossible( bool ) ) );
-
- // actions
- if (coll)
- m_actions = coll;
- else
- m_actions = new KActionCollection(this);
- initActions();
-
- // first update
- restoreSettings();
- loadParameters();
-
- // delay first update until KMManager is ready
- reset( i18n( "Initializing manager..." ), true, true );
-}
-
-KMMainView::~KMMainView()
-{
- saveSettings();
- //KMFactory::release();
-}
-
-void KMMainView::loadParameters()
-{
-}
-
-void KMMainView::restoreSettings()
-{
- KConfig *conf = KMFactory::self()->printConfig();
- conf->setGroup("General");
- setViewType((KMPrinterView::ViewType)conf->readNumEntry("ViewType",KMPrinterView::Icons));
- setOrientation(conf->readNumEntry("Orientation", Qt::Vertical));
- bool view = conf->readBoolEntry("ViewToolBar",false);
- slotToggleToolBar(view);
- ((KToggleAction*)m_actions->action("view_toolbar"))->setChecked(view);
- view = conf->readBoolEntry( "ViewMenuBar", true );
- slotToggleMenuBar( view );
- static_cast<KToggleAction*>( m_actions->action( "view_menubar" ) )->setChecked( view );
- view = conf->readBoolEntry("ViewPrinterInfos",true);
- slotShowPrinterInfos(view);
- ((KToggleAction*)m_actions->action("view_printerinfos"))->setChecked(view);
-}
-
-void KMMainView::saveSettings()
-{
- KConfig *conf = KMFactory::self()->printConfig();
- conf->setGroup("General");
- conf->writeEntry("ViewType",(int)m_printerview->viewType());
- conf->writeEntry("Orientation",(int)orientation());
- conf->writeEntry("ViewToolBar",((KToggleAction*)m_actions->action("view_toolbar"))->isChecked());
- conf->writeEntry("ViewMenuBar",static_cast<KToggleAction*>( m_actions->action("view_menubar") )->isChecked());
- conf->writeEntry("ViewPrinterInfos",((KToggleAction*)m_actions->action("view_printerinfos"))->isChecked());
- conf->sync();
-}
-
-void KMMainView::initActions()
-{
- KIconSelectAction *vact = new KIconSelectAction(i18n("&View"),0,m_actions,"view_change");
- TQStringList iconlst;
- iconlst << "view_icon" << "view_detailed" << "view_tree";
- vact->setItems(TQStringList::split(',',i18n("&Icons,&List,&Tree"),false), iconlst);
- vact->setCurrentItem(0);
- connect(vact,TQT_SIGNAL(activated(int)),TQT_SLOT(slotChangeView(int)));
-
- KActionMenu *stateAct = new KActionMenu(i18n("Start/Stop Printer"), "tdeprint_printstate", m_actions, "printer_state_change");
- stateAct->setDelayed(false);
- stateAct->insert(new KAction(i18n("&Start Printer"),"tdeprint_enableprinter",0,TQT_TQOBJECT(this),TQT_SLOT(slotChangePrinterState()),m_actions,"printer_start"));
- stateAct->insert(new KAction(i18n("Sto&p Printer"),"tdeprint_stopprinter",0,TQT_TQOBJECT(this),TQT_SLOT(slotChangePrinterState()),m_actions,"printer_stop"));
-
- stateAct = new KActionMenu(i18n("Enable/Disable Job Spooling"), "tdeprint_queuestate", m_actions, "printer_spool_change");
- stateAct->setDelayed(false);
- stateAct->insert(new KAction(i18n("&Enable Job Spooling"),"tdeprint_enableprinter",0,TQT_TQOBJECT(this),TQT_SLOT(slotChangePrinterState()),m_actions,"printer_enable"));
- stateAct->insert(new KAction(i18n("&Disable Job Spooling"),"tdeprint_stopprinter",0,TQT_TQOBJECT(this),TQT_SLOT(slotChangePrinterState()),m_actions,"printer_disable"));
-
- new KAction(i18n("&Remove"),"edittrash",0,TQT_TQOBJECT(this),TQT_SLOT(slotRemove()),m_actions,"printer_remove");
- new KAction(i18n("&Configure..."),"configure",0,TQT_TQOBJECT(this),TQT_SLOT(slotConfigure()),m_actions,"printer_configure");
- new KAction(i18n("Add &Printer/Class..."),"tdeprint_addprinter",0,TQT_TQOBJECT(this),TQT_SLOT(slotAdd()),m_actions,"printer_add");
- new KAction(i18n("Add &Special (pseudo) Printer..."),"tdeprint_addpseudo",0,TQT_TQOBJECT(this),TQT_SLOT(slotAddSpecial()),m_actions,"printer_add_special");
- new KAction(i18n("Set as &Local Default"),"tdeprint_defaulthard",0,TQT_TQOBJECT(this),TQT_SLOT(slotHardDefault()),m_actions,"printer_hard_default");
- new KAction(i18n("Set as &User Default"),"tdeprint_defaultsoft",0,TQT_TQOBJECT(this),TQT_SLOT(slotSoftDefault()),m_actions,"printer_soft_default");
- new KAction(i18n("&Test Printer..."),"tdeprint_testprinter",0,TQT_TQOBJECT(this),TQT_SLOT(slotTest()),m_actions,"printer_test");
- new KAction(i18n("Configure &Manager..."),"tdeprint_configmgr",0,TQT_TQOBJECT(this),TQT_SLOT(slotManagerConfigure()),m_actions,"manager_configure");
- new KAction(i18n("Initialize Manager/&View"),"reload",0,TQT_TQOBJECT(this),TQT_SLOT(slotInit()),m_actions,"view_refresh");
-
- KIconSelectAction *dact = new KIconSelectAction(i18n("&Orientation"),0,m_actions,"orientation_change");
- iconlst.clear();
- iconlst << "view_top_bottom" << "view_left_right";
- dact->setItems(TQStringList::split(',',i18n("&Vertical,&Horizontal"),false), iconlst);
- dact->setCurrentItem(0);
- connect(dact,TQT_SIGNAL(activated(int)),TQT_SLOT(slotChangeDirection(int)));
-
- new KAction(i18n("R&estart Server"),"tdeprint_restartsrv",0,TQT_TQOBJECT(this),TQT_SLOT(slotServerRestart()),m_actions,"server_restart");
- new KAction(i18n("Configure &Server..."),"tdeprint_configsrv",0,TQT_TQOBJECT(this),TQT_SLOT(slotServerConfigure()),m_actions,"server_configure");
- new KAction(i18n("Configure Server Access..."),"tdeprint_configsrv",0,TQT_TQOBJECT(this),TQT_SLOT(slotServerAccessConfigure()),m_actions,"server_access_configure");
-
- KToggleAction *tact = new KToggleAction(i18n("Show &Toolbar"),0,m_actions,"view_toolbar");
- tact->setCheckedState(i18n("Hide &Toolbar"));
- connect(tact,TQT_SIGNAL(toggled(bool)),TQT_SLOT(slotToggleToolBar(bool)));
- tact = new KToggleAction( i18n( "Show Me&nu Toolbar" ), 0, m_actions, "view_menubar" );
- tact->setCheckedState(i18n("Hide Me&nu Toolbar"));
- connect( tact, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( slotToggleMenuBar( bool ) ) );
- tact = new KToggleAction(i18n("Show Pr&inter Details"),"tdeprint_printer_infos", 0,m_actions,"view_printerinfos");
- tact->setCheckedState(KGuiItem(i18n("Hide Pr&inter Details"),"tdeprint_printer_infos"));
- tact->setChecked(true);
- connect(tact,TQT_SIGNAL(toggled(bool)),TQT_SLOT(slotShowPrinterInfos(bool)));
-
- tact = new KToggleAction(i18n("Toggle Printer &Filtering"), "filter", 0, m_actions, "view_pfilter");
- tact->setChecked(KMManager::self()->isFilterEnabled());
- connect(tact, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotToggleFilter(bool)));
-
- new KAction( i18n( "%1 &Handbook" ).arg( "KDEPrint" ), "contents", 0, TQT_TQOBJECT(this), TQT_SLOT( slotHelp() ), m_actions, "invoke_help" );
- new KAction( i18n( "%1 &Web Site" ).arg( "KDEPrint" ), "network", 0, TQT_TQOBJECT(this), TQT_SLOT( slotHelp() ), m_actions, "invoke_web" );
-
- KActionMenu *mact = new KActionMenu(i18n("Pri&nter Tools"), "package_utilities", m_actions, "printer_tool");
- mact->setDelayed(false);
- connect(mact->popupMenu(), TQT_SIGNAL(activated(int)), TQT_SLOT(slotToolSelected(int)));
- TQStringList files = KGlobal::dirs()->findAllResources("data", "tdeprint/tools/*.desktop");
- for (TQStringList::ConstIterator it=files.begin(); it!=files.end(); ++it)
- {
- KSimpleConfig conf(*it);
- conf.setGroup("Desktop Entry");
- mact->popupMenu()->insertItem(conf.readEntry("Name", "Unnamed"), mact->popupMenu()->count());
- m_toollist << conf.readEntry("X-KDE-Library");
- }
-
- // add actions to the toolbar
- m_actions->action("printer_add")->plug(m_toolbar);
- m_actions->action("printer_add_special")->plug(m_toolbar);
- m_toolbar->insertLineSeparator();
- m_actions->action("printer_state_change")->plug(m_toolbar);
- m_actions->action("printer_spool_change")->plug(m_toolbar);
- m_toolbar->insertSeparator();
- m_actions->action("printer_hard_default")->plug(m_toolbar);
- m_actions->action("printer_soft_default")->plug(m_toolbar);
- m_actions->action("printer_remove")->plug(m_toolbar);
- m_toolbar->insertSeparator();
- m_actions->action("printer_configure")->plug(m_toolbar);
- m_actions->action("printer_test")->plug(m_toolbar);
- m_actions->action("printer_tool")->plug(m_toolbar);
- m_pactionsindex = m_toolbar->insertSeparator();
- m_toolbar->insertLineSeparator();
- m_actions->action("server_restart")->plug(m_toolbar);
- m_actions->action("server_configure")->plug(m_toolbar);
- m_toolbar->insertLineSeparator();
- m_actions->action("manager_configure")->plug(m_toolbar);
- m_actions->action("view_refresh")->plug(m_toolbar);
- m_toolbar->insertLineSeparator();
- m_actions->action("view_printerinfos")->plug(m_toolbar);
- m_actions->action("view_change")->plug(m_toolbar);
- m_actions->action("orientation_change")->plug(m_toolbar);
- m_actions->action("view_pfilter")->plug(m_toolbar);
-
- // add actions to the menu bar
- TQPopupMenu *menu = new TQPopupMenu( this );
- m_actions->action( "printer_add" )->plug( menu );
- m_actions->action( "printer_add_special" )->plug( menu );
- //m_menubar->insertItem( i18n( "Add" ), menu );
- m_menubar->insertButton( "wizard", 0, true, i18n( "Add" ) );
- m_menubar->getButton( 0 )->setPopup( menu, true );
- menu = new TQPopupMenu( this );
- m_actions->action("printer_state_change")->plug( menu );
- m_actions->action("printer_spool_change")->plug( menu );
- menu->insertSeparator();
- m_actions->action("printer_hard_default")->plug( menu );
- m_actions->action("printer_soft_default")->plug( menu );
- m_actions->action("printer_remove")->plug( menu );
- menu->insertSeparator();
- m_actions->action("printer_configure")->plug( menu );
- m_actions->action("printer_test")->plug( menu );
- m_actions->action("printer_tool")->plug( menu );
- menu->insertSeparator();
- //m_menubar->insertItem( i18n( "Printer" ), menu );
- m_menubar->insertButton( "printer1", 1, true, i18n( "Printer" ) );
- m_menubar->getButton( 1 )->setPopup( menu, true );
- menu = new TQPopupMenu( this );
- m_actions->action("server_restart")->plug( menu );
- m_actions->action("server_configure")->plug( menu );
- //m_menubar->insertItem( i18n( "Server" ), menu );
- m_menubar->insertButton( "misc", 2, true, i18n( "Print Server" ) );
- m_menubar->getButton( 2 )->setPopup( menu, true );
- menu = new TQPopupMenu( this );
- m_actions->action("manager_configure")->plug( menu );
- m_actions->action("view_refresh")->plug( menu );
- //m_menubar->insertItem( i18n( "Manager" ), menu );
- m_menubar->insertButton( "tdeprint_configmgr", 3, true, i18n( "Print Manager" ) );
- m_menubar->getButton( 3 )->setPopup( menu, true );
- menu = new TQPopupMenu( this );
- m_actions->action("view_printerinfos")->plug( menu );
- m_actions->action("view_change")->plug( menu );
- m_actions->action("orientation_change")->plug( menu );
- m_actions->action( "view_toolbar" )->plug ( menu );
- m_actions->action( "view_menubar" )->plug ( menu );
- menu->insertSeparator();
- m_actions->action("view_pfilter")->plug( menu );
- //m_menubar->insertItem( i18n( "View" ), menu );
- m_menubar->insertButton( "view_remove", 4, true, i18n( "View" ) );
- m_menubar->getButton( 4 )->setPopup( menu, true );
- //m_menubar->setMinimumHeight( m_menubar->heightForWidth( 1000 ) );
- menu = new TQPopupMenu( this );
- m_actions->action( "invoke_help" )->plug( menu );
- m_actions->action( "invoke_web" )->plug( menu );
- m_menubar->insertButton( "help", 5, true, i18n( "Documentation" ) );
- m_menubar->getButton( 5 )->setPopup( menu, true );
-
- loadPluginActions();
- slotPrinterSelected(TQString::null);
-}
-
-void KMMainView::slotRefresh()
-{
- // TODO: remove me
-}
-
-void KMMainView::slotTimer()
-{
- kdDebug() << "KMMainView::slotTimer" << endl;
- TQPtrList<KMPrinter> *printerlist = m_manager->printerList();
- bool ok = m_manager->errorMsg().isEmpty();
- m_printerview->setPrinterList(printerlist);
- if ( m_first )
- {
- if ( !ok )
- showErrorMsg(i18n("An error occurred while retrieving the printer list."));
- else
- {
- /* try to select the most appropriate printer:
- * - soft default owner printer
- * - hard default printer
- * - first printer
- */
- TQPtrListIterator<KMPrinter> it( *printerlist );
- KMPrinter *p1 = 0, *p2 = 0, *p3 = 0;
- while ( it.current() )
- {
- if ( !it.current()->isVirtual() )
- {
- if ( it.current()->ownSoftDefault() )
- {
- p1 = it.current();
- break;
- }
- else if ( it.current()->isHardDefault() )
- p2 = it.current();
- else if ( !p3 )
- p3 = it.current();
- }
- ++it;
- }
- if ( p1 || p2 || p3 )
- m_printerview->setPrinter( p1 ? p1 : ( p2 ? p2 : p3 ) );
- }
- m_first = false;
- }
-}
-
-void KMMainView::slotPrinterSelected(const TQString& prname)
-{
- KMPrinter *p = KMManager::self()->findPrinter(prname);
- m_current = p;
- if (p && !p->isSpecial())
- KMFactory::self()->manager()->completePrinter(p);
- m_printerpages->setPrinter(p);
-
- // update actions state (only if toolbar enabled, workaround for toolbar
- // problem).
- //if (m_toolbar->isEnabled())
- //{
- int mask = (m_manager->hasManagement() ? m_manager->printerOperationMask() : 0);
- bool sp = !(p && p->isSpecial());
-// m_actions->action("printer_remove")->setEnabled(!sp || ((mask & KMManager::PrinterRemoval) && p && p->isLocal() && !p->isImplicit()));
- m_actions->action("printer_remove")->setEnabled(!sp || ((mask & KMManager::PrinterRemoval) && p && !p->isImplicit()));
- m_actions->action("printer_configure")->setEnabled(!sp || ((mask & KMManager::PrinterConfigure) && p && !p->isClass(true) /*&& p->isLocal()*/));
- m_actions->action("printer_hard_default")->setEnabled((sp && (mask & KMManager::PrinterDefault) && p && !p->isClass(true) && !p->isHardDefault() && p->isLocal()));
- m_actions->action("printer_soft_default")->setEnabled((p && !p->isSoftDefault()));
- m_actions->action("printer_test")->setEnabled((sp && (mask & KMManager::PrinterTesting) && p && !p->isClass(true)));
- bool stmask = (sp && (mask & KMManager::PrinterEnabling) && p);
- m_actions->action("printer_state_change")->setEnabled(stmask && p->isLocal());
- m_actions->action("printer_spool_change")->setEnabled(stmask);
- m_actions->action("printer_start")->setEnabled((stmask && p->state() == KMPrinter::Stopped));
- m_actions->action("printer_stop")->setEnabled((stmask && p->state() != KMPrinter::Stopped));
- m_actions->action("printer_enable")->setEnabled((stmask && !p->acceptJobs()));
- m_actions->action("printer_disable")->setEnabled((stmask && p->acceptJobs()));
-
- m_actions->action("printer_add")->setEnabled((mask & KMManager::PrinterCreation));
- mask = m_manager->serverOperationMask();
- m_actions->action("server_restart")->setEnabled((mask & KMManager::ServerRestarting));
- m_actions->action("server_configure")->setEnabled((mask & KMManager::ServerConfigure));
-
- KMFactory::self()->manager()->validatePluginActions(m_actions, p);
- //}
- m_actions->action("printer_tool")->setEnabled(p && !p->isClass(true) && !p->isRemote() && !p->isSpecial());
-}
-
-void KMMainView::setViewType(int ID)
-{
- ((KSelectAction*)m_actions->action("view_change"))->setCurrentItem(ID);
- slotChangeView(ID);
-}
-
-int KMMainView::viewType() const
-{ return m_printerview->viewType(); }
-
-void KMMainView::slotChangeView(int ID)
-{
- kdDebug() << "KMMainView::slotChangeView" << endl;
- if (ID >= KMPrinterView::Icons && ID <= KMPrinterView::Tree)
- m_printerview->setViewType((KMPrinterView::ViewType)ID);
-}
-
-void KMMainView::slotRightButtonClicked(const TQString& prname, const TQPoint& p)
-{
- KMPrinter *printer = KMManager::self()->findPrinter(prname);
- // construct popup menu
- m_pop->clear();
- if (printer)
- {
- m_current = printer;
- if (!printer->isSpecial())
- {
- if (printer->isLocal())
- m_actions->action((printer->state() == KMPrinter::Stopped ? "printer_start" : "printer_stop"))->plug(m_pop);
- m_actions->action((printer->acceptJobs() ? "printer_disable" : "printer_enable"))->plug(m_pop);
- m_pop->insertSeparator();
- }
- if (!printer->isSoftDefault()) m_actions->action("printer_soft_default")->plug(m_pop);
- if (printer->isLocal() && !printer->isImplicit())
- {
- if (!printer->isHardDefault()) m_actions->action("printer_hard_default")->plug(m_pop);
- m_actions->action("printer_remove")->plug(m_pop);
- m_pop->insertSeparator();
- if (!printer->isClass(true))
- {
- m_actions->action("printer_configure")->plug(m_pop);
- m_actions->action("printer_test")->plug(m_pop);
- m_actions->action("printer_tool")->plug(m_pop);
- m_pop->insertSeparator();
- }
- }
- else
- {
- m_actions->action("printer_remove")->plug(m_pop);
- m_pop->insertSeparator();
- if (!printer->isClass(true))
- {
- m_actions->action("printer_configure")->plug(m_pop);
- m_actions->action("printer_test")->plug(m_pop);
- }
- m_pop->insertSeparator();
- }
- if (!printer->isSpecial())
- {
- TQValueList<KAction*> pactions = m_actions->actions("plugin");
- for (TQValueList<KAction*>::Iterator it=pactions.begin(); it!=pactions.end(); ++it)
- (*it)->plug(m_pop);
- if (pactions.count() > 0)
- m_pop->insertSeparator();
- }
- }
- else
- {
- m_actions->action("printer_add")->plug(m_pop);
- m_actions->action("printer_add_special")->plug(m_pop);
- m_pop->insertSeparator();
- m_actions->action("server_restart")->plug(m_pop);
- m_actions->action("server_configure")->plug(m_pop);
- m_pop->insertSeparator();
- m_actions->action("manager_configure")->plug(m_pop);
- m_actions->action("view_refresh")->plug(m_pop);
- m_pop->insertSeparator();
- }
- m_actions->action("view_printerinfos")->plug(m_pop);
- m_actions->action("view_change")->plug(m_pop);
- m_actions->action("orientation_change")->plug(m_pop);
- m_actions->action("view_toolbar")->plug(m_pop);
- m_actions->action("view_menubar")->plug(m_pop);
- m_pop->insertSeparator();
- m_actions->action("view_pfilter")->plug(m_pop);
-
- // pop the menu
- m_pop->popup(p);
-}
-
-void KMMainView::slotChangePrinterState()
-{
- TQString opname = TQT_TQOBJECT_CONST(sender())->name();
- if (m_current && opname.startsWith("printer_"))
- {
- opname = opname.mid(8);
- KMTimer::self()->hold();
- bool result(false);
- if (opname == "enable")
- result = m_manager->enablePrinter(m_current, true);
- else if (opname == "disable")
- result = m_manager->enablePrinter(m_current, false);
- else if (opname == "start")
- result = m_manager->startPrinter(m_current, true);
- else if (opname == "stop")
- result = m_manager->startPrinter(m_current, false);
- if (!result)
- showErrorMsg(i18n("Unable to modify the state of printer %1.").arg(m_current->printerName()));
- KMTimer::self()->release(result);
- }
-}
-
-void KMMainView::slotRemove()
-{
- if (m_current)
- {
- KMTimer::self()->hold();
- bool result(false);
- if (KMessageBox::warningYesNo(this,i18n("Do you really want to remove %1?").arg(m_current->printerName())) == KMessageBox::Yes)
- if (m_current->isSpecial())
- {
- if (!(result=m_manager->removeSpecialPrinter(m_current)))
- showErrorMsg(i18n("Unable to remove special printer %1.").arg(m_current->printerName()));
- }
- else if (!(result=m_manager->removePrinter(m_current)))
- showErrorMsg(i18n("Unable to remove printer %1.").arg(m_current->printerName()));
- KMTimer::self()->release(result);
- }
-}
-
-void KMMainView::slotConfigure()
-{
- if (m_current)
- {
- KMTimer::self()->hold();
- bool needRefresh(false);
- if (m_current->isSpecial())
- {
- KMSpecialPrinterDlg dlg(this);
- dlg.setPrinter(m_current);
- if (dlg.exec())
- {
- KMPrinter *prt = dlg.printer();
- if (prt->name() != m_current->name())
- m_manager->removeSpecialPrinter(m_current);
- m_manager->createSpecialPrinter(prt);
- needRefresh = true;
- }
- }
- else
- {
- DrMain *driver = m_manager->loadPrinterDriver(m_current, true);
- if (driver)
- {
- KMDriverDialog dlg(this);
- dlg.setCaption(i18n("Configure %1").arg(m_current->printerName()));
- dlg.setDriver(driver);
- // disable OK button for remote printer (read-only dialog)
- if (m_current->isRemote())
- dlg.enableButtonOK(false);
- if (dlg.exec())
- if (!m_manager->savePrinterDriver(m_current,driver))
- showErrorMsg(i18n("Unable to modify settings of printer %1.").arg(m_current->printerName()));
- delete driver;
- }
- else
- showErrorMsg(i18n("Unable to load a valid driver for printer %1.").arg(m_current->printerName()));
- }
- KMTimer::self()->release(needRefresh);
- }
-}
-
-void KMMainView::slotAdd()
-{
- KMTimer::self()->hold();
-
- int result(0);
- if ((result=tdeprint_management_add_printer_wizard(this)) == -1)
- showErrorMsg(i18n("Unable to create printer."));
-
- KMTimer::self()->release((result == 1));
-}
-
-void KMMainView::slotHardDefault()
-{
- if (m_current)
- {
- KMTimer::self()->hold();
- bool result = m_manager->setDefaultPrinter(m_current);
- if (!result)
- showErrorMsg(i18n("Unable to define printer %1 as default.").arg(m_current->printerName()));
- KMTimer::self()->release(result);
- }
-}
-
-void KMMainView::slotSoftDefault()
-{
- if (m_current)
- {
- KMTimer::self()->hold();
- KMFactory::self()->virtualManager()->setAsDefault(m_current,TQString::null);
- KMTimer::self()->release(true);
- }
-}
-
-void KMMainView::setOrientation(int o)
-{
- int ID = (o == Qt::Horizontal ? 1 : 0);
- ((KSelectAction*)m_actions->action("orientation_change"))->setCurrentItem(ID);
- slotChangeDirection(ID);
-}
-
-int KMMainView::orientation() const
-{ return (m_boxlayout->direction() == TQBoxLayout::LeftToRight ? Qt::Horizontal : Qt::Vertical); }
-
-void KMMainView::slotChangeDirection(int d)
-{
- m_boxlayout->setDirection(d == 1 ? TQBoxLayout::LeftToRight : TQBoxLayout::TopToBottom);
-}
-
-void KMMainView::slotTest()
-{
- if (m_current)
- {
- KMTimer::self()->hold();
- if (KMessageBox::warningContinueCancel(this, i18n("You are about to print a test page on %1. Do you want to continue?").arg(m_current->printerName()), TQString::null, i18n("Print Test Page"), "printTestPage") == KMessageBox::Continue)
- {
- if (KMFactory::self()->manager()->testPrinter(m_current))
- KMessageBox::information(this,i18n("Test page successfully sent to printer %1.").arg(m_current->printerName()));
- else
- showErrorMsg(i18n("Unable to test printer %1.").arg(m_current->printerName()));
- }
- KMTimer::self()->release(true);
- }
-}
-
-void KMMainView::showErrorMsg(const TQString& msg, bool usemgr)
-{
- TQString s(msg);
- if (usemgr)
- {
- s.prepend("<p>");
- s.append(" ");
- s += i18n("Error message received from manager:</p><p>%1</p>");
- if (m_manager->errorMsg().isEmpty())
- s = s.arg(i18n("Internal error (no error message)."));
- else
- s = s.arg(m_manager->errorMsg());
- // clean up error message
- m_manager->setErrorMsg(TQString::null);
- }
- s.prepend("<qt>").append("</qt>");
- KMTimer::self()->hold();
- KMessageBox::error(this,s);
- KMTimer::self()->release();
-}
-
-void KMMainView::slotServerRestart()
-{
- KMTimer::self()->hold();
- bool result = m_manager->restartServer();
- if (!result)
- {
- showErrorMsg(i18n("Unable to restart print server."));
- KMTimer::self()->release( false );
- }
- else
- {
- reset( i18n( "Restarting server..." ), false, false );
- }
-}
-
-void KMMainView::slotServerConfigure()
-{
- KMTimer::self()->hold();
- bool result = m_manager->configureServer(this);
- if (!result)
- {
- showErrorMsg(i18n("Unable to configure print server."));
- KMTimer::self()->release( false );
- }
- else
- {
- reset( i18n( "Configuring server..." ), false, false );
- }
-}
-
-void KMMainView::slotServerConfigureAccess()
-{
- KProcess *proc = new KProcess;
- *proc << "/usr/bin/system-config-printer-kde";
- proc->start(KProcess::DontCare);
-}
-
-void KMMainView::slotToggleToolBar(bool on)
-{
- if (on) m_toolbar->show();
- else m_toolbar->hide();
-}
-
-void KMMainView::slotToggleMenuBar( bool on )
-{
- if ( on )
- m_menubar->show();
- else
- m_menubar->hide();
-}
-
-void KMMainView::slotManagerConfigure()
-{
- KMTimer::self()->hold();
- KMConfigDialog dlg(this,"ConfigDialog");
- if ( dlg.exec() )
- {
- loadParameters();
- }
- /* when "OK":
- * => the config file is saved
- * => triggering a DCOP signal
- * => configChanged() called
- * hence no need to refresh, just release the timer
- */
- KMTimer::self()->release( false );
-}
-
-void KMMainView::slotAddSpecial()
-{
- KMTimer::self()->hold();
- KMSpecialPrinterDlg dlg(this);
- if (dlg.exec())
- {
- KMPrinter *prt = dlg.printer();
- m_manager->createSpecialPrinter(prt);
- }
- KMTimer::self()->release(true);
-}
-
-void KMMainView::slotShowPrinterInfos(bool on)
-{
- if (on)
- m_printerpages->show();
- else
- m_printerpages->hide();
- m_actions->action("orientation_change")->setEnabled(on);
-}
-
-void KMMainView::enableToolbar(bool on)
-{
- KToggleAction *act = (KToggleAction*)m_actions->action("view_toolbar");
- m_toolbar->setEnabled(on);
- act->setEnabled(on);
- if (on && act->isChecked())
- m_toolbar->show();
- else
- m_toolbar->hide();
-}
-
-KAction* KMMainView::action(const char *name)
-{
- return m_actions->action(name);
-}
-
-/*
-void KMMainView::aboutToReload()
-{
- m_printerview->setPrinterList(0);
-}
-*/
-
-void KMMainView::reload()
-{
- removePluginActions();
- loadPluginActions();
-
- // redo the connection as the old manager object has been removed
- connect( m_manager, TQT_SIGNAL( updatePossible( bool ) ), TQT_SLOT( slotUpdatePossible( bool ) ) );
-
- // We must delay the refresh such that all objects has been
- // correctly reloaded (otherwise, crash in KMJobViewer).
- reset( i18n( "Initializing manager..." ), true, true );
-}
-
-void KMMainView::showPrinterInfos(bool on)
-{
- static_cast<KToggleAction*>(m_actions->action("view_printerinfos"))->setChecked(on);
- slotShowPrinterInfos(on);
-}
-
-bool KMMainView::printerInfosShown() const
-{
- return (static_cast<KToggleAction*>(m_actions->action("view_printerinfos"))->isChecked());
-}
-
-void KMMainView::loadPluginActions()
-{
- KMFactory::self()->manager()->createPluginActions(m_actions);
- TQValueList<KAction*> pactions = m_actions->actions("plugin");
- int index = m_pactionsindex;
- //TQPopupMenu *menu = m_menubar->findItem( m_menubar->idAt( 1 ) )->popup();
- TQPopupMenu *menu = m_menubar->getButton( 1 )->popup();
- for (TQValueList<KAction*>::Iterator it=pactions.begin(); it!=pactions.end(); ++it)
- {
- (*it)->plug(m_toolbar, index++);
- ( *it )->plug( menu );
- }
-}
-
-void KMMainView::removePluginActions()
-{
- TQValueList<KAction*> pactions = m_actions->actions("plugin");
- for (TQValueList<KAction*>::Iterator it=pactions.begin(); it!=pactions.end(); ++it)
- {
- (*it)->unplugAll();
- delete (*it);
- }
-}
-
-void KMMainView::slotToolSelected(int ID)
-{
- KMTimer::self()->hold();
-
- TQString libname = m_toollist[ID];
- libname.prepend("tdeprint_tool_");
- if (m_current && !m_current->device().isEmpty() && !libname.isEmpty())
- {
- KLibFactory *factory = KLibLoader::self()->factory(libname.local8Bit());
- if (factory)
- {
- TQStringList args;
- args << m_current->device() << m_current->printerName();
- KDialogBase *dlg = static_cast<KDialogBase*>(TQT_TQWIDGET(factory->create(TQT_TQOBJECT(this), "Tool", 0, args)));
- if (dlg)
- dlg->exec();
- delete dlg;
- }
- }
- else
- KMessageBox::error(this,
- i18n("Unable to start printer tool. Possible reasons are: "
- "no printer selected, the selected printer doesn't have "
- "any local device defined (printer port), or the tool library "
- "could not be found."));
-
- KMTimer::self()->release();
-}
-
-void KMMainView::slotToggleFilter(bool on)
-{
- KMTimer::self()->hold();
- KMManager::self()->enableFilter(on);
- KMTimer::self()->release(true);
-}
-
-void KMMainView::configChanged()
-{
- reset( i18n( "Initializing manager..." ), false, true );
-}
-
-void KMMainView::slotUpdatePossible( bool flag )
-{
- destroyMessageWindow();
- if ( !flag )
- showErrorMsg( i18n( "Unable to retrieve the printer list." ) );
- KMTimer::self()->release( true );
-}
-
-void KMMainView::createMessageWindow( const TQString& txt, int delay )
-{
- destroyMessageWindow();
- MessageWindow::add( m_printerview, txt, delay );
-}
-
-void KMMainView::destroyMessageWindow()
-{
- MessageWindow::remove( m_printerview );
-}
-
-void KMMainView::slotInit()
-{
- reset( i18n( "Initializing manager..." ), true, true );
-}
-
-void KMMainView::reset( const TQString& msg, bool useDelay, bool holdTimer )
-{
- if ( holdTimer )
- KMTimer::self()->hold();
- m_printerview->setPrinterList( 0 );
- if ( !msg.isEmpty() )
- createMessageWindow( msg, ( useDelay ? 500 : 0 ) );
- m_first = true;
- m_manager->checkUpdatePossible();
-}
-
-void KMMainView::slotHelp()
-{
- TQString s = TQT_TQOBJECT_CONST(sender())->name();
- if ( s == "invoke_help" )
- kapp->invokeHelp( TQString::null, "tdeprint" );
- else if ( s == "invoke_web" )
- {
- TQStringList args;
- args << "exec" << "http://printing.kde.org";
- kapp->tdeinitExec( "kfmclient", args );
- }
- else
- kdDebug( 500 ) << "Unknown help invokator: " << s << endl;
-}
-
-#include "kmmainview.moc"
diff --git a/kdeprint/management/kmmainview.h b/kdeprint/management/kmmainview.h
deleted file mode 100644
index 0d05692d9..000000000
--- a/kdeprint/management/kmmainview.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMMAINVIEW_H
-#define KMMAINVIEW_H
-
-#if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
-#warning internal header, do not use except if you are a KDEPrint developer
-#endif
-
-#include <tqwidget.h>
-#include <tdeprint/kpreloadobject.h>
-#include <kmainwindow.h>
-
-class KMManager;
-class KMPrinterView;
-class KMPrinter;
-class KMPages;
-class KActionCollection;
-class TQPopupMenu;
-class TQTimer;
-class TQSplitter;
-class KToolBar;
-class KAction;
-class PluginComboBox;
-class TQBoxLayout;
-class MessageWindow;
-class TQMenuBar;
-
-/**
- * @internal
- * This class is internal to KDEPrint and is not intended to be
- * used outside it. Please do not make use of this header, except
- * if you're a KDEPrint developer. The API might change in the
- * future and binary compatibility might be broken.
- */
-class KDEPRINT_EXPORT KMMainView : public TQWidget, public KPReloadObject
-{
- Q_OBJECT
-public:
- KMMainView(TQWidget *parent = 0, const char *name = 0, KActionCollection *coll = 0);
- ~KMMainView();
-
- void setOrientation(int);
- int orientation() const;
- void setViewType(int);
- int viewType() const;
- void enableToolbar(bool on = true);
- KAction* action(const char *name);
- void showPrinterInfos(bool on);
- bool printerInfosShown() const;
-
-public slots:
- void slotTimer();
- void slotShowPrinterInfos(bool);
- void slotChangePrinterState();
- void slotRemove();
- void slotConfigure();
- void slotAdd();
- void slotHardDefault();
- void slotSoftDefault();
- void slotTest();
- void slotServerRestart();
- void slotServerConfigure();
- void slotServerConfigureAccess();
- void slotManagerConfigure();
- void slotAddSpecial();
- void slotRefresh();
- void slotToolSelected(int);
- void slotToggleFilter(bool);
- void slotHelp();
-
-protected slots:
- void slotPrinterSelected(const TQString&);
- void slotRightButtonClicked(const TQString&, const TQPoint&);
- void slotToggleToolBar(bool);
- void slotToggleMenuBar(bool);
- void slotChangeView(int);
- void slotChangeDirection(int);
- void slotUpdatePossible( bool );
- void slotInit();
-
-protected:
- void initActions();
- void showErrorMsg(const TQString& msg, bool usemgr = true);
- void restoreSettings();
- void saveSettings();
- void loadParameters();
- void reload();
- void configChanged();
- //void aboutToReload();
- void loadPluginActions();
- void removePluginActions();
- void createMessageWindow( const TQString&, int delay = 500 );
- void destroyMessageWindow();
- void reset( const TQString& msg = TQString::null, bool useDelay = true, bool holdTimer = true );
-
-private:
- KMPrinterView *m_printerview;
- KMPages *m_printerpages;
- TQPopupMenu *m_pop;
- KActionCollection *m_actions;
- KMPrinter *m_current;
- KToolBar *m_toolbar;
- PluginComboBox *m_plugin;
- int m_pactionsindex;
- TQStringList m_toollist;
- bool m_first;
- TQBoxLayout *m_boxlayout;
- class KMainWindowPrivate;
- KMainWindowPrivate *d;
- KToolBar *m_menubar;
-};
-
-KDEPRINT_EXPORT int tdeprint_management_add_printer_wizard( TQWidget* parent );
-
-#endif
diff --git a/kdeprint/management/kmpages.cpp b/kdeprint/management/kmpages.cpp
deleted file mode 100644
index 4f0f1f4f7..000000000
--- a/kdeprint/management/kmpages.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpages.h"
-#include "kminfopage.h"
-#include "kmjobviewer.h"
-#include "kmpropertypage.h"
-#include "kminstancepage.h"
-
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kdialog.h>
-
-KMPages::KMPages(TQWidget *parent, const char *name)
-: TQTabWidget(parent,name)
-{
- m_pages.setAutoDelete(false);
- initialize();
-}
-
-KMPages::~KMPages()
-{
-}
-
-void KMPages::setPrinter(KMPrinter *p)
-{
- TQPtrListIterator<KMPrinterPage> it(m_pages);
- for (int i=0;it.current();++it,i++)
- it.current()->setPrinter(p);
-}
-
-void KMPages::initialize()
-{
- setMargin(KDialog::marginHint());
-
- // Info page
- KMInfoPage *infopage = new KMInfoPage(this, "InfoPage");
- addTab(infopage, SmallIcon("help"), i18n("Information"));
- m_pages.append(infopage);
-
- // Job page
- KMJobViewer *jobviewer = new KMJobViewer(this, "JobViewer");
- addTab(jobviewer, SmallIcon("folder"), i18n("Jobs"));
- m_pages.append(jobviewer);
-
- // Property page
- KMPropertyPage *proppage = new KMPropertyPage(this, "Property");
- addTab(proppage, SmallIcon("configure"), i18n("Properties"));
- m_pages.append(proppage);
-
- // Instance page
- KMInstancePage *instpage = new KMInstancePage(this, "Instance");
- addTab(instpage, SmallIcon("fileprint"), i18n("Instances"));
- m_pages.append(instpage);
-
- // initialize pages
- setPrinter(0);
-}
diff --git a/kdeprint/management/kmpages.h b/kdeprint/management/kmpages.h
deleted file mode 100644
index 761c8d22d..000000000
--- a/kdeprint/management/kmpages.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPAGES_H
-#define KMPAGES_H
-
-#include <tqtabwidget.h>
-#include <tqptrlist.h>
-
-class KMPrinter;
-class KMPrinterPage;
-
-class KMPages : public TQTabWidget
-{
-public:
- KMPages(TQWidget *parent = 0, const char *name = 0);
- ~KMPages();
-
- void setPrinter(KMPrinter *p);
-
-protected:
- void initialize();
-
-private:
- TQPtrList<KMPrinterPage> m_pages;
-};
-
-#endif
diff --git a/kdeprint/management/kmprinterpage.h b/kdeprint/management/kmprinterpage.h
deleted file mode 100644
index 25e5b1c12..000000000
--- a/kdeprint/management/kmprinterpage.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPRINTERPAGE_H
-#define KMPRINTERPAGE_H
-
-#if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
-#warning internal header, do not use except if you are a KDEPrint developer
-#endif
-
-class KMPrinter;
-
-/**
- * @internal
- * This class is internal to KDEPrint and is not intended to be
- * used outside it. Please do not make use of this header, except
- * if you're a KDEPrint developer. The API might change in the
- * future and binary compatibility might be broken.
- */
-class KMPrinterPage
-{
-public:
- virtual void setPrinter(KMPrinter*) = 0;
-};
-
-#endif
diff --git a/kdeprint/management/kmprinterview.cpp b/kdeprint/management/kmprinterview.cpp
deleted file mode 100644
index 19264a946..000000000
--- a/kdeprint/management/kmprinterview.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmprinterview.h"
-#include "kmprinter.h"
-#include "kmiconview.h"
-#include "kmlistview.h"
-#include "kmtimer.h"
-#include "kmmanager.h"
-
-#include <tqlayout.h>
-#include <tqpopupmenu.h>
-#include <kaction.h>
-#include <klocale.h>
-
-KMPrinterView::KMPrinterView(TQWidget *parent, const char *name)
-: TQWidgetStack(parent,name), m_type(KMPrinterView::Icons)
-{
- m_iconview = new KMIconView(this);
- addWidget(m_iconview,0);
- m_listview = new KMListView(this);
- addWidget(m_listview,1);
- m_current = TQString();
- m_listset = false;
-
- connect(m_iconview,TQT_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)),TQT_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)));
- connect(m_listview,TQT_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)),TQT_SIGNAL(rightButtonClicked(const TQString&,const TQPoint&)));
- connect(m_iconview,TQT_SIGNAL(printerSelected(const TQString&)),TQT_SIGNAL(printerSelected(const TQString&)));
- connect(m_listview,TQT_SIGNAL(printerSelected(const TQString&)),TQT_SIGNAL(printerSelected(const TQString&)));
- connect(m_iconview,TQT_SIGNAL(printerSelected(const TQString&)),TQT_SLOT(slotPrinterSelected(const TQString&)));
- connect(m_listview,TQT_SIGNAL(printerSelected(const TQString&)),TQT_SLOT(slotPrinterSelected(const TQString&)));
-
- setViewType(m_type);
- tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
-}
-
-KMPrinterView::~KMPrinterView()
-{
-}
-
-void KMPrinterView::setPrinterList(TQPtrList<KMPrinter> *list)
-{
- if (m_type != KMPrinterView::Tree || list == 0)
- m_iconview->setPrinterList(list);
- if (m_type == KMPrinterView::Tree || list == 0)
- m_listview->setPrinterList(list);
- m_listset = ( list != 0 );
-}
-
-void KMPrinterView::setPrinter( KMPrinter *p )
-{
- if ( m_type == KMPrinterView::Tree )
- m_listview->setPrinter( p );
- else
- m_iconview->setPrinter( p );
-}
-
-void KMPrinterView::setViewType(ViewType t)
-{
- m_type = t;
- switch (m_type)
- {
- case KMPrinterView::Icons:
- m_iconview->setViewMode(KMIconView::Big);
- break;
- case KMPrinterView::List:
- m_iconview->setViewMode(KMIconView::Small);
- break;
- default:
- break;
- }
- QString oldcurrent = m_current;
- if ( m_listset )
- setPrinterList(KMManager::self()->printerList(false));
- if (m_type == KMPrinterView::Tree)
- {
- raiseWidget(m_listview);
- m_listview->setPrinter(oldcurrent);
- }
- else
- {
- raiseWidget(m_iconview);
- m_iconview->setPrinter(oldcurrent);
- }
-}
-
-void KMPrinterView::slotPrinterSelected(const TQString& p)
-{
- m_current = p;
-}
-
-TQSize KMPrinterView::tqminimumSizeHint() const
-{
- return TQWidgetStack::tqminimumSizeHint();
-}
-
-#include "kmprinterview.moc"
diff --git a/kdeprint/management/kmprinterview.h b/kdeprint/management/kmprinterview.h
deleted file mode 100644
index ba1bd38b1..000000000
--- a/kdeprint/management/kmprinterview.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPRINTERVIEW_H
-#define KMPRINTERVIEW_H
-
-#include <tqwidgetstack.h>
-#include <tqptrlist.h>
-
-class KMIconView;
-class KMListView;
-class KMPrinter;
-class TQIconViewItem;
-
-class KMPrinterView : public TQWidgetStack
-{
- Q_OBJECT
-public:
- enum ViewType { Icons = 0, List, Tree };
-
- KMPrinterView(TQWidget *parent = 0, const char *name = 0);
- ~KMPrinterView();
-
- void setPrinterList(TQPtrList<KMPrinter> *list);
- void setPrinter( KMPrinter* );
- void setViewType(ViewType t);
- ViewType viewType() const { return m_type; }
-
- TQSize tqminimumSizeHint() const;
-
-signals:
- void printerSelected(const TQString&);
- void rightButtonClicked(const TQString&, const TQPoint&);
-
-protected slots:
- void slotPrinterSelected(const TQString&);
-
-private:
- KMIconView *m_iconview;
- KMListView *m_listview;
- ViewType m_type;
- QString m_current;
- bool m_listset;
-};
-
-#endif
diff --git a/kdeprint/management/kmpropbackend.cpp b/kdeprint/management/kmpropbackend.cpp
deleted file mode 100644
index 98004d2ed..000000000
--- a/kdeprint/management/kmpropbackend.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpropbackend.h"
-#include "kmprinter.h"
-#include "kmwizard.h"
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <klocale.h>
-
-KMPropBackend::KMPropBackend(TQWidget *parent, const char *name)
-: KMPropWidget(parent,name)
-{
- m_uri = new TQLabel("",this);
- m_type = new TQLabel("",this);
-
- TQLabel *l1 = new TQLabel(i18n("Printer type:"), this);
- TQLabel *l2 = new TQLabel(i18n("URI:"), this);
-
- // layout
- TQGridLayout *main_ = new TQGridLayout(this, 3, 2, 10, 7);
- main_->setColStretch(0,0);
- main_->setColStretch(1,1);
- main_->setRowStretch(2,1);
- main_->addWidget(l1,0,0);
- main_->addWidget(l2,1,0);
- main_->addWidget(m_type,0,1);
- main_->addWidget(m_uri,1,1);
-
- m_pixmap = "connect_established";
- m_title = i18n("Interface");
- m_header = i18n("Interface Settings");
-}
-
-KMPropBackend::~KMPropBackend()
-{
-}
-
-void KMPropBackend::setPrinter(KMPrinter *p)
-{
- if (p && p->isPrinter())
- {
- m_uri->setText(KURL(p->device()).prettyURL());
- TQString prot = p->deviceProtocol();
- if (prot == "ipp" || prot == "http") m_type->setText(i18n("IPP Printer"));
- else if (prot == "usb") m_type->setText(i18n("Local USB Printer"));
- else if (prot == "parallel") m_type->setText(i18n("Local Parallel Printer"));
- else if (prot == "serial") m_type->setText(i18n("Local Serial Printer"));
- else if (prot == "socket") m_type->setText(i18n("Network Printer (socket)"));
- else if (prot == "smb") m_type->setText(i18n("SMB printers (Windows)"));
- else if (prot == "lpd") m_type->setText(i18n("Remote LPD queue"));
- else if (prot == "file") m_type->setText(i18n("File printer"));
- else if (prot == "fax") m_type->setText(i18n("Serial Fax/Modem printer"));
- else m_type->setText(i18n("Unknown Protocol", "Unknown"));
- emit enable(true);
- emit enableChange(p->isLocal());
- }
- else
- {
- emit enable(false);
- m_type->setText("");
- m_uri->setText("");
- }
-}
-
-void KMPropBackend::configureWizard(KMWizard *w)
-{
- w->configure(KMWizard::Backend,KMWizard::Driver,false);
-}
diff --git a/kdeprint/management/kmpropbackend.h b/kdeprint/management/kmpropbackend.h
deleted file mode 100644
index 01249d348..000000000
--- a/kdeprint/management/kmpropbackend.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPROPBACKEND_H
-#define KMPROPBACKEND_H
-
-#include "kmpropwidget.h"
-
-#include <kdelibs_export.h>
-
-class TQLabel;
-
-class KDEPRINT_EXPORT KMPropBackend : public KMPropWidget
-{
-public:
- KMPropBackend(TQWidget *parent = 0, const char *name = 0);
- ~KMPropBackend();
-
- void setPrinter(KMPrinter*);
-
-protected:
- void configureWizard(KMWizard*);
-
-private:
- TQLabel *m_type;
- TQLabel *m_uri;
-};
-
-#endif
diff --git a/kdeprint/management/kmpropcontainer.cpp b/kdeprint/management/kmpropcontainer.cpp
deleted file mode 100644
index 9c7808199..000000000
--- a/kdeprint/management/kmpropcontainer.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpropcontainer.h"
-#include "kmpropwidget.h"
-
-#include <kpushbutton.h>
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kseparator.h>
-#include <kguiitem.h>
-
-KMPropContainer::KMPropContainer(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- KSeparator* sep = new KSeparator( KSeparator::HLine, this);
- sep->setFixedHeight(5);
-
- m_button = new KPushButton(KGuiItem(i18n("Change..."), "edit"), this);
- m_widget = 0;
-
- TQVBoxLayout *main_ = new TQVBoxLayout(this, 0, 10);
- TQHBoxLayout *btn_ = new TQHBoxLayout(0, 0, 0);
- main_->addWidget(sep,0);
- main_->addLayout(btn_,0);
- btn_->addStretch(1);
- btn_->addWidget(m_button);
-}
-
-KMPropContainer::~KMPropContainer()
-{
-}
-
-void KMPropContainer::setWidget(KMPropWidget *w)
-{
- if (!m_widget)
- {
- m_widget = w;
- m_widget->reparent(this,TQPoint(0,0));
- connect(m_button,TQT_SIGNAL(clicked()),m_widget,TQT_SLOT(slotChange()));
- connect(m_widget,TQT_SIGNAL(enable(bool)),TQT_SIGNAL(enable(bool)));
- connect(m_widget,TQT_SIGNAL(enableChange(bool)),TQT_SLOT(slotEnableChange(bool)));
- TQVBoxLayout *lay = dynamic_cast<TQVBoxLayout*>(layout());
- if (lay)
- {
- lay->insertWidget(0,m_widget,1);
- }
- }
-}
-
-void KMPropContainer::setPrinter(KMPrinter *p)
-{
- if (m_widget)
- m_widget->setPrinterBase(p);
-}
-
-void KMPropContainer::slotEnableChange(bool on)
-{
- m_button->setEnabled(on && (m_widget ? m_widget->canChange() : true));
-}
-#include "kmpropcontainer.moc"
diff --git a/kdeprint/management/kmpropcontainer.h b/kdeprint/management/kmpropcontainer.h
deleted file mode 100644
index d191dfeb6..000000000
--- a/kdeprint/management/kmpropcontainer.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPROPCONTAINER_H
-#define KMPROPCONTAINER_H
-
-#include <tqwidget.h>
-
-class KMPropWidget;
-class TQPushButton;
-class KMPrinter;
-
-class KMPropContainer : public TQWidget
-{
- Q_OBJECT
-public:
- KMPropContainer(TQWidget *parent = 0, const char *name = 0);
- ~KMPropContainer();
-
- void setWidget(KMPropWidget*);
- void setPrinter(KMPrinter*);
-
-signals:
- void enable(bool);
-
-protected slots:
- void slotEnableChange(bool);
-
-private:
- KMPropWidget *m_widget;
- TQPushButton *m_button;
-};
-
-#endif
diff --git a/kdeprint/management/kmpropdriver.cpp b/kdeprint/management/kmpropdriver.cpp
deleted file mode 100644
index 55daf0ed5..000000000
--- a/kdeprint/management/kmpropdriver.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpropdriver.h"
-#include "kmprinter.h"
-#include "kmwizard.h"
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <klocale.h>
-
-KMPropDriver::KMPropDriver(TQWidget *parent, const char *name)
-: KMPropWidget(parent,name)
-{
- m_manufacturer = new TQLabel("",this);
- m_model = new TQLabel("",this);
- m_driverinfo = new TQLabel("",this);
- m_driverinfo->setTextFormat(TQt::RichText);
-
- TQLabel *l1 = new TQLabel(i18n("Manufacturer:"), this);
- TQLabel *l2 = new TQLabel(i18n("Printer model:"), this);
- TQLabel *l3 = new TQLabel(i18n("Driver info:"), this);
-
- // layout
- TQGridLayout *main_ = new TQGridLayout(this, 4, 2, 10, 7);
- main_->setColStretch(0,0);
- main_->setColStretch(1,1);
- main_->setRowStretch(3,1);
- main_->addWidget(l1,0,0);
- main_->addWidget(l2,1,0);
- main_->addWidget(l3,2,0,Qt::AlignTop|Qt::AlignLeft);
- main_->addWidget(m_manufacturer,0,1);
- main_->addWidget(m_model,1,1);
- main_->addWidget(m_driverinfo,2,1);
-
- m_pixmap = "gear";
- m_title = i18n("Driver");
- m_header = i18n("Driver Settings");
-}
-
-KMPropDriver::~KMPropDriver()
-{
-}
-
-void KMPropDriver::setPrinter(KMPrinter *p)
-{
- if (p && p->isPrinter())
- {
- m_manufacturer->setText(p->manufacturer());
- m_model->setText(p->model());
- m_driverinfo->setText(p->driverInfo());
- emit enable(true);
- emit enableChange(p->isLocal());
- }
- else
- {
- emit enable(false);
- m_manufacturer->setText("");
- m_model->setText("");
- m_driverinfo->setText("");
- }
-}
-
-void KMPropDriver::configureWizard(KMWizard *w)
-{
- w->configure(KMWizard::Driver,KMWizard::DriverTest,true);
-}
diff --git a/kdeprint/management/kmpropdriver.h b/kdeprint/management/kmpropdriver.h
deleted file mode 100644
index 247431762..000000000
--- a/kdeprint/management/kmpropdriver.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPROPDRIVER_H
-#define KMPROPDRIVER_H
-
-#include "kmpropwidget.h"
-
-#include <kdelibs_export.h>
-
-class TQLabel;
-
-class KDEPRINT_EXPORT KMPropDriver : public KMPropWidget
-{
-public:
- KMPropDriver(TQWidget *parent = 0, const char *name = 0);
- ~KMPropDriver();
-
- void setPrinter(KMPrinter*);
-
-protected:
- void configureWizard(KMWizard*);
-
-private:
- TQLabel *m_manufacturer;
- TQLabel *m_model;
- TQLabel *m_driverinfo;
-};
-
-#endif
diff --git a/kdeprint/management/kmpropertypage.cpp b/kdeprint/management/kmpropertypage.cpp
deleted file mode 100644
index e0526ad5a..000000000
--- a/kdeprint/management/kmpropertypage.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpropertypage.h"
-#include "kmpropwidget.h"
-#include "kmpropcontainer.h"
-#include "kmprinter.h"
-#include "kmfactory.h"
-#include "kmuimanager.h"
-
-#include "kmpropgeneral.h"
-
-#include <tqvbox.h>
-#include <kiconloader.h>
-
-KMPropertyPage::KMPropertyPage(TQWidget *parent, const char *name)
-: CJanusWidget(parent,name)
-{
- m_widgets.setAutoDelete(false);
-
- initialize();
-}
-
-KMPropertyPage::~KMPropertyPage()
-{
-}
-
-void KMPropertyPage::setPrinter(KMPrinter *p)
-{
- TQPtrListIterator<KMPropWidget> it(m_widgets);
- for (;it.current();++it)
- it.current()->setPrinterBase(p);
-}
-
-void KMPropertyPage::addPropPage(KMPropWidget *w)
-{
- if (w)
- {
- m_widgets.append(w);
- KMPropContainer *ctn = new KMPropContainer(this,"Container");
- ctn->setWidget(w);
- connect(ctn,TQT_SIGNAL(enable(bool)),TQT_SLOT(slotEnable(bool)));
-
- TQPixmap icon = KGlobal::instance()->iconLoader()->loadIcon(
- w->pixmap(),
- KIcon::NoGroup,
- KIcon::SizeMedium
- );
- addPage(ctn,w->title(),w->header(),icon);
- }
-}
-
-void KMPropertyPage::slotEnable(bool on)
-{
- TQWidget *w = (TQWidget*)(sender());
- if (on)
- enablePage(w);
- else
- disablePage(w);
-}
-
-void KMPropertyPage::initialize()
-{
- // add General page
- addPropPage(new KMPropGeneral(this, "General"));
- // add plugin specific pages
- KMFactory::self()->uiManager()->setupPropertyPages(this);
-}
-
-void KMPropertyPage::reload()
-{
- clearPages();
- m_widgets.clear();
- initialize();
- setPrinter(0);
-}
-
-#include "kmpropertypage.moc"
diff --git a/kdeprint/management/kmpropertypage.h b/kdeprint/management/kmpropertypage.h
deleted file mode 100644
index d13338750..000000000
--- a/kdeprint/management/kmpropertypage.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPROPERTYPAGE_H
-#define KMPROPERTYPAGE_H
-
-#include "cjanuswidget.h"
-#include "kmprinterpage.h"
-#include <tdeprint/kpreloadobject.h>
-#include <kdelibs_export.h>
-#include <tqptrlist.h>
-
-class KMPropWidget;
-class KMPrinter;
-
-class KDEPRINT_EXPORT KMPropertyPage : public CJanusWidget, public KMPrinterPage, public KPReloadObject
-{
- Q_OBJECT
-public:
- KMPropertyPage(TQWidget *parent = 0, const char *name = 0);
- ~KMPropertyPage();
-
- void addPropPage(KMPropWidget*);
- void setPrinter(KMPrinter*);
-
-protected slots:
- void slotEnable(bool);
- void initialize();
-
-protected:
- void reload();
-
-private:
- TQPtrList<KMPropWidget> m_widgets;
-};
-
-#endif
diff --git a/kdeprint/management/kmpropgeneral.cpp b/kdeprint/management/kmpropgeneral.cpp
deleted file mode 100644
index c55603da9..000000000
--- a/kdeprint/management/kmpropgeneral.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpropgeneral.h"
-#include "kmprinter.h"
-#include "kmwizard.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <klocale.h>
-
-KMPropGeneral::KMPropGeneral(TQWidget *parent, const char *name)
-: KMPropWidget(parent,name)
-{
- m_name = new TQLabel("",this);
- m_location = new TQLabel("",this);
- m_description = new TQLabel("",this);
-
- TQLabel *l1 = new TQLabel(i18n("Printer name:"), this);
- TQLabel *l2 = new TQLabel(i18n("Physical Location", "Location:"), this);
- TQLabel *l3 = new TQLabel(i18n("Description:"), this);
-
- // layout
- TQGridLayout *main_ = new TQGridLayout(this, 4, 2, 10, 7);
- main_->setColStretch(0,0);
- main_->setColStretch(1,1);
- main_->setRowStretch(3,1);
- main_->addWidget(l1,0,0);
- main_->addWidget(l2,1,0);
- main_->addWidget(l3,2,0);
- main_->addWidget(m_name,0,1);
- main_->addWidget(m_location,1,1);
- main_->addWidget(m_description,2,1);
-
- m_pixmap = "contents";
- m_title = i18n("General");
- m_header = i18n("General Settings");
-}
-
-KMPropGeneral::~KMPropGeneral()
-{
-}
-
-void KMPropGeneral::setPrinter(KMPrinter *p)
-{
- if (p)
- {
- m_name->setText(p->name());
- m_location->setText(p->location());
- m_description->setText(p->description());
- emit enableChange(!(p->isSpecial() || p->isRemote() || p->isImplicit()));
- }
- else
- {
- emit enableChange(false);
- m_name->setText("");
- m_location->setText("");
- m_description->setText("");
- }
-}
-
-void KMPropGeneral::configureWizard(KMWizard *w)
-{
- w->configure(KMWizard::Name,KMWizard::Name,true);
-}
diff --git a/kdeprint/management/kmpropgeneral.h b/kdeprint/management/kmpropgeneral.h
deleted file mode 100644
index c4e403b86..000000000
--- a/kdeprint/management/kmpropgeneral.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPROPGENERAL_H
-#define KMPROPGENERAL_H
-
-#include "kmpropwidget.h"
-
-class TQLabel;
-
-class KMPropGeneral : public KMPropWidget
-{
-public:
- KMPropGeneral(TQWidget *parent = 0, const char *name = 0);
- ~KMPropGeneral();
-
- void setPrinter(KMPrinter*);
-
-protected:
- void configureWizard(KMWizard*);
-
-private:
- TQLabel *m_name;
- TQLabel *m_location;
- TQLabel *m_description;
-};
-
-#endif
diff --git a/kdeprint/management/kmpropmembers.cpp b/kdeprint/management/kmpropmembers.cpp
deleted file mode 100644
index 4efbcf547..000000000
--- a/kdeprint/management/kmpropmembers.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpropmembers.h"
-#include "kmprinter.h"
-#include "kmwizard.h"
-
-#include <tqtextview.h>
-#include <tqlayout.h>
-#include <klocale.h>
-
-KMPropMembers::KMPropMembers(TQWidget *parent, const char *name)
-: KMPropWidget(parent,name)
-{
- m_members = new TQTextView(this);
- m_members->setPaper(tqcolorGroup().background());
- m_members->setFrameStyle(TQFrame::NoFrame);
-
- TQVBoxLayout *main_ = new TQVBoxLayout(this, 10, 0);
- main_->addWidget(m_members);
-
- m_pixmap = "tdeprint_printer_class";
- m_title = i18n("Members");
- m_header = i18n("Class Members");
-}
-
-KMPropMembers::~KMPropMembers()
-{
-}
-
-void KMPropMembers::setPrinter(KMPrinter *p)
-{
- if (p && ((p->isClass(false) && p->isLocal()) || p->isImplicit()))
- {
- TQStringList l = p->members();
- TQString txt("<ul>");
- for (TQStringList::ConstIterator it=l.begin(); it!=l.end(); ++it)
- txt.append("<li>" + (*it) + "</li>");
- txt.append("</ul>");
- m_members->setText(txt);
- emit enable(true);
- emit enableChange(!p->isImplicit());
- }
- else
- {
- emit enable(false);
- m_members->setText("");
- }
-}
-
-void KMPropMembers::configureWizard(KMWizard *w)
-{
- w->configure(KMWizard::Class,KMWizard::Class,true);
-}
diff --git a/kdeprint/management/kmpropmembers.h b/kdeprint/management/kmpropmembers.h
deleted file mode 100644
index 90330681e..000000000
--- a/kdeprint/management/kmpropmembers.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPROPMEMBERS_H
-#define KMPROPMEMBERS_H
-
-#include "kmpropwidget.h"
-
-class TQTextView;
-
-class KDEPRINT_EXPORT KMPropMembers : public KMPropWidget
-{
-public:
- KMPropMembers(TQWidget *parent = 0, const char *name = 0);
- ~KMPropMembers();
-
- void setPrinter(KMPrinter*);
-
-protected:
- void configureWizard(KMWizard*);
-
-private:
- TQTextView *m_members;
-};
-
-#endif
diff --git a/kdeprint/management/kmpropwidget.cpp b/kdeprint/management/kmpropwidget.cpp
deleted file mode 100644
index ae8b03cbf..000000000
--- a/kdeprint/management/kmpropwidget.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmpropwidget.h"
-#include "kmwizard.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-#include "kmtimer.h"
-
-#include <kmessagebox.h>
-#include <klocale.h>
-
-KMPropWidget::KMPropWidget(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- m_pixmap = "folder";
- m_title = m_header = "Title";
- m_printer = 0;
- m_canchange = ((KMFactory::self()->manager()->printerOperationMask() & KMManager::PrinterCreation) && KMFactory::self()->manager()->hasManagement());
-
- connect(this,TQT_SIGNAL(enable(bool)),this,TQT_SIGNAL(enableChange(bool)));
-}
-
-KMPropWidget::~KMPropWidget()
-{
-}
-
-void KMPropWidget::slotChange()
-{
- KMTimer::self()->hold();
- int value = requestChange();
- if (value == -1)
- {
- KMessageBox::error(this, i18n("<qt>Unable to change printer properties. Error received from manager:<p>%1</p></qt>").arg(KMManager::self()->errorMsg()));
- KMManager::self()->setErrorMsg(TQString::null);
- }
- KMTimer::self()->release((value == 1));
-}
-
-void KMPropWidget::setPrinterBase(KMPrinter *p)
-{
- m_printer = p;
- setPrinter(p);
-}
-
-void KMPropWidget::setPrinter(KMPrinter*)
-{
-}
-
-void KMPropWidget::configureWizard(KMWizard*)
-{
-}
-
-// return status:
-// -1 : error
-// 0 : nothing to be done (canceled)
-// 1 : success
-int KMPropWidget::requestChange()
-{
- if (m_printer)
- {
- KMWizard dlg(this);
- configureWizard(&dlg);
- dlg.setPrinter(m_printer);
- if (dlg.exec())
- return (KMFactory::self()->manager()->modifyPrinter(m_printer,dlg.printer()) ? 1 : -1);
- }
- return 0;
-}
-#include "kmpropwidget.moc"
diff --git a/kdeprint/management/kmpropwidget.h b/kdeprint/management/kmpropwidget.h
deleted file mode 100644
index 83148bc72..000000000
--- a/kdeprint/management/kmpropwidget.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMPROPWIDGET_H
-#define KMPROPWIDGET_H
-
-#include <tqwidget.h>
-
-#include <kdelibs_export.h>
-
-class KMPrinter;
-class KMWizard;
-
-class KDEPRINT_EXPORT KMPropWidget : public TQWidget
-{
- Q_OBJECT
-public:
- KMPropWidget(TQWidget *parent = 0, const char *name = 0);
- virtual ~KMPropWidget();
-
- virtual void setPrinter(KMPrinter*);
- void setPrinterBase(KMPrinter*);
- TQString pixmap() const { return m_pixmap; }
- TQString title() const { return m_title; }
- TQString header() const { return m_header; }
- bool canChange() const { return m_canchange; }
-
-signals:
- void enable(bool);
- void enableChange(bool);
-
-public slots:
- void slotChange();
-
-protected:
- virtual int requestChange();
- virtual void configureWizard(KMWizard*);
-
-protected:
- QString m_pixmap;
- QString m_title;
- QString m_header;
- KMPrinter *m_printer;
- bool m_canchange;
-};
-
-#endif
diff --git a/kdeprint/management/kmspecialprinterdlg.cpp b/kdeprint/management/kmspecialprinterdlg.cpp
deleted file mode 100644
index 6569f3f83..000000000
--- a/kdeprint/management/kmspecialprinterdlg.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmspecialprinterdlg.h"
-#include "kmprinter.h"
-#include "tdeprintcheck.h"
-#include "kmfactory.h"
-#include "kmspecialmanager.h"
-#include "kxmlcommandselector.h"
-#include "kxmlcommand.h"
-#include "driver.h"
-
-#include <tqpushbutton.h>
-#include <tqlineedit.h>
-#include <tqcheckbox.h>
-#include <tqcombobox.h>
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <tqwhatsthis.h>
-#include <tqgroupbox.h>
-#include <klocale.h>
-#include <kmessagebox.h>
-#include <kicondialog.h>
-#include <kfiledialog.h>
-#include <kseparator.h>
-
-KMSpecialPrinterDlg::KMSpecialPrinterDlg(TQWidget *parent, const char *name)
-: KDialogBase(parent, name, true, TQString::null, Ok|Cancel, Ok)
-{
- setCaption(i18n("Add Special Printer"));
-
- TQWidget *dummy = new TQWidget(this);
- setMainWidget(dummy);
-
- // widget creation
- m_name = new TQLineEdit(dummy);
- connect(m_name, TQT_SIGNAL(textChanged ( const TQString & )),this,TQT_SLOT(slotTextChanged(const TQString & )));
- m_description = new TQLineEdit(dummy);
- m_location = new TQLineEdit(dummy);
- TQLabel *m_namelabel = new TQLabel(i18n("&Name:"), dummy);
- TQLabel *m_desclabel = new TQLabel(i18n("&Description:"), dummy);
- TQLabel *m_loclabel = new TQLabel(i18n("&Location:"), dummy);
- m_namelabel->setBuddy(m_name);
- m_desclabel->setBuddy(m_description);
- m_loclabel->setBuddy(m_location);
-
- KSeparator* sep = new KSeparator( KSeparator::HLine, dummy);
-
- sep->setFixedHeight(10);
- TQGroupBox *m_gb = new TQGroupBox(1, Qt::Horizontal, i18n("Command &Settings"), dummy);
- m_command = new KXmlCommandSelector(true, m_gb, "CommandSelector", this);
-
- TQGroupBox *m_outfile_gb = new TQGroupBox( 0, Qt::Horizontal, i18n( "Outp&ut File" ), dummy );
-
- m_usefile = new TQCheckBox( i18n("&Enable output file"), m_outfile_gb);
-
- m_mimetype = new TQComboBox(m_outfile_gb);
- KMimeType::List list = KMimeType::allMimeTypes();
- for (TQValueList<KMimeType::Ptr>::ConstIterator it=list.begin(); it!=list.end(); ++it)
- {
- TQString mimetype = (*it)->name();
- m_mimelist << mimetype;
- }
- m_mimelist.sort();
- m_mimetype->insertStringList(m_mimelist);
-
- TQLabel *m_mimetypelabel = new TQLabel(i18n("&Format:"), m_outfile_gb);
- m_mimetypelabel->setBuddy (m_mimetype);
-
- m_extension = new TQLineEdit(m_outfile_gb);
-
- TQLabel *m_extensionlabel = new TQLabel(i18n("Filename e&xtension:"), m_outfile_gb);
- m_extensionlabel->setBuddy(m_extension);
-
- m_icon = new KIconButton(dummy);
- m_icon->setIcon("fileprint");
- m_icon->setFixedSize(TQSize(48,48));
-
- connect( m_usefile, TQT_SIGNAL( toggled( bool ) ), m_mimetype, TQT_SLOT( setEnabled( bool ) ) );
- connect( m_usefile, TQT_SIGNAL( toggled( bool ) ), m_extension, TQT_SLOT( setEnabled( bool ) ) );
- connect( m_usefile, TQT_SIGNAL( toggled( bool ) ), m_mimetypelabel, TQT_SLOT( setEnabled( bool ) ) );
- connect( m_usefile, TQT_SIGNAL( toggled( bool ) ), m_extensionlabel, TQT_SLOT( setEnabled( bool ) ) );
- m_mimetypelabel->setEnabled( false );
- m_mimetype->setEnabled( false );
- m_extensionlabel->setEnabled( false );
- m_extension->setEnabled( false );
-
- TQWhatsThis::add(m_usefile,
- i18n("<p>The command will use an output file. If checked, make sure the "
- "command contains an output tag.</p>"));
- TQWhatsThis::add(m_command,
- i18n("<p>The command to execute when printing on this special printer. Either enter "
- "the command to execute directly, or associate/create a command object with/for "
- "this special printer. The command object is the preferred method as it provides "
- "support for advanced settings like mime type checking, configurable options and "
- "requirement list (the plain command is only provided for backward compatibility). "
- "When using a plain command, the following tags are recognized:</p>"
- "<ul><li><b>%in</b>: the input file (required).</li>"
- "<li><b>%out</b>: the output file (required if using an output file).</li>"
- "<li><b>%psl</b>: the paper size in lower case.</li>"
- "<li><b>%psu</b>: the paper size with the first letter in upper case.</li></ul>"));
- TQString mimetypeWhatsThis = i18n("<p>The default mimetype for the output file (e.g. application/postscript).</p>");
- TQWhatsThis::add(m_mimetypelabel, mimetypeWhatsThis);
- TQWhatsThis::add(m_mimetype, mimetypeWhatsThis);
- TQString extensionWhatsThis = i18n("<p>The default extension for the output file (e.g. ps, pdf, ps.gz).</p>");
- TQWhatsThis::add(m_extensionlabel, extensionWhatsThis);
- TQWhatsThis::add(m_extension, extensionWhatsThis);
-
- // layout creation
- TQVBoxLayout *l0 = new TQVBoxLayout(dummy, 0, 10);
- TQGridLayout *l1 = new TQGridLayout(0, 3, 3, 0, 5);
- l0->addLayout(TQT_TQLAYOUT(l1));
- l1->setColStretch(2,1);
- l1->addColSpacing(0,60);
- l1->addMultiCellWidget(m_icon, 0, 2, 0, 0, Qt::AlignCenter);
- l1->addWidget(m_namelabel, 0, 1);
- l1->addWidget(m_desclabel, 1, 1);
- l1->addWidget(m_loclabel, 2, 1);
- l1->addWidget(m_name, 0, 2);
- l1->addWidget(m_description, 1, 2);
- l1->addWidget(m_location, 2, 2);
- l0->addWidget(sep);
- l0->addWidget(m_gb);
- l0->addWidget(m_outfile_gb);
- TQGridLayout *l6 = new TQGridLayout(m_outfile_gb->tqlayout(), 3, 2, 10);
- l6->addMultiCellWidget( m_usefile, 0, 0, 0, 1 );
- l6->addWidget(m_mimetypelabel, 1, 0);
- l6->addWidget(m_mimetype, 1, 1);
- l6->addWidget(m_extensionlabel, 2, 0);
- l6->addWidget(m_extension, 2, 1);
-
- enableButton(Ok, !m_name->text().isEmpty());
-
- // resize dialog
- resize(400,100);
-}
-
-void KMSpecialPrinterDlg::slotTextChanged(const TQString & )
-{
- enableButton(Ok, !m_name->text().isEmpty());
-}
-
-void KMSpecialPrinterDlg::slotOk()
-{
- if (!checkSettings())
- return;
- KDialogBase::slotOk();
-}
-
-bool KMSpecialPrinterDlg::checkSettings()
-{
- TQString msg;
- if (m_name->text().isEmpty())
- msg = i18n("You must provide a non-empty name.");
- else
- KXmlCommandManager::self()->checkCommand(m_command->command(),
- KXmlCommandManager::Basic,
- (m_usefile->isChecked() ? KXmlCommandManager::Basic : KXmlCommandManager::None),
- &msg);
-
- if (!msg.isEmpty())
- KMessageBox::error(this, i18n("Invalid settings. %1.").arg(msg));
-
- return (msg.isEmpty());
-}
-
-void KMSpecialPrinterDlg::setPrinter(KMPrinter *printer)
-{
- if (printer && printer->isSpecial())
- {
- m_command->setCommand(printer->option("kde-special-command"));
- m_usefile->setChecked(printer->option("kde-special-file") == "1");
- int index = m_mimelist.findIndex(printer->option("kde-special-mimetype"));
- m_mimetype->setCurrentItem(index == -1 ? 0 : index);
- m_extension->setText(printer->option("kde-special-extension"));
- m_name->setText(printer->name());
- m_description->setText(printer->description());
- m_location->setText(printer->location());
- m_icon->setIcon(printer->pixmap());
-
- setCaption(i18n("Configuring %1").arg(printer->name()));
- }
-}
-
-KMPrinter* KMSpecialPrinterDlg::printer()
-{
- KMPrinter *printer = new KMPrinter();
- printer->setName(m_name->text());
- printer->setPrinterName(m_name->text());
- printer->setPixmap(m_icon->icon());
- printer->setDescription(m_description->text());
- printer->setLocation(m_location->text());
- printer->setOption("kde-special-command",m_command->command());
- printer->setOption("kde-special-file",(m_usefile->isChecked() ? "1" : "0"));
- if (m_usefile->isChecked ())
- {
- if (m_mimetype->currentText() != "all/all")
- printer->setOption("kde-special-mimetype", m_mimetype->currentText());
- printer->setOption("kde-special-extension",m_extension->text());
- }
- printer->setType(KMPrinter::Special);
- printer->setState(KMPrinter::Idle);
- return printer;
-}
-
-#include "kmspecialprinterdlg.moc"
diff --git a/kdeprint/management/kmspecialprinterdlg.h b/kdeprint/management/kmspecialprinterdlg.h
deleted file mode 100644
index bc7497a05..000000000
--- a/kdeprint/management/kmspecialprinterdlg.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMSPECIALPRINTERDLG_H
-#define KMSPECIALPRINTERDLG_H
-
-#include <kdialogbase.h>
-
-class KMPrinter;
-class TQLineEdit;
-class TQCheckBox;
-class TQComboBox;
-class KIconButton;
-class KXmlCommandSelector;
-
-class KMSpecialPrinterDlg : public KDialogBase
-{
- Q_OBJECT
-public:
- KMSpecialPrinterDlg(TQWidget *parent = 0, const char *name = 0);
-
- void setPrinter(KMPrinter*);
- KMPrinter* printer();
-
-protected:
- bool checkSettings();
-
-protected slots:
- void slotOk();
- void slotTextChanged(const TQString &);
-
-private:
- TQLineEdit *m_name, *m_description, *m_location, *m_extension;
- TQComboBox *m_mimetype;
- TQCheckBox *m_usefile;
- TQStringList m_mimelist;
- KIconButton *m_icon;
- KXmlCommandSelector *m_command;
-};
-
-#endif
diff --git a/kdeprint/management/kmtimer.cpp b/kdeprint/management/kmtimer.cpp
deleted file mode 100644
index 1525dd875..000000000
--- a/kdeprint/management/kmtimer.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmtimer.h"
-#include "kmfactory.h"
-
-#include <kconfig.h>
-
-KMTimer* KMTimer::m_self = 0;
-
-KMTimer* KMTimer::self()
-{
- if (!m_self)
- {
- m_self = new KMTimer(KMFactory::self(), "InternalTimer");
- Q_CHECK_PTR(m_self);
- }
- return m_self;
-}
-
-KMTimer::KMTimer(TQObject *parent, const char *name)
-: TQTimer(parent, name), m_count(0)
-{
- connect(this, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()));
-}
-
-KMTimer::~KMTimer()
-{
- m_self = 0;
-}
-
-void KMTimer::hold()
-{
- if ((m_count++) == 0)
- stop();
-}
-
-void KMTimer::release()
-{
- releaseTimer(false);
-}
-
-void KMTimer::release(bool do_emit)
-{
- releaseTimer(do_emit);
-}
-
-void KMTimer::releaseTimer(bool do_emit)
-{
- m_count = QMAX(0, m_count-1);
- if (m_count == 0)
- {
- if (do_emit)
- emit timeout();
- startTimer();
- }
-}
-
-void KMTimer::delay(int t)
-{
- startTimer(t);
-}
-
-void KMTimer::slotTimeout()
-{
- startTimer();
-}
-
-void KMTimer::startTimer(int t)
-{
- if (t == -1)
- {
- KConfig *conf = KMFactory::self()->printConfig();
- conf->setGroup("General");
- t = conf->readNumEntry("TimerDelay", 5) * 1000;
- }
- start(t, true);
-}
-
-#include "kmtimer.moc"
diff --git a/kdeprint/management/kmtimer.h b/kdeprint/management/kmtimer.h
deleted file mode 100644
index eb40e7957..000000000
--- a/kdeprint/management/kmtimer.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMTIMER_H
-#define KMTIMER_H
-
-#if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
-#warning internal header, do not use except if you are a KDEPrint developer
-#endif
-
-#include <tqtimer.h>
-#include <kdelibs_export.h>
-
-/**
- * @internal
- * This class is internal to KDEPrint and is not intended to be
- * used outside it. Please do not make use of this header, except
- * if you're a KDEPrint developer. The API might change in the
- * future and binary compatibility might be broken.
- */
-class KDEPRINT_EXPORT KMTimer : public TQTimer
-{
- Q_OBJECT
-public:
- void delay(int t);
- ~KMTimer();
-
-public slots:
- void hold();
- void release();
- void release(bool do_emit);
-
- static KMTimer* self();
-
-private slots:
- void slotTimeout();
-
-private:
- static KMTimer *m_self;
- int m_count;
- KMTimer(TQObject *parent = 0, const char *name = 0);
- void releaseTimer(bool do_emit = false);
- void startTimer(int delay = -1);
-};
-
-#endif
diff --git a/kdeprint/management/kmwbackend.cpp b/kdeprint/management/kmwbackend.cpp
deleted file mode 100644
index e39b52f8d..000000000
--- a/kdeprint/management/kmwbackend.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwbackend.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-
-#include <tqlayout.h>
-#include <tqregexp.h>
-#include <tqbuttongroup.h>
-#include <tqradiobutton.h>
-#include <tqwhatsthis.h>
-
-#include <kcursor.h>
-#include <klocale.h>
-#include <kseparator.h>
-#include <kdialog.h>
-#include <kdebug.h>
-
-class KRadioButton : public TQRadioButton
-{
-public:
- KRadioButton(const TQString& txt, TQWidget *parent = 0, const char *name = 0);
-};
-
-KRadioButton::KRadioButton(const TQString& txt, TQWidget *parent, const char *name)
-: TQRadioButton(txt,parent,name)
-{
- setCursor(KCursor::handCursor());
-}
-
-//********************************************************************************************************
-
-KMWBackend::KMWBackend(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::Backend;
- m_title = i18n("Backend Selection");
-
- m_buttons = new TQButtonGroup(this);
- m_buttons->hide();
-
- m_layout = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- m_layout->addStretch(1);
- m_count = 0;
-}
-
-bool KMWBackend::isValid(TQString& msg)
-{
- if (!m_buttons->selected())
- {
- msg = i18n("You must select a backend.");
- return false;
- }
- return true;
-}
-
-void KMWBackend::initPrinter(KMPrinter *p)
-{
- TQString s = p->option("kde-backend");
- int ID(-1);
-
- if (!s.isEmpty())
- ID = s.toInt();
- else
- {
- s = p->deviceProtocol();
- // extract protocol
- if (s == "parallel" || s == "serial" || s == "usb") ID = KMWizard::Local;
- else if (s == "smb") ID = KMWizard::SMB;
- else if (s == "ipp" || s == "http") ID = KMWizard::IPP;
- else if (s == "lpd") ID = KMWizard::LPD;
- else if (s == "socket") ID = KMWizard::TCP;
- else if (s == "file") ID = KMWizard::File;
- else if (p->members().count() > 0) ID = KMWizard::Class;
- }
-
- if (m_buttons->find(ID))
- m_buttons->setButton(ID);
-}
-
-void KMWBackend::updatePrinter(KMPrinter *p)
-{
- int ID = m_buttons->id(m_buttons->selected());
- if (ID == KMWizard::Class) p->setType(KMPrinter::Class);
- else p->setType(KMPrinter::Printer);
- p->setOption("kde-backend",TQString::number(ID));
- TQString s = m_buttons->selected()->text();
- s.replace(TQRegExp("&(?=\\w)"), TQString::tqfromLatin1(""));
- p->setOption("kde-backend-description",s);
- setNextPage((m_map.contains(ID) ? m_map[ID] : KMWizard::Error));
-}
-
-void KMWBackend::addBackend( int ID, bool on, int nextpage )
-{
- switch ( ID )
- {
- case KMWizard::Local:
- addBackend( ID, i18n("&Local printer (parallel, serial, USB)"), on,
- i18n( "<qt><p>Locally-connected printer</p>"
- "<p>Use this for a printer connected "
- "to the computer via a parallel, serial or USB port.</p></qt>" ),
- nextpage );
- break;
- case KMWizard::SMB:
- addBackend( ID, i18n("&SMB shared printer (Windows)"), on,
- i18n( "<qt><p>Shared Windows printer</p>"
- "<p>Use this for a printer installed "
- "on a Windows server and shared on the network using the SMB "
- "protocol (samba).</p></qt>" ),
- nextpage );
- break;
- case KMWizard::LPD:
- addBackend( ID, i18n("&Remote LPD queue"), on,
- i18n( "<qt><p>Print queue on a remote LPD server</p>"
- "<p>Use this for a print queue "
- "existing on a remote machine running a LPD print server.</p></qt>" ),
- nextpage );
- break;
- case KMWizard::TCP:
- addBackend( ID, i18n("Ne&twork printer (TCP)"), on,
- i18n( "<qt><p>Network TCP printer</p>"
- "<p>Use this for a network-enabled printer "
- "using TCP (usually on port 9100) as communication protocol. Most "
- "network printers can use this mode.</p></qt>" ),
- nextpage );
- break;
- case -1:
- addBackend( ID, TQString::null, on, TQString::null, nextpage );
- break;
- default:
- kdError( 500 ) << "Non standard wizard page ID: " << ID << endl;
- }
-}
-
-void KMWBackend::addBackend(int ID, const TQString& txt, bool on, const TQString& whatsThis, int nextpage)
-{
- if (ID == -1)
- {
- KSeparator* sep = new KSeparator( KSeparator::HLine, this);
- m_layout->insertWidget(m_count, sep);
- }
- else
- {
- KRadioButton *btn = new KRadioButton(txt, this);
- btn->setEnabled(on);
- if ( !whatsThis.isEmpty() )
- TQWhatsThis::add( btn, whatsThis );
- m_buttons->insert(btn, ID);
- m_map[ID] = (nextpage == -1 ? ID : nextpage); // use nextpage if specified, default to ID
- m_layout->insertWidget(m_count, btn);
- }
- m_count++;
-}
-
-void KMWBackend::enableBackend(int ID, bool on)
-{
- TQButton *btn = static_cast<TQButton*>(m_buttons->find(ID));
- if (btn)
- btn->setEnabled(on);
-}
diff --git a/kdeprint/management/kmwbackend.h b/kdeprint/management/kmwbackend.h
deleted file mode 100644
index 223123b4f..000000000
--- a/kdeprint/management/kmwbackend.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWBACKEND_H
-#define KMWBACKEND_H
-
-#include "kmwizardpage.h"
-#include <kdelibs_export.h>
-#include <tqmap.h>
-
-class TQButtonGroup;
-class TQVBoxLayout;
-
-class KDEPRINT_EXPORT KMWBackend : public KMWizardPage
-{
-public:
- KMWBackend(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void initPrinter(KMPrinter*);
- void updatePrinter(KMPrinter*);
-
- void addBackend(int ID, const TQString& txt, bool on = true, const TQString& whatsThis = TQString::null, int nextpage = -1);
- void addBackend(int ID = -1, bool on = true, int nextpage = -1);
- void enableBackend(int ID, bool on = true);
-
-private:
- TQButtonGroup *m_buttons;
- TQVBoxLayout *m_layout;
- // keep a map between button ID and the real next page to switch to. This enables
- // to have different backends switching to the same page (like backends requiring
- // a password). If the next page is not given when adding the backend, the ID is
- // used by default.
- TQMap<int,int> m_map;
- int m_count;
-};
-
-#endif
diff --git a/kdeprint/management/kmwclass.cpp b/kdeprint/management/kmwclass.cpp
deleted file mode 100644
index a87388a6f..000000000
--- a/kdeprint/management/kmwclass.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwclass.h"
-#include "kmwizard.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-#include "kmprinter.h"
-
-#include <tqlayout.h>
-#include <tqlabel.h>
-#include <tqtoolbutton.h>
-#include <klistbox.h>
-#include <klocale.h>
-#include <kiconloader.h>
-
-KMWClass::KMWClass(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::Class;
- m_title = i18n("Class Composition");
- m_nextpage = KMWizard::Name;
-
- m_list1 = new KListBox(this);
- m_list1->setSelectionMode(TQListBox::Extended);
- m_list2 = new KListBox(this);
- m_list2->setSelectionMode(TQListBox::Extended);
-
- TQToolButton *add = new TQToolButton(this);
- TQToolButton *remove = new TQToolButton(this);
- add->setIconSet(BarIcon("forward"));
- remove->setIconSet(BarIcon("back"));
- connect(add,TQT_SIGNAL(clicked()),TQT_SLOT(slotAdd()));
- connect(remove,TQT_SIGNAL(clicked()),TQT_SLOT(slotRemove()));
-
- TQLabel *l1 = new TQLabel(i18n("Available printers:"), this);
- TQLabel *l2 = new TQLabel(i18n("Class printers:"), this);
-
- TQHBoxLayout *lay1 = new TQHBoxLayout(this, 0, 15);
- TQVBoxLayout *lay2 = new TQVBoxLayout(0, 0, 20);
- TQVBoxLayout *lay3 = new TQVBoxLayout(0, 0, 0), *lay4 = new TQVBoxLayout(0, 0, 0);
- lay1->addLayout(lay3, 1);
- lay1->addLayout(lay2, 0);
- lay1->addLayout(lay4, 1);
- lay3->addWidget(l1, 0);
- lay3->addWidget(m_list1, 1);
- lay2->addStretch(1);
- lay2->addWidget(add, 0);
- lay2->addWidget(remove, 0);
- lay2->addStretch(1);
- lay4->addWidget(l2, 0);
- lay4->addWidget(m_list2, 1);
-}
-
-KMWClass::~KMWClass()
-{
-}
-
-bool KMWClass::isValid(TQString& msg)
-{
- if (m_list2->count() == 0)
- {
- msg = i18n("You must select at least one printer.");
- return false;
- }
- return true;
-}
-
-void KMWClass::initPrinter(KMPrinter *p)
-{
- TQStringList members = p->members();
- KMManager *mgr = KMFactory::self()->manager();
-
- // first load available printers
- TQPtrList<KMPrinter> *list = mgr->printerList(false);
- m_list1->clear();
- if (list)
- {
- TQPtrListIterator<KMPrinter> it(*list);
- for (;it.current();++it)
- if (it.current()->instanceName().isEmpty() && !it.current()->isClass(true) && !it.current()->isSpecial() && !members.contains(it.current()->name()))
- m_list1->insertItem(SmallIcon(it.current()->pixmap()), it.current()->name());
- m_list1->sort();
- }
-
- // set class printers
- m_list2->clear();
- for (TQStringList::ConstIterator it=members.begin(); it!=members.end(); ++it)
- {
- KMPrinter *pr = mgr->findPrinter(*it);
- if (pr) m_list2->insertItem(SmallIcon(pr->pixmap()), *it);
- }
- m_list2->sort();
-}
-
-void KMWClass::updatePrinter(KMPrinter *p)
-{
- TQStringList members;
- for (uint i=0; i<m_list2->count(); i++)
- members.append(m_list2->item(i)->text());
- p->setMembers(members);
-}
-
-void KMWClass::slotAdd()
-{
- for (uint i=0;i<m_list1->count();i++)
- if (m_list1->isSelected(i))
- {
- m_list2->insertItem(*(m_list1->pixmap(i)), m_list1->text(i));
- m_list1->removeItem(i--);
- }
- m_list2->sort();
-}
-
-void KMWClass::slotRemove()
-{
- for (uint i=0;i<m_list2->count();i++)
- if (m_list2->isSelected(i))
- {
- m_list1->insertItem(*(m_list2->pixmap(i)), m_list2->text(i));
- m_list2->removeItem(i--);
- }
- m_list1->sort();
-}
-#include "kmwclass.moc"
diff --git a/kdeprint/management/kmwclass.h b/kdeprint/management/kmwclass.h
deleted file mode 100644
index c9b63befb..000000000
--- a/kdeprint/management/kmwclass.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWCLASS_H
-#define KMWCLASS_H
-
-#include "kmwizardpage.h"
-
-class KListBox;
-
-class KMWClass : public KMWizardPage
-{
- Q_OBJECT
-public:
- KMWClass(TQWidget *parent = 0, const char *name = 0);
- ~KMWClass();
-
- bool isValid(TQString&);
- void initPrinter(KMPrinter*);
- void updatePrinter(KMPrinter*);
-
-protected slots:
- void slotAdd();
- void slotRemove();
-
-private:
- KListBox *m_list1, *m_list2;
-};
-
-#endif
diff --git a/kdeprint/management/kmwdriver.cpp b/kdeprint/management/kmwdriver.cpp
deleted file mode 100644
index 58793c192..000000000
--- a/kdeprint/management/kmwdriver.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwdriver.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-#include "kmdriverdbwidget.h"
-#include "kmdriverdb.h"
-
-#include <tqlayout.h>
-#include <klocale.h>
-
-KMWDriver::KMWDriver(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::Driver;
- m_title = i18n("Printer Model Selection");
- m_nextpage = KMWizard::DriverTest;
-
- m_widget = new KMDriverDbWidget(this);
-
- TQVBoxLayout *lay1 = new TQVBoxLayout(this, 0, 0);
- lay1->addWidget(m_widget);
-}
-
-void KMWDriver::initPrinter(KMPrinter *p)
-{
- m_widget->init();
- if (p)
- {
- TQString autoDetect = p->option( "kde-autodetect" );
- if ( !autoDetect.isEmpty() )
- {
- // use auto-detection info instead: split the string
- // into make/model pair at the first space character
- int p = autoDetect.find( ' ' );
- if ( p != -1 )
- {
- TQString manu = autoDetect.left( p ), model = autoDetect.mid( p+1 );
- KMDBEntryList *l = KMDriverDB::self()->findPnpEntry( manu, model );
- if ( l && l->count() > 0 )
- {
- m_widget->setDriver( l->getFirst()->manufacturer, l->getFirst()->model );
- return;
- }
- }
- }
- m_widget->setDriver(p->manufacturer(),p->model());
- }
-}
-
-void KMWDriver::updatePrinter(KMPrinter *p)
-{
- if (p)
- {
- p->setManufacturer(TQString::null);
- p->setModel(TQString::null);
- p->setDbEntry(0);
- p->setDriverInfo(TQString::null);
- p->setOption("kde-driver",TQString::null);
- setNextPage(KMWizard::DriverTest);
- if (m_widget->isRaw())
- {
- p->setDriverInfo(i18n("Raw printer"));
- p->setOption("kde-driver","raw");
- }
- else
- {
- p->setManufacturer(m_widget->manufacturer());
- p->setModel(m_widget->model());
- if (m_widget->isExternal())
- {
- p->setDriverInfo(m_widget->description());
- p->setOption("kde-driver",m_widget->driverFile());
- }
- else
- {
- KMDBEntryList *drvs = m_widget->drivers();
- if (drvs->count() == 1)
- {
- p->setDbEntry(drvs->getFirst());
- p->setDriverInfo(drvs->getFirst()->description);
- }
- else
- setNextPage(KMWizard::DriverSelect);
- }
- }
- }
-}
-
-bool KMWDriver::isValid(TQString& msg)
-{
- if (m_widget->isRaw() || m_widget->isExternal() || m_widget->drivers())
- return true;
- else
- {
- msg = i18n("Internal error: unable to locate the driver.");
- return false;
- }
-}
diff --git a/kdeprint/management/kmwdriver.h b/kdeprint/management/kmwdriver.h
deleted file mode 100644
index 9eef02069..000000000
--- a/kdeprint/management/kmwdriver.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWDRIVER_H
-#define KMWDRIVER_H
-
-#include "kmwizardpage.h"
-
-class KMDriverDbWidget;
-
-class KMWDriver : public KMWizardPage
-{
-public:
- KMWDriver(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void updatePrinter(KMPrinter*);
- void initPrinter(KMPrinter*);
-
-private:
- KMDriverDbWidget *m_widget;
-};
-
-#endif
diff --git a/kdeprint/management/kmwdriverselect.cpp b/kdeprint/management/kmwdriverselect.cpp
deleted file mode 100644
index e3d253660..000000000
--- a/kdeprint/management/kmwdriverselect.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwdriverselect.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-#include "kmdbentry.h"
-#include "kmdriverdb.h"
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <kpushbutton.h>
-#include <klistbox.h>
-#include <klocale.h>
-#include <kmessagebox.h>
-
-KMWDriverSelect::KMWDriverSelect(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::DriverSelect;
- m_title = i18n("Driver Selection");
- m_nextpage = KMWizard::DriverTest;
- m_entries = NULL;
-
- m_list = new KListBox(this);
- TQLabel *l1 = new TQLabel(this);
- l1->setText(i18n("<p>Several drivers have been detected for this model. Select the driver "
- "you want to use. You will have the opportunity to test it as well as to "
- "change it if necessary.</p>"));
- m_drivercomment = new KPushButton(i18n("Driver Information"), this);
- connect(m_drivercomment, TQT_SIGNAL(clicked()), TQT_SLOT(slotDriverComment()));
-
- TQVBoxLayout *main_ = new TQVBoxLayout(this, 0, 10);
- main_->addWidget(l1,0);
- main_->addWidget(m_list,1);
- TQHBoxLayout *lay0 = new TQHBoxLayout(0, 0, 0);
- main_->addLayout(lay0,0);
- lay0->addStretch(1);
- lay0->addWidget(m_drivercomment);
-}
-
-bool KMWDriverSelect::isValid(TQString& msg)
-{
- if (m_list->currentItem() == -1)
- {
- msg = i18n("You must select a driver.");
- return false;
- }
- return true;
-}
-
-void KMWDriverSelect::initPrinter(KMPrinter *p)
-{
- m_entries = KMDriverDB::self()->findEntry(p->manufacturer(),p->model());
- m_list->clear();
- if (m_entries)
- {
- KMDBEntryListIterator it(*m_entries);
- int recomm(0);
- for (;it.current();++it)
- {
- TQString s(it.current()->description);
- if (it.current()->recommended)
- {
- recomm = m_list->count();
- s.append(i18n(" [recommended]"));
- }
- m_list->insertItem(s);
- }
- if (m_entries->count() > 0)
- m_list->setSelected(recomm, true);
- }
-}
-
-void KMWDriverSelect::updatePrinter(KMPrinter *p)
-{
- int index = m_list->currentItem();
- if (m_entries && index >= 0 && index < (int)(m_entries->count()))
- {
- KMDBEntry *entry = m_entries->tqat(index);
- p->setDbEntry(entry);
- p->setDriverInfo(entry->description);
- }
- else
- {
- p->setDbEntry(0);
- p->setDriverInfo(TQString::null);
- }
-}
-
-void KMWDriverSelect::slotDriverComment()
-{
- int index = m_list->currentItem();
- if (m_entries && index >=0 && index < (int)(m_entries->count()) && !m_entries->tqat(index)->drivercomment.isEmpty())
- KMessageBox::information(this, m_entries->tqat(index)->drivercomment, TQString::null, TQString::null, KMessageBox::AllowLink);
- else
- KMessageBox::error(this, i18n("No information about the selected driver."));
-}
-
-#include "kmwdriverselect.moc"
diff --git a/kdeprint/management/kmwdriverselect.h b/kdeprint/management/kmwdriverselect.h
deleted file mode 100644
index 464a78239..000000000
--- a/kdeprint/management/kmwdriverselect.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWDRIVERSELECT_H
-#define KMWDRIVERSELECT_H
-
-#include "kmwizardpage.h"
-#include "kmdbentry.h"
-
-class KListBox;
-class TQPushButton;
-
-class KMWDriverSelect : public KMWizardPage
-{
- Q_OBJECT
-public:
- KMWDriverSelect(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void initPrinter(KMPrinter*);
- void updatePrinter(KMPrinter*);
-
-protected slots:
- void slotDriverComment();
-
-private:
- KListBox *m_list;
- KMDBEntryList *m_entries;
- TQPushButton *m_drivercomment;
-};
-
-#endif
diff --git a/kdeprint/management/kmwdrivertest.cpp b/kdeprint/management/kmwdrivertest.cpp
deleted file mode 100644
index 545d3b94d..000000000
--- a/kdeprint/management/kmwdrivertest.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwdrivertest.h"
-#include "kmprinter.h"
-#include "kmwizard.h"
-#include "driver.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-#include "kmdriverdialog.h"
-
-#include <tqlabel.h>
-#include <kpushbutton.h>
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kapplication.h>
-#include <kmessagebox.h>
-#include <kguiitem.h>
-#include <kio/netaccess.h>
-
-KMWDriverTest::KMWDriverTest(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::DriverTest;
- m_title = i18n("Printer Test");
- m_nextpage = KMWizard::Name;
- m_needsinitonback = true;
- m_driver = 0;
- m_printer = 0;
-
- m_manufacturer = new TQLabel(this);
- m_model = new TQLabel(this);
- m_driverinfo = new TQLabel(this);
- m_driverinfo->setTextFormat(TQt::RichText);
- TQLabel *l1 = new TQLabel(i18n("<b>Manufacturer:</b>"), this);
- TQLabel *l2 = new TQLabel(i18n("<b>Model:</b>"), this);
- TQLabel *l3 = new TQLabel(i18n("<b>Description:</b>"), this);
-
- m_test = new KPushButton(KGuiItem(i18n("&Test"), "tdeprint_testprinter"), this);
- m_settings = new KPushButton(KGuiItem(i18n("&Settings"), "configure"), this);
-
- TQLabel *l0 = new TQLabel(this);
- l0->setText(i18n("<p>Now you can test the printer before finishing installation. "
- "Use the <b>Settings</b> button to configure the printer driver and "
- "the <b>Test</b> button to test your configuration. Use the <b>Back</b> "
- "button to change the driver (your current configuration will be discarded).</p>"));
-
- TQVBoxLayout *lay1 = new TQVBoxLayout(this, 0, 15);
- TQGridLayout *lay2 = new TQGridLayout(0, 3, 3, 0, 0);
- TQHBoxLayout *lay3 = new TQHBoxLayout(0, 0, 10);
- lay1->addWidget(l0,0);
- lay1->addLayout(TQT_TQLAYOUT(lay2),0);
- lay1->addLayout(lay3,0);
- lay1->addStretch(1);
- lay2->setColStretch(2,1);
- lay2->addColSpacing(1,10);
- lay2->addWidget(l1,0,0);
- lay2->addWidget(l2,1,0);
- lay2->addWidget(l3,2,0,Qt::AlignLeft|Qt::AlignTop);
- lay2->addWidget(m_manufacturer,0,2);
- lay2->addWidget(m_model,1,2);
- lay2->addWidget(m_driverinfo,2,2);
- lay3->addWidget(m_test,0);
- lay3->addWidget(m_settings,0);
- lay3->addStretch(1);
-
- connect(m_test,TQT_SIGNAL(clicked()),TQT_SLOT(slotTest()));
- connect(m_settings,TQT_SIGNAL(clicked()),TQT_SLOT(slotSettings()));
-}
-
-KMWDriverTest::~KMWDriverTest()
-{
- delete m_driver;
-}
-
-void KMWDriverTest::initPrinter(KMPrinter *p)
-{
- m_manufacturer->setText(p->manufacturer());
- m_model->setText(p->model());
- m_driverinfo->setText(p->driverInfo());
- m_printer = p;
-
- delete m_driver;
- m_driver = 0;
-
- TQString drfile = p->option("kde-driver");
- bool checkDriver(true);
- if (!drfile.isEmpty() && drfile != "raw")
- {
- m_driver = KMFactory::self()->manager()->loadFileDriver(drfile);
- /* remove the temp file if it has been downloaded */
- KIO::NetAccess::removeTempFile( drfile );
- }
- else if (p->dbEntry() != NULL)
- m_driver = KMFactory::self()->manager()->loadDbDriver(p->dbEntry());
- else
- checkDriver = false;
-
- if (checkDriver && !m_driver)
- {
- KMessageBox::error(this, i18n("<qt>Unable to load the requested driver:<p>%1</p></qt>").arg(KMManager::self()->errorMsg()));
- KMManager::self()->setErrorMsg(TQString::null);
- }
- m_settings->setEnabled((m_driver != 0));
-}
-
-void KMWDriverTest::updatePrinter(KMPrinter *p)
-{
- // Give the DrMain structure to the driver and don't care about it anymore.
- // It will be destroyed either when giving another structure, or when the
- // printer object will be destroyed.
- p->setDriver(m_driver);
- m_driver = 0;
-}
-
-void KMWDriverTest::slotTest()
-{
- if (!m_printer) return;
-
- TQString name = "tmpprinter_"+KApplication::randomString(8);
- // save printer name (can be non empty when modifying a printer)
- TQString oldname = m_printer->name();
-
- m_printer->setName(name);
- m_printer->setPrinterName(name);
- m_printer->setDriver(m_driver);
- if (KMFactory::self()->manager()->createPrinter(m_printer))
- {
- if (KMFactory::self()->manager()->testPrinter(m_printer))
- KMessageBox::information(this,"<qt>"+i18n("Test page successfully sent to printer. Wait until printing is complete, then click the OK button."));
- else
- KMessageBox::error(this,"<qt>"+i18n("Unable to test printer: ")+KMFactory::self()->manager()->errorMsg()+"</qt>");
- if (!KMFactory::self()->manager()->removePrinter(m_printer))
- KMessageBox::error(this,i18n("Unable to remove temporary printer."));
- }
- else
- KMessageBox::error(this,i18n("Unable to create temporary printer."));
-
- // restoring old name
- m_printer->setName(oldname);
- m_printer->setPrinterName(oldname);
-
- m_driver = m_printer->takeDriver();
-}
-
-void KMWDriverTest::slotSettings()
-{
- if (m_driver)
- {
- KMDriverDialog dlg(this);
- dlg.setDriver(m_driver);
- dlg.showButtonCancel(false); // only OK button
- dlg.exec();
- }
-}
-#include "kmwdrivertest.moc"
diff --git a/kdeprint/management/kmwdrivertest.h b/kdeprint/management/kmwdrivertest.h
deleted file mode 100644
index 5c1aefaee..000000000
--- a/kdeprint/management/kmwdrivertest.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWDRIVERTEST_H
-#define KMWDRIVERTEST_H
-
-#include "kmwizardpage.h"
-
-class TQLabel;
-class TQPushButton;
-class DrMain;
-
-class KMWDriverTest : public KMWizardPage
-{
- Q_OBJECT
-public:
- KMWDriverTest(TQWidget *parent = 0, const char *name = 0);
- ~KMWDriverTest();
-
- void initPrinter(KMPrinter*);
- void updatePrinter(KMPrinter*);
-
-protected slots:
- void slotTest();
- void slotSettings();
-
-private:
- TQLabel *m_manufacturer;
- TQLabel *m_model;
- TQLabel *m_driverinfo;
- TQPushButton *m_test;
- TQPushButton *m_settings;
- DrMain *m_driver;
- KMPrinter *m_printer;
-};
-
-#endif
diff --git a/kdeprint/management/kmwend.cpp b/kdeprint/management/kmwend.cpp
deleted file mode 100644
index 54294fb13..000000000
--- a/kdeprint/management/kmwend.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwend.h"
-#include "kmprinter.h"
-#include "kmwizard.h"
-#include "util.h"
-
-#include <tqtextview.h>
-#include <klocale.h>
-#include <tqlayout.h>
-
-KMWEnd::KMWEnd(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::End;
- m_title = i18n("Confirmation");
- m_nextpage = KMWizard::Error;
-
- m_view = new TQTextView(this);
-
- TQVBoxLayout *lay = new TQVBoxLayout(this, 0, 0);
- lay->addWidget(m_view,1);
-}
-
-void KMWEnd::initPrinter(KMPrinter *p)
-{
- TQString txt;
- TQString s(TQString::tqfromLatin1("<li><u>%1</u>: %2</li>"));
- int ID = p->option("kde-backend").toInt();
-
- // general information
- txt.append(TQString::tqfromLatin1("<b>%1</b><ul type=circle>").arg(i18n("General")));
- txt.append(s.arg(i18n("Type")).arg(p->option("kde-backend-description")));
- txt.append(s.arg(i18n("Name")).arg(p->name()));
- txt.append(s.arg(i18n("Location")).arg(p->location()));
- txt.append(s.arg(i18n("Description")).arg(p->description()));
- txt.append("</ul><br>");
-
- if (ID == KMWizard::Class)
- {
- // class members
- txt.append(TQString::tqfromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Members")));
- TQStringList m(p->members());
- TQString s1(TQString::tqfromLatin1("<li>%1</li>"));
- for (TQStringList::ConstIterator it=m.begin(); it!=m.end(); ++it)
- txt.append(s1.arg(*it));
- txt.append("</ul><br>");
- }
- else
- {
- // backend information
- txt.append(TQString::tqfromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Backend")));
- KURL url ( p->device() );
- switch (ID)
- {
- case KMWizard::Local:
- txt.append(s.arg(i18n("Device")).arg(url.path()));
- break;
- case KMWizard::TCP:
- txt.append(s.arg(i18n("Printer IP")).arg(url.host()));
- txt.append(s.arg(i18n("Port")).arg(url.port()));
- break;
- case KMWizard::LPD:
- txt.append(s.arg(i18n("Host")).arg(url.host()));
- txt.append(s.arg(i18n("Queue")).arg(url.path().right(url.path().length()-1)));
- break;
- case KMWizard::File:
- txt.append(s.arg(i18n("File")).arg(url.path()));
- break;
- case KMWizard::IPP:
- txt.append(s.arg(i18n("Host")).arg(url.host()));
- txt.append(s.arg(i18n("Port")).arg(url.port()));
- txt.append(s.arg(i18n("Printer")).arg(url.path().right(url.path().length()-1)));
- if (url.hasUser()) txt.append(s.arg(i18n("Account")).arg(url.user()));
- break;
- default:
- // double decoding in case the printer name contains chars like '#' that are
- // not decoded by "prettyURL".
- txt.append(s.arg(i18n("URI")).arg(KURL( p->device()).prettyURL()));
- break;
- }
- txt.append("</ul><br>");
-
- if (p->option("kde-driver") == "raw" || p->driver())
- {
- // driver information
- txt.append(TQString::tqfromLatin1("<b>%1</b><ul type=circle>").arg(i18n("Driver")));
- if (p->option("kde-driver") == "raw")
- txt.append(s.arg(i18n("Type")).arg(i18n("Raw printer")));
- else
- {
- txt.append(s.arg(i18n("Type")).arg((p->dbEntry() ? i18n("DB driver") : i18n("External driver"))));
- txt.append(s.arg(i18n("Manufacturer")).arg(p->manufacturer()));
- txt.append(s.arg(i18n("Model")).arg(p->model()));
- txt.append(s.arg(i18n("Description")).arg(p->driverInfo()));
- }
- txt.append("</ul><br>");
- }
- }
-
- m_view->setText(txt);
-}
diff --git a/kdeprint/management/kmwend.h b/kdeprint/management/kmwend.h
deleted file mode 100644
index 626eedf96..000000000
--- a/kdeprint/management/kmwend.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWEND_H
-#define KMWEND_H
-
-#include "kmwizardpage.h"
-
-class TQTextView;
-
-class KMWEnd : public KMWizardPage
-{
-public:
- KMWEnd(TQWidget *parent = 0, const char *name = 0);
-
- void initPrinter(KMPrinter*);
-
-private:
- TQTextView *m_view;
-};
-
-#endif
diff --git a/kdeprint/management/kmwfile.cpp b/kdeprint/management/kmwfile.cpp
deleted file mode 100644
index 32da27c03..000000000
--- a/kdeprint/management/kmwfile.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwfile.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-
-#include <kurlrequester.h>
-#include <klocale.h>
-#include <kfiledialog.h>
-
-KMWFile::KMWFile(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::File;
- m_title = i18n("File Selection");
- m_nextpage = KMWizard::Driver;
-
- m_url = new KURLRequester(this);
- m_url->setMode((KFile::Mode)(KFile::File|KFile::LocalOnly));
- TQLabel *l1 = new TQLabel(this);
- l1->setText(i18n("<p>The printing will be redirected to a file. Enter here the path "
- "of the file you want to use for redirection. Use an absolute path or "
- "the browse button for graphical selection.</p>"));
- TQLabel *l2 = new TQLabel(i18n("Print to file:"), this);
-
- TQVBoxLayout *lay1 = new TQVBoxLayout(this, 0, 30);
- TQVBoxLayout *lay2 = new TQVBoxLayout(0, 0, 5);
- lay1->addWidget(l1);
- lay1->addLayout(lay2);
- lay1->addStretch(1);
- lay2->addWidget(l2);
- lay2->addWidget(m_url);
-}
-
-bool KMWFile::isValid(TQString& msg)
-{
- TQFileInfo fi(m_url->url());
- if (fi.fileName().isEmpty())
- {
- msg = i18n("Empty file name.");
- return false;
- }
-
- if (!fi.dir().exists())
- {
- msg = i18n("Directory does not exist.");
- return false;
- }
-
- return true;
-}
-
-void KMWFile::updatePrinter(KMPrinter *p)
-{
- TQString dev = TQString::tqfromLatin1("file:%1").arg(m_url->url());
- p->setDevice(dev);
-}
diff --git a/kdeprint/management/kmwfile.h b/kdeprint/management/kmwfile.h
deleted file mode 100644
index 40e2e2171..000000000
--- a/kdeprint/management/kmwfile.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWFILE_H
-#define KMWFILE_H
-
-#include "kmwizardpage.h"
-
-class KURLRequester;
-
-class KMWFile : public KMWizardPage
-{
-public:
- KMWFile(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void updatePrinter(KMPrinter*);
-
-private:
- KURLRequester *m_url;
-};
-
-#endif
diff --git a/kdeprint/management/kmwinfobase.cpp b/kdeprint/management/kmwinfobase.cpp
deleted file mode 100644
index 993576334..000000000
--- a/kdeprint/management/kmwinfobase.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwinfobase.h"
-
-#include <tqlabel.h>
-#include <tqlineedit.h>
-#include <tqlayout.h>
-
-KMWInfoBase::KMWInfoBase(int n, TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_labels.setAutoDelete(false);
- m_edits.setAutoDelete(false);
-
- m_nlines = n;
- TQGridLayout *lay1 = new TQGridLayout(this, m_nlines+3, 2, 0, 10);
- lay1->addRowSpacing(1,10);
- lay1->setRowStretch(m_nlines+2,1);
- lay1->setColStretch(1,1);
-
- m_info = new TQLabel(this);
- m_info->setTextFormat(TQt::RichText);
- lay1->addMultiCellWidget(m_info,0,0,0,1);
-
- for (int i=0;i<m_nlines;i++)
- {
- m_labels.append(new TQLabel(this));
- m_edits.append(new TQLineEdit(this));
- lay1->addWidget(m_labels.last(),i+2,0);
- lay1->addWidget(m_edits.last(),i+2,1);
- }
-}
-
-void KMWInfoBase::setInfo(const TQString& s)
-{
- m_info->setText(s);
-}
-
-void KMWInfoBase::setLabel(int i, const TQString& s)
-{
- if (i >= 0 && i < m_nlines)
- m_labels.tqat(i)->setText(s);
-}
-
-void KMWInfoBase::setText(int i, const TQString& s)
-{
- if (i >= 0 && i < m_nlines)
- m_edits.tqat(i)->setText(s);
-}
-
-TQString KMWInfoBase::text(int i)
-{
- if (i >= 0 && i < m_nlines)
- return m_edits.tqat(i)->text();
- return TQString::null;
-}
-
-void KMWInfoBase::setCurrent(int i)
-{
- if (i >= 0 && i < m_nlines)
- {
- m_edits.tqat(i)->selectAll();
- m_edits.tqat(i)->setFocus();
- }
-}
-
-TQLineEdit* KMWInfoBase::lineEdit( int i )
-{
- if ( i >= 0 && i < m_nlines )
- return m_edits.tqat( i );
- else
- return NULL;
-}
diff --git a/kdeprint/management/kmwinfobase.h b/kdeprint/management/kmwinfobase.h
deleted file mode 100644
index 9a2b6464e..000000000
--- a/kdeprint/management/kmwinfobase.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWINFOBASE_H
-#define KMWINFOBASE_H
-
-#include "kmwizardpage.h"
-#include <tqptrlist.h>
-
-class TQLabel;
-class TQLineEdit;
-
-class KDEPRINT_EXPORT KMWInfoBase : public KMWizardPage
-{
-public:
- KMWInfoBase(int n = 1, TQWidget *parent = 0, const char *name = 0);
-
- void setInfo(const TQString&);
- void setLabel(int, const TQString&);
- void setText(int, const TQString&);
- void setCurrent(int);
-
- TQString text(int);
-
-protected:
- TQLineEdit* lineEdit( int );
-
-private:
- TQPtrList<TQLabel> m_labels;
- TQPtrList<TQLineEdit> m_edits;
- TQLabel *m_info;
- int m_nlines;
-};
-
-#endif
diff --git a/kdeprint/management/kmwinfopage.cpp b/kdeprint/management/kmwinfopage.cpp
deleted file mode 100644
index 1e9652e93..000000000
--- a/kdeprint/management/kmwinfopage.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwinfopage.h"
-#include "kmwizard.h"
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kactivelabel.h>
-
-KMWInfoPage::KMWInfoPage(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_ID = KMWizard::Start;
- m_title = i18n("Introduction");
- m_nextpage = KMWizard::Backend;
-
- //TQLabel *m_label = new TQLabel(this);
- KActiveLabel *m_label = new KActiveLabel(this);
- m_label->setText(i18n("<p>Welcome,</p><br>"
- "<p>This wizard will help to install a new printer on your computer. "
- "It will guide you through the various steps of the process of installing "
- "and configuring a printer for your printing system. At each step, you "
- "can always go back using the <b>Back</b> button.</p><br>"
- "<p>We hope you'll enjoy this tool!</p><br>"
- "<p align=right><a href=\"http://printing.kde.org\"><i>"
- "The KDE printing team</i></a>.</p>"));
-
- TQVBoxLayout *main_ = new TQVBoxLayout(this, 0, 0);
- main_->addWidget(m_label);
-}
diff --git a/kdeprint/management/kmwinfopage.h b/kdeprint/management/kmwinfopage.h
deleted file mode 100644
index 346d29401..000000000
--- a/kdeprint/management/kmwinfopage.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWINFOPAGE_H
-#define KMWINFOPAGE_H
-
-#include "kmwizardpage.h"
-
-class KMWInfoPage : public KMWizardPage
-{
-public:
- KMWInfoPage(TQWidget *parent = 0, const char *name = 0);
-};
-
-#endif
diff --git a/kdeprint/management/kmwizard.cpp b/kdeprint/management/kmwizard.cpp
deleted file mode 100644
index 5dc915572..000000000
--- a/kdeprint/management/kmwizard.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwizard.h"
-#include "kmwizardpage.h"
-#include "kmprinter.h"
-#include "kmfactory.h"
-#include "kmuimanager.h"
-
-#include <kpushbutton.h>
-#include <tqlabel.h>
-#include <tqwidgetstack.h>
-#include <kmessagebox.h>
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kdebug.h>
-#include <kseparator.h>
-#include <kapplication.h>
-#include <kstdguiitem.h>
-
-#include "kmwinfopage.h"
-#include "kmwpassword.h"
-#include "kmwbackend.h"
-#include "kmwsocket.h"
-#include "kmwdriver.h"
-#include "kmwdriverselect.h"
-#include "kmwdrivertest.h"
-#include "kmwname.h"
-#include "kmwend.h"
-#include "kmwclass.h"
-#include "kmwlpd.h"
-#include "kmwfile.h"
-#include "kmwsmb.h"
-#include "kmwlocal.h"
-#include "sidepixmap.h"
-
-KMWizard::KMWizard(TQWidget *parent, const char *name)
-: TQDialog(parent,name,true)
-{
- m_start = KMWizard::Start;
- m_end = KMWizard::End;
- m_inclusive = true;
- m_printer = new KMPrinter();
-
- m_pagepool.setAutoDelete(false);
-
- m_stack = new TQWidgetStack(this);
- m_next = new KPushButton(i18n("&Next >"), this);
- m_next->setDefault(true);
- m_prev = new KPushButton(i18n("< &Back"), this);
- TQPushButton *m_cancel = new KPushButton(KStdGuiItem::cancel(), this);
- m_title = new TQLabel(this);
- TQFont f(m_title->font());
- f.setBold(true);
- m_title->setFont(f);
- KSeparator* sep = new KSeparator( KSeparator::HLine, this);
- sep->setFixedHeight(5);
- KSeparator* sep2 = new KSeparator( KSeparator::HLine, this);
- TQPushButton *m_help = new KPushButton(KStdGuiItem::help(), this);
-
- connect(m_cancel,TQT_SIGNAL(clicked()),TQT_SLOT(reject()));
- connect(m_next,TQT_SIGNAL(clicked()),TQT_SLOT(slotNext()));
- connect(m_prev,TQT_SIGNAL(clicked()),TQT_SLOT(slotPrev()));
- connect(m_help, TQT_SIGNAL(clicked()), TQT_SLOT(slotHelp()));
-
- m_side = new SidePixmap(this);
- if (!m_side->isValid())
- {
- delete m_side;
- m_side = 0;
- }
-
- // layout
- TQVBoxLayout *main0_ = new TQVBoxLayout(this, 10, 10);
- TQVBoxLayout *main_ = new TQVBoxLayout(0, 0, 0);
- TQHBoxLayout *main1_ = new TQHBoxLayout(0, 0, 10);
- TQHBoxLayout *btn_ = new TQHBoxLayout(0, 0, 10);
- main0_->addLayout(main1_);
- if (m_side)
- main1_->addWidget(m_side);
- main1_->addLayout(main_);
- main_->addWidget(m_title);
- main_->addWidget(sep);
- main_->addSpacing(10);
- main_->addWidget(m_stack,1);
- main0_->addWidget(sep2);
- main0_->addLayout(btn_);
- btn_->addWidget(m_help);
- btn_->addStretch(1);
- btn_->addWidget(m_prev);
- btn_->addWidget(m_next);
- btn_->addWidget(m_cancel);
-
- // create standard pages
- addPage(new KMWInfoPage(this));
- m_backend = new KMWBackend(this);
- addPage(m_backend);
- addPage(new KMWPassword(this));
- addPage(new KMWSocket(this));
- addPage(new KMWDriver(this));
- addPage(new KMWDriverSelect(this));
- addPage(new KMWDriverTest(this));
- addPage(new KMWName(this));
- addPage(new KMWEnd(this));
- addPage(new KMWClass(this));
- addPage(new KMWLpd(this));
- addPage(new KMWFile(this));
- addPage(new KMWSmb(this));
- addPage(new KMWLocal(this));
-
- // add other pages
- KMFactory::self()->uiManager()->setupWizard(this);
-
- setCurrentPage(m_start,false);
- setCaption(i18n("Add Printer Wizard"));
- resize(400,350);
-}
-
-KMWizard::~KMWizard()
-{
- delete m_printer;
-}
-
-void KMWizard::addPage(KMWizardPage *page)
-{
- m_stack->addWidget(page,page->id());
- m_pagepool.insert(page->id(),page);
-}
-
-void KMWizard::setPrinter(KMPrinter *p)
-{
- if (p)
- {
- m_printer->copy(*p);
- KMWizardPage *page = (KMWizardPage*)m_stack->visibleWidget();
- if (page)
- page->initPrinter(m_printer);
- }
-}
-
-void KMWizard::configure(int start, int end, bool inclusive)
-{
- m_start = start;
- m_end = end;
- m_inclusive = inclusive;
- m_pagestack.clear();
-
- // disable class if not starting from beginning
- m_backend->enableBackend(KMWizard::Class,(m_start == KMWizard::Start));
- setCaption((m_start == KMWizard::Start ? i18n("Add Printer Wizard") : i18n("Modify Printer")));
-
- if (m_side)
- {
- if (start == KMWizard::Start && end == KMWizard::End)
- m_side->show();
- else
- m_side->hide();
- }
-
- setCurrentPage(m_start,false);
-}
-
-void KMWizard::setNextPage(int page, int next)
-{
- KMWizardPage *p = m_pagepool.find(page);
- if (p)
- p->setNextPage(next);
-}
-
-void KMWizard::setCurrentPage(int ID, bool back)
-{
- KMWizardPage *page = m_pagepool.find(ID);
- if (!page)
- {
- KMessageBox::error(this,i18n("Unable to find the requested page."),i18n("Add Printer Wizard"));
- return;
- }
-
- // add current page to stack (only if going backward)
- if (!back) m_pagestack.push(ID);
-
- // raise page + initialize
- m_stack->raiseWidget(page);
- m_title->setText(page->title());
- if (!back || page->needsInitOnBack()) page->initPrinter(m_printer);
-
- // update buttons
- if (ID == m_start) m_prev->setEnabled(false);
- else m_prev->setEnabled(true);
- if ((m_inclusive && ID == m_end) || (!m_inclusive && page->nextPage() == m_end))
- m_next->setText(i18n("&Finish"));
- else
- m_next->setText(i18n("&Next >"));
-}
-
-void KMWizard::slotPrev()
-{
- // current page is on top of stack -> pop it and retrieve new top of stack
- m_pagestack.pop();
- int ID = m_pagestack.top();
- setCurrentPage(ID,true);
-}
-
-void KMWizard::slotNext()
-{
- KMWizardPage *page = (KMWizardPage*)m_stack->visibleWidget();
- if (page)
- {
- TQString msg;
- if (!page->isValid(msg))
- {
- if (!msg.isEmpty())
- KMessageBox::error(this,msg.prepend("<qt>").append("</qt>"),page->title());
- }
- else
- {
- page->updatePrinter(m_printer);
- if (m_next->text() == i18n("&Finish"))
- accept();
- else
- {
- int ID = page->nextPage();
- setCurrentPage(ID,false);
- }
- }
- }
-}
-
-void KMWizard::slotHelp()
-{
- kapp->invokeHelp(TQString::null, "tdeprint");
-}
-
-void KMWizard::enableWizard()
-{
- m_next->setEnabled( true );
- m_prev->setEnabled( m_pagestack.top() != m_start );
-}
-
-void KMWizard::disableWizard()
-{
- m_next->setEnabled( false );
- m_prev->setEnabled( false );
-}
-
-#include "kmwizard.moc"
diff --git a/kdeprint/management/kmwizard.h b/kdeprint/management/kmwizard.h
deleted file mode 100644
index 5a2dcb6ea..000000000
--- a/kdeprint/management/kmwizard.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWIZARD_H
-#define KMWIZARD_H
-
-#include <tqdialog.h>
-#include <tqintdict.h>
-#include <tqvaluestack.h>
-
-#include <kdelibs_export.h>
-
-class TQWidgetStack;
-class TQLabel;
-class TQPushButton;
-class KMWizardPage;
-class KMPrinter;
-class KMWBackend;
-class SidePixmap;
-
-class KDEPRINT_EXPORT KMWizard : public TQDialog
-{
- Q_OBJECT
-public:
- enum PageType {
- Start = 0,
- End,
- Error,
- Backend,
- Driver,
- File,
- SMB,
- TCP,
- Local,
- LPD,
- IPP,
- IPPSelect,
- Class,
- Password,
- DriverTest,
- DriverSelect,
- Name,
- Banners,
- Custom = 100
- };
-
- KMWizard(TQWidget *parent = 0, const char *name = 0);
- ~KMWizard();
-
- void configure(int start, int end, bool inclusive = true);
- void setCurrentPage(int ID, bool back = false);
- void setPrinter(KMPrinter*);
- KMPrinter* printer() { return m_printer; }
- void addPage(KMWizardPage*);
- KMWBackend* backendPage() { return m_backend; }
- void setNextPage(int page, int next);
-
-public slots:
- void enableWizard();
- void disableWizard();
-
-protected slots:
- void slotNext();
- void slotPrev();
- void slotHelp();
-
-private:
- TQIntDict<KMWizardPage> m_pagepool;
- TQValueStack<int> m_pagestack;
-
- TQWidgetStack *m_stack;
- TQLabel *m_title;
- TQPushButton *m_next, *m_prev;
- int m_start, m_end;
- bool m_inclusive;
- KMPrinter *m_printer;
-
- // backend page
- KMWBackend *m_backend;
-
- // side pixmap
- SidePixmap *m_side;
-};
-
-#endif
diff --git a/kdeprint/management/kmwizardpage.cpp b/kdeprint/management/kmwizardpage.cpp
deleted file mode 100644
index 10149d0f9..000000000
--- a/kdeprint/management/kmwizardpage.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwizardpage.h"
-#include "kmwizard.h"
-
-KMWizardPage::KMWizardPage(TQWidget *parent, const char *name)
-: TQWidget(parent,name)
-{
- m_ID = KMWizard::Error;
- m_title = "KMWizardPage";
- m_nextpage = KMWizard::Error;
- m_needsinitonback = false;
-}
-
-KMWizardPage::~KMWizardPage()
-{
-}
-
-bool KMWizardPage::isValid(TQString&)
-{
- return true;
-}
-
-void KMWizardPage::initPrinter(KMPrinter*)
-{
-}
-
-void KMWizardPage::updatePrinter(KMPrinter*)
-{
-}
-#include "kmwizardpage.moc"
diff --git a/kdeprint/management/kmwizardpage.h b/kdeprint/management/kmwizardpage.h
deleted file mode 100644
index 61fe938b7..000000000
--- a/kdeprint/management/kmwizardpage.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWIZARDPAGE_H
-#define KMWIZARDPAGE_H
-
-#include <tqwidget.h>
-
-#include <kdelibs_export.h>
-
-class KMPrinter;
-
-class KDEPRINT_EXPORT KMWizardPage : public TQWidget
-{
- Q_OBJECT
-public:
- KMWizardPage(TQWidget *parent = 0, const char *name = 0);
- virtual ~KMWizardPage();
-
- int id() const { return m_ID; }
- const TQString& title() const { return m_title; }
- int nextPage() const { return m_nextpage; }
- void setNextPage(int p) { m_nextpage = p; }
- virtual bool isValid(TQString&);
- virtual void initPrinter(KMPrinter*);
- virtual void updatePrinter(KMPrinter*);
- bool needsInitOnBack() { return m_needsinitonback; }
-
-protected:
- QString m_title;
- int m_ID;
- int m_nextpage;
- bool m_needsinitonback;
-};
-
-#endif
diff --git a/kdeprint/management/kmwlocal.cpp b/kdeprint/management/kmwlocal.cpp
deleted file mode 100644
index 7b56b2deb..000000000
--- a/kdeprint/management/kmwlocal.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwlocal.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-#include "kmfactory.h"
-#include "kmmanager.h"
-
-#include <klocale.h>
-#include <tqlayout.h>
-#include <tqlineedit.h>
-#include <tqlabel.h>
-#include <tqheader.h>
-#include <klistview.h>
-#include <kmessagebox.h>
-#include <kiconloader.h>
-
-KMWLocal::KMWLocal(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_title = i18n("Local Port Selection");
- m_ID = KMWizard::Local;
- m_nextpage = KMWizard::Driver;
- m_initialized = false;
- m_block = false;
-
- m_ports = new KListView(this);
- m_ports->setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
- m_ports->setLineWidth(1);
- m_ports->header()->hide();
- m_ports->addColumn("");
- m_ports->setSorting(-1);
- TQListViewItem *root = new TQListViewItem(m_ports, i18n("Local System"));
- root->setPixmap(0, SmallIcon("tdeprint_computer"));
- root->setOpen(true);
- connect(m_ports, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotPortSelected(TQListViewItem*)));
- TQLabel *l1 = new TQLabel(i18n("URI:"), this);
- m_localuri = new TQLineEdit(this);
- connect( m_localuri, TQT_SIGNAL( textChanged( const TQString& ) ), TQT_SLOT( slotTextChanged( const TQString& ) ) );
- m_parents[0] = new TQListViewItem(root, i18n("Parallel"));
- m_parents[1] = new TQListViewItem(root, m_parents[0], i18n("Serial"));
- m_parents[2] = new TQListViewItem(root, m_parents[1], i18n("USB"));
- m_parents[3] = new TQListViewItem(root, m_parents[2], i18n("Others"));
- for (int i=0;i<4;i++)
- m_parents[i]->setPixmap(0, SmallIcon("input_devices_settings"));
- TQLabel *l2 = new TQLabel(i18n("<p>Select a valid detected port, or enter directly the corresponding URI in the bottom edit field.</p>"), this);
-
- TQVBoxLayout *lay0 = new TQVBoxLayout(this, 0, 10);
- TQHBoxLayout *lay1 = new TQHBoxLayout(0, 0, 10);
- lay0->addWidget(l2, 0);
- lay0->addWidget(m_ports, 1);
- lay0->addLayout(lay1, 0);
- lay1->addWidget(l1, 0);
- lay1->addWidget(m_localuri, 1);
-}
-
-bool KMWLocal::isValid(TQString& msg)
-{
- if (m_localuri->text().isEmpty())
- {
- msg = i18n("The URI is empty","Empty URI.");
- return false;
- }
- else if (m_uris.findIndex(m_localuri->text()) == -1)
- {
- if (KMessageBox::warningContinueCancel(this, i18n("The local URI doesn't correspond to a detected port. Continue?")) == KMessageBox::Cancel)
- {
- msg = i18n("Select a valid port.");
- return false;
- }
- }
- return true;
-}
-
-void KMWLocal::slotPortSelected(TQListViewItem *item)
-{
- if ( m_block )
- return;
-
- TQString uri;
- if (!item || item->depth() <= 1 || item->depth() > 3)
- uri = TQString::null;
- else if (item->depth() == 3)
- uri = item->parent()->text( 1 );
- else
- uri = item->text( 1 );
- m_block = true;
- m_localuri->setText( uri );
- m_block = false;
-}
-
-void KMWLocal::updatePrinter(KMPrinter *printer)
-{
- TQListViewItem *item = m_ports->selectedItem();
- if ( item && item->depth() == 3 )
- printer->setOption( "kde-autodetect", item->text( 0 ) );
- printer->setDevice(m_localuri->text());
-}
-
-void KMWLocal::initPrinter(KMPrinter *printer)
-{
- if (!m_initialized)
- initialize();
-
- if (printer)
- {
- m_localuri->setText(printer->device());
- }
-}
-
-TQListViewItem* KMWLocal::lookForItem( const TQString& uri )
-{
- for ( int i=0; i<4; i++ )
- {
- TQListViewItem *item = m_parents[ i ]->firstChild();
- while ( item )
- if ( item->text( 1 ) == uri )
- if ( item->firstChild() )
- return item->firstChild();
- else
- return item;
- else
- item = item->nextSibling();
- }
- return 0;
-}
-
-void KMWLocal::slotTextChanged( const TQString& txt )
-{
- if ( m_block )
- return;
-
- TQListViewItem *item = lookForItem( txt );
- if ( item )
- {
- m_block = true;
- m_ports->setSelected( item, true );
- m_block = false;
- }
- else
- m_ports->clearSelection();
-}
-
-void KMWLocal::initialize()
-{
- TQStringList list = KMFactory::self()->manager()->detectLocalPrinters();
- if (list.isEmpty() || (list.count() % 4) != 0)
- {
- KMessageBox::error(this, i18n("Unable to detect local ports."));
- return;
- }
- TQListViewItem *last[4] = {0, 0, 0, 0};
- for (TQStringList::Iterator it=list.begin(); it!=list.end(); ++it)
- {
- TQString cl = *it;
- ++it;
-
- TQString uri = *it;
- int p = uri.find( ':' );
- TQString desc = *(++it), prot = ( p != -1 ? uri.left( p ) : TQString::null );
- TQString printer = *(++it);
- int index(-1);
- if (desc.isEmpty())
- desc = uri;
- if (prot == "parallel" || prot == "file")
- index = 0;
- else if (prot == "serial")
- index = 1;
- else if (prot == "usb")
- index = 2;
- else if (cl == "direct")
- index = 3;
- else
- continue;
- last[index] = new TQListViewItem(m_parents[index], last[index], desc, uri);
- last[index]->setPixmap(0, SmallIcon("blockdevice"));
- m_parents[index]->setOpen(true);
- m_uris << uri;
- if (!printer.isEmpty())
- {
- TQListViewItem *pItem = new TQListViewItem(last[index], printer);
- last[index]->setOpen(true);
- pItem->setPixmap(0, SmallIcon("tdeprint_printer"));
- }
- }
- m_initialized = true;
-}
-
-#include "kmwlocal.moc"
diff --git a/kdeprint/management/kmwlocal.h b/kdeprint/management/kmwlocal.h
deleted file mode 100644
index 681d94e51..000000000
--- a/kdeprint/management/kmwlocal.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWLOCAL_H
-#define KMWLOCAL_H
-
-#include "kmwizardpage.h"
-
-#include <tqstringlist.h>
-
-class TQLineEdit;
-class KListView;
-class TQListViewItem;
-
-class KMWLocal : public KMWizardPage
-{
- Q_OBJECT
-public:
- KMWLocal(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void updatePrinter(KMPrinter*);
- void initPrinter(KMPrinter*);
-
-protected slots:
- void slotPortSelected(TQListViewItem*);
- void slotTextChanged( const TQString& );
-
-protected:
- void initialize();
- TQListViewItem* lookForItem( const TQString& );
-
-protected:
- KListView *m_ports;
- TQLineEdit *m_localuri;
- TQStringList m_uris;
- TQListViewItem *m_parents[4];
- bool m_initialized;
- bool m_block;
-};
-
-#endif
diff --git a/kdeprint/management/kmwlpd.cpp b/kdeprint/management/kmwlpd.cpp
deleted file mode 100644
index cce4c7b5a..000000000
--- a/kdeprint/management/kmwlpd.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include <config.h>
-#include "kmwlpd.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-
-#include <kurl.h>
-#include <klocale.h>
-#include <tqlabel.h>
-#include <kdebug.h>
-#include <tqlineedit.h>
-#include <kmessagebox.h>
-#include <kextsock.h>
-
-static bool checkLpdQueue(const char *host, const char *queue);
-
-//********************************************************************************************************
-
-KMWLpd::KMWLpd(TQWidget *parent, const char *name)
-: KMWInfoBase(2,parent,name)
-{
- m_ID = KMWizard::LPD;
- m_title = i18n("LPD Queue Information");
- m_nextpage = KMWizard::Driver;
-
- setInfo(i18n("<p>Enter the information concerning the remote LPD queue; "
- "this wizard will check it before continuing.</p>"));
- setLabel(0,i18n("Host:"));
- setLabel(1,i18n("Queue:"));
-}
-
-bool KMWLpd::isValid(TQString& msg)
-{
- if (text(0).isEmpty() || text(1).isEmpty())
- {
- msg = i18n("Some information is missing.");
- return false;
- }
-
- // check LPD queue
- if (!checkLpdQueue(text(0).latin1(),text(1).latin1()))
- {
- if (KMessageBox::warningContinueCancel(this, i18n("Cannot find queue %1 on server %2; do you want to continue anyway?").arg(text(1)).arg(text(0))) == KMessageBox::Cancel)
- return false;
- }
- return true;
-}
-
-void KMWLpd::updatePrinter(KMPrinter *p)
-{
- QString dev = TQString::tqfromLatin1("lpd://%1/%2").arg(text(0)).arg(text(1));
- p->setDevice(dev);
-}
-
-//*******************************************************************************************************
-
-bool checkLpdQueue(const char *host, const char *queue)
-{
- KExtendedSocket sock(host, "printer", KExtendedSocket::streamSocket);
- sock.setBlockingMode(true);
- if (sock.connect() != 0)
- return false;
-
- char res[64] = {0};
- snprintf(res,64,"%c%s\n",(char)4,queue);
- if (sock.tqwriteBlock(res, strlen(res)) != (TQ_LONG)(strlen(res)))
- return false;
-
- char buf[1024] = {0};
- int n, tot(1);
- while ((n = sock.tqreadBlock(res, 63)) > 0)
- {
- res[n] = 0;
- tot += n;
- if (tot >= 1024)
- break;
- else
- strcat(buf, res);
- }
- sock.close();
- if (strlen(buf) == 0 || strstr(buf, "unknown printer") != NULL)
- return false;
- return true;
-}
diff --git a/kdeprint/management/kmwlpd.h b/kdeprint/management/kmwlpd.h
deleted file mode 100644
index 674cdff44..000000000
--- a/kdeprint/management/kmwlpd.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWLPD_H
-#define KMWLPD_H
-
-#include "kmwinfobase.h"
-
-class KMWLpd : public KMWInfoBase
-{
-public:
- KMWLpd(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void updatePrinter(KMPrinter*);
-};
-
-#endif
diff --git a/kdeprint/management/kmwname.cpp b/kdeprint/management/kmwname.cpp
deleted file mode 100644
index fe567f7bb..000000000
--- a/kdeprint/management/kmwname.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwname.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-
-#include <tqlabel.h>
-#include <tqlineedit.h>
-#include <klocale.h>
-#include <kmessagebox.h>
-#include <tqregexp.h>
-
-KMWName::KMWName(TQWidget *parent, const char *name)
-: KMWInfoBase(3,parent,name)
-{
- m_ID = KMWizard::Name;
- m_title = i18n("General Information");
- m_nextpage = KMWizard::End;
-
- setInfo(i18n("<p>Enter the information concerning your printer or class. <b>Name</b> is mandatory, "
- "<b>Location</b> and <b>Description</b> are not (they may even not be used on some systems).</p>"));
- setLabel(0,i18n("Name:"));
- setLabel(1,i18n("Location:"));
- setLabel(2,i18n("Description:"));
-}
-
-bool KMWName::isValid(TQString& msg)
-{
- if (text(0).isEmpty())
- {
- msg = i18n("You must supply at least a name.");
- return false;
- }
- else if (text(0).find(TQRegExp("\\s")) != -1)
- {
- QString conv = text(0);
- conv.replace(TQRegExp("\\s"), "");
- int result = KMessageBox::warningYesNoCancel(this,
- i18n("It is usually not a good idea to include spaces "
- "in printer name: it may prevent your printer from "
- "working correctly. The wizard can strip all spaces "
- "from the string you entered, resulting in %1; "
- "what do you want to do?").arg(conv),
- TQString::null,
- i18n("Strip"), i18n("Keep"));
- switch (result)
- {
- case KMessageBox::Yes:
- setText(0, conv);
- case KMessageBox::No:
- return true;
- default:
- return false;
- }
- }
- return true;
-}
-
-void KMWName::initPrinter(KMPrinter *p)
-{
- setText(0,p->printerName());
- setText(1,p->location());
- setText(2,p->description());
- if (text(2).isEmpty())
- if (p->option("kde-driver") == "raw")
- setText(2,i18n("Raw printer"));
- else
- setText(2,p->manufacturer() + " " + p->model());
-
- setCurrent(0);
-}
-
-void KMWName::updatePrinter(KMPrinter *p)
-{
- p->setPrinterName(text(0));
- p->setName(text(0));
- p->setLocation(text(1));
- p->setDescription(text(2));
-}
diff --git a/kdeprint/management/kmwname.h b/kdeprint/management/kmwname.h
deleted file mode 100644
index f933d59ed..000000000
--- a/kdeprint/management/kmwname.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWNAME_H
-#define KMWNAME_H
-
-#include "kmwinfobase.h"
-
-class KMWName : public KMWInfoBase
-{
-public:
- KMWName(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void initPrinter(KMPrinter*);
- void updatePrinter(KMPrinter*);
-};
-
-#endif
diff --git a/kdeprint/management/kmwpassword.cpp b/kdeprint/management/kmwpassword.cpp
deleted file mode 100644
index 40dc105d5..000000000
--- a/kdeprint/management/kmwpassword.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwpassword.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-
-#include <tqlabel.h>
-#include <tqlineedit.h>
-#include <tqvbuttongroup.h>
-#include <tqradiobutton.h>
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kcursor.h>
-
-#include <stdlib.h>
-
-KMWPassword::KMWPassword(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_title = i18n("User Identification");
- m_ID = KMWizard::Password;
- m_nextpage = KMWizard::SMB;
-
- // create widgets
- TQLabel *infotext_ = new TQLabel(this);
- infotext_->setText(i18n("<p>This backend may require a login/password to work properly. "
- "Select the type of access to use and fill in the login and password entries if needed.</p>"));
- m_login = new TQLineEdit(this);
- m_login->setText(TQString::fromLocal8Bit(getenv("USER")));
- m_password = new TQLineEdit(this);
- m_password->setEchoMode(TQLineEdit::Password);
- TQLabel *loginlabel_ = new TQLabel(i18n("&Login:"),this);
- TQLabel *passwdlabel_ = new TQLabel(i18n("&Password:"),this);
- m_btngroup = new TQVButtonGroup( this );
- m_btngroup->setFrameStyle( TQFrame::NoFrame );
- TQRadioButton *btn1 = new TQRadioButton( i18n( "&Anonymous (no login/password)" ), m_btngroup );
- TQRadioButton *btn2 = new TQRadioButton( i18n( "&Guest account (login=\"guest\")" ), m_btngroup );
- TQRadioButton *btn3 = new TQRadioButton( i18n( "Nor&mal account" ), m_btngroup );
- btn1->setCursor( KCursor::handCursor() );
- btn2->setCursor( KCursor::handCursor() );
- btn3->setCursor( KCursor::handCursor() );
- m_btngroup->setButton( 0 );
-
- loginlabel_->setBuddy(m_login);
- passwdlabel_->setBuddy(m_password);
-
- m_login->setEnabled(false);
- m_password->setEnabled(false);
- connect(btn3,TQT_SIGNAL(toggled(bool)),m_login,TQT_SLOT(setEnabled(bool)));
- connect(btn3,TQT_SIGNAL(toggled(bool)),m_password,TQT_SLOT(setEnabled(bool)));
-
- // layout
- TQVBoxLayout *main_ = new TQVBoxLayout( this, 0, 0 );
- main_->addWidget( infotext_ );
- main_->addSpacing( 10 );
- main_->addWidget( m_btngroup );
- TQGridLayout *l1 = new TQGridLayout( 0, 2, 3 );
- main_->addLayout( TQT_TQLAYOUT(l1) );
- main_->addStretch( 1 );
- l1->setColSpacing( 0, 35 );
- l1->setColStretch( 2, 1 );
- l1->addWidget( loginlabel_, 0, 1 );
- l1->addWidget( passwdlabel_, 1, 1 );
- l1->addWidget( m_login, 0, 2 );
- l1->addWidget( m_password, 1, 2 );
-}
-
-bool KMWPassword::isValid(TQString& msg)
-{
- if ( !m_btngroup->selected() )
- msg = i18n( "Select one option" );
- else if (m_btngroup->selectedId() == 2 && m_login->text().isEmpty())
- msg = i18n("User name is empty.");
- else
- return true;
- return false;
-}
-
-void KMWPassword::initPrinter( KMPrinter* p )
-{
- /* guest account only for SMB backend */
- if ( p->option( "kde-backend" ).toInt() != KMWizard::SMB )
- {
- int ID = m_btngroup->selectedId();
- m_btngroup->find( 1 )->hide();
- if ( ID == 1 )
- m_btngroup->setButton( 0 );
- }
- else
- m_btngroup->find( 1 )->show();
-}
-
-void KMWPassword::updatePrinter(KMPrinter *p)
-{
- TQString s = p->option("kde-backend");
- if (!s.isEmpty())
- setNextPage(s.toInt());
- else
- setNextPage(KMWizard::Error);
- switch ( m_btngroup->selectedId() )
- {
- case 0:
- p->setOption( "kde-login", TQString::null );
- p->setOption( "kde-password", TQString::null );
- break;
- case 1:
- p->setOption( "kde-login", TQString::tqfromLatin1( "guest" ) );
- p->setOption( "kde-password", TQString::null );
- break;
- case 2:
- p->setOption( "kde-login", m_login->text() );
- p->setOption( "kde-password", m_password->text() );
- break;
- }
-}
-
diff --git a/kdeprint/management/kmwpassword.h b/kdeprint/management/kmwpassword.h
deleted file mode 100644
index a7dfb062a..000000000
--- a/kdeprint/management/kmwpassword.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWPASSWORD_H
-#define KMWPASSWORD_H
-
-#include "kmwizardpage.h"
-
-class TQLineEdit;
-class TQButtonGroup;
-
-class KMWPassword : public KMWizardPage
-{
-public:
- KMWPassword(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void initPrinter( KMPrinter* );
- void updatePrinter(KMPrinter*);
-
-private:
- TQLineEdit *m_login;
- TQLineEdit *m_password;
- TQButtonGroup *m_btngroup;
-};
-
-#endif
diff --git a/kdeprint/management/kmwsmb.cpp b/kdeprint/management/kmwsmb.cpp
deleted file mode 100644
index e76240cf8..000000000
--- a/kdeprint/management/kmwsmb.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwsmb.h"
-#include "kmwizard.h"
-#include "smbview.h"
-#include "kmprinter.h"
-#include "util.h"
-
-#include <klocale.h>
-#include <kpushbutton.h>
-#include <tqlayout.h>
-#include <tqlineedit.h>
-#include <tqlabel.h>
-
-KMWSmb::KMWSmb(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_title = i18n("SMB Printer Settings");
- m_ID = KMWizard::SMB;
- m_nextpage = KMWizard::Driver;
-
- m_view = new SmbView(this,"SmbView");
- m_loginlabel = new TQLabel( this );
- TQPushButton *m_scan = new KPushButton(KGuiItem(i18n("Scan"), "viewmag"), this);
- TQPushButton *m_abort = new KPushButton(KGuiItem(i18n("Abort"), "stop"), this);
- m_abort->setEnabled(false);
- TQLabel *m_worklabel = new TQLabel(i18n("Workgroup:"), this);
- TQLabel *m_serverlabel = new TQLabel(i18n("Server:"), this);
- TQLabel *m_printerlabel = new TQLabel(i18n("Printer:"), this);
- m_work = new TQLineEdit(this);
- m_server = new TQLineEdit(this);
- m_printer = new TQLineEdit(this);
-
- TQVBoxLayout *lay0 = new TQVBoxLayout(this, 0, 10);
- TQGridLayout *lay1 = new TQGridLayout(0, 3, 2, 0, 10);
- TQHBoxLayout *lay3 = new TQHBoxLayout(0, 0, 10);
- lay0->addLayout(TQT_TQLAYOUT(lay1),0);
- lay0->addWidget(m_view,1);
- lay0->addLayout(lay3,0);
- lay0->addSpacing(10);
- lay1->setColStretch(1,1);
- lay1->addWidget(m_worklabel,0,0);
- lay1->addWidget(m_serverlabel,1,0);
- lay1->addWidget(m_printerlabel,2,0);
- lay1->addWidget(m_work,0,1);
- lay1->addWidget(m_server,1,1);
- lay1->addWidget(m_printer,2,1);
- lay3->addWidget( m_loginlabel );
- lay3->addStretch(1);
- lay3->addWidget(m_scan);
- lay3->addWidget(m_abort);
-
- connect(m_scan,TQT_SIGNAL(clicked()),TQT_SLOT(slotScan()));
- connect(m_abort,TQT_SIGNAL(clicked()),TQT_SLOT(slotAbort()));
- connect(m_view,TQT_SIGNAL(printerSelected(const TQString&,const TQString&,const TQString&)),TQT_SLOT(slotPrinterSelected(const TQString&,const TQString&,const TQString&)));
- connect(m_view,TQT_SIGNAL(running(bool)),m_abort,TQT_SLOT(setEnabled(bool)));
-}
-
-bool KMWSmb::isValid(TQString& msg)
-{
- if (m_server->text().isEmpty())
- msg = i18n("Empty server name.");
- else if (m_printer->text().isEmpty())
- msg = i18n("Empty printer name.");
- else
- return true;
- return false;
-}
-
-void KMWSmb::updatePrinter(KMPrinter *printer)
-{
- TQString uri = buildSmbURI( m_work->text(), m_server->text(), m_printer->text(), printer->option( "kde-login" ), printer->option( "kde-password" ) );
- printer->setDevice( uri );
-}
-
-void KMWSmb::initPrinter(KMPrinter *printer)
-{
- if (printer)
- {
- TQString login = printer->option( "kde-login" );
- m_view->setLoginInfos(login,printer->option("kde-password"));
- m_loginlabel->setText( i18n( "Login: %1" ).arg( login.isEmpty() ? i18n( "<anonymous>" ) : login ) );
- }
-}
-
-void KMWSmb::slotScan()
-{
- m_view->init();
-}
-
-void KMWSmb::slotAbort()
-{
- m_view->abort();
-}
-
-void KMWSmb::slotPrinterSelected(const TQString& work, const TQString& server, const TQString& printer)
-{
- m_work->setText(work);
- m_server->setText(server);
- m_printer->setText(printer);
-}
-#include "kmwsmb.moc"
diff --git a/kdeprint/management/kmwsmb.h b/kdeprint/management/kmwsmb.h
deleted file mode 100644
index 695379a79..000000000
--- a/kdeprint/management/kmwsmb.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWSMB_H
-#define KMWSMB_H
-
-#include "kmwizardpage.h"
-
-class SmbView;
-class TQLineEdit;
-class TQLabel;
-
-class KMWSmb : public KMWizardPage
-{
- Q_OBJECT
-public:
- KMWSmb(TQWidget *parent = 0, const char *name = 0);
-
- bool isValid(TQString&);
- void updatePrinter(KMPrinter*);
- void initPrinter(KMPrinter*);
-
-protected slots:
- void slotScan();
- void slotAbort();
- void slotPrinterSelected(const TQString& work, const TQString& server, const TQString& printer);
-
-protected:
- SmbView *m_view;
- TQLineEdit *m_work, *m_server, *m_printer;
- TQLabel *m_loginlabel;
-};
-
-#endif
diff --git a/kdeprint/management/kmwsocket.cpp b/kdeprint/management/kmwsocket.cpp
deleted file mode 100644
index 98aad76a5..000000000
--- a/kdeprint/management/kmwsocket.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kmwsocket.h"
-#include "networkscanner.h"
-#include "kmwizard.h"
-#include "kmprinter.h"
-
-#include <klistview.h>
-#include <tqheader.h>
-#include <tqlineedit.h>
-#include <tqlabel.h>
-#include <kmessagebox.h>
-#include <tqlayout.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kseparator.h>
-
-KMWSocket::KMWSocket(TQWidget *parent, const char *name)
-: KMWizardPage(parent,name)
-{
- m_title = i18n("Network Printer Information");
- m_ID = KMWizard::TCP;
- m_nextpage = KMWizard::Driver;
-
- m_list = new KListView(this);
- m_list->addColumn("");
- m_list->header()->hide();
- m_list->setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
- m_list->setLineWidth(1);
-
- TQLabel *l1 = new TQLabel(i18n("&Printer address:"),this);
- TQLabel *l2 = new TQLabel(i18n("P&ort:"),this);
-
- m_printer = new TQLineEdit(this);
- m_port = new TQLineEdit(this);
- m_port->setText(TQString("9100"));
-
- l1->setBuddy(m_printer);
- l2->setBuddy(m_port);
-
- m_scanner = new NetworkScanner( 9100, this );
-
- KSeparator* sep = new KSeparator( KSeparator::HLine, this);
- sep->setFixedHeight(40);
-
- connect(m_list,TQT_SIGNAL(selectionChanged(TQListViewItem*)),TQT_SLOT(slotPrinterSelected(TQListViewItem*)));
- connect( m_scanner, TQT_SIGNAL( scanStarted() ), TQT_SLOT( slotScanStarted() ) );
- connect( m_scanner, TQT_SIGNAL( scanFinished() ), TQT_SLOT( slotScanFinished() ) );
- connect( m_scanner, TQT_SIGNAL( scanStarted() ), parent, TQT_SLOT( disableWizard() ) );
- connect( m_scanner, TQT_SIGNAL( scanFinished() ), parent, TQT_SLOT( enableWizard() ) );
-
- // layout
- TQHBoxLayout *lay3 = new TQHBoxLayout(this, 0, 10);
- TQVBoxLayout *lay2 = new TQVBoxLayout(0, 0, 0);
-
- lay3->addWidget(m_list,1);
- lay3->addLayout(lay2,1);
- lay2->addWidget(l1);
- lay2->addWidget(m_printer);
- lay2->addSpacing(10);
- lay2->addWidget(l2);
- lay2->addWidget(m_port);
- lay2->addWidget(sep);
- lay2->addWidget( m_scanner );
- lay2->addStretch(1);
-}
-
-KMWSocket::~KMWSocket()
-{
-}
-
-void KMWSocket::updatePrinter(KMPrinter *p)
-{
- TQString dev = TQString::tqfromLatin1("socket://%1:%2").arg(m_printer->text()).arg(m_port->text());
- p->setDevice(dev);
-}
-
-bool KMWSocket::isValid(TQString& msg)
-{
- if (m_printer->text().isEmpty())
- {
- msg = i18n("You must enter a printer address.");
- return false;
- }
- TQString port(m_port->text());
- int p(9100);
- if (!port.isEmpty())
- {
- bool ok;
- p = port.toInt(&ok);
- if (!ok)
- {
- msg = i18n("Wrong port number.");
- return false;
- }
- }
-
- if (!m_scanner->checkPrinter(m_printer->text(),p))
- {
- msg = i18n("No printer found at this address/port.");
- return false;
- }
- return true;
-}
-
-void KMWSocket::slotScanStarted()
-{
- m_list->clear();
-}
-
-void KMWSocket::slotScanFinished()
-{
- const TQPtrList<NetworkScanner::SocketInfo> *list = m_scanner->printerList();
- TQPtrListIterator<NetworkScanner::SocketInfo> it(*list);
- for (;it.current();++it)
- {
- TQString name;
- if (it.current()->Name.isEmpty())
- name = i18n("Unknown host - 1 is the IP", "<Unknown> (%1)").arg(it.current()->IP);
- else
- name = it.current()->Name;
- TQListViewItem *item = new TQListViewItem(m_list,name,it.current()->IP,TQString::number(it.current()->Port));
- item->setPixmap(0,SmallIcon("tdeprint_printer"));
- }
-}
-
-void KMWSocket::slotPrinterSelected(TQListViewItem *item)
-{
- if (!item) return;
- m_printer->setText(item->text(1));
- m_port->setText(item->text(2));
-}
-
-#include "kmwsocket.moc"
diff --git a/kdeprint/management/kmwsocket.h b/kdeprint/management/kmwsocket.h
deleted file mode 100644
index 687b52fd4..000000000
--- a/kdeprint/management/kmwsocket.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWSOCKET_H
-#define KMWSOCKET_H
-
-#include "kmwizardpage.h"
-
-class KListView;
-class TQListViewItem;
-class TQLineEdit;
-class NetworkScanner;
-
-class KMWSocket : public KMWizardPage
-{
- Q_OBJECT
-public:
- KMWSocket(TQWidget *parent = 0, const char *name = 0);
- ~KMWSocket();
-
- bool isValid(TQString&);
- void updatePrinter(KMPrinter*);
-
-protected slots:
- void slotPrinterSelected(TQListViewItem*);
- void slotScanStarted();
- void slotScanFinished();
-
-private:
- KListView *m_list;
- NetworkScanner *m_scanner;
- TQLineEdit *m_printer, *m_port;
-};
-
-#endif
diff --git a/kdeprint/management/kmwsocketutil.cpp b/kdeprint/management/kmwsocketutil.cpp
deleted file mode 100644
index e6d06bae2..000000000
--- a/kdeprint/management/kmwsocketutil.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include <config.h>
-
-#include "kmwsocketutil.h"
-
-#include <tqprogressbar.h>
-#include <tqlineedit.h>
-#include <tqlabel.h>
-#include <tqcombobox.h>
-#include <tqpushbutton.h>
-#include <kmessagebox.h>
-#include <tqlayout.h>
-#include <tqregexp.h>
-#include <knumvalidator.h>
-
-#include <kapplication.h>
-#include <klocale.h>
-#include <kextsock.h>
-#include <kdebug.h>
-
-#include <unistd.h>
-
-TQString localRootIP();
-
-//----------------------------------------------------------------------------------------
-
-SocketConfig::SocketConfig(KMWSocketUtil *util, TQWidget *parent, const char *name)
-: KDialogBase(parent, name, true, TQString::null, Ok|Cancel, Ok, true)
-{
- TQWidget *dummy = new TQWidget(this);
- setMainWidget(dummy);
- KIntValidator *val = new KIntValidator( this );
- TQLabel *masklabel = new TQLabel(i18n("&Subnetwork:"),dummy);
- TQLabel *portlabel = new TQLabel(i18n("&Port:"),dummy);
- TQLabel *toutlabel = new TQLabel(i18n("&Timeout (ms):"),dummy);
- TQLineEdit *mm = new TQLineEdit(dummy);
- mm->setText(TQString::tqfromLatin1(".[0-255]"));
- mm->setReadOnly(true);
- mm->setFixedWidth(fontMetrics().width(mm->text())+10);
-
- mask_ = new TQLineEdit(dummy);
- mask_->tqsetAlignment(Qt::AlignRight);
- port_ = new TQComboBox(true,dummy);
- if ( port_->lineEdit() )
- port_->lineEdit()->setValidator( val );
- tout_ = new TQLineEdit(dummy);
- tout_->setValidator( val );
-
- masklabel->setBuddy(mask_);
- portlabel->setBuddy(port_);
- toutlabel->setBuddy(tout_);
-
- mask_->setText(util->root_);
- port_->insertItem("631");
- port_->insertItem("9100");
- port_->insertItem("9101");
- port_->insertItem("9102");
- port_->setEditText(TQString::number(util->port_));
- tout_->setText(TQString::number(util->timeout_));
-
- TQGridLayout *main_ = new TQGridLayout(dummy, 3, 2, 0, 10);
- TQHBoxLayout *lay1 = new TQHBoxLayout(0, 0, 5);
- main_->addWidget(masklabel, 0, 0);
- main_->addWidget(portlabel, 1, 0);
- main_->addWidget(toutlabel, 2, 0);
- main_->addLayout(lay1, 0, 1);
- main_->addWidget(port_, 1, 1);
- main_->addWidget(tout_, 2, 1);
- lay1->addWidget(mask_,1);
- lay1->addWidget(mm,0);
-
- resize(250,130);
- setCaption(i18n("Scan Configuration"));
-}
-
-SocketConfig::~SocketConfig()
-{
-}
-
-void SocketConfig::slotOk()
-{
- TQString msg;
- TQRegExp re("(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})");
- if (!re.exactMatch(mask_->text()))
- msg = i18n("Wrong subnetwork specification.");
- else
- {
- for (int i=1; i<=3; i++)
- if (re.cap(i).toInt() >= 255)
- {
- msg = i18n("Wrong subnetwork specification.");
- break;
- }
- }
-
- bool ok(false);
- int v = tout_->text().toInt(&ok);
- if (!ok || v <= 0)
- msg = i18n("Wrong timeout specification.");
- v = port_->currentText().toInt(&ok);
- if (!ok || v <= 0)
- msg = i18n("Wrong port specification.");
- if (!msg.isEmpty())
- {
- KMessageBox::error(this,msg);
- return;
- }
-
- KDialogBase::slotOk();
-}
-
-//----------------------------------------------------------------------------------------
-
-KMWSocketUtil::KMWSocketUtil()
-{
- printerlist_.setAutoDelete(true);
- root_ = localRootIP();
- port_ = 9100;
- timeout_ = 50;
-}
-
-bool KMWSocketUtil::checkPrinter(const TQString& IPstr, int port, TQString* hostname)
-{
- KExtendedSocket sock(IPstr, port, KExtendedSocket::inetSocket|KExtendedSocket::streamSocket);
- bool result(false);
- sock.setTimeout(0, timeout_ * 1000);
- if (sock.connect() == 0)
- {
- if (hostname)
- {
- TQString portname;
- KExtendedSocket::resolve((KSocketAddress*)(sock.peerAddress()), *hostname, portname);
- }
- result = true;
- }
- sock.close();
- return result;
-}
-
-bool KMWSocketUtil::scanNetwork(TQProgressBar *bar)
-{
- printerlist_.setAutoDelete(true);
- printerlist_.clear();
- int n(256);
- if (bar)
- bar->setTotalSteps(n);
- for (int i=0; i<n; i++)
- {
- TQString IPstr = root_ + "." + TQString::number(i);
- TQString hostname;
- if (checkPrinter(IPstr, port_, &hostname))
- { // we found a printer at this address, create SocketInfo entry in printer list
- SocketInfo *info = new SocketInfo;
- info->IP = IPstr;
- info->Port = port_;
- info->Name = hostname;
- printerlist_.append(info);
- }
- if (bar)
- {
- bar->setProgress(i);
- kapp->flushX();
- }
- }
- return true;
-}
-
-void KMWSocketUtil::configureScan(TQWidget *parent)
-{
- SocketConfig *dlg = new SocketConfig(this,parent);
- if (dlg->exec())
- {
- root_ = dlg->mask_->text();
- port_ = dlg->port_->currentText().toInt();
- timeout_ = dlg->tout_->text().toInt();
- }
- delete dlg;
-}
-
-//----------------------------------------------------------------------------------------
-
-TQString localRootIP()
-{
- char buf[256];
- buf[0] = '\0';
- if (!gethostname(buf, sizeof(buf)))
- buf[sizeof(buf)-1] = '\0';
- TQPtrList<KAddressInfo> infos = KExtendedSocket::lookup(buf, TQString::null);
- infos.setAutoDelete(true);
- if (infos.count() > 0)
- {
- TQString IPstr = infos.first()->address()->nodeName();
- int p = IPstr.findRev('.');
- IPstr.truncate(p);
- return IPstr;
- }
- return TQString::null;
-}
-
-#include "kmwsocketutil.moc"
diff --git a/kdeprint/management/kmwsocketutil.h b/kdeprint/management/kmwsocketutil.h
deleted file mode 100644
index dfb9f490e..000000000
--- a/kdeprint/management/kmwsocketutil.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KMWSOCKETUTIL_H
-#define KMWSOCKETUTIL_H
-
-#include <tqstring.h>
-#include <tqptrlist.h>
-#include <kdialogbase.h>
-
-struct SocketInfo
-{
- QString IP;
- QString Name;
- int Port;
-};
-
-class TQProgressBar;
-class TQLineEdit;
-class TQComboBox;
-class KMWSocketUtil;
-
-class SocketConfig : public KDialogBase
-{
- friend class KMWSocketUtil;
- Q_OBJECT
-public:
- SocketConfig(KMWSocketUtil *util, TQWidget *parent = 0, const char *name = 0);
- ~SocketConfig();
-
-protected slots:
- void slotOk();
-
-private:
- TQLineEdit *mask_, *tout_;
- TQComboBox *port_;
-};
-
-class KMWSocketUtil
-{
- friend class SocketConfig;
-
-public:
- KMWSocketUtil();
-
- bool checkPrinter(const TQString& host, int port, TQString* hostname = 0);
-
- const TQPtrList<SocketInfo>* printerList() { return &printerlist_; }
- bool scanNetwork(TQProgressBar *bar = 0);
- void configureScan(TQWidget *parent = 0);
- void setDefaultPort(int p) { port_ = p; }
-
-private:
- TQPtrList<SocketInfo> printerlist_;
- TQString root_;
- int port_;
- int timeout_; // in milliseconds
-};
-
-#endif
diff --git a/kdeprint/management/kxmlcommanddlg.cpp b/kdeprint/management/kxmlcommanddlg.cpp
deleted file mode 100644
index 3b42b71d7..000000000
--- a/kdeprint/management/kxmlcommanddlg.cpp
+++ /dev/null
@@ -1,1059 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kxmlcommanddlg.h"
-#include "driver.h"
-#include "kxmlcommand.h"
-
-#include <tqlayout.h>
-#include <tqheader.h>
-#include <tqlabel.h>
-#include <tqlineedit.h>
-#include <tqcombobox.h>
-#include <tqgroupbox.h>
-#include <tqwidgetstack.h>
-#include <tqtoolbutton.h>
-#include <kpushbutton.h>
-#include <tqtooltip.h>
-#include <tqcheckbox.h>
-#include <ktextedit.h>
-#include <tqregexp.h>
-#include <tqwhatsthis.h>
-#include <tqapplication.h>
-
-#include <klistview.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kdialogbase.h>
-#include <kseparator.h>
-#include <klistbox.h>
-#include <kmimetype.h>
-#include <kmessagebox.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kguiitem.h>
-
-TQString generateId(const TQMap<TQString, DrBase*>& map)
-{
- int index(-1);
- while (map.contains(TQString::tqfromLatin1("item%1").arg(++index))) ;
- return TQString::tqfromLatin1("item%1").arg(index);
-}
-
-TQListViewItem* findPrev(TQListViewItem *item)
-{
- TQListViewItem *prev = item->itemAbove();
- while (prev && prev->depth() > item->depth())
- prev = prev->itemAbove();
- if (prev && prev->depth() == item->depth())
- return prev;
- else
- return 0;
-}
-
-TQListViewItem* findNext(TQListViewItem *item)
-{
- TQListViewItem *next = item->itemBelow();
- while (next && next->depth() > item->depth())
- next = next->itemBelow();
- if (next && next->depth() == item->depth())
- return next;
- else
- return 0;
-}
-
-KXmlCommandAdvancedDlg::KXmlCommandAdvancedDlg(TQWidget *parent, const char *name)
-: TQWidget(parent, name)
-{
- m_xmlcmd = 0;
-
- m_command = new TQLineEdit(this);
- m_view = new KListView(this);
- m_view->addColumn("");
- m_view->header()->hide();
- m_view->setSorting(-1);
- m_apply = new TQToolButton(this);
- m_apply->setIconSet( TQApplication::reverseLayout()? SmallIconSet( "forward" ) : SmallIconSet("back"));
- m_addgrp = new TQToolButton(this);
- m_addgrp->setIconSet(SmallIconSet("folder"));
- m_addopt = new TQToolButton(this);
- m_addopt->setIconSet(SmallIconSet("document"));
- m_delopt = new TQToolButton(this);
- m_delopt->setIconSet(SmallIconSet("editdelete"));
- m_up = new TQToolButton(this);
- m_up->setIconSet(SmallIconSet("up"));
- m_down = new TQToolButton(this);
- m_down->setIconSet(SmallIconSet("down"));
- m_dummy = new TQWidget(this);
- m_desc = new TQLineEdit(m_dummy);
- m_name = new TQLineEdit(m_dummy);
- m_type = new TQComboBox(m_dummy);
- m_type->insertItem(i18n("String"));
- m_type->insertItem(i18n("Integer"));
- m_type->insertItem(i18n("Float"));
- m_type->insertItem(i18n("List"));
- m_type->insertItem(i18n("Boolean"));
- m_format = new TQLineEdit(m_dummy);
- m_default = new TQLineEdit(m_dummy);
- TQLabel *m_namelab = new TQLabel(i18n("&Name:"), m_dummy);
- TQLabel *m_desclab = new TQLabel(i18n("&Description:"), m_dummy);
- TQLabel *m_formatlab = new TQLabel(i18n("&Format:"), m_dummy);
- TQLabel *m_typelab = new TQLabel(i18n("&Type:"), m_dummy);
- TQLabel *m_defaultlab = new TQLabel(i18n("Default &value:"), m_dummy);
- TQLabel *m_commandlab = new TQLabel(i18n("Co&mmand:"), this);
- m_namelab->setBuddy(m_name);
- m_desclab->setBuddy(m_desc);
- m_formatlab->setBuddy(m_format);
- m_typelab->setBuddy(m_type);
- m_defaultlab->setBuddy(m_default);
- m_commandlab->setBuddy(m_command);
- m_persistent = new TQCheckBox( i18n( "&Persistent option" ), m_dummy );
-
- TQGroupBox *gb = new TQGroupBox(0, Qt::Horizontal, i18n("Va&lues"), m_dummy);
- m_stack = new TQWidgetStack(gb);
- TQWidget *w1 = new TQWidget(m_stack), *w2 = new TQWidget(m_stack), *w3 = new TQWidget(m_stack);
- m_stack->addWidget(w1, 1);
- m_stack->addWidget(w2, 2);
- m_stack->addWidget(w3, 3);
- m_edit1 = new TQLineEdit(w1);
- m_edit2 = new TQLineEdit(w1);
- TQLabel *m_editlab1 = new TQLabel(i18n("Minimum v&alue:"), w1);
- TQLabel *m_editlab2 = new TQLabel(i18n("Ma&ximum value:"), w1);
- m_editlab1->setBuddy(m_edit1);
- m_editlab2->setBuddy(m_edit2);
- m_values = new KListView(w2);
- m_values->addColumn(i18n("Name"));
- m_values->addColumn(i18n("Description"));
- m_values->setAllColumnsShowFocus(true);
- m_values->setSorting(-1);
- m_values->setMaximumHeight(110);
- m_addval = new TQToolButton(w2);
- m_addval->setIconSet(SmallIconSet("editcopy"));
- m_delval = new TQToolButton(w2);
- m_delval->setIconSet(SmallIconSet("editdelete"));
- TQToolTip::add(m_addval, i18n("Add value"));
- TQToolTip::add(m_delval, i18n("Delete value"));
-
- TQToolTip::add(m_apply, i18n("Apply changes"));
- TQToolTip::add(m_addgrp, i18n("Add group"));
- TQToolTip::add(m_addopt, i18n("Add option"));
- TQToolTip::add(m_delopt, i18n("Delete item"));
- TQToolTip::add(m_up, i18n("Move up"));
- TQToolTip::add(m_down, i18n("Move down"));
-
- KSeparator *sep1 = new KSeparator(KSeparator::HLine, m_dummy);
-
- TQGroupBox *gb_input = new TQGroupBox(0, Qt::Horizontal, i18n("&Input From"), this);
- TQGroupBox *gb_output = new TQGroupBox(0, Qt::Horizontal, i18n("O&utput To"), this);
- TQLabel *m_inputfilelab = new TQLabel(i18n("File:"), gb_input);
- TQLabel *m_inputpipelab = new TQLabel(i18n("Pipe:"), gb_input);
- TQLabel *m_outputfilelab = new TQLabel(i18n("File:"), gb_output);
- TQLabel *m_outputpipelab = new TQLabel(i18n("Pipe:"), gb_output);
- m_inputfile = new TQLineEdit(gb_input);
- m_inputpipe = new TQLineEdit(gb_input);
- m_outputfile = new TQLineEdit(gb_output);
- m_outputpipe = new TQLineEdit(gb_output);
-
- m_comment = new KTextEdit( this );
- m_comment->setTextFormat(TQt::RichText );
- m_comment->setReadOnly(true);
- TQLabel *m_commentlab = new TQLabel( i18n( "Comment:" ), this );
-
- TQVBoxLayout *l2 = new TQVBoxLayout(this, 0, KDialog::spacingHint());
- TQHBoxLayout *l3 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
- TQVBoxLayout *l7 = new TQVBoxLayout(0, 0, 0);
- l2->addLayout(l3, 0);
- l3->addWidget(m_commandlab);
- l3->addWidget(m_command);
- TQHBoxLayout *l0 = new TQHBoxLayout(0, 0, KDialog::spacingHint());
- TQGridLayout *l10 = new TQGridLayout(0, 2, 2, 0, KDialog::spacingHint());
- l2->addLayout(l0, 1);
- l0->addLayout(TQT_TQLAYOUT(l10));
- l10->addMultiCellWidget(m_view, 0, 0, 0, 1);
- l10->addWidget(gb_input, 1, 0);
- l10->addWidget(gb_output, 1, 1);
- l10->setRowStretch(0, 1);
- l0->addLayout(l7);
- l7->addWidget(m_apply);
- l7->addSpacing(5);
- l7->addWidget(m_addgrp);
- l7->addWidget(m_addopt);
- l7->addWidget(m_delopt);
- l7->addSpacing(5);
- l7->addWidget(m_up);
- l7->addWidget(m_down);
- l7->addStretch(1);
- l0->addWidget(m_dummy, 1);
- TQGridLayout *l1 = new TQGridLayout(m_dummy, 9, 2, 0, KDialog::spacingHint());
- l1->addWidget(m_desclab, 0, 0, Qt::AlignRight|Qt::AlignVCenter);
- l1->addWidget(m_desc, 0, 1);
- l1->addMultiCellWidget(sep1, 1, 1, 0, 1);
- l1->addWidget(m_namelab, 2, 0, Qt::AlignRight|Qt::AlignVCenter);
- l1->addWidget(m_name, 2, 1);
- l1->addWidget(m_typelab, 3, 0, Qt::AlignRight|Qt::AlignVCenter);
- l1->addWidget(m_type, 3, 1);
- l1->addWidget(m_formatlab, 4, 0, Qt::AlignRight|Qt::AlignVCenter);
- l1->addWidget(m_format, 4, 1);
- l1->addWidget(m_defaultlab, 5, 0, Qt::AlignRight|Qt::AlignVCenter);
- l1->addWidget(m_default, 5, 1);
- l1->addWidget( m_persistent, 6, 1 );
- l1->addMultiCellWidget(gb, 7, 7, 0, 1);
- l1->setRowStretch(8, 1);
-
- TQHBoxLayout *l4 = new TQHBoxLayout(w2, 0, KDialog::spacingHint());
- l4->addWidget(m_values);
- TQVBoxLayout *l6 = new TQVBoxLayout(0, 0, 0);
- l4->addLayout(l6);
- l6->addWidget(m_addval);
- l6->addWidget(m_delval);
- l6->addStretch(1);
- TQGridLayout *l5 = new TQGridLayout(w1, 3, 2, 0, KDialog::spacingHint());
- l5->setRowStretch(2, 1);
- l5->addWidget(m_editlab1, 0, 0, Qt::AlignRight|Qt::AlignVCenter);
- l5->addWidget(m_editlab2, 1, 0, Qt::AlignRight|Qt::AlignVCenter);
- l5->addWidget(m_edit1, 0, 1);
- l5->addWidget(m_edit2, 1, 1);
-
- TQGridLayout *l8 = new TQGridLayout(gb_input->tqlayout(), 2, 2,
- KDialog::spacingHint());
- TQGridLayout *l9 = new TQGridLayout(gb_output->tqlayout(), 2, 2,
- KDialog::spacingHint());
- l8->addWidget(m_inputfilelab, 0, 0);
- l8->addWidget(m_inputpipelab, 1, 0);
- l8->addWidget(m_inputfile, 0, 1);
- l8->addWidget(m_inputpipe, 1, 1);
- l9->addWidget(m_outputfilelab, 0, 0);
- l9->addWidget(m_outputpipelab, 1, 0);
- l9->addWidget(m_outputfile, 0, 1);
- l9->addWidget(m_outputpipe, 1, 1);
-
- TQVBoxLayout *l11 = new TQVBoxLayout(TQT_TQLAYOUT(gb->tqlayout()));
- l11->addWidget(m_stack);
-
- TQVBoxLayout *l12 = new TQVBoxLayout( 0, 0, 0 );
- l2->addSpacing( 10 );
- l2->addLayout( l12 );
- l12->addWidget( m_commentlab );
- l12->addWidget( m_comment );
-
- connect(m_view, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotSelectionChanged(TQListViewItem*)));
- connect(m_values, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotValueSelected(TQListViewItem*)));
- connect(m_type, TQT_SIGNAL(activated(int)), TQT_SLOT(slotTypeChanged(int)));
- connect(m_addval, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddValue()));
- connect(m_delval, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveValue()));
- connect(m_apply, TQT_SIGNAL(clicked()), TQT_SLOT(slotApplyChanges()));
- connect(m_addgrp, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddGroup()));
- connect(m_addopt, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddOption()));
- connect(m_delopt, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveItem()));
- connect(m_up, TQT_SIGNAL(clicked()), TQT_SLOT(slotMoveUp()));
- connect(m_down, TQT_SIGNAL(clicked()), TQT_SLOT(slotMoveDown()));
- connect(m_command, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotCommandChanged(const TQString&)));
- connect(m_view, TQT_SIGNAL(itemRenamed(TQListViewItem*,int)), TQT_SLOT(slotOptionRenamed(TQListViewItem*,int)));
- connect(m_desc, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotChanged()));
- connect(m_name, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotChanged()));
- connect(m_format, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotChanged()));
- connect(m_default, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotChanged()));
- connect(m_edit1, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotChanged()));
- connect(m_edit2, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(slotChanged()));
- connect(m_type, TQT_SIGNAL(activated(int)), TQT_SLOT(slotChanged()));
- connect(m_addval, TQT_SIGNAL(clicked()), TQT_SLOT(slotChanged()));
- connect(m_delval, TQT_SIGNAL(clicked()), TQT_SLOT(slotChanged()));
- connect( m_persistent, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( slotChanged() ) );
- m_dummy->setEnabled(false);
- viewItem(0);
-
- /**
- * Add some short help for the normal (non expert) user
- */
- TQWhatsThis::add( m_name, i18n(
- "An identification string. Use only alphanumeric characters except spaces. "
- "The string <b>__root__</b> is reserved for internal use." ) );
- TQWhatsThis::add( m_namelab, TQWhatsThis::textFor( m_name ) );
- TQWhatsThis::add( m_desc, i18n(
- "A description string. This string is shown in the interface, and should "
- "be explicit enough about the role of the corresponding option." ) );
- TQWhatsThis::add( m_desclab, TQWhatsThis::textFor( m_desc ) );
- TQWhatsThis::add( m_type, i18n(
- "The type of the option. This determines how the option is presented "
- "graphically to the user." ) );
- TQWhatsThis::add( m_typelab, TQWhatsThis::textFor( m_type ) );
- TQWhatsThis::add( m_format, i18n(
- "The format of the option. This determines how the option is formatted "
- "for inclusion in the global command line. The tag <b>%value</b> can be used "
- "to represent the user selection. This tag will be replaced at run-time by a "
- "string representation of the option value." ) );
- TQWhatsThis::add( m_formatlab, TQWhatsThis::textFor( m_format ) );
- TQWhatsThis::add( m_default, i18n(
- "The default value of the option. For non persistent options, nothing is "
- "added to the command line if the option has that default value. If this "
- "value does not correspond to the actual default value of the underlying "
- "utility, make the option persistent to avoid unwanted effects." ) );
- TQWhatsThis::add( m_defaultlab, TQWhatsThis::textFor( m_default ) );
- TQWhatsThis::add( m_persistent, i18n(
- "Make the option persistent. A persistent option is always written to the "
- "command line, whatever its value. This is useful when the chosen default "
- "value does not match with the actual default value of the underlying utility." ) );
- TQWhatsThis::add( m_command, i18n(
- "The full command line to execute the associated underlying utility. This "
- "command line is based on a mechanism of tags that are replaced at run-time. "
- "The supported tags are:<ul>"
- "<li><b>%filterargs</b>: command options</li>"
- "<li><b>%filterinput</b>: input specification</li>"
- "<li><b>%filteroutput</b>: output specification</li>"
- "<li><b>%psu</b>: the page size in upper case</li>"
- "<li><b>%psl</b>: the page size in lower case</li></ul>" ) );
- TQWhatsThis::add( m_commandlab, TQWhatsThis::textFor( m_command ) );
- TQWhatsThis::add( m_inputfile, i18n(
- "Input specification when the underlying utility reads input data from a file. Use "
- "the tag <b>%in</b> to represent the input filename." ) );
- TQWhatsThis::add( m_inputfilelab, TQWhatsThis::textFor( m_inputfile ) );
- TQWhatsThis::add( m_outputfile, i18n(
- "Output specification when the underlying utility writes output data to a file. Use "
- "the tag <b>%out</b> to represent the output filename." ) );
- TQWhatsThis::add( m_outputfilelab, TQWhatsThis::textFor( m_outputfile ) );
- TQWhatsThis::add( m_inputpipe, i18n(
- "Input specification when the underlying utility reads input data from its "
- "standard input." ) );
- TQWhatsThis::add( m_inputpipelab, TQWhatsThis::textFor( m_inputpipe ) );
- TQWhatsThis::add( m_outputpipe, i18n(
- "Output specification when the underlying utility writes output data to its "
- "standard output." ) );
- TQWhatsThis::add( m_outputpipelab, TQWhatsThis::textFor( m_outputpipe ) );
- TQWhatsThis::add( m_comment, i18n(
- "A comment about the underlying utility, which can be viewed by the user "
- "from the interface. This comment string supports basic HTML tags like "
- "&lt;a&gt;, &lt;b&gt; or &lt;i&gt;." ) );
- TQWhatsThis::add( m_commentlab, TQWhatsThis::textFor( m_comment ) );
-
- resize(660, 200);
-}
-
-KXmlCommandAdvancedDlg::~KXmlCommandAdvancedDlg()
-{
- if (m_opts.count() > 0)
- {
- kdDebug() << "KXmlCommandAdvancedDlg: " << m_opts.count() << " items remaining" << endl;
- for (TQMap<TQString,DrBase*>::ConstIterator it=m_opts.begin(); it!=m_opts.end(); ++it)
- {
- //kdDebug() << "Item: name=" << (*it)->name() << endl;
- delete (*it);
- }
- }
-}
-
-void KXmlCommandAdvancedDlg::setCommand(KXmlCommand *xmlcmd)
-{
- m_xmlcmd = xmlcmd;
- if (m_xmlcmd)
- parseXmlCommand(m_xmlcmd);
-}
-
-void KXmlCommandAdvancedDlg::parseXmlCommand(KXmlCommand *xmlcmd)
-{
- m_view->clear();
- TQListViewItem *root = new TQListViewItem(m_view, xmlcmd->name(), xmlcmd->name());
- DrMain *driver = xmlcmd->driver();
-
- root->setPixmap(0, SmallIcon("fileprint"));
- root->setOpen(true);
- if (driver)
- {
- DrMain *clone = driver->cloneDriver();
- if (!clone->get("text").isEmpty())
- root->setText(0, clone->get("text"));
- root->setText(1, "__root__");
- clone->setName("__root__");
- m_opts["__root__"] = clone;
- parseGroupItem(clone, root);
- clone->flatten();
- }
- m_command->setText(xmlcmd->command());
- m_inputfile->setText(xmlcmd->io(true, false));
- m_inputpipe->setText(xmlcmd->io(true, true));
- m_outputfile->setText(xmlcmd->io(false, false));
- m_outputpipe->setText(xmlcmd->io(false, true));
- m_comment->setText( xmlcmd->comment() );
-
- viewItem(0);
-}
-
-void KXmlCommandAdvancedDlg::parseGroupItem(DrGroup *grp, TQListViewItem *parent)
-{
- TQListViewItem *item(0);
-
- TQPtrListIterator<DrGroup> git(grp->groups());
- for (; git.current(); ++git)
- {
- TQString namestr = git.current()->name();
- if (namestr.isEmpty())
- {
- namestr = "group_"+kapp->randomString(4);
- }
- git.current()->setName(namestr);
- item = new TQListViewItem(parent, item, git.current()->get("text"), git.current()->name());
- item->setPixmap(0, SmallIcon("folder"));
- item->setOpen(true);
- item->setRenameEnabled(0, true);
- parseGroupItem(git.current(), item);
- m_opts[namestr] = git.current();
- }
-
- TQPtrListIterator<DrBase> oit(grp->options());
- for (; oit.current(); ++oit)
- {
- TQString namestr = oit.current()->name().mid(m_xmlcmd->name().length()+6);
- if (namestr.isEmpty())
- {
- namestr = "option_"+kapp->randomString(4);
- }
- oit.current()->setName(namestr);
- item = new TQListViewItem(parent, item, oit.current()->get("text"), namestr);
- item->setPixmap(0, SmallIcon("document"));
- item->setRenameEnabled(0, true);
- m_opts[namestr] = oit.current();
- }
-}
-
-void KXmlCommandAdvancedDlg::slotSelectionChanged(TQListViewItem *item)
-{
- if (item && item->depth() == 0)
- item = 0;
- viewItem(item);
-}
-
-void KXmlCommandAdvancedDlg::viewItem(TQListViewItem *item)
-{
- m_dummy->setEnabled((item != 0));
- m_name->setText("");
- m_desc->setText("");
- m_format->setText("");
- m_default->setText("");
- m_values->clear();
- m_edit1->setText("");
- m_edit2->setText("");
- m_persistent->setChecked( false );
- int typeId(-1);
- if (item)
- {
- m_name->setText(item->text(1));
- m_desc->setText(item->text(0));
-
- DrBase *opt = (m_opts.contains(item->text(1)) ? m_opts[item->text(1)] : 0);
- if (opt)
- {
- bool isgroup = (opt->type() < DrBase::String);
- if (!isgroup)
- {
- m_type->setCurrentItem(opt->type() - DrBase::String);
- typeId = m_type->currentItem();
- m_format->setText(opt->get("format"));
- m_default->setText(opt->get("default"));
- }
- m_type->setEnabled(!isgroup);
- m_default->setEnabled(!isgroup);
- m_format->setEnabled(!isgroup);
- m_stack->setEnabled(!isgroup);
-
- switch (opt->type())
- {
- case DrBase::Float:
- case DrBase::Integer:
- m_edit1->setText(opt->get("minval"));
- m_edit2->setText(opt->get("maxval"));
- break;
- case DrBase::Boolean:
- case DrBase::List:
- {
- TQPtrListIterator<DrBase> it(*(static_cast<DrListOption*>(opt)->choices()));
- TQListViewItem *item(0);
- for (; it.current(); ++it)
- {
- item = new TQListViewItem(m_values, item, it.current()->name(), it.current()->get("text"));
- item->setRenameEnabled(0, true);
- item->setRenameEnabled(1, true);
- }
- break;
- }
- default:
- break;
- }
-
- m_addgrp->setEnabled(isgroup);
- m_addopt->setEnabled(isgroup);
-
- TQListViewItem *prevItem = findPrev(item), *nextItem = findNext(item);
- DrBase *prevOpt = (prevItem && m_opts.contains(prevItem->text(1)) ? m_opts[prevItem->text(1)] : 0);
- DrBase *nextOpt = (nextItem && m_opts.contains(nextItem->text(1)) ? m_opts[nextItem->text(1)] : 0);
- m_up->setEnabled(prevOpt && !(prevOpt->type() < DrBase::String && opt->type() >= DrBase::String));
- m_down->setEnabled(nextOpt && !(isgroup && nextOpt->type() >= DrBase::String));
-
- m_persistent->setChecked( opt->get( "persistent" ) == "1" );
- }
-
- m_delopt->setEnabled(true);
- m_dummy->setEnabled(opt);
- }
- else
- {
- m_delopt->setEnabled(false);
- m_addopt->setEnabled(m_view->currentItem() && m_view->isEnabled());
- m_addgrp->setEnabled(m_view->currentItem() && m_view->isEnabled());
- m_up->setEnabled(false);
- m_down->setEnabled(false);
- }
- slotTypeChanged(typeId);
- m_apply->setEnabled(false);
-}
-
-void KXmlCommandAdvancedDlg::slotTypeChanged(int ID)
-{
- int wId(3);
- ID += DrBase::String;
- switch (ID)
- {
- case DrBase::Float:
- case DrBase::Integer:
- wId = 1;
- break;
- case DrBase::Boolean:
- case DrBase::List:
- wId = 2;
- slotValueSelected(m_values->currentItem());
- break;
- }
- m_stack->raiseWidget(wId);
-}
-
-void KXmlCommandAdvancedDlg::slotAddValue()
-{
- TQListViewItem *item = new TQListViewItem(m_values, m_values->lastItem(), i18n("Name"), i18n("Description"));
- item->setRenameEnabled(0, true);
- item->setRenameEnabled(1, true);
- m_values->ensureItemVisible(item);
- slotValueSelected(item);
- item->startRename(0);
-}
-
-void KXmlCommandAdvancedDlg::slotRemoveValue()
-{
- TQListViewItem *item = m_values->currentItem();
- if (item)
- delete item;
- slotValueSelected(m_values->currentItem());
-}
-
-void KXmlCommandAdvancedDlg::slotApplyChanges()
-{
- TQListViewItem *item = m_view->currentItem();
- if (item)
- {
- if (m_name->text().isEmpty() || m_name->text() == "__root__")
- {
- KMessageBox::error(this, i18n("Invalid identification name. Empty strings and \"__root__\" are not allowed."));
- return;
- }
-
- m_apply->setEnabled(false);
-
- DrBase *opt = (m_opts.contains(item->text(1)) ? m_opts[item->text(1)] : 0);
- m_opts.remove(item->text(1));
- delete opt;
-
- // update tree item
- item->setText(0, m_desc->text());
- item->setText(1, m_name->text());
-
- // recreate option
- if (m_type->isEnabled())
- {
- int type = m_type->currentItem() + DrBase::String;
- switch (type)
- {
- case DrBase::Integer:
- case DrBase::Float:
- if (type == DrBase::Integer)
- opt = new DrIntegerOption;
- else
- opt = new DrFloatOption;
- opt->set("minval", m_edit1->text());
- opt->set("maxval", m_edit2->text());
- break;
- case DrBase::List:
- case DrBase::Boolean:
- {
- if (type == DrBase::List)
- opt = new DrListOption;
- else
- opt = new DrBooleanOption;
- DrListOption *lopt = static_cast<DrListOption*>(opt);
- TQListViewItem *item = m_values->firstChild();
- while (item)
- {
- DrBase *choice = new DrBase;
- choice->setName(item->text(0));
- choice->set("text", item->text(1));
- lopt->addChoice(choice);
- item = item->nextSibling();
- }
- break;
- }
- case DrBase::String:
- opt = new DrStringOption;
- break;
-
- }
- opt->set("format", m_format->text());
- opt->set("default", m_default->text());
- opt->setValueText(opt->get("default"));
- }
- else
- opt = new DrGroup;
-
- opt->setName((m_name->text().isEmpty() ? generateId(m_opts) : m_name->text()));
- opt->set("text", m_desc->text());
- opt->set( "persistent", m_persistent->isChecked() ? "1" : "0" );
-
- m_opts[opt->name()] = opt;
- }
-}
-
-void KXmlCommandAdvancedDlg::slotChanged()
-{
- m_apply->setEnabled(true);
-}
-
-void KXmlCommandAdvancedDlg::slotAddGroup()
-{
- if (m_view->currentItem())
- {
- TQString ID = generateId(m_opts);
-
- DrGroup *grp = new DrGroup;
- grp->setName(ID);
- grp->set("text", i18n("New Group"));
- m_opts[ID] = grp;
-
- TQListViewItem *item = new TQListViewItem(m_view->currentItem(), i18n("New Group"), ID);
- item->setRenameEnabled(0, true);
- item->setPixmap(0, SmallIcon("folder"));
- m_view->ensureItemVisible(item);
- item->startRename(0);
- }
-}
-
-void KXmlCommandAdvancedDlg::slotAddOption()
-{
- if (m_view->currentItem())
- {
- TQString ID = generateId(m_opts);
-
- DrBase *opt = new DrStringOption;
- opt->setName(ID);
- opt->set("text", i18n("New Option"));
- m_opts[ID] = opt;
-
- TQListViewItem *item = new TQListViewItem(m_view->currentItem(), i18n("New Option"), ID);
- item->setRenameEnabled(0, true);
- item->setPixmap(0, SmallIcon("document"));
- m_view->ensureItemVisible(item);
- item->startRename(0);
- }
-}
-
-void KXmlCommandAdvancedDlg::slotRemoveItem()
-{
- TQListViewItem *item = m_view->currentItem();
- if (item)
- {
- TQListViewItem *newCurrent(item->nextSibling());
- if (!newCurrent)
- newCurrent = item->parent();
- removeItem(item);
- delete item;
- m_view->setSelected(newCurrent, true);
- }
-}
-
-void KXmlCommandAdvancedDlg::removeItem(TQListViewItem *item)
-{
- delete m_opts[item->text(1)];
- m_opts.remove(item->text(1));
- TQListViewItem *child = item->firstChild();
- while (child && item)
- {
- removeItem(child);
- if ( item )
- item = item->nextSibling();
- }
-}
-
-void KXmlCommandAdvancedDlg::slotMoveUp()
-{
- TQListViewItem *item = m_view->currentItem(), *prev = 0;
- if (item && (prev=findPrev(item)))
- {
- TQListViewItem *after(0);
- if ((after=findPrev(prev)) != 0)
- item->moveItem(after);
- else
- {
- TQListViewItem *parent = item->parent();
- parent->takeItem(item);
- parent->insertItem(item);
- }
- m_view->setSelected(item, true);
- slotSelectionChanged(item);
- }
-}
-
-void KXmlCommandAdvancedDlg::slotMoveDown()
-{
- TQListViewItem *item = m_view->currentItem(), *next = 0;
- if (item && (next=findNext(item)))
- {
- item->moveItem(next);
- m_view->setSelected(item, true);
- slotSelectionChanged(item);
- }
-}
-
-void KXmlCommandAdvancedDlg::slotCommandChanged(const TQString& cmd)
-{
- m_inputfile->parentWidget()->setEnabled(cmd.find("%filterinput") != -1);
- m_outputfile->parentWidget()->setEnabled(cmd.find("%filteroutput") != -1);
- m_view->setEnabled(cmd.find("%filterargs") != -1);
- m_name->parentWidget()->setEnabled(m_view->isEnabled());
- slotSelectionChanged((m_view->isEnabled() ? m_view->currentItem() : 0));
- m_view->setOpen(m_view->firstChild(), m_view->isEnabled());
-}
-
-void KXmlCommandAdvancedDlg::slotValueSelected(TQListViewItem *item)
-{
- m_addval->setEnabled(m_type->currentItem() != 4 || m_values->childCount() < 2);
- m_delval->setEnabled(item != 0);
-}
-
-void KXmlCommandAdvancedDlg::slotOptionRenamed(TQListViewItem *item, int)
-{
- if (item && m_opts.contains(item->text(1)))
- {
- DrBase *opt = m_opts[item->text(1)];
- opt->set("text", item->text(0));
- slotSelectionChanged(item);
- }
-}
-
-void KXmlCommandAdvancedDlg::recreateGroup(TQListViewItem *item, DrGroup *grp)
-{
- if (!item)
- return;
-
- TQListViewItem *child = item->firstChild();
- while (child)
- {
- DrBase *opt = (m_opts.contains(child->text(1)) ? m_opts[child->text(1)] : 0);
- if (opt)
- {
- if (opt->type() == DrBase::Group)
- {
- DrGroup *childGroup = static_cast<DrGroup*>(opt);
- recreateGroup(child, childGroup);
- grp->addGroup(childGroup);
- }
- else
- {
- opt->setName("_kde-"+m_xmlcmd->name()+"-"+opt->name());
- grp->addOption(opt);
- }
- m_opts.remove(child->text(1));
- }
- child = child->nextSibling();
- }
-}
-
-bool KXmlCommandAdvancedDlg::editCommand(KXmlCommand *xmlcmd, TQWidget *parent)
-{
- if (!xmlcmd)
- return false;
-
- KDialogBase dlg(parent, 0, true, i18n("Command Edit for %1").arg(xmlcmd->name()), KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, false);
- KXmlCommandAdvancedDlg *xmldlg = new KXmlCommandAdvancedDlg(&dlg);
- dlg.setMainWidget(xmldlg);
- //dlg.enableButton(KDialogBase::Ok, false);
- xmldlg->setCommand(xmlcmd);
- if (dlg.exec())
- {
- xmlcmd->setCommand(xmldlg->m_command->text());
- xmlcmd->setIo(xmldlg->m_inputfile->text(), true, false);
- xmlcmd->setIo(xmldlg->m_inputpipe->text(), true, true);
- xmlcmd->setIo(xmldlg->m_outputfile->text(), false, false);
- xmlcmd->setIo(xmldlg->m_outputpipe->text(), false, true);
- xmlcmd->setComment( xmldlg->m_comment->text().replace( TQRegExp( "\n" ), " " ) );
-
- // need to recreate the driver tree structure
- DrMain *driver = (xmldlg->m_opts.contains("__root__") ? static_cast<DrMain*>(xmldlg->m_opts["__root__"]) : 0);
- if (!driver && xmldlg->m_opts.count() > 0)
- {
- kdDebug() << "KXmlCommandAdvancedDlg: driver structure not found, creating one" << endl;
- driver = new DrMain;
- driver->setName(xmlcmd->name());
- }
- xmldlg->recreateGroup(xmldlg->m_view->firstChild(), driver);
- xmldlg->m_opts.remove("__root__");
- xmlcmd->setDriver(driver);
-
- // remaining options will be removed in destructor
-
- return true;
- }
- return false;
-}
-
-//-----------------------------------------------------------------------------------------------------
-
-KXmlCommandDlg::KXmlCommandDlg(TQWidget *parent, const char *name)
-: KDialogBase(parent, name, true, TQString::null, Ok|Cancel|Details, Ok, true)
-{
- setButtonText(Details, i18n("&Mime Type Settings"));
- m_cmd = 0;
-
- TQWidget *dummy = new TQWidget(this, "TopDetail");
- TQWidget *topmain = new TQWidget(this, "TopMain");
-
- TQGroupBox *m_gb1 = new TQGroupBox(0, Qt::Horizontal, i18n("Supported &Input Formats"), dummy);
- TQGroupBox *m_gb2 = new TQGroupBox(0, Qt::Horizontal, i18n("Requirements"), topmain);
-
- m_description = new TQLineEdit(topmain);
- m_idname = new TQLabel(topmain);
- m_requirements = new KListView(m_gb2);
- m_requirements->addColumn("");
- m_requirements->header()->hide();
- m_addreq = new TQToolButton(m_gb2);
- m_addreq->setIconSet(SmallIconSet("filenew"));
- m_removereq = new TQToolButton(m_gb2);
- m_removereq->setIconSet(SmallIconSet("editdelete"));
- TQPushButton *m_edit = new KPushButton(KGuiItem(i18n("&Edit Command..."), "edit"), topmain);
- m_mimetype = new TQComboBox(dummy);
- m_availablemime = new KListBox(m_gb1);
- m_selectedmime = new KListBox(m_gb1);
- m_addmime = new TQToolButton(m_gb1);
- m_addmime->setIconSet(TQApplication::reverseLayout()? SmallIconSet("forward") : SmallIconSet("back"));
- m_removemime = new TQToolButton(m_gb1);
- m_removemime->setIconSet(TQApplication::reverseLayout()? SmallIconSet("back" ) : SmallIconSet("forward"));
- m_gb2->setMinimumWidth(380);
- m_gb1->setMinimumHeight(180);
- m_requirements->setMaximumHeight(80);
- m_removereq->setEnabled(false);
- m_addmime->setEnabled(false);
- m_removemime->setEnabled(false);
-
- TQLabel *m_desclab = new TQLabel(i18n("&Description:"), topmain);
- m_desclab->setBuddy(m_description);
- TQLabel *m_mimetypelab = new TQLabel(i18n("Output &format:"), dummy);
- m_mimetypelab->setBuddy(m_mimetype);
- TQLabel *m_idnamelab = new TQLabel(i18n("ID name:"), topmain);
-
- TQFont f(m_idname->font());
- f.setBold(true);
- m_idname->setFont(f);
-
- KSeparator *sep1 = new KSeparator(TQFrame::HLine, dummy);
-
- TQVBoxLayout *l0 = new TQVBoxLayout(topmain, 0, 10);
- TQGridLayout *l5 = new TQGridLayout(0, 2, 2, 0, 5);
- l0->addLayout(TQT_TQLAYOUT(l5));
- l5->addWidget(m_idnamelab, 0, 0);
- l5->addWidget(m_idname, 0, 1);
- l5->addWidget(m_desclab, 1, 0);
- l5->addWidget(m_description, 1, 1);
- l0->addWidget(m_gb2);
- TQHBoxLayout *l3 = new TQHBoxLayout(0, 0, 0);
- l0->addLayout(l3);
- l3->addWidget(m_edit);
- l3->addStretch(1);
-
- TQVBoxLayout *l7 = new TQVBoxLayout(dummy, 0, 10);
- TQHBoxLayout *l6 = new TQHBoxLayout(0, 0, 5);
- l7->addWidget(sep1);
- l7->addLayout(l6);
- l6->addWidget(m_mimetypelab, 0);
- l6->addWidget(m_mimetype, 1);
- l7->addWidget(m_gb1);
- TQGridLayout *l2 = new TQGridLayout(TQT_TQLAYOUT(m_gb1->tqlayout()), 4, 3, 10);
- l2->addMultiCellWidget(m_availablemime, 0, 3, 2, 2);
- l2->addMultiCellWidget(m_selectedmime, 0, 3, 0, 0);
- l2->addWidget(m_addmime, 1, 1);
- l2->addWidget(m_removemime, 2, 1);
- l2->setRowStretch(0, 1);
- l2->setRowStretch(3, 1);
- TQHBoxLayout *l4 = new TQHBoxLayout(TQT_TQLAYOUT(m_gb2->tqlayout()), 10);
- l4->addWidget(m_requirements);
- TQVBoxLayout *l8 = new TQVBoxLayout(0, 0, 0);
- l4->addLayout(l8);
- l8->addWidget(m_addreq);
- l8->addWidget(m_removereq);
- l8->addStretch(1);
-
- connect(m_addmime, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddMime()));
- connect(m_removemime, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveMime()));
- connect(m_edit, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditCommand()));
- connect(m_requirements, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotReqSelected(TQListViewItem*)));
- connect(m_availablemime, TQT_SIGNAL(selectionChanged(TQListBoxItem*)), TQT_SLOT(slotAvailableSelected(TQListBoxItem*)));
- connect(m_selectedmime, TQT_SIGNAL(selectionChanged(TQListBoxItem*)), TQT_SLOT(slotSelectedSelected(TQListBoxItem*)));
- connect(m_addreq, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddReq()));
- connect(m_removereq, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveReq()));
-
- KMimeType::List list = KMimeType::allMimeTypes();
- for (TQValueList<KMimeType::Ptr>::ConstIterator it=list.begin(); it!=list.end(); ++it)
- {
- TQString mimetype = (*it)->name();
- m_mimelist << mimetype;
- }
-
- m_mimelist.sort();
- m_mimetype->insertStringList(m_mimelist);
- m_availablemime->insertStringList(m_mimelist);
-
- setMainWidget(topmain);
- setDetailsWidget(dummy);
-}
-
-void KXmlCommandDlg::setCommand(KXmlCommand *xmlCmd)
-{
- setCaption(i18n("Command Edit for %1").arg(xmlCmd->name()));
-
- m_cmd = xmlCmd;
- m_description->setText(i18n(xmlCmd->description().utf8()));
- m_idname->setText(xmlCmd->name());
-
- m_requirements->clear();
- TQStringList list = xmlCmd->requirements();
- TQListViewItem *item(0);
- for (TQStringList::ConstIterator it=list.begin(); it!=list.end(); ++it)
- {
- item = new TQListViewItem(m_requirements, item, *it);
- item->setRenameEnabled(0, true);
- }
-
- int index = m_mimelist.findIndex(xmlCmd->mimeType());
- if (index != -1)
- m_mimetype->setCurrentItem(index);
- else
- m_mimetype->setCurrentItem(0);
-
- list = xmlCmd->inputMimeTypes();
- m_selectedmime->clear();
- m_availablemime->clear();
- m_availablemime->insertStringList(m_mimelist);
- for (TQStringList::ConstIterator it=list.begin(); it!=list.end(); ++it)
- {
- m_selectedmime->insertItem(*it);
- delete m_availablemime->findItem(*it, TQt::ExactMatch);
- }
-}
-
-void KXmlCommandDlg::slotOk()
-{
- if (m_cmd)
- {
- m_cmd->setMimeType((m_mimetype->currentText() == "all/all" ? TQString::null : m_mimetype->currentText()));
- m_cmd->setDescription(m_description->text());
- TQStringList l;
- TQListViewItem *item = m_requirements->firstChild();
- while (item)
- {
- l << item->text(0);
- item = item->nextSibling();
- }
- m_cmd->setRequirements(l);
- l.clear();
- for (uint i=0; i<m_selectedmime->count(); i++)
- l << m_selectedmime->text(i);
- m_cmd->setInputMimeTypes(l);
- }
- KDialogBase::slotOk();
-}
-
-bool KXmlCommandDlg::editCommand(KXmlCommand *xmlCmd, TQWidget *parent)
-{
- if (!xmlCmd)
- return false;
-
- KXmlCommandDlg xmldlg(parent, 0);
- xmldlg.setCommand(xmlCmd);
-
- return (xmldlg.exec() == Accepted);
-}
-
-void KXmlCommandDlg::slotAddMime()
-{
- int index = m_availablemime->currentItem();
- if (index != -1)
- {
- m_selectedmime->insertItem(m_availablemime->currentText());
- m_availablemime->removeItem(index);
- m_selectedmime->sort();
- }
-}
-
-void KXmlCommandDlg::slotRemoveMime()
-{
- int index = m_selectedmime->currentItem();
- if (index != -1)
- {
- m_availablemime->insertItem(m_selectedmime->currentText());
- m_selectedmime->removeItem(index);
- m_availablemime->sort();
- }
-}
-
-void KXmlCommandDlg::slotEditCommand()
-{
- KXmlCommandAdvancedDlg::editCommand(m_cmd, parentWidget());
-}
-
-void KXmlCommandDlg::slotAddReq()
-{
- TQListViewItem *item = new TQListViewItem(m_requirements, m_requirements->lastItem(), i18n("exec:/"));
- item->setRenameEnabled(0, true);
- m_requirements->ensureItemVisible(item);
- item->startRename(0);
-}
-
-void KXmlCommandDlg::slotRemoveReq()
-{
- delete m_requirements->currentItem();
-}
-
-void KXmlCommandDlg::slotReqSelected(TQListViewItem *item)
-{
- m_removereq->setEnabled(item);
-}
-
-void KXmlCommandDlg::slotAvailableSelected(TQListBoxItem *item)
-{
- m_addmime->setEnabled(item);
-}
-
-void KXmlCommandDlg::slotSelectedSelected(TQListBoxItem *item)
-{
- m_removemime->setEnabled(item);
-}
-
-#include "kxmlcommanddlg.moc"
diff --git a/kdeprint/management/kxmlcommanddlg.h b/kdeprint/management/kxmlcommanddlg.h
deleted file mode 100644
index 88e590325..000000000
--- a/kdeprint/management/kxmlcommanddlg.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KXMLCOMMANDDLG_H
-#define KXMLCOMMANDDLG_H
-
-#include <tqwidget.h>
-#include <tqmap.h>
-#include <tqstringlist.h>
-#include <kdialogbase.h>
-
-class KListView;
-class TQListViewItem;
-class TQLineEdit;
-class TQComboBox;
-class TQWidgetStack;
-class TQToolButton;
-class KListBox;
-class TQListBoxItem;
-class TQTextEdit;
-class TQCheckBox;
-
-class DrGroup;
-class DrBase;
-class KXmlCommand;
-
-class KXmlCommandAdvancedDlg : public TQWidget
-{
- Q_OBJECT
-public:
- KXmlCommandAdvancedDlg(TQWidget *parent = 0, const char *name = 0);
- ~KXmlCommandAdvancedDlg();
-
- void setCommand(KXmlCommand*);
- static bool editCommand(KXmlCommand *xmlcmd, TQWidget *parent = 0);
-
-protected:
- void parseGroupItem(DrGroup*, TQListViewItem*);
- void parseXmlCommand(KXmlCommand*);
- void viewItem(TQListViewItem*);
- void removeItem(TQListViewItem*);
- void recreateGroup(TQListViewItem*, DrGroup*);
-
-protected slots:
- void slotSelectionChanged(TQListViewItem*);
- void slotTypeChanged(int);
- void slotAddValue();
- void slotRemoveValue();
- void slotApplyChanges();
- void slotAddGroup();
- void slotAddOption();
- void slotRemoveItem();
- void slotMoveUp();
- void slotMoveDown();
- void slotCommandChanged(const TQString&);
- void slotValueSelected(TQListViewItem*);
- void slotOptionRenamed(TQListViewItem*, int);
- void slotChanged();
-
-private:
- KListView *m_view;
- TQLineEdit *m_name, *m_desc, *m_format, *m_default, *m_command;
- TQComboBox *m_type;
- TQWidget *m_dummy;
- KListView *m_values;
- TQLineEdit *m_edit1, *m_edit2;
- TQWidgetStack *m_stack;
- TQToolButton *m_apply, *m_addgrp, *m_addopt, *m_delopt, *m_up, *m_down;
- TQLineEdit *m_inputfile, *m_inputpipe, *m_outputfile, *m_outputpipe;
- TQToolButton *m_addval, *m_delval;
- TQTextEdit *m_comment;
- TQCheckBox *m_persistent;
-
- KXmlCommand *m_xmlcmd;
- TQMap<TQString, DrBase*> m_opts;
-};
-
-class KXmlCommandDlg : public KDialogBase
-{
- Q_OBJECT
-public:
- KXmlCommandDlg(TQWidget *parent = 0, const char *name = 0);
-
- void setCommand(KXmlCommand*);
- static bool editCommand(KXmlCommand*, TQWidget *parent = 0);
-
-protected slots:
- void slotAddMime();
- void slotRemoveMime();
- void slotEditCommand();
- void slotAddReq();
- void slotRemoveReq();
- void slotReqSelected(TQListViewItem*);
- void slotAvailableSelected(TQListBoxItem*);
- void slotSelectedSelected(TQListBoxItem*);
- void slotOk();
-
-private:
- TQLineEdit *m_description;
- TQLabel *m_idname;
- TQComboBox *m_mimetype;
- KListBox *m_availablemime, *m_selectedmime;
- TQToolButton *m_addmime, *m_removemime;
- KListView *m_requirements;
- TQToolButton *m_removereq, *m_addreq;
-
- TQStringList m_mimelist;
- KXmlCommand *m_cmd;
-};
-
-#endif
diff --git a/kdeprint/management/kxmlcommandselector.cpp b/kdeprint/management/kxmlcommandselector.cpp
deleted file mode 100644
index dfefe0a8b..000000000
--- a/kdeprint/management/kxmlcommandselector.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "kxmlcommandselector.h"
-#include "kxmlcommand.h"
-#include "kxmlcommanddlg.h"
-#include "tdeprintcheck.h"
-
-#include <tqcombobox.h>
-#include <kpushbutton.h>
-#include <tqlabel.h>
-#include <tqcheckbox.h>
-#include <tqlayout.h>
-#include <tqtooltip.h>
-#include <tqlineedit.h>
-#include <kinputdialog.h>
-#include <klocale.h>
-#include <kiconloader.h>
-#include <kmessagebox.h>
-#include <kfiledialog.h>
-#include <kseparator.h>
-#include <kguiitem.h>
-#include <kactivelabel.h>
-#include <kdatetbl.h>
-#include <kdialogbase.h>
-
-KXmlCommandSelector::KXmlCommandSelector(bool canBeNull, TQWidget *parent, const char *name, KDialogBase *dlg)
-: TQWidget(parent, name)
-{
- m_cmd = new TQComboBox(this);
- connect(m_cmd, TQT_SIGNAL(activated(int)), TQT_SLOT(slotCommandSelected(int)));
- TQPushButton *m_add = new KPushButton(this);
- TQPushButton *m_edit = new KPushButton(this);
- m_add->setPixmap(SmallIcon("filenew"));
- m_edit->setPixmap(SmallIcon("configure"));
- connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddCommand()));
- connect(m_edit, TQT_SIGNAL(clicked()), TQT_SLOT(slotEditCommand()));
- TQToolTip::add(m_add, i18n("New command"));
- TQToolTip::add(m_edit, i18n("Edit command"));
- m_shortinfo = new TQLabel(this);
- m_helpbtn = new KPushButton( this );
- m_helpbtn->setIconSet( SmallIconSet( "help" ) );
- connect( m_helpbtn, TQT_SIGNAL( clicked() ), TQT_SLOT( slotHelpCommand() ) );
- TQToolTip::add( m_helpbtn, i18n( "Information" ) );
- m_helpbtn->setEnabled( false );
-
- m_line = 0;
- m_usefilter = 0;
- TQPushButton *m_browse = 0;
-
- TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, 10);
-
- if (canBeNull)
- {
- m_line = new TQLineEdit(this);
- m_browse = new KPushButton(KGuiItem(i18n("&Browse..."), "fileopen"), this);
- m_usefilter = new TQCheckBox(i18n("Use co&mmand:"), this);
- connect(m_browse, TQT_SIGNAL(clicked()), TQT_SLOT(slotBrowse()));
- connect(m_usefilter, TQT_SIGNAL(toggled(bool)), m_line, TQT_SLOT(setDisabled(bool)));
- connect(m_usefilter, TQT_SIGNAL(toggled(bool)), m_browse, TQT_SLOT(setDisabled(bool)));
- connect(m_usefilter, TQT_SIGNAL(toggled(bool)), m_cmd, TQT_SLOT(setEnabled(bool)));
- connect(m_usefilter, TQT_SIGNAL(toggled(bool)), m_add, TQT_SLOT(setEnabled(bool)));
- connect(m_usefilter, TQT_SIGNAL(toggled(bool)), m_edit, TQT_SLOT(setEnabled(bool)));
- connect(m_usefilter, TQT_SIGNAL(toggled(bool)), m_shortinfo, TQT_SLOT(setEnabled(bool)));
- connect( m_usefilter, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( slotXmlCommandToggled( bool ) ) );
- m_usefilter->setChecked(true);
- m_usefilter->setChecked(false);
- //setFocusProxy(m_line);
- setTabOrder(m_usefilter, m_cmd);
- setTabOrder(m_cmd, m_add);
- setTabOrder(m_add, m_edit);
-
- TQHBoxLayout *l1 = new TQHBoxLayout(0, 0, 10);
- l0->addLayout(l1);
- l1->addWidget(m_line);
- l1->addWidget(m_browse);
-
- KSeparator *sep = new KSeparator(Qt::Horizontal, this);
- l0->addWidget(sep);
- }
- else
- setFocusProxy(m_cmd);
-
- TQGridLayout *l2 = new TQGridLayout(0, 2, (m_usefilter?3:2), 0, 5);
- int c(0);
- l0->addLayout(TQT_TQLAYOUT(l2));
- if (m_usefilter)
- {
- l2->addWidget(m_usefilter, 0, c++);
- }
- l2->addWidget(m_cmd, 0, c);
- TQHBoxLayout *l4 = new TQHBoxLayout( 0, 0, 5 );
- l2->addLayout( l4, 1, c );
- l4->addWidget( m_helpbtn, 0 );
- l4->addWidget( m_shortinfo, 1 );
- TQHBoxLayout *l3 = new TQHBoxLayout(0, 0, 0);
- l2->addLayout(l3, 0, c+1);
- l3->addWidget(m_add);
- l3->addWidget(m_edit);
-
- if ( dlg )
- connect( this, TQT_SIGNAL( commandValid( bool ) ), dlg, TQT_SLOT( enableButtonOK( bool ) ) );
-
- loadCommands();
-}
-
-void KXmlCommandSelector::loadCommands()
-{
- TQString thisCmd = (m_cmd->currentItem() != -1 ? m_cmdlist[m_cmd->currentItem()] : TQString::null);
-
- m_cmd->clear();
- m_cmdlist.clear();
-
- TQStringList list = KXmlCommandManager::self()->commandListWithDescription();
- TQStringList desclist;
- for (TQStringList::Iterator it=list.begin(); it!=list.end(); ++it)
- {
- m_cmdlist << (*it);
- ++it;
- desclist << (*it);
- }
- m_cmd->insertStringList(desclist);
-
- int index = m_cmdlist.findIndex(thisCmd);
- if (index != -1)
- m_cmd->setCurrentItem(index);
- if (m_cmd->currentItem() != -1 && m_cmd->isEnabled())
- slotCommandSelected(m_cmd->currentItem());
-}
-
-TQString KXmlCommandSelector::command() const
-{
- TQString cmd;
- if (m_line && !m_usefilter->isChecked())
- cmd = m_line->text();
- else
- cmd = m_cmdlist[m_cmd->currentItem()];
- return cmd;
-}
-
-void KXmlCommandSelector::setCommand(const TQString& cmd)
-{
- int index = m_cmdlist.findIndex(cmd);
-
- if (m_usefilter)
- m_usefilter->setChecked(index != -1);
- if (m_line)
- m_line->setText((index == -1 ? cmd : TQString::null));
- if (index != -1)
- m_cmd->setCurrentItem(index);
- if (m_cmd->currentItem() != -1 && m_cmd->isEnabled())
- slotCommandSelected(m_cmd->currentItem());
-}
-
-void KXmlCommandSelector::slotAddCommand()
-{
- bool ok(false);
- TQString cmdId = KInputDialog::getText(i18n("Command Name"), i18n("Enter an identification name for the new command:"), TQString::null, &ok, this);
- if (ok)
- {
- bool added(true);
-
- if (m_cmdlist.findIndex(cmdId) != -1)
- {
- if (KMessageBox::warningContinueCancel(
- this,
- i18n("A command named %1 already exists. Do you want "
- "to continue and edit the existing one?").arg(cmdId),
- TQString::null,
- KStdGuiItem::cont()) == KMessageBox::Cancel)
- {
- return;
- }
- else
- added = false;
- }
-
- KXmlCommand *xmlCmd = KXmlCommandManager::self()->loadCommand(cmdId);
- if (KXmlCommandDlg::editCommand(xmlCmd, this))
- KXmlCommandManager::self()->saveCommand(xmlCmd);
-
- if (added)
- loadCommands();
- }
-}
-
-void KXmlCommandSelector::slotEditCommand()
-{
- TQString xmlId = m_cmdlist[m_cmd->currentItem()];
- KXmlCommand *xmlCmd = KXmlCommandManager::self()->loadCommand(xmlId);
- if (xmlCmd)
- {
- if (KXmlCommandDlg::editCommand(xmlCmd, this))
- {
- // force to load the driver if not already done
- xmlCmd->driver();
- KXmlCommandManager::self()->saveCommand(xmlCmd);
- }
- m_cmd->changeItem(xmlCmd->description(), m_cmd->currentItem());
- delete xmlCmd;
- slotCommandSelected(m_cmd->currentItem());
- }
- else
- KMessageBox::error(this, i18n("Internal error. The XML driver for the command %1 could not be found.").arg(xmlId));
-}
-
-void KXmlCommandSelector::slotBrowse()
-{
- TQString filename = KFileDialog::getOpenFileName(TQString::null, TQString::null, this);
- if (!filename.isEmpty() && m_line)
- m_line->setText(filename);
-}
-
-void KXmlCommandSelector::slotCommandSelected(int ID)
-{
- KXmlCommand *xmlCmd = KXmlCommandManager::self()->loadCommand(m_cmdlist[ID], true);
- if (xmlCmd)
- {
- TQString msg;
- if ( xmlCmd->isValid() && KdeprintChecker::check( xmlCmd->requirements() ) )
- {
- msg = TQString::fromLocal8Bit("(ID = %1, %2 = ").arg(xmlCmd->name()).arg(i18n("output"));
- if (KXmlCommandManager::self()->checkCommand(xmlCmd->name(), KXmlCommandManager::None, KXmlCommandManager::Basic))
- {
- if (xmlCmd->mimeType() == "all/all")
- msg.append(i18n("undefined"));
- else
- msg.append(xmlCmd->mimeType());
- }
- else
- msg.append(i18n("not allowed"));
- msg.append(")");
- emit commandValid( true );
- }
- else
- {
- msg = "<font color=\"red\">" + i18n( "(Unavailable: requirements not satisfied)" ) + "</font>";
- emit commandValid( false );
- }
- m_shortinfo->setText(msg);
- m_help = xmlCmd->comment();
- m_helpbtn->setEnabled( !m_help.isEmpty() );
- }
- delete xmlCmd;
-}
-
-void KXmlCommandSelector::slotXmlCommandToggled( bool on )
-{
- if ( on )
- slotCommandSelected( m_cmd->currentItem() );
- else
- {
- emit commandValid( true );
- m_shortinfo->setText( TQString::null );
- }
-}
-
-void KXmlCommandSelector::slotHelpCommand()
-{
- KPopupFrame *pop = new KPopupFrame( m_helpbtn );
- KActiveLabel *lab = new KActiveLabel( m_help, pop );
- lab->resize( lab->tqsizeHint() );
- pop->setMainWidget( lab );
- pop->exec( m_helpbtn->mapToGlobal( TQPoint( m_helpbtn->width(), 0 ) ) );
- pop->close( 0 );
- delete pop;
-}
-
-#include "kxmlcommandselector.moc"
diff --git a/kdeprint/management/kxmlcommandselector.h b/kdeprint/management/kxmlcommandselector.h
deleted file mode 100644
index 0efc299f9..000000000
--- a/kdeprint/management/kxmlcommandselector.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef KXMLCOMMANDSELECTOR_H
-#define KXMLCOMMANDSELECTOR_H
-
-#include <tqwidget.h>
-#include <tqstringlist.h>
-
-#include <kdelibs_export.h>
-
-class TQComboBox;
-class TQLineEdit;
-class TQCheckBox;
-class TQLabel;
-class TQPushButton;
-class KDialogBase;
-
-class KDEPRINT_EXPORT KXmlCommandSelector : public TQWidget
-{
- Q_OBJECT
-public:
- KXmlCommandSelector(bool canBeNull = true, TQWidget *parent = 0, const char *name = 0, KDialogBase *dlg = 0);
-
- void setCommand(const TQString&);
- TQString command() const;
-
-protected:
- void loadCommands();
-
-protected slots:
- void slotAddCommand();
- void slotEditCommand();
- void slotBrowse();
- void slotCommandSelected(int);
- void slotHelpCommand();
- void slotXmlCommandToggled( bool );
-
-signals:
- void commandValid( bool );
-
-private:
- TQComboBox *m_cmd;
- TQLineEdit *m_line;
- TQCheckBox *m_usefilter;
- TQStringList m_cmdlist;
- TQLabel *m_shortinfo;
- TQPushButton *m_helpbtn;
- TQString m_help;
-};
-
-#endif
diff --git a/kdeprint/management/networkscanner.cpp b/kdeprint/management/networkscanner.cpp
deleted file mode 100644
index a52e66018..000000000
--- a/kdeprint/management/networkscanner.cpp
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001-2002 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#define USE_QSOCKET
-
-#include "networkscanner.h"
-
-#include <tqprogressbar.h>
-#include <kpushbutton.h>
-#include <tqlayout.h>
-#include <tqtimer.h>
-#include <tqlabel.h>
-#include <tqcombobox.h>
-#include <tqlineedit.h>
-#include <tqregexp.h>
-#include <tqsocket.h>
-#include <klocale.h>
-#include <kextendedsocket.h>
-#include <kmessagebox.h>
-#include <knumvalidator.h>
-#include <kdebug.h>
-#include <unistd.h>
-
-class NetworkScanner::NetworkScannerPrivate
-{
-public:
- int port;
- TQString prefixaddress;
- int currentaddress;
- int timeout;
- bool scanning;
- TQPtrList<NetworkScanner::SocketInfo> printers;
-
- TQProgressBar *bar;
- KPushButton *scan, *settings;
- TQLabel *subnetlab;
- TQTimer *timer;
-#ifdef USE_QSOCKET
- TQSocket *socket;
-#else
- KExtendedSocket *socket;
-#endif
-
- NetworkScannerPrivate( int portvalue ) : port( portvalue )
- {
- prefixaddress = localPrefix();
- currentaddress = 1;
- timeout = 50;
- scanning = false;
- printers.setAutoDelete( true );
- }
- TQString localPrefix();
- TQString scanString();
-};
-
-TQString NetworkScanner::NetworkScannerPrivate::localPrefix()
-{
- char buf[256];
- buf[0] = '\0';
- if (!gethostname(buf, sizeof(buf)))
- buf[sizeof(buf)-1] = '\0';
- TQPtrList<KAddressInfo> infos = KExtendedSocket::lookup(buf, TQString::null);
- infos.setAutoDelete(true);
- if (infos.count() > 0)
- {
- TQString IPstr = infos.first()->address()->nodeName();
- int p = IPstr.findRev('.');
- IPstr.truncate(p);
- return IPstr;
- }
- return TQString::null;
-}
-
-TQString NetworkScanner::NetworkScannerPrivate::scanString()
-{
- TQString s = prefixaddress + ".*";
- if ( port != -1 )
- s.append( ":" ).append( TQString::number( port ) );
- return s;
-}
-
-NetworkScanner::NetworkScanner( int port, TQWidget *parent, const char *name )
- : TQWidget( parent, name )
-{
- d = new NetworkScannerPrivate( port );
- d->bar = new TQProgressBar( 256, this );
- d->settings = new KPushButton( KGuiItem( i18n( "&Settings" ), "configure" ), this );
- d->scan = new KPushButton( KGuiItem( i18n( "Sc&an" ), "viewmag" ), this );
- d->timer = new TQTimer( this );
-#ifdef USE_QSOCKET
- d->socket = new TQSocket( TQT_TQOBJECT(this) );
-#else
- d->socket = new KExtendedSocket();
-#endif
- TQLabel *label = new TQLabel( i18n( "Network scan:" ), this );
- d->subnetlab = new TQLabel( i18n( "Subnet: %1" ).arg( d->scanString() ), this );
-
- TQGridLayout *l0 = new TQGridLayout( this, 4, 2, 0, 10 );
- l0->addMultiCellWidget( label, 0, 0, 0, 1 );
- l0->addMultiCellWidget( d->bar, 1, 1, 0, 1 );
- l0->addMultiCellWidget( d->subnetlab, 2, 2, 0, 1 );
- l0->addWidget( d->settings, 3, 0 );
- l0->addWidget( d->scan, 3, 1 );
-
- connect( d->timer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotTimeout() ) );
- connect( d->settings, TQT_SIGNAL( clicked() ), TQT_SLOT( slotSettingsClicked() ) );
- connect( d->scan, TQT_SIGNAL( clicked() ), TQT_SLOT( slotScanClicked() ) );
-#ifdef USE_QSOCKET
- connect( d->socket, TQT_SIGNAL( connected() ), TQT_SLOT( slotConnectionSuccess() ) );
- connect( d->socket, TQT_SIGNAL( error( int ) ), TQT_SLOT( slotConnectionFailed( int ) ) );
-#else
- connect( d->socket, TQT_SIGNAL( connectionSuccess() ), TQT_SLOT( slotConnectionSuccess() ) );
- connect( d->socket, TQT_SIGNAL( connectionFailed( int ) ), TQT_SLOT( slotConnectionFailed( int ) ) );
-#endif
-}
-
-NetworkScanner::~NetworkScanner()
-{
-#ifndef USE_QSOCKET
- delete d->socket;
-#endif
- delete d;
-}
-
-void NetworkScanner::start()
-{
- if ( d->scanning )
- return;
-
- d->printers.clear();
- emit scanStarted();
- d->settings->setEnabled( false );
- d->scan->setGuiItem( KGuiItem( i18n( "&Abort" ), "stop" ) );
- d->currentaddress = -1;
- d->scanning = true;
- next();
-}
-
-void NetworkScanner::slotScanClicked()
-{
- if ( !d->scanning )
- {
- if ( d->localPrefix() == d->prefixaddress ||
- KMessageBox::warningContinueCancel( this->parentWidget(),
- i18n( "You are about to scan a subnet (%1.*) that does not "
- "correspond to the current subnet of this computer (%2.*). Do you want "
- "to scan the specified subnet anyway?" ).arg( d->prefixaddress ).arg( d->localPrefix() ),
- TQString::null, KGuiItem( i18n( "&Scan" ), "viewmag" ), "askForScan" ) == KMessageBox::Continue )
- start();
- }
- else
- {
-#ifdef USE_QSOCKET
- d->socket->close();
-#else
- d->socket->cancelAsyncConnect();
-#endif
- finish();
- }
-}
-
-void NetworkScanner::finish()
-{
- if ( !d->scanning )
- return;
-
- d->settings->setEnabled( true );
- d->scan->setGuiItem( KGuiItem( i18n( "Sc&an" ), "viewmag" ) );
- d->bar->reset();
- d->scanning = false;
- emit scanFinished();
-}
-
-void NetworkScanner::slotSettingsClicked()
-{
- NetworkScannerConfig dlg( this );
- dlg.exec();
-}
-
-void NetworkScanner::slotNext()
-{
- if ( !d->scanning )
- return;
-
- d->timer->stop();
-#ifdef USE_QSOCKET
- d->socket->connectToHost( d->prefixaddress + "." + TQString::number( d->currentaddress ), d->port );
- kdDebug() << "Address: " << d->socket->peerName() << ", Port: " << d->socket->peerPort() << endl;
-#else
- d->socket->setAddress( d->prefixaddress + "." + TQString::number( d->currentaddress ), d->port );
- d->socket->startAsyncLookup();
- kdDebug() << "Address: " << d->socket->host() << ", Port: " << d->socket->port() << endl;
-#endif
- d->timer->start( d->timeout, true );
-}
-
-void NetworkScanner::next()
-{
- //kdDebug() << "Next" << endl;
- d->currentaddress++;
- if ( d->currentaddress >= 256 )
- finish();
- else
- {
- d->bar->setProgress( d->currentaddress );
- TQTimer::singleShot( 0, this, TQT_SLOT( slotNext() ) );
- }
-}
-
-void NetworkScanner::slotTimeout()
-{
- kdDebug() << "Timeout" << endl;
- if ( !d->scanning )
- return;
-
-#ifdef USE_QSOCKET
- d->socket->close();
-#else
- d->socket->cancelAsyncConnect();
-#endif
- next();
-}
-
-void NetworkScanner::slotConnectionSuccess()
-{
- kdDebug() << "Success" << endl;
-#ifdef USE_QSOCKET
- KSocketAddress *addr = KExtendedSocket::peerAddress( d->socket->socket() );
-#else
- KSocketAddress *addr = const_cast<KSocketAddress*>( d->socket->peerAddress() );
-#endif
- kdDebug() << "Connection success: " << ( addr ? addr->pretty() : TQString( "ERROR" ) ) << endl;
- kdDebug() << "Socket: " << d->socket->socket() << endl;
- if ( addr )
- {
- SocketInfo *info = new SocketInfo;
-#ifdef USE_QSOCKET
- info->IP = d->socket->peerName();
-#else
- info->IP = d->socket->host();
-#endif
- info->Port = d->port;
- TQString portname;
- KExtendedSocket::resolve( addr, info->Name, portname );
- d->printers.append( info );
- d->socket->close();
- delete addr;
- }
- else
- kdDebug() << "Unconnected socket, skipping" << endl;
- next();
-}
-
-void NetworkScanner::slotConnectionFailed( int )
-{
- kdDebug() << "Failure" << endl;
- next();
-}
-
-const TQPtrList<NetworkScanner::SocketInfo>* NetworkScanner::printerList()
-{
- return &( d->printers );
-}
-
-int NetworkScanner::timeout() const
-{
- return d->timeout;
-}
-
-void NetworkScanner::setTimeout( int to )
-{
- d->timeout = to;
-}
-
-TQString NetworkScanner::subnet() const
-{
- return d->prefixaddress;
-}
-
-void NetworkScanner::setSubnet( const TQString& sn )
-{
- d->prefixaddress = sn;
- d->subnetlab->setText( i18n( "Subnet: %1" ).arg( d->scanString() ) );
-}
-
-int NetworkScanner::port() const
-{
- return d->port;
-}
-
-void NetworkScanner::setPort( int p )
-{
- d->port = p;
- d->subnetlab->setText( i18n( "Subnet: %1" ).arg( d->scanString() ) );
-}
-
-bool NetworkScanner::checkPrinter( const TQString& host, int port )
-{
- // try first to find it in the SocketInfo list
- TQPtrListIterator<NetworkScanner::SocketInfo> it( d->printers );
- for ( ; it.current(); ++it )
- {
- if ( port == it.current()->Port && ( host == it.current()->IP ||
- host == it.current()->Name ) )
- return true;
- }
-
- // not found in SocketInfo list, try to establish connection
- KExtendedSocket extsock( host, port );
- extsock.setBlockingMode( false );
- extsock.setTimeout( 0, d->timeout * 1000 );
- return ( extsock.connect() == 0 );
-}
-
-NetworkScannerConfig::NetworkScannerConfig(NetworkScanner *scanner, const char *name)
- : KDialogBase(scanner, name, true, TQString::null, Ok|Cancel, Ok, true)
-{
- scanner_ = scanner;
- TQWidget *dummy = new TQWidget(this);
- setMainWidget(dummy);
- KIntValidator *val = new KIntValidator( this );
- TQLabel *masklabel = new TQLabel(i18n("&Subnetwork:"),dummy);
- TQLabel *portlabel = new TQLabel(i18n("&Port:"),dummy);
- TQLabel *toutlabel = new TQLabel(i18n("&Timeout (ms):"),dummy);
- TQLineEdit *mm = new TQLineEdit(dummy);
- mm->setText(TQString::tqfromLatin1(".[0-255]"));
- mm->setReadOnly(true);
- mm->setFixedWidth(fontMetrics().width(mm->text())+10);
-
- mask_ = new TQLineEdit(dummy);
- mask_->tqsetAlignment(Qt::AlignRight);
- port_ = new TQComboBox(true,dummy);
- if ( port_->lineEdit() )
- port_->lineEdit()->setValidator( val );
- tout_ = new TQLineEdit(dummy);
- tout_->setValidator( val );
-
- masklabel->setBuddy(mask_);
- portlabel->setBuddy(port_);
- toutlabel->setBuddy(tout_);
-
- mask_->setText(scanner_->subnet());
- port_->insertItem("631");
- port_->insertItem("9100");
- port_->insertItem("9101");
- port_->insertItem("9102");
- port_->setEditText(TQString::number(scanner_->port()));
- tout_->setText(TQString::number(scanner_->timeout()));
-
- TQGridLayout *main_ = new TQGridLayout(dummy, 3, 2, 0, 10);
- TQHBoxLayout *lay1 = new TQHBoxLayout(0, 0, 5);
- main_->addWidget(masklabel, 0, 0);
- main_->addWidget(portlabel, 1, 0);
- main_->addWidget(toutlabel, 2, 0);
- main_->addLayout(lay1, 0, 1);
- main_->addWidget(port_, 1, 1);
- main_->addWidget(tout_, 2, 1);
- lay1->addWidget(mask_,1);
- lay1->addWidget(mm,0);
-
- resize(250,130);
- setCaption(i18n("Scan Configuration"));
-}
-
-NetworkScannerConfig::~NetworkScannerConfig()
-{
-}
-
-void NetworkScannerConfig::slotOk()
-{
- TQString msg;
- TQRegExp re("(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})");
- if (!re.exactMatch(mask_->text()))
- msg = i18n("Wrong subnetwork specification.");
- else
- {
- for (int i=1; i<=3; i++)
- if (re.cap(i).toInt() >= 255)
- {
- msg = i18n("Wrong subnetwork specification.");
- break;
- }
- }
-
- bool ok(false);
- int v = tout_->text().toInt(&ok);
- if (!ok || v <= 0)
- msg = i18n("Wrong timeout specification.");
- v = port_->currentText().toInt(&ok);
- if (!ok || v <= 0)
- msg = i18n("Wrong port specification.");
- if (!msg.isEmpty())
- {
- KMessageBox::error(this,msg);
- return;
- }
-
- scanner_->setTimeout( tout_->text().toInt() );
- scanner_->setSubnet( mask_->text() );
- scanner_->setPort( port_->currentText().toInt() );
-
- KDialogBase::slotOk();
-}
-
-#include "networkscanner.moc"
diff --git a/kdeprint/management/networkscanner.h b/kdeprint/management/networkscanner.h
deleted file mode 100644
index 3d56bb03e..000000000
--- a/kdeprint/management/networkscanner.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001-2002 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef NETWORKSCANNER_H
-#define NETWORKSCANNER_H
-
-#include <tqwidget.h>
-#include <kdialogbase.h>
-#include <tqptrlist.h>
-
-
-class KDEPRINT_EXPORT NetworkScanner : public TQWidget
-{
- Q_OBJECT
-
-public:
- NetworkScanner( int port = 9100, TQWidget *parent = 0, const char *name = 0 );
- ~NetworkScanner();
-
- struct SocketInfo
- {
- TQString IP;
- TQString Name;
- int Port;
- };
-
- const TQPtrList<NetworkScanner::SocketInfo>* printerList();
-
- int timeout() const;
- void setTimeout( int to );
- TQString subnet() const;
- void setSubnet( const TQString& );
- int port() const;
- void setPort( int );
- bool checkPrinter( const TQString&, int );
-
-signals:
- void scanStarted();
- void scanFinished();
-
-protected slots:
- void slotConnectionSuccess();
- void slotConnectionFailed( int );
- void slotTimeout();
- void slotScanClicked();
- void slotSettingsClicked();
- void slotNext();
-
-protected:
- void next();
- void finish();
- void start();
-
-private:
- class NetworkScannerPrivate;
- NetworkScannerPrivate *d;
-};
-
-class TQLineEdit;
-class TQComboBox;
-
-class NetworkScannerConfig : public KDialogBase
-{
- Q_OBJECT
-
-public:
- NetworkScannerConfig(NetworkScanner *scanner, const char *name = 0);
- ~NetworkScannerConfig();
-
-protected slots:
- void slotOk();
-
-private:
- TQLineEdit *mask_, *tout_;
- TQComboBox *port_;
- NetworkScanner *scanner_;
-};
-
-#endif
diff --git a/kdeprint/management/pluginaction.cpp b/kdeprint/management/pluginaction.cpp
deleted file mode 100644
index 0aa3c10a3..000000000
--- a/kdeprint/management/pluginaction.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "pluginaction.h"
-
-// automatically connect to "pluginActionActived(int)" in the receiver.
-PluginAction::PluginAction(int ID, const TQString& txt, const TQString& icon, int accel, TQObject *parent, const char *name)
-: KAction(txt, icon, accel, parent, name), m_id(ID)
-{
- connect(this, TQT_SIGNAL(activated()), TQT_SLOT(slotActivated()));
-}
-
-void PluginAction::slotActivated()
-{
- emit activated(m_id);
-}
-
-#include "pluginaction.moc"
diff --git a/kdeprint/management/pluginaction.h b/kdeprint/management/pluginaction.h
deleted file mode 100644
index fb355b597..000000000
--- a/kdeprint/management/pluginaction.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef PLUGINACTION_H
-#define PLUGINACTION_H
-
-#include <kaction.h>
-
-class KDEPRINT_EXPORT PluginAction : public KAction
-{
- Q_OBJECT
-
-public:
- PluginAction(int ID, const TQString& txt, const TQString& icon, int accel, TQObject *parent = 0, const char *name = 0);
-
-signals:
- void activated(int);
-
-protected slots:
- void slotActivated();
-
-private:
- int m_id;
-};
-
-#endif
diff --git a/kdeprint/management/side.png b/kdeprint/management/side.png
deleted file mode 100644
index f7e978d27..000000000
--- a/kdeprint/management/side.png
+++ /dev/null
Binary files differ
diff --git a/kdeprint/management/sidepixmap.cpp b/kdeprint/management/sidepixmap.cpp
deleted file mode 100644
index 8824dd5fc..000000000
--- a/kdeprint/management/sidepixmap.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "sidepixmap.h"
-
-#include <tqpainter.h>
-#include <kstandarddirs.h>
-
-SidePixmap::SidePixmap(TQWidget *parent, const char *name)
-: TQFrame(parent, name)
-{
- setLineWidth(1);
- setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
-
- m_side.load(locate("data", "tdeprint/side.png"));
- m_tileup.load(locate("data", "tdeprint/tileup.png"));
- m_tiledown.load(locate("data", "tdeprint/tiledown.png"));
-
- tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Minimum));
-}
-
-bool SidePixmap::isValid()
-{
- return (!m_side.isNull() && !m_tileup.isNull() && !m_tiledown.isNull()
- && (m_side.width() == m_tileup.width())
- && (m_side.width() == m_tiledown.width()));
-}
-
-TQSize SidePixmap::tqsizeHint() const
-{
- return (TQSize(m_side.width()+lineWidth(), 300+lineWidth()));
-}
-
-void SidePixmap::drawContents(TQPainter *p)
-{
- QRect r = contentsRect();
- if (r.height() <= m_side.height())
- {
- // case where the main pixmap is enough, just center it
- int yoffset = (m_side.height()-r.height())/2;
- p->drawPixmap(r.left(), r.top(), m_side, 0, yoffset, r.width(), r.height());
- }
- else
- {
- // we need to add tiled pixmap. Make sure we have a multiple
- // of 3 in the space above to simplifu tiling.
- int hh = (((r.height()-m_side.height())/2)/3)*3;
- if (hh > 0)
- p->drawTiledPixmap(r.left(), r.top(), r.width(), hh, m_tileup);
- p->drawPixmap(r.left(), r.top()+hh, m_side);
- p->drawTiledPixmap(r.left(), r.top()+m_side.height()+hh, r.width(), r.height()-m_side.height()-hh, m_tiledown);
- }
-}
diff --git a/kdeprint/management/sidepixmap.h b/kdeprint/management/sidepixmap.h
deleted file mode 100644
index a9730883e..000000000
--- a/kdeprint/management/sidepixmap.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef SIDEPIXMAP_H
-#define SIDEPIXMAP_H
-
-#include <tqframe.h>
-#include <tqpixmap.h>
-
-#include <kdelibs_export.h>
-
-class KDEPRINT_EXPORT SidePixmap : public TQFrame
-{
-public:
- SidePixmap(TQWidget *parent = 0, const char *name = 0);
- TQSize tqsizeHint() const;
- bool isValid();
-
-protected:
- void drawContents(TQPainter*);
-
-private:
- QPixmap m_side, m_tileup, m_tiledown;
-};
-
-#endif
diff --git a/kdeprint/management/smbview.cpp b/kdeprint/management/smbview.cpp
deleted file mode 100644
index fde3a3451..000000000
--- a/kdeprint/management/smbview.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#include "smbview.h"
-
-#include <kprocess.h>
-#include <ktempfile.h>
-#include <tqheader.h>
-#include <tqapplication.h>
-
-#include <kiconloader.h>
-#include <klocale.h>
-#include <kdebug.h>
-#include <kmessagebox.h>
-#include <kcursor.h>
-
-#include <tqfile.h>
-#include <tqtextstream.h>
-#include <cstdlib>
-
-
-//*********************************************************************************************
-
-SmbView::SmbView(TQWidget *parent, const char *name)
-: KListView(parent,name)
-{
- addColumn(i18n("Printer"));
- addColumn(i18n("Comment"));
- setFrameStyle(TQFrame::WinPanel|TQFrame::Sunken);
- setLineWidth(1);
- setAllColumnsShowFocus(true);
- setRootIsDecorated(true);
-
- m_state = Idle;
- m_current = 0;
- m_proc = new KProcess();
- m_proc->setUseShell(true);
- m_passwdFile = 0;
- connect(m_proc,TQT_SIGNAL(processExited(KProcess*)),TQT_SLOT(slotProcessExited(KProcess*)));
- connect(m_proc,TQT_SIGNAL(receivedStdout(KProcess*,char*,int)),TQT_SLOT(slotReceivedStdout(KProcess*,char*,int)));
- connect(this,TQT_SIGNAL(selectionChanged(TQListViewItem*)),TQT_SLOT(slotSelectionChanged(TQListViewItem*)));
-}
-
-SmbView::~SmbView()
-{
- delete m_proc;
- delete m_passwdFile;
-}
-
-void SmbView::setLoginInfos(const TQString& login, const TQString& password)
-{
- m_login = login;
- m_password = password;
-
- // We can't pass the password via the command line or the environment
- // because the command line is publically accessible on most OSes and
- // the environment is publically accessible on some OSes.
- // Therefor we write the password to a file and pass that file to
- // smbclient with the -A option
- delete m_passwdFile;
- m_passwdFile = new KTempFile;
- m_passwdFile->setAutoDelete(true);
-
- TQTextStream *passwdFile = m_passwdFile->textStream();
- if (!passwdFile) return; // Error
- (*passwdFile) << "username = " << m_login << endl;
- (*passwdFile) << "password = " << m_password << endl;
- // (*passwdFile) << "domain = " << ???? << endl;
-
- m_passwdFile->close();
-}
-
-void SmbView::startProcess(int state)
-{
- m_buffer = TQString::null;
- m_state = state;
- TQApplication::setOverrideCursor(KCursor::waitCursor());
- m_proc->start(KProcess::NotifyOnExit,KProcess::Stdout);
- emit running(true);
-}
-
-void SmbView::endProcess()
-{
- switch (m_state)
- {
- case GroupListing:
- processGroups();
- break;
- case ServerListing:
- processServers();
- break;
- case ShareListing:
- processShares();
- break;
- default:
- break;
- }
- m_state = Idle;
- TQApplication::restoreOverrideCursor();
- emit running(false);
- // clean up for future usage
- m_proc->clearArguments();
-}
-
-void SmbView::slotProcessExited(KProcess*)
-{
- endProcess();
-}
-
-void SmbView::slotReceivedStdout(KProcess*, char *buf, int len)
-{
- m_buffer.append(TQString::fromLocal8Bit(buf,len));
-}
-
-void SmbView::init()
-{
- // Open Samba configuration file and check if a WINS server is defined
- m_wins_server = TQString::null;
- TQString wins_keyword("wins server");
- TQFile smb_conf ("/etc/samba/smb.conf");
- if (smb_conf.exists () && smb_conf.open (IO_ReadOnly))
- {
- TQTextStream smb_stream (&smb_conf);
- while (!smb_stream.atEnd ())
- {
- TQString smb_line = smb_stream.readLine ();
- if (smb_line.contains (wins_keyword, FALSE) > 0)
- {
- TQString key = smb_line.section ('=', 0, 0);
- key = key.stripWhiteSpace();
- if (key.lower() == wins_keyword)
- {
- continue;
- }
- m_wins_server = smb_line.section ('=', 1, 1);
- // take only the first declared WINS server
- m_wins_server = m_wins_server.section(',', 0, 0);
- m_wins_server = m_wins_server.stripWhiteSpace ();
- m_wins_server = m_wins_server.section(' ', 0, 0);
- // strip any server tag (see man smb.conf(5))
- if (m_wins_server.section(':', 1, 1) != NULL)
- {
- m_wins_server = m_wins_server.section(':', 1, 1);
- }
- break;
- }
- }
- smb_conf.close ();
- }
- m_wins_server = m_wins_server.isEmpty ()? " " : " -U " + m_wins_server + " ";
- TQString cmd ("nmblookup" + m_wins_server +
- "-M -- - | grep '<01>' | awk '{print $1}' | xargs nmblookup -A | grep '<1d>'");
- *m_proc << cmd;
- startProcess(GroupListing);
-}
-
-void SmbView::setOpen(TQListViewItem *item, bool on)
-{
- if (on && item->childCount() == 0)
- {
- if (item->depth() == 0)
- { // opening group
- m_current = item;
- *m_proc << "nmblookup"+m_wins_server+"-M ";
- *m_proc << KProcess::quote(item->text(0));
- *m_proc << " -S";
- startProcess(ServerListing);
- }
- else if (item->depth() == 1)
- { // opening server
- char *krb5ccname = getenv ("KRB5CCNAME");
- m_current = item;
- if (krb5ccname)
- {
- *m_proc << "smbclient -k -N -L ";
- }
- else
- {
- *m_proc << "smbclient -N -L ";
- }
- *m_proc << KProcess::quote (item->text (0));
- *m_proc << " -W ";
- *m_proc << KProcess::quote (item->parent ()->
- text (0));
- if (!krb5ccname)
- {
- *m_proc << " -A ";
- *m_proc << KProcess::
- quote (m_passwdFile->name ());
- }
- startProcess(ShareListing);
- }
- }
- TQListView::setOpen(item,on);
-}
-
-void SmbView::processGroups()
-{
- TQStringList grps = TQStringList::split('\n',m_buffer,false);
- clear();
- for (TQStringList::ConstIterator it=grps.begin(); it!=grps.end(); ++it)
- {
- int p = (*it).find("<1d>");
- if (p == -1)
- continue;
- TQListViewItem *item = new TQListViewItem(this,(*it).left(p).stripWhiteSpace());
- item->setExpandable(true);
- item->setPixmap(0,SmallIcon("network"));
- }
-}
-
-void SmbView::processServers()
-{
- TQStringList lines = TQStringList::split('\n',m_buffer,true);
- TQString line;
- uint index(0);
- while (index < lines.count())
- {
- line = lines[index++].stripWhiteSpace();
- if (line.isEmpty())
- break;
- TQStringList words = TQStringList::split(' ',line,false);
- if (words[1] != "<00>" || words[3] == "<GROUP>")
- continue;
- TQListViewItem *item = new TQListViewItem(m_current,words[0]);
- item->setExpandable(true);
- item->setPixmap(0,SmallIcon("tdeprint_computer"));
- }
-}
-
-void SmbView::processShares()
-{
- TQStringList lines = TQStringList::split('\n',m_buffer,true);
- TQString line;
- uint index(0);
- for (;index < lines.count();index++)
- if (lines[index].stripWhiteSpace().startsWith("Sharename"))
- break;
- index += 2;
- while (index < lines.count())
- {
- line = lines[index++].stripWhiteSpace();
- if (line.isEmpty())
- break;
- else if ( line.startsWith( "Error returning" ) )
- {
- KMessageBox::error( this, line );
- break;
- }
- TQString typestr(line.mid(15, 10).stripWhiteSpace());
- //TQStringList words = TQStringList::split(' ',line,false);
- //if (words[1] == "Printer")
- if (typestr == "Printer")
- {
- TQString comm(line.mid(25).stripWhiteSpace()), sharen(line.mid(0, 15).stripWhiteSpace());
- //for (uint i=2; i<words.count(); i++)
- // comm += (words[i]+" ");
- //TQListViewItem *item = new TQListViewItem(m_current,words[0],comm);
- TQListViewItem *item = new TQListViewItem(m_current,sharen,comm);
- item->setPixmap(0,SmallIcon("tdeprint_printer"));
- }
- }
-}
-
-void SmbView::slotSelectionChanged(TQListViewItem *item)
-{
- if (item && item->depth() == 2)
- emit printerSelected(item->parent()->parent()->text(0),item->parent()->text(0),item->text(0));
-}
-
-void SmbView::abort()
-{
- if (m_proc->isRunning())
- m_proc->kill();
-}
-#include "smbview.moc"
diff --git a/kdeprint/management/smbview.h b/kdeprint/management/smbview.h
deleted file mode 100644
index aea1d920d..000000000
--- a/kdeprint/management/smbview.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * This file is part of the KDE libraries
- * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- **/
-
-#ifndef SMBVIEW_H
-#define SMBVIEW_H
-
-#include <klistview.h>
-
-class KProcess;
-class KTempFile;
-
-class SmbView : public KListView
-{
- Q_OBJECT
-public:
- SmbView(TQWidget *parent = 0, const char *name = 0);
- ~SmbView();
-
- void setLoginInfos(const TQString& login, const TQString& password);
- void setOpen(TQListViewItem*, bool);
- void init();
- void abort();
-
-signals:
- void printerSelected(const TQString& work, const TQString& server, const TQString& printer);
- void running(bool);
-
-protected:
- void startProcess(int);
- void endProcess();
- void processGroups();
- void processServers();
- void processShares();
-
-protected slots:
- void slotReceivedStdout(KProcess*, char*, int);
- void slotProcessExited(KProcess*);
- void slotSelectionChanged(TQListViewItem*);
-
-private:
- enum State { GroupListing, ServerListing, ShareListing, Idle };
- int m_state;
- TQListViewItem *m_current;
- KProcess *m_proc;
- TQString m_buffer;
- TQString m_login, m_password;
- KTempFile *m_passwdFile;
- TQString m_wins_server;
-};
-
-#endif
diff --git a/kdeprint/management/tiledown.png b/kdeprint/management/tiledown.png
deleted file mode 100644
index 71af44b99..000000000
--- a/kdeprint/management/tiledown.png
+++ /dev/null
Binary files differ
diff --git a/kdeprint/management/tileup.png b/kdeprint/management/tileup.png
deleted file mode 100644
index cf63939a3..000000000
--- a/kdeprint/management/tileup.png
+++ /dev/null
Binary files differ