Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cc2c86af authored by Laurent Montel's avatar Laurent Montel 😁

Move AttachmentTemporaryFilesDirs to pimcommon.

parent 192520f4
......@@ -76,7 +76,6 @@ set(libmessageviewer_viewer_SRCS
viewer/htmlquotecolorer.cpp
viewer/mimetreemodel.cpp
viewer/nodehelper.cpp
viewer/attachmenttemporaryfilesdirs.cpp
viewer/objecttreeemptysource.cpp
viewer/objecttreeparser.cpp
viewer/objecttreeviewersource.cpp
......
......@@ -43,11 +43,6 @@ add_messageviewer_unittest( eventedittest.cpp )
add_messageviewer_unittest( eventdatetimewidgettest.cpp )
add_messageviewer_unittest( messagedisplayformatattributetest.cpp )
set( messageviewer_attachmentdirs_SRCS attachmenttemporaryfilesdirstest.cpp ../viewer/attachmenttemporaryfilesdirs.cpp)
kde4_add_unit_test( messageviewer_attachmentdirstest ${messageviewer_attachmentdirs_SRCS})
target_link_libraries( messageviewer_attachmentdirstest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS})
set( messageviewer_converthtmltoplaintext_SRCS converthtmltoplaintexttest.cpp ../viewer/converthtmltoplaintext.cpp)
kde4_add_unit_test( messageviewer_converthtmltoplaintext ${messageviewer_converthtmltoplaintext_SRCS})
target_link_libraries( messageviewer_converthtmltoplaintext ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} ${Grantlee_GUI_LIBRARIES})
......
......@@ -24,7 +24,7 @@
#include "partmetadata.h"
#include "interfaces/bodypart.h"
#include "utils/util.h"
#include "viewer/attachmenttemporaryfilesdirs.h"
#include "pimcommon/temporaryfile/attachmenttemporaryfilesdirs.h"
#include <messagecore/helpers/nodehelper.h>
#include <messagecore/utils/stringutil.h>
......@@ -56,7 +56,7 @@ QStringList replySubjPrefixes(QStringList() << QLatin1String("Re\\s*:") << QLati
QStringList forwardSubjPrefixes( QStringList() << QLatin1String("Fwd:") << QLatin1String("FW:"));
NodeHelper::NodeHelper() :
mAttachmentFilesDir(new AttachmentTemporaryFilesDirs())
mAttachmentFilesDir(new PimCommon::AttachmentTemporaryFilesDirs())
{
//TODO(Andras) add methods to modify these prefixes
......@@ -308,7 +308,7 @@ void NodeHelper::removeTempFiles()
{
//Don't delete it it will delete in class
mAttachmentFilesDir->removeTempFiles();
mAttachmentFilesDir = new AttachmentTemporaryFilesDirs();
mAttachmentFilesDir = new PimCommon::AttachmentTemporaryFilesDirs();
}
void NodeHelper::addTempFile( const QString& file )
......
......@@ -40,10 +40,13 @@ namespace MessageViewer {
}
}
namespace MessageViewer {
namespace PimCommon
{
class AttachmentTemporaryFilesDirs;
}
namespace MessageViewer {
/** Flags for the encryption state. */
typedef enum
{
......@@ -303,7 +306,7 @@ private:
QMap<QString, QMap<QByteArray, Interface::BodyPartMemento*> > mBodyPartMementoMap;
QMap<KMime::Content*, PartMetaData> mPartMetaDatas;
QMap<KMime::Message::Content*, QList<KMime::Content*> > mExtraContents;
AttachmentTemporaryFilesDirs *mAttachmentFilesDir;
PimCommon::AttachmentTemporaryFilesDirs *mAttachmentFilesDir;
};
}
......
......@@ -189,6 +189,10 @@ set(libpimcommon_util_SRCS
)
set(libpimcommon_temporary_SRCS
temporaryfile/attachmenttemporaryfilesdirs.cpp
)
set(libpimcommon_SRCS
settings/pimcommonsettings.cpp
${libpimcommon_util_SRCS}
......@@ -204,6 +208,7 @@ set(libpimcommon_SRCS
${libpimcommon_widgets_SRCS}
${libpimcommon_baloodebug_SRCS}
${libpimcommon_syntaxhighlighter_SRCS}
${libpimcommon_temporary_SRCS}
)
......
......@@ -25,7 +25,7 @@
#include <QTimer>
#include <QDebug>
using namespace MessageViewer;
using namespace PimCommon;
//10 secondes
static int DELETEAFTER = 10000;
......
......@@ -23,10 +23,11 @@
#include <QObject>
#include <QStringList>
#include "pimcommon_export.h"
namespace MessageViewer {
namespace PimCommon {
class AttachmentTemporaryFilesDirs : public QObject
class PIMCOMMON_EXPORT AttachmentTemporaryFilesDirs : public QObject
{
Q_OBJECT
public:
......
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
set( pimcommon_attachmentdirs_SRCS attachmenttemporaryfilesdirstest.cpp )
kde4_add_unit_test( pimcommon_attachmentdirstest ${pimcommon_attachmentdirs_SRCS})
target_link_libraries( pimcommon_attachmentdirstest ${QT_QTTEST_LIBRARY} ${KDE4_KDEUI_LIBS} pimcommon)
......@@ -19,9 +19,11 @@
*/
#include "attachmenttemporaryfilesdirstest.h"
#include "../viewer/attachmenttemporaryfilesdirs.h"
#include "../attachmenttemporaryfilesdirs.h"
#include <qtest_kde.h>
using PimCommon;
AttachmentTemporaryFilesDirsTest::AttachmentTemporaryFilesDirsTest(QObject *parent)
: QObject(parent)
{
......@@ -35,14 +37,14 @@ AttachmentTemporaryFilesDirsTest::~AttachmentTemporaryFilesDirsTest()
void AttachmentTemporaryFilesDirsTest::shouldHaveDefaultValue()
{
MessageViewer::AttachmentTemporaryFilesDirs attachmentDir;
AttachmentTemporaryFilesDirs attachmentDir;
QVERIFY(attachmentDir.temporaryFiles().isEmpty());
QVERIFY(attachmentDir.temporaryDirs().isEmpty());
}
void AttachmentTemporaryFilesDirsTest::shouldAddTemporaryFiles()
{
MessageViewer::AttachmentTemporaryFilesDirs attachmentDir;
AttachmentTemporaryFilesDirs attachmentDir;
attachmentDir.addTempFile(QLatin1String("foo"));
QCOMPARE(attachmentDir.temporaryFiles().count(), 1);
attachmentDir.addTempFile(QLatin1String("foo1"));
......@@ -51,7 +53,7 @@ void AttachmentTemporaryFilesDirsTest::shouldAddTemporaryFiles()
void AttachmentTemporaryFilesDirsTest::shouldAddTemporaryDirs()
{
MessageViewer::AttachmentTemporaryFilesDirs attachmentDir;
AttachmentTemporaryFilesDirs attachmentDir;
attachmentDir.addTempDir(QLatin1String("foo"));
QCOMPARE(attachmentDir.temporaryDirs().count(), 1);
attachmentDir.addTempDir(QLatin1String("foo1"));
......@@ -60,7 +62,7 @@ void AttachmentTemporaryFilesDirsTest::shouldAddTemporaryDirs()
void AttachmentTemporaryFilesDirsTest::shouldNotAddSameFiles()
{
MessageViewer::AttachmentTemporaryFilesDirs attachmentDir;
AttachmentTemporaryFilesDirs attachmentDir;
attachmentDir.addTempFile(QLatin1String("foo"));
QCOMPARE(attachmentDir.temporaryFiles().count(), 1);
attachmentDir.addTempFile(QLatin1String("foo"));
......@@ -69,7 +71,7 @@ void AttachmentTemporaryFilesDirsTest::shouldNotAddSameFiles()
void AttachmentTemporaryFilesDirsTest::shouldNotAddSameDirs()
{
MessageViewer::AttachmentTemporaryFilesDirs attachmentDir;
AttachmentTemporaryFilesDirs attachmentDir;
attachmentDir.addTempDir(QLatin1String("foo"));
QCOMPARE(attachmentDir.temporaryDirs().count(), 1);
attachmentDir.addTempDir(QLatin1String("foo"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment