Skip to content

Commit

Permalink
Merge pull request #286 from UDAAN-LEAP/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Sadam452 authored Aug 18, 2023
2 parents 5339443 + b8f0d7d commit b1da15e
Show file tree
Hide file tree
Showing 72 changed files with 52,185 additions and 240 deletions.
2 changes: 2 additions & 0 deletions FrameWorkCode/AppResources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
<file>Resources/comments.png</file>
<file>Resources/word-count-cropped.png</file>
<file>Resources/find-and-replace-cropped.png</file>
<file>Resources/pen.png</file>
<file>Resources/view.png</file>
</qresource>
<qresource prefix="/WordList">
<file>wordlists/english.txt</file>
Expand Down
Binary file added FrameWorkCode/Resources/pen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FrameWorkCode/Resources/view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 98 additions & 0 deletions FrameWorkCode/SimpleMail/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
set(simplemailqt_SRC
emailaddress.cpp
emailaddress_p.h
mimeattachment.cpp
mimecontentformatter.cpp
mimefile.cpp
mimehtml.cpp
mimeinlinefile.cpp
mimemessage.cpp
mimemessage_p.h
mimemultipart.cpp
mimemultipart_p.h
mimepart.cpp
mimepart_p.h
mimetext.cpp
quotedprintable.cpp
sender.cpp
sender_p.h
server.cpp
server_p.h
serverreply.cpp
serverreply_p.h
smtpexports.h
)

set(simplemailqt_HEADERS
emailaddress.h
mimeattachment.h
mimecontentformatter.h
mimefile.h
mimehtml.h
mimeinlinefile.h
mimemessage.h
mimemultipart.h
mimepart.h
mimetext.h
quotedprintable.h
sender.h
server.h
serverreply.h
smtpexports.h
SimpleMail
)

set(simplemailqt_HEADERS_PRIVATE
# common.h
)

add_library(SimpleMail2Qt5 SHARED
${simplemailqt_SRC}
${simplemailqt_HEADERS}
${simplemailqt_HEADERS_PRIVATE}
)

#Add an alias so that library can be used inside the build tree, e.g. when testing
add_library(SimpleMail${PROJECT_VERSION_MAJOR}Qt5::Core ALIAS SimpleMail2Qt5)

if (CMAKE_GENERATOR MATCHES "Visual Studio")
set_property(TARGET SimpleMail2Qt5 PROPERTY DEBUG_POSTFIX "d")
endif()

target_compile_definitions(SimpleMail2Qt5
PRIVATE
PLUGINS_PREFER_DEBUG_POSTFIX=$<CONFIG:Debug>
)

target_include_directories(SimpleMail2Qt5 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/simplemail2-qt5>
)

set_target_properties(SimpleMail2Qt5 PROPERTIES
EXPORT_NAME Core
VERSION ${PROJECT_VERSION}
SOVERSION 0
)

target_link_libraries(SimpleMail2Qt5
PUBLIC
Qt5::Core
Qt5::Network
)

set_property(TARGET SimpleMail2Qt5 PROPERTY PUBLIC_HEADER ${simplemailqt_HEADERS})
install(TARGETS SimpleMail2Qt5
EXPORT SimpleMailTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION bin COMPONENT runtime
ARCHIVE DESTINATION lib COMPONENT devel
PUBLIC_HEADER DESTINATION include/simplemail2-qt5/SimpleMail COMPONENT devel
)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simplemail-qt5.pc.in
${CMAKE_CURRENT_BINARY_DIR}/SimpleMail${PROJECT_VERSION_MAJOR}Qt5.pc
@ONLY
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SimpleMail${PROJECT_VERSION_MAJOR}Qt5.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
32 changes: 32 additions & 0 deletions FrameWorkCode/SimpleMail/SimpleMail
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright (c) 2011-2012 - Tőkés Attila

This file is part of SmtpClient for Qt.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

See the LICENSE file for more details.
*/
#ifndef SIMPLEMAIL_H
#define SIMPLEMAIL_H

#include "sender.h"
#include "mimepart.h"
#include "mimehtml.h"
#include "mimeattachment.h"
#include "mimemessage.h"
#include "mimetext.h"
#include "mimeinlinefile.h"
#include "mimefile.h"
#include "server.h"
#include "serverreply.h"

#endif // SIMPLEMAIL_H
90 changes: 90 additions & 0 deletions FrameWorkCode/SimpleMail/emailaddress.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
Copyright (c) 2011-2012 - Tőkés Attila
Copyright (C) 2015 Daniel Nicoletti <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
See the LICENSE file for more details.
*/

