From kmail-devel Mon Oct 30 08:05:41 2000 From: Espen Sand Date: Mon, 30 Oct 2000 08:05:41 +0000 To: kmail-devel Subject: Re: Kmail crashes by modifying a pop Account without a name X-MARC-Message: https://marc.info/?l=kmail-devel&m=97289879126140 On Sun, 29 Oct 2000, George Staikos wrote: > On Friday 27 October 2000 11:22, Johannes Pohl wrote: > > Kmail crashes if you want to modify an Pop Account where the name field was > > left blank. > > Confirmed - it's crashing in QMap::clear(). I'm thinking it would be a > good idea to require a name >= 1 character for this too. hi, I think the code below should not be used until the crash reason is removed. We should make the core more robust first instead of just hiding the problem I think. The general problem is that it is quite difficult to hide a problem 100%. Anyway here is the fix when saving pop account data. I only have a kde-20 branch at the moment (f* up my head branch) and I can't commit it because of the new message strings I added. Add it to the head version if you like but I think (as I said above) it is not the best to do in the long run. What should we do if one want to modify an accout that contains an empty name (because someone has manually edited the kmailrc file) ? .... (ps: the saveSettings() must be modified in "accountdialog.h" as well. It did not return bool before this fix) void AccountDialog::slotOk() { if( saveSettings() ) { accept(); } } bool AccountDialog::saveSettings() { QString accountType = mAccount->type(); if( accountType == "local" ) { // // The system can not handle empty name strings (espen 2000-10-30) // QString name = mLocal.nameEdit->text().stripWhiteSpace(); if( name.isEmpty() ) { QString msg = i18n("You must specify an account name"); KMessageBox::information( topLevelWidget(), msg, i18n("Save Account") ); return false; } mAccount->setName( name ); ((KMAcctLocal*)mAccount)->setLocation( mLocal.locationEdit->text() ); mAccount->setCheckInterval( mLocal.intervalCheck->isChecked() ? mLocal.intervalSpin->value() : 0 ); mAccount->setCheckExclude( mLocal.excludeCheck->isChecked() ); mAccount->setPrecommand( mLocal.precommand->text() ); KMFolder *folder = kernel->folderMgr()->find( mLocal.folderCombo->currentText() ); mAccount->setFolder( folder ); } else if( accountType == "pop" ) { // // The system can not handle empty name strings (espen 2000-10-30) // QString name = mPop.nameEdit->text().stripWhiteSpace(); if( name.isEmpty() ) { QString msg = i18n("You must specify an account name"); KMessageBox::information( topLevelWidget(), msg, i18n("Save Account") ); return false; } mAccount->setName( name ); mAccount->setCheckInterval( mPop.intervalCheck->isChecked() ? mPop.intervalSpin->value() : 0 ); mAccount->setCheckExclude( mPop.excludeCheck->isChecked() ); KMFolder *folder = kernel->folderMgr()->find( mPop.folderCombo->currentText() ); mAccount->setFolder( folder ); KMAcctExpPop &epa = *(KMAcctExpPop*)mAccount; epa.setHost( mPop.hostEdit->text() ); epa.setPort( mPop.portEdit->text().toInt() ); epa.setLogin( mPop.loginEdit->text() ); epa.setPasswd( mPop.passwordEdit->text(), true ); epa.setUseSSL( mPop.useSSLCheck->isChecked() ); epa.setStorePasswd( mPop.storePasswordCheck->isChecked() ); epa.setPasswd( mPop.passwordEdit->text(), epa.storePasswd() ); epa.setLeaveOnServer( !mPop.deleteMailCheck->isChecked() ); epa.setRetrieveAll( mPop.retriveAllCheck->isChecked() ); epa.setPrecommand( mPop.precommand->text() ); } kernel->acctMgr()->writeConfig(TRUE); return true; } -- Espen Sand _______________________________________________ Kmail Developers mailing list Kmail@master.kde.org http://master.kde.org/mailman/listinfo/kmail