mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Send by email
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
#include "pdffont.h"
|
||||
#include "pdfitemmodels.h"
|
||||
#include "pdfutils.h"
|
||||
#include "pdfsendmail.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
@ -665,6 +666,7 @@ void PDFViewerMainWindow::updateUI(bool fullUpdate)
|
||||
}
|
||||
|
||||
ui->actionProperties->setEnabled(m_pdfDocument);
|
||||
ui->actionSend_by_E_Mail->setEnabled(m_pdfDocument);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -714,6 +716,7 @@ void PDFViewerMainWindow::openDocument(const QString& fileName)
|
||||
closeDocument();
|
||||
|
||||
QFileInfo fileInfo(fileName);
|
||||
m_fileInfo.originalFileName = fileName;
|
||||
m_fileInfo.fileName = fileInfo.fileName();
|
||||
m_fileInfo.path = fileInfo.path();
|
||||
m_fileInfo.fileSize = fileInfo.size();
|
||||
@ -932,4 +935,20 @@ void PDFViewerMainWindow::on_actionAbout_triggered()
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void PDFViewerMainWindow::on_actionSend_by_E_Mail_triggered()
|
||||
{
|
||||
Q_ASSERT(m_pdfDocument);
|
||||
|
||||
QString subject = m_pdfDocument->getInfo()->title;
|
||||
if (subject.isEmpty())
|
||||
{
|
||||
subject = m_fileInfo.fileName;
|
||||
}
|
||||
|
||||
if (!PDFSendMail::sendMail(this, subject, m_fileInfo.originalFileName))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Error while starting email client occured!"));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pdfviewer
|
||||
|
Reference in New Issue
Block a user