36 #include "kmfolderdia.h" 37 #include "kmacctfolder.h" 38 #include "kmfoldermgr.h" 39 #include <libkpimidentities/identitycombo.h> 40 #include "kmfolderimap.h" 41 #include "kmfoldercachedimap.h" 43 #include "kmheaders.h" 44 #include "kmcommands.h" 45 #include "kmfoldertree.h" 46 #include "folderdiaacltab.h" 47 #include "folderdiaquotatab.h" 48 #include "kmailicalifaceimpl.h" 49 #include "globalsettings.h" 50 #include "folderrequester.h" 52 #include <keditlistbox.h> 53 #include <klineedit.h> 54 #include <tdelocale.h> 55 #include <knuminput.h> 56 #include <tdemessagebox.h> 57 #include <kicondialog.h> 58 #include <tdeconfig.h> 60 #include <tdelistview.h> 61 #include <kpushbutton.h> 63 #include <tqcheckbox.h> 65 #include <tqgroupbox.h> 69 #include <tqtooltip.h> 70 #include <tqwhatsthis.h> 73 #include <tqhbuttongroup.h> 74 #include <tqradiobutton.h> 75 #include <tqtextedit.h> 77 #include "templatesconfiguration.h" 78 #include "templatesconfiguration_kfg.h" 80 #include "kmfolderdia.moc" 82 using namespace KMail;
84 static TQString inCaseWeDecideToRenameTheTab( I18N_NOOP(
"Permissions (ACL)" ) );
88 KMFolderTree* aParent,
const TQString& aCap,
89 const TQString& aName):
90 KDialogBase( KDialogBase::Tabbed,
91 aCap, KDialogBase::
Ok|KDialogBase::Cancel,
92 KDialogBase::
Ok, aParent,
"KMFolderDialog", TRUE ),
94 mFolderDir( aFolderDir ),
96 mIsNewFolder( aFolder == 0 ),
97 mFolderTree( aParent )
99 kdDebug(5006)<<
"KMFolderDialog::KMFolderDialog()" << endl;
101 TQStringList folderNames;
102 TQValueList<TQGuardedPtr<KMFolder> > folders;
104 aParent->createFolderList(&folderNames, &folders,
true,
true,
105 true,
false,
true,
false);
109 FolderList::ConstIterator it;
111 for( it = folders.begin(); it != folders.end(); ++it, ++i ) {
112 if( (*it)->child() == mFolderDir ) {
122 box = addVBoxPage( i18n(
"General") );
125 box = addVBoxPage( i18n(
"Templates") );
129 KMFolder* refFolder = mFolder ? mFolder : mParentFolder;
130 KMFolderType folderType = refFolder ? refFolder->
folderType() : KMFolderTypeUnknown;
131 bool noContent = mFolder ? mFolder->storage()->
noContent() :
false;
132 if ( !noContent && refFolder && ( folderType == KMFolderTypeImap || folderType == KMFolderTypeCachedImap ) ) {
133 if ( FolderDiaACLTab::supports( refFolder ) ) {
134 box = addVBoxPage( i18n(
"Access Control") );
139 if ( !noContent && refFolder && ( folderType == KMFolderTypeImap || folderType == KMFolderTypeCachedImap ) ) {
140 if ( FolderDiaQuotaTab::supports( refFolder ) ) {
141 box = addVBoxPage( i18n(
"Quota") );
147 for (
unsigned int i = 0 ; i < mTabs.count() ; ++i )
153 connect( tab, TQT_SIGNAL( readyForAccept() ),
154 this, TQT_SLOT( slotReadyForAccept() ) );
155 connect( tab, TQT_SIGNAL( cancelAccept() ),
156 this, TQT_SLOT( slotCancelAccept() ) );
163 void KMFolderDialog::slotApply()
165 if ( mFolder.isNull() && !mIsNewFolder ) {
166 KDialogBase::slotApply();
169 for (
unsigned int i = 0 ; i < mTabs.count() ; ++i )
171 if ( !mFolder.isNull() && mIsNewFolder )
172 mIsNewFolder =
false;
173 KDialogBase::slotApply();
179 void KMFolderDialog::slotOk()
181 if ( mFolder.isNull() && !mIsNewFolder ) {
182 KDialogBase::slotOk();
186 mDelayedSavingTabs = 0;
187 for (
unsigned int i = 0 ; i < mTabs.count() ; ++i ) {
188 FolderDiaTab::AccepStatus s = mTabs[i]->accept();
189 if ( s == FolderDiaTab::Canceled ) {
193 else if ( s == FolderDiaTab::Delayed )
194 ++mDelayedSavingTabs;
197 if ( mDelayedSavingTabs )
198 enableButtonOK(
false );
200 KDialogBase::slotOk();
203 void KMFolderDialog::slotReadyForAccept()
205 --mDelayedSavingTabs;
206 if ( mDelayedSavingTabs == 0 )
207 KDialogBase::slotOk();
210 void KMFolderDialog::slotCancelAccept()
212 mDelayedSavingTabs = -1;
213 enableButtonOK(
true );
215 if ( !mFolder.isNull() )
216 mIsNewFolder =
false;
225 void KMFolderDialog::slotChanged(
bool )
231 void KMFolderDialog::setFolder(
KMFolder* folder )
233 Q_ASSERT( mFolder.isNull() );
237 static void addLine( TQWidget *parent, TQVBoxLayout* layout )
239 TQFrame *line =
new TQFrame( parent,
"line" );
240 line->setGeometry( TQRect( 80, 150, 250, 20 ) );
241 line->setFrameShape( TQFrame::HLine );
242 line->setFrameShadow( TQFrame::Sunken );
243 line->setFrameShape( TQFrame::HLine );
244 layout->addWidget( line );
248 KMail::FolderDiaGeneralTab::FolderDiaGeneralTab(
KMFolderDialog* dlg,
249 const TQString& aName,
250 TQWidget* parent,
const char* name )
252 mSharedSeenFlagsCheckBox( 0 ),
256 mIsLocalSystemFolder = mDlg->folder()->isSystemFolder();
257 mIsResourceFolder = kmkernel->iCalIface().isStandardResourceFolder( mDlg->folder() );
261 TQVBoxLayout *topLayout =
new TQVBoxLayout(
this, 0, KDialog::spacingHint() );
264 if ( !mIsLocalSystemFolder || mIsResourceFolder ) {
266 TQHBoxLayout *hl =
new TQHBoxLayout( topLayout );
267 hl->setSpacing( KDialog::spacingHint() );
269 label =
new TQLabel( i18n(
"&Name:"),
this );
270 hl->addWidget( label );
274 bool nameChangeAllowed =
true;
275 if ( mDlg->folder() && mDlg->parentFolder() &&
276 mDlg->folder()->storage() && mDlg->parentFolder()->storage() &&
277 ( mDlg->folder()->folderType() == KMFolderTypeCachedImap ||
278 mDlg->folder()->folderType() == KMFolderTypeImap ) ) {
279 ImapAccountBase *account = 0;
280 KMFolderCachedImap *dimap = 0;
281 KMFolderImap *imap = 0;
282 if ( mDlg->folder()->folderType() == KMFolderTypeCachedImap ) {
283 dimap =
static_cast<KMFolderCachedImap*
>( mDlg->folder()->storage() );
284 account =
dynamic_cast<ImapAccountBase*
>( dimap->account() );
286 if ( mDlg->folder()->folderType() == KMFolderTypeImap ) {
287 imap =
static_cast<KMFolderImap*
>( mDlg->folder()->storage() );
288 account =
dynamic_cast<ImapAccountBase*
>( imap->account() );
291 if ( account && account->hasACLSupport() ) {
292 int parentRights = -1;
293 int folderRights = -1;
294 bool parentRightsOk =
false;
295 bool folderRightsOk =
false;
297 KMFolderImap *
const parent =
dynamic_cast<KMFolderImap*
>( mDlg->parentFolder()->storage() );
298 folderRights = imap->userRights();
301 parentRights = parent->userRights();
304 }
else if ( dimap ) {
305 KMFolderCachedImap *
const parent =
dynamic_cast<KMFolderCachedImap*
>( mDlg->parentFolder()->storage() );
306 folderRights = dimap->userRights();
309 parentRights = parent->userRights();
315 if ( parentRightsOk && folderRightsOk &&
316 ( !( parentRights & KMail::ACLJobs::Create ) || !( folderRights & KMail::ACLJobs::Delete ) ) ) {
317 nameChangeAllowed =
false;
322 mNameEdit =
new KLineEdit(
this );
323 if( !mDlg->folder() && nameChangeAllowed )
324 mNameEdit->setFocus();
325 mNameEdit->setEnabled( nameChangeAllowed );
326 if ( !nameChangeAllowed ) {
327 TQToolTip::add( mNameEdit, i18n(
"Not enough permissions to rename this folder.\n" 328 "The parent folder doesn't have write support.\n" 329 "A sync is needed after changing the permissions." ) );
331 mNameEdit->setText( mDlg->folder() ? mDlg->folder()->label() : i18n(
"unnamed") );
332 if (!aName.isEmpty())
333 mNameEdit->setText(aName);
334 mNameEdit->setMinimumSize(mNameEdit->sizeHint());
336 if ( mDlg->folder() && mDlg->folder()->isSystemFolder() ) {
338 if ( mDlg->folder()->folderType() == KMFolderTypeImap )
339 imapPath = static_cast<KMFolderImap*>( mDlg->folder()->storage() )->imapPath();
340 if ( mDlg->folder()->folderType() == KMFolderTypeCachedImap )
341 imapPath = static_cast<KMFolderCachedImap*>( mDlg->folder()->storage() )->imapPath();
342 if ( imapPath ==
"/INBOX/" )
343 mNameEdit->setEnabled(
false );
345 label->setBuddy( mNameEdit );
346 hl->addWidget( mNameEdit );
347 connect( mNameEdit, TQT_SIGNAL( textChanged(
const TQString & ) ),
348 this, TQT_SLOT( slotFolderNameChanged(
const TQString & ) ) );
352 TQVBoxLayout *ivl =
new TQVBoxLayout( topLayout );
353 ivl->setSpacing( KDialog::spacingHint() );
355 TQHBoxLayout *ihl =
new TQHBoxLayout( ivl );
356 mIconsCheckBox =
new TQCheckBox( i18n(
"Use custom &icons"),
this );
357 mIconsCheckBox->setChecked(
false );
358 ihl->addWidget( mIconsCheckBox );
359 ihl->addStretch( 2 );
361 mNormalIconLabel =
new TQLabel( i18n(
"&Normal:"),
this );
362 mNormalIconLabel->setEnabled(
false );
363 ihl->addWidget( mNormalIconLabel );
365 mNormalIconButton =
new TDEIconButton(
this );
366 mNormalIconLabel->setBuddy( mNormalIconButton );
367 mNormalIconButton->setIconType( TDEIcon::NoGroup , TDEIcon::Any,
true );
368 mNormalIconButton->setIconSize( 16 );
369 mNormalIconButton->setStrictIconSize(
true );
370 mNormalIconButton->setFixedSize( 28, 28 );
372 mNormalIconButton->setIcon(
"folder" );
373 mNormalIconButton->setEnabled(
false );
374 ihl->addWidget( mNormalIconButton );
376 mUnreadIconLabel =
new TQLabel( i18n(
"&Unread:"),
this );
377 mUnreadIconLabel->setEnabled(
false );
378 ihl->addWidget( mUnreadIconLabel );
380 mUnreadIconButton =
new TDEIconButton(
this );
381 mUnreadIconLabel->setBuddy( mUnreadIconButton );
382 mUnreadIconButton->setIconType( TDEIcon::NoGroup, TDEIcon::Any,
true );
383 mUnreadIconButton->setIconSize( 16 );
384 mUnreadIconButton->setStrictIconSize(
true );
385 mUnreadIconButton->setFixedSize( 28, 28 );
387 mUnreadIconButton->setIcon(
"folder_open" );
388 mUnreadIconButton->setEnabled(
false );
389 ihl->addWidget( mUnreadIconButton );
390 ihl->addStretch( 1 );
392 connect( mIconsCheckBox, TQT_SIGNAL(toggled(
bool)),
393 mNormalIconButton, TQT_SLOT(setEnabled(
bool)) );
394 connect( mIconsCheckBox, TQT_SIGNAL(toggled(
bool)),
395 mUnreadIconButton, TQT_SLOT(setEnabled(
bool)) );
396 connect( mIconsCheckBox, TQT_SIGNAL(toggled(
bool)),
397 mNormalIconLabel, TQT_SLOT(setEnabled(
bool)) );
398 connect( mIconsCheckBox, TQT_SIGNAL(toggled(
bool)),
399 mUnreadIconLabel, TQT_SLOT(setEnabled(
bool)) );
401 connect( mNormalIconButton, TQT_SIGNAL(iconChanged(TQString)),
402 this, TQT_SLOT(slotChangeIcon(TQString)) );
405 addLine(
this, topLayout);
410 TQHBoxLayout *hbl =
new TQHBoxLayout( topLayout );
411 hbl->setSpacing( KDialog::spacingHint() );
412 mNotifyOnNewMailCheckBox =
413 new TQCheckBox( i18n(
"Act on new/unread mail in this folder" ),
this );
414 TQWhatsThis::add( mNotifyOnNewMailCheckBox,
415 i18n(
"<qt><p>If this option is enabled then you will be notified about " 416 "new/unread mail in this folder. Moreover, going to the " 417 "next/previous folder with unread messages will stop at this " 419 "<p>Uncheck this option if you do not want to be notified about " 420 "new/unread mail in this folder and if you want this folder to " 421 "be skipped when going to the next/previous folder with unread " 422 "messages. This is useful for ignoring any new/unread mail in " 423 "your trash and spam folder.</p></qt>" ) );
424 hbl->addWidget( mNotifyOnNewMailCheckBox );
426 if ( mDlg->folder()->folderType() == KMFolderTypeImap ) {
429 TQHBoxLayout *nml =
new TQHBoxLayout( topLayout );
430 nml->setSpacing( KDialog::spacingHint() );
431 mNewMailCheckBox =
new TQCheckBox( i18n(
"Include this folder in mail checks"),
this );
433 mNewMailCheckBox->setChecked(
true);
434 nml->addWidget( mNewMailCheckBox );
435 nml->addStretch( 1 );
439 hbl =
new TQHBoxLayout( topLayout );
440 hbl->setSpacing( KDialog::spacingHint() );
441 mKeepRepliesInSameFolderCheckBox =
442 new TQCheckBox( i18n(
"Keep replies in this folder" ),
this );
443 TQWhatsThis::add( mKeepRepliesInSameFolderCheckBox,
444 i18n(
"Check this option if you want replies you write " 445 "to mails in this folder to be put in this same folder " 446 "after sending, instead of in the configured sent-mail folder." ) );
447 hbl->addWidget( mKeepRepliesInSameFolderCheckBox );
448 hbl->addStretch( 1 );
450 addLine(
this, topLayout );
453 TQGridLayout *gl =
new TQGridLayout( topLayout, 3, 2, KDialog::spacingHint() );
454 gl->setColStretch( 1, 100 );
459 TQString tip = i18n(
"Show Sender/Receiver Column in List of Messages");
461 TQLabel *sender_label =
new TQLabel( i18n(
"Sho&w column:" ),
this );
462 gl->addWidget( sender_label, row, 0 );
463 mShowSenderReceiverComboBox =
new TQComboBox(
this );
464 TQToolTip::add( mShowSenderReceiverComboBox, tip );
465 sender_label->setBuddy(mShowSenderReceiverComboBox);
466 gl->addWidget( mShowSenderReceiverComboBox, row, 1 );
467 mShowSenderReceiverComboBox->insertItem(i18n(
"Default"), 0);
468 mShowSenderReceiverComboBox->insertItem(i18n(
"Sender"), 1);
469 mShowSenderReceiverComboBox->insertItem(i18n(
"Receiver"), 2);
472 if (mDlg->folder()) whoField = mDlg->folder()->userWhoField();
473 if (whoField.isEmpty()) mShowSenderReceiverComboBox->setCurrentItem(0);
474 else if (whoField ==
"From") mShowSenderReceiverComboBox->setCurrentItem(1);
475 else if (whoField ==
"To") mShowSenderReceiverComboBox->setCurrentItem(2);
480 label =
new TQLabel( i18n(
"&Sender identity:"),
this );
481 gl->addWidget( label, row, 0 );
482 mIdentityComboBox =
new KPIM::IdentityCombo( kmkernel->identityManager(), this );
483 label->setBuddy( mIdentityComboBox );
484 gl->addWidget( mIdentityComboBox, row, 1 );
485 TQWhatsThis::add( mIdentityComboBox,
486 i18n(
"Select the sender identity to be used when writing new mail " 487 "or replying to mail in this folder. This means that if you are in " 488 "one of your work folders, you can make KMail use the corresponding " 489 "sender email address, signature and signing or encryption keys " 490 "automatically. Identities can be set up in the main configuration " 491 "dialog. (Settings -> Configure KMail)") );
494 if ( ( !mIsLocalSystemFolder || mIsResourceFolder ) &&
495 kmkernel->iCalIface().isEnabled() &&
496 mDlg->folder() && mDlg->folder()->folderType() != KMFolderTypeImap ) {
500 label =
new TQLabel( i18n(
"&Folder contents:"),
this );
501 gl->addWidget( label, row, 0 );
502 mContentsComboBox =
new TQComboBox(
this );
503 label->setBuddy( mContentsComboBox );
504 gl->addWidget( mContentsComboBox, row, 1 );
506 mContentsComboBox->insertItem( i18n(
"Mail" ) );
507 mContentsComboBox->insertItem( i18n(
"Calendar" ) );
508 mContentsComboBox->insertItem( i18n(
"Contacts" ) );
509 mContentsComboBox->insertItem( i18n(
"Notes" ) );
510 mContentsComboBox->insertItem( i18n(
"Tasks" ) );
511 mContentsComboBox->insertItem( i18n(
"Journal" ) );
512 if ( mDlg->folder() )
513 mContentsComboBox->setCurrentItem( mDlg->folder()->storage()->contentsType() );
514 connect ( mContentsComboBox, TQT_SIGNAL ( activated(
int ) ),
515 this, TQT_SLOT( slotFolderContentsSelectionChanged(
int ) ) );
516 if ( mDlg->folder()->isReadOnly() || mIsResourceFolder )
517 mContentsComboBox->setEnabled(
false );
519 mContentsComboBox = 0;
522 mIncidencesForComboBox = 0;
523 mAlarmsBlockedCheckBox = 0;
528 if ( ( GlobalSettings::self()->theIMAPResourceStorageFormat() ==
529 GlobalSettings::EnumTheIMAPResourceStorageFormat::XML ) &&
530 mContentsComboBox ) {
533 TQLabel* label =
new TQLabel( i18n(
"Generate free/&busy and activate alarms for:" ),
this );
534 gl->addWidget( label, row, 0 );
535 mIncidencesForComboBox =
new TQComboBox(
this );
536 label->setBuddy( mIncidencesForComboBox );
537 gl->addWidget( mIncidencesForComboBox, row, 1 );
539 const TQString whatsThisForMyOwnFolders =
540 i18n(
"This setting defines which users sharing " 541 "this folder should get \"busy\" periods in their freebusy lists " 542 "and should see the alarms for the events or tasks in this folder. " 543 "The setting applies to Calendar and Task folders only " 544 "(for tasks, this setting is only used for alarms).\n\n" 545 "Example use cases: if the boss shares a folder with his secretary, " 546 "only the boss should be marked as busy for his meetings, so he should " 547 "select \"Admins\", since the secretary has no admin rights on the folder.\n" 548 "On the other hand if a working group shares a Calendar for " 549 "group meetings, all readers of the folders should be marked " 550 "as busy for meetings.\n" 551 "A company-wide folder with optional events in it would use \"Nobody\" " 552 "since it is not known who will go to those events." );
554 TQWhatsThis::add( mIncidencesForComboBox, whatsThisForMyOwnFolders );
555 mIncidencesForComboBox->insertItem( i18n(
"Nobody" ) );
556 mIncidencesForComboBox->insertItem( i18n(
"Admins of This Folder" ) );
557 mIncidencesForComboBox->insertItem( i18n(
"All Readers of This Folder" ) );
559 const TQString whatsThisForReadOnlyFolders =
560 i18n(
"This setting allows you to disable alarms for folders shared by others. ");
561 mAlarmsBlockedCheckBox =
new TQCheckBox(
this );
562 mAlarmsBlockedCheckBox->setText( i18n(
"Block alarms locally" ) );
563 gl->addMultiCellWidget( mAlarmsBlockedCheckBox, row, row, 0, 1);
564 TQWhatsThis::add( mAlarmsBlockedCheckBox, whatsThisForReadOnlyFolders );
566 if ( mDlg->folder()->storage()->contentsType() != KMail::ContentsTypeCalendar
567 && mDlg->folder()->storage()->contentsType() != KMail::ContentsTypeTask ) {
568 mIncidencesForComboBox->setEnabled(
false );
569 mAlarmsBlockedCheckBox->setEnabled(
false );
573 if ( mDlg->folder()->folderType() == KMFolderTypeCachedImap ) {
574 kdDebug() << k_funcinfo << mDlg->folder()->folderType() << endl;
575 mSharedSeenFlagsCheckBox =
new TQCheckBox(
this );
576 mSharedSeenFlagsCheckBox->setText( i18n(
"Share unread state with all users" ) );
578 gl->addMultiCellWidget( mSharedSeenFlagsCheckBox, row, row, 0, 1 );
579 TQWhatsThis::add( mSharedSeenFlagsCheckBox, i18n(
"If enabled, the unread state of messages in this folder will be the same " 580 "for all users having access to this folders. If disabled (the default), every user with access to this folder has her " 581 "own unread state." ) );
583 topLayout->addStretch( 100 );
585 initializeWithValuesFromFolder( mDlg->folder() );
588 void FolderDiaGeneralTab::load()
593 void FolderDiaGeneralTab::initializeWithValuesFromFolder(
KMFolder* folder ) {
597 if ( !mIsLocalSystemFolder ) {
604 TQString iconPath = folder->normalIconPath();
605 if ( !iconPath.isEmpty() )
606 mNormalIconButton->setIcon( iconPath );
607 iconPath = folder->unreadIconPath();
608 if ( !iconPath.isEmpty() )
609 mUnreadIconButton->setIcon( iconPath );
613 mIdentityComboBox->setCurrentIdentity( folder->identity() );
615 mNotifyOnNewMailCheckBox->setChecked( !folder->
ignoreNewMail() );
618 mKeepRepliesInSameFolderCheckBox->setChecked( keepInFolder );
619 mKeepRepliesInSameFolderCheckBox->setDisabled( folder->
isReadOnly() );
623 KMFolderImap* imapFolder =
static_cast<KMFolderImap*
>(folder->storage());
624 bool checked = imapFolder->includeInMailCheck();
625 mNewMailCheckBox->setChecked(checked);
628 if ( mIncidencesForComboBox ) {
629 KMFolderCachedImap* dimap =
static_cast<KMFolderCachedImap *
>( folder->storage() );
630 mIncidencesForComboBox->setCurrentItem( dimap->incidencesFor() );
631 mIncidencesForComboBox->setDisabled( mDlg->folder()->isReadOnly() );
633 if ( mAlarmsBlockedCheckBox ) {
634 KMFolderCachedImap* dimap =
static_cast<KMFolderCachedImap *
>( folder->storage() );
635 mAlarmsBlockedCheckBox->setChecked( dimap->alarmsBlocked() );
637 if ( mSharedSeenFlagsCheckBox ) {
638 KMFolderCachedImap *dimap =
static_cast<KMFolderCachedImap*
>( folder->storage() );
639 ImapAccountBase *account =
dynamic_cast<ImapAccountBase*
>( dimap->account() );
640 mSharedSeenFlagsCheckBox->setChecked( dimap->sharedSeenFlags() );
641 mSharedSeenFlagsCheckBox->setDisabled( folder->
isReadOnly() );
642 if ( account && account->hasCapability(
"x-kmail-sharedseen" ) )
643 mSharedSeenFlagsCheckBox->show();
645 mSharedSeenFlagsCheckBox->hide();
650 void FolderDiaGeneralTab::slotFolderNameChanged(
const TQString& str )
652 mDlg->enableButtonOK( !str.isEmpty() );
656 void FolderDiaGeneralTab::slotFolderContentsSelectionChanged(
int )
658 KMail::FolderContentsType type =
659 static_cast<KMail::FolderContentsType
>( mContentsComboBox->currentItem() );
660 if( type != KMail::ContentsTypeMail && GlobalSettings::self()->hideGroupwareFolders() ) {
661 TQString message = i18n(
"You have configured this folder to contain groupware information " 662 "and the general configuration option to hide groupware folders is " 663 "set. That means that this folder will disappear once the configuration " 664 "dialog is closed. If you want to remove the folder again, you will need " 665 "to temporarily disable hiding of groupware folders to be able to see it.");
666 KMessageBox::information(
this, message );
668 const bool enable = type == KMail::ContentsTypeCalendar ||
669 type == KMail::ContentsTypeTask;
670 if ( mIncidencesForComboBox )
671 mIncidencesForComboBox->setEnabled( enable );
672 if ( mAlarmsBlockedCheckBox )
673 mAlarmsBlockedCheckBox->setEnabled( enable );
677 bool FolderDiaGeneralTab::save()
680 folder->setIdentity( mIdentityComboBox->currentIdentity() );
682 if (mShowSenderReceiverComboBox->currentItem() == 1)
683 folder->setUserWhoField(
"From");
684 else if (mShowSenderReceiverComboBox->currentItem() == 2)
685 folder->setUserWhoField(
"To");
687 folder->setUserWhoField(
"");
689 folder->setIgnoreNewMail( !mNotifyOnNewMailCheckBox->isChecked() );
690 folder->setPutRepliesInSameFolder( mKeepRepliesInSameFolderCheckBox->isChecked() );
692 TQString fldName, oldFldName;
693 KMFolderCachedImap* dimap = 0;
694 if ( folder->
folderType() == KMFolderTypeCachedImap )
695 dimap = static_cast<KMFolderCachedImap *>( mDlg->folder()->storage() );
697 if ( !mIsLocalSystemFolder || mIsResourceFolder )
699 oldFldName = mDlg->folder()->name();
700 if (!mNameEdit->text().isEmpty())
701 fldName = mNameEdit->text();
703 fldName = oldFldName;
705 if ( mDlg->parentFolder() &&
706 mDlg->parentFolder()->folderType() != KMFolderTypeImap &&
707 mDlg->parentFolder()->folderType() != KMFolderTypeCachedImap )
709 fldName.remove(TQRegExp(
"^\\.*"));
710 if (fldName.isEmpty()) fldName = i18n(
"unnamed");
716 folder->setUseCustomIcons( mIconsCheckBox->isChecked() );
719 folder->setIconPaths(
"",
"" );
723 (( mNormalIconButton->icon() != folder->normalIconPath() ) &&
724 ( !mNormalIconButton->icon().isEmpty())) ||
725 (( mUnreadIconButton->icon() != folder->unreadIconPath() ) &&
726 ( !mUnreadIconButton->icon().isEmpty())) ) ) {
727 folder->setIconPaths( mNormalIconButton->icon(), mUnreadIconButton->icon() );
731 if ( mContentsComboBox ) {
732 KMail::FolderContentsType type =
733 static_cast<KMail::FolderContentsType
>( mContentsComboBox->currentItem() );
738 if ( mIncidencesForComboBox ) {
739 KMFolderCachedImap::IncidencesFor incfor = KMFolderCachedImap::IncForAdmins;
740 incfor =
static_cast<KMFolderCachedImap::IncidencesFor
>( mIncidencesForComboBox->currentItem() );
741 if ( dimap->incidencesFor() != incfor ) {
742 dimap->setIncidencesFor( incfor );
743 dimap->writeConfig();
746 if ( mAlarmsBlockedCheckBox && mAlarmsBlockedCheckBox->isChecked() != dimap->alarmsBlocked() ) {
747 dimap->setAlarmsBlocked( mAlarmsBlockedCheckBox->isChecked() );
748 dimap->writeConfig();
752 if( folder->
folderType() == KMFolderTypeImap )
754 KMFolderImap* imapFolder =
static_cast<KMFolderImap*
>( folder->storage() );
755 imapFolder->setIncludeInMailCheck(
756 mNewMailCheckBox->isChecked() );
760 if ( dimap && mSharedSeenFlagsCheckBox &&
761 mSharedSeenFlagsCheckBox->isChecked() != dimap->sharedSeenFlags() ) {
762 dimap->setSharedSeenFlags( mSharedSeenFlagsCheckBox->isChecked() );
763 dimap->writeConfig();
772 KMessageBox::sorry(
this, msg );
781 if ( !oldFldName.isEmpty() )
783 kmkernel->folderMgr()->renameFolder( folder, fldName );
785 kmkernel->folderMgr()->contentsChanged();
792 void FolderDiaGeneralTab::slotChangeIcon( TQString icon )
794 mUnreadIconButton->setIcon( icon );
798 KMail::FolderDiaTemplatesTab::FolderDiaTemplatesTab(
KMFolderDialog* dlg,
803 mIsLocalSystemFolder = mDlg->folder()->isSystemFolder();
806 TQVBoxLayout *topLayout =
new TQVBoxLayout(
this, 0, KDialog::spacingHint() );
808 mCustom =
new TQCheckBox( i18n(
"&Use custom message templates"),
this );
809 topLayout->addWidget( mCustom );
811 mWidget =
new TemplatesConfiguration(
this ,
"folder-templates" );
812 mWidget->setEnabled(
false );
813 topLayout->addWidget( mWidget );
815 TQHBoxLayout *btns =
new TQHBoxLayout( topLayout, KDialog::spacingHint() );
816 mCopyGlobal =
new KPushButton( i18n(
"&Copy global templates"),
this );
817 mCopyGlobal->setEnabled(
false );
818 btns->addWidget( mCopyGlobal );
820 connect( mCustom, TQT_SIGNAL(toggled(
bool)),
821 mWidget, TQT_SLOT(setEnabled(
bool)) );
822 connect( mCustom, TQT_SIGNAL(toggled(
bool)),
823 mCopyGlobal, TQT_SLOT(setEnabled(
bool)) );
825 connect( mCopyGlobal, TQT_SIGNAL(clicked()),
826 this, TQT_SLOT(slotCopyGlobal()) );
828 initializeWithValuesFromFolder( mDlg->folder() );
830 connect( mWidget, TQT_SIGNAL( changed() ),
831 this, TQT_SLOT( slotEmitChanged(
void ) ) );
834 void FolderDiaTemplatesTab::load()
839 void FolderDiaTemplatesTab::initializeWithValuesFromFolder(
KMFolder* folder ) {
849 mCustom->setChecked(t.useCustomTemplates());
851 mIdentity = folder->identity();
853 mWidget->loadFromFolder( fid, mIdentity );
857 bool FolderDiaTemplatesTab::save()
864 kdDebug() <<
"use custom templates for folder " << fid <<
": " << mCustom->isChecked() << endl;
865 t.setUseCustomTemplates(mCustom->isChecked());
868 mWidget->saveToFolder(fid);
874 void FolderDiaTemplatesTab::slotEmitChanged() {}
876 void FolderDiaTemplatesTab::slotCopyGlobal() {
878 mWidget->loadFromIdentity( mIdentity );
881 mWidget->loadFromGlobal();
bool putRepliesInSameFolder() const
Returns true if the replies to mails from this folder should be put in the same folder.
"Quota" tab in the folder dialog Internal class, only used by KMFolderDialog
virtual bool noContent() const
Returns, if the folder can't contain mails, but only subfolder.
virtual void setContentsType(KMail::FolderContentsType type, bool quiet=false)
Set the type of contents held in this folder (mail, calendar, etc.)
KMFolderType folderType() const
Returns the type of this folder.
bool isReadOnly() const
Is the folder read-only?
TQString idString() const
Returns a string that can be used to identify this folder.
This is the base class for tabs in the folder dialog.
KMail list that manages the contents of one directory that may contain folders and/or other directori...
virtual void writeConfig()
Write the config file.
bool ignoreNewMail() const
Returns true if the user doesn't want to get notified about new mail in this folder.
"Templates" tab in the folder dialog Internal class, only used by KMFolderDialog
bool useCustomIcons() const
Icon related methods.
"Access Control" tab in the folder dialog Internal class, only used by KMFolderDialog ...
The user rights/ACL have been fetched from the server sucessfully.
"General" tab in the folder dialog Internal class, only used by KMFolderDialog
Dialog for handling the properties of a mail folder.
bool isValidName(const TQString &folderName, TQString &message)
Returns true if the name is valid for a child of this folder.