diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-06 15:56:40 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-06 15:56:40 -0600 |
commit | e16866e072f94410321d70daedbcb855ea878cac (patch) | |
tree | ee3f52eabde7da1a0e6ca845fb9c2813cf1558cf /kdeprint/cups/cupsdconf2 | |
parent | a58c20c1a7593631a1b50213c805507ebc16adaf (diff) | |
download | tdelibs-e16866e072f94410321d70daedbcb855ea878cac.tar.gz tdelibs-e16866e072f94410321d70daedbcb855ea878cac.zip |
Actually move the kde files that were renamed in the last commit
Diffstat (limited to 'kdeprint/cups/cupsdconf2')
51 files changed, 0 insertions, 6543 deletions
diff --git a/kdeprint/cups/cupsdconf2/CMakeLists.txt b/kdeprint/cups/cupsdconf2/CMakeLists.txt deleted file mode 100644 index ceee1bc47..000000000 --- a/kdeprint/cups/cupsdconf2/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -################################################# -# -# (C) 2010 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${TQT_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR}/tdecore - ${CMAKE_SOURCE_DIR}/tdecore - ${CMAKE_SOURCE_DIR}/tdeui - ${CMAKE_SOURCE_DIR}/kio - ${CMAKE_SOURCE_DIR}/kio/kio - ${CMAKE_SOURCE_DIR}/kio/kfile -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES - kde_logo.png cups_logo.png cupsd.conf.template - DESTINATION ${DATA_INSTALL_DIR}/tdeprint ) - - -#### cupsdconf ################################## - -set( target cupsdconf ) - -set( ${target}_SRCS - cupsdconf.cpp cupsddialog.cpp cupsdpage.cpp cupsdcomment.cpp - cupsdsplash.cpp cupsdserverpage.cpp cupsdlogpage.cpp - cupsdjobspage.cpp cupsdfilterpage.cpp qdirlineedit.cpp - cupsddirpage.cpp portdialog.cpp cupsdnetworkpage.cpp - editlist.cpp cupsdbrowsingpage.cpp browsedialog.cpp - cupsdsecuritypage.cpp locationdialog.cpp addressdialog.cpp - cups-util.c qdirmultilineedit.cpp sizewidget.cpp main.cpp -) - -tde_add_tdeinit_executable( ${target} AUTOMOC - SOURCES ${${target}_SRCS} - LINK kio-shared ${CUPS_LIBRARIES} -) diff --git a/kdeprint/cups/cupsdconf2/Makefile.am b/kdeprint/cups/cupsdconf2/Makefile.am deleted file mode 100644 index 434af6a3c..000000000 --- a/kdeprint/cups/cupsdconf2/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -#$Id$ - -INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/kio -I$(top_srcdir)/kfile $(all_includes) - -bin_PROGRAMS = -lib_LTLIBRARIES = -tdeinit_LTLIBRARIES = cupsdconf.la - -# library creation -cupsdconf_la_SOURCES = cupsdconf.cpp cupsddialog.cpp cupsdpage.cpp cupsdcomment.cpp cupsdsplash.cpp \ - cupsdserverpage.cpp cupsdlogpage.cpp cupsdjobspage.cpp cupsdfilterpage.cpp \ - qdirlineedit.cpp cupsddirpage.cpp portdialog.cpp cupsdnetworkpage.cpp \ - editlist.cpp cupsdbrowsingpage.cpp browsedialog.cpp cupsdsecuritypage.cpp \ - locationdialog.cpp addressdialog.cpp cups-util.c \ - qdirmultilineedit.cpp sizewidget.cpp main.cpp -cupsdconf_la_METASOURCES = AUTO -cupsdconf_la_LDFLAGS = -avoid-version -module $(all_libraries) $(KDE_RPATH) -cupsdconf_la_LIBADD = $(LIB_KIO) $(LIB_CUPS) $(LIB_QT) $(LIB_KDEUI) $(LIB_KDECORE) - -noinst_HEADERS = cupsdconf.h cupsdpage.h cupsddialog.h cupsdcomment.h cupsdsplash.h \ - cupsdserverpage.h cupsdlogpage.h cupsdjobspage.h cupsdfilterpage.h \ - qdirlineedit.h cupsddirpage.h portdialog.h cupsdnetworkpage.h \ - editlist.h cupsdbrowsingpage.h browsedialog.h cupsdsecuritypage.h \ - locationdialog.h addressdialog.h cups-util.h qdirmultilineedit.h \ - sizewidget.h - -# Data -cupsdconfdata_DATA = kde_logo.png cups_logo.png cupsd.conf.template -cupsdconfdatadir = $(kde_datadir)/tdeprint - -# Translations -messages: - perl cupsdcomment.pl < cupsd.conf.template > cupsd.conf.template.txt - $(XGETTEXT) *.cpp -o $(podir)/cupsdconf.pot - rm -f cupsd.conf.template.txt diff --git a/kdeprint/cups/cupsdconf2/addressdialog.cpp b/kdeprint/cups/cupsdconf2/addressdialog.cpp deleted file mode 100644 index fab6a6fba..000000000 --- a/kdeprint/cups/cupsdconf2/addressdialog.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 "addressdialog.h" - -#include <tqcombobox.h> -#include <tqlineedit.h> -#include <tqlabel.h> -#include <tqlayout.h> - -#include <klocale.h> - -AddressDialog::AddressDialog(TQWidget *parent, const char *name) - : KDialogBase(Swallow, i18n("ACL Address"), Ok|Cancel, Ok, parent, name, true, true) -{ - TQWidget *w = new TQWidget(this); - type_ = new TQComboBox(w); - address_ = new TQLineEdit(w); - - type_->insertItem(i18n("Allow")); - type_->insertItem(i18n("Deny")); - - TQLabel *l1 = new TQLabel(i18n("Type:"), w); - TQLabel *l2 = new TQLabel(i18n("Address:"), w); - - TQGridLayout *m1 = new TQGridLayout(w, 2, 2, 0, 5); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(type_, 0, 1); - m1->addWidget(address_, 1, 1); - - setMainWidget(w); - resize(300, 100); -} - -TQString AddressDialog::addressString() -{ - TQString s; - if (type_->currentItem() == 0) - s.append("Allow "); - else - s.append("Deny "); - if (address_->text().isEmpty()) - s.append("All"); - else - s.append(address_->text()); - return s; -} - -TQString AddressDialog::newAddress(TQWidget *parent) -{ - AddressDialog dlg(parent); - if (dlg.exec()) - return dlg.addressString(); - else - return TQString::null; -} - -TQString AddressDialog::editAddress(const TQString& addr, TQWidget *parent) -{ - AddressDialog dlg(parent); - int p = addr.find(' '); - if (p != -1) - { - dlg.type_->setCurrentItem(addr.left(p).lower() == "deny" ? 1 : 0); - dlg.address_->setText(addr.mid(p+1)); - } - if (dlg.exec()) - return dlg.addressString(); - else - return TQString::null; -} diff --git a/kdeprint/cups/cupsdconf2/addressdialog.h b/kdeprint/cups/cupsdconf2/addressdialog.h deleted file mode 100644 index 7fdb6fb6f..000000000 --- a/kdeprint/cups/cupsdconf2/addressdialog.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 ADDRESSDIALOG_H -#define ADDRESSDIALOG_H - -#include <kdialogbase.h> - -class TQComboBox; -class TQLineEdit; - -class AddressDialog : public KDialogBase -{ -public: - AddressDialog(TQWidget *parent = 0, const char *name = 0); - - TQString addressString(); - static TQString newAddress(TQWidget *parent = 0); - static TQString editAddress(const TQString& s, TQWidget *parent = 0); - -private: - TQComboBox *type_; - TQLineEdit *address_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/browsedialog.cpp b/kdeprint/cups/cupsdconf2/browsedialog.cpp deleted file mode 100644 index b337eb883..000000000 --- a/kdeprint/cups/cupsdconf2/browsedialog.cpp +++ /dev/null @@ -1,150 +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 "browsedialog.h" -#include "cupsdconf.h" - -#include <tqlineedit.h> -#include <tqpushbutton.h> -#include <tqcombobox.h> -#include <tqlabel.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> -#include <tqregexp.h> - -#include <klocale.h> - -BrowseDialog::BrowseDialog(TQWidget *parent, const char *name) - : KDialogBase(parent, name, true, TQString::null, Ok|Cancel, Ok, true) -{ - TQWidget *dummy = new TQWidget(this); - setMainWidget(dummy); - type_ = new TQComboBox(dummy); - from_ = new TQLineEdit(dummy); - to_ = new TQLineEdit(dummy); - type_->insertItem(i18n("Send")); - type_->insertItem(i18n("Allow")); - type_->insertItem(i18n("Deny")); - type_->insertItem(i18n("Relay")); - type_->insertItem(i18n("Poll")); - - TQLabel *l1 = new TQLabel(i18n("Type:"), dummy); - TQLabel *l2 = new TQLabel(i18n("From:"), dummy); - TQLabel *l3 = new TQLabel(i18n("To:"), dummy); - - TQGridLayout *m1 = new TQGridLayout(dummy, 3, 2, 0, 5); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(l3, 2, 0, Qt::AlignRight); - m1->addWidget(type_, 0, 1); - m1->addWidget(from_, 1, 1); - m1->addWidget(to_, 2, 1); - - connect(type_, TQT_SIGNAL(activated(int)), TQT_SLOT(slotTypeChanged(int))); - slotTypeChanged(type_->currentItem()); - - setCaption(i18n("Browse Address")); - resize(250, 100); -} - -TQString BrowseDialog::addressString() -{ - TQString s; - switch (type_->currentItem()) - { - case 0: - s.append("Send"); - break; - case 1: - s.append("Allow"); - break; - case 2: - s.append("Deny"); - break; - case 3: - s.append("Relay"); - break; - case 4: - s.append("Poll"); - break; - } - if (from_->isEnabled()) - s.append(" ").append(from_->text()); - if (to_->isEnabled()) - s.append(" ").append(to_->text()); - return s; -} - -void BrowseDialog::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(type_, conf->comments_.toolTip("browsetype")); -} - -TQString BrowseDialog::newAddress(TQWidget *parent, CupsdConf *conf) -{ - BrowseDialog dlg(parent); - dlg.setInfos(conf); - if (dlg.exec()) - { - return dlg.addressString(); - } - return TQString::null; -} - -TQString BrowseDialog::editAddress(const TQString& s, TQWidget *parent, CupsdConf *conf) -{ - BrowseDialog dlg(parent); - dlg.setInfos(conf); - TQStringList l = TQStringList::split(TQRegExp("\\s"), s, false); - if (l.count() > 1) - { - if (l[0] == "Send") dlg.type_->setCurrentItem(0); - else if (l[0] == "Allow") dlg.type_->setCurrentItem(1); - else if (l[0] == "Deny") dlg.type_->setCurrentItem(2); - else if (l[0] == "Relay") dlg.type_->setCurrentItem(3); - else if (l[0] == "Poll") dlg.type_->setCurrentItem(4); - dlg.slotTypeChanged(dlg.type_->currentItem()); - int index(1); - if (dlg.from_->isEnabled()) - dlg.from_->setText(l[index++]); - if (dlg.to_->isEnabled()) - dlg.to_->setText(l[index]); - } - if (dlg.exec()) - { - return dlg.addressString(); - } - return TQString::null; -} - -void BrowseDialog::slotTypeChanged(int index) -{ - bool useFrom(true), useTo(true); - switch (index) - { - case 0: useFrom = false; break; - case 1: - case 4: - case 2: useTo = false; break; - } - from_->setEnabled(useFrom); - to_->setEnabled(useTo); -} - -#include "browsedialog.moc" diff --git a/kdeprint/cups/cupsdconf2/browsedialog.h b/kdeprint/cups/cupsdconf2/browsedialog.h deleted file mode 100644 index 8db12bc34..000000000 --- a/kdeprint/cups/cupsdconf2/browsedialog.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 BROWSEDIALOG_H -#define BROWSEDIALOG_H - -#include <kdialogbase.h> - -class TQLineEdit; -class TQComboBox; -struct CupsdConf; - -class BrowseDialog : public KDialogBase -{ - Q_OBJECT - -public: - BrowseDialog(TQWidget *parent = 0, const char *name = 0); - - TQString addressString(); - void setInfos(CupsdConf*); - static TQString newAddress(TQWidget *parent = 0, CupsdConf *conf = 0); - static TQString editAddress(const TQString& s, TQWidget *parent = 0, CupsdConf *conf = 0); - -protected slots: - void slotTypeChanged(int); - -private: - TQComboBox *type_; - TQLineEdit *from_, *to_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cups-util.c b/kdeprint/cups/cupsdconf2/cups-util.c deleted file mode 100644 index eadd6b629..000000000 --- a/kdeprint/cups/cupsdconf2/cups-util.c +++ /dev/null @@ -1,557 +0,0 @@ -#include <stdio.h> -#include <cups/ipp.h> -#include <cups/http.h> -#include <cups/cups.h> -#include <stdlib.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <unistd.h> - -#define CUPS_SERVERROOT "/etc/cups" -static http_t *cups_server; -static ipp_status_t last_error; -static char authstring[HTTP_MAX_VALUE]; -static char pwdstring[33]; -static int cups_local_auth(http_t *http); - -const char* cupsGetConf( void ); -int cupsPutConf( const char* ); - -const char * /* O - Filename for PPD file */ -cupsGetConf(void) -{ - int fd; /* PPD file */ - int bytes; /* Number of bytes read */ - char buffer[8192]; /* Buffer for file */ - char resource[HTTP_MAX_URI]; /* Resource name */ - const char *password; /* Password string */ - char realm[HTTP_MAX_VALUE], /* realm="xyz" string */ - nonce[HTTP_MAX_VALUE], /* nonce="xyz" string */ - plain[255], /* Plaintext username:password */ - encode[512]; /* Encoded username:password */ - http_status_t status; /* HTTP status from server */ - char prompt[1024]; /* Prompt string */ - int digest_tries; /* Number of tries with Digest */ - static char filename[HTTP_MAX_URI]; /* Local filename */ -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - const char *fqdn = 0; -#else - char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ -#endif - - - /* - * Connect to the correct server as needed... - */ - - if ((cups_server = httpConnectEncrypt(cupsServer(), ippPort(), - cupsEncryption())) == NULL) - { - last_error = IPP_SERVICE_UNAVAILABLE; - return (NULL); - } - - /* - * Get a temp file... - */ - - if ((fd = cupsTempFd(filename, sizeof(filename))) < 0) - { - /* - * Can't open file; close the server connection and return NULL... - */ - - httpFlush(cups_server); - httpClose(cups_server); - cups_server = NULL; - return (NULL); - } - - /* - * And send a request to the HTTP server... - */ - - snprintf(resource, sizeof(resource), "/admin/conf/cupsd.conf"); - - digest_tries = 0; - - do - { - httpClearFields(cups_server); - httpSetField(cups_server, HTTP_FIELD_HOST, cupsServer()); - httpSetField(cups_server, HTTP_FIELD_AUTHORIZATION, authstring); - - if (httpGet(cups_server, resource)) - { - if (httpReconnect(cups_server)) - { - status = HTTP_ERROR; - break; - } - else - { - status = HTTP_UNAUTHORIZED; - continue; - } - } - - while ((status = httpUpdate(cups_server)) == HTTP_CONTINUE); - - if (status == HTTP_UNAUTHORIZED) - { - const char *www_authenticate; - fprintf(stderr,"cupsGetConf: unauthorized...\n"); - - /* - * Flush any error message... - */ - - httpFlush(cups_server); - - /* - * See if we can do local authentication... - */ - - if (cups_local_auth(cups_server)) - continue; - - /* - * See if we should retry the current digest password... - */ - -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; -#else - www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); -#endif - if (strncmp(www_authenticate, "Basic", 5) == 0 || - digest_tries > 1 || !pwdstring[0]) - { - /* - * Nope - get a password from the user... - */ -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - fqdn = cups_server->hostname; -#else - httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); -#endif - - snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(), fqdn ); - - if ((password = cupsGetPassword(prompt)) == NULL) - break; - if (!password[0]) - break; - - strncpy(pwdstring, password, sizeof(pwdstring) - 1); - pwdstring[sizeof(pwdstring) - 1] = '\0'; - - digest_tries = 0; - } - else - digest_tries ++; - - /* - * Got a password; encode it for the server... - */ - -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; -#else - www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); -#endif - if (strncmp(www_authenticate, "Basic", 5) == 0) - { - /* - * Basic authentication... - */ - - snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); -#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 - httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); -#else - httpEncode64(encode, plain); -#endif - snprintf(authstring, sizeof(authstring), "Basic %s", encode); - } - else - { - /* - * Digest authentication... - */ - - httpGetSubField(cups_server, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm); - httpGetSubField(cups_server, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce); - - httpMD5(cupsUser(), realm, pwdstring, encode); - httpMD5Final(nonce, "GET", resource, encode); - snprintf(authstring, sizeof(authstring), - "Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", " - "response=\"%s\"", cupsUser(), realm, nonce, encode); - } - - continue; - } -#ifdef HAVE_LIBSSL - else if (status == HTTP_UPGRADE_REQUIRED) - { - /* - * Flush any error message... - */ - - httpFlush(cups_server); - - /* - * Upgrade with encryption... - */ - - httpEncryption(cups_server, HTTP_ENCRYPT_REQUIRED); - - /* - * Try again, this time with encryption enabled... - */ - - continue; - } -#endif /* HAVE_LIBSSL */ - } - while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED); - - /* - * See if we actually got the file or an error... - */ - - if (status != HTTP_OK) - { - close(fd); - unlink(filename); - httpFlush(cups_server); - httpClose(cups_server); - cups_server = NULL; - return (NULL); - } - - /* - * OK, we need to copy the file... - */ - - while ((bytes = -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - httpRead -#else - httpRead2 -#endif - (cups_server, buffer, sizeof(buffer))) > 0) - { - write(fd, buffer, bytes); - } - - close(fd); - - return (filename); -} - -int /* O - Status of operation */ -cupsPutConf(const char *name) /* I - Name of the config file to send */ -{ - int fd; /* PPD file */ - int bytes; /* Number of bytes read */ - char buffer[8192]; /* Buffer for file */ - char resource[HTTP_MAX_URI]; /* Resource name */ - const char *password; /* Password string */ - char realm[HTTP_MAX_VALUE], /* realm="xyz" string */ - nonce[HTTP_MAX_VALUE], /* nonce="xyz" string */ - plain[255], /* Plaintext username:password */ - encode[512]; /* Encoded username:password */ - http_status_t status; /* HTTP status from server */ - char prompt[1024]; /* Prompt string */ - int digest_tries; /* Number of tries with Digest */ -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - const char *fqdn = 0; -#else - char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ -#endif - - if (name == NULL) - return 0; - - /* - * Connect to the correct server as needed... - */ - - if ((cups_server = httpConnectEncrypt(cupsServer(), ippPort(), - cupsEncryption())) == NULL) - { - last_error = IPP_SERVICE_UNAVAILABLE; - return 0; - } - - /* - * Open the local config file... - */ - - if ((fd = open(name, O_RDONLY)) < 0) - { - /* - * Can't open file; close the server connection and return NULL... - */ - - httpFlush(cups_server); - httpClose(cups_server); - cups_server = NULL; - return 0; - } - - /* - * And send a request to the HTTP server... - */ - - strncpy(resource, "/admin/conf/cupsd.conf", sizeof(resource)); - - digest_tries = 0; - - do - { - httpClearFields(cups_server); - httpSetField(cups_server, HTTP_FIELD_HOST, cupsServer()); - httpSetField(cups_server, HTTP_FIELD_AUTHORIZATION, authstring); - httpSetField(cups_server, HTTP_FIELD_TRANSFER_ENCODING, "chunked"); - - if (httpPut(cups_server, resource)) - { - if (httpReconnect(cups_server)) - { - status = HTTP_ERROR; - break; - } - else - { - status = HTTP_UNAUTHORIZED; - continue; - } - } - - /* send the file now */ - lseek(fd, 0, SEEK_SET); - status = HTTP_CONTINUE; - while ((bytes = read(fd, buffer, sizeof(buffer))) > 0) - if (httpCheck(cups_server)) - { - if ((status = httpUpdate(cups_server)) != HTTP_CONTINUE) - break; - } - else -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - httpWrite -#else - httpWrite2 -#endif - (cups_server, buffer, bytes); - - if (status == HTTP_CONTINUE) - { -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - httpWrite -#else - httpWrite2 -#endif - (cups_server, buffer, 0); - while ((status = httpUpdate(cups_server)) == HTTP_CONTINUE); - } - - if (status == HTTP_UNAUTHORIZED) - { - const char *www_authenticate; - fprintf(stderr,"cupsPutConf: unauthorized..."); - - /* - * Flush any error message... - */ - - httpFlush(cups_server); - - /* - * See if we can do local authentication... - */ - - if (cups_local_auth(cups_server)) - continue; - - /* - * See if we should retry the current digest password... - */ - -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; -#else - www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); -#endif - if (strncmp(www_authenticate, "Basic", 5) == 0 || - digest_tries > 1 || !pwdstring[0]) - { - /* - * Nope - get a password from the user... - */ - - -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - fqdn = cups_server->hostname; -#else - httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); -#endif - snprintf(prompt, sizeof(prompt), "Password for %s on %s? ", cupsUser(), fqdn ); - - if ((password = cupsGetPassword(prompt)) == NULL) - break; - if (!password[0]) - break; - - strncpy(pwdstring, password, sizeof(pwdstring) - 1); - pwdstring[sizeof(pwdstring) - 1] = '\0'; - - digest_tries = 0; - } - else - digest_tries ++; - - /* - * Got a password; encode it for the server... - */ - -#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 - www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; -#else - www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); -#endif - if (strncmp(www_authenticate, "Basic", 5) == 0) - { - /* - * Basic authentication... - */ - - snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); -#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 - httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); -#else - httpEncode64(encode, plain); -#endif - snprintf(authstring, sizeof(authstring), "Basic %s", encode); - } - else - { - /* - * Digest authentication... - */ - - httpGetSubField(cups_server, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm); - httpGetSubField(cups_server, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce); - - httpMD5(cupsUser(), realm, pwdstring, encode); - httpMD5Final(nonce, "GET", resource, encode); - snprintf(authstring, sizeof(authstring), - "Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", " - "response=\"%s\"", cupsUser(), realm, nonce, encode); - } - - continue; - } -#ifdef HAVE_LIBSSL - else if (status == HTTP_UPGRADE_REQUIRED) - { - /* - * Flush any error message... - */ - - httpFlush(cups_server); - - /* - * Upgrade with encryption... - */ - - httpEncryption(cups_server, HTTP_ENCRYPT_REQUIRED); - - /* - * Try again, this time with encryption enabled... - */ - - continue; - } -#endif /* HAVE_LIBSSL */ - } - while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED); - - /* - * See if we actually got the file or an error... - */ - - if (status != HTTP_CREATED) - { - httpFlush(cups_server); - httpClose(cups_server); - cups_server = NULL; - close(fd); - return 0; - } - - close(fd); - - return 1; -} - -static int /* O - 1 if available, 0 if not */ -cups_local_auth(http_t *http) /* I - Connection */ -{ - int pid; /* Current process ID */ - FILE *fp; /* Certificate file */ - char filename[1024], /* Certificate filename */ - certificate[33];/* Certificate string */ - const char *root; /* Server root directory */ - - - /* - * See if we are accessing localhost... - the struct has changed in newer versions - PiggZ (adam@piggz.co.uk) - */ -#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 - if (!httpAddrLocalhost(http)) -#else - if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 && - strcasecmp(http->hostname, "localhost") != 0) -#endif - return (0); - - /* - * Try opening a certificate file for this PID. If that fails, - * try the root certificate... - */ - - if ((root = getenv("CUPS_SERVERROOT")) == NULL) - root = CUPS_SERVERROOT; - - pid = getpid(); - snprintf(filename, sizeof(filename), "%s/certs/%d", root, pid); - if ((fp = fopen(filename, "r")) == NULL && pid > 0) - { - snprintf(filename, sizeof(filename), "%s/certs/0", root); - fp = fopen(filename, "r"); - } - - if (fp == NULL) - return (0); - - /* - * Read the certificate from the file... - */ - - fgets(certificate, sizeof(certificate), fp); - fclose(fp); - - /* - * Set the authorization string and return... - */ - - snprintf(authstring, sizeof(authstring), "Local %s", certificate); - - return (1); -} - diff --git a/kdeprint/cups/cupsdconf2/cups-util.h b/kdeprint/cups/cupsdconf2/cups-util.h deleted file mode 100644 index 9c23c0c5e..000000000 --- a/kdeprint/cups/cupsdconf2/cups-util.h +++ /dev/null @@ -1,26 +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 CUPS_UTIL_H -#define CUPS_UTIL_H - -const char* cupsGetConf(void); -int cupsPutConf(const char *filename); - -#endif diff --git a/kdeprint/cups/cupsdconf2/cups_logo.png b/kdeprint/cups/cupsdconf2/cups_logo.png Binary files differdeleted file mode 100644 index e6f9b5919..000000000 --- a/kdeprint/cups/cupsdconf2/cups_logo.png +++ /dev/null diff --git a/kdeprint/cups/cupsdconf2/cupsd.conf.template b/kdeprint/cups/cupsdconf2/cupsd.conf.template deleted file mode 100644 index 08d4b9425..000000000 --- a/kdeprint/cups/cupsdconf2/cupsd.conf.template +++ /dev/null @@ -1,977 +0,0 @@ -%%header -# CUPS configuration file, generated by CUPS configuration tool. -# This tool is part of KDEPrint, the printing framework for KDE -# since version 2.2.2 and is used by the CUPS supporting module -# in KDEPrint. The predecessors to KDEPrint in former KDE releases -# were KUPS and QtCUPS; they are deprecated and no longer maintained. -# -# Author: Michael Goffioul <tdeprint@swing.be> -# -# Web site: http://printing.kde.org/ -# -######################################################################## -# # -# This is the CUPS configuration file. If you are familiar with # -# Apache or any of the other popular web servers, we've followed the # -# same format. Any configuration variable used here has the same # -# semantics as the corresponding variable in Apache. If we need # -# different functionality then a different name is used to avoid # -# confusion... # -# # -######################################################################## -@@ - -%%servername -# <b>Server name (ServerName)</b> -# <p> -# The hostname of your server, as advertised to the world. -# By default CUPS will use the hostname of the system.</p> -# <p> -# To set the default server used by clients, see the client.conf file.</p> -# <p> -# <i>ex</i>: myhost.domain.com</p> -$$ -#ServerName myhost.domain.com -@@ - -%%serveradmin -# <b>Server administrator (ServerAdmin)</b> -# <p> -# The email address to send all complaints or problems to. -# By default CUPS will use "root@hostname".</p> -# <p> -# <i>ex</i>: root@myhost.com</p> -$$ -#ServerAdmin root@your.domain.com -@@ - -%%accesslog -# <b>Access log (AccessLog)</b> -# <p> -# The access log file; if this does not start with a leading / -# then it is assumed to be relative to ServerRoot. By default set to -# "/var/log/cups/access_log".</p> -# <p> -# You can also use the special name <b>syslog</b> to send the output to the -# syslog file or daemon.</p> -# <p> -# <i>ex</i>: /var/log/cups/access_log</p> -$$ -#AccessLog /var/log/cups/access_log -@@ - -%%datadir -# <b>Data directory (DataDir)</b> -# <p> -# The root directory for the CUPS data files. -# By default /usr/share/cups.</p> -# <p> -# <i>ex</i>: /usr/share/cups</p> -$$ -#DataDir /usr/share/cups -@@ - -%%defaultcharset -# <b>Default character set (DefaultCharset)</b> -# <p> -# The default character set to use. If not specified, -# defaults to utf-8. Note that this can also be overridden in -# HTML documents...</p> -# <p> -# <i>ex</i>: utf-8</p> -$$ -#DefaultCharset utf-8 -@@ - -%%defaultlanguage -# <b>Default language (DefaultLanguage)</b> -# <p> -# The default language if not specified by the browser. -# If not specified, the current locale is used.</p> -# <p> -# <i>ex</i>: en</p> -$$ -#DefaultLanguage en -@@ - -%%documentroot -# <b>Document directory (DocumentRoot)</b> -# <p> -# The root directory for HTTP documents that are served. -# By default the compiled-in directory.</p> -# <p> -# <i>ex</i>: /usr/share/cups/doc-root</p> -$$ -#DocumentRoot /usr/share/cups/doc-root -@@ - -%%errorlog -# <b>Error log (ErrorLog)</b> -# <p> -# The error log file; if this does not start with a leading / -# then it is assumed to be relative to ServerRoot. By default set to -# "/var/log/cups/error_log".</p> -# <p> -# You can also use the special name <b>syslog</b> to send the output to the -# syslog file or daemon.</p> -# <p> -# <i>ex</i>: /var/log/cups/error_log</p> -$$ -#ErrorLog /var/log/cups/error_log -@@ - -%%fontpath -# <b>Font path (FontPath)</b> -# <p> -# The path to locate all font files (currently only for pstoraster). -# By default /usr/share/cups/fonts.</p> -# <p> -# <i>ex</i>: /usr/share/cups/fonts</p> -$$ -#FontPath /usr/share/cups/fonts -@@ - -%%loglevel -# <b>Log level (LogLevel)</b> -# <p> -# Controls the number of messages logged to the ErrorLog -# file and can be one of the following:</p> -# <ul type=circle> -# <li><i>debug2</i>: Log everything.</li> -# <li><i>debug</i>: Log almost everything.</li> -# <li><i>info</i>: Log all requests and state changes.</li> -# <li><i>warn</i>: Log errors and warnings.</li> -# <li><i>error</i>: Log only errors.</li> -# <li><i>none</i>: Log nothing.</li> -# </ul><p> -# <i>ex</i>: info</p> -$$ -#LogLevel info -@@ - -%%maxlogsize -# <b>Max log size (MaxLogSize)</b> -# <p> -# Controls the maximum size of each log file before they are -# rotated. Defaults to 1048576 (1MB). Set to 0 to disable log rotating.</p> -# <p> -# <i>ex</i>: 1048576</p> -$$ -#MaxLogSize 0 -@@ - -%%pagelog -# <b>Page log (PageLog)</b> -# <p> -# The page log file; if this does not start with a leading / -# then it is assumed to be relative to ServerRoot. By default set to -# "/var/log/cups/page_log".</p> -# <p> -# You can also use the special name <b>syslog</b> to send the output to the -# syslog file or daemon.</p> -# <p> -# <i>ex</i>: /var/log/cups/page_log</p> -$$ -#PageLog /var/log/cups/page_log -@@ - -%%preservejobhistory -# <b>Preserve job history (PreserveJobHistory)</b> -# <p> -# Whether or not to preserve the job history after a -# job is completed, canceled, or stopped. Default is Yes.</p> -# <p> -# <i>ex</i>: Yes</p> -$$ -#PreserveJobHistory Yes -@@ - -%%preservejobfiles -# <b>Preserve job files (PreserveJobFiles)</b> -# <p> -# Whether or not to preserve the job files after a -# job is completed, canceled, or stopped. Default is No.</p> -# <p> -# <i>ex</i>: No</p> -$$ -#PreserveJobFiles No -@@ - -%%printcap -# <b>Printcap file (Printcap)</b> -# <p> -# The name of the printcap file. Default is no filename. -# Leave blank to disable printcap file generation.</p> -# <p> -# <i>ex</i>: /etc/printcap</p> -$$ -#Printcap /etc/printcap -@@ - -%%requestroot -# <b>Request directory (RequestRoot)</b> -# <p> -# The directory where request files are stored. -# By default /var/spool/cups.</p> -# <p> -# <i>ex</i>: /var/spool/cups</p> -$$ -#RequestRoot /var/spool/cups -@@ - -%%remoteroot -# <b>Remote root user (RemoteRoot)</b> -# <p> -# The name of the user assigned to unauthenticated accesses -# from remote systems. By default "remroot".</p> -# <p> -# <i>ex</i>: remroot</p> -$$ -#RemoteRoot remroot -@@ - -%%serverbin -# <b>Server binaries (ServerBin)</b> -# <p> -# The root directory for the scheduler executables. -# By default /usr/lib/cups or /usr/lib32/cups (IRIX 6.5).</p> -# <p> -# <i>ex</i>: /usr/lib/cups</p> -$$ -#ServerBin /usr/lib/cups -@@ - -%%serverroot -# <b>Server files (ServerRoot)</b> -# <p> -# The root directory for the scheduler. -# By default /etc/cups.</p> -# <p> -# <i>ex</i>: /etc/cups</p> -$$ -#ServerRoot /etc/cups -@@ - -%%user -# <b>User (User)</b> -# <p> -# The user the server runs under. Normally this -# must be <b>lp</b>, however you can configure things for another user -# as needed.</p> -# <p> -# Note: the server must be run initially as root to support the -# default IPP port of 631. It changes users whenever an external -# program is run...</p> -# <p> -# <i>ex</i>: lp</p> -$$ -#User lp -@@ - -%%group -# <b>Group (Group)</b> -# <p> -# The group the server runs under. Normally this -# must be <b>lpadmin</b>, however you can configure things for another -# group as needed.</p> -# <p> -# <i>ex</i>: lpadmin</p> -$$ -#Group lpadmin -@@ - -%%ripcache -# <b>RIP cache (RIPCache)</b> -# <p> -# The amount of memory that each RIP should use to cache -# bitmaps. The value can be any real number followed by "k" for -# kilobytes, "m" for megabytes, "g" for gigabytes, or "t" for tiles -# (1 tile = 256x256 pixels). Defaults to "8m" (8 megabytes).</p> -# <p> -# <i>ex</i>: 8m</p> -$$ -#RIPCache 8m -@@ - -%%tempdir -# <b>Temporary files (TempDir)</b> -# <p> -# The directory to put temporary files in. This directory must be -# writable by the user defined above! Defaults to "/var/spool/cups/tmp" or -# the value of the TMPDIR environment variable.</p> -# <p> -# <i>ex</i>: /var/spool/cups/tmp</p> -$$ -#TempDir /var/spool/cups/tmp -@@ - -%%filterlimit -# <b>Filter limit (FilterLimit)</b> -# <p> -# Sets the maximum cost of all job filters that can be run -# at the same time. A limit of 0 means no limit. A typical job may need -# a filter limit of at least 200; limits less than the minimum required -# by a job force a single job to be printed at any time.</p> -# <p> -# The default limit is 0 (unlimited).</p> -# <p> -# <i>ex</i>: 200</p> -$$ -#FilterLimit 0 -@@ - -%%listen -# <b>Listen to (Port/Listen)</b> -# <p> -# Ports/addresses that are listened to. The default port 631 is reserved -# for the Internet Printing Protocol (IPP) and is what is used here.</p> -# <p> -# You can have multiple Port/Listen lines to listen to more than one -# port or address, or to restrict access.</p> -# <p> -# Note: Unfortunately, most web browsers don't support TLS or HTTP Upgrades -# for encryption. If you want to support web-based encryption you will -# probably need to listen on port 443 (the "HTTPS" port...).</p> -# <p> -# <i>ex</i>: 631, myhost:80, 1.2.3.4:631</p> -$$ -# Port 80 -# Port 631 -# Listen hostname -# Listen hostname:80 -# Listen hostname:631 -# Listen 1.2.3.4 -# Listen 1.2.3.4:631 -# -#Port 631 -@@ - -%%hostnamelookups -# <b>Hostname lookups (HostNameLookups)</b> -# <p> -# Whether or not to do lookups on IP addresses to get a -# fully-qualified hostname. This defaults to Off for performance reasons...</p> -# <p> -# <i>ex</i>: On</p> -$$ -#HostNameLookups On -@@ - -%%keepalive -# <b>Keep alive (KeepAlive)</b> -# <p> -# Whether or not to support the Keep-Alive connection -# option. Default is on.</p> -# <p> -# <i>ex</i>: On</p> -$$ -#KeepAlive On -@@ - -%%keepalivetimeout -# <b>Keep-alive timeout (KeepAliveTimeout)</b> -# <p> -# The timeout (in seconds) before Keep-Alive connections are -# automatically closed. Default is 60 seconds.</p> -# <p> -# <i>ex</i>: 60</p> -$$ -#KeepAliveTimeout 60 -@@ - -%%maxclients -# <b>Max clients (MaxClients)</b> -# <p> -# Controls the maximum number of simultaneous clients that -# will be handled. Defaults to 100.</p> -# <p> -# <i>ex</i>: 100</p> -$$ -#MaxClients 100 -@@ - -%%maxrequestsize -# <b>Max request size (MaxRequestSize)</b> -# <p> -# Controls the maximum size of HTTP requests and print files. -# Set to 0 to disable this feature (defaults to 0).</p> -# <p> -# <i>ex</i>: 0</p> -$$ -#MaxRequestSize 0 -@@ - -%%timeout -# <b>Client timeout (Timeout)</b> -# <p> -# The timeout (in seconds) before requests time out. Default is 300 seconds.</p> -# <p> -# <i>ex</i>: 300</p> -$$ -#Timeout 300 -@@ - -%%browsing -# <b>Use browsing (Browsing)</b> -# <p> -# Whether or not to <b>listen</b> to printer -# information from other CUPS servers. -# </p> -# <p> -# Enabled by default. -# </p> -# <p> -# Note: to enable the <b>sending</b> of browsing -# information from this CUPS server to the LAN, -# specify a valid <i>BrowseAddress</i>. -# </p> -# <p> -# <i>ex</i>: On</p> -$$ -#Browsing On -@@ - -%%browseshortnames -# <b>Use short names (BrowseShortNames)</b> -# <p> -# Whether or not to use "short" names for remote printers -# when possible (e.g. "printer" instead of "printer@host"). Enabled by -# default.</p> -# <p> -# <i>ex</i>: Yes</p> -$$ -#BrowseShortNames Yes -@@ - -%%browseaddress -# <b>Browse addresses (BrowseAddress)</b> -# <p> -# Specifies a broadcast address to be used. By -# default browsing information is broadcast to all active interfaces.</p> -# <p> -# Note: HP-UX 10.20 and earlier do not properly handle broadcast unless -# you have a Class A, B, C, or D netmask (i.e. no CIDR support).</p> -# <p> -# <i>ex</i>: x.y.z.255, x.y.255.255</p> -$$ -#BrowseAddress x.y.z.255 -#BrowseAddress x.y.255.255 -#BrowseAddress x.255.255.255 -@@ - -%%browseallow -# <b>Browse allow/deny (BrowseAllow/BrowseDeny)</b> -# <p> -# <u>BrowseAllow</u>: specifies an address mask to allow for incoming browser -# packets. The default is to allow packets from all addresses.</p> -# <p> -# <u>BrowseDeny</u>: specifies an address mask to deny for incoming browser -# packets. The default is to deny packets from no addresses.</p> -# <p> -# Both "BrowseAllow" and "BrowseDeny" accept the following notations for -# addresses:</p> -# <pre> -# All -# None -# *.domain.com -# .domain.com -# host.domain.com -# nnn.* -# nnn.nnn.* -# nnn.nnn.nnn.* -# nnn.nnn.nnn.nnn -# nnn.nnn.nnn.nnn/mm -# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm -# </pre><p> -# The hostname/domainname restrictions only work if you have turned hostname -# lookups on!</p> -$$ -#BrowseAllow address -#BrowseDeny address -@@ - -%%browseinterval -# <b>Browse interval (BrowseInterval)</b> -# <p> -# The time between browsing updates in seconds. Default -# is 30 seconds.</p> -# <p> -# Note that browsing information is sent whenever a printer's state changes -# as well, so this represents the maximum time between updates.</p> -# <p> -# Set this to 0 to disable outgoing broadcasts so your local printers are -# not advertised but you can still see printers on other hosts.</p> -# <p> -# <i>ex</i>: 30</p> -$$ -#BrowseInterval 30 -@@ - -%%browseorder -# <b>Browse order (BrowseOrder)</b> -# <p> -# Specifies the order of BrowseAllow/BrowseDeny comparisons.</p> -# <p> -# <i>ex</i>: allow,deny</p> -$$ -#BrowseOrder allow,deny -#BrowseOrder deny,allow -@@ - -%%browsepoll -# <b>Browse poll (BrowsePoll)</b> -# <p> -# Poll the named server(s) for printers.</p> -# <p> -# <i>ex</i>: myhost:631</p> -$$ -#BrowsePoll address:port -@@ - -%%browseport -# <b>Browse port (BrowsePort)</b> -# <p> -# The port used for UDP broadcasts. By default this is -# the IPP port; if you change this you need to do it on all servers. -# Only one BrowsePort is recognized.</p> -# <p> -# <i>ex</i>: 631</p> -$$ -#BrowsePort 631 -@@ - -%%browserelay -# <b>Browse relay (BrowseRelay)</b> -# <p> -# Relay browser packets from one address/network to another.</p> -# <p> -# <i>ex</i>: src-address dest-address</p> -$$ -#BrowseRelay source-address destination-address -@@ - -%%browsetimeout -# <b>Browse timeout (BrowseTimeout)</b> -# <p> -# The timeout (in seconds) for network printers - if we don't -# get an update within this time the printer will be removed -# from the printer list. This number definitely should not be -# less the BrowseInterval value for obvious reasons. Defaults -# to 300 seconds.</p> -# <p> -# <i>ex</i>: 300</p> -$$ -#BrowseTimeout 300 -@@ - -%%implicitclasses -# <b>Implicit classes (ImplicitClasses)</b> -# <p> -# Whether or not to use implicit classes.</p> -# <p> -# Printer classes can be specified explicitly in the classes.conf -# file, implicitly based upon the printers available on the LAN, or -# both.</p> -# <p> -# When ImplicitClasses is On, printers on the LAN with the same name -# (e.g. Acme-LaserPrint-1000) will be put into a class with the same -# name. This allows you to setup multiple redundant queues on a LAN -# without a lot of administrative difficulties. If a user sends a -# job to Acme-LaserPrint-1000, the job will go to the first available -# queue.</p> -# <p> -# Enabled by default.</p> -$$ -#ImplicitClasses Off -@@ - -%%systemgroup -# <b>System group (SystemGroup)</b> -# <p> -# The group name for "System" (printer administration) -# access. The default varies depending on the operating system, but -# will be <b>sys</b>, <b>system</b>, or <b>root</b> (checked for in that order).</p> -# <p> -# <i>ex</i>: lpadmin</p> -$$ -#SystemGroup lpadmin -@@ - -%%servercertificate -# <b>Encryption certificate (ServerCertificate)</b> -# <p> -# The file to read containing the server's certificate. -# Defaults to "/etc/cups/ssl/server.crt".</p> -# <p> -# <i>ex</i>: /etc/cups/ssl/server.crt</p> -$$ -#ServerCertificate /etc/cups/ssl/server.crt -@@ - -%%serverkey -# <b>Encryption key (ServerKey)</b> -# <p> -# The file to read containing the server's key. -# Defaults to "/etc/cups/ssl/server.key".</p> -# <p> -# <i>ex</i>: /etc/cups/ssl/server.key</p> -$$ -#ServerKey /etc/cups/ssl/server.key -@@ - -%%locations -# Access permissions -# -# Access permissions for each directory served by the scheduler. -# Locations are relative to DocumentRoot... -# -# AuthType: the authorization to use: -# -# None - Perform no authentication -# Basic - Perform authentication using the HTTP Basic method. -# Digest - Perform authentication using the HTTP Digest method. -# -# (Note: local certificate authentication can be substituted by -# the client for Basic or Digest when connecting to the -# localhost interface) -# -# AuthClass: the authorization class; currently only Anonymous, User, -# System (valid user belonging to group SystemGroup), and Group -# (valid user belonging to the specified group) are supported. -# -# AuthGroupName: the group name for "Group" authorization. -# -# Order: the order of Allow/Deny processing. -# -# Allow: allows access from the specified hostname, domain, IP address, or -# network. -# -# Deny: denies access from the specified hostname, domain, IP address, or -# network. -# -# Both "Allow" and "Deny" accept the following notations for addresses: -# -# All -# None -# *.domain.com -# .domain.com -# host.domain.com -# nnn.* -# nnn.nnn.* -# nnn.nnn.nnn.* -# nnn.nnn.nnn.nnn -# nnn.nnn.nnn.nnn/mm -# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm -# -# The host and domain address require that you enable hostname lookups -# with "HostNameLookups On" above. -# -# Encryption: whether or not to use encryption; this depends on having -# the OpenSSL library linked into the CUPS library and scheduler. -# -# Possible values: -# -# Always - Always use encryption (SSL) -# Never - Never use encryption -# Required - Use TLS encryption upgrade -# IfRequested - Use encryption if the server requests it -# -# The default value is "IfRequested". -$$ -#<Location [resource_name]> -# -# You may wish to limit access to printers and classes, either with Allow -# and Deny lines, or by requiring a username and password. -# -# -## Anonymous access (default) -#AuthType None -# -## Require a username and password (Basic authentication) -#AuthType Basic -#AuthClass User -# -## Require a username and password (Digest/MD5 authentication) -#AuthType Digest -#AuthClass User -# -## Restrict access to local domain -#Order Deny,Allow -#Deny From All -#Allow From .mydomain.com -# -## Use encryption if requested -#Encryption IfRequested -#</Location> -@@ - -%%authtype -# <b>Authentication (AuthType)</b> -# <p> -# The authorization to use:<p> -# <ul type=circle> -# <li><i>None</i> - Perform no authentication.</li> -# <li><i>Basic</i> - Perform authentication using the HTTP Basic method.</li> -# <li><i>Digest</i> - Perform authentication using the HTTP Digest method.</li> -# </ul><p> -# Note: local certificate authentication can be substituted by -# the client for <i>Basic</i> or <i>Digest</i> when connecting to the -# localhost interface.</p> -@@ - -%%authclass -# <b>Class (AuthClass)</b> -# <p> -# The authorization class; currently only <i>Anonymous</i>, <i>User</i>, -# <i>System</i> (valid user belonging to group SystemGroup), and <i>Group</i> -# (valid user belonging to the specified group) are supported.</p> -@@ - -%%authname -# <p>The user/group names allowed to access the resource. The format is a -# comma separated list.</p> -@@ - -%%satisfy -# <b>Satisfy (Satisfy)</b> -# <p> -# This directive controls whether all specified conditions must -# be satisfied to allow access to the resource. If set to "all", -# then all authentication and access control conditions must be -# satisfied to allow access. -# </p> -# <p> -# Setting Satisfy to "any" allows a user to gain access if the -# authentication <i>or</i> access control requirements are satisfied. -# For example, you might require authentication for remote access, -# but allow local access without authentication. -# </p> -# <p> -# The default is "all". -# </p> -@@ - -%%authgroupname -# <b>Authentication group name (AuthGroupName)</b> -# <p> -# The group name for <i>Group</i> authorization.</p> -@@ - -%%order -# <b>ACL order (Order)</b> -# <p> -# The order of Allow/Deny processing.</p> -@@ - -%%allow -# <b>Allow</b> -# <p> -# Allows access from the specified hostname, domain, IP address, or -# network. Possible values are:</p> -# <pre> -# All -# None -# *.domain.com -# .domain.com -# host.domain.com -# nnn.* -# nnn.nnn.* -# nnn.nnn.nnn.* -# nnn.nnn.nnn.nnn -# nnn.nnn.nnn.nnn/mm -# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm -# </pre><p> -# The host and domain address require that you enable hostname lookups -# with "HostNameLookups On" above.</p> -@@ - -%%allowdeny -# <b>ACL addresses (Allow/Deny)</b> -# <p> -# Allows/Denies access from the specified hostname, domain, IP address, or -# network. Possible values are:</p> -# <pre> -# All -# None -# *.domain.com -# .domain.com -# host.domain.com -# nnn.* -# nnn.nnn.* -# nnn.nnn.nnn.* -# nnn.nnn.nnn.nnn -# nnn.nnn.nnn.nnn/mm -# nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm -# </pre><p> -# The host and domain address require that you enable hostname lookups -# with "HostNameLookups On" above.</p> -@@ - -%%encryption -# <b>Encryption (Encryption)</b> -# <p> -# Whether or not to use encryption; this depends on having -# the OpenSSL library linked into the CUPS library and scheduler.</p> -# <p> -# Possible values:</p> -# <ul type=circle> -# <li><i>Always</i> - Always use encryption (SSL)</li> -# <li><i>Never</i> - Never use encryption</li> -# <li><i>Required</i> - Use TLS encryption upgrade</li> -# <li><i>IfRequested</i> - Use encryption if the server requests it</li> -# </ul><p> -# The default value is "IfRequested".</p> -@@ - -%%locationsshort -# <b>Access permissions</b> -# <p> -# Access permissions for each directory served by the scheduler. -# Locations are relative to DocumentRoot...</p> -@@ - -%%autopurgejobs -# <b>Auto purge jobs (AutoPurgeJobs)</b> -# <p> -# Automatically purge jobs when not needed for quotas. -# Default is No.</p> -$$ -#AutoPurgeJobs No -@@ - -%%browseprotocols -# <b>Browse protocols (BrowseProtocols)</b> -# <p> -# Which protocols to use for browsing. Can be -# any of the following separated by whitespace and/or commas:</p> -# <ul type=circle> -# <li><i>all</i> - Use all supported protocols.</li> -# <li><i>cups</i> - Use the CUPS browse protocol.</li> -# <li><i>slp</i> - Use the SLPv2 protocol.</li> -# </ul><p> -# The default is <b>cups</b>.</p> -# <p> -# Note: If you choose to use SLPv2, it is <b>strongly</b> recommended that -# you have at least one SLP Directory Agent (DA) on your -# network. Otherwise, browse updates can take several seconds, -# during which the scheduler will not response to client -# requests.</p> -$$ -#BrowseProtocols cups -@@ - -%%classification -# <b>Classification (Classification)</b> -# <p> -# The classification level of the server. If set, this -# classification is displayed on all pages, and raw printing is disabled. -# The default is the empty string.</p> -# <p> -# <i>ex</i>: confidential -$$ -#Classification classified -@@ - -%%classifyoverride -# <b>Allow overrides (ClassifyOverride)</b> -# <p> -# Whether to allow users to override the classification -# on printouts. If enabled, users can limit banner pages to before or -# after the job, and can change the classification of a job, but cannot -# completely eliminate the classification or banners.</p> -# <p> -# The default is off.</p> -$$ -#ClassifyOverride off -@@ - -%%hideimplicitmembers -# <b>Hide implicit members (HideImplicitMembers)</b> -# <p> -# Whether or not to show the members of an -# implicit class.</p> -# <p> -# When HideImplicitMembers is On, any remote printers that are -# part of an implicit class are hidden from the user, who will -# then only see a single queue even though many queues will be -# supporting the implicit class.</p> -# <p> -# Enabled by default.</p> -$$ -#HideImplicitMembers On -@@ - -%%implicitanyclasses -# <b>Use "any" classes (ImplicitAnyClasses)</b> -# <p> -# Whether or not to create <b>AnyPrinter</b> implicit -# classes.</p> -# <p> -# When ImplicitAnyClasses is On and a local queue of the same name -# exists, e.g. "printer", "printer@server1", "printer@server1", then -# an implicit class called "Anyprinter" is created instead.</p> -# <p> -# When ImplicitAnyClasses is Off, implicit classes are not created -# when there is a local queue of the same name.</p> -# <p> -# Disabled by default.</p> -$$ -#ImplicitAnyCLasses Off -@@ - -%%maxjobs -# <b>Max jobs (MaxJobs)</b> -# <p> -# Maximum number of jobs to keep in memory (active and completed). -# Default is 0 (no limit).</p> -$$ -#MaxJobs 0 -@@ - -%%maxjobsperuser -# <b>Max jobs per user (MaxJobsPerUser)</b> -# <p> -# The MaxJobsPerUser directive controls the maximum number of <i>active</i> -# jobs that are allowed for each user. Once a user reaches the limit, new -# jobs will be rejected until one of the active jobs is completed, stopped, -# aborted, or canceled.</p> -# <p> -# Setting the maximum to 0 disables this functionality. -# Default is 0 (no limit). -# </p> -$$ -#MaxJobsPerUser 0 -@@ - -%%maxjobsperprinter -# <b>Max jobs per printer (MaxJobsPerPrinter)</b> -# <p> -# The MaxJobsPerPrinter directive controls the maximum number of <i>active</i> -# jobs that are allowed for each printer or class. Once a printer or class -# reaches the limit, new jobs will be rejected until one of the active jobs -# is completed, stopped, aborted, or canceled.</p> -# <p> -# Setting the maximum to 0 disables this functionality. -# Default is 0 (no limit). -# </p> -$$ -#MaxJobsPerPrinter 0 -@@ - -%%port -# <b>Port</b> -# <p> -# The port value that the CUPS daemon is listening to. Default is 631.</p> -@@ - -%%address -# <b>Address</b> -# <p> -# The address that the CUPS daemon is listening at. Leave it empty or use -# an asterisk (*) to specify a port value on the entire subnetwork.</p> -@@ - -%%usessl -# <p>Check this box if you want to use SSL encryption with this address/port. -# </p> -@@ diff --git a/kdeprint/cups/cupsdconf2/cupsdbrowsingpage.cpp b/kdeprint/cups/cupsdconf2/cupsdbrowsingpage.cpp deleted file mode 100644 index 4b056cdb0..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdbrowsingpage.cpp +++ /dev/null @@ -1,210 +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 "cupsdbrowsingpage.h" -#include "cupsdconf.h" -#include "editlist.h" -#include "browsedialog.h" - -#include <tqlabel.h> -#include <tqlayout.h> -#include <tqcheckbox.h> -#include <tqcombobox.h> -#include <tqwhatsthis.h> - -#include <klocale.h> -#include <knuminput.h> - -CupsdBrowsingPage::CupsdBrowsingPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Browsing")); - setHeader(i18n("Browsing Settings")); - setPixmap("tdeprint_printer_remote"); - - browseinterval_ = new KIntNumInput(this); - browseport_ = new KIntNumInput(this); - browsetimeout_ = new KIntNumInput(this); - browsing_ = new TQCheckBox(i18n("Use browsing"), this); - cups_ = new TQCheckBox("CUPS", this); - slp_ = new TQCheckBox("SLP", this); - browseaddresses_ = new EditList(this); - browseorder_ = new TQComboBox(this); - useimplicitclasses_ = new TQCheckBox(i18n("Implicit classes"), this); - hideimplicitmembers_ = new TQCheckBox(i18n("Hide implicit members"), this); - useshortnames_ = new TQCheckBox(i18n("Use short names"), this); - useanyclasses_ = new TQCheckBox(i18n("Use \"any\" classes"), this); - - browseorder_->insertItem(i18n("Allow, Deny")); - browseorder_->insertItem(i18n("Deny, Allow")); - - browseport_->setRange(0, 9999, 1, true); - browseport_->setSteps(1, 5); - browseinterval_->setRange(0, 10000, 1, true); - browseinterval_->setSteps(1, 10); - browseinterval_->setSuffix(i18n(" sec")); - browsetimeout_->setRange(0, 10000, 1, true); - browsetimeout_->setSteps(1, 10); - browsetimeout_->setSuffix(i18n(" sec")); - - TQLabel *l1 = new TQLabel(i18n("Browse port:"), this); - TQLabel *l2 = new TQLabel(i18n("Browse interval:"), this); - TQLabel *l3 = new TQLabel(i18n("Browse timeout:"), this); - TQLabel *l4 = new TQLabel(i18n("Browse addresses:"), this); - TQLabel *l5 = new TQLabel(i18n("Browse order:"), this); - TQLabel *l6 = new TQLabel(i18n("Browse options:"), this); - - TQGridLayout *m1 = new TQGridLayout(this, 8, 2, 10, 7); - m1->setRowStretch(7, 1); - m1->setColStretch(1, 1); - TQHBoxLayout *m2 = new TQHBoxLayout(0, 0, 10); - m1->addMultiCellLayout(m2, 0, 0, 0, 1); - m2->addWidget(browsing_); - m2->addWidget(cups_); - m2->addWidget(slp_); - m2->addStretch(1); - m1->addWidget(l1, 1, 0, Qt::AlignRight); - m1->addWidget(l2, 2, 0, Qt::AlignRight); - m1->addWidget(l3, 3, 0, Qt::AlignRight); - m1->addWidget(l4, 4, 0, Qt::AlignRight|Qt::AlignTop); - m1->addWidget(l5, 5, 0, Qt::AlignRight); - m1->addWidget(l6, 6, 0, Qt::AlignRight|Qt::AlignTop); - m1->addWidget(browseport_, 1, 1); - m1->addWidget(browseinterval_, 2, 1); - m1->addWidget(browsetimeout_, 3, 1); - m1->addWidget(browseaddresses_, 4, 1); - m1->addWidget(browseorder_, 5, 1); - TQGridLayout *m3 = new TQGridLayout(0, 2, 2, 0, 5); - m1->addLayout(m3, 6, 1); - m3->addWidget(useimplicitclasses_, 0, 0); - m3->addWidget(useanyclasses_, 0, 1); - m3->addWidget(hideimplicitmembers_, 1, 0); - m3->addWidget(useshortnames_, 1, 1); - - connect(browsing_, TQT_SIGNAL(toggled(bool)), cups_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), slp_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), browseport_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), browseinterval_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), browsetimeout_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), browseaddresses_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), browseorder_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), useimplicitclasses_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), useanyclasses_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), hideimplicitmembers_, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), useshortnames_, TQT_SLOT(setEnabled(bool))); - - connect(browsing_, TQT_SIGNAL(toggled(bool)), l1, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), l2, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), l3, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), l4, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), l5, TQT_SLOT(setEnabled(bool))); - connect(browsing_, TQT_SIGNAL(toggled(bool)), l6, TQT_SLOT(setEnabled(bool))); - - connect(browseaddresses_, TQT_SIGNAL(add()), TQT_SLOT(slotAdd())); - connect(browseaddresses_, TQT_SIGNAL(edit(int)), TQT_SLOT(slotEdit(int))); - connect(browseaddresses_, TQT_SIGNAL(defaultList()), TQT_SLOT(slotDefaultList())); - connect(browseinterval_, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(intervalChanged(int))); - browsing_->setChecked(true); -} - -bool CupsdBrowsingPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - browsing_->setChecked(conf_->browsing_); - cups_->setChecked(conf_->browseprotocols_.findIndex("CUPS") != -1); - slp_->setChecked(conf_->browseprotocols_.findIndex("SLP") != -1); - browseport_->setValue(conf_->browseport_); - browseinterval_->setValue(conf_->browseinterval_); - browsetimeout_->setValue(conf_->browsetimeout_); - browseaddresses_->insertItems(conf_->browseaddresses_); - browseorder_->setCurrentItem(conf_->browseorder_); - useimplicitclasses_->setChecked(conf_->useimplicitclasses_); - useanyclasses_->setChecked(conf_->useanyclasses_); - hideimplicitmembers_->setChecked(conf_->hideimplicitmembers_); - useshortnames_->setChecked(conf_->useshortnames_); - - return true; -} - -bool CupsdBrowsingPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->browsing_ = browsing_->isChecked(); - TQStringList l; - if (cups_->isChecked()) l << "CUPS"; - if (slp_->isChecked()) l << "SLP"; - conf->browseprotocols_ = l; - conf->browseport_ = browseport_->value(); - conf->browseinterval_ = browseinterval_->value(); - conf->browsetimeout_ = browsetimeout_->value(); - conf->browseaddresses_ = browseaddresses_->items(); - conf->browseorder_ = browseorder_->currentItem(); - conf->useimplicitclasses_ = useimplicitclasses_->isChecked(); - conf->useanyclasses_ = useanyclasses_->isChecked(); - conf->hideimplicitmembers_ = hideimplicitmembers_->isChecked(); - conf->useshortnames_ = useshortnames_->isChecked(); - - return true; -} - -void CupsdBrowsingPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(browsing_, conf->comments_.toolTip("browsing")); - TQWhatsThis::add(cups_, conf->comments_.toolTip("browseprotocols")); - TQWhatsThis::add(slp_, conf->comments_.toolTip("browseprotocols")); - TQWhatsThis::add(browseinterval_, conf->comments_.toolTip("browseinterval")); - TQWhatsThis::add(browseport_, conf->comments_.toolTip("browseport")); - TQWhatsThis::add(browsetimeout_, conf->comments_.toolTip("browsetimeout")); - TQWhatsThis::add(browseaddresses_, conf->comments_.toolTip("browseaddresses")); - TQWhatsThis::add(browseorder_, conf->comments_.toolTip("browseorder")); - TQWhatsThis::add(useimplicitclasses_, conf->comments_.toolTip("implicitclasses")); - TQWhatsThis::add(useanyclasses_, conf->comments_.toolTip("implicitanyclasses")); - TQWhatsThis::add(hideimplicitmembers_, conf->comments_.toolTip("hideimplicitmembers")); - TQWhatsThis::add(useshortnames_, conf->comments_.toolTip("browseshortnames")); -} - -void CupsdBrowsingPage::slotAdd() -{ - TQString s = BrowseDialog::newAddress(this, conf_); - if (!s.isEmpty()) - browseaddresses_->insertItem(s); -} - -void CupsdBrowsingPage::slotEdit(int index) -{ - TQString s = browseaddresses_->text(index); - s = BrowseDialog::editAddress(s, this, conf_); - if (!s.isEmpty()) - browseaddresses_->setText(index, s); -} - -void CupsdBrowsingPage::slotDefaultList() -{ - browseaddresses_->clear(); - TQStringList l; - l << "Send 255.255.255.255"; - browseaddresses_->insertItems(l); -} - -void CupsdBrowsingPage::intervalChanged(int val) -{ - browsetimeout_->setRange(val, 10000, 1, true); - browsetimeout_->setSteps(1, 10); -} - -#include "cupsdbrowsingpage.moc" diff --git a/kdeprint/cups/cupsdconf2/cupsdbrowsingpage.h b/kdeprint/cups/cupsdconf2/cupsdbrowsingpage.h deleted file mode 100644 index bdbff1844..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdbrowsingpage.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 CUPSDBROWSINGPAGE_H -#define CUPSDBROWSINGPAGE_H - -#include "cupsdpage.h" - -class KIntNumInput; -class TQCheckBox; -class EditList; -class TQComboBox; - -class CupsdBrowsingPage : public CupsdPage -{ - Q_OBJECT - -public: - CupsdBrowsingPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -protected slots: - void slotAdd(); - void slotEdit(int); - void slotDefaultList(); - void intervalChanged(int); - -private: - KIntNumInput *browseport_, *browseinterval_, *browsetimeout_; - EditList *browseaddresses_; - TQComboBox *browseorder_; - TQCheckBox *browsing_, *cups_, *slp_; - TQCheckBox *useimplicitclasses_, *hideimplicitmembers_, *useshortnames_, *useanyclasses_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdcomment.cpp b/kdeprint/cups/cupsdconf2/cupsdcomment.cpp deleted file mode 100644 index d17c8bd0c..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdcomment.cpp +++ /dev/null @@ -1,136 +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 "cupsdcomment.h" - -#include <tqfile.h> -#include <tqregexp.h> -#include <klocale.h> -#include <kstandarddirs.h> - -TQString Comment::comment() -{ - TQString str = comment_; - str.replace(TQRegExp("<[^>]*>"), ""); - str += ("#\n" + example_); - return str; -} - -TQString Comment::toolTip() -{ - TQString str = comment_; - str.replace(TQRegExp("^#[\\s]*"), "").replace(TQRegExp("\n#[\\s]*"), "\n"); - return i18n("Do not translate the keyword between brackets (e.g. ServerName, ServerAdmin, etc.)", str.utf8()); -} - -TQString Comment::key() -{ - return key_; -} - -bool Comment::load(TQFile *f) -{ - comment_ = ""; - example_ = ""; - key_ = ""; - TQString line, *current = &comment_; - while (!f->atEnd()) - { - f->readLine(line, 1024); - if (line.left(2) == "$$") - { - current = &example_; - } - else if (line.left(2) == "%%") - { - key_ = line.mid(2).stripWhiteSpace(); - } - else if (line.left(2) == "@@") - { - return true; - } - else if (line.stripWhiteSpace().isEmpty()) - { - ; // do nothing - } - else - { - if (line[0] != '#') break; - else - { - current->append(line); - } - } - } - return false; -} - -//------------------------------------------------------------------------------------------------------------ - -TQString CupsdComment::operator[] (const TQString& key) -{ - return comment(key); -} - -TQString CupsdComment::comment(const TQString& key) -{ - if (comments_.count() != 0 || loadComments()) - { - Comment *comm = comments_.find(key); - if (comm) - return comm->comment(); - } - return TQString::null; -} - -TQString CupsdComment::toolTip(const TQString& key) -{ - if (comments_.count() != 0 || loadComments()) - { - Comment *comm = comments_.find(key); - if (comm) - return comm->toolTip(); - } - return TQString::null; -} - -bool CupsdComment::loadComments() -{ - comments_.setAutoDelete(true); - comments_.clear(); - TQFile f(locate("data", "tdeprint/cupsd.conf.template")); - if (f.exists() && f.open(IO_ReadOnly)) - { - Comment *comm; - while (!f.atEnd()) - { - comm = new Comment(); - if (!comm->load(&f)) - break; - else - { - if (comm->key().isEmpty()) - delete comm; - else - comments_.insert(comm->key(), comm); - } - } - } - return true; -} diff --git a/kdeprint/cups/cupsdconf2/cupsdcomment.h b/kdeprint/cups/cupsdconf2/cupsdcomment.h deleted file mode 100644 index 35f9e0515..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdcomment.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 CUPSDCOMMENT_H -#define CUPSDCOMMENT_H - -#include <tqstringlist.h> -#include <tqdict.h> - -class TQFile; - -class Comment -{ -public: - bool load(TQFile* f); - TQString toolTip(); - TQString comment(); - TQString key(); -private: - TQString comment_; - TQString example_; - TQString key_; -}; - -class CupsdComment -{ -public: - TQString operator[] (const TQString& key); - TQString comment(const TQString& key); - TQString toolTip(const TQString& key); - -private: - bool loadComments(); - -private: - TQDict<Comment> comments_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdcomment.pl b/kdeprint/cups/cupsdconf2/cupsdcomment.pl deleted file mode 100644 index b3da5ee7e..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdcomment.pl +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/perl -w -# -# Filter to extract comments for translation from cupsd.conf.template -# -# This code should produce strings identical to tooltips in cupsdcomment.cpp -# -my ($comment_, $example_); -$example_ = ""; - -load(); # Skip header - -while ( <STDIN> ) -{ - if(load()) - { - print toolTip(); - } -} - -# Corresponds to Comment::load in cupsdcomment.cpp -sub load -{ - $comment_ = ""; - my($current) = \$comment_; - while ( <STDIN> ) - { - if (/^\$\$/) - { - $current = \$example_; - } - elsif (/^\%\%/) - { - next; # Do nothing - } - elsif (/^\@\@/) - { - return 1; - } - elsif (/^[\s]*$/) - { - next; # Do nothing - } - else - { - last if (!/^\#/); - ${$current} = ${$current} . $_; - } - } - return 0; -} - -# Corresponds to Comment::toolTip in cupsdcomment.cpp -sub toolTip -{ - my($str) = $comment_; - $str =~ s/\"/\\\"/g; - $str =~ s/^\#[\s]*/i18n\(\"Do not translate the keyword between brackets \(e\.g\. ServerName, ServerAdmin, etc\.\)\",\"/; - $str =~ s/\n\#[\s]*/\\n\"\n\"/g; - $str =~ s/\n$/\\n\"\n\)\;\n\n/; - return $str; -} diff --git a/kdeprint/cups/cupsdconf2/cupsdconf.cpp b/kdeprint/cups/cupsdconf2/cupsdconf.cpp deleted file mode 100644 index 0cd041d48..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdconf.cpp +++ /dev/null @@ -1,884 +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 "cupsdconf.h" - -#include <tqfile.h> -#include <tqregexp.h> -#include <klocale.h> -#include <kdebug.h> -#include <kconfig.h> - -#include <stdlib.h> -#include <cups/cups.h> -#include <cups/ipp.h> -#include <cups/language.h> - -TQString findDir(const TQStringList& list) -{ - for (TQStringList::ConstIterator it=list.begin(); it!=list.end(); ++it) - if (TQFile::exists(*it)) - return *it; - // if nothing found, just use the first as default value - return list[0]; -} - -void splitSizeSpec(const TQString& s, int& sz, int& suff) -{ - int p = s.find(TQRegExp("\\D")); - sz = s.mid(0, p).toInt(); - if (p != -1) - { - switch (s[p].latin1()) - { - case 'k': suff = UNIT_KB; break; - default: - case 'm': suff = UNIT_MB; break; - case 'g': suff = UNIT_GB; break; - case 't': suff = UNIT_TILE; break; - } - } - else - suff = UNIT_MB; -} - -CupsdConf::CupsdConf() -{ - // start by trying to find CUPS directories (useful later) - datadir_ = findDir(TQStringList("/usr/share/cups") - << "/usr/local/share/cups" - << "/opt/share/cups" - << "/opt/local/share/cups"); - documentdir_ = findDir(TQStringList(datadir_+"/doc-root") - << datadir_.left(datadir_.length()-5)+"/doc/cups"); - //fontpath_ << (datadir_+"/fonts"); - requestdir_ = findDir(TQStringList("/var/spool/cups") - << "/var/cups"); - serverbin_ = findDir(TQStringList("/usr/lib" KDELIBSUFF "/cups") - << "/usr/local/lib" KDELIBSUFF "/cups" - << "/opt/lib" KDELIBSUFF "/cups" - << "/opt/local/lib" KDELIBSUFF "/cups"); - serverfiles_ = findDir(TQStringList("/etc/cups") - << "/usr/local/etc/cups"); - tmpfiles_ = requestdir_+"/tmp"; - - // other options - servername_ = TQString::null; - serveradmin_ = TQString::null; - classification_ = CLASS_NONE; - otherclassname_ = TQString::null; - classoverride_ = false; - charset_ = "utf-8"; - language_ = "en"; - printcap_ = "/etc/printcap"; - printcapformat_ = PRINTCAP_BSD; - remoteroot_ = "remroot"; - systemgroup_ = "lpadmin"; - encryptcert_ = serverfiles_+"/ssl/server.crt"; - encryptkey_ = serverfiles_+"/ssl/server.key"; - hostnamelookup_ = HOSTNAME_OFF; - keepalive_ = true; - keepalivetimeout_ = 60; - maxclients_ = 100; - maxrequestsize_ = "0"; - clienttimeout_ = 300; - // listenaddresses_ - TQString logdir = findDir(TQStringList("/var/log/cups") - << "/var/spool/cups/log" - << "/var/cups/log"); - accesslog_ = logdir+"/access_log"; - errorlog_ = logdir+"/error_log"; - pagelog_ = logdir+"/page_log"; - maxlogsize_ = "1m"; - loglevel_ = LOGLEVEL_INFO; - keepjobhistory_ = true; - keepjobfiles_ = false; - autopurgejobs_ = false; - maxjobs_ = 0; - maxjobsperprinter_ = 0; - maxjobsperuser_ = 0; - user_ = "lp"; - group_ = "lpadmin"; - ripcache_ = "8m"; - filterlimit_ = 0; - browsing_ = true; - browseprotocols_ << "CUPS"; - browseport_ = ippPort(); - browseinterval_ = 30; - browsetimeout_ = 300; - // browseaddresses_ - browseorder_ = ORDER_ALLOW_DENY; - useimplicitclasses_ = true; - hideimplicitmembers_ = true; - useshortnames_ = true; - useanyclasses_ = false; - - loadAvailableResources(); -} - -CupsdConf::~CupsdConf() -{ -} - -bool CupsdConf::loadFromFile(const TQString& filename) -{ - TQFile f(filename); - if (!f.exists() || !f.open(IO_ReadOnly)) return false; - else - { - TQTextStream t(&f); - TQString line; - bool done(false), value(true); - while (!done && value) - { - line = t.readLine().simplifyWhiteSpace(); - if (line.isEmpty()) - { - if (t.atEnd()) done = true; - else continue; - } - else if (line[0] == '#') continue; - else if (line.left(9).lower() == "<location") - { - CupsLocation *location = new CupsLocation(); - locations_.append(location); - if (!location->parseResource(line) || !parseLocation(location, t)) - value = false; - // search corresponding resource - for (resources_.first();resources_.current();resources_.next()) - if (resources_.current()->path_ == location->resourcename_) - location->resource_ = resources_.current(); - } - else value = parseOption(line); - } - f.close(); - return value; - } -} - -bool CupsdConf::saveToFile(const TQString& filename) -{ - TQFile f(filename); - if (!f.open(IO_WriteOnly)) - return false; - else - { - TQTextStream t(&f); - t << comments_["header"] << endl; - t << "# Server" << endl << endl; - - t << comments_["servername"] << endl; - if ( !servername_.isEmpty() ) - t << "ServerName " << servername_ << endl; - - t << endl << comments_["serveradmin"] << endl; - if ( !serveradmin_.isEmpty() ) - t << "ServerAdmin " << serveradmin_ << endl; - - t << endl << comments_["classification"] << endl; - t << "Classification "; - switch (classification_) - { - default: - case CLASS_NONE: t << "none"; break; - case CLASS_CLASSIFIED: t << "classified"; break; - case CLASS_CONFIDENTIAL: t << "confidential"; break; - case CLASS_SECRET: t << "secret"; break; - case CLASS_TOPSECRET: t << "topsecret"; break; - case CLASS_UNCLASSIFIED: t << "unclassified"; break; - case CLASS_OTHER: t << otherclassname_; break; - } - t << endl; - - t << endl << comments_["classifyoverride"] << endl; - if (classification_ != CLASS_NONE) t << "ClassifyOverride " << (classoverride_ ? "Yes" : "No") << endl; - - t << endl << comments_["defaultcharset"] << endl; - t << "DefaultCharset " << charset_.upper() << endl; - - t << endl << comments_["defaultlanguage"] << endl; - t << "DefaultLanguage " << language_.lower() << endl; - - t << endl << comments_["printcap"] << endl; - t << "Printcap " << printcap_ << endl; - - t << endl << comments_["printcapformat"] << endl; - t << "PrintcapFormat " << (printcapformat_ == PRINTCAP_SOLARIS ? "Solaris" : "BSD") << endl; - - t << endl << "# Security" << endl; - t << endl << comments_["remoteroot"] << endl; - t << "RemoteRoot " << remoteroot_ << endl; - - t << endl << comments_["systemgroup"] << endl; - t << "SystemGroup " << systemgroup_ << endl; - - t << endl << comments_["servercertificate"] << endl; - t << "ServerCertificate " << encryptcert_ << endl; - - t << endl << comments_["serverkey"] << endl; - t << "ServerKey " << encryptkey_ << endl; - - t << endl << comments_["locations"] << endl; - for (locations_.first(); locations_.current(); locations_.next()) - { - CupsLocation *loc = locations_.current(); - t << "<Location " << loc->resourcename_ << ">" << endl; - if (loc->authtype_ != AUTHTYPE_NONE) - { - t << "AuthType "; - switch (loc->authtype_) - { - case AUTHTYPE_BASIC: t << "Basic"; break; - case AUTHTYPE_DIGEST: t << "Digest"; break; - } - t << endl; - } - if (loc->authclass_ != AUTHCLASS_ANONYMOUS) - { - switch (loc->authclass_) - { - case AUTHCLASS_USER: - if (!loc->authname_.isEmpty()) - t << "Require user " << loc->authname_ << endl; - else - t << "AuthClass User" << endl; - break; - case AUTHCLASS_GROUP: - if (!loc->authname_.isEmpty()) - t << "Require group " << loc->authname_ << endl; - else - t << "AuthClass Group" << endl; - break; - case AUTHCLASS_SYSTEM: - t << "AuthClass System" << endl; - break; - } - } - t << "Encryption "; - switch (loc->encryption_) - { - case ENCRYPT_ALWAYS: t << "Always"; break; - case ENCRYPT_NEVER: t << "Never"; break; - case ENCRYPT_REQUIRED: t << "Required"; break; - default: - case ENCRYPT_IFREQUESTED: t << "IfRequested"; break; - } - t << endl; - t << "Satisfy " << (loc->satisfy_ == SATISFY_ALL ? "All" : "Any") << endl; - t << "Order " << (loc->order_ == ORDER_ALLOW_DENY ? "allow,deny" : "deny,allow") << endl; - for (TQStringList::ConstIterator it=loc->addresses_.begin(); it!=loc->addresses_.end(); ++it) - t << *it << endl; - t << "</Location>" << endl; - } - - t << endl << "# Network" << endl; - t << endl << comments_["hostnamelookups"] << endl; - t << "HostnameLookups "; - switch (hostnamelookup_) - { - default: - case HOSTNAME_OFF: t << "Off"; break; - case HOSTNAME_ON: t << "On"; break; - case HOSTNAME_DOUBLE: t << "Double"; break; - } - t << endl; - - t << endl << comments_["keepalive"] << endl; - t << "KeepAlive " << (keepalive_ ? "On" : "Off") << endl; - - t << endl << comments_["keepalivetimeout"] << endl; - t << "KeepAliveTimeout " << keepalivetimeout_ << endl; - - t << endl << comments_["maxclients"] << endl; - t << "MaxClients " << maxclients_ << endl; - - t << endl << comments_["maxrequestsize"] << endl; - t << "MaxRequestSize " << maxrequestsize_ << endl; - - t << endl << comments_["timeout"] << endl; - t << "Timeout " << clienttimeout_ << endl; - - t << endl << comments_["listen"] << endl; - for (TQStringList::ConstIterator it=listenaddresses_.begin(); it!=listenaddresses_.end(); ++it) - t << *it << endl; - - t << endl << "# Log" << endl; - t << endl << comments_["accesslog"] << endl; - t << "AccessLog " << accesslog_ << endl; - - t << endl << comments_["errorlog"] << endl; - t << "ErrorLog " << errorlog_ << endl; - - t << endl << comments_["pagelog"] << endl; - t << "PageLog " << pagelog_ << endl; - - t << endl << comments_["maxlogsize"] << endl; - //t << "MaxLogSize " << maxlogsize_ << "m" << endl; - t << "MaxLogSize " << maxlogsize_ << endl; - - t << endl << comments_["loglevel"] << endl; - t << "LogLevel "; - switch (loglevel_) - { - case LOGLEVEL_NONE: t << "none"; break; - default: - case LOGLEVEL_INFO: t << "info"; break; - case LOGLEVEL_ERROR: t << "error"; break; - case LOGLEVEL_WARN: t << "warn"; break; - case LOGLEVEL_DEBUG: t << "debug"; break; - case LOGLEVEL_DEBUG2: t << "debug2"; break; - } - t << endl; - - t << endl << "# Jobs" << endl; - t << endl << comments_["preservejobhistory"] << endl; - t << "PreserveJobHistory " << (keepjobhistory_ ? "On" : "Off") << endl; - - t << endl << comments_["preservejobfiles"] << endl; - if (keepjobhistory_) t << "PreserveJobFiles " << (keepjobfiles_ ? "On" : "Off") << endl; - - t << endl << comments_["autopurgejobs"] << endl; - if (keepjobhistory_) t << "AutoPurgeJobs " << (autopurgejobs_ ? "Yes" : "No") << endl; - - t << endl << comments_["maxjobs"] << endl; - t << "MaxJobs " << maxjobs_ << endl; - - t << endl << comments_["maxjobsperprinter"] << endl; - t << "MaxJobsPerPrinter " << maxjobsperprinter_ << endl; - - t << endl << comments_["maxjobsperuser"] << endl; - t << "MaxJobsPerUser " << maxjobsperuser_ << endl; - - t << endl << "# Filter" << endl; - t << endl << comments_["user"] << endl; - t << "User " << user_ << endl; - - t << endl << comments_["group"] << endl; - t << "Group " << group_ << endl; - - t << endl << comments_["ripcache"] << endl; - t << "RIPCache " << ripcache_ << endl; - - t << endl << comments_["filterlimit"] << endl; - t << "FilterLimit " << filterlimit_ << endl; - - t << endl << "# Directories" << endl; - t << endl << comments_["datadir"] << endl; - t << "DataDir " << datadir_ << endl; - - t << endl << comments_["documentroot"] << endl; - t << "DocumentRoot " << documentdir_ << endl; - - t << endl << comments_["fontpath"] << endl; - for (TQStringList::ConstIterator it=fontpath_.begin(); it!=fontpath_.end(); ++it) - t << "FontPath " << *it << endl; - - t << endl << comments_["requestroot"] << endl; - t << "RequestRoot " << requestdir_ << endl; - - t << endl << comments_["serverbin"] << endl; - t << "ServerBin " << serverbin_ << endl; - - t << endl << comments_["serverroot"] << endl; - t << "ServerRoot " << serverfiles_ << endl; - - t << endl << comments_["tempdir"] << endl; - t << "TempDir " << tmpfiles_ << endl; - - t << endl << "# Browsing" << endl; - t << endl << comments_["browsing"] << endl; - t << "Browsing " << (browsing_ ? "On" : "Off") << endl; - - t << endl << comments_["browseprotocols"] << endl; - if (browsing_) - { - t << "BrowseProtocols "; - for (TQStringList::ConstIterator it=browseprotocols_.begin(); it!=browseprotocols_.end(); ++it) - t << (*it).upper() << " "; - t << endl; - } - - t << endl << comments_["browseport"] << endl; - if (browsing_) t << "BrowsePort " << browseport_ << endl; - - t << endl << comments_["browseinterval"] << endl; - if (browsing_) t << "BrowseInterval " << browseinterval_ << endl; - - t << endl << comments_["browsetimeout"] << endl; - if (browsing_) t << "BrowseTimeout " << browsetimeout_ << endl; - - t << endl << comments_["browseaddress"] << endl; - if (browsing_) - for (TQStringList::ConstIterator it=browseaddresses_.begin(); it!=browseaddresses_.end(); ++it) - if ((*it).startsWith("Send")) - t << "BrowseAddress " << (*it).mid(5) << endl; - else - t << "Browse" << (*it) << endl; - - t << endl << comments_["browseorder"] << endl; - if (browsing_) t << "BrowseOrder " << (browseorder_ == ORDER_ALLOW_DENY ? "allow,deny" : "deny,allow") << endl; - - t << endl << comments_["implicitclasses"] << endl; - if (browsing_) t << "ImplicitClasses " << (useimplicitclasses_ ? "On" : "Off") << endl; - - t << endl << comments_["implicitanyclasses"] << endl; - if (browsing_) t << "ImplicitAnyClasses " << (useanyclasses_ ? "On" : "Off") << endl; - - t << endl << comments_["hideimplicitmembers"] << endl; - if (browsing_) t << "HideImplicitMembers " << (hideimplicitmembers_ ? "Yes" : "No") << endl; - - t << endl << comments_["browseshortnames"] << endl; - if (browsing_) t << "BrowseShortNames " << (useshortnames_ ? "Yes" : "No") << endl; - - t << endl << "# Unknown" << endl; - for (TQValueList< TQPair<TQString,TQString> >::ConstIterator it=unknown_.begin(); it!=unknown_.end(); ++it) - t << (*it).first << " " << (*it).second << endl; - - return true; - } -} - -bool CupsdConf::parseLocation(CupsLocation *location, TQTextStream& file) -{ - TQString line; - bool done(false); - bool value(true); - while (!done && value) - { - line = file.readLine().simplifyWhiteSpace(); - if (line.isEmpty()) - { - if (file.atEnd()) - { - value = false; - done = true; - } - else continue; - } - else if (line[0] == '#') continue; - else if (line.lower() == "</location>") done = true; - else value = location->parseOption(line); - } - return value; -} - -bool CupsdConf::parseOption(const TQString& line) -{ - int p(-1); - TQString keyword, value, l(line.simplifyWhiteSpace()); - - if ((p=l.find(' ')) != -1) - { - keyword = l.left(p).lower(); - value = l.mid(p+1); - } - else - { - keyword = l.lower(); - } - - //kdDebug() << "cupsd.conf keyword=" << keyword << endl; - if (keyword == "accesslog") accesslog_ = value; - else if (keyword == "autopurgejobs") autopurgejobs_ = (value.lower() == "yes"); - else if (keyword == "browseaddress") browseaddresses_.append("Send "+value); - else if (keyword == "browseallow") browseaddresses_.append("Allow "+value); - else if (keyword == "browsedeny") browseaddresses_.append("Deny "+value); - else if (keyword == "browseinterval") browseinterval_ = value.toInt(); - else if (keyword == "browseorder") browseorder_ = (value.lower() == "deny,allow" ? ORDER_DENY_ALLOW : ORDER_ALLOW_DENY); - else if (keyword == "browsepoll") browseaddresses_.append("Poll "+value); - else if (keyword == "browseport") browseport_ = value.toInt(); - else if (keyword == "browseprotocols") - { - browseprotocols_.clear(); - TQStringList prots = TQStringList::split(TQRegExp("\\s"), value, false); - if (prots.find("all") != prots.end()) - browseprotocols_ << "CUPS" << "SLP"; - else - for (TQStringList::ConstIterator it=prots.begin(); it!=prots.end(); ++it) - browseprotocols_ << (*it).upper(); - } - else if (keyword == "browserelay") browseaddresses_.append("Relay "+value); - else if (keyword == "browseshortnames") useshortnames_ = (value.lower() != "no"); - else if (keyword == "browsetimeout") browsetimeout_ = value.toInt(); - else if (keyword == "browsing") browsing_ = (value.lower() != "off"); - else if (keyword == "classification") - { - TQString cl = value.lower(); - if (cl == "none") classification_ = CLASS_NONE; - else if (cl == "classified") classification_ = CLASS_CLASSIFIED; - else if (cl == "confidential") classification_ = CLASS_CONFIDENTIAL; - else if (cl == "secret") classification_ = CLASS_SECRET; - else if (cl == "topsecret") classification_ = CLASS_TOPSECRET; - else if (cl == "unclassified") classification_ = CLASS_UNCLASSIFIED; - else - { - classification_ = CLASS_OTHER; - otherclassname_ = cl; - } - } - else if (keyword == "classifyoverride") classoverride_ = (value.lower() == "yes"); - else if (keyword == "datadir") datadir_ = value; - else if (keyword == "defaultcharset") charset_ = value; - else if (keyword == "defaultlanguage") language_ = value; - else if (keyword == "documentroot") documentdir_ = value; - else if (keyword == "errorlog") errorlog_ = value; - else if (keyword == "filterlimit") filterlimit_ = value.toInt(); - else if (keyword == "fontpath") fontpath_ += TQStringList::split(':', value, false); - else if (keyword == "group") group_ = value; - else if (keyword == "hideimplicitmembers") hideimplicitmembers_ = (value.lower() != "no"); - else if (keyword == "hostnamelookups") - { - TQString h = value.lower(); - if (h == "on") hostnamelookup_ = HOSTNAME_ON; - else if (h == "double") hostnamelookup_ = HOSTNAME_DOUBLE; - else hostnamelookup_ = HOSTNAME_OFF; - } - else if (keyword == "implicitclasses") useimplicitclasses_ = (value.lower() != "off"); - else if (keyword == "implicitanyclasses") useanyclasses_ = (value.lower() == "on"); - else if (keyword == "keepalive") keepalive_ = (value.lower() != "off"); - else if (keyword == "keepalivetimeout") keepalivetimeout_ = value.toInt(); - else if (keyword == "listen") listenaddresses_.append("Listen "+value); - else if (keyword == "loglevel") - { - TQString ll = value.lower(); - if (ll == "none") loglevel_ = LOGLEVEL_NONE; - else if (ll == "error") loglevel_ = LOGLEVEL_ERROR; - else if (ll == "warn") loglevel_ = LOGLEVEL_WARN; - else if (ll == "info") loglevel_ = LOGLEVEL_INFO; - else if (ll == "debug") loglevel_ = LOGLEVEL_DEBUG; - else if (ll == "debug2") loglevel_ = LOGLEVEL_DEBUG2; - } - else if (keyword == "maxclients") maxclients_ = value.toInt(); - else if (keyword == "maxjobs") maxjobs_ = value.toInt(); - else if (keyword == "maxjobsperprinter") maxjobsperprinter_ = value.toInt(); - else if (keyword == "maxjobsperuser") maxjobsperuser_ = value.toInt(); - else if (keyword == "maxrequestsize") maxrequestsize_ = value; - else if (keyword == "maxlogsize") maxlogsize_ = value; - /*{ - // FIXME: support for suffixes - int suffix; - splitSizeSpec( value, maxlogsize_, suffix ); - }*/ - else if (keyword == "pagelog") pagelog_ = value; - else if (keyword == "port") listenaddresses_.append("Listen *:"+value); - else if (keyword == "preservejobhistory") keepjobhistory_ = (value != "off"); - else if (keyword == "preservejobfiles") keepjobfiles_ = (value == "on"); - else if (keyword == "printcap") printcap_ = value; - else if (keyword == "printcapformat") printcapformat_ = (value.lower() == "solaris" ? PRINTCAP_SOLARIS : PRINTCAP_BSD); - else if (keyword == "requestroot") requestdir_ = value; - else if (keyword == "remoteroot") remoteroot_ = value; - else if (keyword == "ripcache") ripcache_ = value; - else if (keyword == "serveradmin") serveradmin_ = value; - else if (keyword == "serverbin") serverbin_ = value; - else if (keyword == "servercertificate") encryptcert_ = value; - else if (keyword == "serverkey") encryptkey_ = value; - else if (keyword == "servername") servername_ = value; - else if (keyword == "serverroot") serverfiles_ = value; - else if (keyword == "ssllisten") listenaddresses_.append("SSLListen "+value); - else if (keyword == "sslport") listenaddresses_.append("SSLListen *:"+value); - else if (keyword == "systemgroup") systemgroup_ = value; - else if (keyword == "tempdir") tmpfiles_ = value; - else if (keyword == "timeout") clienttimeout_ = value.toInt(); - else if (keyword == "user") user_ = value; - else - { - // unrecognized option - unknown_ << TQPair<TQString,TQString>(keyword, value); - } - return true; -} - -bool CupsdConf::loadAvailableResources() -{ - KConfig conf("tdeprintrc"); - conf.setGroup("CUPS"); - TQString host = conf.readEntry("Host",cupsServer()); - int port = conf.readNumEntry("Port",ippPort()); - http_t *http_ = httpConnect(host.local8Bit(),port); - - resources_.clear(); - // standard resources - resources_.append(new CupsResource("/")); - resources_.append(new CupsResource("/admin")); - resources_.append(new CupsResource("/printers")); - resources_.append(new CupsResource("/classes")); - resources_.append(new CupsResource("/jobs")); - - if (!http_) - return false; - - // printer resources - ipp_t *request_ = ippNew(); - cups_lang_t* lang = cupsLangDefault(); - ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(lang)); - ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, lang->language); - request_->request.op.operation_id = CUPS_GET_PRINTERS; - request_ = cupsDoRequest(http_, request_, "/printers/"); - if (request_) - { - TQString name; - int type(0); - ipp_attribute_t *attr = request_->attrs; - while (attr) - { - // check new printer (keep only local non-implicit printers) - if (!attr->name) - { - if (!(type & CUPS_PRINTER_REMOTE) && !(type & CUPS_PRINTER_IMPLICIT) && !name.isEmpty()) - resources_.append(new CupsResource("/printers/"+name)); - name = ""; - type = 0; - } - else if (strcmp(attr->name, "printer-name") == 0) name = attr->values[0].string.text; - else if (strcmp(attr->name, "printer-type") == 0) type = attr->values[0].integer; - attr = attr->next; - } - if (!(type & CUPS_PRINTER_REMOTE) && !(type & CUPS_PRINTER_IMPLICIT) && !name.isEmpty()) - resources_.append(new CupsResource("/printers/"+name)); - ippDelete(request_); - } - // class resources - request_ = ippNew(); - ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(lang)); - ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, lang->language); - request_->request.op.operation_id = CUPS_GET_CLASSES; - request_ = cupsDoRequest(http_, request_, "/classes/"); - if (request_) - { - TQString name; - int type(0); - ipp_attribute_t *attr = request_->attrs; - while (attr) - { - // check new class (keep only local classes) - if (!attr->name) - { - if (!(type & CUPS_PRINTER_REMOTE) && !name.isEmpty()) - resources_.append(new CupsResource("/classes/"+name)); - name = ""; - type = 0; - } - else if (strcmp(attr->name, "printer-name") == 0) name = attr->values[0].string.text; - else if (strcmp(attr->name, "printer-type") == 0) type = attr->values[0].integer; - attr = attr->next; - } - if (!(type & CUPS_PRINTER_REMOTE) && !name.isEmpty()) - resources_.append(new CupsResource("/classes/"+name)); - ippDelete(request_); - } - httpClose(http_); - return true; -} - -//------------------------------------------------------------------------------------------------ - -CupsLocation::CupsLocation() -{ - resource_ = 0; - resourcename_ = ""; - authtype_ = AUTHTYPE_NONE; - authclass_ = AUTHCLASS_ANONYMOUS; - authname_ = TQString::null; - encryption_ = ENCRYPT_IFREQUESTED; - satisfy_ = SATISFY_ALL; - order_ = ORDER_ALLOW_DENY; - // addresses_ -} - -CupsLocation::CupsLocation(const CupsLocation& loc) -: resource_(loc.resource_), - resourcename_(loc.resourcename_), - authtype_(loc.authtype_), - authclass_(loc.authclass_), - authname_(loc.authname_), - encryption_(loc.encryption_), - satisfy_(loc.satisfy_), - order_(loc.order_), - addresses_(loc.addresses_) -{ -} - -bool CupsLocation::parseResource(const TQString& line) -{ - TQString str = line.simplifyWhiteSpace(); - int p1 = line.find(' '), p2 = line.find('>'); - if (p1 != -1 && p2 != -1) - { - resourcename_ = str.mid(p1+1,p2-p1-1); - return true; - } - else return false; -} - -bool CupsLocation::parseOption(const TQString& line) -{ - int p(-1); - TQString keyword, value, l(line.simplifyWhiteSpace()); - - if ((p=l.find(' ')) != -1) - { - keyword = l.left(p).lower(); - value = l.mid(p+1); - } - else - { - keyword = l.lower(); - } - - if (keyword == "authtype") - { - TQString a = value.lower(); - if (a == "basic") authtype_ = AUTHTYPE_BASIC; - else if (a == "digest") authtype_ = AUTHTYPE_DIGEST; - else authtype_ = AUTHTYPE_NONE; - } - else if (keyword == "authclass") - { - TQString a = value.lower(); - if (a == "user") authclass_ = AUTHCLASS_USER; - else if (a == "system") authclass_ = AUTHCLASS_SYSTEM; - else if (a == "group") authclass_ = AUTHCLASS_GROUP; - else authclass_ = AUTHCLASS_ANONYMOUS; - } - else if (keyword == "authgroupname") authname_ = value; - else if (keyword == "require") - { - int p = value.find(' '); - if (p != -1) - { - authname_ = value.mid(p+1); - TQString cl = value.left(p).lower(); - if (cl == "user") - authclass_ = AUTHCLASS_USER; - else if (cl == "group") - authclass_ = AUTHCLASS_GROUP; - } - } - else if (keyword == "allow") addresses_.append("Allow "+value); - else if (keyword == "deny") addresses_.append("Deny "+value); - else if (keyword == "order") order_ = (value.lower() == "deny,allow" ? ORDER_DENY_ALLOW : ORDER_ALLOW_DENY); - else if (keyword == "encryption") - { - TQString e = value.lower(); - if (e == "always") encryption_ = ENCRYPT_ALWAYS; - else if (e == "never") encryption_ = ENCRYPT_NEVER; - else if (e == "required") encryption_ = ENCRYPT_REQUIRED; - else encryption_ = ENCRYPT_IFREQUESTED; - } - else if (keyword == "satisfy") satisfy_ = (value.lower() == "any" ? SATISFY_ANY : SATISFY_ALL); - else return false; - return true; -} - -//------------------------------------------------------------------------------------------------ - -CupsResource::CupsResource() -{ - type_ = RESOURCE_GLOBAL; -} - -CupsResource::CupsResource(const TQString& path) -{ - setPath(path); -} - -void CupsResource::setPath(const TQString& path) -{ - path_ = path; - type_ = typeFromPath(path_); - text_ = pathToText(path_); -} - -int CupsResource::typeFromText(const TQString& text) -{ - if (text == i18n("Base", "Root") || text == i18n("All printers") || text == i18n("All classes") || text == i18n("Print jobs")) return RESOURCE_GLOBAL; - else if (text == i18n("Administration")) return RESOURCE_ADMIN; - else if (text.find(i18n("Class")) == 0) return RESOURCE_CLASS; - else if (text.find(i18n("Printer")) == 0) return RESOURCE_PRINTER; - else return RESOURCE_PRINTER; -} - -int CupsResource::typeFromPath(const TQString& path) -{ - if (path == "/admin") return RESOURCE_ADMIN; - else if (path == "/printers" || path == "/classes" || path == "/" || path == "/jobs") return RESOURCE_GLOBAL; - else if (path.left(9) == "/printers") return RESOURCE_PRINTER; - else if (path.left(8) == "/classes") return RESOURCE_CLASS; - else return RESOURCE_GLOBAL; -} - -TQString CupsResource::textToPath(const TQString& text) -{ - TQString path("/"); - if (text == i18n("Administration")) path = "/admin"; - else if (text == i18n("All printers")) path = "/printers"; - else if (text == i18n("All classes")) path = "/classes"; - else if (text == i18n("Print jobs")) path = "/jobs"; - else if (text == i18n("Base", "Root")) path = "/"; - else if (text.find(i18n("Printer")) == 0) - { - path = "/printers/"; - path.append(text.right(text.length()-i18n("Printer").length()-1)); - } - else if (text.find(i18n("Class")) == 0) - { - path = "/classes/"; - path.append(text.right(text.length()-i18n("Class").length()-1)); - } - return path; -} - -TQString CupsResource::pathToText(const TQString& path) -{ - TQString text(i18n("Base", "Root")); - if (path == "/admin") text = i18n("Administration"); - else if (path == "/printers") text = i18n("All printers"); - else if (path == "/classes") text = i18n("All classes"); - else if (path == "/") text = i18n("Root"); - else if (path == "/jobs") text = i18n("Print jobs"); - else if (path.find("/printers/") == 0) - { - text = i18n("Printer"); - text.append(" "); - text.append(path.right(path.length()-10)); - } - else if (path.find("/classes/") == 0) - { - text = i18n("Class"); - text.append(" "); - text.append(path.right(path.length()-9)); - } - return text; -} - -TQString CupsResource::typeToIconName(int type) -{ - switch (type) - { - case RESOURCE_ADMIN: - case RESOURCE_GLOBAL: - return TQString("folder"); - case RESOURCE_PRINTER: - return TQString("tdeprint_printer"); - case RESOURCE_CLASS: - return TQString("tdeprint_printer_class"); - } - return TQString("folder"); -} diff --git a/kdeprint/cups/cupsdconf2/cupsdconf.h b/kdeprint/cups/cupsdconf2/cupsdconf.h deleted file mode 100644 index 70b4f591b..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdconf.h +++ /dev/null @@ -1,181 +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 CUPSDCONF_H -#define CUPSDCONF_H - -#include <tqstring.h> -#include <tqstringlist.h> -#include <tqptrlist.h> -#include <tqtextstream.h> -#include <tqpair.h> - -#include "cupsdcomment.h" - -enum LogLevelType { LOGLEVEL_DEBUG2 = 0, LOGLEVEL_DEBUG, LOGLEVEL_INFO, LOGLEVEL_WARN, LOGLEVEL_ERROR, LOGLEVEL_NONE }; -enum OrderType { ORDER_ALLOW_DENY = 0, ORDER_DENY_ALLOW }; -enum AuthTypeType { AUTHTYPE_NONE = 0, AUTHTYPE_BASIC, AUTHTYPE_DIGEST }; -enum AuthClassType { AUTHCLASS_ANONYMOUS = 0, AUTHCLASS_USER, AUTHCLASS_SYSTEM, AUTHCLASS_GROUP }; -enum EncryptionType { ENCRYPT_ALWAYS = 0, ENCRYPT_NEVER, ENCRYPT_REQUIRED, ENCRYPT_IFREQUESTED }; -enum BrowseProtocolType { BROWSE_ALL = 0, BROWSE_CUPS, BROWSE_SLP }; -enum PrintcapFormatType { PRINTCAP_BSD = 0, PRINTCAP_SOLARIS }; -enum HostnameLookupType { HOSTNAME_OFF = 0, HOSTNAME_ON, HOSTNAME_DOUBLE }; -enum ClassificationType { CLASS_NONE = 0, CLASS_CLASSIFIED, CLASS_CONFIDENTIAL, CLASS_SECRET, CLASS_TOPSECRET, CLASS_UNCLASSIFIED, CLASS_OTHER }; -enum SatisfyType { SATISFY_ALL = 0, SATISFY_ANY }; -enum UnitType { UNIT_KB = 0, UNIT_MB, UNIT_GB, UNIT_TILE }; - -struct CupsLocation; -struct CupsResource; -enum ResourceType { RESOURCE_GLOBAL, RESOURCE_PRINTER, RESOURCE_CLASS, RESOURCE_ADMIN }; - -struct CupsdConf -{ -// functions member - CupsdConf(); - ~CupsdConf(); - - bool loadFromFile(const TQString& filename); - bool saveToFile(const TQString& filename); - bool parseOption(const TQString& line); - bool parseLocation(CupsLocation *location, TQTextStream& file); - - bool loadAvailableResources(); - - static CupsdConf* get(); - static void release(); - -// data members - static CupsdConf *unique_; - - // Server - TQString servername_; - TQString serveradmin_; - int classification_; - TQString otherclassname_; - bool classoverride_; - TQString charset_; - TQString language_; - TQString printcap_; - int printcapformat_; - - // Security - TQString remoteroot_; - TQString systemgroup_; - TQString encryptcert_; - TQString encryptkey_; - TQPtrList<CupsLocation> locations_; - TQPtrList<CupsResource> resources_; - - // Network - int hostnamelookup_; - bool keepalive_; - int keepalivetimeout_; - int maxclients_; - TQString maxrequestsize_; - int clienttimeout_; - TQStringList listenaddresses_; - - // Log - TQString accesslog_; - TQString errorlog_; - TQString pagelog_; - TQString maxlogsize_; - int loglevel_; - - // Jobs - bool keepjobhistory_; - bool keepjobfiles_; - bool autopurgejobs_; - int maxjobs_; - int maxjobsperprinter_; - int maxjobsperuser_; - - // Filter - TQString user_; - TQString group_; - TQString ripcache_; - int filterlimit_; - - // Directories - TQString datadir_; - TQString documentdir_; - TQStringList fontpath_; - TQString requestdir_; - TQString serverbin_; - TQString serverfiles_; - TQString tmpfiles_; - - // Browsing - bool browsing_; - TQStringList browseprotocols_; - int browseport_; - int browseinterval_; - int browsetimeout_; - TQStringList browseaddresses_; - int browseorder_; - bool useimplicitclasses_; - bool hideimplicitmembers_; - bool useshortnames_; - bool useanyclasses_; - - // cupsd.conf file comments - CupsdComment comments_; - - // unrecognized options - TQValueList< TQPair<TQString,TQString> > unknown_; -}; - -struct CupsLocation -{ - CupsLocation(); - CupsLocation(const CupsLocation& loc); - - bool parseOption(const TQString& line); - bool parseResource(const TQString& line); - - CupsResource *resource_; - TQString resourcename_; - int authtype_; - int authclass_; - TQString authname_; - int encryption_; - int satisfy_; - int order_; - TQStringList addresses_; -}; - -struct CupsResource -{ - CupsResource(); - CupsResource(const TQString& path); - - void setPath(const TQString& path); - - int type_; - TQString path_; - TQString text_; - - static TQString textToPath(const TQString& text); - static TQString pathToText(const TQString& path); - static int typeFromPath(const TQString& path); - static int typeFromText(const TQString& text); - static TQString typeToIconName(int type); -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsddialog.cpp b/kdeprint/cups/cupsdconf2/cupsddialog.cpp deleted file mode 100644 index e6338eb8c..000000000 --- a/kdeprint/cups/cupsdconf2/cupsddialog.cpp +++ /dev/null @@ -1,356 +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 "cupsddialog.h" - -#include "cupsdpage.h" -#include "cupsdconf.h" -#include "cupsdsplash.h" -#include "cupsdserverpage.h" -#include "cupsdlogpage.h" -#include "cupsdjobspage.h" -#include "cupsdfilterpage.h" -#include "cupsddirpage.h" -#include "cupsdnetworkpage.h" -#include "cupsdbrowsingpage.h" -#include "cupsdsecuritypage.h" - -#include <tqdir.h> -#include <tqvbox.h> -#include <kmessagebox.h> -#include <klocale.h> -#include <tqfile.h> -#include <tqfileinfo.h> -#include <kglobal.h> -#include <kiconloader.h> -#include <tqstringlist.h> -#include <tqwhatsthis.h> -#include <kio/passdlg.h> -#include <kguiitem.h> -#include <kprocess.h> - -#include <stdlib.h> -#include <signal.h> -#include <cups/cups.h> - -static bool dynamically_loaded = false; -static TQString pass_string; - -extern "C" -{ -#include "cups-util.h" - KDEPRINT_EXPORT bool restartServer(TQString& msg) - { - return CupsdDialog::restartServer(msg); - } - KDEPRINT_EXPORT bool configureServer(TQWidget *parent, TQString& msg) - { - dynamically_loaded = true; - bool result = CupsdDialog::configure(TQString::null, parent, &msg); - dynamically_loaded = false; - return result; - } -} - -int getServerPid() -{ - TQDir dir("/proc",TQString::null,TQDir::Name,TQDir::Dirs); - for (uint i=0;i<dir.count();i++) - { - if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue; - TQFile f("/proc/" + dir[i] + "/cmdline"); - if (f.exists() && f.open(IO_ReadOnly)) - { - TQTextStream t(&f); - TQString line; - t >> line; - f.close(); - if (line.right(5) == "cupsd" || - line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels - // which add a null byte at the end - return dir[i].toInt(); - } - } - return (-1); -} - -const char* getPassword(const char*) -{ - TQString user(cupsUser()); - TQString pass; - - if (KIO::PasswordDialog::getNameAndPassword(user, pass, NULL) == TQDialog::Accepted) - { - cupsSetUser(user.latin1()); - pass_string = pass; - if (pass_string.isEmpty()) - return ""; - else - return pass_string.latin1(); - } - else - return NULL; -} - -//--------------------------------------------------- - -CupsdDialog::CupsdDialog(TQWidget *parent, const char *name) - : KDialogBase(IconList, "", Ok|Cancel|User1, Ok, parent, name, true, true, KGuiItem(i18n("Short Help"), "help")) -{ - KGlobal::iconLoader()->addAppDir("tdeprint"); - KGlobal::locale()->insertCatalogue("cupsdconf"); - - setShowIconsInTreeList(true); - setRootIsDecorated(false); - - pagelist_.setAutoDelete(false); - filename_ = ""; - conf_ = 0; - constructDialog(); - - setCaption(i18n("CUPS Server Configuration")); - - //resize(500, 400); -} - -CupsdDialog::~CupsdDialog() -{ - delete conf_; -} - -void CupsdDialog::addConfPage(CupsdPage *page) -{ - TQPixmap icon = KGlobal::instance()->iconLoader()->loadIcon( - page->pixmap(), - KIcon::NoGroup, - KIcon::SizeMedium - ); - - TQVBox *box = addVBoxPage(page->pageLabel(), page->header(), icon); - page->reparent(box, TQPoint(0,0)); - pagelist_.append(page); -} - -void CupsdDialog::constructDialog() -{ - addConfPage(new CupsdSplash(0)); - addConfPage(new CupsdServerPage(0)); - addConfPage(new CupsdNetworkPage(0)); - addConfPage(new CupsdSecurityPage(0)); - addConfPage(new CupsdLogPage(0)); - addConfPage(new CupsdJobsPage(0)); - addConfPage(new CupsdFilterPage(0)); - addConfPage(new CupsdDirPage(0)); - addConfPage(new CupsdBrowsingPage(0)); - - conf_ = new CupsdConf(); - for (pagelist_.first();pagelist_.current();pagelist_.next()) - { - pagelist_.current()->setInfos(conf_); - } -} - -bool CupsdDialog::setConfigFile(const TQString& filename) -{ - filename_ = filename; - if (!conf_->loadFromFile(filename_)) - { - KMessageBox::error(this, i18n("Error while loading configuration file!"), i18n("CUPS Configuration Error")); - return false; - } - if (conf_->unknown_.count() > 0) - { - // there were some unknown options, warn the user - TQString msg; - for (TQValueList< TQPair<TQString,TQString> >::ConstIterator it=conf_->unknown_.begin(); it!=conf_->unknown_.end(); ++it) - msg += ((*it).first + " = " + (*it).second + "<br>"); - msg.prepend("<p>" + i18n("Some options were not recognized by this configuration tool. " - "They will be left untouched and you won't be able to change them.") + "</p>"); - KMessageBox::sorry(this, msg, i18n("Unrecognized Options")); - } - bool ok(true); - TQString msg; - for (pagelist_.first();pagelist_.current() && ok;pagelist_.next()) - ok = pagelist_.current()->loadConfig(conf_, msg); - if (!ok) - { - KMessageBox::error(this, msg.prepend("<qt>").append("</qt>"), i18n("CUPS Configuration Error")); - return false; - } - return true; -} - -bool CupsdDialog::restartServer(TQString& msg) -{ - int serverPid = getServerPid(); - msg.truncate(0); - if (serverPid <= 0) - { - msg = i18n("Unable to find a running CUPS server"); - } - else - { - bool success = false; - KProcess proc; - proc << "tdesu" << "-c" << "/etc/init.d/cupsys restart"; - success = proc.start( KProcess::Block ) && proc.normalExit(); - if( !success ) - msg = i18n("Unable to restart CUPS server (pid = %1)").arg(serverPid); - } - return (msg.isEmpty()); -} - -bool CupsdDialog::configure(const TQString& filename, TQWidget *parent, TQString *msg) -{ - bool needUpload(false); - TQString errormsg; - bool result = true; - - // init password dialog if needed - if (!dynamically_loaded) - cupsSetPasswordCB(getPassword); - - // load config file from server - TQString fn(filename); - if (fn.isEmpty()) - { - fn = cupsGetConf(); - if (fn.isEmpty()) - errormsg = i18n("Unable to retrieve configuration file from the CUPS server. " - "You probably don't have the access permissions to perform this operation."); - else needUpload = true; - } - - // check read state (only if needed) - if (!fn.isEmpty()) - { - TQFileInfo fi(fn); - if (!fi.exists() || !fi.isReadable() || !fi.isWritable()) - errormsg = i18n("Internal error: file '%1' not readable/writable!").arg(fn); - // check file size - if (fi.size() == 0) - errormsg = i18n("Internal error: empty file '%1'!").arg(fn); - } - - if (!errormsg.isEmpty()) - { - if ( !dynamically_loaded ) - KMessageBox::error(parent, errormsg.prepend("<qt>").append("</qt>"), i18n("CUPS Configuration Error")); - result = false; - } - else - { - KGlobal::locale()->insertCatalogue("cupsdconf"); // Must be before dialog is created to translate "Short Help" - CupsdDialog dlg(parent); - if (dlg.setConfigFile(fn) && dlg.exec()) - { - TQCString encodedFn = TQFile::encodeName(fn); - if (!needUpload) - KMessageBox::information(parent, - i18n("The config file has not been uploaded to the " - "CUPS server. The daemon will not be restarted.")); - else if (!cupsPutConf(encodedFn.data())) - { - errormsg = i18n("Unable to upload the configuration file to CUPS server. " - "You probably don't have the access permissions to perform this operation."); - if ( !dynamically_loaded ) - KMessageBox::error(parent, errormsg, i18n("CUPS configuration error")); - result = false; - } - } - - } - if (needUpload) - TQFile::remove(fn); - - if ( msg ) - *msg = errormsg; - return result; -} - -void CupsdDialog::slotOk() -{ - if (conf_ && !filename_.isEmpty()) - { // try to save the file - bool ok(true); - TQString msg; - CupsdConf newconf_; - for (pagelist_.first();pagelist_.current() && ok;pagelist_.next()) - ok = pagelist_.current()->saveConfig(&newconf_, msg); - // copy unknown options - newconf_.unknown_ = conf_->unknown_; - if (!ok) - { - ; // do nothing - } - else if (!newconf_.saveToFile(filename_)) - { - msg = i18n("Unable to write configuration file %1").arg(filename_); - ok = false; - } - if (!ok) - { - KMessageBox::error(this, msg.prepend("<qt>").append("</qt>"), i18n("CUPS Configuration Error")); - } - else - KDialogBase::slotOk(); - } -} - -void CupsdDialog::slotUser1() -{ - TQWhatsThis::enterWhatsThisMode(); -} - -int CupsdDialog::serverPid() -{ - return getServerPid(); -} - -int CupsdDialog::serverOwner() -{ - int pid = getServerPid(); - if (pid > 0) - { - TQString str; - str.sprintf("/proc/%d/status",pid); - TQFile f(str); - if (f.exists() && f.open(IO_ReadOnly)) - { - TQTextStream t(&f); - while (!t.eof()) - { - str = t.readLine(); - if (str.find("Uid:",0,false) == 0) - { - TQStringList list = TQStringList::split('\t', str, false); - if (list.count() >= 2) - { - bool ok; - int u = list[1].toInt(&ok); - if (ok) return u; - } - } - } - } - } - return (-1); -} - -#include "cupsddialog.moc" diff --git a/kdeprint/cups/cupsdconf2/cupsddialog.h b/kdeprint/cups/cupsdconf2/cupsddialog.h deleted file mode 100644 index 85eee172e..000000000 --- a/kdeprint/cups/cupsdconf2/cupsddialog.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 CUPSDDIALOG_H -#define CUPSDDIALOG_H - -#include <kdialogbase.h> -#include <tqptrlist.h> - -class CupsdPage; -struct CupsdConf; - -class CupsdDialog : public KDialogBase -{ - Q_OBJECT -public: - CupsdDialog(TQWidget *parent = 0, const char *name = 0); - ~CupsdDialog(); - - bool setConfigFile(const TQString& filename); - - static bool configure(const TQString& filename = TQString::null, TQWidget *parent = 0, TQString *errormsg = 0); - static bool restartServer(TQString& msg); - static int serverPid(); - static int serverOwner(); - -protected slots: - void slotOk(); - void slotUser1(); - -protected: - void addConfPage(CupsdPage*); - void constructDialog(); - void restartServer(); - -private: - TQPtrList<CupsdPage> pagelist_; - CupsdConf *conf_; - QString filename_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsddirpage.cpp b/kdeprint/cups/cupsdconf2/cupsddirpage.cpp deleted file mode 100644 index 268465a76..000000000 --- a/kdeprint/cups/cupsdconf2/cupsddirpage.cpp +++ /dev/null @@ -1,109 +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 "cupsddirpage.h" -#include "cupsdconf.h" -#include "qdirlineedit.h" -#include "qdirmultilineedit.h" - -#include <tqlabel.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> - -#include <klocale.h> - -CupsdDirPage::CupsdDirPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Folders")); - setHeader(i18n("Folders Settings")); - setPixmap("folder"); - - datadir_ = new QDirLineEdit(false, this); - documentdir_ = new QDirLineEdit(false, this); - fontpath_ = new QDirMultiLineEdit(this); - requestdir_ = new QDirLineEdit(false, this); - serverbin_ = new QDirLineEdit(false, this); - serverfiles_ = new QDirLineEdit(false, this); - tmpfiles_ = new QDirLineEdit(false, this); - - TQLabel *l1 = new TQLabel(i18n("Data folder:"), this); - TQLabel *l2 = new TQLabel(i18n("Document folder:"), this); - TQLabel *l3 = new TQLabel(i18n("Font path:"), this); - TQLabel *l4 = new TQLabel(i18n("Request folder:"), this); - TQLabel *l5 = new TQLabel(i18n("Server binaries:"), this); - TQLabel *l6 = new TQLabel(i18n("Server files:"), this); - TQLabel *l7 = new TQLabel(i18n("Temporary files:"), this); - - TQGridLayout *m1 = new TQGridLayout(this, 8, 2, 10, 7); - m1->setRowStretch(7, 1); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(l3, 2, 0, Qt::AlignRight|Qt::AlignTop); - m1->addWidget(l4, 3, 0, Qt::AlignRight); - m1->addWidget(l5, 4, 0, Qt::AlignRight); - m1->addWidget(l6, 5, 0, Qt::AlignRight); - m1->addWidget(l7, 6, 0, Qt::AlignRight); - m1->addWidget(datadir_, 0, 1); - m1->addWidget(documentdir_, 1, 1); - m1->addWidget(fontpath_, 2, 1); - m1->addWidget(requestdir_, 3, 1); - m1->addWidget(serverbin_, 4, 1); - m1->addWidget(serverfiles_, 5, 1); - m1->addWidget(tmpfiles_, 6, 1); -} - -bool CupsdDirPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - datadir_->setURL(conf_->datadir_); - documentdir_->setURL(conf_->documentdir_); - fontpath_->setURLs(conf_->fontpath_); - requestdir_->setURL(conf_->requestdir_); - serverbin_->setURL(conf_->serverbin_); - serverfiles_->setURL(conf_->serverfiles_); - tmpfiles_->setURL(conf_->tmpfiles_); - - return true; -} - -bool CupsdDirPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->datadir_ = datadir_->url(); - conf->documentdir_ = documentdir_->url(); - conf->fontpath_ = fontpath_->urls(); - conf->requestdir_ = requestdir_->url(); - conf->serverbin_ = serverbin_->url(); - conf->serverfiles_ = serverfiles_->url(); - conf->tmpfiles_ = tmpfiles_->url(); - - return true; -} - -void CupsdDirPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(datadir_, conf->comments_.toolTip("datadir")); - TQWhatsThis::add(documentdir_, conf->comments_.toolTip("documentroot")); - TQWhatsThis::add(fontpath_, conf->comments_.toolTip("fontpath")); - TQWhatsThis::add(requestdir_, conf->comments_.toolTip("requestroot")); - TQWhatsThis::add(serverbin_, conf->comments_.toolTip("serverbin")); - TQWhatsThis::add(serverfiles_, conf->comments_.toolTip("serverroot")); - TQWhatsThis::add(tmpfiles_, conf->comments_.toolTip("tempdir")); -} diff --git a/kdeprint/cups/cupsdconf2/cupsddirpage.h b/kdeprint/cups/cupsdconf2/cupsddirpage.h deleted file mode 100644 index 571c79f21..000000000 --- a/kdeprint/cups/cupsdconf2/cupsddirpage.h +++ /dev/null @@ -1,47 +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 CUPSDDIRPAGE_H -#define CUPSDDIRPAGE_H - -#include "cupsdpage.h" - -class QDirLineEdit; -class QDirMultiLineEdit; - -class CupsdDirPage : public CupsdPage -{ -public: - CupsdDirPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -private: - QDirLineEdit *datadir_, - *documentdir_, - *requestdir_, - *serverbin_, - *serverfiles_, - *tmpfiles_; - QDirMultiLineEdit *fontpath_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdfilterpage.cpp b/kdeprint/cups/cupsdconf2/cupsdfilterpage.cpp deleted file mode 100644 index 79c8a9401..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdfilterpage.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 "cupsdfilterpage.h" -#include "cupsdconf.h" -#include "sizewidget.h" - -#include <tqlabel.h> -#include <tqlineedit.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> -#include <tqcombobox.h> - -#include <klocale.h> -#include <knuminput.h> - -CupsdFilterPage::CupsdFilterPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Filter")); - setHeader(i18n("Filter Settings")); - setPixmap("filter"); - - user_ = new TQLineEdit(this); - group_ = new TQLineEdit(this); - ripcache_ = new SizeWidget(this); - filterlimit_ = new KIntNumInput(this); - - filterlimit_->setRange(0, 1000, 1, true); - filterlimit_->setSpecialValueText(i18n("Unlimited")); - filterlimit_->setSteps(1, 10); - - TQLabel *l1 = new TQLabel(i18n("User:"), this); - TQLabel *l2 = new TQLabel(i18n("Group:"), this); - TQLabel *l3 = new TQLabel(i18n("RIP cache:"), this); - TQLabel *l4 = new TQLabel(i18n("Filter limit:"), this); - - TQGridLayout *m1 = new TQGridLayout(this, 5, 2, 10, 7); - m1->setRowStretch(4, 1); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(l3, 2, 0, Qt::AlignRight); - m1->addWidget(l4, 3, 0, Qt::AlignRight); - m1->addWidget(user_, 0, 1); - m1->addWidget(group_, 1, 1); - m1->addWidget(ripcache_, 2, 1); - m1->addWidget(filterlimit_, 3, 1); -} - -bool CupsdFilterPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - user_->setText(conf_->user_); - group_->setText(conf_->group_); - ripcache_->setSizeString(conf_->ripcache_); - filterlimit_->setValue(conf_->filterlimit_); - - return true; -} - -bool CupsdFilterPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->user_ = user_->text(); - conf->group_ = group_->text(); - conf->ripcache_ = ripcache_->sizeString(); - conf->filterlimit_ = filterlimit_->value(); - - return true; -} - -void CupsdFilterPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(user_, conf->comments_.toolTip("user")); - TQWhatsThis::add(group_, conf->comments_.toolTip("group")); - TQWhatsThis::add(ripcache_, conf->comments_.toolTip("ripcache")); - TQWhatsThis::add(filterlimit_, conf->comments_.toolTip("filterlimit")); -} diff --git a/kdeprint/cups/cupsdconf2/cupsdfilterpage.h b/kdeprint/cups/cupsdconf2/cupsdfilterpage.h deleted file mode 100644 index 18fc5d405..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdfilterpage.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 CUPSDFILTERPAGE_H -#define CUPSDFILTERPAGE_H - -#include "cupsdpage.h" - -class SizeWidget; -class TQLineEdit; -class TQComboBox; -class KIntNumInput; - -class CupsdFilterPage : public CupsdPage -{ -public: - CupsdFilterPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -private: - TQLineEdit *user_, *group_; - KIntNumInput *filterlimit_; - SizeWidget *ripcache_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdjobspage.cpp b/kdeprint/cups/cupsdconf2/cupsdjobspage.cpp deleted file mode 100644 index f12f82f1e..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdjobspage.cpp +++ /dev/null @@ -1,123 +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 "cupsdjobspage.h" -#include "cupsdconf.h" - -#include <tqlabel.h> -#include <tqcheckbox.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> - -#include <klocale.h> -#include <knuminput.h> - -CupsdJobsPage::CupsdJobsPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Jobs")); - setHeader(i18n("Print Jobs Settings")); - setPixmap("fileprint"); - - keepjobhistory_ = new TQCheckBox(i18n("Preserve job history"), this); - keepjobfiles_ = new TQCheckBox(i18n("Preserve job files"), this); - autopurgejobs_ = new TQCheckBox(i18n("Auto purge jobs"), this); - maxjobs_ = new KIntNumInput(this); - maxjobsperprinter_ = new KIntNumInput(this); - maxjobsperuser_ = new KIntNumInput(this); - - maxjobs_->setRange(0, 1000, 1, true); - maxjobs_->setSteps(1, 10); - maxjobs_->setSpecialValueText(i18n("Unlimited")); - maxjobsperprinter_->setRange(0, 1000, 1, true); - maxjobsperprinter_->setSpecialValueText(i18n("Unlimited")); - maxjobsperprinter_->setSteps(1, 10); - maxjobsperuser_->setRange(0, 1000, 1, true); - maxjobsperuser_->setSpecialValueText(i18n("Unlimited")); - maxjobsperuser_->setSteps(1, 10); - - TQLabel *l1 = new TQLabel(i18n("Max jobs:"), this); - TQLabel *l2 = new TQLabel(i18n("Max jobs per printer:"), this); - TQLabel *l3 = new TQLabel(i18n("Max jobs per user:"), this); - - TQGridLayout *m1 = new TQGridLayout(this, 7, 2, 10, 7); - m1->setRowStretch(6, 1); - m1->setColStretch(1, 1); - m1->addWidget(keepjobhistory_, 0, 1); - m1->addWidget(keepjobfiles_, 1, 1); - m1->addWidget(autopurgejobs_, 2, 1); - m1->addWidget(l1, 3, 0, Qt::AlignRight); - m1->addWidget(l2, 4, 0, Qt::AlignRight); - m1->addWidget(l3, 5, 0, Qt::AlignRight); - m1->addWidget(maxjobs_, 3, 1); - m1->addWidget(maxjobsperprinter_, 4, 1); - m1->addWidget(maxjobsperuser_, 5, 1); - - connect(keepjobhistory_, TQT_SIGNAL(toggled(bool)), TQT_SLOT(historyChanged(bool))); - keepjobhistory_->setChecked(true); -} - -bool CupsdJobsPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - keepjobhistory_->setChecked(conf_->keepjobhistory_); - if (conf_->keepjobhistory_) - { - keepjobfiles_->setChecked(conf_->keepjobfiles_); - autopurgejobs_->setChecked(conf_->autopurgejobs_); - } - maxjobs_->setValue(conf_->maxjobs_); - maxjobsperprinter_->setValue(conf_->maxjobsperprinter_); - maxjobsperuser_->setValue(conf_->maxjobsperuser_); - - return true; -} - -bool CupsdJobsPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->keepjobhistory_ = keepjobhistory_->isChecked(); - if (conf->keepjobhistory_) - { - conf->keepjobfiles_ = keepjobfiles_->isChecked(); - conf->autopurgejobs_ = autopurgejobs_->isChecked(); - } - conf->maxjobs_ = maxjobs_->value(); - conf->maxjobsperprinter_ = maxjobsperprinter_->value(); - conf->maxjobsperuser_ = maxjobsperuser_->value(); - - return true; -} - -void CupsdJobsPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(keepjobhistory_, conf->comments_.toolTip("preservejobhistory")); - TQWhatsThis::add(keepjobfiles_, conf->comments_.toolTip("preservejobfiles")); - TQWhatsThis::add(autopurgejobs_, conf->comments_.toolTip("autopurgejobs")); - TQWhatsThis::add(maxjobs_, conf->comments_.toolTip("maxjobs")); - TQWhatsThis::add(maxjobsperprinter_, conf->comments_.toolTip("maxjobsperprinter")); - TQWhatsThis::add(maxjobsperuser_, conf->comments_.toolTip("maxjobsperuser")); -} - -void CupsdJobsPage::historyChanged(bool on) -{ - keepjobfiles_->setEnabled(on); - autopurgejobs_->setEnabled(on); -} - -#include "cupsdjobspage.moc" diff --git a/kdeprint/cups/cupsdconf2/cupsdjobspage.h b/kdeprint/cups/cupsdconf2/cupsdjobspage.h deleted file mode 100644 index abbbd140d..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdjobspage.h +++ /dev/null @@ -1,47 +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 CUPSDJOBSPAGE_H -#define CUPSDJOBSPAGE_H - -#include "cupsdpage.h" - -class KIntNumInput; -class TQCheckBox; - -class CupsdJobsPage : public CupsdPage -{ - Q_OBJECT - -public: - CupsdJobsPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -protected slots: - void historyChanged(bool); - -private: - KIntNumInput *maxjobs_, *maxjobsperprinter_, *maxjobsperuser_; - TQCheckBox *keepjobhistory_, *keepjobfiles_, *autopurgejobs_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdlogpage.cpp b/kdeprint/cups/cupsdconf2/cupsdlogpage.cpp deleted file mode 100644 index 61a89f933..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdlogpage.cpp +++ /dev/null @@ -1,111 +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 "cupsdlogpage.h" -#include "cupsdconf.h" -#include "qdirlineedit.h" -#include "sizewidget.h" - -#include <tqlabel.h> -#include <tqcombobox.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> - -#include <klocale.h> -#include <kfiledialog.h> - -CupsdLogPage::CupsdLogPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Log")); - setHeader(i18n("Log Settings")); - setPixmap("contents"); - - accesslog_ = new QDirLineEdit(true, this); - errorlog_ = new QDirLineEdit(true, this); - pagelog_ = new QDirLineEdit(true, this); - maxlogsize_ = new SizeWidget(this); - loglevel_ = new TQComboBox(this); - - loglevel_->insertItem(i18n("Detailed Debugging")); - loglevel_->insertItem(i18n("Debug Information")); - loglevel_->insertItem(i18n("General Information")); - loglevel_->insertItem(i18n("Warnings")); - loglevel_->insertItem(i18n("Errors")); - loglevel_->insertItem(i18n("No Logging")); - - /*maxlogsize_->setRange(0, 100, 1, true); - maxlogsize_->setSteps(1, 5); - maxlogsize_->setSpecialValueText(i18n("Unlimited")); - maxlogsize_->setSuffix(i18n("MB"));*/ - - TQLabel *l1 = new TQLabel(i18n("Access log:"), this); - TQLabel *l2 = new TQLabel(i18n("Error log:"), this); - TQLabel *l3 = new TQLabel(i18n("Page log:"), this); - TQLabel *l4 = new TQLabel(i18n("Max log size:"), this); - TQLabel *l5 = new TQLabel(i18n("Log level:"), this); - - loglevel_->setCurrentItem(2); - - TQGridLayout *m1 = new TQGridLayout(this, 6, 2, 10, 7); - m1->setRowStretch(5, 1); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(l3, 2, 0, Qt::AlignRight); - m1->addWidget(l4, 3, 0, Qt::AlignRight); - m1->addWidget(l5, 4, 0, Qt::AlignRight); - m1->addWidget(accesslog_, 0, 1); - m1->addWidget(errorlog_, 1, 1); - m1->addWidget(pagelog_, 2, 1); - m1->addWidget(maxlogsize_, 3, 1); - m1->addWidget(loglevel_, 4, 1); -} - -bool CupsdLogPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - accesslog_->setURL(conf_->accesslog_); - errorlog_->setURL(conf_->errorlog_); - pagelog_->setURL(conf_->pagelog_); - maxlogsize_->setSizeString(conf_->maxlogsize_); - loglevel_->setCurrentItem(conf_->loglevel_); - - return true; -} - -bool CupsdLogPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->accesslog_ = accesslog_->url(); - conf->errorlog_ = errorlog_->url(); - conf->pagelog_ = pagelog_->url(); - conf->maxlogsize_ = maxlogsize_->sizeString(); - conf->loglevel_ = loglevel_->currentItem(); - - return true; -} - -void CupsdLogPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(accesslog_, conf->comments_.toolTip("accesslog")); - TQWhatsThis::add(errorlog_, conf->comments_.toolTip("errorlog")); - TQWhatsThis::add(pagelog_, conf->comments_.toolTip("pagelog")); - TQWhatsThis::add(maxlogsize_, conf->comments_.toolTip("maxlogsize")); - TQWhatsThis::add(loglevel_, conf->comments_.toolTip("loglevel")); -} diff --git a/kdeprint/cups/cupsdconf2/cupsdlogpage.h b/kdeprint/cups/cupsdconf2/cupsdlogpage.h deleted file mode 100644 index 618f612be..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdlogpage.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 CUPSDLOGPAGE_H -#define CUPSDLOGPAGE_H - -#include "cupsdpage.h" - -class QDirLineEdit; -class SizeWidget; -class TQComboBox; - -class CupsdLogPage : public CupsdPage -{ -public: - CupsdLogPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -private: - QDirLineEdit *accesslog_, *errorlog_, *pagelog_; - TQComboBox *loglevel_; - SizeWidget *maxlogsize_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdnetworkpage.cpp b/kdeprint/cups/cupsdconf2/cupsdnetworkpage.cpp deleted file mode 100644 index 9edca5868..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdnetworkpage.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 "cupsdnetworkpage.h" -#include "cupsdconf.h" -#include "editlist.h" -#include "portdialog.h" -#include "sizewidget.h" - -#include <tqlabel.h> -#include <tqcheckbox.h> -#include <tqcombobox.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> - -#include <klocale.h> -#include <knuminput.h> - -CupsdNetworkPage::CupsdNetworkPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Network")); - setHeader(i18n("Network Settings")); - setPixmap("network"); - - keepalive_ = new TQCheckBox(i18n("Keep alive"), this); - keepalivetimeout_ = new KIntNumInput(this); - maxclients_ = new KIntNumInput(this); - maxrequestsize_ = new SizeWidget(this); - clienttimeout_ = new KIntNumInput(this); - hostnamelookup_ = new TQComboBox(this); - listen_ = new EditList(this); - - keepalivetimeout_->setRange(0, 10000, 1, true); - keepalivetimeout_->setSteps(1, 10); - keepalivetimeout_->setSpecialValueText(i18n("Unlimited")); - keepalivetimeout_->setSuffix(i18n(" sec")); - - maxclients_->setRange(1, 1000, 1, true); - maxclients_->setSteps(1, 10); - - clienttimeout_->setRange(0, 10000, 1, true); - clienttimeout_->setSteps(1, 10); - clienttimeout_->setSpecialValueText(i18n("Unlimited")); - clienttimeout_->setSuffix(i18n(" sec")); - - hostnamelookup_->insertItem(i18n("Off")); - hostnamelookup_->insertItem(i18n("On")); - hostnamelookup_->insertItem(i18n("Double")); - - TQLabel *l1 = new TQLabel(i18n("Hostname lookups:"), this); - TQLabel *l2 = new TQLabel(i18n("Keep-alive timeout:"), this); - TQLabel *l3 = new TQLabel(i18n("Max clients:"), this); - TQLabel *l4 = new TQLabel(i18n("Max request size:"), this); - TQLabel *l5 = new TQLabel(i18n("Client timeout:"), this); - TQLabel *l6 = new TQLabel(i18n("Listen to:"), this); - - TQGridLayout *m1 = new TQGridLayout(this, 8, 2, 10, 7); - m1->setRowStretch(7, 1); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 2, 0, Qt::AlignRight); - m1->addWidget(l3, 3, 0, Qt::AlignRight); - m1->addWidget(l4, 4, 0, Qt::AlignRight); - m1->addWidget(l5, 5, 0, Qt::AlignRight); - m1->addWidget(l6, 6, 0, Qt::AlignTop|Qt::AlignRight); - m1->addWidget(keepalive_, 1, 1); - m1->addWidget(hostnamelookup_, 0, 1); - m1->addWidget(keepalivetimeout_, 2, 1); - m1->addWidget(maxclients_, 3, 1); - m1->addWidget(maxrequestsize_, 4, 1); - m1->addWidget(clienttimeout_, 5, 1); - m1->addWidget(listen_, 6, 1); - - connect(listen_, TQT_SIGNAL(add()), TQT_SLOT(slotAdd())); - connect(listen_, TQT_SIGNAL(edit(int)), TQT_SLOT(slotEdit(int))); - connect(listen_, TQT_SIGNAL(defaultList()), TQT_SLOT(slotDefaultList())); - connect(keepalive_, TQT_SIGNAL(toggled(bool)), keepalivetimeout_, TQT_SLOT(setEnabled(bool))); - keepalive_->setChecked(true); -} - -bool CupsdNetworkPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - hostnamelookup_->setCurrentItem(conf_->hostnamelookup_); - keepalive_->setChecked(conf_->keepalive_); - keepalivetimeout_->setValue(conf_->keepalivetimeout_); - maxclients_->setValue(conf_->maxclients_); - maxrequestsize_->setSizeString(conf_->maxrequestsize_); - clienttimeout_->setValue(conf_->clienttimeout_); - listen_->insertItems(conf_->listenaddresses_); - - return true; -} - -bool CupsdNetworkPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->hostnamelookup_ = hostnamelookup_->currentItem(); - conf->keepalive_ = keepalive_->isChecked(); - conf->keepalivetimeout_ = keepalivetimeout_->value(); - conf->maxclients_ = maxclients_->value(); - conf->maxrequestsize_ = maxrequestsize_->sizeString(); - conf->clienttimeout_ = clienttimeout_->value(); - conf->listenaddresses_ = listen_->items(); - - return true; -} - -void CupsdNetworkPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(hostnamelookup_, conf->comments_.toolTip("hostnamelookups")); - TQWhatsThis::add(keepalive_, conf->comments_.toolTip("keepalive")); - TQWhatsThis::add(keepalivetimeout_, conf->comments_.toolTip("keepalivetimeout")); - TQWhatsThis::add(maxclients_, conf->comments_.toolTip("maxclients")); - TQWhatsThis::add(maxrequestsize_, conf->comments_.toolTip("maxrequestsize")); - TQWhatsThis::add(clienttimeout_, conf->comments_.toolTip("timeout")); - TQWhatsThis::add(listen_, conf->comments_.toolTip("listen")); -} - -void CupsdNetworkPage::slotAdd() -{ - TQString s = PortDialog::newListen(this, conf_); - if (!s.isEmpty()) - listen_->insertItem(s); -} - -void CupsdNetworkPage::slotEdit(int index) -{ - TQString s = listen_->text(index); - s = PortDialog::editListen(s, this, conf_); - if (!s.isEmpty()) - listen_->setText(index, s); -} - -void CupsdNetworkPage::slotDefaultList() -{ - listen_->clear(); - TQStringList l; - l << "Listen *:631"; - listen_->insertItems(l); -} - -#include "cupsdnetworkpage.moc" diff --git a/kdeprint/cups/cupsdconf2/cupsdnetworkpage.h b/kdeprint/cups/cupsdconf2/cupsdnetworkpage.h deleted file mode 100644 index be46c280f..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdnetworkpage.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 CUPSDNETWORKPAGE_H -#define CUPSDNETWORKPAGE_H - -#include "cupsdpage.h" - -class KIntNumInput; -class TQCheckBox; -class TQComboBox; -class EditList; -class SizeWidget; - -class CupsdNetworkPage : public CupsdPage -{ - Q_OBJECT - -public: - CupsdNetworkPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -protected slots: - void slotAdd(); - void slotEdit(int); - void slotDefaultList(); - -private: - KIntNumInput *keepalivetimeout_, *maxclients_, *clienttimeout_; - TQComboBox *hostnamelookup_; - TQCheckBox *keepalive_; - EditList *listen_; - SizeWidget *maxrequestsize_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdpage.cpp b/kdeprint/cups/cupsdconf2/cupsdpage.cpp deleted file mode 100644 index 68bdde7a6..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdpage.cpp +++ /dev/null @@ -1,32 +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 "cupsdpage.h" - -CupsdPage::CupsdPage(TQWidget *parent, const char *name) - : TQWidget(parent, name) -{ - conf_ = 0; -} - -CupsdPage::~CupsdPage() -{ -} - -#include "cupsdpage.moc" diff --git a/kdeprint/cups/cupsdconf2/cupsdpage.h b/kdeprint/cups/cupsdconf2/cupsdpage.h deleted file mode 100644 index aadbd54b9..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdpage.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 CUPSDPAGE_H -#define CUPSDPAGE_H - -#include <tqwidget.h> - -struct CupsdConf; - -class CupsdPage : public TQWidget -{ - Q_OBJECT -public: - CupsdPage(TQWidget *parent = 0, const char *name = 0); - virtual ~CupsdPage(); - - virtual bool loadConfig(CupsdConf *conf, TQString& msg) = 0; - virtual bool saveConfig(CupsdConf *conf, TQString& msg) = 0; - virtual void setInfos(CupsdConf*) {} - - TQString pageLabel() const { return label_; } - TQString header() const { return header_; } - TQString pixmap() const { return pixmap_; } - -protected: - void setPageLabel(const TQString& s) { label_ = s; } - void setHeader(const TQString& s) { header_ = s; } - void setPixmap(const TQString& s) { pixmap_ = s; } - -protected: - CupsdConf *conf_; - QString label_; - QString header_; - QString pixmap_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdsecuritypage.cpp b/kdeprint/cups/cupsdconf2/cupsdsecuritypage.cpp deleted file mode 100644 index 092e1a7e5..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdsecuritypage.cpp +++ /dev/null @@ -1,168 +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 "cupsdsecuritypage.h" -#include "cupsdconf.h" -#include "qdirlineedit.h" -#include "editlist.h" -#include "locationdialog.h" - -#include <tqlabel.h> -#include <tqlineedit.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> - -#include <klocale.h> -#include <kiconloader.h> -#include <kmessagebox.h> - -CupsdSecurityPage::CupsdSecurityPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Security")); - setHeader(i18n("Security Settings")); - setPixmap("password"); - locs_.setAutoDelete(true); - - remoteroot_ = new TQLineEdit(this); - systemgroup_ = new TQLineEdit(this); - encryptcert_ = new QDirLineEdit(true, this); - encryptkey_ = new QDirLineEdit(true, this); - locations_ = new EditList(this); - - TQLabel *l1 = new TQLabel(i18n("Remote root user:"), this); - TQLabel *l2 = new TQLabel(i18n("System group:"), this); - TQLabel *l3 = new TQLabel(i18n("Encryption certificate:"), this); - TQLabel *l4 = new TQLabel(i18n("Encryption key:"), this); - TQLabel *l5 = new TQLabel(i18n("Locations:"), this); - - TQGridLayout *m1 = new TQGridLayout(this, 6, 2, 10, 7); - m1->setRowStretch(5, 1); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(l3, 2, 0, Qt::AlignRight); - m1->addWidget(l4, 3, 0, Qt::AlignRight); - m1->addWidget(l5, 4, 0, Qt::AlignRight|Qt::AlignTop); - m1->addWidget(remoteroot_, 0, 1); - m1->addWidget(systemgroup_, 1, 1); - m1->addWidget(encryptcert_, 2, 1); - m1->addWidget(encryptkey_, 3, 1); - m1->addWidget(locations_, 4, 1); - - connect(locations_, TQT_SIGNAL(add()), TQT_SLOT(slotAdd())); - connect(locations_, TQT_SIGNAL(edit(int)), TQT_SLOT(slotEdit(int))); - connect(locations_, TQT_SIGNAL(defaultList()), TQT_SLOT(slotDefaultList())); - connect(locations_, TQT_SIGNAL(deleted(int)), TQT_SLOT(slotDeleted(int))); -} - -bool CupsdSecurityPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - remoteroot_->setText(conf_->remoteroot_); - systemgroup_->setText(conf_->systemgroup_); - encryptcert_->setURL(conf_->encryptcert_); - encryptkey_->setURL(conf_->encryptkey_); - locs_.clear(); - TQPtrListIterator<CupsLocation> it(conf_->locations_); - for (;it.current();++it) - { - locs_.append(new CupsLocation(*(it.current()))); - if (it.current()->resource_) - locations_->insertItem(SmallIcon(CupsResource::typeToIconName(it.current()->resource_->type_)), it.current()->resource_->text_); - else - locations_->insertItem(it.current()->resourcename_); - } - - return true; -} - -bool CupsdSecurityPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->remoteroot_ = remoteroot_->text(); - conf->systemgroup_ = systemgroup_->text(); - conf->encryptcert_ = encryptcert_->url(); - conf->encryptkey_ = encryptkey_->url(); - conf->locations_.clear(); - TQPtrListIterator<CupsLocation> it(locs_); - for (;it.current();++it) - conf->locations_.append(new CupsLocation(*(it.current()))); - - return true; -} - -void CupsdSecurityPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(remoteroot_, conf->comments_.toolTip("remoteroot")); - TQWhatsThis::add(systemgroup_, conf->comments_.toolTip("systemgroup")); - TQWhatsThis::add(encryptcert_, conf->comments_.toolTip("servercertificate")); - TQWhatsThis::add(encryptkey_, conf->comments_.toolTip("serverkey")); - TQWhatsThis::add(locations_, conf->comments_.toolTip("locationsshort")); -} - -void CupsdSecurityPage::slotAdd() -{ - CupsLocation *loc = new CupsLocation; - if (LocationDialog::newLocation(loc, this, conf_)) - { - int index(-1); - for (locs_.first(); locs_.current(); locs_.next()) - if (locs_.current()->resource_ == loc->resource_) - { - if (KMessageBox::warningContinueCancel(this, i18n("This location is already defined. Do you want to replace the existing one?"),TQString::null,i18n("Replace")) == KMessageBox::Continue) - { - index = locs_.tqat(); - locs_.remove(); - break; - } - else - { - delete loc; - return; - } - } - - if (index == -1) - index = locs_.count(); - locs_.insert(index, loc); - locations_->insertItem(SmallIcon(loc->resource_->typeToIconName(loc->resource_->type_)), loc->resource_->text_); - } - else - delete loc; -} - -void CupsdSecurityPage::slotEdit(int index) -{ - CupsLocation *loc = locs_.tqat(index); - LocationDialog::editLocation(loc, this, conf_); -} - -void CupsdSecurityPage::slotDefaultList() -{ - locs_.clear(); - locations_->clear(); -} - -void CupsdSecurityPage::slotDeleted(int index) -{ - if (index >= 0 && index < (int)(locs_.count())) - locs_.remove(index); -} - -#include "cupsdsecuritypage.moc" diff --git a/kdeprint/cups/cupsdconf2/cupsdsecuritypage.h b/kdeprint/cups/cupsdconf2/cupsdsecuritypage.h deleted file mode 100644 index 5e97c1cf8..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdsecuritypage.h +++ /dev/null @@ -1,56 +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 CUPSDSECURITYPAGE_H -#define CUPSDSECURITYPAGE_H - -#include "cupsdpage.h" -#include <tqptrlist.h> - -class TQLineEdit; -class EditList; -class QDirLineEdit; -struct CupsLocation; - -class CupsdSecurityPage : public CupsdPage -{ - Q_OBJECT - -public: - CupsdSecurityPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -protected slots: - void slotAdd(); - void slotEdit(int); - void slotDefaultList(); - void slotDeleted(int); - -private: - TQLineEdit *remoteroot_, *systemgroup_; - QDirLineEdit *encryptcert_, *encryptkey_; - EditList *locations_; - - TQPtrList<CupsLocation> locs_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdserverpage.cpp b/kdeprint/cups/cupsdconf2/cupsdserverpage.cpp deleted file mode 100644 index cfd731430..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdserverpage.cpp +++ /dev/null @@ -1,181 +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 "cupsdserverpage.h" -#include "cupsdconf.h" - -#include <tqlineedit.h> -#include <tqlabel.h> -#include <tqcheckbox.h> -#include <tqcombobox.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> - -#include <klocale.h> - -int findComboItem(TQComboBox *cb, const TQString& str) -{ - for (int i=0; i<cb->count(); i++) - if (cb->text(i) == str) - return i; - return (-1); -} - -CupsdServerPage::CupsdServerPage(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setPageLabel(i18n("Server")); - setHeader(i18n("Server Settings")); - setPixmap("gear"); - - servername_ = new TQLineEdit(this); - serveradmin_ = new TQLineEdit(this); - otherclassname_ = new TQLineEdit(this); - language_ = new TQLineEdit(this); - printcap_ = new TQLineEdit(this); - classification_ = new TQComboBox(this); - charset_ = new TQComboBox(this); - printcapformat_ = new TQComboBox(this); - classoverride_ = new TQCheckBox(i18n("Allow overrides"), this); - - classification_->insertItem(i18n("None")); - classification_->insertItem(i18n("Classified")); - classification_->insertItem(i18n("Confidential")); - classification_->insertItem(i18n("Secret")); - classification_->insertItem(i18n("Top Secret")); - classification_->insertItem(i18n("Unclassified")); - classification_->insertItem(i18n("Other")); - - charset_->insertItem("UTF-8"); - charset_->insertItem("ISO-8859-1"); - charset_->insertItem("ISO-8859-2"); - charset_->insertItem("ISO-8859-3"); - charset_->insertItem("ISO-8859-4"); - charset_->insertItem("ISO-8859-5"); - charset_->insertItem("ISO-8859-6"); - charset_->insertItem("ISO-8859-7"); - charset_->insertItem("ISO-8859-8"); - charset_->insertItem("ISO-8859-9"); - charset_->insertItem("ISO-8859-10"); - charset_->insertItem("ISO-8859-13"); - charset_->insertItem("ISO-8859-14"); - charset_->insertItem("ISO-8859-15"); - - printcapformat_->insertItem("BSD"); - printcapformat_->insertItem("SOLARIS"); - - TQLabel *l1 = new TQLabel(i18n("Server name:"), this); - TQLabel *l2 = new TQLabel(i18n("Server administrator:"), this); - TQLabel *l3 = new TQLabel(i18n("Classification:"), this); - TQLabel *l4 = new TQLabel(i18n("Default character set:"), this); - TQLabel *l5 = new TQLabel(i18n("Default language:"), this); - TQLabel *l6 = new TQLabel(i18n("Printcap file:"), this); - TQLabel *l7 = new TQLabel(i18n("Printcap format:"), this); - - connect(classification_, TQT_SIGNAL(activated(int)), TQT_SLOT(classChanged(int))); - classification_->setCurrentItem(0); - charset_->setCurrentItem(0); - printcapformat_->setCurrentItem(0); - classChanged(0); - - TQGridLayout *m1 = new TQGridLayout(this, 9, 2, 10, 7); - m1->setRowStretch(8, 1); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(l3, 2, 0, Qt::AlignRight); - m1->addWidget(l4, 4, 0, Qt::AlignRight); - m1->addWidget(l5, 5, 0, Qt::AlignRight); - m1->addWidget(l6, 6, 0, Qt::AlignRight); - m1->addWidget(l7, 7, 0, Qt::AlignRight); - m1->addWidget(servername_, 0, 1); - m1->addWidget(serveradmin_, 1, 1); - m1->addWidget(charset_, 4, 1); - m1->addWidget(language_, 5, 1); - m1->addWidget(printcap_, 6, 1); - m1->addWidget(printcapformat_, 7, 1); - TQHBoxLayout *m2 = new TQHBoxLayout(0, 0, 5); - m1->addLayout(m2, 2, 1); - m2->addWidget(classification_); - m2->addWidget(otherclassname_); - TQWidget *w = new TQWidget(this); - w->setFixedWidth(20); - TQHBoxLayout *m3 = new TQHBoxLayout(0, 0, 0); - m1->addLayout(m3, 3, 1); - m3->addWidget(w); - m3->addWidget(classoverride_); -} - -bool CupsdServerPage::loadConfig(CupsdConf *conf, TQString&) -{ - conf_ = conf; - servername_->setText(conf_->servername_); - serveradmin_->setText(conf_->serveradmin_); - classification_->setCurrentItem(conf_->classification_); - classChanged(conf_->classification_); - if (conf->classification_ != CLASS_NONE) - classoverride_->setChecked(conf_->classoverride_); - if (conf->classification_ == CLASS_OTHER) - otherclassname_->setText(conf_->otherclassname_); - int index = findComboItem(charset_, conf_->charset_.upper()); - if (index != -1) - charset_->setCurrentItem(index); - language_->setText(conf_->language_); - printcap_->setText(conf_->printcap_); - printcapformat_->setCurrentItem(conf_->printcapformat_); - - return true; -} - -bool CupsdServerPage::saveConfig(CupsdConf *conf, TQString&) -{ - conf->servername_ = servername_->text(); - conf->serveradmin_ = serveradmin_->text(); - conf->classification_ = classification_->currentItem(); - if (conf->classification_ != CLASS_NONE) - conf->classoverride_ = classoverride_->isChecked(); - if (conf->classification_ == CLASS_OTHER) - conf->otherclassname_ = otherclassname_->text(); - conf->charset_ = charset_->currentText(); - conf->language_ = language_->text(); - conf->printcap_ = printcap_->text(); - conf->printcapformat_ = printcapformat_->currentItem(); - - return true; -} - -void CupsdServerPage::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(servername_, conf->comments_.toolTip("servername")); - TQWhatsThis::add(serveradmin_, conf->comments_.toolTip("serveradmin")); - TQWhatsThis::add(classification_, conf->comments_.toolTip("classification")); - TQWhatsThis::add(classoverride_, conf->comments_.toolTip("classifyoverride")); - TQWhatsThis::add(charset_, conf->comments_.toolTip("defaultcharset")); - TQWhatsThis::add(language_, conf->comments_.toolTip("defaultlanguage")); - TQWhatsThis::add(printcap_, conf->comments_.toolTip("printcap")); - TQWhatsThis::add(printcapformat_, conf->comments_.toolTip("printcapformat")); -} - -void CupsdServerPage::classChanged(int index) -{ - classoverride_->setEnabled(index != 0); - otherclassname_->setEnabled(index == CLASS_OTHER); -} - -#include "cupsdserverpage.moc" diff --git a/kdeprint/cups/cupsdconf2/cupsdserverpage.h b/kdeprint/cups/cupsdconf2/cupsdserverpage.h deleted file mode 100644 index f1f9eed2f..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdserverpage.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 CUPSDSERVERPAGE_H -#define CUPSDSERVERPAGE_H - -#include "cupsdpage.h" - -class TQLineEdit; -class TQCheckBox; -class TQComboBox; - -class CupsdServerPage : public CupsdPage -{ - Q_OBJECT - -public: - CupsdServerPage(TQWidget *parent = 0, const char *name = 0); - - bool loadConfig(CupsdConf*, TQString&); - bool saveConfig(CupsdConf*, TQString&); - void setInfos(CupsdConf*); - -protected slots: - void classChanged(int); - -private: - TQLineEdit *servername_, *serveradmin_, *language_, *printcap_, *otherclassname_; - TQComboBox *classification_, *charset_, *printcapformat_; - TQCheckBox *classoverride_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/cupsdsplash.cpp b/kdeprint/cups/cupsdconf2/cupsdsplash.cpp deleted file mode 100644 index c26b65fd7..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdsplash.cpp +++ /dev/null @@ -1,73 +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 "cupsdsplash.h" - -#include <tqlabel.h> -#include <tqpixmap.h> -#include <tqlayout.h> -#include <klocale.h> -#include <kstandarddirs.h> - -CupsdSplash::CupsdSplash(TQWidget *parent, const char *name) - : CupsdPage(parent, name) -{ - setHeader(i18n("Welcome to the CUPS Server Configuration Tool")); - setPageLabel(i18n("Welcome")); - setPixmap("go"); - - TQVBoxLayout *main_ = new TQVBoxLayout(this, 10, 10); - TQHBoxLayout *sub_ = new TQHBoxLayout(0, 0, 10); - main_->addLayout(sub_); - - TQLabel *cupslogo_ = new TQLabel(this); - TQString logopath = locate("data", TQString("tdeprint/cups_logo.png")); - cupslogo_->setPixmap(logopath.isEmpty() ? TQPixmap() : TQPixmap(logopath)); - cupslogo_->tqsetAlignment(Qt::AlignCenter); - TQLabel *kupslogo_ = new TQLabel(this); - logopath = locate("data", TQString("tdeprint/kde_logo.png")); - kupslogo_->setPixmap(logopath.isEmpty() ? TQPixmap() : TQPixmap(logopath)); - kupslogo_->tqsetAlignment(Qt::AlignCenter); - - TQLabel *helptxt_ = new TQLabel(this); - helptxt_->setText(i18n( "<p>This tool will help you to configure graphically the server of the CUPS printing system. " - "The available options are grouped into sets of related topics and can be accessed " - "quickly through the icon view located on the left. Each option has a default value that is " - "shown if it has not been previously set. This default value should be OK in most cases.</p><br>" - "<p>You can access a short help message for each option using either the '?' button in the " - "the title bar, or the button at the bottom of this dialog.</p>")); - - sub_->addWidget(cupslogo_); - sub_->addWidget(kupslogo_); - main_->addWidget(helptxt_, 1); -} - -CupsdSplash::~CupsdSplash() -{ -} - -bool CupsdSplash::loadConfig(CupsdConf*, TQString&) -{ - return true; -} - -bool CupsdSplash::saveConfig(CupsdConf*, TQString&) -{ - return true; -} diff --git a/kdeprint/cups/cupsdconf2/cupsdsplash.h b/kdeprint/cups/cupsdconf2/cupsdsplash.h deleted file mode 100644 index f484958d4..000000000 --- a/kdeprint/cups/cupsdconf2/cupsdsplash.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 CUPSDSPLASH_H -#define CUPSDSPLASH_H - -#include "cupsdpage.h" - -class CupsdSplash : public CupsdPage -{ -public: - CupsdSplash(TQWidget *parent = 0, const char *name = 0); - ~CupsdSplash(); - - bool loadConfig(CupsdConf *conf, TQString& msg); - bool saveConfig(CupsdConf *conf, TQString& msg); -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/editlist.cpp b/kdeprint/cups/cupsdconf2/editlist.cpp deleted file mode 100644 index 754c9659e..000000000 --- a/kdeprint/cups/cupsdconf2/editlist.cpp +++ /dev/null @@ -1,124 +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 "editlist.h" - -#include <klistbox.h> -#include <kpushbutton.h> -#include <tqlayout.h> -#include <klocale.h> -#include <kiconloader.h> -#include <kguiitem.h> - -EditList::EditList(TQWidget *parent, const char *name) - : TQWidget(parent, name) -{ - list_ = new KListBox(this); - addbtn_ = new KPushButton(KGuiItem(i18n("Add..."), "filenew"), this); - editbtn_ = new KPushButton(KGuiItem(i18n("Edit..."), "edit"), this); - delbtn_ = new KPushButton(KGuiItem(i18n("Delete"), "editdelete"), this); - defbtn_ = new KPushButton(KGuiItem(i18n("Default List"), "history"), this); - - TQGridLayout *m1 = new TQGridLayout(this, 4, 2, 0, 0); - m1->setColStretch(0, 1); - m1->addMultiCellWidget(list_, 0, 3, 0, 1); - m1->addWidget(addbtn_, 0, 1); - m1->addWidget(editbtn_, 1, 1); - m1->addWidget(delbtn_, 2, 1); - m1->addWidget(defbtn_, 3, 1); - - connect(addbtn_, TQT_SIGNAL(clicked()), TQT_SIGNAL(add())); - connect(editbtn_, TQT_SIGNAL(clicked()), TQT_SLOT(slotEdit())); - connect(delbtn_, TQT_SIGNAL(clicked()), TQT_SLOT(slotDelete())); - connect(defbtn_, TQT_SIGNAL(clicked()), TQT_SIGNAL(defaultList())); - connect(list_, TQT_SIGNAL(highlighted(int)), TQT_SLOT(slotSelected(int))); - slotSelected(-1); -} - -void EditList::slotEdit() -{ - int index = list_->currentItem(); - if (index >= 0) - emit edit(index); -} - -void EditList::slotDelete() -{ - int index = list_->currentItem(); - list_->removeItem(index); - slotSelected((list_->count() > 0 ? list_->currentItem() : -1)); - emit deleted(index); -} - -void EditList::slotSelected(int index) -{ - editbtn_->setEnabled(index >= 0); - delbtn_->setEnabled(index >= 0); -} - -TQString EditList::text(int index) -{ - return list_->text(index); -} - -void EditList::setText(int index, const TQString& s) -{ - if (list_->text(index) != s) - { - TQListBoxItem *it = list_->findItem(s, TQt::ExactMatch); - if (!it) - list_->changeItem(s, index); - else - list_->removeItem(index); - } -} - -void EditList::clear() -{ - list_->clear(); - slotSelected(-1); -} - -void EditList::insertItem(const TQString& s) -{ - if (!list_->findItem(s, TQt::ExactMatch)) - list_->insertItem(s); -} - -void EditList::insertItem(const TQPixmap& icon, const TQString& s) -{ - if (!list_->findItem(s, TQt::ExactMatch)) - list_->insertItem(icon, s); -} - -void EditList::insertItems(const TQStringList& l) -{ - for (TQStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) - insertItem(*it); -} - -TQStringList EditList::items() -{ - TQStringList l; - for (uint i=0; i<list_->count(); i++) - l << list_->text(i); - return l; -} - -#include "editlist.moc" diff --git a/kdeprint/cups/cupsdconf2/editlist.h b/kdeprint/cups/cupsdconf2/editlist.h deleted file mode 100644 index a0fc7ee0a..000000000 --- a/kdeprint/cups/cupsdconf2/editlist.h +++ /dev/null @@ -1,60 +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 EDITLIST_H -#define EDITLIST_H - -#include <tqwidget.h> -#include <tqpixmap.h> - -class KListBox; -class TQPushButton; - -class EditList : public TQWidget -{ - Q_OBJECT - -public: - EditList(TQWidget *parent = 0, const char *name = 0); - - TQString text(int); - void setText(int, const TQString&); - void insertItem(const TQString&); - void insertItem(const TQPixmap&, const TQString&); - void insertItems(const TQStringList&); - TQStringList items(); - void clear(); - -signals: - void add(); - void edit(int); - void defaultList(); - void deleted(int); - -protected slots: - void slotDelete(); - void slotEdit(); - void slotSelected(int); - -private: - KListBox *list_; - TQPushButton *addbtn_, *editbtn_, *delbtn_, *defbtn_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/kde_logo.png b/kdeprint/cups/cupsdconf2/kde_logo.png Binary files differdeleted file mode 100644 index 6ba204607..000000000 --- a/kdeprint/cups/cupsdconf2/kde_logo.png +++ /dev/null diff --git a/kdeprint/cups/cupsdconf2/locationdialog.cpp b/kdeprint/cups/cupsdconf2/locationdialog.cpp deleted file mode 100644 index 7e1858cc7..000000000 --- a/kdeprint/cups/cupsdconf2/locationdialog.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 "locationdialog.h" -#include "cupsdconf.h" -#include "editlist.h" -#include "addressdialog.h" - -#include <tqlineedit.h> -#include <tqcombobox.h> -#include <tqlayout.h> -#include <tqlabel.h> -#include <tqpushbutton.h> -#include <tqwhatsthis.h> - -#include <klocale.h> -#include <kiconloader.h> - -LocationDialog::LocationDialog(TQWidget *parent, const char *name) - : KDialogBase(parent, name, true, TQString::null, Ok|Cancel, Ok, true) -{ - TQWidget *dummy = new TQWidget(this); - setMainWidget(dummy); - resource_ = new TQComboBox(dummy); - authtype_ = new TQComboBox(dummy); - authclass_ = new TQComboBox(dummy); - authname_ = new TQLineEdit(dummy); - encryption_ = new TQComboBox(dummy); - satisfy_ = new TQComboBox(dummy); - order_ = new TQComboBox(dummy); - addresses_ = new EditList(dummy); - - authtype_->insertItem(i18n("None")); - authtype_->insertItem(i18n("Basic")); - authtype_->insertItem(i18n("Digest")); - - authclass_->insertItem(i18n("None")); - authclass_->insertItem(i18n("User")); - authclass_->insertItem(i18n("System")); - authclass_->insertItem(i18n("Group")); - - encryption_->insertItem(i18n("Always")); - encryption_->insertItem(i18n("Never")); - encryption_->insertItem(i18n("Required")); - encryption_->insertItem(i18n("If Requested")); - - satisfy_->insertItem(i18n("All")); - satisfy_->insertItem(i18n("Any")); - - order_->insertItem(i18n("Allow, Deny")); - order_->insertItem(i18n("Deny, Allow")); - - connect(authclass_, TQT_SIGNAL(activated(int)), TQT_SLOT(slotClassChanged(int))); - connect(authtype_, TQT_SIGNAL(activated(int)), TQT_SLOT(slotTypeChanged(int))); - - TQLabel *l1 = new TQLabel(i18n("Resource:"), dummy); - TQLabel *l2 = new TQLabel(i18n("Authentication:"), dummy); - TQLabel *l3 = new TQLabel(i18n("Class:"), dummy); - TQLabel *l4 = new TQLabel(i18n("Names:"), dummy); - TQLabel *l5 = new TQLabel(i18n("Encryption:"), dummy); - TQLabel *l6 = new TQLabel(i18n("Satisfy:"), dummy); - TQLabel *l7 = new TQLabel(i18n("ACL order:"), dummy); - TQLabel *l8 = new TQLabel(i18n("ACL addresses:"),dummy); - - TQGridLayout *m1 = new TQGridLayout(dummy, 8, 2, 0, 5); - m1->setColStretch(1, 1); - m1->addWidget(l1, 0, 0, Qt::AlignRight); - m1->addWidget(l2, 1, 0, Qt::AlignRight); - m1->addWidget(l3, 2, 0, Qt::AlignRight); - m1->addWidget(l4, 3, 0, Qt::AlignRight); - m1->addWidget(l5, 4, 0, Qt::AlignRight); - m1->addWidget(l6, 5, 0, Qt::AlignRight); - m1->addWidget(l7, 6, 0, Qt::AlignRight); - m1->addWidget(l8, 7, 0, Qt::AlignRight|Qt::AlignTop); - m1->addWidget(resource_, 0, 1); - m1->addWidget(authtype_, 1, 1); - m1->addWidget(authclass_, 2, 1); - m1->addWidget(authname_, 3, 1); - m1->addWidget(encryption_, 4, 1); - m1->addWidget(satisfy_, 5, 1); - m1->addWidget(order_, 6, 1); - m1->addWidget(addresses_, 7, 1); - - setCaption(i18n("Location")); - resize(400, 100); - - slotTypeChanged(AUTHTYPE_NONE); - slotClassChanged(AUTHCLASS_ANONYMOUS); - encryption_->setCurrentItem(ENCRYPT_IFREQUESTED); - - connect(addresses_, TQT_SIGNAL(add()), TQT_SLOT(slotAdd())); - connect(addresses_, TQT_SIGNAL(edit(int)), TQT_SLOT(slotEdit(int))); - connect(addresses_, TQT_SIGNAL(defaultList()), TQT_SLOT(slotDefaultList())); -} - -void LocationDialog::setInfos(CupsdConf *conf) -{ - conf_ = conf; - - TQPtrListIterator<CupsResource> it(conf->resources_); - for (; it.current(); ++it) - resource_->insertItem(SmallIcon(it.current()->typeToIconName(it.current()->type_)), it.current()->text_); - - TQWhatsThis::add(encryption_, conf_->comments_.toolTip("encryption")); - TQWhatsThis::add(order_, conf_->comments_.toolTip("order")); - TQWhatsThis::add(authclass_, conf_->comments_.toolTip("authclass")); - TQWhatsThis::add(authtype_, conf_->comments_.toolTip("authtype")); - TQWhatsThis::add(authname_, conf_->comments_.toolTip("authname")); - TQWhatsThis::add(satisfy_, conf_->comments_.toolTip("satisfy")); - TQWhatsThis::add(addresses_, conf_->comments_.toolTip("allowdeny")); -} - -void LocationDialog::fillLocation(CupsLocation *loc) -{ - loc->resource_ = conf_->resources_.tqat(resource_->currentItem()); - loc->resourcename_ = loc->resource_->path_; - loc->authtype_ = authtype_->currentItem(); - loc->authclass_ = (loc->authtype_ == AUTHTYPE_NONE ? AUTHCLASS_ANONYMOUS : authclass_->currentItem()); - loc->authname_ = (loc->authclass_ == AUTHCLASS_USER || loc->authclass_ == AUTHCLASS_GROUP ? authname_->text() : TQString::null); - loc->encryption_ = encryption_->currentItem(); - loc->satisfy_ = satisfy_->currentItem(); - loc->order_ = order_->currentItem(); - loc->addresses_ = addresses_->items(); -} - -void LocationDialog::setLocation(CupsLocation *loc) -{ - int index = conf_->resources_.findRef(loc->resource_); - resource_->setCurrentItem(index); - authtype_->setCurrentItem(loc->authtype_); - authclass_->setCurrentItem(loc->authclass_); - authname_->setText(loc->authname_); - encryption_->setCurrentItem(loc->encryption_); - satisfy_->setCurrentItem(loc->satisfy_); - order_->setCurrentItem(loc->order_); - addresses_->insertItems(loc->addresses_); - - slotTypeChanged(loc->authtype_); - slotClassChanged(loc->authclass_); -} - -void LocationDialog::slotTypeChanged(int index) -{ - authclass_->setEnabled(index != AUTHTYPE_NONE); - if (index != AUTHTYPE_NONE) - slotClassChanged(authclass_->currentItem()); - else - authname_->setEnabled(false); -} - -void LocationDialog::slotClassChanged(int index) -{ - authname_->setEnabled((index == AUTHCLASS_USER || index == AUTHCLASS_GROUP)); -} - -bool LocationDialog::newLocation(CupsLocation *loc, TQWidget *parent, CupsdConf *conf) -{ - LocationDialog dlg(parent); - if (conf) - dlg.setInfos(conf); - if (dlg.exec()) - { - dlg.fillLocation(loc); - return true; - } - else - return false; -} - -bool LocationDialog::editLocation(CupsLocation *loc, TQWidget *parent, CupsdConf *conf) -{ - LocationDialog dlg(parent); - if (conf) - dlg.setInfos(conf); - dlg.setLocation(loc); - dlg.resource_->setEnabled(false); - if (dlg.exec()) - { - dlg.fillLocation(loc); - return true; - } - else - return false; -} - -void LocationDialog::slotAdd() -{ - TQString addr = AddressDialog::newAddress(this); - if (!addr.isEmpty()) - addresses_->insertItem(addr); -} - -void LocationDialog::slotEdit(int index) -{ - TQString addr = addresses_->text(index); - addr = AddressDialog::editAddress(addr, this); - if (!addr.isEmpty()) - addresses_->insertItem(addr); -} - -void LocationDialog::slotDefaultList() -{ - addresses_->clear(); -} - -#include "locationdialog.moc" diff --git a/kdeprint/cups/cupsdconf2/locationdialog.h b/kdeprint/cups/cupsdconf2/locationdialog.h deleted file mode 100644 index f0c182f42..000000000 --- a/kdeprint/cups/cupsdconf2/locationdialog.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 LOCATIONDIALOG_H -#define LOCATIONDIALOG_H - -#include <kdialogbase.h> - -class TQComboBox; -class TQLineEdit; -class EditList; -struct CupsdConf; -struct CupsLocation; - -class LocationDialog : public KDialogBase -{ - Q_OBJECT -public: - LocationDialog(TQWidget *parent = 0, const char *name = 0); - - void setInfos(CupsdConf*); - void fillLocation(CupsLocation*); - void setLocation(CupsLocation*); - - static bool newLocation(CupsLocation*, TQWidget *parent = 0, CupsdConf *conf = 0); - static bool editLocation(CupsLocation*, TQWidget *parent = 0, CupsdConf *conf = 0); - -protected slots: - void slotTypeChanged(int); - void slotClassChanged(int); - void slotAdd(); - void slotEdit(int); - void slotDefaultList(); - -private: - TQComboBox *resource_, *authtype_, *authclass_, *encryption_, *satisfy_, *order_; - TQLineEdit *authname_; - EditList *addresses_; - CupsdConf *conf_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/main.cpp b/kdeprint/cups/cupsdconf2/main.cpp deleted file mode 100644 index f3c317afd..000000000 --- a/kdeprint/cups/cupsdconf2/main.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 "cupsddialog.h" - -#include <tqfile.h> -#include <klocale.h> -#include <kcmdlineargs.h> -#include <kapplication.h> - -static KCmdLineOptions options[] = -{ - { "+[file]", I18N_NOOP("Configuration file to load"), 0}, - KCmdLineLastOption -}; - -extern "C" KDE_EXPORT int kdemain(int argc, char *argv[]) -{ - KCmdLineArgs::init(argc,argv,"cupsdconf", - I18N_NOOP("A CUPS configuration tool"), - I18N_NOOP("A CUPS configuration tool"),"0.0.1"); - KCmdLineArgs::addCmdLineOptions(options); - KApplication app; - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - KURL configfile; - if (args->count() > 0) - CupsdDialog::configure(args->url(0).path()); - else - CupsdDialog::configure(); - return (0); -} diff --git a/kdeprint/cups/cupsdconf2/portdialog.cpp b/kdeprint/cups/cupsdconf2/portdialog.cpp deleted file mode 100644 index 18cade9fc..000000000 --- a/kdeprint/cups/cupsdconf2/portdialog.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 "portdialog.h" -#include "cupsdconf.h" - -#include <tqlineedit.h> -#include <tqspinbox.h> -#include <tqcheckbox.h> -#include <tqpushbutton.h> -#include <tqlabel.h> -#include <tqlayout.h> -#include <tqwhatsthis.h> - -#include <klocale.h> - -PortDialog::PortDialog(TQWidget *parent, const char *name) - : KDialogBase(parent, name, true, TQString::null, Ok|Cancel, Ok, true) -{ - TQWidget *dummy = new TQWidget(this); - setMainWidget(dummy); - address_ = new TQLineEdit(dummy); - port_ = new TQSpinBox(0, 9999, 1, dummy); - port_->setValue(631); - usessl_ = new TQCheckBox(i18n("Use SSL encryption"), dummy); - - TQLabel *l1 = new TQLabel(i18n("Address:"), dummy); - TQLabel *l2 = new TQLabel(i18n("Port:"), dummy); - - TQVBoxLayout *m1 = new TQVBoxLayout(dummy, 0, 10); - TQGridLayout *m2 = new TQGridLayout(0, 3, 2, 0, 5); - m1->addLayout(TQT_TQLAYOUT(m2)); - m2->addWidget(l1, 0, 0, Qt::AlignRight); - m2->addWidget(l2, 1, 0, Qt::AlignRight); - m2->addMultiCellWidget(usessl_, 2, 2, 0, 1); - m2->addWidget(address_, 0, 1); - m2->addWidget(port_, 1, 1); - - setCaption(i18n("Listen To")); - resize(250, 100); -} - -TQString PortDialog::listenString() -{ - TQString s; - if (usessl_->isChecked()) - s.append("SSLListen "); - else - s.append("Listen "); - if (!address_->text().isEmpty()) - s.append(address_->text()); - else - s.append("*"); - s.append(":").append(port_->text()); - return s; -} - -void PortDialog::setInfos(CupsdConf *conf) -{ - TQWhatsThis::add(address_, conf->comments_.toolTip("address")); - TQWhatsThis::add(port_, conf->comments_.toolTip("port")); - TQWhatsThis::add(usessl_, conf->comments_.toolTip("usessl")); -} - -TQString PortDialog::newListen(TQWidget *parent, CupsdConf *conf) -{ - PortDialog dlg(parent); - dlg.setInfos(conf); - if (dlg.exec()) - { - return dlg.listenString(); - } - return TQString::null; -} - -TQString PortDialog::editListen(const TQString& s, TQWidget *parent, CupsdConf *conf) -{ - PortDialog dlg(parent); - dlg.setInfos(conf); - int p = s.find(' '); - if (p != -1) - { - dlg.usessl_->setChecked(s.left(p).startsWith("SSL")); - TQString addr = s.mid(p+1).stripWhiteSpace(); - int p1 = addr.find(':'); - if (p1 == -1) - { - dlg.address_->setText(addr); - dlg.port_->setValue(631); - } - else - { - dlg.address_->setText(addr.left(p1)); - dlg.port_->setValue(addr.mid(p1+1).toInt()); - } - } - if (dlg.exec()) - { - return dlg.listenString(); - } - return TQString::null; -} diff --git a/kdeprint/cups/cupsdconf2/portdialog.h b/kdeprint/cups/cupsdconf2/portdialog.h deleted file mode 100644 index 42dd7037b..000000000 --- a/kdeprint/cups/cupsdconf2/portdialog.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 PORTDIALOG_H -#define PORTDIALOG_H - -#include <kdialogbase.h> - -class TQLineEdit; -class TQSpinBox; -class TQCheckBox; -struct CupsdConf; - -class PortDialog : public KDialogBase -{ -public: - PortDialog(TQWidget *parent = 0, const char *name = 0); - - TQString listenString(); - void setInfos(CupsdConf*); - static TQString newListen(TQWidget *parent = 0, CupsdConf *conf = 0); - static TQString editListen(const TQString& s, TQWidget *parent = 0, CupsdConf *conf = 0); - -private: - TQLineEdit *address_; - TQSpinBox *port_; - TQCheckBox *usessl_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/qdirlineedit.cpp b/kdeprint/cups/cupsdconf2/qdirlineedit.cpp deleted file mode 100644 index 7cf0ea74e..000000000 --- a/kdeprint/cups/cupsdconf2/qdirlineedit.cpp +++ /dev/null @@ -1,73 +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 "qdirlineedit.h" - -#include <tqlineedit.h> -#include <tqlayout.h> -#include <kpushbutton.h> -#include <kfiledialog.h> -#include <kiconloader.h> - -QDirLineEdit::QDirLineEdit(bool file, TQWidget *parent, const char *name) - : TQWidget(parent, name) -{ - edit_ = new TQLineEdit(this); - button_ = new KPushButton(this); - button_->setPixmap(SmallIcon("fileopen")); - connect(button_,TQT_SIGNAL(clicked()),TQT_SLOT(buttonClicked())); - - TQHBoxLayout *main_ = new TQHBoxLayout(this, 0, 3); - main_->addWidget(edit_); - main_->addWidget(button_); - - fileedit_ = file; -} - -QDirLineEdit::~QDirLineEdit() -{ -} - -void QDirLineEdit::setURL(const TQString& txt) -{ - edit_->setText(txt); -} - -TQString QDirLineEdit::url() -{ - return edit_->text(); -} - -void QDirLineEdit::buttonClicked() -{ - TQString dirname; - if (!fileedit_) - dirname = KFileDialog::getExistingDirectory(edit_->text(), this); - else - dirname = KFileDialog::getOpenFileName(edit_->text(), TQString::null, this); - if (!dirname.isEmpty()) - edit_->setText(dirname); -} - -void QDirLineEdit::setFileEdit(bool on) -{ - fileedit_ = on; -} - -#include "qdirlineedit.moc" diff --git a/kdeprint/cups/cupsdconf2/qdirlineedit.h b/kdeprint/cups/cupsdconf2/qdirlineedit.h deleted file mode 100644 index d852897c3..000000000 --- a/kdeprint/cups/cupsdconf2/qdirlineedit.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 QDIRLINEEDIT_H -#define QDIRLINEEDIT_H - -#include <tqwidget.h> -#include <tqstring.h> - -class TQLineEdit; -class TQPushButton; - -class QDirLineEdit : public TQWidget -{ - Q_OBJECT -public: - QDirLineEdit(bool file, TQWidget *parent = 0, const char *name = 0); - ~QDirLineEdit(); - - void setURL(const TQString& txt); - TQString url(); - void setFileEdit(bool on = true); - -private slots: - void buttonClicked(); - -private: - TQLineEdit *edit_; - TQPushButton *button_; - bool fileedit_; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/qdirmultilineedit.cpp b/kdeprint/cups/cupsdconf2/qdirmultilineedit.cpp deleted file mode 100644 index e677da988..000000000 --- a/kdeprint/cups/cupsdconf2/qdirmultilineedit.cpp +++ /dev/null @@ -1,109 +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. - **/ - -#include "qdirmultilineedit.h" - -#include <tqlayout.h> -#include <tqheader.h> -#include <tqpushbutton.h> -#include <klistview.h> -#include <klocale.h> -#include <kfiledialog.h> -#include <kiconloader.h> - -QDirMultiLineEdit::QDirMultiLineEdit(TQWidget *parent, const char *name) -: TQWidget(parent, name) -{ - m_view = new KListView(this); - m_view->header()->hide(); - m_view->addColumn(""); - m_view->setFullWidth(true); - connect(m_view, TQT_SIGNAL(selectionChanged(TQListViewItem*)), TQT_SLOT(slotSelected(TQListViewItem*))); - - m_add = new TQPushButton(this); - m_add->setPixmap(SmallIcon("folder_new")); - connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddClicked())); - m_remove = new TQPushButton(this); - m_remove->setPixmap(SmallIcon("editdelete")); - connect(m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveClicked())); - m_remove->setEnabled(false); - - m_view->setFixedHeight(TQMAX(m_view->fontMetrics().lineSpacing()*3+m_view->lineWidth()*2, m_add->tqsizeHint().height()*2)); - - TQHBoxLayout *l0 = new TQHBoxLayout(this, 0, 3); - TQVBoxLayout *l1 = new TQVBoxLayout(0, 0, 0); - l0->addWidget(m_view); - l0->addLayout(l1); - l1->addWidget(m_add); - l1->addWidget(m_remove); - l1->addStretch(1); -} - -QDirMultiLineEdit::~QDirMultiLineEdit() -{ -} - -void QDirMultiLineEdit::setURLs(const TQStringList& urls) -{ - m_view->clear(); - for (TQStringList::ConstIterator it=urls.begin(); it!=urls.end(); ++it) - addURL(*it); -} - -TQStringList QDirMultiLineEdit::urls() -{ - TQListViewItem *item = m_view->firstChild(); - TQStringList l; - while (item) - { - l << item->text(0); - item = item->nextSibling(); - } - return l; -} - -void QDirMultiLineEdit::addURL(const TQString& url) -{ - TQListViewItem *item = new TQListViewItem(m_view, url); - item->setRenameEnabled(0, true); -} - -void QDirMultiLineEdit::slotAddClicked() -{ - TQString dirname = KFileDialog::getExistingDirectory(TQString::null, this); - if (!dirname.isEmpty()) - addURL(dirname); -} - -void QDirMultiLineEdit::slotRemoveClicked() -{ - TQListViewItem *item = m_view->currentItem(); - if (item) - { - delete item; - slotSelected(m_view->currentItem()); - } -} - -void QDirMultiLineEdit::slotSelected(TQListViewItem *item) -{ - m_remove->setEnabled((item != NULL)); -} - -#include "qdirmultilineedit.moc" diff --git a/kdeprint/cups/cupsdconf2/qdirmultilineedit.h b/kdeprint/cups/cupsdconf2/qdirmultilineedit.h deleted file mode 100644 index c3765362e..000000000 --- a/kdeprint/cups/cupsdconf2/qdirmultilineedit.h +++ /dev/null @@ -1,53 +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 QDIRMULTILINEEDIT_H -#define QDIRMULTILINEEDIT_H - -#include <tqwidget.h> - -class KListView; -class TQListViewItem; -class TQPushButton; - -class QDirMultiLineEdit : public TQWidget -{ - Q_OBJECT - -public: - QDirMultiLineEdit(TQWidget *parent = 0, const char *name = 0); - ~QDirMultiLineEdit(); - - void setURLs(const TQStringList&); - TQStringList urls(); - -protected: - void addURL(const TQString&); - -private slots: - void slotAddClicked(); - void slotRemoveClicked(); - void slotSelected(TQListViewItem*); - -private: - KListView *m_view; - TQPushButton *m_add, *m_remove; -}; - -#endif diff --git a/kdeprint/cups/cupsdconf2/sizewidget.cpp b/kdeprint/cups/cupsdconf2/sizewidget.cpp deleted file mode 100644 index 742702e48..000000000 --- a/kdeprint/cups/cupsdconf2/sizewidget.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This file is part of the KDE libraries - * Copyright (c) 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. - **/ - -#include "sizewidget.h" - -#include <tqcombobox.h> -#include <tqspinbox.h> -#include <tqlayout.h> -#include <tqregexp.h> -#include <klocale.h> - -SizeWidget::SizeWidget( TQWidget *parent, const char *name ) - : TQWidget( parent, name ) -{ - m_size = new TQSpinBox( 0, 9999, 1, this ); - m_unit = new TQComboBox( this ); - - m_unit->insertItem( i18n( "KB" ) ); - m_unit->insertItem( i18n( "MB" ) ); - m_unit->insertItem( i18n( "GB" ) ); - m_unit->insertItem( i18n( "Tiles" ) ); - m_unit->setCurrentItem( 1 ); - m_size->setSpecialValueText( i18n( "Unlimited" ) ); - - TQHBoxLayout *l0 = new TQHBoxLayout( this, 0, 5 ); - l0->addWidget( m_size, 1 ); - l0->addWidget( m_unit, 0 ); -} - -void SizeWidget::setSizeString( const TQString& sz ) -{ - int p = sz.find( TQRegExp( "\\D" ) ); - m_size->setValue( sz.left( p ).toInt() ); - switch( sz[ p ].latin1() ) - { - case 'k': p = 0; break; - default: - case 'm': p = 1; break; - case 'g': p = 2; break; - case 't': p = 3; break; - } - m_unit->setCurrentItem( p ); -} - -TQString SizeWidget::sizeString() const -{ - TQString result = TQString::number( m_size->value() ); - switch ( m_unit->currentItem() ) - { - case 0: result.append( "k" ); break; - case 1: result.append( "m" ); break; - case 2: result.append( "g" ); break; - case 3: result.append( "t" ); break; - } - return result; -} - -void SizeWidget::setValue( int value ) -{ - m_size->setValue( value ); - m_unit->setCurrentItem( 1 ); -} - -int SizeWidget::value() const -{ - return m_size->value(); -} diff --git a/kdeprint/cups/cupsdconf2/sizewidget.h b/kdeprint/cups/cupsdconf2/sizewidget.h deleted file mode 100644 index 000fb22bc..000000000 --- a/kdeprint/cups/cupsdconf2/sizewidget.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of the KDE libraries - * Copyright (c) 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 SIZEWIDGET_H -#define SIZEWIDGET_H - -#include <tqwidget.h> - -class TQSpinBox; -class TQComboBox; - -class SizeWidget : public TQWidget -{ -public: - SizeWidget( TQWidget *parent = 0, const char *name = 0 ); - - void setSizeString( const TQString& sizeString ); - TQString sizeString() const; - void setValue( int sz ); - int value() const; - -private: - TQSpinBox *m_size; - TQComboBox *m_unit; -}; - -#endif |