diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
commit | ffe8a83e053396df448e9413828527613ca3bd46 (patch) | |
tree | a73d4169e02df4a50f9a12cb165fcd0ab5bac7c6 /kdeprint/kdeprintd.cpp | |
parent | 682bf3bfdcbcbb1fca85e8a36ed03e062e0555d5 (diff) | |
download | tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.tar.gz tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeprint/kdeprintd.cpp')
-rw-r--r-- | kdeprint/kdeprintd.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/kdeprint/kdeprintd.cpp b/kdeprint/kdeprintd.cpp index 3506b6469..198147463 100644 --- a/kdeprint/kdeprintd.cpp +++ b/kdeprint/kdeprintd.cpp @@ -20,7 +20,7 @@ #include "kdeprintd.h" #include "kprintprocess.h" -#include <qfile.h> +#include <tqfile.h> #include <klocale.h> #include <knotifyclient.h> #include <kmessagebox.h> @@ -28,21 +28,21 @@ #include <dcopclient.h> #include <kio/passdlg.h> #include <kio/authinfo.h> -#include <qlabel.h> +#include <tqlabel.h> #include <kpushbutton.h> #include <kiconloader.h> #include <kstandarddirs.h> #include <kwin.h> #include <kapplication.h> -#include <qlayout.h> -#include <qtimer.h> -#include <qregexp.h> +#include <tqlayout.h> +#include <tqtimer.h> +#include <tqregexp.h> #include <unistd.h> extern "C" { - KDE_EXPORT KDEDModule *create_kdeprintd(const QCString& name) + KDE_EXPORT KDEDModule *create_kdeprintd(const TQCString& name) { return new KDEPrintd(name); } @@ -52,7 +52,7 @@ class StatusWindow : public QWidget { public: StatusWindow(int pid = -1); - void setMessage(const QString&); + void setMessage(const TQString&); int pid() const { return m_pid; } private: @@ -63,31 +63,31 @@ private: }; StatusWindow::StatusWindow(int pid) -: QWidget(NULL, "StatusWindow", WType_TopLevel|WStyle_DialogBorder|WStyle_StaysOnTop|WDestructiveClose), m_pid(pid) +: TQWidget(NULL, "StatusWindow", WType_TopLevel|WStyle_DialogBorder|WStyle_StaysOnTop|WDestructiveClose), m_pid(pid) { - m_label = new QLabel(this); + m_label = new TQLabel(this); m_label->setAlignment(AlignCenter); m_button = new KPushButton(KStdGuiItem::close(), this); - m_icon = new QLabel(this); + m_icon = new TQLabel(this); m_icon->setPixmap(DesktopIcon("fileprint")); m_icon->setAlignment(AlignCenter); KWin::setIcons(winId(), *(m_icon->pixmap()), SmallIcon("fileprint")); - QGridLayout *l0 = new QGridLayout(this, 2, 3, 10, 10); + QGridLayout *l0 = new TQGridLayout(this, 2, 3, 10, 10); l0->setRowStretch(0, 1); l0->setColStretch(1, 1); l0->addMultiCellWidget(m_label, 0, 0, 1, 2); l0->addWidget(m_button, 1, 2); l0->addMultiCellWidget(m_icon, 0, 1, 0, 0); - connect(m_button, SIGNAL(clicked()), SLOT(hide())); + connect(m_button, TQT_SIGNAL(clicked()), TQT_SLOT(hide())); resize(200, 50); } -void StatusWindow::setMessage(const QString& msg) +void StatusWindow::setMessage(const TQString& msg) { //QSize oldSz = size(); m_label->setText(msg); //QSize sz = m_label->sizeHint(); - //sz += QSize(layout()->margin()*2, layout()->margin()*2+layout()->spacing()+m_button->sizeHint().height()); + //sz += TQSize(layout()->margin()*2, layout()->margin()*2+layout()->spacing()+m_button->sizeHint().height()); // dialog will never be smaller //sz = sz.expandedTo(oldSz); //resize(sz); @@ -97,7 +97,7 @@ void StatusWindow::setMessage(const QString& msg) //***************************************************************************************************** -KDEPrintd::KDEPrintd(const QCString& obj) +KDEPrintd::KDEPrintd(const TQCString& obj) : KDEDModule(obj) { m_processpool.setAutoDelete(true); @@ -109,21 +109,21 @@ KDEPrintd::~KDEPrintd() { } -int KDEPrintd::print(const QString& cmd, const QStringList& files, bool remflag) +int KDEPrintd::print(const TQString& cmd, const TQStringList& files, bool remflag) { KPrintProcess *proc = new KPrintProcess; QString command(cmd); - QRegExp re( "\\$out\\{([^}]*)\\}" ); + TQRegExp re( "\\$out\\{([^}]*)\\}" ); - connect(proc,SIGNAL(printTerminated(KPrintProcess*)),SLOT(slotPrintTerminated(KPrintProcess*))); - connect(proc,SIGNAL(printError(KPrintProcess*,const QString&)),SLOT(slotPrintError(KPrintProcess*,const QString&))); + connect(proc,TQT_SIGNAL(printTerminated(KPrintProcess*)),TQT_SLOT(slotPrintTerminated(KPrintProcess*))); + connect(proc,TQT_SIGNAL(printError(KPrintProcess*,const TQString&)),TQT_SLOT(slotPrintError(KPrintProcess*,const TQString&))); proc->setCommand( command ); if ( re.search( command ) != -1 ) { KURL url( re.cap( 1 ) ); if ( !url.isLocalFile() ) { - QString tmpFilename = locateLocal( "tmp", "kdeprint_" + kapp->randomString( 8 ) ); + TQString tmpFilename = locateLocal( "tmp", "kdeprint_" + kapp->randomString( 8 ) ); command.replace( re, KProcess::quote( tmpFilename ) ); proc->setOutput( re.cap( 1 ) ); proc->setTempOutput( tmpFilename ); @@ -153,13 +153,13 @@ void KDEPrintd::slotPrintTerminated( KPrintProcess *proc ) m_processpool.removeRef( proc ); } -void KDEPrintd::slotPrintError( KPrintProcess *proc, const QString& msg ) +void KDEPrintd::slotPrintError( KPrintProcess *proc, const TQString& msg ) { KNotifyClient::event("printerror",i18n("<p><nobr>A print error occurred. Error message received from system:</nobr></p><br>%1").arg(msg)); m_processpool.removeRef( proc ); } -QString KDEPrintd::openPassDlg(const QString& user) +TQString KDEPrintd::openPassDlg(const TQString& user) { QString user_(user), pass_, result; if (KIO::PasswordDialog::getNameAndPassword(user_, pass_, NULL) == KDialog::Accepted) @@ -167,17 +167,17 @@ QString KDEPrintd::openPassDlg(const QString& user) return result; } -bool KDEPrintd::checkFiles(QString& cmd, const QStringList& files) +bool KDEPrintd::checkFiles(TQString& cmd, const TQStringList& files) { - for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it) - if (::access(QFile::encodeName(*it).data(), R_OK) != 0) + for (TQStringList::ConstIterator it=files.begin(); it!=files.end(); ++it) + if (::access(TQFile::encodeName(*it).data(), R_OK) != 0) { if (KMessageBox::warningContinueCancel(0, i18n("Some of the files to print are not readable by the KDE " "print daemon. This may happen if you are trying to print " "as a different user to the one currently logged in. To continue " "printing, you need to provide root's password."), - QString::null, + TQString::null, i18n("Provide root's Password"), "provideRootsPassword") == KMessageBox::Continue) { @@ -190,17 +190,17 @@ bool KDEPrintd::checkFiles(QString& cmd, const QStringList& files) return true; } -void KDEPrintd::statusMessage(const QString& msg, int pid, const QString& appName) +void KDEPrintd::statusMessage(const TQString& msg, int pid, const TQString& appName) { StatusWindow *w = m_windows.find(pid); if (!w && !msg.isEmpty()) { w = new StatusWindow(pid); if (appName.isEmpty()) - w->setCaption(i18n("Printing Status - %1").arg("(pid="+QString::number(pid)+")")); + w->setCaption(i18n("Printing Status - %1").arg("(pid="+TQString::number(pid)+")")); else w->setCaption(i18n("Printing Status - %1").arg(appName)); - connect(w, SIGNAL(destroyed()), SLOT(slotClosed())); + connect(w, TQT_SIGNAL(destroyed()), TQT_SLOT(slotClosed())); w->show(); m_windows.insert(pid, w); } @@ -228,21 +228,21 @@ class KDEPrintd::Request { public: DCOPClientTransaction *transaction; - QString user; - QString uri; + TQString user; + TQString uri; int seqNbr; }; -QString KDEPrintd::requestPassword( const QString& user, const QString& host, int port, int seqNbr ) +TQString KDEPrintd::requestPassword( const TQString& user, const TQString& host, int port, int seqNbr ) { Request *req = new Request; req->user = user; - req->uri = "print://" + user + "@" + host + ":" + QString::number(port); + req->uri = "print://" + user + "@" + host + ":" + TQString::number(port); req->seqNbr = seqNbr; req->transaction = callingDcopClient()->beginTransaction(); m_requestsPending.append( req ); if ( m_requestsPending.count() == 1 ) - QTimer::singleShot( 0, this, SLOT( processRequest() ) ); + TQTimer::singleShot( 0, this, TQT_SLOT( processRequest() ) ); return "::"; } @@ -253,29 +253,29 @@ void KDEPrintd::processRequest() Request *req = m_requestsPending.first(); KIO::AuthInfo info; - QByteArray params, reply; - QCString replyType; - QString authString( "::" ); + TQByteArray params, reply; + TQCString replyType; + TQString authString( "::" ); info.username = req->user; info.keepPassword = true; info.url = req->uri; info.comment = i18n( "Printing system" ); - QDataStream input( params, IO_WriteOnly ); + TQDataStream input( params, IO_WriteOnly ); input << info << i18n( "Authentication failed (user name=%1)" ).arg( info.username ) << 0L << (long int) req->seqNbr; - if ( callingDcopClient()->call( "kded", "kpasswdserver", "queryAuthInfo(KIO::AuthInfo,QString,long int,long int)", + if ( callingDcopClient()->call( "kded", "kpasswdserver", "queryAuthInfo(KIO::AuthInfo,TQString,long int,long int)", params, replyType, reply ) ) { if ( replyType == "KIO::AuthInfo" ) { - QDataStream output( reply, IO_ReadOnly ); + TQDataStream output( reply, IO_ReadOnly ); KIO::AuthInfo result; int seqNbr; output >> result >> seqNbr; if ( result.isModified() ) - authString = result.username + ":" + result.password + ":" + QString::number( seqNbr ); + authString = result.username + ":" + result.password + ":" + TQString::number( seqNbr ); } else kdWarning( 500 ) << "DCOP returned type error, expected KIO::AuthInfo, received " << replyType << endl; @@ -283,28 +283,28 @@ void KDEPrintd::processRequest() else kdWarning( 500 ) << "Cannot communicate with kded_kpasswdserver" << endl; - QByteArray outputData; - QDataStream output( outputData, IO_WriteOnly ); + TQByteArray outputData; + TQDataStream output( outputData, IO_WriteOnly ); output << authString; - replyType = "QString"; + replyType = "TQString"; callingDcopClient()->endTransaction( req->transaction, replyType, outputData ); m_requestsPending.remove( ( unsigned int )0 ); if ( m_requestsPending.count() > 0 ) - QTimer::singleShot( 0, this, SLOT( processRequest() ) ); + TQTimer::singleShot( 0, this, TQT_SLOT( processRequest() ) ); } -void KDEPrintd::initPassword( const QString& user, const QString& passwd, const QString& host, int port ) +void KDEPrintd::initPassword( const TQString& user, const TQString& passwd, const TQString& host, int port ) { - QByteArray params, reply; - QCString replyType; + TQByteArray params, reply; + TQCString replyType; KIO::AuthInfo info; info.username = user; info.password = passwd; - info.url = "print://" + user + "@" + host + ":" + QString::number(port); + info.url = "print://" + user + "@" + host + ":" + TQString::number(port); - QDataStream input( params, IO_WriteOnly ); + TQDataStream input( params, IO_WriteOnly ); input << info << ( long int )0; if ( !callingDcopClient()->call( "kded", "kpasswdserver", "addAuthInfo(KIO::AuthInfo,long int)", |