22 #include "accountdialog.h"
24 #include <tqbuttongroup.h>
25 #include <tqcheckbox.h>
27 #include <tqtabwidget.h>
28 #include <tqradiobutton.h>
29 #include <tqvalidator.h>
31 #include <tqpushbutton.h>
32 #include <tqwhatsthis.h>
34 #include <tqcombobox.h>
36 #include <tqtoolbutton.h>
39 #include <tdefiledialog.h>
40 #include <tdelocale.h>
42 #include <tdemessagebox.h>
43 #include <knuminput.h>
44 #include <kseparator.h>
45 #include <tdeapplication.h>
46 #include <tdemessagebox.h>
47 #include <kprotocolinfo.h>
48 #include <kiconloader.h>
49 #include <tdepopupmenu.h>
52 #include <netinet/in.h>
54 #include "sieveconfig.h"
55 #include "kmacctmaildir.h"
56 #include "kmacctlocal.h"
57 #include "accountmanager.h"
58 #include "popaccount.h"
59 #include "kmacctimap.h"
60 #include "kmacctcachedimap.h"
61 #include "kmfoldermgr.h"
62 #include "kmservertest.h"
63 #include "protocols.h"
64 #include "folderrequester.h"
65 #include "kmmainwidget.h"
67 #include <libkpimidentities/identitymanager.h>
68 #include <libkpimidentities/identitycombo.h>
69 #include <libkpimidentities/identity.h>
70 #include "globalsettings.h"
80 #define _PATH_MAILDIR "/var/spool/mail"
85 class ProcmailRCParser
88 ProcmailRCParser(TQString fileName = TQString());
91 TQStringList getLockFilesList()
const {
return mLockFiles; }
92 TQStringList getSpoolFilesList()
const {
return mSpoolFiles; }
95 void processGlobalLock(
const TQString&);
96 void processLocalLock(
const TQString&);
97 void processVariableSetting(
const TQString&,
int);
98 TQString expandVars(
const TQString&);
101 TQTextStream *mStream;
102 TQStringList mLockFiles;
103 TQStringList mSpoolFiles;
104 TQAsciiDict<TQString> mVars;
107 ProcmailRCParser::ProcmailRCParser(TQString fname)
108 : mProcmailrc(fname),
109 mStream(new TQTextStream(&mProcmailrc))
111 mVars.setAutoDelete(
true);
114 mVars.insert(
"HOME",
new TQString( TQDir::homeDirPath() ) );
116 if( !fname || fname.isEmpty() ) {
117 fname = TQDir::homeDirPath() +
"/.procmailrc";
118 mProcmailrc.setName(fname);
121 TQRegExp lockFileGlobal(
"^LOCKFILE=",
true);
122 TQRegExp lockFileLocal(
"^:0",
true);
124 if( mProcmailrc.open(IO_ReadOnly) ) {
128 while( !mStream->eof() ) {
130 s = mStream->readLine().stripWhiteSpace();
132 if( s[0] ==
'#' )
continue;
136 if( (commentPos = s.find(
'#')) > -1 ) {
138 s.truncate(commentPos);
139 s = s.stripWhiteSpace();
142 if( lockFileGlobal.search(s) != -1 ) {
143 processGlobalLock(s);
144 }
else if( lockFileLocal.search(s) != -1 ) {
146 }
else if(
int i = s.find(
'=') ) {
147 processVariableSetting(s,i);
152 TQString default_Location = getenv(
"MAIL");
154 if (default_Location.isNull()) {
155 default_Location = _PATH_MAILDIR;
156 default_Location +=
'/';
157 default_Location += getenv(
"USER");
159 if ( !mSpoolFiles.contains(default_Location) )
160 mSpoolFiles << default_Location;
162 default_Location = default_Location +
".lock";
163 if ( !mLockFiles.contains(default_Location) )
164 mLockFiles << default_Location;
167 ProcmailRCParser::~ProcmailRCParser()
173 ProcmailRCParser::processGlobalLock(
const TQString &s)
175 TQString val = expandVars(s.mid(s.find(
'=') + 1).stripWhiteSpace());
176 if ( !mLockFiles.contains(val) )
181 ProcmailRCParser::processLocalLock(
const TQString &s)
184 int colonPos = s.findRev(
':');
187 val = s.mid(colonPos + 1).stripWhiteSpace();
189 if ( val.length() ) {
192 val = expandVars(val);
193 if( val[0] !=
'/' && mVars.find(
"MAILDIR") )
194 val.insert(0, *(mVars[
"MAILDIR"]) +
'/');
200 TQString line, prevLine;
203 line = mStream->readLine().stripWhiteSpace();
204 }
while ( !mStream->eof() && (line[0] ==
'*' ||
205 prevLine[prevLine.length() - 1] ==
'\\' ));
207 if( line[0] !=
'!' && line[0] !=
'|' && line[0] !=
'{' ) {
210 line = line.stripWhiteSpace();
211 line = expandVars(line);
214 if( line[0] !=
'/' && mVars.find(
"MAILDIR") )
215 line.insert(0, *(mVars[
"MAILDIR"]) +
'/');
218 if ( !mSpoolFiles.contains(line) )
221 if( colonPos > 0 && (!val || val.isEmpty()) ) {
227 if( mVars.find(
"LOCKEXT") )
228 val += *(mVars[
"LOCKEXT"]);
233 if ( !val.isNull() && !mLockFiles.contains(val) ) {
241 ProcmailRCParser::processVariableSetting(
const TQString &s,
int eqPos)
243 if( eqPos == -1)
return;
245 TQString varName = s.left(eqPos),
246 varValue = expandVars(s.mid(eqPos + 1).stripWhiteSpace());
248 mVars.insert(varName.latin1(),
new TQString(varValue));
252 ProcmailRCParser::expandVars(
const TQString &s)
254 if( s.isEmpty())
return s;
258 TQAsciiDictIterator<TQString> it( mVars );
260 while ( it.current() ) {
261 expS.replace(TQString::fromLatin1(
"$") + it.currentKey(), *it.current());
270 AccountDialog::AccountDialog(
const TQString & caption, KMAccount *account,
271 TQWidget *parent,
const char *name,
bool modal )
272 : KDialogBase( parent, name, modal, caption,
Ok|Cancel|Help,
Ok, true ),
276 mCapaNormal( AllCapa ),
279 mSieveConfigEditor( 0 )
281 mValidator =
new TQRegExpValidator( TQRegExp(
"[A-Za-z0-9-_:.]*" ), 0 );
282 setHelp(
"receiving-mail");
284 TQString accountType = mAccount->type();
286 if( accountType ==
"local" )
288 makeLocalAccountPage();
290 else if( accountType ==
"maildir" )
292 makeMaildirAccountPage();
294 else if( accountType ==
"pop" )
296 makePopAccountPage();
298 else if( accountType ==
"imap" )
300 makeImapAccountPage();
302 else if( accountType ==
"cachedimap" )
304 makeImapAccountPage(
true);
308 TQString msg = i18n(
"Account type is not supported." );
309 KMessageBox::information( topLevelWidget(),msg,i18n(
"Configure Account") );
316 AccountDialog::~AccountDialog()
324 void AccountDialog::makeLocalAccountPage()
326 ProcmailRCParser procmailrcParser;
327 TQFrame *page = makeMainWidget();
328 TQGridLayout *topLayout =
new TQGridLayout( page, 12, 3, 0, spacingHint() );
329 topLayout->addColSpacing( 1, fontMetrics().maxWidth()*15 );
330 topLayout->setRowStretch( 11, 10 );
331 topLayout->setColStretch( 1, 10 );
333 mLocal.titleLabel =
new TQLabel( i18n(
"Account Type: Local Account"), page );
334 topLayout->addMultiCellWidget( mLocal.titleLabel, 0, 0, 0, 2 );
335 TQFont titleFont( mLocal.titleLabel->font() );
336 titleFont.setBold(
true );
337 mLocal.titleLabel->setFont( titleFont );
338 KSeparator *hline =
new KSeparator( KSeparator::HLine, page);
339 topLayout->addMultiCellWidget( hline, 1, 1, 0, 2 );
341 TQLabel *label =
new TQLabel( i18n(
"Account &name:"), page );
342 topLayout->addWidget( label, 2, 0 );
343 mLocal.nameEdit =
new KLineEdit( page );
344 label->setBuddy( mLocal.nameEdit );
345 topLayout->addWidget( mLocal.nameEdit, 2, 1 );
347 label =
new TQLabel( i18n(
"File &location:"), page );
348 topLayout->addWidget( label, 3, 0 );
349 mLocal.locationEdit =
new TQComboBox(
true, page );
350 label->setBuddy( mLocal.locationEdit );
351 topLayout->addWidget( mLocal.locationEdit, 3, 1 );
352 mLocal.locationEdit->insertStringList(procmailrcParser.getSpoolFilesList());
354 TQPushButton *choose =
new TQPushButton( i18n(
"Choo&se..."), page );
355 choose->setAutoDefault(
false );
356 connect( choose, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotLocationChooser()) );
357 topLayout->addWidget( choose, 3, 2 );
359 TQButtonGroup *group =
new TQButtonGroup(i18n(
"Locking Method"), page );
360 group->setColumnLayout(0, TQt::Horizontal);
361 group->layout()->setSpacing( 0 );
362 group->layout()->setMargin( 0 );
363 TQGridLayout *groupLayout =
new TQGridLayout( group->layout() );
364 groupLayout->setAlignment( TQt::AlignTop );
365 groupLayout->setSpacing( 6 );
366 groupLayout->setMargin( 11 );
368 mLocal.lockProcmail =
new TQRadioButton( i18n(
"Procmail loc&kfile:"), group);
369 groupLayout->addWidget(mLocal.lockProcmail, 0, 0);
371 mLocal.procmailLockFileName =
new TQComboBox(
true, group );
372 groupLayout->addWidget(mLocal.procmailLockFileName, 0, 1);
373 mLocal.procmailLockFileName->insertStringList(procmailrcParser.getLockFilesList());
374 mLocal.procmailLockFileName->setEnabled(
false);
376 TQObject::connect(mLocal.lockProcmail, TQ_SIGNAL(toggled(
bool)),
377 mLocal.procmailLockFileName, TQ_SLOT(setEnabled(
bool)));
379 mLocal.lockMutt =
new TQRadioButton(
380 i18n(
"&Mutt dotlock"), group);
381 groupLayout->addWidget(mLocal.lockMutt, 1, 0);
383 mLocal.lockMuttPriv =
new TQRadioButton(
384 i18n(
"M&utt dotlock privileged"), group);
385 groupLayout->addWidget(mLocal.lockMuttPriv, 2, 0);
387 mLocal.lockFcntl =
new TQRadioButton(
388 i18n(
"&FCNTL"), group);
389 groupLayout->addWidget(mLocal.lockFcntl, 3, 0);
391 mLocal.lockNone =
new TQRadioButton(
392 i18n(
"Non&e (use with care)"), group);
393 groupLayout->addWidget(mLocal.lockNone, 4, 0);
395 topLayout->addMultiCellWidget( group, 4, 4, 0, 2 );
398 TQHBox* resourceHB =
new TQHBox( page );
399 resourceHB->setSpacing( 11 );
400 mLocal.resourceCheck =
401 new TQCheckBox( i18n(
"Account for semiautomatic resource handling" ), resourceHB );
402 mLocal.resourceClearButton =
403 new TQPushButton( i18n(
"Clear" ), resourceHB );
404 TQWhatsThis::add( mLocal.resourceClearButton,
405 i18n(
"Delete all allocations for the resource represented by this account." ) );
406 mLocal.resourceClearButton->setEnabled(
false );
407 connect( mLocal.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
408 mLocal.resourceClearButton, TQ_SLOT( setEnabled(
bool) ) );
409 connect( mLocal.resourceClearButton, TQ_SIGNAL( clicked() ),
410 this, TQ_SLOT( slotClearResourceAllocations() ) );
411 mLocal.resourceClearPastButton =
412 new TQPushButton( i18n(
"Clear Past" ), resourceHB );
413 mLocal.resourceClearPastButton->setEnabled(
false );
414 connect( mLocal.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
415 mLocal.resourceClearPastButton, TQ_SLOT( setEnabled(
bool) ) );
416 TQWhatsThis::add( mLocal.resourceClearPastButton,
417 i18n(
"Delete all outdated allocations for the resource represented by this account." ) );
418 connect( mLocal.resourceClearPastButton, TQ_SIGNAL( clicked() ),
419 this, TQ_SLOT( slotClearPastResourceAllocations() ) );
420 topLayout->addMultiCellWidget( resourceHB, 5, 5, 0, 2 );
423 mLocal.includeInCheck =
424 new TQCheckBox( i18n(
"Include in m&anual mail check"),
426 topLayout->addMultiCellWidget( mLocal.includeInCheck, 5, 5, 0, 2 );
428 mLocal.intervalCheck =
429 new TQCheckBox( i18n(
"Enable &interval mail checking"), page );
430 topLayout->addMultiCellWidget( mLocal.intervalCheck, 6, 6, 0, 2 );
431 connect( mLocal.intervalCheck, TQ_SIGNAL(toggled(
bool)),
432 this, TQ_SLOT(slotEnableLocalInterval(
bool)) );
433 mLocal.intervalLabel =
new TQLabel( i18n(
"Check inter&val:"), page );
434 topLayout->addWidget( mLocal.intervalLabel, 7, 0 );
435 mLocal.intervalSpin =
new KIntNumInput( page );
436 mLocal.intervalLabel->setBuddy( mLocal.intervalSpin );
437 mLocal.intervalSpin->setRange( GlobalSettings::self()->minimumCheckInterval(), 10000, 1,
false );
438 mLocal.intervalSpin->setSuffix( i18n(
" min") );
439 mLocal.intervalSpin->setValue( defaultmailcheckintervalmin );
440 topLayout->addWidget( mLocal.intervalSpin, 7, 1 );
442 label =
new TQLabel( i18n(
"&Destination folder:"), page );
443 topLayout->addWidget( label, 8, 0 );
444 mLocal.folderCombo =
new TQComboBox(
false, page );
445 label->setBuddy( mLocal.folderCombo );
446 topLayout->addWidget( mLocal.folderCombo, 8, 1 );
448 label =
new TQLabel( i18n(
"&Pre-command:"), page );
449 topLayout->addWidget( label, 9, 0 );
450 mLocal.precommand =
new KLineEdit( page );
451 label->setBuddy( mLocal.precommand );
452 topLayout->addWidget( mLocal.precommand, 9, 1 );
454 mLocal.identityLabel =
new TQLabel( i18n(
"Identity:"), page );
455 topLayout->addWidget( mLocal.identityLabel, 10, 0 );
456 mLocal.identityCombo =
new KPIM::IdentityCombo(kmkernel->identityManager(), page );
457 mLocal.identityLabel->setBuddy( mLocal.identityCombo );
458 topLayout->addWidget( mLocal.identityCombo, 10, 1 );
460 connect(kapp,TQ_SIGNAL(tdedisplayFontChanged()),TQ_SLOT(slotFontChanged()));
463 void AccountDialog::makeMaildirAccountPage()
465 ProcmailRCParser procmailrcParser;
467 TQFrame *page = makeMainWidget();
468 TQGridLayout *topLayout =
new TQGridLayout( page, 11, 3, 0, spacingHint() );
469 topLayout->addColSpacing( 1, fontMetrics().maxWidth()*15 );
470 topLayout->setRowStretch( 11, 10 );
471 topLayout->setColStretch( 1, 10 );
473 mMaildir.titleLabel =
new TQLabel( i18n(
"Account Type: Maildir Account"), page );
474 topLayout->addMultiCellWidget( mMaildir.titleLabel, 0, 0, 0, 2 );
475 TQFont titleFont( mMaildir.titleLabel->font() );
476 titleFont.setBold(
true );
477 mMaildir.titleLabel->setFont( titleFont );
478 TQFrame *hline =
new TQFrame( page );
479 hline->setFrameStyle( TQFrame::Sunken | TQFrame::HLine );
480 topLayout->addMultiCellWidget( hline, 1, 1, 0, 2 );
482 mMaildir.nameEdit =
new KLineEdit( page );
483 topLayout->addWidget( mMaildir.nameEdit, 2, 1 );
484 TQLabel *label =
new TQLabel( mMaildir.nameEdit, i18n(
"Account &name:"), page );
485 topLayout->addWidget( label, 2, 0 );
487 mMaildir.locationEdit =
new TQComboBox(
true, page );
488 topLayout->addWidget( mMaildir.locationEdit, 3, 1 );
489 mMaildir.locationEdit->insertStringList(procmailrcParser.getSpoolFilesList());
490 label =
new TQLabel( mMaildir.locationEdit, i18n(
"Folder &location:"), page );
491 topLayout->addWidget( label, 3, 0 );
493 TQPushButton *choose =
new TQPushButton( i18n(
"Choo&se..."), page );
494 choose->setAutoDefault(
false );
495 connect( choose, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotMaildirChooser()) );
496 topLayout->addWidget( choose, 3, 2 );
499 TQHBox* resourceHB =
new TQHBox( page );
500 resourceHB->setSpacing( 11 );
501 mMaildir.resourceCheck =
502 new TQCheckBox( i18n(
"Account for semiautomatic resource handling" ), resourceHB );
503 mMaildir.resourceClearButton =
504 new TQPushButton( i18n(
"Clear" ), resourceHB );
505 mMaildir.resourceClearButton->setEnabled(
false );
506 connect( mMaildir.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
507 mMaildir.resourceClearButton, TQ_SLOT( setEnabled(
bool) ) );
508 TQWhatsThis::add( mMaildir.resourceClearButton,
509 i18n(
"Delete all allocations for the resource represented by this account." ) );
510 connect( mMaildir.resourceClearButton, TQ_SIGNAL( clicked() ),
511 this, TQ_SLOT( slotClearResourceAllocations() ) );
512 mMaildir.resourceClearPastButton =
513 new TQPushButton( i18n(
"Clear Past" ), resourceHB );
514 mMaildir.resourceClearPastButton->setEnabled(
false );
515 connect( mMaildir.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
516 mMaildir.resourceClearPastButton, TQ_SLOT( setEnabled(
bool) ) );
517 TQWhatsThis::add( mMaildir.resourceClearPastButton,
518 i18n(
"Delete all outdated allocations for the resource represented by this account." ) );
519 connect( mMaildir.resourceClearPastButton, TQ_SIGNAL( clicked() ),
520 this, TQ_SLOT( slotClearPastResourceAllocations() ) );
521 topLayout->addMultiCellWidget( resourceHB, 4, 4, 0, 2 );
524 mMaildir.includeInCheck =
525 new TQCheckBox( i18n(
"Include in &manual mail check"), page );
526 topLayout->addMultiCellWidget( mMaildir.includeInCheck, 4, 4, 0, 2 );
528 mMaildir.intervalCheck =
529 new TQCheckBox( i18n(
"Enable &interval mail checking"), page );
530 topLayout->addMultiCellWidget( mMaildir.intervalCheck, 5, 5, 0, 2 );
531 connect( mMaildir.intervalCheck, TQ_SIGNAL(toggled(
bool)),
532 this, TQ_SLOT(slotEnableMaildirInterval(
bool)) );
533 mMaildir.intervalLabel =
new TQLabel( i18n(
"Check inter&val:"), page );
534 topLayout->addWidget( mMaildir.intervalLabel, 6, 0 );
535 mMaildir.intervalSpin =
new KIntNumInput( page );
536 mMaildir.intervalSpin->setRange( GlobalSettings::self()->minimumCheckInterval(), 10000, 1,
false );
537 mMaildir.intervalSpin->setSuffix( i18n(
" min") );
538 mMaildir.intervalSpin->setValue( defaultmailcheckintervalmin );
539 mMaildir.intervalLabel->setBuddy( mMaildir.intervalSpin );
540 topLayout->addWidget( mMaildir.intervalSpin, 6, 1 );
542 mMaildir.folderCombo =
new TQComboBox(
false, page );
543 topLayout->addWidget( mMaildir.folderCombo, 7, 1 );
544 label =
new TQLabel( mMaildir.folderCombo,
545 i18n(
"&Destination folder:"), page );
546 topLayout->addWidget( label, 7, 0 );
548 mMaildir.precommand =
new KLineEdit( page );
549 topLayout->addWidget( mMaildir.precommand, 8, 1 );
550 label =
new TQLabel( mMaildir.precommand, i18n(
"&Pre-command:"), page );
551 topLayout->addWidget( label, 8, 0 );
554 mMaildir.identityLabel =
new TQLabel( i18n(
"Identity:"), page );
555 topLayout->addWidget( mMaildir.identityLabel, 9, 0 );
556 mMaildir.identityCombo =
new KPIM::IdentityCombo(kmkernel->identityManager(), page );
557 mMaildir.identityLabel->setBuddy( mMaildir.identityCombo );
558 topLayout->addWidget( mMaildir.identityCombo, 9, 1 );
560 connect(kapp,TQ_SIGNAL(tdedisplayFontChanged()),TQ_SLOT(slotFontChanged()));
564 void AccountDialog::makePopAccountPage()
566 TQFrame *page = makeMainWidget();
567 TQVBoxLayout *topLayout =
new TQVBoxLayout( page, 0, spacingHint() );
569 mPop.titleLabel =
new TQLabel( page );
570 mPop.titleLabel->setText( i18n(
"Account Type: POP Account") );
571 TQFont titleFont( mPop.titleLabel->font() );
572 titleFont.setBold(
true );
573 mPop.titleLabel->setFont( titleFont );
574 topLayout->addWidget( mPop.titleLabel );
575 KSeparator *hline =
new KSeparator( KSeparator::HLine, page);
576 topLayout->addWidget( hline );
578 TQTabWidget *tabWidget =
new TQTabWidget(page);
579 topLayout->addWidget( tabWidget );
581 TQWidget *page1 =
new TQWidget( tabWidget );
582 tabWidget->addTab( page1, i18n(
"&General") );
584 TQGridLayout *grid =
new TQGridLayout( page1, 16, 2, marginHint(), spacingHint() );
585 grid->addColSpacing( 1, fontMetrics().maxWidth()*15 );
586 grid->setRowStretch( 15, 10 );
587 grid->setColStretch( 1, 10 );
589 TQLabel *label =
new TQLabel( i18n(
"Account &name:"), page1 );
590 grid->addWidget( label, 0, 0 );
591 mPop.nameEdit =
new KLineEdit( page1 );
592 label->setBuddy( mPop.nameEdit );
593 grid->addWidget( mPop.nameEdit, 0, 1 );
595 label =
new TQLabel( i18n(
"&Login:"), page1 );
596 TQWhatsThis::add( label, i18n(
"Your Internet Service Provider gave you a <em>user name</em> which is used to authenticate you with their servers. It usually is the first part of your email address (the part before <em>@</em>).") );
597 grid->addWidget( label, 1, 0 );
598 mPop.loginEdit =
new KLineEdit( page1 );
599 label->setBuddy( mPop.loginEdit );
600 grid->addWidget( mPop.loginEdit, 1, 1 );
602 label =
new TQLabel( i18n(
"P&assword:"), page1 );
603 grid->addWidget( label, 2, 0 );
604 mPop.passwordEdit =
new KLineEdit( page1 );
605 mPop.passwordEdit->setEchoMode( TQLineEdit::Password );
606 label->setBuddy( mPop.passwordEdit );
607 grid->addWidget( mPop.passwordEdit, 2, 1 );
609 label =
new TQLabel( i18n(
"Ho&st:"), page1 );
610 grid->addWidget( label, 3, 0 );
611 mPop.hostEdit =
new KLineEdit( page1 );
614 mPop.hostEdit->setValidator(mValidator);
615 label->setBuddy( mPop.hostEdit );
616 grid->addWidget( mPop.hostEdit, 3, 1 );
618 label =
new TQLabel( i18n(
"&Port:"), page1 );
619 grid->addWidget( label, 4, 0 );
620 mPop.portEdit =
new KLineEdit( page1 );
621 mPop.portEdit->setValidator(
new TQIntValidator(
this) );
622 label->setBuddy( mPop.portEdit );
623 grid->addWidget( mPop.portEdit, 4, 1 );
625 mPop.storePasswordCheck =
626 new TQCheckBox( i18n(
"Sto&re POP password"), page1 );
627 TQWhatsThis::add( mPop.storePasswordCheck,
628 i18n(
"Check this option to have KMail store "
629 "the password.\nIf TDEWallet is available "
630 "the password will be stored there which is considered "
631 "safe.\nHowever, if TDEWallet is not available, "
632 "the password will be stored in KMail's configuration "
633 "file. The password is stored in an "
634 "obfuscated format, but should not be "
635 "considered secure from decryption efforts "
636 "if access to the configuration file is obtained.") );
637 grid->addMultiCellWidget( mPop.storePasswordCheck, 5, 5, 0, 1 );
639 mPop.leaveOnServerCheck =
640 new TQCheckBox( i18n(
"Lea&ve fetched messages on the server"), page1 );
641 connect( mPop.leaveOnServerCheck, TQ_SIGNAL( clicked() ),
642 this, TQ_SLOT( slotLeaveOnServerClicked() ) );
643 grid->addMultiCellWidget( mPop.leaveOnServerCheck, 6, 6, 0, 1 );
644 TQHBox *afterDaysBox =
new TQHBox( page1 );
645 afterDaysBox->setSpacing( KDialog::spacingHint() );
646 mPop.leaveOnServerDaysCheck =
647 new TQCheckBox( i18n(
"Leave messages on the server for"), afterDaysBox );
648 connect( mPop.leaveOnServerDaysCheck, TQ_SIGNAL( toggled(
bool) ),
649 this, TQ_SLOT( slotEnableLeaveOnServerDays(
bool)) );
650 mPop.leaveOnServerDaysSpin =
new KIntNumInput( afterDaysBox );
651 mPop.leaveOnServerDaysSpin->setRange( 1, 365, 1,
false );
652 connect( mPop.leaveOnServerDaysSpin, TQ_SIGNAL(valueChanged(
int)),
653 TQ_SLOT(slotLeaveOnServerDaysChanged(
int)));
654 mPop.leaveOnServerDaysSpin->setValue( 1 );
655 afterDaysBox->setStretchFactor( mPop.leaveOnServerDaysSpin, 1 );
656 grid->addMultiCellWidget( afterDaysBox, 7, 7, 0, 1 );
657 TQHBox *leaveOnServerCountBox =
new TQHBox( page1 );
658 leaveOnServerCountBox->setSpacing( KDialog::spacingHint() );
659 mPop.leaveOnServerCountCheck =
660 new TQCheckBox( i18n(
"Keep only the last"), leaveOnServerCountBox );
661 connect( mPop.leaveOnServerCountCheck, TQ_SIGNAL( toggled(
bool) ),
662 this, TQ_SLOT( slotEnableLeaveOnServerCount(
bool)) );
663 mPop.leaveOnServerCountSpin =
new KIntNumInput( leaveOnServerCountBox );
664 mPop.leaveOnServerCountSpin->setRange( 1, 999999, 1,
false );
665 connect( mPop.leaveOnServerCountSpin, TQ_SIGNAL(valueChanged(
int)),
666 TQ_SLOT(slotLeaveOnServerCountChanged(
int)));
667 mPop.leaveOnServerCountSpin->setValue( 100 );
668 grid->addMultiCellWidget( leaveOnServerCountBox, 8, 8, 0, 1 );
669 TQHBox *leaveOnServerSizeBox =
new TQHBox( page1 );
670 leaveOnServerSizeBox->setSpacing( KDialog::spacingHint() );
671 mPop.leaveOnServerSizeCheck =
672 new TQCheckBox( i18n(
"Keep only the last"), leaveOnServerSizeBox );
673 connect( mPop.leaveOnServerSizeCheck, TQ_SIGNAL( toggled(
bool) ),
674 this, TQ_SLOT( slotEnableLeaveOnServerSize(
bool)) );
675 mPop.leaveOnServerSizeSpin =
new KIntNumInput( leaveOnServerSizeBox );
676 mPop.leaveOnServerSizeSpin->setRange( 1, 999999, 1,
false );
677 mPop.leaveOnServerSizeSpin->setSuffix( i18n(
" MB") );
678 mPop.leaveOnServerSizeSpin->setValue( 10 );
679 grid->addMultiCellWidget( leaveOnServerSizeBox, 9, 9, 0, 1 );
681 TQHBox *resourceHB =
new TQHBox( page1 );
682 resourceHB->setSpacing( 11 );
684 new TQCheckBox( i18n(
"Account for semiautomatic resource handling" ), resourceHB );
685 mPop.resourceClearButton =
686 new TQPushButton( i18n(
"Clear" ), resourceHB );
687 mPop.resourceClearButton->setEnabled(
false );
688 connect( mPop.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
689 mPop.resourceClearButton, TQ_SLOT( setEnabled(
bool) ) );
690 TQWhatsThis::add( mPop.resourceClearButton,
691 i18n(
"Delete all allocations for the resource represented by this account." ) );
692 connect( mPop.resourceClearButton, TQ_SIGNAL( clicked() ),
693 this, TQ_SLOT( slotClearResourceAllocations() ) );
694 mPop.resourceClearPastButton =
695 new TQPushButton( i18n(
"Clear Past" ), resourceHB );
696 mPop.resourceClearPastButton->setEnabled(
false );
697 connect( mPop.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
698 mPop.resourceClearPastButton, TQ_SLOT( setEnabled(
bool) ) );
699 TQWhatsThis::add( mPop.resourceClearPastButton,
700 i18n(
"Delete all outdated allocations for the resource represented by this account." ) );
701 connect( mPop.resourceClearPastButton, TQ_SIGNAL( clicked() ),
702 this, TQ_SLOT( slotClearPastResourceAllocations() ) );
703 grid->addMultiCellWidget( resourceHB, 10, 10, 0, 2 );
706 mPop.includeInCheck =
707 new TQCheckBox( i18n(
"Include in man&ual mail check"), page1 );
708 grid->addMultiCellWidget( mPop.includeInCheck, 10, 10, 0, 1 );
710 TQHBox * hbox =
new TQHBox( page1 );
711 hbox->setSpacing( KDialog::spacingHint() );
712 mPop.filterOnServerCheck =
713 new TQCheckBox( i18n(
"&Filter messages if they are greater than"), hbox );
714 mPop.filterOnServerSizeSpin =
new KIntNumInput ( hbox );
715 mPop.filterOnServerSizeSpin->setEnabled(
false );
716 hbox->setStretchFactor( mPop.filterOnServerSizeSpin, 1 );
717 mPop.filterOnServerSizeSpin->setRange( 1, 10000000, 100,
false );
718 connect(mPop.filterOnServerSizeSpin, TQ_SIGNAL(valueChanged(
int)),
719 TQ_SLOT(slotFilterOnServerSizeChanged(
int)));
720 mPop.filterOnServerSizeSpin->setValue( 50000 );
721 grid->addMultiCellWidget( hbox, 11, 11, 0, 1 );
722 connect( mPop.filterOnServerCheck, TQ_SIGNAL(toggled(
bool)),
723 mPop.filterOnServerSizeSpin, TQ_SLOT(setEnabled(
bool)) );
724 connect( mPop.filterOnServerCheck, TQ_SIGNAL( clicked() ),
725 this, TQ_SLOT( slotFilterOnServerClicked() ) );
726 TQString msg = i18n(
"If you select this option, POP Filters will be used to "
727 "decide what to do with messages. You can then select "
728 "to download, delete or keep them on the server." );
729 TQWhatsThis::add( mPop.filterOnServerCheck, msg );
730 TQWhatsThis::add( mPop.filterOnServerSizeSpin, msg );
733 new TQCheckBox( i18n(
"Enable &interval mail checking"), page1 );
734 grid->addMultiCellWidget( mPop.intervalCheck, 12, 12, 0, 1 );
735 connect( mPop.intervalCheck, TQ_SIGNAL(toggled(
bool)),
736 this, TQ_SLOT(slotEnablePopInterval(
bool)) );
737 mPop.intervalLabel =
new TQLabel( i18n(
"Chec&k interval:"), page1 );
738 grid->addWidget( mPop.intervalLabel, 13, 0 );
739 mPop.intervalSpin =
new KIntNumInput( page1 );
740 mPop.intervalSpin->setRange( GlobalSettings::self()->minimumCheckInterval(), 10000, 1,
false );
741 mPop.intervalSpin->setSuffix( i18n(
" min") );
742 mPop.intervalSpin->setValue( defaultmailcheckintervalmin );
743 mPop.intervalLabel->setBuddy( mPop.intervalSpin );
744 grid->addWidget( mPop.intervalSpin, 13, 1 );
746 label =
new TQLabel( i18n(
"Des&tination folder:"), page1 );
747 grid->addWidget( label, 14, 0 );
748 mPop.folderCombo =
new TQComboBox(
false, page1 );
749 label->setBuddy( mPop.folderCombo );
750 grid->addWidget( mPop.folderCombo, 14, 1 );
752 label =
new TQLabel( i18n(
"Pre-com&mand:"), page1 );
753 grid->addWidget( label, 15, 0 );
754 mPop.precommand =
new KLineEdit( page1 );
755 label->setBuddy(mPop.precommand);
756 grid->addWidget( mPop.precommand, 15, 1 );
758 mPop.identityLabel =
new TQLabel( i18n(
"Identity:"), page1 );
759 grid->addWidget( mPop.identityLabel, 16, 0 );
760 mPop.identityCombo =
new KPIM::IdentityCombo(kmkernel->identityManager(), page1 );
761 mPop.identityLabel->setBuddy( mPop.identityCombo );
762 grid->addWidget( mPop.identityCombo, 16, 1 );
764 TQWidget *page2 =
new TQWidget( tabWidget );
765 tabWidget->addTab( page2, i18n(
"&Extras") );
766 TQVBoxLayout *vlay =
new TQVBoxLayout( page2, marginHint(), spacingHint() );
768 vlay->addSpacing( KDialog::spacingHint() );
770 TQHBoxLayout *buttonLay =
new TQHBoxLayout( vlay );
771 mPop.checkCapabilities =
772 new TQPushButton( i18n(
"Check &What the Server Supports"), page2 );
773 connect(mPop.checkCapabilities, TQ_SIGNAL(clicked()),
774 TQ_SLOT(slotCheckPopCapabilities()));
775 buttonLay->addStretch();
776 buttonLay->addWidget( mPop.checkCapabilities );
777 buttonLay->addStretch();
779 vlay->addSpacing( KDialog::spacingHint() );
781 mPop.encryptionGroup =
new TQButtonGroup( 1, TQt::Horizontal,
782 i18n(
"Encryption"), page2 );
783 mPop.encryptionNone =
784 new TQRadioButton( i18n(
"&None"), mPop.encryptionGroup );
786 new TQRadioButton( i18n(
"Use &SSL for secure mail download"),
787 mPop.encryptionGroup );
789 new TQRadioButton( i18n(
"Use &TLS for secure mail download"),
790 mPop.encryptionGroup );
791 connect(mPop.encryptionGroup, TQ_SIGNAL(clicked(
int)),
792 TQ_SLOT(slotPopEncryptionChanged(
int)));
793 vlay->addWidget( mPop.encryptionGroup );
795 mPop.authGroup =
new TQButtonGroup( 1, TQt::Horizontal,
796 i18n(
"Authentication Method"), page2 );
797 mPop.authUser =
new TQRadioButton( i18n(
"Clear te&xt") , mPop.authGroup,
799 mPop.authLogin =
new TQRadioButton( i18n(
"Please translate this "
800 "authentication method only if you have a good reason",
"&LOGIN"),
801 mPop.authGroup,
"auth login" );
802 mPop.authPlain =
new TQRadioButton( i18n(
"Please translate this "
803 "authentication method only if you have a good reason",
"&PLAIN"),
804 mPop.authGroup,
"auth plain" );
805 mPop.authCRAM_MD5 =
new TQRadioButton( i18n(
"CRAM-MD&5"), mPop.authGroup,
"auth cram-md5" );
806 mPop.authDigestMd5 =
new TQRadioButton( i18n(
"&DIGEST-MD5"), mPop.authGroup,
"auth digest-md5" );
807 mPop.authNTLM =
new TQRadioButton( i18n(
"&NTLM"), mPop.authGroup,
"auth ntlm" );
808 mPop.authGSSAPI =
new TQRadioButton( i18n(
"&GSSAPI"), mPop.authGroup,
"auth gssapi" );
809 if ( KProtocolInfo::capabilities(
"pop3").contains(
"SASL") == 0 )
811 mPop.authNTLM->hide();
812 mPop.authGSSAPI->hide();
814 mPop.authAPOP =
new TQRadioButton( i18n(
"&APOP"), mPop.authGroup,
"auth apop" );
816 vlay->addWidget( mPop.authGroup );
818 mPop.usePipeliningCheck =
819 new TQCheckBox( i18n(
"&Use pipelining for faster mail download"), page2 );
820 connect(mPop.usePipeliningCheck, TQ_SIGNAL(clicked()),
821 TQ_SLOT(slotPipeliningClicked()));
822 vlay->addWidget( mPop.usePipeliningCheck );
826 connect(kapp,TQ_SIGNAL(tdedisplayFontChanged()),TQ_SLOT(slotFontChanged()));
830 void AccountDialog::makeImapAccountPage(
bool connected )
832 TQFrame *page = makeMainWidget();
833 TQVBoxLayout *topLayout =
new TQVBoxLayout( page, 0, spacingHint() );
835 mImap.titleLabel =
new TQLabel( page );
837 mImap.titleLabel->setText( i18n(
"Account Type: Disconnected IMAP Account") );
839 mImap.titleLabel->setText( i18n(
"Account Type: IMAP Account") );
840 TQFont titleFont( mImap.titleLabel->font() );
841 titleFont.setBold(
true );
842 mImap.titleLabel->setFont( titleFont );
843 topLayout->addWidget( mImap.titleLabel );
844 KSeparator *hline =
new KSeparator( KSeparator::HLine, page);
845 topLayout->addWidget( hline );
847 TQTabWidget *tabWidget =
new TQTabWidget(page);
848 topLayout->addWidget( tabWidget );
850 TQWidget *page1 =
new TQWidget( tabWidget );
851 tabWidget->addTab( page1, i18n(
"&General") );
854 TQGridLayout *grid =
new TQGridLayout( page1, 16, 2, marginHint(), spacingHint() );
855 grid->addColSpacing( 1, fontMetrics().maxWidth()*16 );
858 TQLabel *label =
new TQLabel( i18n(
"Account &name:"), page1 );
859 grid->addWidget( label, row, 0 );
860 mImap.nameEdit =
new KLineEdit( page1 );
861 label->setBuddy( mImap.nameEdit );
862 grid->addWidget( mImap.nameEdit, row, 1 );
865 label =
new TQLabel( i18n(
"&Login:"), page1 );
866 TQWhatsThis::add( label, i18n(
"Your Internet Service Provider gave you a <em>user name</em> which is used to authenticate you with their servers. It usually is the first part of your email address (the part before <em>@</em>).") );
867 grid->addWidget( label, row, 0 );
868 mImap.loginEdit =
new KLineEdit( page1 );
869 label->setBuddy( mImap.loginEdit );
870 grid->addWidget( mImap.loginEdit, row, 1 );
873 label =
new TQLabel( i18n(
"P&assword:"), page1 );
874 grid->addWidget( label, row, 0 );
875 mImap.passwordEdit =
new KLineEdit( page1 );
876 mImap.passwordEdit->setEchoMode( TQLineEdit::Password );
877 label->setBuddy( mImap.passwordEdit );
878 grid->addWidget( mImap.passwordEdit, row, 1 );
881 label =
new TQLabel( i18n(
"Ho&st:"), page1 );
882 grid->addWidget( label, row, 0 );
883 mImap.hostEdit =
new KLineEdit( page1 );
886 mImap.hostEdit->setValidator(mValidator);
887 label->setBuddy( mImap.hostEdit );
888 grid->addWidget( mImap.hostEdit, row, 1 );
891 label =
new TQLabel( i18n(
"&Port:"), page1 );
892 grid->addWidget( label, row, 0 );
893 mImap.portEdit =
new KLineEdit( page1 );
894 mImap.portEdit->setValidator(
new TQIntValidator(
this) );
895 label->setBuddy( mImap.portEdit );
896 grid->addWidget( mImap.portEdit, row, 1 );
900 TQHBox* box =
new TQHBox( page1 );
901 label =
new TQLabel( i18n(
"Namespaces:"), box );
902 TQWhatsThis::add( label, i18n(
"Here you see the different namespaces that your IMAP server supports."
903 "Each namespace represents a prefix that separates groups of folders."
904 "Namespaces allow KMail for example to display your personal folders and shared folders in one account." ) );
906 TQToolButton* button =
new TQToolButton( box );
907 button->setAutoRaise(
true);
908 button->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) );
909 button->setFixedSize( 22, 22 );
911 TDEGlobal::iconLoader()->loadIconSet(
"reload", TDEIcon::Small, 0 ) );
912 connect( button, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotReloadNamespaces()) );
913 TQWhatsThis::add( button,
914 i18n(
"Reload the namespaces from the server. This overwrites any changes.") );
915 grid->addWidget( box, row, 0 );
918 TQGrid* listbox =
new TQGrid( 3, page1 );
919 label =
new TQLabel( i18n(
"Personal"), listbox );
920 TQWhatsThis::add( label, i18n(
"Personal namespaces include your personal folders." ) );
921 mImap.personalNS =
new KLineEdit( listbox );
922 mImap.personalNS->setReadOnly(
true );
923 mImap.editPNS =
new TQToolButton( listbox );
924 mImap.editPNS->setIconSet(
925 TDEGlobal::iconLoader()->loadIconSet(
"edit", TDEIcon::Small, 0 ) );
926 mImap.editPNS->setAutoRaise(
true );
927 mImap.editPNS->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) );
928 mImap.editPNS->setFixedSize( 22, 22 );
929 connect( mImap.editPNS, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotEditPersonalNamespace()) );
931 label =
new TQLabel( i18n(
"Other Users"), listbox );
932 TQWhatsThis::add( label, i18n(
"These namespaces include the folders of other users." ) );
933 mImap.otherUsersNS =
new KLineEdit( listbox );
934 mImap.otherUsersNS->setReadOnly(
true );
935 mImap.editONS =
new TQToolButton( listbox );
936 mImap.editONS->setIconSet(
937 TDEGlobal::iconLoader()->loadIconSet(
"edit", TDEIcon::Small, 0 ) );
938 mImap.editONS->setAutoRaise(
true );
939 mImap.editONS->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) );
940 mImap.editONS->setFixedSize( 22, 22 );
941 connect( mImap.editONS, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotEditOtherUsersNamespace()) );
943 label =
new TQLabel( i18n(
"Shared"), listbox );
944 TQWhatsThis::add( label, i18n(
"These namespaces include the shared folders." ) );
945 mImap.sharedNS =
new KLineEdit( listbox );
946 mImap.sharedNS->setReadOnly(
true );
947 mImap.editSNS =
new TQToolButton( listbox );
948 mImap.editSNS->setIconSet(
949 TDEGlobal::iconLoader()->loadIconSet(
"edit", TDEIcon::Small, 0 ) );
950 mImap.editSNS->setAutoRaise(
true );
951 mImap.editSNS->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) );
952 mImap.editSNS->setFixedSize( 22, 22 );
953 connect( mImap.editSNS, TQ_SIGNAL(clicked()),
this, TQ_SLOT(slotEditSharedNamespace()) );
955 label->setBuddy( listbox );
956 grid->addWidget( listbox, row, 1 );
959 mImap.storePasswordCheck =
960 new TQCheckBox( i18n(
"Sto&re IMAP password"), page1 );
961 TQWhatsThis::add( mImap.storePasswordCheck,
962 i18n(
"Check this option to have KMail store "
963 "the password.\nIf TDEWallet is available "
964 "the password will be stored there which is considered "
965 "safe.\nHowever, if TDEWallet is not available, "
966 "the password will be stored in KMail's configuration "
967 "file. The password is stored in an "
968 "obfuscated format, but should not be "
969 "considered secure from decryption efforts "
970 "if access to the configuration file is obtained.") );
971 grid->addMultiCellWidget( mImap.storePasswordCheck, row, row, 0, 1 );
975 mImap.autoExpungeCheck =
976 new TQCheckBox( i18n(
"Automaticall&y compact folders (expunges deleted messages)"), page1);
977 grid->addMultiCellWidget( mImap.autoExpungeCheck, row, row, 0, 1 );
981 mImap.hiddenFoldersCheck =
new TQCheckBox( i18n(
"Sho&w hidden folders"), page1);
982 grid->addMultiCellWidget( mImap.hiddenFoldersCheck, row, row, 0, 1 );
986 mImap.subscribedFoldersCheck =
new TQCheckBox(
987 i18n(
"Show only serverside s&ubscribed folders"), page1);
988 grid->addMultiCellWidget( mImap.subscribedFoldersCheck, row, row, 0, 1 );
991 mImap.locallySubscribedFoldersCheck =
new TQCheckBox(
992 i18n(
"Show only &locally subscribed folders"), page1);
993 grid->addMultiCellWidget( mImap.locallySubscribedFoldersCheck, row, row, 0, 1 );
998 mImap.loadOnDemandCheck =
new TQCheckBox(
999 i18n(
"Load attach&ments on demand"), page1);
1000 TQWhatsThis::add( mImap.loadOnDemandCheck,
1001 i18n(
"Activate this to load attachments not automatically when you select the email but only when you click on the attachment. This way also big emails are shown instantly.") );
1002 grid->addMultiCellWidget( mImap.loadOnDemandCheck, row, row, 0, 1 );
1008 mImap.listOnlyOpenCheck =
new TQCheckBox(
1009 i18n(
"List only open folders"), page1);
1010 TQWhatsThis::add( mImap.listOnlyOpenCheck,
1011 i18n(
"Only folders that are open (expanded) in the folder tree are checked for subfolders. Use this if there are many folders on the server.") );
1012 grid->addMultiCellWidget( mImap.listOnlyOpenCheck, row, row, 0, 1 );
1017 TQHBox* resourceHB =
new TQHBox( page1 );
1018 resourceHB->setSpacing( 11 );
1019 mImap.resourceCheck =
1020 new TQCheckBox( i18n(
"Account for semiautomatic resource handling" ), resourceHB );
1021 mImap.resourceClearButton =
1022 new TQPushButton( i18n(
"Clear" ), resourceHB );
1023 mImap.resourceClearButton->setEnabled(
false );
1024 connect( mImap.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
1025 mImap.resourceClearButton, TQ_SLOT( setEnabled(
bool) ) );
1026 TQWhatsThis::add( mImap.resourceClearButton,
1027 i18n(
"Delete all allocations for the resource represented by this account." ) );
1028 connect( mImap.resourceClearButton, TQ_SIGNAL( clicked() ),
1029 this, TQ_SLOT( slotClearResourceAllocations() ) );
1030 mImap.resourceClearPastButton =
1031 new TQPushButton( i18n(
"Clear Past" ), resourceHB );
1032 mImap.resourceClearPastButton->setEnabled(
false );
1033 connect( mImap.resourceCheck, TQ_SIGNAL( toggled(
bool) ),
1034 mImap.resourceClearPastButton, TQ_SLOT( setEnabled(
bool) ) );
1035 TQWhatsThis::add( mImap.resourceClearPastButton,
1036 i18n(
"Delete all outdated allocations for the resource represented by this account." ) );
1037 connect( mImap.resourceClearPastButton, TQ_SIGNAL( clicked() ),
1038 this, TQ_SLOT( slotClearPastResourceAllocations() ) );
1039 grid->addMultiCellWidget( resourceHB, row, row, 0, 2 );
1043 mImap.includeInCheck =
1044 new TQCheckBox( i18n(
"Include in manual mail chec&k"), page1 );
1045 grid->addMultiCellWidget( mImap.includeInCheck, row, row, 0, 1 );
1048 mImap.intervalCheck =
1049 new TQCheckBox( i18n(
"Enable &interval mail checking"), page1 );
1050 grid->addMultiCellWidget( mImap.intervalCheck, row, row, 0, 2 );
1051 connect( mImap.intervalCheck, TQ_SIGNAL(toggled(
bool)),
1052 this, TQ_SLOT(slotEnableImapInterval(
bool)) );
1054 mImap.intervalLabel =
new TQLabel( i18n(
"Check inter&val:"), page1 );
1055 grid->addWidget( mImap.intervalLabel, row, 0 );
1056 mImap.intervalSpin =
new KIntNumInput( page1 );
1057 mImap.intervalSpin->setRange( GlobalSettings::minimumCheckInterval(), 60, 1,
false );
1058 mImap.intervalSpin->setValue( defaultmailcheckintervalmin );
1059 mImap.intervalSpin->setSuffix( i18n(
" min" ) );
1060 mImap.intervalLabel->setBuddy( mImap.intervalSpin );
1061 grid->addWidget( mImap.intervalSpin, row, 1 );
1064 label =
new TQLabel( i18n(
"&Trash folder:"), page1 );
1065 grid->addWidget( label, row, 0 );
1066 mImap.trashCombo =
new FolderRequester( page1,
1067 kmkernel->getKMMainWidget()->folderTree() );
1068 mImap.trashCombo->setShowOutbox(
false );
1069 label->setBuddy( mImap.trashCombo );
1070 grid->addWidget( mImap.trashCombo, row, 1 );
1073 mImap.identityLabel =
new TQLabel( i18n(
"Identity:"), page1 );
1074 grid->addWidget( mImap.identityLabel, row, 0 );
1075 mImap.identityCombo =
new KPIM::IdentityCombo(kmkernel->identityManager(), page1 );
1076 mImap.identityLabel->setBuddy( mImap.identityCombo );
1077 grid->addWidget( mImap.identityCombo, row, 1 );
1079 TQWidget *page2 =
new TQWidget( tabWidget );
1080 tabWidget->addTab( page2, i18n(
"S&ecurity") );
1081 TQVBoxLayout *vlay =
new TQVBoxLayout( page2, marginHint(), spacingHint() );
1083 vlay->addSpacing( KDialog::spacingHint() );
1085 TQHBoxLayout *buttonLay =
new TQHBoxLayout( vlay );
1086 mImap.checkCapabilities =
1087 new TQPushButton( i18n(
"Check &What the Server Supports"), page2 );
1088 connect(mImap.checkCapabilities, TQ_SIGNAL(clicked()),
1089 TQ_SLOT(slotCheckImapCapabilities()));
1090 buttonLay->addStretch();
1091 buttonLay->addWidget( mImap.checkCapabilities );
1092 buttonLay->addStretch();
1094 vlay->addSpacing( KDialog::spacingHint() );
1096 mImap.encryptionGroup =
new TQButtonGroup( 1, TQt::Horizontal,
1097 i18n(
"Encryption"), page2 );
1098 mImap.encryptionNone =
1099 new TQRadioButton( i18n(
"&None"), mImap.encryptionGroup );
1100 mImap.encryptionSSL =
1101 new TQRadioButton( i18n(
"Use &SSL for secure mail download"),
1102 mImap.encryptionGroup );
1103 mImap.encryptionTLS =
1104 new TQRadioButton( i18n(
"Use &TLS for secure mail download"),
1105 mImap.encryptionGroup );
1106 connect(mImap.encryptionGroup, TQ_SIGNAL(clicked(
int)),
1107 TQ_SLOT(slotImapEncryptionChanged(
int)));
1108 vlay->addWidget( mImap.encryptionGroup );
1110 mImap.authGroup =
new TQButtonGroup( 1, TQt::Horizontal,
1111 i18n(
"Authentication Method"), page2 );
1112 mImap.authUser =
new TQRadioButton( i18n(
"Clear te&xt"), mImap.authGroup );
1113 mImap.authLogin =
new TQRadioButton( i18n(
"Please translate this "
1114 "authentication method only if you have a good reason",
"&LOGIN"),
1116 mImap.authPlain =
new TQRadioButton( i18n(
"Please translate this "
1117 "authentication method only if you have a good reason",
"&PLAIN"),
1119 mImap.authCramMd5 =
new TQRadioButton( i18n(
"CRAM-MD&5"), mImap.authGroup );
1120 mImap.authDigestMd5 =
new TQRadioButton( i18n(
"&DIGEST-MD5"), mImap.authGroup );
1121 mImap.authNTLM =
new TQRadioButton( i18n(
"&NTLM"), mImap.authGroup );
1122 mImap.authGSSAPI =
new TQRadioButton( i18n(
"&GSSAPI"), mImap.authGroup );
1123 mImap.authAnonymous =
new TQRadioButton( i18n(
"&Anonymous"), mImap.authGroup );
1124 vlay->addWidget( mImap.authGroup );
1129 mSieveConfigEditor =
new SieveConfigEditor( tabWidget );
1130 mSieveConfigEditor->layout()->setMargin( KDialog::marginHint() );
1131 tabWidget->addTab( mSieveConfigEditor, i18n(
"&Filtering") );
1133 connect(kapp,TQ_SIGNAL(tdedisplayFontChanged()),TQ_SLOT(slotFontChanged()));
1137 void AccountDialog::setupSettings()
1139 TQComboBox *folderCombo = 0;
1140 int interval = mAccount->checkInterval();
1142 TQString accountType = mAccount->type();
1143 if( accountType ==
"local" )
1145 ProcmailRCParser procmailrcParser;
1146 KMAcctLocal *acctLocal =
dynamic_cast<KMAcctLocal*
>(mAccount);
1148 if ( acctLocal->location().isEmpty() )
1149 acctLocal->setLocation( procmailrcParser.getSpoolFilesList().first() );
1151 mLocal.locationEdit->insertItem( acctLocal->location() );
1153 if ( acctLocal->procmailLockFileName().isEmpty() )
1154 acctLocal->setProcmailLockFileName( procmailrcParser.getLockFilesList().first() );
1156 mLocal.procmailLockFileName->insertItem( acctLocal->procmailLockFileName() );
1158 mLocal.nameEdit->setText( mAccount->name() );
1159 mLocal.nameEdit->setFocus();
1160 mLocal.locationEdit->setEditText( acctLocal->location() );
1161 if (acctLocal->lockType() == mutt_dotlock)
1162 mLocal.lockMutt->setChecked(
true);
1163 else if (acctLocal->lockType() == mutt_dotlock_privileged)
1164 mLocal.lockMuttPriv->setChecked(
true);
1165 else if (acctLocal->lockType() == procmail_lockfile) {
1166 mLocal.lockProcmail->setChecked(
true);
1167 mLocal.procmailLockFileName->setEditText(acctLocal->procmailLockFileName());
1168 }
else if (acctLocal->lockType() == FCNTL)
1169 mLocal.lockFcntl->setChecked(
true);
1170 else if (acctLocal->lockType() == lock_none)
1171 mLocal.lockNone->setChecked(
true);
1173 if ( interval <= 0 ) mLocal.intervalSpin->setValue( defaultmailcheckintervalmin );
1174 else mLocal.intervalSpin->setValue( interval );
1175 mLocal.intervalCheck->setChecked( interval >= 1 );
1177 mLocal.resourceCheck->setChecked( mAccount->resource() );
1179 mLocal.includeInCheck->setChecked( !mAccount->checkExclude() );
1180 mLocal.precommand->setText( mAccount->precommand() );
1182 slotEnableLocalInterval( interval >= 1 );
1183 folderCombo = mLocal.folderCombo;
1184 mLocal.identityCombo-> setCurrentIdentity( mAccount->identityId() );
1186 else if( accountType ==
"pop" )
1188 PopAccount &ap = *(PopAccount*)mAccount;
1189 mPop.nameEdit->setText( mAccount->name() );
1190 mPop.nameEdit->setFocus();
1191 mPop.loginEdit->setText( ap.login() );
1192 mPop.passwordEdit->setText( ap.passwd());
1193 mPop.hostEdit->setText( ap.host() );
1194 mPop.portEdit->setText( TQString(
"%1").arg( ap.port() ) );
1195 mPop.usePipeliningCheck->setChecked( ap.usePipelining() );
1196 mPop.storePasswordCheck->setChecked( ap.storePasswd() );
1197 mPop.leaveOnServerCheck->setChecked( ap.leaveOnServer() );
1198 mPop.leaveOnServerDaysCheck->setEnabled( ap.leaveOnServer() );
1199 mPop.leaveOnServerDaysCheck->setChecked( ap.leaveOnServerDays() >= 1 );
1200 mPop.leaveOnServerDaysSpin->setValue( ap.leaveOnServerDays() >= 1 ?
1201 ap.leaveOnServerDays() : 7 );
1202 mPop.leaveOnServerCountCheck->setEnabled( ap.leaveOnServer() );
1203 mPop.leaveOnServerCountCheck->setChecked( ap.leaveOnServerCount() >= 1 );
1204 mPop.leaveOnServerCountSpin->setValue( ap.leaveOnServerCount() >= 1 ?
1205 ap.leaveOnServerCount() : 100 );
1206 mPop.leaveOnServerSizeCheck->setEnabled( ap.leaveOnServer() );
1207 mPop.leaveOnServerSizeCheck->setChecked( ap.leaveOnServerSize() >= 1 );
1208 mPop.leaveOnServerSizeSpin->setValue( ap.leaveOnServerSize() >= 1 ?
1209 ap.leaveOnServerSize() : 10 );
1210 mPop.filterOnServerCheck->setChecked( ap.filterOnServer() );
1211 mPop.filterOnServerSizeSpin->setValue( ap.filterOnServerCheckSize() );
1212 mPop.intervalCheck->setChecked( interval >= 1 );
1213 if ( interval <= 0 ) mPop.intervalSpin->setValue( defaultmailcheckintervalmin );
1214 else mPop.intervalSpin->setValue( interval );
1216 mPop.resourceCheck->setChecked( mAccount->resource() );
1218 mPop.includeInCheck->setChecked( !mAccount->checkExclude() );
1219 mPop.precommand->setText( ap.precommand() );
1220 mPop.identityCombo-> setCurrentIdentity( mAccount->identityId() );
1222 mPop.encryptionSSL->setChecked(
true );
1223 else if (ap.useTLS())
1224 mPop.encryptionTLS->setChecked(
true );
1225 else mPop.encryptionNone->setChecked(
true );
1226 if (ap.auth() ==
"LOGIN")
1227 mPop.authLogin->setChecked(
true );
1228 else if (ap.auth() ==
"PLAIN")
1229 mPop.authPlain->setChecked(
true );
1230 else if (ap.auth() ==
"CRAM-MD5")
1231 mPop.authCRAM_MD5->setChecked(
true );
1232 else if (ap.auth() ==
"DIGEST-MD5")
1233 mPop.authDigestMd5->setChecked(
true );
1234 else if (ap.auth() ==
"NTLM")
1235 mPop.authNTLM->setChecked(
true );
1236 else if (ap.auth() ==
"GSSAPI")
1237 mPop.authGSSAPI->setChecked(
true );
1238 else if (ap.auth() ==
"APOP")
1239 mPop.authAPOP->setChecked(
true );
1240 else mPop.authUser->setChecked(
true );
1242 slotEnableLeaveOnServerDays( mPop.leaveOnServerDaysCheck->isEnabled() ?
1243 ap.leaveOnServerDays() >= 1 : 0);
1244 slotEnableLeaveOnServerCount( mPop.leaveOnServerCountCheck->isEnabled() ?
1245 ap.leaveOnServerCount() >= 1 : 0);
1246 slotEnableLeaveOnServerSize( mPop.leaveOnServerSizeCheck->isEnabled() ?
1247 ap.leaveOnServerSize() >= 1 : 0);
1248 slotEnablePopInterval( interval >= 1 );
1249 folderCombo = mPop.folderCombo;
1251 else if( accountType ==
"imap" )
1253 KMAcctImap &ai = *(KMAcctImap*)mAccount;
1254 mImap.nameEdit->setText( mAccount->name() );
1255 mImap.nameEdit->setFocus();
1256 mImap.loginEdit->setText( ai.login() );
1257 mImap.passwordEdit->setText( ai.passwd());
1258 mImap.hostEdit->setText( ai.host() );
1259 mImap.portEdit->setText( TQString(
"%1").arg( ai.port() ) );
1260 mImap.autoExpungeCheck->setChecked( ai.autoExpunge() );
1261 mImap.hiddenFoldersCheck->setChecked( ai.hiddenFolders() );
1262 mImap.subscribedFoldersCheck->setChecked( ai.onlySubscribedFolders() );
1263 mImap.locallySubscribedFoldersCheck->setChecked( ai.onlyLocallySubscribedFolders() );
1264 mImap.loadOnDemandCheck->setChecked( ai.loadOnDemand() );
1265 mImap.listOnlyOpenCheck->setChecked( ai.listOnlyOpenFolders() );
1266 mImap.storePasswordCheck->setChecked( ai.storePasswd() );
1268 mImap.resourceCheck->setChecked( ai.resource() );
1270 mImap.includeInCheck->setChecked( !ai.checkExclude() );
1271 mImap.intervalCheck->setChecked( interval >= 1 );
1272 if ( interval <= 0 ) mImap.intervalSpin->setValue( defaultmailcheckintervalmin );
1273 else mImap.intervalSpin->setValue( interval );
1274 TQString trashfolder = ai.trash();
1275 if (trashfolder.isEmpty())
1276 trashfolder = kmkernel->trashFolder()->idString();
1277 mImap.trashCombo->setFolder( trashfolder );
1278 slotEnableImapInterval( interval >= 1 );
1279 mImap.identityCombo-> setCurrentIdentity( mAccount->identityId() );
1282 mImap.encryptionSSL->setChecked(
true );
1283 else if (ai.useTLS())
1284 mImap.encryptionTLS->setChecked(
true );
1285 else mImap.encryptionNone->setChecked(
true );
1286 if (ai.auth() ==
"CRAM-MD5")
1287 mImap.authCramMd5->setChecked(
true );
1288 else if (ai.auth() ==
"DIGEST-MD5")
1289 mImap.authDigestMd5->setChecked(
true );
1290 else if (ai.auth() ==
"NTLM")
1291 mImap.authNTLM->setChecked(
true );
1292 else if (ai.auth() ==
"GSSAPI")
1293 mImap.authGSSAPI->setChecked(
true );
1294 else if (ai.auth() ==
"ANONYMOUS")
1295 mImap.authAnonymous->setChecked(
true );
1296 else if (ai.auth() ==
"PLAIN")
1297 mImap.authPlain->setChecked(
true );
1298 else if (ai.auth() ==
"LOGIN")
1299 mImap.authLogin->setChecked(
true );
1300 else mImap.authUser->setChecked(
true );
1301 if ( mSieveConfigEditor )
1302 mSieveConfigEditor->setConfig( ai.sieveConfig() );
1304 else if( accountType ==
"cachedimap" )
1306 KMAcctCachedImap &ai = *(KMAcctCachedImap*)mAccount;
1307 mImap.nameEdit->setText( mAccount->name() );
1308 mImap.nameEdit->setFocus();
1309 mImap.loginEdit->setText( ai.login() );
1310 mImap.passwordEdit->setText( ai.passwd());
1311 mImap.hostEdit->setText( ai.host() );
1312 mImap.portEdit->setText( TQString(
"%1").arg( ai.port() ) );
1314 mImap.resourceCheck->setChecked( ai.resource() );
1316 mImap.hiddenFoldersCheck->setChecked( ai.hiddenFolders() );
1317 mImap.subscribedFoldersCheck->setChecked( ai.onlySubscribedFolders() );
1318 mImap.locallySubscribedFoldersCheck->setChecked( ai.onlyLocallySubscribedFolders() );
1319 mImap.storePasswordCheck->setChecked( ai.storePasswd() );
1320 mImap.intervalCheck->setChecked( interval >= 1 );
1321 if ( interval <= 0 ) mImap.intervalSpin->setValue( defaultmailcheckintervalmin );
1322 else mImap.intervalSpin->setValue( interval );
1323 mImap.includeInCheck->setChecked( !ai.checkExclude() );
1324 TQString trashfolder = ai.trash();
1325 if (trashfolder.isEmpty())
1326 trashfolder = kmkernel->trashFolder()->idString();
1327 mImap.trashCombo->setFolder( trashfolder );
1328 slotEnableImapInterval( interval >= 1 );
1329 mImap.identityCombo-> setCurrentIdentity( mAccount->identityId() );
1332 mImap.encryptionSSL->setChecked(
true );
1333 else if (ai.useTLS())
1334 mImap.encryptionTLS->setChecked(
true );
1335 else mImap.encryptionNone->setChecked(
true );
1336 if (ai.auth() ==
"CRAM-MD5")
1337 mImap.authCramMd5->setChecked(
true );
1338 else if (ai.auth() ==
"DIGEST-MD5")
1339 mImap.authDigestMd5->setChecked(
true );
1340 else if (ai.auth() ==
"GSSAPI")
1341 mImap.authGSSAPI->setChecked(
true );
1342 else if (ai.auth() ==
"NTLM")
1343 mImap.authNTLM->setChecked(
true );
1344 else if (ai.auth() ==
"ANONYMOUS")
1345 mImap.authAnonymous->setChecked(
true );
1346 else if (ai.auth() ==
"PLAIN")
1347 mImap.authPlain->setChecked(
true );
1348 else if (ai.auth() ==
"LOGIN")
1349 mImap.authLogin->setChecked(
true );
1350 else mImap.authUser->setChecked(
true );
1351 if ( mSieveConfigEditor )
1352 mSieveConfigEditor->setConfig( ai.sieveConfig() );
1354 else if( accountType ==
"maildir" )
1356 KMAcctMaildir *acctMaildir =
dynamic_cast<KMAcctMaildir*
>(mAccount);
1358 mMaildir.nameEdit->setText( mAccount->name() );
1359 mMaildir.nameEdit->setFocus();
1360 mMaildir.locationEdit->setEditText( acctMaildir->location() );
1362 if ( interval <= 0 ) mMaildir.intervalSpin->setValue( defaultmailcheckintervalmin );
1363 else mMaildir.intervalSpin->setValue( interval );
1364 mMaildir.intervalCheck->setChecked( interval >= 1 );
1366 mMaildir.resourceCheck->setChecked( mAccount->resource() );
1368 mMaildir.includeInCheck->setChecked( !mAccount->checkExclude() );
1369 mMaildir.precommand->setText( mAccount->precommand() );
1370 mMaildir.identityCombo-> setCurrentIdentity( mAccount->identityId() );
1371 slotEnableMaildirInterval( interval >= 1 );
1372 folderCombo = mMaildir.folderCombo;
1377 if ( accountType ==
"imap" || accountType ==
"cachedimap" )
1380 ImapAccountBase &ai = *(ImapAccountBase*)mAccount;
1382 if ( ( ai.namespaces().isEmpty() || ai.namespaceToDelimiter().isEmpty() ) &&
1383 !ai.login().isEmpty() && !ai.passwd().isEmpty() && !ai.host().isEmpty() )
1385 slotReloadNamespaces();
1387 slotSetupNamespaces( ai.namespacesWithDelimiter() );
1391 if (!folderCombo)
return;
1394 KMFolder *acctFolder = mAccount->folder();
1395 if( acctFolder == 0 )
1397 acctFolder = (
KMFolder*)fdir->first();
1399 if( acctFolder == 0 )
1401 folderCombo->insertItem( i18n(
"<none>") );
1407 kmkernel->folderMgr()->createI18nFolderList(&mFolderNames, &mFolderList);
1408 while (i < mFolderNames.count())
1410 TQValueList<TQGuardedPtr<KMFolder> >::Iterator it = mFolderList.at(i);
1415 mFolderNames.remove(mFolderNames.at(i));
1417 if (folder == acctFolder) curIndex = i;
1421 mFolderNames.prepend(i18n(
"inbox"));
1422 mFolderList.prepend(kmkernel->inboxFolder());
1423 folderCombo->insertStringList(mFolderNames);
1424 folderCombo->setCurrentItem(curIndex + 1);
1427 if (folderCombo->count() == 0)
1428 folderCombo->insertItem( i18n(
"inbox") );
1432 void AccountDialog::slotLeaveOnServerClicked()
1434 bool state = mPop.leaveOnServerCheck->isChecked();
1435 mPop.leaveOnServerDaysCheck->setEnabled( state );
1436 mPop.leaveOnServerCountCheck->setEnabled( state );
1437 mPop.leaveOnServerSizeCheck->setEnabled( state );
1439 if ( mPop.leaveOnServerDaysCheck->isChecked() ) {
1440 slotEnableLeaveOnServerDays( state );
1442 if ( mPop.leaveOnServerCountCheck->isChecked() ) {
1443 slotEnableLeaveOnServerCount( state );
1445 if ( mPop.leaveOnServerSizeCheck->isChecked() ) {
1446 slotEnableLeaveOnServerSize( state );
1449 slotEnableLeaveOnServerDays( state );
1450 slotEnableLeaveOnServerCount( state );
1451 slotEnableLeaveOnServerSize( state );
1453 if ( !( mCurCapa & UIDL ) && mPop.leaveOnServerCheck->isChecked() ) {
1454 KMessageBox::information( topLevelWidget(),
1455 i18n(
"The server does not seem to support unique "
1456 "message numbers, but this is a "
1457 "requirement for leaving messages on the "
1459 "Since some servers do not correctly "
1460 "announce their capabilities you still "
1461 "have the possibility to turn leaving "
1462 "fetched messages on the server on.") );
1466 void AccountDialog::slotFilterOnServerClicked()
1468 if ( !( mCurCapa & TOP ) && mPop.filterOnServerCheck->isChecked() ) {
1469 KMessageBox::information( topLevelWidget(),
1470 i18n(
"The server does not seem to support "
1471 "fetching message headers, but this is a "
1472 "requirement for filtering messages on the "
1474 "Since some servers do not correctly "
1475 "announce their capabilities you still "
1476 "have the possibility to turn filtering "
1477 "messages on the server on.") );
1481 void AccountDialog::slotPipeliningClicked()
1483 if (mPop.usePipeliningCheck->isChecked())
1484 KMessageBox::information( topLevelWidget(),
1485 i18n(
"Please note that this feature can cause some POP3 servers "
1486 "that do not support pipelining to send corrupted mail;\n"
1487 "this is configurable, though, because some servers support pipelining "
1488 "but do not announce their capabilities. To check whether your POP3 server "
1489 "announces pipelining support use the \"Check What the Server "
1490 "Supports\" button at the bottom of the dialog;\n"
1491 "if your server does not announce it, but you want more speed, then "
1492 "you should do some testing first by sending yourself a batch "
1493 "of mail and downloading it."), TQString(),
1498 void AccountDialog::slotPopEncryptionChanged(
int id)
1500 kdDebug(5006) <<
"slotPopEncryptionChanged( " <<
id <<
" )" << endl;
1502 if (
id == SSL || mPop.portEdit->text() ==
"995" )
1503 mPop.portEdit->setText( (
id == SSL ) ?
"995" :
"110" );
1506 mCurCapa = (
id == TLS ) ? mCapaTLS
1507 : (
id == SSL ) ? mCapaSSL
1509 enablePopFeatures( mCurCapa );
1510 const TQButton *old = mPop.authGroup->selected();
1511 if ( !old->isEnabled() )
1512 checkHighest( mPop.authGroup );
1516 void AccountDialog::slotImapEncryptionChanged(
int id)
1518 kdDebug(5006) <<
"slotImapEncryptionChanged( " <<
id <<
" )" << endl;
1520 if (
id == SSL || mImap.portEdit->text() ==
"993" )
1521 mImap.portEdit->setText( (
id == SSL ) ?
"993" :
"143" );
1524 int authMethods = (
id == TLS ) ? mCapaTLS
1525 : (
id == SSL ) ? mCapaSSL
1527 enableImapAuthMethods( authMethods );
1528 TQButton *old = mImap.authGroup->selected();
1529 if ( !old->isEnabled() )
1530 checkHighest( mImap.authGroup );
1534 void AccountDialog::slotCheckPopCapabilities()
1536 if ( mPop.hostEdit->text().isEmpty() || mPop.portEdit->text().isEmpty() )
1538 KMessageBox::sorry(
this, i18n(
"Please specify a server and port on "
1539 "the General tab first." ) );
1543 mServerTest =
new KMServerTest(POP_PROTOCOL, mPop.hostEdit->text(),
1544 mPop.portEdit->text().toInt());
1545 connect( mServerTest, TQ_SIGNAL( capabilities(
const TQStringList &,
1546 const TQStringList & ) ),
1547 this, TQ_SLOT( slotPopCapabilities(
const TQStringList &,
1548 const TQStringList & ) ) );
1549 mPop.checkCapabilities->setEnabled(
false);
1553 void AccountDialog::slotCheckImapCapabilities()
1555 if ( mImap.hostEdit->text().isEmpty() || mImap.portEdit->text().isEmpty() )
1557 KMessageBox::sorry(
this, i18n(
"Please specify a server and port on "
1558 "the General tab first." ) );
1562 mServerTest =
new KMServerTest(IMAP_PROTOCOL, mImap.hostEdit->text(),
1563 mImap.portEdit->text().toInt());
1564 connect( mServerTest, TQ_SIGNAL( capabilities(
const TQStringList &,
1565 const TQStringList & ) ),
1566 this, TQ_SLOT( slotImapCapabilities(
const TQStringList &,
1567 const TQStringList & ) ) );
1568 mImap.checkCapabilities->setEnabled(
false);
1572 unsigned int AccountDialog::popCapabilitiesFromStringList(
const TQStringList & l )
1574 unsigned int capa = 0;
1575 kdDebug( 5006 ) << k_funcinfo << l << endl;
1576 for ( TQStringList::const_iterator it = l.begin() ; it != l.end() ; ++it ) {
1577 TQString cur = (*it).upper();
1578 if ( cur ==
"PLAIN" )
1580 else if ( cur ==
"LOGIN" )
1582 else if ( cur ==
"CRAM-MD5" )
1584 else if ( cur ==
"DIGEST-MD5" )
1586 else if ( cur ==
"NTLM" )
1588 else if ( cur ==
"GSSAPI" )
1590 else if ( cur ==
"APOP" )
1592 else if ( cur ==
"PIPELINING" )
1594 else if ( cur ==
"TOP" )
1596 else if ( cur ==
"UIDL" )
1598 else if ( cur ==
"STLS" )
1605 void AccountDialog::slotPopCapabilities(
const TQStringList & capaNormal,
1606 const TQStringList & capaSSL )
1608 mPop.checkCapabilities->setEnabled(
true );
1609 mCapaNormal = popCapabilitiesFromStringList( capaNormal );
1610 if ( mCapaNormal & STLS )
1611 mCapaTLS = mCapaNormal;
1614 mCapaSSL = popCapabilitiesFromStringList( capaSSL );
1615 kdDebug(5006) <<
"mCapaNormal = " << mCapaNormal
1616 <<
"; mCapaSSL = " << mCapaSSL
1617 <<
"; mCapaTLS = " << mCapaTLS << endl;
1618 mPop.encryptionNone->setEnabled( !capaNormal.isEmpty() );
1619 mPop.encryptionSSL->setEnabled( !capaSSL.isEmpty() );
1620 mPop.encryptionTLS->setEnabled( mCapaTLS != 0 );
1621 checkHighest( mPop.encryptionGroup );
1627 void AccountDialog::enablePopFeatures(
unsigned int capa )
1629 kdDebug(5006) <<
"enablePopFeatures( " << capa <<
" )" << endl;
1630 mPop.authPlain->setEnabled( capa & Plain );
1631 mPop.authLogin->setEnabled( capa & Login );
1632 mPop.authCRAM_MD5->setEnabled( capa & CRAM_MD5 );
1633 mPop.authDigestMd5->setEnabled( capa & Digest_MD5 );
1634 mPop.authNTLM->setEnabled( capa & NTLM );
1635 mPop.authGSSAPI->setEnabled( capa & GSSAPI );
1636 mPop.authAPOP->setEnabled( capa & APOP );
1637 if ( !( capa & Pipelining ) && mPop.usePipeliningCheck->isChecked() ) {
1638 mPop.usePipeliningCheck->setChecked(
false );
1639 KMessageBox::information( topLevelWidget(),
1640 i18n(
"The server does not seem to support "
1641 "pipelining; therefore, this option has "
1643 "Since some servers do not correctly "
1644 "announce their capabilities you still "
1645 "have the possibility to turn pipelining "
1646 "on. But please note that this feature can "
1647 "cause some POP servers that do not "
1648 "support pipelining to send corrupt "
1649 "messages. So before using this feature "
1650 "with important mail you should first "
1651 "test it by sending yourself a larger "
1652 "number of test messages which you all "
1653 "download in one go from the POP "
1656 if ( !( capa & UIDL ) && mPop.leaveOnServerCheck->isChecked() ) {
1657 mPop.leaveOnServerCheck->setChecked(
false );
1658 KMessageBox::information( topLevelWidget(),
1659 i18n(
"The server does not seem to support unique "
1660 "message numbers, but this is a "
1661 "requirement for leaving messages on the "
1662 "server; therefore, this option has been "
1664 "Since some servers do not correctly "
1665 "announce their capabilities you still "
1666 "have the possibility to turn leaving "
1667 "fetched messages on the server on.") );
1669 if ( !( capa & TOP ) && mPop.filterOnServerCheck->isChecked() ) {
1670 mPop.filterOnServerCheck->setChecked(
false );
1671 KMessageBox::information( topLevelWidget(),
1672 i18n(
"The server does not seem to support "
1673 "fetching message headers, but this is a "
1674 "requirement for filtering messages on the "
1675 "server; therefore, this option has been "
1677 "Since some servers do not correctly "
1678 "announce their capabilities you still "
1679 "have the possibility to turn filtering "
1680 "messages on the server on.") );
1685 unsigned int AccountDialog::imapCapabilitiesFromStringList(
const TQStringList & l )
1687 unsigned int capa = 0;
1688 for ( TQStringList::const_iterator it = l.begin() ; it != l.end() ; ++it ) {
1689 TQString cur = (*it).upper();
1690 if ( cur ==
"AUTH=PLAIN" )
1692 else if ( cur ==
"AUTH=LOGIN" )
1694 else if ( cur ==
"AUTH=CRAM-MD5" )
1696 else if ( cur ==
"AUTH=DIGEST-MD5" )
1698 else if ( cur ==
"AUTH=NTLM" )
1700 else if ( cur ==
"AUTH=GSSAPI" )
1702 else if ( cur ==
"AUTH=ANONYMOUS" )
1704 else if ( cur ==
"STARTTLS" )
1711 void AccountDialog::slotImapCapabilities(
const TQStringList & capaNormal,
1712 const TQStringList & capaSSL )
1714 mImap.checkCapabilities->setEnabled(
true );
1715 mCapaNormal = imapCapabilitiesFromStringList( capaNormal );
1716 if ( mCapaNormal & STARTTLS )
1717 mCapaTLS = mCapaNormal;
1720 mCapaSSL = imapCapabilitiesFromStringList( capaSSL );
1721 kdDebug(5006) <<
"mCapaNormal = " << mCapaNormal
1722 <<
"; mCapaSSL = " << mCapaSSL
1723 <<
"; mCapaTLS = " << mCapaTLS << endl;
1724 mImap.encryptionNone->setEnabled( !capaNormal.isEmpty() );
1725 mImap.encryptionSSL->setEnabled( !capaSSL.isEmpty() );
1726 mImap.encryptionTLS->setEnabled( mCapaTLS != 0 );
1727 checkHighest( mImap.encryptionGroup );
1732 void AccountDialog::slotLeaveOnServerDaysChanged (
int value )
1734 mPop.leaveOnServerDaysSpin->setSuffix( i18n(
" day",
" days", value) );
1738 void AccountDialog::slotLeaveOnServerCountChanged (
int value )
1740 mPop.leaveOnServerCountSpin->setSuffix( i18n(
" message",
" messages", value) );
1744 void AccountDialog::slotFilterOnServerSizeChanged (
int value )
1746 mPop.filterOnServerSizeSpin->setSuffix( i18n(
" byte",
" bytes", value) );
1750 void AccountDialog::enableImapAuthMethods(
unsigned int capa )
1752 kdDebug(5006) <<
"enableImapAuthMethods( " << capa <<
" )" << endl;
1753 mImap.authPlain->setEnabled( capa & Plain );
1754 mImap.authLogin->setEnabled( capa & Login );
1755 mImap.authCramMd5->setEnabled( capa & CRAM_MD5 );
1756 mImap.authDigestMd5->setEnabled( capa & Digest_MD5 );
1757 mImap.authNTLM->setEnabled( capa & NTLM );
1758 mImap.authGSSAPI->setEnabled( capa & GSSAPI );
1759 mImap.authAnonymous->setEnabled( capa & Anonymous );
1763 void AccountDialog::checkHighest( TQButtonGroup *btnGroup )
1765 kdDebug(5006) <<
"checkHighest( " << btnGroup <<
" )" << endl;
1766 for (
int i = btnGroup->count() - 1; i >= 0 ; --i ) {
1767 TQButton * btn = btnGroup->find( i );
1768 if ( btn && btn->isEnabled() ) {
1769 btn->animateClick();
1776 void AccountDialog::slotOk()
1783 void AccountDialog::saveSettings()
1785 TQString accountType = mAccount->type();
1786 if( accountType ==
"local" )
1788 KMAcctLocal *acctLocal =
dynamic_cast<KMAcctLocal*
>(mAccount);
1791 mAccount->setName( mLocal.nameEdit->text() );
1792 acctLocal->setLocation( mLocal.locationEdit->currentText() );
1793 if (mLocal.lockMutt->isChecked())
1794 acctLocal->setLockType(mutt_dotlock);
1795 else if (mLocal.lockMuttPriv->isChecked())
1796 acctLocal->setLockType(mutt_dotlock_privileged);
1797 else if (mLocal.lockProcmail->isChecked()) {
1798 acctLocal->setLockType(procmail_lockfile);
1799 acctLocal->setProcmailLockFileName(mLocal.procmailLockFileName->currentText());
1801 else if (mLocal.lockNone->isChecked())
1802 acctLocal->setLockType(lock_none);
1803 else acctLocal->setLockType(FCNTL);
1806 mAccount->setCheckInterval( mLocal.intervalCheck->isChecked() ?
1807 mLocal.intervalSpin->value() : 0 );
1809 mAccount->setResource( mLocal.resourceCheck->isChecked() );
1811 mAccount->setCheckExclude( !mLocal.includeInCheck->isChecked() );
1813 mAccount->setPrecommand( mLocal.precommand->text() );
1815 mAccount->setFolder( *mFolderList.at(mLocal.folderCombo->currentItem()) );
1817 mAccount->setIdentityId( mLocal.identityCombo->currentIdentity() );
1820 else if( accountType ==
"pop" )
1822 mAccount->setName( mPop.nameEdit->text() );
1823 mAccount->setCheckInterval( mPop.intervalCheck->isChecked() ?
1824 mPop.intervalSpin->value() : 0 );
1826 mAccount->setResource( mPop.resourceCheck->isChecked() );
1828 mAccount->setCheckExclude( !mPop.includeInCheck->isChecked() );
1830 mAccount->setFolder( *mFolderList.at(mPop.folderCombo->currentItem()) );
1832 mAccount->setIdentityId( mPop.identityCombo->currentIdentity() );
1834 initAccountForConnect();
1835 PopAccount &epa = *(PopAccount*)mAccount;
1836 epa.setUsePipelining( mPop.usePipeliningCheck->isChecked() );
1837 epa.setLeaveOnServer( mPop.leaveOnServerCheck->isChecked() );
1838 epa.setLeaveOnServerDays( mPop.leaveOnServerCheck->isChecked() ?
1839 ( mPop.leaveOnServerDaysCheck->isChecked() ?
1840 mPop.leaveOnServerDaysSpin->value() : -1 ) : 0);
1841 epa.setLeaveOnServerCount( mPop.leaveOnServerCheck->isChecked() ?
1842 ( mPop.leaveOnServerCountCheck->isChecked() ?
1843 mPop.leaveOnServerCountSpin->value() : -1 ) : 0 );
1844 epa.setLeaveOnServerSize( mPop.leaveOnServerCheck->isChecked() ?
1845 ( mPop.leaveOnServerSizeCheck->isChecked() ?
1846 mPop.leaveOnServerSizeSpin->value() : -1 ) : 0 );
1847 epa.setFilterOnServer( mPop.filterOnServerCheck->isChecked() );
1848 epa.setFilterOnServerCheckSize (mPop.filterOnServerSizeSpin->value() );
1849 epa.setPrecommand( mPop.precommand->text() );
1852 else if( accountType ==
"imap" )
1854 mAccount->setName( mImap.nameEdit->text() );
1855 mAccount->setCheckInterval( mImap.intervalCheck->isChecked() ?
1856 mImap.intervalSpin->value() : 0 );
1857 mAccount->setIdentityId( mImap.identityCombo->currentIdentity() );
1860 mAccount->setResource( mImap.resourceCheck->isChecked() );
1862 mAccount->setCheckExclude( !mImap.includeInCheck->isChecked() );
1863 mAccount->setFolder( kmkernel->imapFolderMgr()->findById(mAccount->id()) );
1865 initAccountForConnect();
1866 KMAcctImap &epa = *(KMAcctImap*)mAccount;
1867 epa.setAutoExpunge( mImap.autoExpungeCheck->isChecked() );
1868 epa.setHiddenFolders( mImap.hiddenFoldersCheck->isChecked() );
1869 epa.setOnlySubscribedFolders( mImap.subscribedFoldersCheck->isChecked() );
1870 epa.setOnlyLocallySubscribedFolders( mImap.locallySubscribedFoldersCheck->isChecked() );
1871 epa.setLoadOnDemand( mImap.loadOnDemandCheck->isChecked() );
1872 epa.setListOnlyOpenFolders( mImap.listOnlyOpenCheck->isChecked() );
1873 KMFolder *t = mImap.trashCombo->folder();
1875 epa.setTrash( mImap.trashCombo->folder()->idString() );
1877 epa.setTrash( kmkernel->trashFolder()->idString() );
1879 epa.setResource( mImap.resourceCheck->isChecked() );
1881 epa.setCheckExclude( !mImap.includeInCheck->isChecked() );
1882 if ( mSieveConfigEditor )
1883 epa.setSieveConfig( mSieveConfigEditor->config() );
1885 else if( accountType ==
"cachedimap" )
1887 mAccount->setName( mImap.nameEdit->text() );
1888 mAccount->setCheckInterval( mImap.intervalCheck->isChecked() ?
1889 mImap.intervalSpin->value() : 0 );
1890 mAccount->setIdentityId( mImap.identityCombo->currentIdentity() );
1893 mAccount->setResource( mImap.resourceCheck->isChecked() );
1895 mAccount->setCheckExclude( !mImap.includeInCheck->isChecked() );
1897 mAccount->setFolder( kmkernel->dimapFolderMgr()->findById(mAccount->id()) );
1900 initAccountForConnect();
1901 KMAcctCachedImap &epa = *(KMAcctCachedImap*)mAccount;
1902 epa.setHiddenFolders( mImap.hiddenFoldersCheck->isChecked() );
1903 epa.setOnlySubscribedFolders( mImap.subscribedFoldersCheck->isChecked() );
1904 epa.setOnlyLocallySubscribedFolders( mImap.locallySubscribedFoldersCheck->isChecked() );
1905 epa.setStorePasswd( mImap.storePasswordCheck->isChecked() );
1906 epa.setPasswd( mImap.passwordEdit->text(), epa.storePasswd() );
1907 KMFolder *t = mImap.trashCombo->folder();
1909 epa.setTrash( mImap.trashCombo->folder()->idString() );
1911 epa.setTrash( kmkernel->trashFolder()->idString() );
1913 epa.setResource( mImap.resourceCheck->isChecked() );
1915 epa.setCheckExclude( !mImap.includeInCheck->isChecked() );
1916 if ( mSieveConfigEditor )
1917 epa.setSieveConfig( mSieveConfigEditor->config() );
1919 else if( accountType ==
"maildir" )
1921 KMAcctMaildir *acctMaildir =
dynamic_cast<KMAcctMaildir*
>(mAccount);
1924 mAccount->setName( mMaildir.nameEdit->text() );
1925 acctMaildir->setLocation( mMaildir.locationEdit->currentText() );
1927 KMFolder *targetFolder = *mFolderList.at(mMaildir.folderCombo->currentItem());
1928 if ( targetFolder->
location() == acctMaildir->location() ) {
1934 targetFolder = kmkernel->inboxFolder();
1936 mAccount->setFolder( targetFolder );
1938 mAccount->setCheckInterval( mMaildir.intervalCheck->isChecked() ?
1939 mMaildir.intervalSpin->value() : 0 );
1941 mAccount->setResource( mMaildir.resourceCheck->isChecked() );
1943 mAccount->setCheckExclude( !mMaildir.includeInCheck->isChecked() );
1945 mAccount->setPrecommand( mMaildir.precommand->text() );
1947 mAccount->setIdentityId( mMaildir.identityCombo->currentIdentity() );
1950 if ( accountType ==
"imap" || accountType ==
"cachedimap" )
1953 ImapAccountBase &ai = *(ImapAccountBase*)mAccount;
1955 ImapAccountBase::nsMap map;
1956 ImapAccountBase::namespaceDelim delimMap;
1957 ImapAccountBase::nsDelimMap::Iterator it;
1958 ImapAccountBase::namespaceDelim::Iterator it2;
1959 for ( it = mImap.nsMap.begin(); it != mImap.nsMap.end(); ++it ) {
1961 for ( it2 = it.data().begin(); it2 != it.data().end(); ++it2 ) {
1963 delimMap[it2.key()] = it2.data();
1965 map[it.key()] = list;
1967 ai.setNamespaces( map );
1968 ai.setNamespaceToDelimiter( delimMap );
1971 kmkernel->acctMgr()->writeConfig(
true );
1975 KMAccount* newAcct = kmkernel->acctMgr()->find(mAccount->id());
1978 if( accountType ==
"local" ) {
1979 newAcct->setFolder( *mFolderList.at(mLocal.folderCombo->currentItem()),
true );
1980 }
else if ( accountType ==
"pop" ) {
1981 newAcct->setFolder( *mFolderList.at(mPop.folderCombo->currentItem()),
true );
1982 }
else if ( accountType ==
"maildir" ) {
1983 newAcct->setFolder( *mFolderList.at(mMaildir.folderCombo->currentItem()),
true );
1984 }
else if ( accountType ==
"imap" ) {
1985 newAcct->setFolder( kmkernel->imapFolderMgr()->findById(mAccount->id()),
true );
1986 }
else if ( accountType ==
"cachedimap" ) {
1987 newAcct->setFolder( kmkernel->dimapFolderMgr()->findById(mAccount->id()),
true );
1993 void AccountDialog::slotLocationChooser()
1995 static TQString directory(
"/" );
1997 KFileDialog dialog( directory, TQString(),
this, 0,
true );
1998 dialog.setCaption( i18n(
"Choose Location") );
2000 bool result = dialog.exec();
2001 if( result ==
false )
2006 KURL url = dialog.selectedURL();
2011 if( url.isLocalFile() ==
false )
2013 KMessageBox::sorry( 0, i18n(
"Only local files are currently supported." ) );
2017 mLocal.locationEdit->setEditText( url.path() );
2018 directory = url.directory();
2021 void AccountDialog::slotMaildirChooser()
2023 static TQString directory(
"/" );
2025 TQString dir = KFileDialog::getExistingDirectory(directory,
this, i18n(
"Choose Location"));
2030 mMaildir.locationEdit->setEditText( dir );
2034 void AccountDialog::slotEnableLeaveOnServerDays(
bool state )
2036 if ( state && !mPop.leaveOnServerDaysCheck->isEnabled())
return;
2037 mPop.leaveOnServerDaysSpin->setEnabled( state );
2040 void AccountDialog::slotEnableLeaveOnServerCount(
bool state )
2042 if ( state && !mPop.leaveOnServerCountCheck->isEnabled())
return;
2043 mPop.leaveOnServerCountSpin->setEnabled( state );
2047 void AccountDialog::slotEnableLeaveOnServerSize(
bool state )
2049 if ( state && !mPop.leaveOnServerSizeCheck->isEnabled())
return;
2050 mPop.leaveOnServerSizeSpin->setEnabled( state );
2054 void AccountDialog::slotEnablePopInterval(
bool state )
2056 mPop.intervalSpin->setEnabled( state );
2057 mPop.intervalLabel->setEnabled( state );
2060 void AccountDialog::slotEnableImapInterval(
bool state )
2062 mImap.intervalSpin->setEnabled( state );
2063 mImap.intervalLabel->setEnabled( state );
2066 void AccountDialog::slotEnableLocalInterval(
bool state )
2068 mLocal.intervalSpin->setEnabled( state );
2069 mLocal.intervalLabel->setEnabled( state );
2072 void AccountDialog::slotEnableMaildirInterval(
bool state )
2074 mMaildir.intervalSpin->setEnabled( state );
2075 mMaildir.intervalLabel->setEnabled( state );
2078 void AccountDialog::slotFontChanged(
void )
2080 TQString accountType = mAccount->type();
2081 if( accountType ==
"local" )
2083 TQFont titleFont( mLocal.titleLabel->font() );
2084 titleFont.setBold(
true );
2085 mLocal.titleLabel->setFont(titleFont);
2087 else if( accountType ==
"pop" )
2089 TQFont titleFont( mPop.titleLabel->font() );
2090 titleFont.setBold(
true );
2091 mPop.titleLabel->setFont(titleFont);
2093 else if( accountType ==
"imap" )
2095 TQFont titleFont( mImap.titleLabel->font() );
2096 titleFont.setBold(
true );
2097 mImap.titleLabel->setFont(titleFont);
2102 void AccountDialog::slotClearResourceAllocations()
2104 mAccount->clearIntervals();
2108 void AccountDialog::slotClearPastResourceAllocations()
2110 mAccount->clearOldIntervals();
2114 void AccountDialog::slotReloadNamespaces()
2116 if ( mAccount->type() ==
"imap" || mAccount->type() ==
"cachedimap" )
2118 initAccountForConnect();
2119 mImap.personalNS->setText( i18n(
"Fetching Namespaces...") );
2120 mImap.otherUsersNS->setText( TQString() );
2121 mImap.sharedNS->setText( TQString() );
2122 ImapAccountBase* ai =
static_cast<ImapAccountBase*
>( mAccount );
2123 connect( ai, TQ_SIGNAL( namespacesFetched(
const ImapAccountBase::nsDelimMap& ) ),
2124 this, TQ_SLOT( slotSetupNamespaces(
const ImapAccountBase::nsDelimMap& ) ) );
2125 connect( ai, TQ_SIGNAL( connectionResult(
int,
const TQString&) ),
2126 this, TQ_SLOT( slotConnectionResult(
int,
const TQString&) ) );
2127 ai->getNamespaces();
2131 void AccountDialog::slotConnectionResult(
int errorCode,
const TQString& )
2133 if ( errorCode > 0 ) {
2134 ImapAccountBase* ai =
static_cast<ImapAccountBase*
>( mAccount );
2135 disconnect( ai, TQ_SIGNAL( namespacesFetched(
const ImapAccountBase::nsDelimMap& ) ),
2136 this, TQ_SLOT( slotSetupNamespaces(
const ImapAccountBase::nsDelimMap& ) ) );
2137 disconnect( ai, TQ_SIGNAL( connectionResult(
int,
const TQString&) ),
2138 this, TQ_SLOT( slotConnectionResult(
int,
const TQString&) ) );
2139 mImap.personalNS->setText( TQString() );
2143 void AccountDialog::slotSetupNamespaces(
const ImapAccountBase::nsDelimMap& map )
2145 disconnect(
this, TQ_SLOT( slotSetupNamespaces(
const ImapAccountBase::nsDelimMap& ) ) );
2146 mImap.personalNS->setText( TQString() );
2147 mImap.otherUsersNS->setText( TQString() );
2148 mImap.sharedNS->setText( TQString() );
2151 ImapAccountBase::namespaceDelim ns = map[ImapAccountBase::PersonalNS];
2152 ImapAccountBase::namespaceDelim::ConstIterator it;
2153 if ( !ns.isEmpty() ) {
2154 mImap.personalNS->setText( namespaceListToString( ns.keys() ) );
2155 mImap.editPNS->setEnabled(
true );
2157 mImap.editPNS->setEnabled(
false );
2159 ns = map[ImapAccountBase::OtherUsersNS];
2160 if ( !ns.isEmpty() ) {
2161 mImap.otherUsersNS->setText( namespaceListToString( ns.keys() ) );
2162 mImap.editONS->setEnabled(
true );
2164 mImap.editONS->setEnabled(
false );
2166 ns = map[ImapAccountBase::SharedNS];
2167 if ( !ns.isEmpty() ) {
2168 mImap.sharedNS->setText( namespaceListToString( ns.keys() ) );
2169 mImap.editSNS->setEnabled(
true );
2171 mImap.editSNS->setEnabled(
false );
2175 const TQString AccountDialog::namespaceListToString(
const TQStringList& list )
2177 TQStringList myList = list;
2178 for ( TQStringList::Iterator it = myList.begin(); it != myList.end(); ++it ) {
2179 if ( (*it).isEmpty() ) {
2180 (*it) =
"<" + i18n(
"Empty") +
">";
2183 return myList.join(
",");
2186 void AccountDialog::initAccountForConnect()
2188 TQString type = mAccount->type();
2189 if ( type ==
"local" )
2192 NetworkAccount &na = *(NetworkAccount*)mAccount;
2194 if ( type ==
"pop" ) {
2195 na.setHost( mPop.hostEdit->text().stripWhiteSpace() );
2196 na.setPort( mPop.portEdit->text().toInt() );
2197 na.setLogin( mPop.loginEdit->text().stripWhiteSpace() );
2198 na.setStorePasswd( mPop.storePasswordCheck->isChecked() );
2199 na.setPasswd( mPop.passwordEdit->text(), na.storePasswd() );
2200 na.setUseSSL( mPop.encryptionSSL->isChecked() );
2201 na.setUseTLS( mPop.encryptionTLS->isChecked() );
2202 if (mPop.authUser->isChecked())
2204 else if (mPop.authLogin->isChecked())
2205 na.setAuth(
"LOGIN");
2206 else if (mPop.authPlain->isChecked())
2207 na.setAuth(
"PLAIN");
2208 else if (mPop.authCRAM_MD5->isChecked())
2209 na.setAuth(
"CRAM-MD5");
2210 else if (mPop.authDigestMd5->isChecked())
2211 na.setAuth(
"DIGEST-MD5");
2212 else if (mPop.authNTLM->isChecked())
2214 else if (mPop.authGSSAPI->isChecked())
2215 na.setAuth(
"GSSAPI");
2216 else if (mPop.authAPOP->isChecked())
2218 else na.setAuth(
"AUTO");
2220 else if ( type ==
"imap" || type ==
"cachedimap" ) {
2221 na.setHost( mImap.hostEdit->text().stripWhiteSpace() );
2222 na.setPort( mImap.portEdit->text().toInt() );
2223 na.setLogin( mImap.loginEdit->text().stripWhiteSpace() );
2224 na.setStorePasswd( mImap.storePasswordCheck->isChecked() );
2225 na.setPasswd( mImap.passwordEdit->text(), na.storePasswd() );
2226 na.setUseSSL( mImap.encryptionSSL->isChecked() );
2227 na.setUseTLS( mImap.encryptionTLS->isChecked() );
2228 if (mImap.authCramMd5->isChecked())
2229 na.setAuth(
"CRAM-MD5");
2230 else if (mImap.authDigestMd5->isChecked())
2231 na.setAuth(
"DIGEST-MD5");
2232 else if (mImap.authNTLM->isChecked())
2234 else if (mImap.authGSSAPI->isChecked())
2235 na.setAuth(
"GSSAPI");
2236 else if (mImap.authAnonymous->isChecked())
2237 na.setAuth(
"ANONYMOUS");
2238 else if (mImap.authLogin->isChecked())
2239 na.setAuth(
"LOGIN");
2240 else if (mImap.authPlain->isChecked())
2241 na.setAuth(
"PLAIN");
2242 else na.setAuth(
"*");
2246 void AccountDialog::slotEditPersonalNamespace()
2248 NamespaceEditDialog dialog(
this, ImapAccountBase::PersonalNS, &mImap.nsMap );
2249 if ( dialog.exec() == TQDialog::Accepted ) {
2250 slotSetupNamespaces( mImap.nsMap );
2254 void AccountDialog::slotEditOtherUsersNamespace()
2256 NamespaceEditDialog dialog(
this, ImapAccountBase::OtherUsersNS, &mImap.nsMap );
2257 if ( dialog.exec() == TQDialog::Accepted ) {
2258 slotSetupNamespaces( mImap.nsMap );
2262 void AccountDialog::slotEditSharedNamespace()
2264 NamespaceEditDialog dialog(
this, ImapAccountBase::SharedNS, &mImap.nsMap );
2265 if ( dialog.exec() == TQDialog::Accepted ) {
2266 slotSetupNamespaces( mImap.nsMap );
2270 NamespaceLineEdit::NamespaceLineEdit( TQWidget* parent )
2271 : KLineEdit( parent )
2275 void NamespaceLineEdit::setText(
const TQString& text )
2278 KLineEdit::setText( text );
2281 NamespaceEditDialog::NamespaceEditDialog( TQWidget *parent,
2282 ImapAccountBase::imapNamespace type, ImapAccountBase::nsDelimMap* map )
2283 : KDialogBase( parent,
"edit_namespace", false, TQString(),
2284 Ok|Cancel,
Ok, true ), mType( type ), mNamespaceMap( map )
2286 TQVBox *page = makeVBoxMainWidget();
2289 if ( mType == ImapAccountBase::PersonalNS ) {
2290 ns = i18n(
"Personal");
2291 }
else if ( mType == ImapAccountBase::OtherUsersNS ) {
2292 ns = i18n(
"Other Users");
2294 ns = i18n(
"Shared");
2296 setCaption( i18n(
"Edit Namespace '%1'").arg(ns) );
2297 TQGrid* grid =
new TQGrid( 2, page );
2299 mBg =
new TQButtonGroup( 0 );
2300 connect( mBg, TQ_SIGNAL( clicked(
int) ),
this, TQ_SLOT( slotRemoveEntry(
int) ) );
2301 mDelimMap = mNamespaceMap->find( mType ).data();
2302 ImapAccountBase::namespaceDelim::Iterator it;
2303 for ( it = mDelimMap.begin(); it != mDelimMap.end(); ++it ) {
2304 NamespaceLineEdit* edit =
new NamespaceLineEdit( grid );
2305 edit->setText( it.key() );
2306 TQToolButton* button =
new TQToolButton( grid );
2308 TDEGlobal::iconLoader()->loadIconSet(
"edit-delete", TDEIcon::Small, 0 ) );
2309 button->setAutoRaise(
true );
2310 button->setSizePolicy( TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ) );
2311 button->setFixedSize( 22, 22 );
2312 mLineEditMap[ mBg->insert( button ) ] = edit;
2316 void NamespaceEditDialog::slotRemoveEntry(
int id )
2318 if ( mLineEditMap.contains(
id ) ) {
2320 NamespaceLineEdit* edit = mLineEditMap[id];
2321 mDelimMap.remove( edit->text() );
2322 if ( edit->isModified() ) {
2323 mDelimMap.remove( edit->lastText() );
2325 mLineEditMap.remove(
id );
2328 if ( mBg->find(
id ) ) {
2330 delete mBg->find(
id );
2335 void NamespaceEditDialog::slotOk()
2337 TQMap<int, NamespaceLineEdit*>::Iterator it;
2338 for ( it = mLineEditMap.begin(); it != mLineEditMap.end(); ++it ) {
2339 NamespaceLineEdit* edit = it.data();
2340 if ( edit->isModified() ) {
2342 mDelimMap[edit->text()] = mDelimMap[edit->lastText()];
2343 mDelimMap.remove( edit->lastText() );
2346 mNamespaceMap->replace( mType, mDelimMap );
2347 KDialogBase::slotOk();
2352 #include "accountdialog.moc"
KMail list that manages the contents of one directory that may contain folders and/or other directori...
bool isSystemFolder() const
Returns true if the folder is a kmail system folder.
void remove()
Removes the folder physically from disk and empties the contents of the folder in memory.
TQString location() const
Returns full path to folder file.
@ Ok
The user rights/ACL have been fetched from the server sucessfully.