kmail

subscriptiondialog.h

Go to the documentation of this file.
00001 /*  -*- c++ -*-
00002     subscriptiondialog.h
00003 
00004     This file is part of KMail, the KDE mail client.
00005     Copyright (C) 2002 Carsten Burghardt <burghardt@kde.org>
00006 
00007     KMail is free software; you can redistribute it and/or modify it
00008     under the terms of the GNU General Public License, version 2, as
00009     published by the Free Software Foundation.
00010 
00011     KMail is distributed in the hope that it will be useful, but
00012     WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019 
00020     In addition, as a special exception, the copyright holders give
00021     permission to link the code of this program with any edition of
00022     the Qt library by Trolltech AS, Norway (or with modified versions
00023     of Qt that use the same license as Qt), and distribute linked
00024     combinations including the two.  You must obey the GNU General
00025     Public License in all respects for all of the code used other than
00026     Qt.  If you modify this file, you may extend this exception to
00027     your version of the file, but you are not obligated to do so.  If
00028     you do not wish to do so, delete this exception statement from
00029     your version.
00030 */
00031 
00032 #ifndef __SUBSCRIPTIONDIALOG
00033 #define __SUBSCRIPTIONDIALOG
00034 
00035 #include <qdict.h>
00036 #include <ksubscription.h>
00037 #include "imapaccountbase.h"
00038 
00039 class KMMessage;
00040 class FolderStorage;
00041 
00042 namespace KMail {
00043 
00044   // Abstract base class for the server side and client side subscription dialogs.
00045   // Scott Meyers says: "Make non-leaf classes abstract" and he is right, I think.
00046   // (More Effective C++, Item 33)
00047   class SubscriptionDialogBase : public KSubscription
00048   {
00049     Q_OBJECT
00050 
00051     public:
00052       SubscriptionDialogBase( QWidget *parent,
00053                               const QString &caption,
00054                               KAccount* acct,
00055                               QString startPath = QString::null );
00056       virtual ~SubscriptionDialogBase() {}
00057 
00058       void show();
00059 
00060     protected:
00064       void findParentItem ( QString &name, QString &path, QString &compare,
00065                        GroupItem **parent, GroupItem **oldItem );
00066 
00070       void processNext();
00071 
00075       void initPrefixList();
00076 
00077       virtual void loadingComplete();
00078 
00079     public slots:
00083       void slotListDirectory(const QStringList&, const QStringList&,
00084           const QStringList&, const QStringList&, const ImapAccountBase::jobData &);
00085 
00089       void slotSave();
00090 
00094       void slotConnectionResult( int errorCode, const QString& errorMsg );
00095 
00096     protected slots:
00100       void slotLoadFolders();
00101 
00102     protected:
00103       virtual void listAllAvailableAndCreateItems() = 0;
00104       virtual void processFolderListing() = 0;
00105       virtual void doSave() = 0;
00106 
00107       // helpers
00109       void moveChildrenToNewParent( GroupItem *oldItem, GroupItem *item  );
00110 
00113       void createListViewItem( int i );
00114 
00115       QString mDelimiter;
00116       QStringList mFolderNames, mFolderPaths,
00117                   mFolderMimeTypes, mFolderAttributes;
00118       ImapAccountBase::jobData mJobData;
00119       uint mCount;
00120       QDict<GroupItem> mItemDict;
00121       QString mStartPath;
00122       bool mSubscribed, mForceSubscriptionEnable;
00123       QStringList mPrefixList;
00124       QString mCurrentNamespace;
00125   };
00126 
00127   class SubscriptionDialog : public SubscriptionDialogBase
00128   {
00129     Q_OBJECT
00130     public:
00131 
00132       SubscriptionDialog( QWidget *parent,
00133                           const QString &caption,
00134                           KAccount* acct,
00135                           QString startPath = QString::null );
00136       virtual ~SubscriptionDialog();
00137      protected:
00139       virtual void listAllAvailableAndCreateItems();
00141       virtual void processFolderListing();
00143       virtual void doSave();
00144 
00145     private:
00150       void processItems();
00151 
00152   };
00153 
00154 } // namespace KMail
00155 
00156 #endif