Major config.h cleanup

svn path=/trunk/KDE/kdepim/; revision=624182
wilder-work
David Faure 19 years ago
parent 4fa5ad1262
commit b44c11c32c
  1. 2
      CMakeLists.txt
  2. 15
      configuredialog.cpp
  3. 4
      keyresolver.cpp
  4. 9
      kmmessage.cpp
  5. 15
      kmstartup.cpp

@ -1,5 +1,7 @@
project(kmail)
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(byteswap.h HAVE_BYTESWAP_H)
configure_file(config-kmail.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kmail.h )

@ -91,6 +91,7 @@ using KMime::DateFormatter;
#include <kconfig.h>
#include <kcmultidialog.h>
#include <knotifyconfigwidget.h>
#include <kresolver.h>
// Qt headers:
#include <QBoxLayout>
@ -1035,18 +1036,8 @@ void AccountsPage::SendingTab::doLoadOther() {
mConfirmSendCheck->setChecked(
composer.readEntry( "confirm-before-send", false ) );
QString str = general.readEntry( "Default domain" );
if( str.isEmpty() )
{
//### FIXME: Use the global convenience function instead of the homebrewed
// solution once we can rely on HEAD kdelibs.
//str = KGlobal::hostname(); ???????
char buffer[256];
if ( !gethostname( buffer, 255 ) )
// buffer need not be NUL-terminated if it has full length
buffer[255] = 0;
else
buffer[0] = 0;
str = QString::fromLatin1( *buffer ? buffer : "localhost" );
if( str.isEmpty() ) {
str = KNetwork::KResolver::localHostName();
}
mDefaultDomainEdit->setText( str );
}

@ -389,9 +389,7 @@ static QString canonicalAddress( const QString & _address ) {
const QString address = EmailAddressTools::extractEmailAddress( _address );
if ( !address.contains('@') ) {
// local address
//char hostname[1024];
//gethostname(hostname,1024);
//return address + '@' + hostname;
//return address + '@' + KNetwork::KResolver::localHostName();
return address + "@localdomain";
}
else

@ -40,6 +40,7 @@ using KMail::HeaderStrategy;
#include <khtml_part.h>
#include <kuser.h>
#include <kidna.h>
#include <kresolver.h>
#include <QList>
#include <QCursor>
@ -3740,15 +3741,9 @@ QString KMMessage::guessEmailAddressFromLoginName( const QString& loginName )
if ( loginName.isEmpty() )
return QString();
char hostnameC[256];
// null terminate this C string
hostnameC[255] = '\0';
// set the string to 0 length if gethostname fails
if ( gethostname( hostnameC, 255 ) )
hostnameC[0] = '\0';
QString address = loginName;
address += '@';
address += QString::fromLocal8Bit( hostnameC );
address += KNetwork::KResolver::localHostName();
// try to determine the real name
const KUser user( loginName );

@ -32,6 +32,7 @@
#include <kglobal.h>
#include <kaboutdata.h>
#include <kiconloader.h>
#include <kresolver.h>
#include <errno.h>
#include <sys/types.h>
@ -77,18 +78,6 @@ void kmsetSignalHandler(void (*handler)(int))
}
//-----------------------------------------------------------------------------
namespace {
QString getMyHostName() {
char hostNameC[256];
// null terminate this C string
hostNameC[255] = 0;
// set the string to 0 length if gethostname fails
if(gethostname(hostNameC, 255))
hostNameC[0] = 0;
return QString::fromLocal8Bit(hostNameC);
}
} // anon namespace
namespace KMail {
void checkConfigUpdates() {
@ -149,7 +138,7 @@ void lockOrDie() {
const QString oldHostName = config.readEntry("hostname");
const QString oldAppName = config.readEntry( "appName", appName );
const QString oldProgramName = config.readEntry( "programName", programName );
const QString hostName = getMyHostName();
const QString hostName = KNetwork::KResolver::localHostName();
bool first_instance = false;
if ( oldPid == -1 )
first_instance = true;

Loading…
Cancel
Save