util.h
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 **/ 00019 00020 #ifndef UTIL_H 00021 #define UTIL_H 00022 00023 #include "kprinter.h" 00024 #include <tqstring.h> 00025 #include <kurl.h> 00026 #include <klocale.h> 00027 00028 KURL smbToUrl(const TQString& work, const TQString& server, const TQString& printer); 00029 void urlToSmb(const KURL& url, TQString& work, TQString& server, TQString& printer); 00030 // those 2 are only workarounds when the login/password may contain 00031 // strange characters ('@', '/'). In this case, those chars are not encoded 00032 // as other SMB tools (smbspool) doesn't seem to support encoding. This 00033 // utilities allow to continue working KURL class (and encoding) within 00034 // KDEPrint, but without encoding outside KDEPrint (shoudl fix bug #38733) 00035 KDEPRINT_EXPORT TQString buildSmbURI( const TQString& work, const TQString& server, const TQString& printer, const TQString& user, const TQString& passwd ); 00036 KDEPRINT_EXPORT bool splitSmbURI( const TQString& uri, TQString& work, TQString& server, TQString& printer, TQString& user, TQString& passwd ); 00037 00038 static const struct pagesizestruct 00039 { 00040 const char* text; 00041 int ID; 00042 } page_sizes[] = 00043 { 00044 { "A0", KPrinter::A0 }, 00045 { "A1", KPrinter::A1 }, 00046 { "A2", KPrinter::A2 }, 00047 { "A3", KPrinter::A3 }, 00048 { "A4", KPrinter::A4 }, 00049 { "A5", KPrinter::A5 }, 00050 { "A6", KPrinter::A6 }, 00051 { "A7", KPrinter::A7 }, 00052 { "A8", KPrinter::A8 }, 00053 { "A9", KPrinter::A9 }, 00054 { "B1", KPrinter::B1 }, 00055 { "B10", KPrinter::B10 }, 00056 { "B2", KPrinter::B2 }, 00057 { "B3", KPrinter::B3 }, 00058 { "B4", KPrinter::B4 }, 00059 { "B5", KPrinter::B5 }, 00060 { "B6", KPrinter::B6 }, 00061 { "B7", KPrinter::B7 }, 00062 { "B8", KPrinter::B8 }, 00063 { "B9", KPrinter::B9 }, 00064 { I18N_NOOP("Envelope C5"), KPrinter::C5E }, 00065 { I18N_NOOP("Envelope DL"), KPrinter::DLE }, 00066 { I18N_NOOP("Envelope US #10"), KPrinter::Comm10E }, 00067 { I18N_NOOP("Executive"), KPrinter::Executive }, 00068 { I18N_NOOP("Folio"), KPrinter::Folio }, 00069 { I18N_NOOP("Ledger"), KPrinter::Ledger }, 00070 { I18N_NOOP("Tabloid"), KPrinter::Tabloid }, 00071 { I18N_NOOP("US Legal"), KPrinter::Legal }, 00072 { I18N_NOOP("US Letter"), KPrinter::Letter } 00073 }; 00074 int findIndex(int ID); 00075 00076 #endif