From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkpimexchange/core/exchangeaccount.cpp | 98 ++++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'libkpimexchange/core/exchangeaccount.cpp') diff --git a/libkpimexchange/core/exchangeaccount.cpp b/libkpimexchange/core/exchangeaccount.cpp index 9142c9db3..858169ad8 100644 --- a/libkpimexchange/core/exchangeaccount.cpp +++ b/libkpimexchange/core/exchangeaccount.cpp @@ -20,13 +20,13 @@ Boston, MA 02110-1301, USA. */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -47,10 +47,10 @@ using namespace KPIM; -ExchangeAccount::ExchangeAccount( const QString &host, const QString &port, - const QString &account, - const QString &password, - const QString &mailbox ) +ExchangeAccount::ExchangeAccount( const TQString &host, const TQString &port, + const TQString &account, + const TQString &password, + const TQString &mailbox ) : mError( false ) { KURL url( "webdav://" + host + "/exchange/" + account ); @@ -76,7 +76,7 @@ ExchangeAccount::ExchangeAccount( const QString &host, const QString &port, mCalendarURL = 0; } -ExchangeAccount::ExchangeAccount( const QString& group ) +ExchangeAccount::ExchangeAccount( const TQString& group ) { load( group ); } @@ -85,16 +85,16 @@ ExchangeAccount::~ExchangeAccount() { } -QString endecryptStr( const QString &aStr ) +TQString endecryptStr( const TQString &aStr ) { - QString result; + TQString result; for (uint i = 0; i < aStr.length(); i++) result += (aStr[i].unicode() < 0x20) ? aStr[i] : - QChar(0x1001F - aStr[i].unicode()); + TQChar(0x1001F - aStr[i].unicode()); return result; } -void ExchangeAccount::save( QString const &group ) +void ExchangeAccount::save( TQString const &group ) { kapp->config()->setGroup( group ); kapp->config()->writeEntry( "host", mHost ); @@ -104,32 +104,32 @@ void ExchangeAccount::save( QString const &group ) kapp->config()->sync(); } -void ExchangeAccount::load( QString const &group ) +void ExchangeAccount::load( TQString const &group ) { kapp->config()->setGroup( group ); - QString host = kapp->config()->readEntry( "host" ); + TQString host = kapp->config()->readEntry( "host" ); if ( ! host.isNull() ) { mHost = host; } else { mHost = "mail.company.com"; } - QString user = kapp->config()->readEntry( "user" ); + TQString user = kapp->config()->readEntry( "user" ); if ( ! user.isNull() ) { mAccount = user; } else { mAccount = "username"; } - QString mailbox = kapp->config()->readEntry( "mailbox" ); + TQString mailbox = kapp->config()->readEntry( "mailbox" ); if ( ! mailbox.isNull() ) { mMailbox = mailbox; } else { mMailbox = "webdav://" + host + "/exchange/" + mAccount; } - QString password = endecryptStr( kapp->config()->readEntry( "MS-ID" ) ); + TQString password = endecryptStr( kapp->config()->readEntry( "MS-ID" ) ); if ( ! password.isNull() ) { mPassword = password; } @@ -152,7 +152,7 @@ KURL ExchangeAccount::calendarURL() } } -bool ExchangeAccount::authenticate( QWidget *window ) +bool ExchangeAccount::authenticate( TQWidget *window ) { if ( window ) return authenticate( window->winId() ); @@ -163,7 +163,7 @@ bool ExchangeAccount::authenticate( QWidget *window ) bool ExchangeAccount::authenticate() { long windowId; - QWidgetList *widgets = QApplication::topLevelWidgets(); + TQWidgetList *widgets = TQApplication::topLevelWidgets(); if ( widgets->isEmpty() ) windowId = 0; else @@ -189,8 +189,8 @@ bool ExchangeAccount::authenticate( int windowId ) DCOPClient *dcopClient = new DCOPClient(); dcopClient->attach(); - QByteArray params; - QDataStream stream(params, IO_WriteOnly); + TQByteArray params; + TQDataStream stream(params, IO_WriteOnly); stream << info << windowId; dcopClient->send( "kded", "kpasswdserver", @@ -204,11 +204,11 @@ bool ExchangeAccount::authenticate( int windowId ) calcFolderURLs(); // TODO: Remove this busy loop - QApplication::setOverrideCursor( KCursor::waitCursor() ); + TQApplication::setOverrideCursor( KCursor::waitCursor() ); do { qApp->processEvents(); } while ( !mCalendarURL && !mError ); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); return !mError; } @@ -216,9 +216,9 @@ bool ExchangeAccount::authenticate( int windowId ) void ExchangeAccount::calcFolderURLs() { kdDebug() << "ExchangeAccount::calcFolderURLs" << endl; - QDomDocument doc; - QDomElement root = addElement( doc, doc, "DAV:", "propfind" ); - QDomElement prop = addElement( doc, root, "DAV:", "prop" ); + TQDomDocument doc; + TQDomElement root = addElement( doc, doc, "DAV:", "propfind" ); + TQDomElement prop = addElement( doc, root, "DAV:", "prop" ); addElement( doc, prop, "urn:schemas:httpmail:", "calendar" ); // For later use: // urn:schemas:httpmail:contacts Contacts @@ -239,8 +239,8 @@ void ExchangeAccount::calcFolderURLs() KIO::DavJob* job = KIO::davPropFind( baseURL(), doc, "1", false ); job->addMetaData( "errorPage", "false" ); - connect( job, SIGNAL( result( KIO::Job * ) ), - SLOT( slotFolderResult( KIO::Job * ) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ), + TQT_SLOT( slotFolderResult( KIO::Job * ) ) ); } void ExchangeAccount::slotFolderResult( KIO::Job *job ) @@ -248,24 +248,24 @@ void ExchangeAccount::slotFolderResult( KIO::Job *job ) kdDebug() << "ExchangeAccount::slotFolderResult()" << endl; if ( job->error() ) { kdError() << "Error: Cannot get well-know folder names; " << job->error() << endl; - QString text = i18n("ExchangeAccount\nError accessing '%1': %2") + TQString text = i18n("ExchangeAccount\nError accessing '%1': %2") .arg( baseURL().prettyURL() ).arg( job->errorString() ); KMessageBox::error( 0, text ); mError = true; return; } - QDomDocument &response = static_cast( job )->response(); + TQDomDocument &response = static_cast( job )->response(); - QDomElement prop = response.documentElement().namedItem( "response" ) + TQDomElement prop = response.documentElement().namedItem( "response" ) .namedItem( "propstat" ).namedItem( "prop" ).toElement(); - QDomElement calElement = prop.namedItem( "calendar" ).toElement(); + TQDomElement calElement = prop.namedItem( "calendar" ).toElement(); if ( calElement.isNull() ) { kdError() << "Error: no calendar URL in Exchange server reply" << endl; mError = true; return; } - QString calendar = calElement.text(); + TQString calendar = calElement.text(); kdDebug() << "ExchangeAccount: response calendarURL: " << calendar << endl; @@ -273,14 +273,14 @@ void ExchangeAccount::slotFolderResult( KIO::Job *job ) kdDebug() << "Calendar URL: " << mCalendarURL->url() << endl; } -QString ExchangeAccount::tryFindMailbox( const QString& host, const QString& port, const QString& user, const QString& password ) +TQString ExchangeAccount::tryFindMailbox( const TQString& host, const TQString& port, const TQString& user, const TQString& password ) { kdDebug() << "Entering ExchangeAccount::tryFindMailbox()" << endl; KURL url("http://" + host + "/exchange"); if (!port.isEmpty()) url.setPort(port.toInt()); - QString result = tryMailbox( url.url(), user, password ); + TQString result = tryMailbox( url.url(), user, password ); if ( result.isNull() ) { url.setProtocol("https"); @@ -289,28 +289,28 @@ QString ExchangeAccount::tryFindMailbox( const QString& host, const QString& por return result; } -QString ExchangeAccount::tryMailbox( const QString &_url, const QString &user, - const QString &password ) +TQString ExchangeAccount::tryMailbox( const TQString &_url, const TQString &user, + const TQString &password ) { KURL url = KURL( _url ); url.setUser( user ); url.setPass( password ); - QString tmpFile; + TQString tmpFile; if ( !KIO::NetAccess::download( url, tmpFile, 0 ) ) { kdWarning() << "Trying to find mailbox failed: not able to download " << url.prettyURL() << endl; - return QString::null; + return TQString::null; } - QFile file( tmpFile ); + TQFile file( tmpFile ); if ( !file.open( IO_ReadOnly ) ) { kdWarning() << "Trying to find mailbox failed: not able to open temp file " << tmpFile << endl; KIO::NetAccess::removeTempFile( tmpFile ); - return QString::null; + return TQString::null; } - QTextStream stream( &file ); - QString line; - QString result; + TQTextStream stream( &file ); + TQString line; + TQString result; while ( !stream.eof() ) { line = stream.readLine(); // line of text excluding '\n' int pos = line.find( "