Backup before implementing tag editor for To/Cc/Bcc fields
This commit is contained in:
+6
-1
@@ -11,4 +11,9 @@
|
||||
<file>resources/qml/models/FolderModel.qml</file>
|
||||
<file>resources/translations/en_US/resources.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
<qresource prefix="/icons">
|
||||
<file>resources/icons/attachment.svg</file>
|
||||
<file>resources/icons/edit.svg</file>
|
||||
<file>resources/icons/trash.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -24,7 +24,7 @@ QString Account::encryptPassword(const QString& plainText)
|
||||
QByteArray key;
|
||||
bool ok;
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
char c = QString(keyHex + i * 2, 2).toInt(&ok, 16);
|
||||
char c = QString::fromLatin1(keyHex + i * 2, 2).toInt(&ok, 16);
|
||||
if (!ok) c = 0;
|
||||
key.append(c);
|
||||
}
|
||||
|
||||
+65
-1
@@ -2,6 +2,9 @@
|
||||
#include <QFrame>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QTextList>
|
||||
#include <QTextTable>
|
||||
#include <QTextCursor>
|
||||
@@ -114,6 +117,8 @@ void RichTextEditor::setupToolbar(QVBoxLayout *layout) {
|
||||
);
|
||||
connect(m_signatureButton, &QToolButton::clicked, this, &RichTextEditor::signatureClicked);
|
||||
m_toolbar->addWidget(m_signatureButton);
|
||||
QAction *editSigAct = m_signatureMenu->addAction(tr("Editar firmas"));
|
||||
connect(editSigAct, &QAction::triggered, this, &RichTextEditor::signatureEditRequested);
|
||||
|
||||
m_toolbar->addSeparator();
|
||||
|
||||
@@ -265,6 +270,7 @@ ComposeView::ComposeView(QWidget *parent) : QWidget(parent) {
|
||||
setupUI();
|
||||
// Connect the rich text editor's signature signal to our slot
|
||||
connect(m_bodyEditor, &RichTextEditor::signatureClicked, this, &ComposeView::onSignatureClicked);
|
||||
connect(m_bodyEditor, &RichTextEditor::signatureEditRequested, this, &ComposeView::onSignatureEditRequested);
|
||||
}
|
||||
|
||||
ComposeView::~ComposeView() {
|
||||
@@ -527,6 +533,38 @@ void ComposeView::setupUI() {
|
||||
|
||||
m_schedulePanel->setVisible(false);
|
||||
mainLayout->addWidget(m_schedulePanel);
|
||||
// Attachment section
|
||||
QHBoxLayout *attachmentLayout = new QHBoxLayout();
|
||||
QLabel *attachmentLabel = new QLabel(tr("Attachments:"));
|
||||
attachmentLabel->setFixedWidth(80);
|
||||
attachmentLabel->setStyleSheet("font-weight: bold; color: #555;");
|
||||
attachmentLayout->addWidget(attachmentLabel);
|
||||
|
||||
m_attachButton = new QToolButton();
|
||||
m_attachButton->setIcon(QIcon(QStringLiteral(":/icons/attachment.svg")));
|
||||
m_attachButton->setToolTip(tr("Add attachment"));
|
||||
m_attachButton->setIconSize(QSize(20,20));
|
||||
m_attachButton->setStyleSheet("QToolButton { border: none; padding: 5px; } QToolButton:hover { background: #e0e0e0; border-radius: 3px; }");
|
||||
bool connected = connect(m_attachButton, &QToolButton::clicked, this, &ComposeView::onAddAttachmentClicked);
|
||||
qDebug() << "Attach button connected:" << connected;
|
||||
attachmentLayout->addWidget(m_attachButton);
|
||||
|
||||
m_attachmentList = new QListWidget();
|
||||
m_attachmentList->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_attachmentList->setMaximumHeight(60);
|
||||
m_attachmentList->setStyleSheet("QListWidget { border: 1px solid #d1d1d6; border-radius: 4px; }");
|
||||
attachmentLayout->addWidget(m_attachmentList, 1);
|
||||
|
||||
m_removeAttachmentButton = new QToolButton();
|
||||
m_removeAttachmentButton->setIcon(QIcon(QStringLiteral(":/icons/trash.svg")));
|
||||
m_removeAttachmentButton->setToolTip(tr("Remove selected attachment"));
|
||||
m_removeAttachmentButton->setIconSize(QSize(20,20));
|
||||
m_removeAttachmentButton->setStyleSheet("QToolButton { border: none; padding: 5px; } QToolButton:hover { background: #e0e0e0; border-radius: 3px; }");
|
||||
connect(m_removeAttachmentButton, &QToolButton::clicked, this, &ComposeView::onRemoveAttachmentClicked);
|
||||
attachmentLayout->addWidget(m_removeAttachmentButton);
|
||||
|
||||
mainLayout->addLayout(attachmentLayout);
|
||||
|
||||
|
||||
// Action buttons row
|
||||
QHBoxLayout *actionsLayout = new QHBoxLayout();
|
||||
@@ -557,7 +595,7 @@ void ComposeView::setupUI() {
|
||||
m_sendSplit->setStyleSheet(
|
||||
"QToolButton { background-color: #1976D2; color: white; border: none; border-radius: 4px; padding: 8px 24px; font-weight: bold; }"
|
||||
"QToolButton:hover { background-color: #1565C0; }"
|
||||
"QToolButton::menu-button { border-left: 1px solid rgba(255,255,255,0.3); padding-left: 8px; padding-right: 8px; }"
|
||||
"QToolButton::menu-button { border-left: 1px solid rgba(255,255,255,0.3); padding-left: 8px; padding-right: 8px; width: 40px;}"
|
||||
"QToolButton::menu-button:hover { background-color: #1565C0; border-top-right-radius: 4px; border-bottom-right-radius: 4px; }"
|
||||
);
|
||||
connect(m_sendSplit, &QToolButton::clicked, this, &ComposeView::onSendClicked);
|
||||
@@ -629,4 +667,30 @@ void ComposeView::startNewEmail(const QString &initialRecipient) {
|
||||
m_toField->setText(initialRecipient);
|
||||
m_toField->setFocus();
|
||||
}
|
||||
|
||||
void ComposeView::onAddAttachmentClicked()
|
||||
{
|
||||
qDebug() << "Attach button clicked";
|
||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Select Attachments"), QString(), tr("All Files (*)"));
|
||||
if (files.isEmpty())
|
||||
return;
|
||||
for (const QString &file : files) {
|
||||
m_attachmentFiles.append(file);
|
||||
QListWidgetItem *item = new QListWidgetItem(QFileInfo(file).fileName(), m_attachmentList);
|
||||
item->setToolTip(file);
|
||||
}
|
||||
QMessageBox::information(this, tr("Attachments"), tr("Attached %1 file(s).").arg(files.count()));
|
||||
}
|
||||
|
||||
void ComposeView::onRemoveAttachmentClicked()
|
||||
{
|
||||
QListWidgetItem *item = m_attachmentList->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
int row = m_attachmentList->row(item);
|
||||
m_attachmentList->takeItem(row);
|
||||
m_attachmentFiles.removeAt(row);
|
||||
delete item;
|
||||
}
|
||||
|
||||
#include "composeview.moc"
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QToolBar>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QMenu>
|
||||
@@ -16,6 +15,7 @@
|
||||
#include <QFontComboBox>
|
||||
#include <QSpinBox>
|
||||
#include <QComboBox>
|
||||
#include <QListWidget>
|
||||
#include "models/EmailCompositionModel.h"
|
||||
#include "services/accountservice.h"
|
||||
|
||||
@@ -89,6 +89,8 @@ private slots:
|
||||
void onAccountChanged(int index);
|
||||
void onSignatureClicked();
|
||||
void onSignatureEditRequested();
|
||||
void onAddAttachmentClicked();
|
||||
void onRemoveAttachmentClicked();
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
@@ -122,6 +124,11 @@ private:
|
||||
bool m_ccVisible = false;
|
||||
bool m_bccVisible = false;
|
||||
int m_currentAccountId = -1;
|
||||
};
|
||||
|
||||
// Attachment UI
|
||||
QToolButton *m_attachButton = nullptr;
|
||||
QListWidget *m_attachmentList = nullptr;
|
||||
QToolButton *m_removeAttachmentButton = nullptr;
|
||||
QStringList m_attachmentFiles;
|
||||
};
|
||||
#endif // COMPOSE_VIEW_H
|
||||
@@ -139,7 +139,7 @@ void MainMainWindow::setupUI()
|
||||
void MainMainWindow::setupSidebar()
|
||||
{
|
||||
m_sidebar = new QListWidget();
|
||||
m_sidebar->setFixedWidth(64);
|
||||
m_sidebar->setFixedWidth(100);
|
||||
m_sidebar->setIconSize(QSize(24, 24));
|
||||
m_sidebar->setSpacing(4);
|
||||
m_sidebar->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
Reference in New Issue
Block a user