4 This file is part of KMail, the KDE mail client.
5 Copyright (C) 2002 Carsten Burghardt <burghardt@kde.org>
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License, version 2, as
9 published by the Free Software Foundation.
11 KMail is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the Qt library by Trolltech AS, Norway (or with modified versions
23 of Qt that use the same license as Qt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 Qt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
32 #ifndef __SUBSCRIPTIONDIALOG
33 #define __SUBSCRIPTIONDIALOG
35 #include "imapaccountbase.h"
37 #include <ksubscription.h>
41 using KPIM::KSubscription
;
42 using KPIM::GroupItem
;
43 using KPIM::KGroupInfo
;
47 // Abstract base class for the server side and client side subscription dialogs.
48 // Scott Meyers says: "Make non-leaf classes abstract" and he is right, I think.
49 // (More Effective C++, Item 33)
50 class SubscriptionDialogBase
: public KSubscription
55 SubscriptionDialogBase( QWidget
*parent
,
56 const QString
&caption
,
58 const QString
&startPath
= QString() );
59 virtual ~SubscriptionDialogBase() {
67 * Find the parent item
69 void findParentItem ( QString
&name
, QString
&path
, QString
&compare
,
70 GroupItem
**parent
, GroupItem
**oldItem
);
73 * Process the next prefix in mPrefixList
80 void initPrefixList();
82 virtual void loadingComplete();
86 * get the listing from the imap-server
88 void slotListDirectory(const QStringList
&, const QStringList
&,
89 const QStringList
&, const QStringList
&, const ImapAccountBase::jobData
&);
92 * called by Ok-button, saves the changes
97 * Called from the account when a connection was established
99 void slotConnectionResult( int errorCode
, const QString
& errorMsg
);
105 void slotLoadFolders();
108 virtual void listAllAvailableAndCreateItems() = 0;
109 virtual void processFolderListing() = 0;
110 virtual void doSave() = 0;
113 /** Move all child items of @param oldItem under @param item */
114 void moveChildrenToNewParent( GroupItem
*oldItem
, GroupItem
*item
);
116 /** Create a listview item for the i-th entry in the list of available
118 void createListViewItem( int i
);
120 /** If subscriptions are not used for the server,
121 * asks "Do you want to enable subscriptions?" */
122 void checkIfSubscriptionsEnabled();
125 QStringList mFolderNames
, mFolderPaths
,
126 mFolderMimeTypes
, mFolderAttributes
;
127 ImapAccountBase::jobData mJobData
;
129 QMap
<QString
, GroupItem
*> mItemDict
;
131 bool mSubscribed
, mForceSubscriptionEnable
;
132 QStringList mPrefixList
;
133 QString mCurrentNamespace
;
136 class SubscriptionDialog
: public SubscriptionDialogBase
141 SubscriptionDialog( QWidget
*parent
,
142 const QString
&caption
,
144 const QString
& startPath
= QString() );
145 virtual ~SubscriptionDialog();
148 virtual void listAllAvailableAndCreateItems();
150 virtual void processFolderListing();
152 virtual void doSave();
156 * Create or update the listitems, depending on whether we are listing
157 * all available folders, or only subscribed ones.