[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdepim/kmail
From:       Matt Douhan <matt () fruitsalad ! org>
Date:       2005-05-01 9:55:07
Message-ID: 20050501095507.8DCF4635 () office ! kde ! org
[Download RAW message or body]

CVS commit by mdouhan: 

Sanity check the smtp hostname field to avoid empty hostnames, this is only
the beginning, several more tests will be added as time passes.

BUG:56535


  M +14 -0     kmtransport.cpp   1.49
  M +1 -0      kmtransport.h   1.14


--- kdepim/kmail/kmtransport.cpp  #1.48:1.49
@@ -780,7 +780,21 @@ void KMTransportDialog::slotSmtpCapabili
 }
 
+bool KMTransportDialog::sanityCheckSmtpInput()
+{
+  // FIXME: add additional checks for all fields that needs it
+  // this is only the beginning
+  if ( mSmtp.hostEdit->text().isEmpty() ) {
+    QString errorMsg = i18n(" The hostname field cannot be emtpy, please enter a \
valid hostname or IP address"); +    KMessageBox::sorry( this, errorMsg, \
i18n("Invalid Smtp hostname or address") ); +    return false;
+  }
+  return true;
+}
 
 void KMTransportDialog::slotOk()
 {
+  if( !sanityCheckSmtpInput() ) {
+    return;
+  }
   saveSettings();
   accept();

--- kdepim/kmail/kmtransport.h  #1.13:1.14
@@ -140,4 +140,5 @@ private:
   void checkHighest( QButtonGroup * );
   void enableAuthMethods( unsigned int which );
+  bool sanityCheckSmtpInput();
   static unsigned int authMethodsFromString( const QString & s );
   static unsigned int authMethodsFromStringList( const QStringList & sl );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic