kpilot Library API Documentation

setupDialog.cc

00001 /* setupDialog.cc KPilot 00002 ** 00003 ** Copyright (C) 1998-2001 Dan Pilone 00004 ** 00005 ** This file is part of the popmail conduit, a conduit for KPilot that 00006 ** synchronises the Pilot's email application with the outside world, 00007 ** which currently means: 00008 ** -- sendmail or SMTP for outgoing mail 00009 ** -- POP or mbox for incoming mail 00010 */ 00011 00012 /* 00013 ** This program is free software; you can redistribute it and/or modify 00014 ** it under the terms of the GNU General Public License as published by 00015 ** the Free Software Foundation; either version 2 of the License, or 00016 ** (at your option) any later version. 00017 ** 00018 ** This program is distributed in the hope that it will be useful, 00019 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 ** GNU General Public License for more details. 00022 ** 00023 ** You should have received a copy of the GNU General Public License 00024 ** along with this program in a file called COPYING; if not, write to 00025 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00026 ** MA 02111-1307, USA. 00027 */ 00028 00029 /* 00030 ** Bug reports and questions can be sent to kde-pim@kde.org 00031 */ 00032 // This is an old trick so you can determine what revisions 00033 // make up a binary distribution. 00034 // 00035 // 00036 static const char *setupDialog_id= 00037 "$Id: setupDialog.cc,v 1.45 2004/01/06 16:49:21 rnolden Exp $"; 00038 00039 #include "options.h" 00040 00041 00042 #include <sys/types.h> 00043 #include <sys/stat.h> 00044 #include <stdlib.h> 00045 00046 #include <kconfig.h> 00047 #include <kstddirs.h> 00048 #include <klineedit.h> 00049 00050 #include <qcheckbox.h> 00051 #include <qdir.h> 00052 #include <qcombobox.h> 00053 00054 #undef OLDSTYLE 00055 #ifdef OLDSTYLE 00056 #include <qlabel.h> 00057 #include <qwhatsthis.h> 00058 #include <qfiledlg.h> 00059 #include <qbttngrp.h> 00060 #include <qpushbutton.h> 00061 #include <qradiobt.h> 00062 #include <qlayout.h> 00063 #include <qvbuttongroup.h> 00064 #endif 00065 00066 #include "kfiledialog.h" 00067 00068 #include <kurlrequester.h> 00069 00070 #include "uiDialog.h" 00071 00072 #include "popmail-factory.h" 00073 #include "setup-dialog.h" 00074 #include "setupDialog.moc" 00075 00076 #if 0 00077 PopMailSendPage::PopMailSendPage(QWidget *parent) : 00078 QWidget(parent,"SendMail") 00079 { 00080 FUNCTIONSETUP; 00081 QGridLayout *grid=new QGridLayout(this,6,3,SPACING); 00082 QLabel *currentLabel; 00083 00084 sendGroup=new QVButtonGroup(i18n("Send Method"), 00085 this,"sb"); 00086 00087 fNoSend=new QRadioButton(i18n("&Do not send mail"),sendGroup); 00088 fSendmail=new QRadioButton(i18n("Use &sendmail"),sendGroup); 00089 fSMTP=new QRadioButton(i18n("Use S&MTP"),sendGroup); 00090 fKMail=new QRadioButton(i18n("Use &KMail"),sendGroup); 00091 00092 connect(fNoSend,SIGNAL(clicked()), 00093 this,SLOT(toggleMode())); 00094 connect(fSMTP,SIGNAL(clicked()), 00095 this,SLOT(toggleMode())); 00096 connect(fSendmail,SIGNAL(clicked()), 00097 this,SLOT(toggleMode())); 00098 connect(fKMail,SIGNAL(clicked()), 00099 this,SLOT(toggleMode())); 00100 00101 sendGroup->adjustSize(); 00102 00103 grid->addMultiCellWidget(sendGroup,0,0,0,2); 00104 00105 00106 //----------------------------------------------- 00107 // 00108 // Sending mail options. 00109 // 00110 currentLabel = new QLabel(i18n("Email address: "), 00111 this); 00112 00113 fEmailFrom = new QLineEdit(this); 00114 fEmailFrom->resize(200, fEmailFrom->height()); 00115 00116 grid->addWidget(currentLabel,1,0); 00117 grid->addWidget(fEmailFrom,1,1); 00118 00119 currentLabel = new QLabel(i18n("Signature file: "), 00120 this); 00121 currentLabel->adjustSize(); 00122 00123 fSignature = new QLineEdit(this); 00124 fSignature->resize(200, fSignature->height()); 00125 00126 fSignatureBrowse=new QPushButton(i18n("Browse..."),this); 00127 fSignatureBrowse->adjustSize(); 00128 00129 connect(fSignatureBrowse,SIGNAL(clicked()), 00130 this,SLOT(browseSignature())); 00131 00132 grid->addWidget(currentLabel,2,0); 00133 grid->addWidget(fSignature,2,1); 00134 grid->addWidget(fSignatureBrowse,2,2); 00135 00136 currentLabel = new QLabel(i18n("Sendmail command:"), this); 00137 currentLabel->adjustSize(); 00138 00139 fSendmailCmd = new QLineEdit(this); 00140 fSendmailCmd->resize(300, fSendmailCmd->height()); 00141 00142 grid->addWidget(currentLabel,4,0); 00143 grid->addWidget(fSendmailCmd,4,1); 00144 00145 currentLabel = new QLabel(i18n("SMTP server:"), this); 00146 currentLabel->adjustSize(); 00147 00148 fSMTPServer = new QLineEdit(this); 00149 fSMTPServer->resize(200, fSendmailCmd->height()); 00150 00151 grid->addWidget(currentLabel,6,0); 00152 grid->addWidget(fSMTPServer,6,1); 00153 00154 currentLabel = new QLabel(i18n("SMTP port:"), this); 00155 currentLabel->adjustSize(); 00156 00157 fSMTPPort = new QLineEdit(this); 00158 fSMTPPort->resize(200, fSendmailCmd->height()); 00159 00160 grid->addWidget(currentLabel,7,0); 00161 grid->addWidget(fSMTPPort,7,1); 00162 00163 currentLabel = new QLabel(i18n("Firewall:"), this); 00164 currentLabel->adjustSize(); 00165 00166 fFirewallFQDN = new QLineEdit(this); 00167 fFirewallFQDN->resize(200, fSendmailCmd->height()); 00168 00169 grid->addWidget(currentLabel,9,0); 00170 grid->addWidget(fFirewallFQDN,9,1); 00171 00172 fKMailSendImmediate = new QCheckBox( 00173 i18n("Send mail through KMail immediately"), 00174 this); 00175 grid->addRowSpacing(10,SPACING); 00176 grid->addWidget(fKMailSendImmediate,11,1); 00177 QWhatsThis::add(fKMailSendImmediate, 00178 i18n("<qt>Check this box if you want the conduit " 00179 "to send all items in the outbox as soon " 00180 "as it is done, as if you clicked KMail's " 00181 "File->Send Queued menu item.</qt>")); 00182 00183 00184 00185 (void) setupDialog_id; 00186 } 00187 00188 void PopMailSendPage::readSettings(KConfig &config) 00189 { 00190 fEmailFrom->setText(config.readEntry("EmailAddress", CSL1("$USER"))); 00191 fSignature->setText(config.readPathEntry("Signature")); 00192 fSendmailCmd->setText(config.readPathEntry("SendmailCmd", 00193 CSL1("/usr/lib/sendmail -t -i"))); 00194 fSMTPServer->setText(config.readEntry("SMTPServer", CSL1("mail"))); 00195 fSMTPPort->setText(QString::number(config.readNumEntry("SMTPPort", 25))); 00196 fFirewallFQDN->setText(config.readEntry("explicitDomainName", CSL1("$MAILDOMAIN"))); 00197 fKMailSendImmediate->setChecked(config.readBoolEntry("SendImmediate", 00198 true)); 00199 setMode(SendMode(config.readNumEntry(PopMailConduitFactory::syncOutgoing,SEND_NONE))); 00200 } 00201 00202 /* virtual */ int PopMailSendPage::commitChanges(KConfig& config) 00203 { 00204 FUNCTIONSETUP; 00205 00206 #if 0 00207 if (parentSetup->queryFile(i18n("Signature File %1 is missing."), 00208 fSignature->text())!=KMessageBox::No) 00209 #endif 00210 00211 { 00212 config.writePathEntry("Signature", fSignature->text()); 00213 } 00214 00215 config.writeEntry("EmailAddress", fEmailFrom->text()); 00216 00217 00218 config.writePathEntry("SendmailCmd", fSendmailCmd->text()); 00219 config.writeEntry("SMTPServer", fSMTPServer->text()); 00220 config.writeEntry("SMTPPort", fSMTPPort->text()); 00221 config.writeEntry("explicitDomainName", fFirewallFQDN->text()); 00222 00223 config.writeEntry(PopMailConduitFactory::syncOutgoing, (int)getMode()); 00224 00225 config.writeEntry("SendImmediate", fKMailSendImmediate->isChecked()); 00226 return 0; 00227 } 00228 00229 00230 /* slot */ void PopMailSendPage::toggleMode() 00231 { 00232 if (fNoSend->isChecked()) setMode(SEND_NONE); 00233 if (fSendmail->isChecked()) setMode(SEND_SENDMAIL); 00234 if (fSMTP->isChecked()) setMode(SEND_SMTP); 00235 if (fKMail->isChecked()) setMode(SEND_KMAIL); 00236 } 00237 00238 void PopMailSendPage::setMode(SendMode m) 00239 { 00240 FUNCTIONSETUP; 00241 00242 switch(m) 00243 { 00244 case SEND_SENDMAIL : 00245 fSendmailCmd->setEnabled(true); 00246 fSMTPServer->setEnabled(false); 00247 fSMTPPort->setEnabled(false); 00248 fKMailSendImmediate->setEnabled(false); 00249 fSendmail->setChecked(true); 00250 break; 00251 case SEND_SMTP : 00252 fSendmailCmd->setEnabled(false); 00253 fSMTPServer->setEnabled(true); 00254 fSMTPPort->setEnabled(true); 00255 fKMailSendImmediate->setEnabled(false); 00256 fSMTP->setChecked(true); 00257 break; 00258 case SEND_KMAIL : 00259 fSendmailCmd->setEnabled(false); 00260 fSMTPServer->setEnabled(false); 00261 fSMTPPort->setEnabled(false); 00262 fKMailSendImmediate->setEnabled(true); 00263 fKMail->setChecked(true); 00264 break; 00265 case SEND_NONE : 00266 fSendmailCmd->setEnabled(false); 00267 fSMTPServer->setEnabled(false); 00268 fSMTPPort->setEnabled(false); 00269 fKMailSendImmediate->setEnabled(false); 00270 fNoSend->setChecked(true); 00271 break; 00272 default : 00273 kdWarning() << k_funcinfo 00274 << ": Unknown mode " 00275 << (int) m 00276 << endl; 00277 return; 00278 } 00279 00280 fMode=m; 00281 } 00282 00283 00284 00285 00286 void PopMailSendPage::browseSignature() 00287 { 00288 FUNCTIONSETUP; 00289 00290 QString filename=fSignature->text(); 00291 00292 #ifdef DEBUG 00293 { 00294 DEBUGCONDUIT << fname << ": Signature currently " 00295 << fSignature->text() << endl; 00296 } 00297 #endif 00298 00299 if (filename.isEmpty()) 00300 { 00301 filename=QDir::currentDirPath(); 00302 } 00303 else 00304 { 00305 filename=QFileInfo( filename ).dirPath(); 00306 } 00307 00308 filename = KFileDialog::getOpenFileName(filename,CSL1("*")); 00309 00310 #ifdef DEBUG 00311 { 00312 DEBUGCONDUIT << fname << ": Signature selected " 00313 << filename << endl; 00314 } 00315 #endif 00316 00317 if (!filename.isEmpty()) 00318 { 00319 fSignature->setText(filename); 00320 } 00321 } 00322 00323 00324 00325 PopMailReceivePage::PopMailReceivePage(QWidget *parent) : 00326 QWidget(parent,"RecvMail") 00327 { 00328 FUNCTIONSETUP; 00329 QLabel *currentLabel; 00330 QGridLayout *grid=new QGridLayout(this,8,3,SPACING); 00331 00332 methodGroup=new QVButtonGroup(i18n("Retrieve Method"), 00333 this,"bg"); 00334 00335 fNoReceive=new QRadioButton(i18n("Do &not receive mail"), 00336 methodGroup); 00337 fReceivePOP=new QRadioButton(i18n("Use &POP3 server"), 00338 methodGroup); 00339 fReceiveUNIX=new QRadioButton(i18n("Use &UNIX mailbox"), 00340 methodGroup); 00341 00342 connect(fNoReceive,SIGNAL(clicked()), 00343 this,SLOT(toggleMode())); 00344 connect(fReceivePOP,SIGNAL(clicked()), 00345 this,SLOT(toggleMode())); 00346 connect(fReceiveUNIX,SIGNAL(clicked()), 00347 this,SLOT(toggleMode())); 00348 methodGroup->adjustSize(); 00349 00350 00351 grid->addMultiCellWidget(methodGroup,0,0,0,2); 00352 00353 currentLabel = new QLabel(i18n("UNIX mailbox:"),this); 00354 currentLabel->adjustSize(); 00355 00356 fMailbox=new QLineEdit(this); 00357 fMailbox->resize(200,fMailbox->height()); 00358 00359 fMailboxBrowse=new QPushButton(i18n("Browse..."),this); 00360 fMailboxBrowse->adjustSize(); 00361 00362 connect(fMailboxBrowse,SIGNAL(clicked()), 00363 this,SLOT(browseMailbox())); 00364 00365 grid->addWidget(currentLabel,1,0); 00366 grid->addWidget(fMailbox,1,1); 00367 grid->addWidget(fMailboxBrowse,1,2); 00368 00369 //----------------------------------------------- 00370 // 00371 // Receiving mail options. 00372 // 00373 00374 currentLabel = new QLabel(i18n("POP server:"), this); 00375 currentLabel->adjustSize(); 00376 00377 fPopServer = new QLineEdit(this); 00378 fPopServer->resize(200, fPopServer->height()); 00379 00380 grid->addWidget(currentLabel,3,0); 00381 grid->addWidget(fPopServer,3,1); 00382 00383 currentLabel = new QLabel(i18n("POP port:"), this); 00384 currentLabel->adjustSize(); 00385 00386 fPopPort = new QLineEdit(this); 00387 fPopPort->resize(200, fPopPort->height()); 00388 00389 grid->addWidget(currentLabel,4,0); 00390 grid->addWidget(fPopPort,4,1); 00391 00392 currentLabel = new QLabel(i18n("POP username:"), this); 00393 currentLabel->adjustSize(); 00394 00395 fPopUser = new QLineEdit(this); 00396 fPopUser->resize(200, fPopUser->height()); 00397 00398 grid->addWidget(currentLabel,5,0); 00399 grid->addWidget(fPopUser,5,1); 00400 00401 fLeaveMail = new QCheckBox(i18n("&Leave mail on server"), this); 00402 fLeaveMail->adjustSize(); 00403 00404 grid->addWidget(fLeaveMail,6,1); 00405 00406 currentLabel = new QLabel(i18n("POP password:"), this); 00407 currentLabel->adjustSize(); 00408 00409 fPopPass = new QLineEdit(this); 00410 fPopPass->setEchoMode(QLineEdit::Password); 00411 fPopPass->resize(200, fPopPass->height()); 00412 00413 00414 grid->addWidget(currentLabel,7,0); 00415 grid->addWidget(fPopPass,7,1); 00416 00417 00418 fStorePass = new QCheckBox(i18n("Save &POP password"), this); 00419 connect(fStorePass, SIGNAL(clicked()), this, SLOT(togglePopPass())); 00420 fStorePass->adjustSize(); 00421 togglePopPass(); 00422 00423 grid->addWidget(fStorePass,8,1); 00424 00425 } 00426 00427 void PopMailReceivePage::readSettings(KConfig &config) 00428 { 00429 FUNCTIONSETUP; 00430 00431 QString defaultMailbox; 00432 char *u=getenv("USER"); 00433 if (u==0L) 00434 { 00435 u=getenv("HOME"); 00436 if (u==0L) 00437 { 00438 defaultMailbox=CSL1("mbox"); 00439 } 00440 else 00441 { 00442 defaultMailbox=QString::fromLocal8Bit(u)+CSL1("mbox"); 00443 } 00444 } 00445 else 00446 { 00447 defaultMailbox=CSL1("/var/spool/mail/")+QString::fromLocal8Bit(u); 00448 } 00449 00450 fMailbox->setText(config.readEntry("UNIX Mailbox",defaultMailbox)); 00451 fPopServer->setText(config.readEntry("PopServer", CSL1("pop"))); 00452 fPopPort->setText(config.readEntry("PopPort", CSL1("110"))); 00453 fPopUser->setText(config.readEntry("PopUser", CSL1("$USER"))); 00454 fLeaveMail->setChecked(config.readNumEntry("LeaveMail", 1)); 00455 fPopPass->setText(config.readEntry("PopPass")); 00456 fPopPass->setEnabled(config.readNumEntry("StorePass", 0)); 00457 fStorePass->setChecked(config.readNumEntry("StorePass", 0)); 00458 setMode(RetrievalMode( 00459 config.readNumEntry(PopMailConduitFactory::syncIncoming,RECV_NONE))); 00460 } 00461 00462 /* virtual */ int PopMailReceivePage::commitChanges(KConfig& config) 00463 { 00464 FUNCTIONSETUP; 00465 config.writeEntry("UNIX Mailbox", fMailbox->text()); 00466 00467 config.writeEntry("PopServer", fPopServer->text().latin1()); 00468 config.writeEntry("PopPort", atoi(fPopPort->text().latin1())); 00469 config.writeEntry("PopUser", fPopUser->text().latin1()); 00470 config.writeEntry("LeaveMail", (int)fLeaveMail->isChecked()); 00471 config.writeEntry("StorePass", (int)fStorePass->isChecked()); 00472 config.sync(); 00473 // 00474 // Make sure permissions are safe (still not a good idea) 00475 // 00476 if(fStorePass->isChecked()) 00477 { 00478 chmod(KGlobal::dirs()->findResource("config", CSL1("kpilotrc")) 00479 .latin1(), 0600); 00480 config.writeEntry("PopPass", fPopPass->text()); 00481 } 00482 else 00483 { 00484 config.writeEntry("PopPass",QString::null); 00485 } 00486 00487 config.writeEntry(PopMailConduitFactory::syncIncoming, (int)getMode()); 00488 config.sync(); 00489 00490 return 0; 00491 } 00492 00493 /* slot */ void PopMailReceivePage::toggleMode() 00494 { 00495 if (fNoReceive->isChecked()) setMode(RECV_NONE); 00496 if (fReceivePOP->isChecked()) setMode(RECV_POP); 00497 if (fReceiveUNIX->isChecked()) setMode(RECV_UNIX); 00498 } 00499 00500 void PopMailReceivePage::setMode(RetrievalMode m) 00501 { 00502 FUNCTIONSETUP; 00503 00504 switch(m) 00505 { 00506 case RECV_NONE : 00507 fMailbox->setEnabled(false); 00508 fPopServer->setEnabled(false); 00509 fPopPort->setEnabled(false); 00510 fPopUser->setEnabled(false); 00511 fLeaveMail->setEnabled(false); 00512 fStorePass->setEnabled(false); 00513 fPopPass->setEnabled(false); 00514 fNoReceive->setChecked(true); 00515 break; 00516 case RECV_POP : 00517 fMailbox->setEnabled(false); 00518 fPopServer->setEnabled(true); 00519 fPopPort->setEnabled(true); 00520 fPopUser->setEnabled(true); 00521 fLeaveMail->setEnabled(true); 00522 fStorePass->setEnabled(true); 00523 togglePopPass(); 00524 fReceivePOP->setChecked(true); 00525 break; 00526 case RECV_UNIX : 00527 fMailbox->setEnabled(true); 00528 fPopServer->setEnabled(false); 00529 fPopPort->setEnabled(false); 00530 fPopUser->setEnabled(false); 00531 fLeaveMail->setEnabled(false); 00532 fStorePass->setEnabled(false); 00533 fPopPass->setEnabled(false); 00534 fReceiveUNIX->setChecked(true); 00535 break; 00536 default : 00537 kdWarning() << k_funcinfo 00538 << ": Unknown mode " << (int) m 00539 << endl; 00540 return; 00541 } 00542 00543 fMode=m; 00544 } 00545 00546 /* slot */ void PopMailReceivePage::browseMailbox() 00547 { 00548 FUNCTIONSETUP; 00549 00550 QString filename=fMailbox->text(); 00551 00552 #ifdef DEBUG 00553 { 00554 DEBUGCONDUIT << fname << ": Mailbox currently " 00555 << fMailbox->text() << endl; 00556 } 00557 #endif 00558 00559 if (filename.isEmpty()) 00560 { 00561 filename=QDir::currentDirPath(); 00562 } 00563 else 00564 { 00565 filename=QFileInfo( filename ).dirPath(); 00566 } 00567 00568 filename = KFileDialog::getOpenFileName(filename,CSL1("*")); 00569 00570 #ifdef DEBUG 00571 { 00572 DEBUGCONDUIT << fname << ": Mailbox selected " 00573 << filename << endl; 00574 } 00575 #endif 00576 00577 if (!filename.isEmpty()) 00578 { 00579 fMailbox->setText(filename); 00580 } 00581 } 00582 00583 void PopMailReceivePage::togglePopPass() 00584 { 00585 FUNCTIONSETUP; 00586 00587 if(fStorePass->isChecked()) 00588 { 00589 fPopPass->setEnabled(true); 00590 } 00591 else 00592 { 00593 fPopPass->setEnabled(false); 00594 } 00595 } 00596 #endif 00597 00598 00599 PopMailWidgetConfig::PopMailWidgetConfig(QWidget *p,const char *n) : 00600 ConduitConfigBase(p,n), 00601 fConfigWidget(new PopMailWidget(p,"PopMailWidget")) 00602 { 00603 FUNCTIONSETUP; 00604 fConduitName = i18n("Popmail"); 00605 UIDialog::addAboutPage(fConfigWidget->fTabWidget,PopMailConduitFactory::about()); 00606 fWidget=fConfigWidget; 00607 00608 #define CM(a,b) connect(fConfigWidget->a,b,this,SLOT(modified())); 00609 CM(fStorePass,SIGNAL(toggled(bool))); 00610 CM(fPopPass,SIGNAL(textChanged(const QString &))); 00611 CM(fRecvMode,SIGNAL(activated(int))); 00612 CM(fSendMode,SIGNAL(activated(int))); 00613 #undef CM 00614 00615 connect(fConfigWidget->fStorePass,SIGNAL(toggled(bool)), 00616 fConfigWidget->fPopPass,SLOT(setEnabled(bool))); 00617 connect(fConfigWidget->fRecvMode,SIGNAL(activated(int)), 00618 this,SLOT(toggleRecvMode(int))); 00619 connect(fConfigWidget->fSendMode,SIGNAL(activated(int)), 00620 this,SLOT(toggleSendMode(int))); 00621 } 00622 00623 void PopMailWidgetConfig::commit(KConfig *fConfig) 00624 { 00625 FUNCTIONSETUP; 00626 KConfigGroupSaver s(fConfig,PopMailConduitFactory::group()); 00627 #define WR(a,b,c) fConfig->writeEntry(c,fConfigWidget->a->b); 00628 WR(fSendMode,currentItem(),PopMailConduitFactory::syncIncoming()); 00629 WR(fEmailFrom,text(),"EmailAddress"); 00630 WR(fSignature,url(),"Signature"); 00631 WR(fLeaveMail,isChecked(),"LeaveMail"); 00632 #undef WR 00633 } 00634 00635 void PopMailWidgetConfig::load(KConfig *fConfig) 00636 { 00637 FUNCTIONSETUP; 00638 KConfigGroupSaver s(fConfig,PopMailConduitFactory::group()); 00639 #define RD(a,b,c,d,e) fConfigWidget->a->b(fConfig->read##c##Entry(d,e)) 00640 RD(fSendMode,setCurrentItem,Num,PopMailConduitFactory::syncIncoming(),(int)NoSend); 00641 RD(fEmailFrom,setText,,"EmailAddress",QString::null); 00642 RD(fSignature,setURL,,"Signature",CSL1("$HOME/.signature")); 00643 RD(fLeaveMail,setChecked,Bool,"LeaveMail",true); 00644 #undef RD 00645 00651 fConfigWidget->fSendMode->setCurrentItem(3); 00652 fConfigWidget->fRecvMode->setCurrentItem(0); 00653 00654 toggleSendMode(fConfigWidget->fSendMode->currentItem()); 00655 toggleRecvMode(fConfigWidget->fRecvMode->currentItem()); 00656 } 00657 00658 00659 /* slot */ void PopMailWidgetConfig::toggleRecvMode(int i) 00660 { 00661 FUNCTIONSETUP; 00662 #ifdef DEBUG 00663 DEBUGCONDUIT << fname << ": Got mode " << i << endl; 00664 #endif 00665 00666 #define E(a,b) fConfigWidget->a->setEnabled(b) 00667 switch(i) 00668 { 00669 case RecvPOP : 00670 E(fPopPass,true); 00671 E(fStorePass,true); 00672 E(fPopServer,true); 00673 E(fPopUser,true); 00674 E(fLeaveMail,true); 00675 E(fMailbox,false); 00676 break; 00677 case RecvMBOX : 00678 E(fPopPass,false); 00679 E(fStorePass,false); 00680 E(fPopServer,false); 00681 E(fPopUser,false); 00682 E(fLeaveMail,false); 00683 E(fMailbox,true); 00684 break; 00685 case NoRecv : /* FALLTHRU */ 00686 default : 00687 E(fPopPass,false); 00688 E(fStorePass,false); 00689 E(fPopServer,false); 00690 E(fPopUser,false); 00691 E(fLeaveMail,false); 00692 E(fMailbox,false); 00693 break; 00694 } 00695 #undef E 00696 } 00697 00698 /* slot */ void PopMailWidgetConfig::toggleSendMode(int i) 00699 { 00700 FUNCTIONSETUP; 00701 #ifdef DEBUG 00702 DEBUGCONDUIT << fname << ": Got mode " << i << endl; 00703 #endif 00704 00705 #define E(a,b) fConfigWidget->a->setEnabled(b) 00706 switch(i) 00707 { 00708 case SendKMail : 00709 E(fEmailFrom,true); 00710 E(fSignature,true); 00711 E(fSMTPServer,false); 00712 E(fSendmailCmd,false); 00713 break; 00714 case SendSMTP : 00715 E(fEmailFrom,true); 00716 E(fSignature,true); 00717 E(fSMTPServer,true); 00718 E(fSendmailCmd,false); 00719 break; 00720 case SendSendmail : 00721 E(fEmailFrom,true); 00722 E(fSignature,true); 00723 E(fSMTPServer,false); 00724 E(fSendmailCmd,true); 00725 break; 00726 case NoSend : /* FALLTHRU */ 00727 default : 00728 E(fEmailFrom,false); 00729 E(fSignature,false); 00730 E(fSMTPServer,false); 00731 E(fSendmailCmd,false); 00732 break; 00733 } 00734 #undef E 00735 } 00736 00737 00738
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003