libkpimexchange Library API Documentation

exchangeaccount.h

00001 /*
00002     This file is part of libkpimexchange.
00003 
00004     Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
00005     Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
00006  
00007     This library is free software; you can redistribute it and/or modify it
00008     under the terms of the GNU Library General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or (at your
00010     option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful, but WITHOUT
00013     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015     License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to the
00019     Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00020     02111-1307, USA.
00021 
00022 */
00023 #ifndef EXCHANGE_ACCOUNT_H
00024 #define EXCHANGE_ACCOUNT_H
00025 
00026 #include <qobject.h>
00027 #include <qstring.h>
00028 
00029 #include <kurl.h>
00030 #include <kio/job.h>
00031 
00032 namespace KPIM {
00033     
00034 class ExchangeAccount : public QObject
00035 {
00036     Q_OBJECT
00037   public:
00038     ExchangeAccount( const QString &host, const QString &port,
00039                      const QString &account, const QString &password,
00040                      const QString &mailbox = QString::null );
00044     ExchangeAccount( const QString &group );
00045     ~ExchangeAccount();
00046 
00047     void save( QString const &group );
00048     void load( QString const &group );
00049 
00050     QString host() { return mHost; }
00051     QString port() { return mPort; }
00052     QString account() { return mAccount; }
00053     QString mailbox() { return mMailbox; }
00054     QString password() { return mPassword; }
00055 
00056     void setHost( QString host ) { mHost = host; }
00057     void setPort( QString port ) { mPort = port; }
00058     void setAccount( QString account ) { mAccount = account; }
00059     void setMailbox( QString mailbox ) { mMailbox = mailbox; }
00060     void setPassword( QString password ) { mPassword = password; }
00061 
00062     KURL baseURL();
00063     KURL calendarURL();
00064 
00065     // Returns the mailbox URL of this user. QString::null if unsuccessful
00066     static QString tryFindMailbox( const QString &host, const QString &port,
00067                                    const QString &user,
00068                                    const QString &password );
00069 
00070     //  Put authentication info in KDE password store for auto-authentication
00071     //  with later webdav access. Also calculates the calendar URL.
00072     bool authenticate();
00073     bool authenticate( QWidget *window );
00074 
00075   private:
00076     bool authenticate( int windowId );
00077     void calcFolderURLs();
00078     static QString tryMailbox( const QString &_url, const QString &user,
00079                                const QString &password );
00080 
00081   private slots:
00082     void slotFolderResult( KIO::Job * );
00083 
00084   private:
00085     QString mHost;
00086     QString mPort;
00087     QString mAccount;
00088     QString mMailbox;
00089     QString mPassword;
00090 
00091     KURL *mCalendarURL;
00092     bool mError;
00093 };
00094 
00095 }
00096 
00097 #endif
00098 
KDE Logo
This file is part of the documentation for libkpimexchange Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu May 3 20:22:24 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003