35 #include "kmfolderdia.h"
36 #include "kmacctfolder.h"
37 #include "kmfoldermgr.h"
38 #include <libkpimidentities/identitycombo.h>
39 #include "kmfolderimap.h"
40 #include "kmfoldercachedimap.h"
42 #include "kmheaders.h"
43 #include "kmcommands.h"
44 #include "kmfoldertree.h"
45 #include "folderdiaacltab.h"
46 #include "folderdiaquotatab.h"
47 #include "kmailicalifaceimpl.h"
48 #include "globalsettings.h"
49 #include "folderrequester.h"
51 #include <keditlistbox.h>
52 #include <klineedit.h>
53 #include <tdelocale.h>
54 #include <knuminput.h>
55 #include <tdemessagebox.h>
56 #include <kicondialog.h>
57 #include <tdeconfig.h>
59 #include <tdelistview.h>
60 #include <kpushbutton.h>
62 #include <tqcheckbox.h>
64 #include <tqgroupbox.h>
68 #include <tqtooltip.h>
69 #include <tqwhatsthis.h>
72 #include <tqhbuttongroup.h>
73 #include <tqradiobutton.h>
74 #include <tqtextedit.h>
76 #include "templatesconfiguration.h"
77 #include "templatesconfiguration_kfg.h"
79 #include "kmfolderdia.moc"
81 using namespace KMail;
83 static TQString inCaseWeDecideToRenameTheTab( I18N_NOOP(
"Permissions (ACL)" ) );
87 KMFolderTree* aParent,
const TQString& aCap,
88 const TQString& aName):
89 KDialogBase( KDialogBase::Tabbed,
90 aCap, KDialogBase::
Ok|KDialogBase::Cancel,
91 KDialogBase::
Ok, aParent,
"KMFolderDialog", TRUE ),
93 mFolderDir( aFolderDir ),
95 mIsNewFolder( aFolder == 0 ),
96 mFolderTree( aParent )
98 kdDebug(5006)<<
"KMFolderDialog::KMFolderDialog()" << endl;
100 TQStringList folderNames;
101 TQValueList<TQGuardedPtr<KMFolder> > folders;
103 aParent->createFolderList(&folderNames, &folders,
true,
true,
104 true,
false,
true,
false);
108 FolderList::ConstIterator it;
110 for( it = folders.begin(); it != folders.end(); ++it, ++i ) {
111 if( (*it)->child() == mFolderDir ) {
121 box = addVBoxPage( i18n(
"General") );
124 box = addVBoxPage( i18n(
"Templates") );
128 KMFolder* refFolder = mFolder ? mFolder : mParentFolder;
129 KMFolderType folderType = refFolder ? refFolder->
folderType() : KMFolderTypeUnknown;
130 bool noContent = mFolder ? mFolder->storage()->noContent() :
false;
131 if ( !noContent && refFolder && ( folderType == KMFolderTypeImap || folderType == KMFolderTypeCachedImap ) ) {
132 if ( FolderDiaACLTab::supports( refFolder ) ) {
133 box = addVBoxPage( i18n(
"Access Control") );
138 if ( !noContent && refFolder && ( folderType == KMFolderTypeImap || folderType == KMFolderTypeCachedImap ) ) {
139 if ( FolderDiaQuotaTab::supports( refFolder ) ) {
140 box = addVBoxPage( i18n(
"Quota") );
146 for (
unsigned int i = 0 ; i < mTabs.count() ; ++i )
152 connect( tab, TQ_SIGNAL( readyForAccept() ),
153 this, TQ_SLOT( slotReadyForAccept() ) );
154 connect( tab, TQ_SIGNAL( cancelAccept() ),
155 this, TQ_SLOT( slotCancelAccept() ) );
162 void KMFolderDialog::slotApply()
164 if ( mFolder.isNull() && !mIsNewFolder ) {
165 KDialogBase::slotApply();
168 for (
unsigned int i = 0 ; i < mTabs.count() ; ++i )
170 if ( !mFolder.isNull() && mIsNewFolder )
171 mIsNewFolder =
false;
172 KDialogBase::slotApply();
178 void KMFolderDialog::slotOk()
180 if ( mFolder.isNull() && !mIsNewFolder ) {
181 KDialogBase::slotOk();
185 mDelayedSavingTabs = 0;
186 for (
unsigned int i = 0 ; i < mTabs.count() ; ++i ) {
187 FolderDiaTab::AccepStatus s = mTabs[i]->accept();
188 if ( s == FolderDiaTab::Canceled ) {
192 else if ( s == FolderDiaTab::Delayed )
193 ++mDelayedSavingTabs;
196 if ( mDelayedSavingTabs )
197 enableButtonOK(
false );
199 KDialogBase::slotOk();
202 void KMFolderDialog::slotReadyForAccept()
204 --mDelayedSavingTabs;
205 if ( mDelayedSavingTabs == 0 )
206 KDialogBase::slotOk();
209 void KMFolderDialog::slotCancelAccept()
211 mDelayedSavingTabs = -1;
212 enableButtonOK(
true );
214 if ( !mFolder.isNull() )
215 mIsNewFolder =
false;
224 void KMFolderDialog::slotChanged(
bool )
230 void KMFolderDialog::setFolder(
KMFolder* folder )
232 Q_ASSERT( mFolder.isNull() );
236 static void addLine( TQWidget *parent, TQVBoxLayout* layout )
238 TQFrame *line =
new TQFrame( parent,
"line" );
239 line->setGeometry( TQRect( 80, 150, 250, 20 ) );
240 line->setFrameShape( TQFrame::HLine );
241 line->setFrameShadow( TQFrame::Sunken );
242 line->setFrameShape( TQFrame::HLine );
243 layout->addWidget( line );
247 KMail::FolderDiaGeneralTab::FolderDiaGeneralTab(
KMFolderDialog* dlg,
248 const TQString& aName,
249 TQWidget* parent,
const char* name )
251 mSharedSeenFlagsCheckBox( 0 ),
255 mIsLocalSystemFolder = mDlg->folder()->isSystemFolder();
256 mIsResourceFolder = kmkernel->iCalIface().isStandardResourceFolder( mDlg->folder() );
260 TQVBoxLayout *topLayout =
new TQVBoxLayout(
this, 0, KDialog::spacingHint() );
263 if ( !mIsLocalSystemFolder || mIsResourceFolder ) {
265 TQHBoxLayout *hl =
new TQHBoxLayout( topLayout );
266 hl->setSpacing( KDialog::spacingHint() );
268 label =
new TQLabel( i18n(
"&Name:"),
this );
269 hl->addWidget( label );
273 bool nameChangeAllowed =
true;
274 if ( mDlg->folder() && mDlg->parentFolder() &&
275 mDlg->folder()->storage() && mDlg->parentFolder()->storage() &&
276 ( mDlg->folder()->folderType() == KMFolderTypeCachedImap ||
277 mDlg->folder()->folderType() == KMFolderTypeImap ) ) {
278 ImapAccountBase *account = 0;
279 KMFolderCachedImap *dimap = 0;
280 KMFolderImap *imap = 0;
281 if ( mDlg->folder()->folderType() == KMFolderTypeCachedImap ) {
282 dimap =
static_cast<KMFolderCachedImap*
>( mDlg->folder()->storage() );
283 account =
dynamic_cast<ImapAccountBase*
>( dimap->account() );
285 if ( mDlg->folder()->folderType() == KMFolderTypeImap ) {
286 imap =
static_cast<KMFolderImap*
>( mDlg->folder()->storage() );
287 account =
dynamic_cast<ImapAccountBase*
>( imap->account() );
290 if ( account && account->hasACLSupport() ) {
291 int parentRights = -1;
292 int folderRights = -1;
293 bool parentRightsOk =
false;
294 bool folderRightsOk =
false;
296 KMFolderImap *
const parent =
dynamic_cast<KMFolderImap*
>( mDlg->parentFolder()->storage() );
297 folderRights = imap->userRights();
300 parentRights = parent->userRights();
303 }
else if ( dimap ) {
304 KMFolderCachedImap *
const parent =
dynamic_cast<KMFolderCachedImap*
>( mDlg->parentFolder()->storage() );
305 folderRights = dimap->userRights();
308 parentRights = parent->userRights();
314 if ( parentRightsOk && folderRightsOk &&
315 ( !( parentRights & KMail::ACLJobs::Create ) || !( folderRights & KMail::ACLJobs::Delete ) ) ) {
316 nameChangeAllowed =
false;
321 mNameEdit =
new KLineEdit(
this );
322 if( !mDlg->folder() && nameChangeAllowed )
323 mNameEdit->setFocus();
324 mNameEdit->setEnabled( nameChangeAllowed );
325 if ( !nameChangeAllowed ) {
326 TQToolTip::add( mNameEdit, i18n(
"Not enough permissions to rename this folder.\n"
327 "The parent folder doesn't have write support.\n"
328 "A sync is needed after changing the permissions." ) );
330 mNameEdit->setText( mDlg->folder() ? mDlg->folder()->label() : i18n(
"unnamed") );
331 if (!aName.isEmpty())
332 mNameEdit->setText(aName);
333 mNameEdit->setMinimumSize(mNameEdit->sizeHint());
335 if ( mDlg->folder() && mDlg->folder()->isSystemFolder() ) {
337 if ( mDlg->folder()->folderType() == KMFolderTypeImap )
338 imapPath =
static_cast<KMFolderImap*
>( mDlg->folder()->storage() )->imapPath();
339 if ( mDlg->folder()->folderType() == KMFolderTypeCachedImap )
340 imapPath =
static_cast<KMFolderCachedImap*
>( mDlg->folder()->storage() )->imapPath();
341 if ( imapPath ==
"/INBOX/" )
342 mNameEdit->setEnabled(
false );
344 label->setBuddy( mNameEdit );
345 hl->addWidget( mNameEdit );
346 connect( mNameEdit, TQ_SIGNAL( textChanged(
const TQString & ) ),
347 this, TQ_SLOT( slotFolderNameChanged(
const TQString & ) ) );
351 TQVBoxLayout *ivl =
new TQVBoxLayout( topLayout );
352 ivl->setSpacing( KDialog::spacingHint() );
354 TQHBoxLayout *ihl =
new TQHBoxLayout( ivl );
355 mIconsCheckBox =
new TQCheckBox( i18n(
"Use custom &icons"),
this );
356 mIconsCheckBox->setChecked(
false );
357 ihl->addWidget( mIconsCheckBox );
358 ihl->addStretch( 2 );
360 mNormalIconLabel =
new TQLabel( i18n(
"&Normal:"),
this );
361 mNormalIconLabel->setEnabled(
false );
362 ihl->addWidget( mNormalIconLabel );
364 mNormalIconButton =
new TDEIconButton(
this );
365 mNormalIconLabel->setBuddy( mNormalIconButton );
366 mNormalIconButton->setIconType( TDEIcon::NoGroup , TDEIcon::Any,
true );
367 mNormalIconButton->setIconSize( 16 );
368 mNormalIconButton->setStrictIconSize(
true );
369 mNormalIconButton->setFixedSize( 28, 28 );
371 mNormalIconButton->setIcon(
"folder" );
372 mNormalIconButton->setEnabled(
false );
373 ihl->addWidget( mNormalIconButton );
375 mUnreadIconLabel =
new TQLabel( i18n(
"&Unread:"),
this );
376 mUnreadIconLabel->setEnabled(
false );
377 ihl->addWidget( mUnreadIconLabel );
379 mUnreadIconButton =
new TDEIconButton(
this );
380 mUnreadIconLabel->setBuddy( mUnreadIconButton );
381 mUnreadIconButton->setIconType( TDEIcon::NoGroup, TDEIcon::Any,
true );
382 mUnreadIconButton->setIconSize( 16 );
383 mUnreadIconButton->setStrictIconSize(
true );
384 mUnreadIconButton->setFixedSize( 28, 28 );
386 mUnreadIconButton->setIcon(
"folder_open" );
387 mUnreadIconButton->setEnabled(
false );
388 ihl->addWidget( mUnreadIconButton );
389 ihl->addStretch( 1 );
391 connect( mIconsCheckBox, TQ_SIGNAL(toggled(
bool)),
392 mNormalIconButton, TQ_SLOT(setEnabled(
bool)) );
393 connect( mIconsCheckBox, TQ_SIGNAL(toggled(
bool)),
394 mUnreadIconButton, TQ_SLOT(setEnabled(
bool)) );
395 connect( mIconsCheckBox, TQ_SIGNAL(toggled(
bool)),
396 mNormalIconLabel, TQ_SLOT(setEnabled(
bool)) );
397 connect( mIconsCheckBox, TQ_SIGNAL(toggled(
bool)),
398 mUnreadIconLabel, TQ_SLOT(setEnabled(
bool)) );
400 connect( mNormalIconButton, TQ_SIGNAL(iconChanged(TQString)),
401 this, TQ_SLOT(slotChangeIcon(TQString)) );
404 addLine(
this, topLayout);
409 TQHBoxLayout *hbl =
new TQHBoxLayout( topLayout );
410 hbl->setSpacing( KDialog::spacingHint() );
411 mNotifyOnNewMailCheckBox =
412 new TQCheckBox( i18n(
"Act on new/unread mail in this folder" ),
this );
413 TQWhatsThis::add( mNotifyOnNewMailCheckBox,
414 i18n(
"<qt><p>If this option is enabled then you will be notified about "
415 "new/unread mail in this folder. Moreover, going to the "
416 "next/previous folder with unread messages will stop at this "
418 "<p>Uncheck this option if you do not want to be notified about "
419 "new/unread mail in this folder and if you want this folder to "
420 "be skipped when going to the next/previous folder with unread "
421 "messages. This is useful for ignoring any new/unread mail in "
422 "your trash and spam folder.</p></qt>" ) );
423 hbl->addWidget( mNotifyOnNewMailCheckBox );
425 if ( mDlg->folder()->folderType() == KMFolderTypeImap ) {
428 TQHBoxLayout *nml =
new TQHBoxLayout( topLayout );
429 nml->setSpacing( KDialog::spacingHint() );
430 mNewMailCheckBox =
new TQCheckBox( i18n(
"Include this folder in mail checks"),
this );
432 mNewMailCheckBox->setChecked(
true);
433 nml->addWidget( mNewMailCheckBox );
434 nml->addStretch( 1 );
438 hbl =
new TQHBoxLayout( topLayout );
439 hbl->setSpacing( KDialog::spacingHint() );
440 mKeepRepliesInSameFolderCheckBox =
441 new TQCheckBox( i18n(
"Keep replies in this folder" ),
this );
442 TQWhatsThis::add( mKeepRepliesInSameFolderCheckBox,
443 i18n(
"Check this option if you want replies you write "
444 "to mails in this folder to be put in this same folder "
445 "after sending, instead of in the configured sent-mail folder." ) );
446 hbl->addWidget( mKeepRepliesInSameFolderCheckBox );
447 hbl->addStretch( 1 );
449 addLine(
this, topLayout );
452 TQGridLayout *gl =
new TQGridLayout( topLayout, 3, 2, KDialog::spacingHint() );
453 gl->setColStretch( 1, 100 );
458 TQString tip = i18n(
"Show Sender/Receiver Column in List of Messages");
460 TQLabel *sender_label =
new TQLabel( i18n(
"Sho&w column:" ),
this );
461 gl->addWidget( sender_label, row, 0 );
462 mShowSenderReceiverComboBox =
new TQComboBox(
this );
463 TQToolTip::add( mShowSenderReceiverComboBox, tip );
464 sender_label->setBuddy(mShowSenderReceiverComboBox);
465 gl->addWidget( mShowSenderReceiverComboBox, row, 1 );
466 mShowSenderReceiverComboBox->insertItem(i18n(
"Default"), 0);
467 mShowSenderReceiverComboBox->insertItem(i18n(
"Sender"), 1);
468 mShowSenderReceiverComboBox->insertItem(i18n(
"Receiver"), 2);
471 if (mDlg->folder()) whoField = mDlg->folder()->userWhoField();
472 if (whoField.isEmpty()) mShowSenderReceiverComboBox->setCurrentItem(0);
473 else if (whoField ==
"From") mShowSenderReceiverComboBox->setCurrentItem(1);
474 else if (whoField ==
"To") mShowSenderReceiverComboBox->setCurrentItem(2);
479 label =
new TQLabel( i18n(
"&Sender identity:"),
this );
480 gl->addWidget( label, row, 0 );
481 mIdentityComboBox =
new KPIM::IdentityCombo( kmkernel->identityManager(),
this );
482 label->setBuddy( mIdentityComboBox );
483 gl->addWidget( mIdentityComboBox, row, 1 );
484 TQWhatsThis::add( mIdentityComboBox,
485 i18n(
"Select the sender identity to be used when writing new mail "
486 "or replying to mail in this folder. This means that if you are in "
487 "one of your work folders, you can make KMail use the corresponding "
488 "sender email address, signature and signing or encryption keys "
489 "automatically. Identities can be set up in the main configuration "
490 "dialog. (Settings -> Configure KMail)") );
493 if ( ( !mIsLocalSystemFolder || mIsResourceFolder ) &&
494 kmkernel->iCalIface().isEnabled() &&
495 mDlg->folder() && mDlg->folder()->folderType() != KMFolderTypeImap ) {
499 label =
new TQLabel( i18n(
"&Folder contents:"),
this );
500 gl->addWidget( label, row, 0 );
501 mContentsComboBox =
new TQComboBox(
this );
502 label->setBuddy( mContentsComboBox );
503 gl->addWidget( mContentsComboBox, row, 1 );
505 mContentsComboBox->insertItem( i18n(
"Mail" ) );
506 mContentsComboBox->insertItem( i18n(
"Calendar" ) );
507 mContentsComboBox->insertItem( i18n(
"Contacts" ) );
508 mContentsComboBox->insertItem( i18n(
"Notes" ) );
509 mContentsComboBox->insertItem( i18n(
"Tasks" ) );
510 mContentsComboBox->insertItem( i18n(
"Journal" ) );
511 if ( mDlg->folder() )
512 mContentsComboBox->setCurrentItem( mDlg->folder()->storage()->contentsType() );
513 connect ( mContentsComboBox, TQ_SIGNAL ( activated(
int ) ),
514 this, TQ_SLOT( slotFolderContentsSelectionChanged(
int ) ) );
515 if ( mDlg->folder()->isReadOnly() || mIsResourceFolder )
516 mContentsComboBox->setEnabled(
false );
518 mContentsComboBox = 0;
521 mIncidencesForComboBox = 0;
522 mAlarmsBlockedCheckBox = 0;
527 if ( ( GlobalSettings::self()->theIMAPResourceStorageFormat() ==
528 GlobalSettings::EnumTheIMAPResourceStorageFormat::XML ) &&
529 mContentsComboBox ) {
532 TQLabel* label =
new TQLabel( i18n(
"Generate free/&busy and activate alarms for:" ),
this );
533 gl->addWidget( label, row, 0 );
534 mIncidencesForComboBox =
new TQComboBox(
this );
535 label->setBuddy( mIncidencesForComboBox );
536 gl->addWidget( mIncidencesForComboBox, row, 1 );
538 const TQString whatsThisForMyOwnFolders =
539 i18n(
"This setting defines which users sharing "
540 "this folder should get \"busy\" periods in their freebusy lists "
541 "and should see the alarms for the events or tasks in this folder. "
542 "The setting applies to Calendar and Task folders only "
543 "(for tasks, this setting is only used for alarms).\n\n"
544 "Example use cases: if the boss shares a folder with their secretary, "
545 "only the boss should be marked as busy for their meetings, so they should "
546 "select \"Admins\", since the secretary has no admin rights on the folder.\n"
547 "On the other hand if a working group shares a Calendar for "
548 "group meetings, all readers of the folders should be marked "
549 "as busy for meetings.\n"
550 "A company-wide folder with optional events in it would use \"Nobody\" "
551 "since it is not known who will go to those events." );
553 TQWhatsThis::add( mIncidencesForComboBox, whatsThisForMyOwnFolders );
554 mIncidencesForComboBox->insertItem( i18n(
"Nobody" ) );
555 mIncidencesForComboBox->insertItem( i18n(
"Admins of This Folder" ) );
556 mIncidencesForComboBox->insertItem( i18n(
"All Readers of This Folder" ) );
558 const TQString whatsThisForReadOnlyFolders =
559 i18n(
"This setting allows you to disable alarms for folders shared by others. ");
560 mAlarmsBlockedCheckBox =
new TQCheckBox(
this );
561 mAlarmsBlockedCheckBox->setText( i18n(
"Block alarms locally" ) );
562 gl->addMultiCellWidget( mAlarmsBlockedCheckBox, row, row, 0, 1);
563 TQWhatsThis::add( mAlarmsBlockedCheckBox, whatsThisForReadOnlyFolders );
565 if ( mDlg->folder()->storage()->contentsType() != KMail::ContentsTypeCalendar
566 && mDlg->folder()->storage()->contentsType() != KMail::ContentsTypeTask ) {
567 mIncidencesForComboBox->setEnabled(
false );
568 mAlarmsBlockedCheckBox->setEnabled(
false );
572 if ( mDlg->folder()->folderType() == KMFolderTypeCachedImap ) {
573 kdDebug() << k_funcinfo << mDlg->folder()->folderType() << endl;
574 mSharedSeenFlagsCheckBox =
new TQCheckBox(
this );
575 mSharedSeenFlagsCheckBox->setText( i18n(
"Share unread state with all users" ) );
577 gl->addMultiCellWidget( mSharedSeenFlagsCheckBox, row, row, 0, 1 );
578 TQWhatsThis::add( mSharedSeenFlagsCheckBox, i18n(
"If enabled, the unread state of messages in this folder will be the same "
579 "for all users having access to this folders. If disabled (the default), every user with access to this folder has her "
580 "own unread state." ) );
582 topLayout->addStretch( 100 );
584 initializeWithValuesFromFolder( mDlg->folder() );
587 void FolderDiaGeneralTab::load()
592 void FolderDiaGeneralTab::initializeWithValuesFromFolder(
KMFolder* folder ) {
596 if ( !mIsLocalSystemFolder ) {
603 TQString iconPath = folder->normalIconPath();
604 if ( !iconPath.isEmpty() )
605 mNormalIconButton->setIcon( iconPath );
606 iconPath = folder->unreadIconPath();
607 if ( !iconPath.isEmpty() )
608 mUnreadIconButton->setIcon( iconPath );
612 mIdentityComboBox->setCurrentIdentity( folder->identity() );
614 mNotifyOnNewMailCheckBox->setChecked( !folder->
ignoreNewMail() );
617 mKeepRepliesInSameFolderCheckBox->setChecked( keepInFolder );
618 mKeepRepliesInSameFolderCheckBox->setDisabled( folder->
isReadOnly() );
622 KMFolderImap* imapFolder =
static_cast<KMFolderImap*
>(folder->storage());
623 bool checked = imapFolder->includeInMailCheck();
624 mNewMailCheckBox->setChecked(checked);
627 if ( mIncidencesForComboBox ) {
628 KMFolderCachedImap* dimap =
static_cast<KMFolderCachedImap *
>( folder->storage() );
629 mIncidencesForComboBox->setCurrentItem( dimap->incidencesFor() );
630 mIncidencesForComboBox->setDisabled( mDlg->folder()->
isReadOnly() );
632 if ( mAlarmsBlockedCheckBox ) {
633 KMFolderCachedImap* dimap =
static_cast<KMFolderCachedImap *
>( folder->storage() );
634 mAlarmsBlockedCheckBox->setChecked( dimap->alarmsBlocked() );
636 if ( mSharedSeenFlagsCheckBox ) {
637 KMFolderCachedImap *dimap =
static_cast<KMFolderCachedImap*
>( folder->storage() );
638 ImapAccountBase *account =
dynamic_cast<ImapAccountBase*
>( dimap->account() );
639 mSharedSeenFlagsCheckBox->setChecked( dimap->sharedSeenFlags() );
640 mSharedSeenFlagsCheckBox->setDisabled( folder->
isReadOnly() );
641 if ( account && account->hasCapability(
"x-kmail-sharedseen" ) )
642 mSharedSeenFlagsCheckBox->show();
644 mSharedSeenFlagsCheckBox->hide();
649 void FolderDiaGeneralTab::slotFolderNameChanged(
const TQString& str )
651 mDlg->enableButtonOK( !str.isEmpty() );
655 void FolderDiaGeneralTab::slotFolderContentsSelectionChanged(
int )
657 KMail::FolderContentsType type =
658 static_cast<KMail::FolderContentsType
>( mContentsComboBox->currentItem() );
659 if( type != KMail::ContentsTypeMail && GlobalSettings::self()->hideGroupwareFolders() ) {
660 TQString message = i18n(
"You have configured this folder to contain groupware information "
661 "and the general configuration option to hide groupware folders is "
662 "set. That means that this folder will disappear once the configuration "
663 "dialog is closed. If you want to remove the folder again, you will need "
664 "to temporarily disable hiding of groupware folders to be able to see it.");
665 KMessageBox::information(
this, message );
667 const bool enable = type == KMail::ContentsTypeCalendar ||
668 type == KMail::ContentsTypeTask;
669 if ( mIncidencesForComboBox )
670 mIncidencesForComboBox->setEnabled( enable );
671 if ( mAlarmsBlockedCheckBox )
672 mAlarmsBlockedCheckBox->setEnabled( enable );
679 folder->setIdentity( mIdentityComboBox->currentIdentity() );
681 if (mShowSenderReceiverComboBox->currentItem() == 1)
682 folder->setUserWhoField(
"From");
683 else if (mShowSenderReceiverComboBox->currentItem() == 2)
684 folder->setUserWhoField(
"To");
686 folder->setUserWhoField(
"");
688 folder->setIgnoreNewMail( !mNotifyOnNewMailCheckBox->isChecked() );
689 folder->setPutRepliesInSameFolder( mKeepRepliesInSameFolderCheckBox->isChecked() );
691 TQString fldName, oldFldName;
692 KMFolderCachedImap* dimap = 0;
693 if ( folder->
folderType() == KMFolderTypeCachedImap )
694 dimap =
static_cast<KMFolderCachedImap *
>( mDlg->folder()->storage() );
696 if ( !mIsLocalSystemFolder || mIsResourceFolder )
698 oldFldName = mDlg->folder()->name();
699 if (!mNameEdit->text().isEmpty())
700 fldName = mNameEdit->text();
702 fldName = oldFldName;
704 if ( mDlg->parentFolder() &&
705 mDlg->parentFolder()->
folderType() != KMFolderTypeImap &&
706 mDlg->parentFolder()->
folderType() != KMFolderTypeCachedImap )
708 fldName.remove(TQRegExp(
"^\\.*"));
709 if (fldName.isEmpty()) fldName = i18n(
"unnamed");
715 folder->setUseCustomIcons( mIconsCheckBox->isChecked() );
718 folder->setIconPaths(
"",
"" );
722 (( mNormalIconButton->icon() != folder->normalIconPath() ) &&
723 ( !mNormalIconButton->icon().isEmpty())) ||
724 (( mUnreadIconButton->icon() != folder->unreadIconPath() ) &&
725 ( !mUnreadIconButton->icon().isEmpty())) ) ) {
726 folder->setIconPaths( mNormalIconButton->icon(), mUnreadIconButton->icon() );
730 if ( mContentsComboBox ) {
731 KMail::FolderContentsType type =
732 static_cast<KMail::FolderContentsType
>( mContentsComboBox->currentItem() );
737 if ( mIncidencesForComboBox ) {
738 KMFolderCachedImap::IncidencesFor incfor = KMFolderCachedImap::IncForAdmins;
739 incfor =
static_cast<KMFolderCachedImap::IncidencesFor
>( mIncidencesForComboBox->currentItem() );
740 if ( dimap->incidencesFor() != incfor ) {
741 dimap->setIncidencesFor( incfor );
742 dimap->writeConfig();
745 if ( mAlarmsBlockedCheckBox && mAlarmsBlockedCheckBox->isChecked() != dimap->alarmsBlocked() ) {
746 dimap->setAlarmsBlocked( mAlarmsBlockedCheckBox->isChecked() );
747 dimap->writeConfig();
751 if( folder->
folderType() == KMFolderTypeImap )
753 KMFolderImap* imapFolder =
static_cast<KMFolderImap*
>( folder->storage() );
754 imapFolder->setIncludeInMailCheck(
755 mNewMailCheckBox->isChecked() );
759 if ( dimap && mSharedSeenFlagsCheckBox &&
760 mSharedSeenFlagsCheckBox->isChecked() != dimap->sharedSeenFlags() ) {
761 dimap->setSharedSeenFlags( mSharedSeenFlagsCheckBox->isChecked() );
762 dimap->writeConfig();
771 KMessageBox::sorry(
this, msg );
780 if ( !oldFldName.isEmpty() )
782 kmkernel->folderMgr()->renameFolder( folder, fldName );
784 kmkernel->folderMgr()->contentsChanged();
791 void FolderDiaGeneralTab::slotChangeIcon( TQString icon )
793 mUnreadIconButton->setIcon( icon );
797 KMail::FolderDiaTemplatesTab::FolderDiaTemplatesTab(
KMFolderDialog* dlg,
805 TQVBoxLayout *topLayout =
new TQVBoxLayout(
this, 0, KDialog::spacingHint() );
807 mCustom =
new TQCheckBox( i18n(
"&Use custom message templates"),
this );
808 topLayout->addWidget( mCustom );
810 mWidget =
new TemplatesConfiguration(
this ,
"folder-templates" );
811 mWidget->setEnabled(
false );
812 topLayout->addWidget( mWidget );
814 TQHBoxLayout *btns =
new TQHBoxLayout( topLayout, KDialog::spacingHint() );
815 mCopyGlobal =
new KPushButton( i18n(
"&Copy global templates"),
this );
816 mCopyGlobal->setEnabled(
false );
817 btns->addWidget( mCopyGlobal );
819 connect( mCustom, TQ_SIGNAL(toggled(
bool)),
820 mWidget, TQ_SLOT(setEnabled(
bool)) );
821 connect( mCustom, TQ_SIGNAL(toggled(
bool)),
822 mCopyGlobal, TQ_SLOT(setEnabled(
bool)) );
824 connect( mCopyGlobal, TQ_SIGNAL(clicked()),
825 this, TQ_SLOT(slotCopyGlobal()) );
827 initializeWithValuesFromFolder( mDlg->folder() );
829 connect( mWidget, TQ_SIGNAL(
changed() ),
830 this, TQ_SLOT( slotEmitChanged(
void ) ) );
833 void FolderDiaTemplatesTab::load()
838 void FolderDiaTemplatesTab::initializeWithValuesFromFolder(
KMFolder* folder ) {
848 mCustom->setChecked(t.useCustomTemplates());
850 mIdentity = folder->identity();
852 mWidget->loadFromFolder( fid, mIdentity );
863 kdDebug() <<
"use custom templates for folder " << fid <<
": " << mCustom->isChecked() << endl;
864 t.setUseCustomTemplates(mCustom->isChecked());
867 mWidget->saveToFolder(fid);
873 void FolderDiaTemplatesTab::slotEmitChanged() {}
875 void FolderDiaTemplatesTab::slotCopyGlobal() {
877 mWidget->loadFromIdentity( mIdentity );
880 mWidget->loadFromGlobal();
virtual void setContentsType(KMail::FolderContentsType type, bool quiet=false)
Set the type of contents held in this folder (mail, calendar, etc.)
virtual void writeConfig()
Write the config file.
Dialog for handling the properties of a mail folder.
KMail list that manages the contents of one directory that may contain folders and/or other directori...
TQString idString() const
Returns a string that can be used to identify this folder.
bool useCustomIcons() const
Icon related methods.
bool isValidName(const TQString &folderName, TQString &message)
Returns true if the name is valid for a child of this folder.
bool putRepliesInSameFolder() const
Returns true if the replies to mails from this folder should be put in the same folder.
bool ignoreNewMail() const
Returns true if the user doesn't want to get notified about new mail in this folder.
bool isSystemFolder() const
Returns true if the folder is a kmail system folder.
KMFolderType folderType() const
Returns the type of this folder.
bool isReadOnly() const
Is the folder read-only?
"Access Control" tab in the folder dialog Internal class, only used by KMFolderDialog
"General" tab in the folder dialog Internal class, only used by KMFolderDialog
virtual bool save()
Unlike ConfigModuleTab, we return a bool from save.
"Quota" tab in the folder dialog Internal class, only used by KMFolderDialog
This is the base class for tabs in the folder dialog.
void changed(bool)
Called when this module was changed [not really used yet].
"Templates" tab in the folder dialog Internal class, only used by KMFolderDialog
virtual bool save()
Unlike ConfigModuleTab, we return a bool from save.
@ Ok
The user rights/ACL have been fetched from the server sucessfully.