Start adding feature for sending simple e-mails.
This commit is contained in:
parent
688198d666
commit
6cc4d8919d
@ -30,7 +30,7 @@
|
|||||||
<url type="donation">https://martinrotter.github.io/donate/</url>
|
<url type="donation">https://martinrotter.github.io/donate/</url>
|
||||||
<content_rating type="oars-1.1" />
|
<content_rating type="oars-1.1" />
|
||||||
<releases>
|
<releases>
|
||||||
<release version="3.5.9" date="2019-06-27"/>
|
<release version="3.5.9" date="2019-07-02"/>
|
||||||
</releases>
|
</releases>
|
||||||
<content_rating type="oars-1.0">
|
<content_rating type="oars-1.0">
|
||||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||||
|
@ -131,6 +131,7 @@ HEADERS += core/feeddownloader.h \
|
|||||||
services/gmail/gmailentrypoint.h \
|
services/gmail/gmailentrypoint.h \
|
||||||
services/gmail/gmailfeed.h \
|
services/gmail/gmailfeed.h \
|
||||||
services/gmail/gmailserviceroot.h \
|
services/gmail/gmailserviceroot.h \
|
||||||
|
services/gmail/gui/emailrecipientcontrol.h \
|
||||||
services/gmail/gui/formeditgmailaccount.h \
|
services/gmail/gui/formeditgmailaccount.h \
|
||||||
services/gmail/network/gmailnetworkfactory.h \
|
services/gmail/network/gmailnetworkfactory.h \
|
||||||
services/inoreader/definitions.h \
|
services/inoreader/definitions.h \
|
||||||
@ -269,6 +270,7 @@ SOURCES += core/feeddownloader.cpp \
|
|||||||
services/gmail/gmailentrypoint.cpp \
|
services/gmail/gmailentrypoint.cpp \
|
||||||
services/gmail/gmailfeed.cpp \
|
services/gmail/gmailfeed.cpp \
|
||||||
services/gmail/gmailserviceroot.cpp \
|
services/gmail/gmailserviceroot.cpp \
|
||||||
|
services/gmail/gui/emailrecipientcontrol.cpp \
|
||||||
services/gmail/gui/formeditgmailaccount.cpp \
|
services/gmail/gui/formeditgmailaccount.cpp \
|
||||||
services/gmail/network/gmailnetworkfactory.cpp \
|
services/gmail/network/gmailnetworkfactory.cpp \
|
||||||
services/inoreader/gui/formeditinoreaderaccount.cpp \
|
services/inoreader/gui/formeditinoreaderaccount.cpp \
|
||||||
|
@ -30,4 +30,11 @@
|
|||||||
#define GMAIL_CONTENT_TYPE_HTTP "application/http"
|
#define GMAIL_CONTENT_TYPE_HTTP "application/http"
|
||||||
#define GMAIL_CONTENT_TYPE_JSON "application/json"
|
#define GMAIL_CONTENT_TYPE_JSON "application/json"
|
||||||
|
|
||||||
|
enum class RecipientType {
|
||||||
|
To,
|
||||||
|
Cc,
|
||||||
|
Bcc,
|
||||||
|
ReplyTo
|
||||||
|
};
|
||||||
|
|
||||||
#endif // GMAIL_DEFINITIONS_H
|
#endif // GMAIL_DEFINITIONS_H
|
||||||
|
37
src/librssguard/services/gmail/gui/emailrecipientcontrol.cpp
Normal file
37
src/librssguard/services/gmail/gui/emailrecipientcontrol.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||||
|
|
||||||
|
#include "services/gmail/gui/emailrecipientcontrol.h"
|
||||||
|
|
||||||
|
#include "gui/plaintoolbutton.h"
|
||||||
|
#include "miscellaneous/application.h"
|
||||||
|
#include "miscellaneous/iconfactory.h"
|
||||||
|
#include "services/gmail/definitions.h"
|
||||||
|
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
EmailRecipientControl::EmailRecipientControl(const QString& recipient, QWidget* parent) : QWidget(parent) {
|
||||||
|
QHBoxLayout* lay = new QHBoxLayout(this);
|
||||||
|
|
||||||
|
lay->addWidget(m_cmbRecipientType = new QComboBox(this));
|
||||||
|
lay->addWidget(m_txtRecipient = new QLineEdit(this), 1);
|
||||||
|
lay->addWidget(m_btnCloseMe = new PlainToolButton(this));
|
||||||
|
lay->setMargin(0);
|
||||||
|
lay->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
m_btnCloseMe->setToolTip("Remove this recipient.");
|
||||||
|
m_btnCloseMe->setIcon(qApp->icons()->fromTheme(QSL("list-remove")));
|
||||||
|
|
||||||
|
connect(m_btnCloseMe, &PlainToolButton::clicked, this, &EmailRecipientControl::removalRequested);
|
||||||
|
|
||||||
|
m_cmbRecipientType->addItem(tr("To"), int(RecipientType::To));
|
||||||
|
m_cmbRecipientType->addItem(tr("Cc"), int(RecipientType::Cc));
|
||||||
|
m_cmbRecipientType->addItem(tr("Bcc"), int(RecipientType::Bcc));
|
||||||
|
m_cmbRecipientType->addItem(tr("Reply-to"), int(RecipientType::ReplyTo));
|
||||||
|
|
||||||
|
setTabOrder(m_cmbRecipientType, m_txtRecipient);
|
||||||
|
setTabOrder(m_txtRecipient, m_btnCloseMe);
|
||||||
|
|
||||||
|
setLayout(lay);
|
||||||
|
}
|
27
src/librssguard/services/gmail/gui/emailrecipientcontrol.h
Normal file
27
src/librssguard/services/gmail/gui/emailrecipientcontrol.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// For license of this file, see <project-root-folder>/LICENSE.md.
|
||||||
|
|
||||||
|
#ifndef EMAILRECIPIENTCONTROL_H
|
||||||
|
#define EMAILRECIPIENTCONTROL_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QComboBox;
|
||||||
|
class QLineEdit;
|
||||||
|
class PlainToolButton;
|
||||||
|
|
||||||
|
class EmailRecipientControl : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EmailRecipientControl(const QString& recipient, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void removalRequested();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QComboBox* m_cmbRecipientType;
|
||||||
|
QLineEdit* m_txtRecipient;
|
||||||
|
PlainToolButton* m_btnCloseMe;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EMAILRECIPIENTCONTROL_H
|
@ -2,12 +2,43 @@
|
|||||||
|
|
||||||
#include "services/gmail/gui/formaddeditemail.h"
|
#include "services/gmail/gui/formaddeditemail.h"
|
||||||
|
|
||||||
|
#include "miscellaneous/application.h"
|
||||||
|
#include "miscellaneous/iconfactory.h"
|
||||||
#include "services/gmail/gmailserviceroot.h"
|
#include "services/gmail/gmailserviceroot.h"
|
||||||
|
#include "services/gmail/gui/emailrecipientcontrol.h"
|
||||||
|
|
||||||
FormAddEditEmail::FormAddEditEmail(GmailServiceRoot* root, QWidget* parent) : QDialog(parent), m_root(root) {
|
FormAddEditEmail::FormAddEditEmail(GmailServiceRoot* root, QWidget* parent) : QDialog(parent), m_root(root) {
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
|
m_ui.m_layoutAdder->setMargin(0);
|
||||||
|
m_ui.m_layoutAdder->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
m_ui.m_btnAdder->setIcon(qApp->icons()->fromTheme(QSL("list-add")));
|
||||||
|
m_ui.m_btnAdder->setToolTip(tr("Add new recipient."));
|
||||||
|
|
||||||
|
connect(m_ui.m_btnAdder, &PlainToolButton::clicked, this, [=]() {
|
||||||
|
addRecipientRow();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormAddEditEmail::execForAdd() {
|
void FormAddEditEmail::execForAdd() {
|
||||||
|
addRecipientRow();
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FormAddEditEmail::removeRecipientRow() {
|
||||||
|
EmailRecipientControl* sndr = static_cast<EmailRecipientControl*>(sender());
|
||||||
|
|
||||||
|
m_ui.m_layout->takeRow(sndr);
|
||||||
|
m_recipientControls.removeOne(sndr);
|
||||||
|
|
||||||
|
sndr->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FormAddEditEmail::addRecipientRow(const QString& recipient) {
|
||||||
|
auto* mail_rec = new EmailRecipientControl(recipient, this);
|
||||||
|
|
||||||
|
connect(mail_rec, &EmailRecipientControl::removalRequested, this, &FormAddEditEmail::removeRecipientRow);
|
||||||
|
|
||||||
|
m_ui.m_layout->insertRow(m_ui.m_layout->indexOf(m_ui.m_txtMessage) - 1, mail_rec);
|
||||||
|
}
|
||||||
|
@ -12,6 +12,7 @@ namespace Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class GmailServiceRoot;
|
class GmailServiceRoot;
|
||||||
|
class EmailRecipientControl;
|
||||||
|
|
||||||
class FormAddEditEmail : public QDialog {
|
class FormAddEditEmail : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -22,10 +23,15 @@ class FormAddEditEmail : public QDialog {
|
|||||||
public slots:
|
public slots:
|
||||||
void execForAdd();
|
void execForAdd();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void removeRecipientRow();
|
||||||
|
void addRecipientRow(const QString& recipient = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GmailServiceRoot* m_root;
|
GmailServiceRoot* m_root;
|
||||||
|
|
||||||
Ui::FormAddEditEmail m_ui;
|
Ui::FormAddEditEmail m_ui;
|
||||||
|
QList<EmailRecipientControl*> m_recipientControls;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FORMADDEDITEMAIL_H
|
#endif // FORMADDEDITEMAIL_H
|
||||||
|
@ -1,42 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<author/>
|
|
||||||
<comment/>
|
|
||||||
<exportmacro/>
|
|
||||||
<class>FormAddEditEmail</class>
|
<class>FormAddEditEmail</class>
|
||||||
<widget name="FormAddEditEmail" class="QDialog">
|
<widget class="QDialog" name="FormAddEditEmail">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>552</width>
|
||||||
<height>300</height>
|
<height>491</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Write e-mail message</string>
|
||||||
</property>
|
</property>
|
||||||
<widget name="buttonBox" class="QDialogButtonBox">
|
<layout class="QFormLayout" name="m_layout">
|
||||||
<property name="geometry">
|
<item row="0" column="0">
|
||||||
<rect>
|
<widget class="QLabel" name="label">
|
||||||
<x>30</x>
|
<property name="text">
|
||||||
<y>240</y>
|
<string>From</string>
|
||||||
<width>341</width>
|
</property>
|
||||||
<height>32</height>
|
</widget>
|
||||||
</rect>
|
</item>
|
||||||
</property>
|
<item row="0" column="1">
|
||||||
<property name="orientation">
|
<widget class="QLineEdit" name="m_txtSender">
|
||||||
<enum>Qt::Horizontal</enum>
|
<property name="placeholderText">
|
||||||
</property>
|
<string>Name and address of this e-mail message sender</string>
|
||||||
<property name="standardButtons">
|
</property>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QTextEdit" name="m_txtMessage">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Contents of your e-mail message</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2">
|
||||||
|
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="m_layoutAdder">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="PlainToolButton" name="m_btnAdder">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<pixmapfunction/>
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>PlainToolButton</class>
|
||||||
|
<extends>QToolButton</extends>
|
||||||
|
<header>plaintoolbutton.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>m_buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>FormAddEditEmail</receiver>
|
<receiver>FormAddEditEmail</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
@ -52,7 +103,7 @@
|
|||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>m_buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>FormAddEditEmail</receiver>
|
<receiver>FormAddEditEmail</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user