37 #include <tdelocale.h>
38 #include <tdemessagebox.h>
40 #include "localsubscriptiondialog.h"
42 #include "accountmanager.h"
43 #include "kmmessage.h"
44 #include "imapaccountbase.h"
49 LocalSubscriptionDialog::LocalSubscriptionDialog( TQWidget *parent,
const TQString &caption,
50 ImapAccountBase *acct, TQString startPath )
51 : SubscriptionDialog( parent, caption, acct, startPath ),
57 LocalSubscriptionDialog::~LocalSubscriptionDialog()
62 void LocalSubscriptionDialog::listAllAvailableAndCreateItems()
64 if ( mAccount->onlySubscribedFolders() )
66 SubscriptionDialog::listAllAvailableAndCreateItems();
70 void LocalSubscriptionDialog::processFolderListing()
73 for (uint i = mCount; i < mFolderNames.count(); ++i)
79 TQTimer::singleShot(0,
this, TQ_SLOT(processItems()));
84 createListViewItem( i );
87 if ( mPrefixList.isEmpty() && !mSubscribed )
93 void LocalSubscriptionDialog::setCheckedStateOfAllItems()
97 TQDictIterator<GroupItem> it( mItemDict );
98 for ( ; it.current(); ++it ) {
99 GroupItem *item = it.current();
100 TQString path = it.currentKey();
101 item->setOn( mAccount->locallySubscribedTo( path ) );
106 void LocalSubscriptionDialog::doSave()
108 bool somethingHappened =
false;
110 TQListViewItemIterator it(subView);
111 for ( ; it.current(); ++it) {
112 static_cast<ImapAccountBase*
>(account())->changeLocalSubscription(
113 static_cast<GroupItem*
>(it.current())->info().path, true );
114 somethingHappened =
true;
118 TQListViewItemIterator it2(unsubView);
119 if ( unsubView->childCount() > 0 ) {
120 const TQString message = i18n(
"Locally unsubscribing from folders will remove all "
121 "information that is present locally about those folders. The folders will "
122 "not be changed on the server. Press cancel now if you want to make sure "
123 "all local changes have been written to the server by checking mail first.");
124 const TQString caption = i18n(
"Local changes will be lost when unsubscribing");
125 if ( KMessageBox::warningContinueCancel(
this, message, caption )
126 != KMessageBox::Cancel ) {
127 somethingHappened =
true;
128 for ( ; it2.current(); ++it2) {
129 static_cast<ImapAccountBase*
>(account())->changeLocalSubscription(
130 static_cast<GroupItem*
>(it2.current())->info().path, false );
135 if ( somethingHappened ) {
136 kmkernel->acctMgr()->singleCheckMail( mAccount,
true);
140 void LocalSubscriptionDialog::loadingComplete()
142 setCheckedStateOfAllItems();
143 SubscriptionDialog::loadingComplete();
148 #include "localsubscriptiondialog.moc"