Merge tests build system changes and util function from enterprise branch.

svn path=/branches/KDE/3.5/kdepim/; revision=766751
wilder-work
Till Adam 18 years ago
parent b77686f7b5
commit a2933decf8
  1. 7
      tests/Makefile.am
  2. 35
      util.h

@ -1,4 +1,4 @@
INCLUDES = -I$(top_srcdir)/kmail $(all_includes)
INCLUDES = -I$(top_srcdir)/kmail -I$(top_srcdir)/mimelib $(all_includes)
AM_CPPFLAGS = -DKDESRCDIR=\"$(srcdir)\"
METASOURCES = AUTO
@ -7,13 +7,14 @@ check_LTLIBRARIES = kunittest_storagelayermodule.la \
kunittest_mimelibmodule.la
kunittest_storagelayermodule_la_SOURCES = storagelayermodule.cpp messagedicttests.cpp ../kmdict.cpp
kunittest_storagelayermodule_la_LIBADD = -lkunittest
kunittest_utilmodule_la_SOURCES = utiltests.cpp ../util.cpp
kunittest_utilmodule_la_LIBADD = -lkunittest ../../mimelib/libmimelib.la
kunittest_mimelibmodule_la_SOURCES = mimelibtests.cpp ../util.cpp
kunittest_mimelibmodule_la_LIBADD = -lkunittest ../../mimelib/libmimelib.la
LIBADD = -lkunittest
LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
#LIBADD = -lkunittest
AM_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)
check-local:
kunittestmodrunner

@ -39,9 +39,17 @@
#define KMAILUTIL_H
#include <stdlib.h>
#include <qobject.h>
#include <qcstring.h>
#include <kio/netaccess.h>
#include <kmessagebox.h>
#include <klocale.h>
class DwString;
class KURL;
class QWidget;
namespace KMail
{
@ -60,7 +68,7 @@ namespace Util {
*/
size_t crlf2lf( char* str, const size_t strLen );
/**
* Convert "\n" line endings to "\r\n".
* @param src The source string to convert.
@ -161,11 +169,11 @@ namespace Util {
void insert( QByteArray& that, uint index, const char* s );
/**
/**
* A LaterDeleter is intended to be used with the RAII ( Resource
* Acquisition is Initialization ) paradigm. When an instance of it
* goes out of scope it deletes the associated object It can be
* disabled, in case the deletion needs to be avoided for some
* goes out of scope it deletes the associated object It can be
* disabled, in case the deletion needs to be avoided for some
* reason, since going out-of-scope cannot be avoided.
*/
class LaterDeleter
@ -189,6 +197,25 @@ namespace Util {
QObject *m_object;
bool m_disabled;
};
// return true if we should proceed, false if we should abort
inline bool checkOverwrite( const KURL& url, QWidget* w )
{
if ( KIO::NetAccess::exists( url, false /*dest*/, w ) ) {
if ( KMessageBox::Cancel ==
KMessageBox::warningContinueCancel(
w,
i18n( "A file named \"%1\" already exists. "
"Are you sure you want to overwrite it?" ).arg( url.prettyURL() ),
i18n( "Overwrite File?" ),
i18n( "&Overwrite" ) ) )
return false;
}
return true;
}
}
}

Loading…
Cancel
Save