summaryrefslogtreecommitdiffstats
path: root/libkpimexchange/core/exchangeaccount.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /libkpimexchange/core/exchangeaccount.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkpimexchange/core/exchangeaccount.cpp')
-rw-r--r--libkpimexchange/core/exchangeaccount.cpp98
1 files changed, 49 insertions, 49 deletions
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 <qstring.h>
-#include <qtextstream.h>
-#include <qapplication.h>
-#include <qdom.h>
-#include <qwidgetlist.h>
-#include <qwidget.h>
-#include <qfile.h>
+#include <tqstring.h>
+#include <tqtextstream.h>
+#include <tqapplication.h>
+#include <tqdom.h>
+#include <tqwidgetlist.h>
+#include <tqwidget.h>
+#include <tqfile.h>
#include <kurl.h>
#include <kapplication.h>
@@ -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<KIO::DavJob *>( job )->response();
+ TQDomDocument &response = static_cast<KIO::DavJob *>( 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( "<BASE href=\"", 0, FALSE );
@@ -321,7 +321,7 @@ QString ExchangeAccount::tryMailbox( const QString &_url, const QString &user,
kdWarning() << "Strange, found no closing quote in " << line << endl;
continue;
}
- QString mailboxString = line.mid( pos+12, end-pos-12 );
+ TQString mailboxString = line.mid( pos+12, end-pos-12 );
KURL mailbox( mailboxString );
if ( mailbox.isEmpty() ) {
kdWarning() << "Strange, could not get URL from " << mailboxString << " in line " << line << endl;