#include "emailaddress_p.h"

using namespace SimpleMail;

EmailAddress::EmailAddress() : d_ptr(new EmailAddressPrivate)
{

}

EmailAddress::EmailAddress(const EmailAddress &other) : d_ptr(other.d_ptr)
{

}

EmailAddress::EmailAddress(const QString &nameAndAddress) : d_ptr(new EmailAddressPrivate)
{
Q_D(EmailAddress);
int p1 = nameAndAddress.indexOf(QLatin1String("<"));
int p2 = nameAndAddress.indexOf(QLatin1String(">"));

if (p1 == -1) {
// no name, only email address
d->address = nameAndAddress;
} else {
d->address = nameAndAddress.mid(p1 + 1, p2 - p1 - 1);
d->name = nameAndAddress.left(p1);
}
}

EmailAddress::EmailAddress(const QString &address, const QString &name) : d_ptr(new EmailAddressPrivate)
{
Q_D(EmailAddress);
d->address = address;
d->name = name;
}

EmailAddress::~EmailAddress()
{
}

EmailAddress &EmailAddress::operator=(const EmailAddress &other)
{
d_ptr = other.d_ptr;
return *this;
}

void EmailAddress::setName(const QString &name)
{
Q_D(EmailAddress);
d->name = name;
}
void EmailAddress::setAddress(const QString &address)
{
Q_D(EmailAddress);
d->address = address;
}

EmailAddressPrivate *EmailAddress::d_func()
{
return d_ptr.data();
}

QString EmailAddress::name() const
{
Q_D(const EmailAddress);
return d->name;
}

QString EmailAddress::address() const
{
Q_D(const EmailAddress);
return d->address;
}
60 changes: 60 additions & 0 deletions FrameWorkCode/SimpleMail/emailaddress.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
Copyright (c) 2011-2012 - Tőkés Attila
Copyright (C) 2015 Daniel Nicoletti <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
See the LICENSE file for more details.
*/

#ifndef EMAILADDRESS_H
#define EMAILADDRESS_H

#include <QtCore/QSharedDataPointer>
#include <QString>

#include "smtpexports.h"

namespace SimpleMail {

class EmailAddressPrivate;
class SMTP_EXPORT EmailAddress
{
public:
EmailAddress();
EmailAddress(const EmailAddress &other);
EmailAddress(const QString &nameAndAddress);
EmailAddress(const QString &address, const QString &name);
virtual ~EmailAddress();

EmailAddress &operator=(const EmailAddress &other);

QString name() const;
void setName(const QString &name);

QString address() const;
void setAddress(const QString &address);

protected:
QSharedDataPointer<EmailAddressPrivate> d_ptr;

private:
// Q_DECLARE_PRIVATE equivalent for shared data pointers
EmailAddressPrivate* d_func();
inline const EmailAddressPrivate* d_func() const
{
return d_ptr.constData();
}
};

}

#endif // EMAILADDRESS_H
37 changes: 37 additions & 0 deletions FrameWorkCode/SimpleMail/emailaddress_p.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2015 Daniel Nicoletti <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

#ifndef EMAILADDRESS_P_H
#define EMAILADDRESS_P_H

#include "emailaddress.h"

namespace SimpleMail {

class EmailAddressPrivate : public QSharedData
{
public:
QString name;
QString address;
};

}

#endif // EMAILADDRESS_P_H

41 changes: 41 additions & 0 deletions FrameWorkCode/SimpleMail/mimeattachment.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright (c) 2011-2012 - Tőkés Attila
Copyright (C) 2015 Daniel Nicoletti <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
See the LICENSE file for more details.
*/

#include "mimeattachment.h"
#include "mimepart_p.h"

#include <QtCore/QFileInfo>

using namespace SimpleMail;

MimeAttachment::MimeAttachment(QFile *file) : MimeFile(file)
{
Q_D(MimePart);
const QString filename = QFileInfo(*file).fileName();
d->header.append("Content-Disposition: attachment; filename=\"" + filename.toLatin1() + "\"\r\n");
}

MimeAttachment::MimeAttachment(const QByteArray &stream, const QString &fileName): MimeFile(stream, fileName)
{
Q_D(MimePart);
d->header.append("Content-Disposition: attachment; filename=\"" + fileName.toLatin1() + "\"\r\n");
}

MimeAttachment::~MimeAttachment()
{

}
Loading

0 comments on commit b1da15e

Please sign in to comment.