void Mailbox::duplicateMail(ReplyType reply_type) { QModelIndex index = getSelectedMail(); if (index == QModelIndex()) return; MessageHeader header; QModelIndex mappedIndex = sortedModel()->mapToSource(index); _sourceModel->getFullMessage(mappedIndex, header); auto msg_window = new MailEditor(this); //TODO: add "x wrote on such date": QString new_body = header.body; msg_window->copyToBody(new_body); QString new_subject; auto addressbook = bts::get_profile()->get_addressbook(); if (reply_type == reply || reply_type == reply_all) { new_subject = "Re: " + header.subject; // auto reply_to_contact = addressbook->get_contact_by_public_key(header.header.from_key); // if (reply_to_contact) // msg_window->addToContact(reply_to_contact->wallet_index); msg_window->addToContact(header.header.from_key); } else if (reply_type == forward) { new_subject = "Fwd: " + header.subject; //TODO add attachments } if (reply_type == reply_all) { //TODO add check to avoid replying to self as well foreach(auto to_key, header.to_list) msg_window->addToContact(to_key); foreach(auto cc_key, header.cc_list) msg_window->addCcContact(cc_key); }
///Constructor HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone) : QWidget(parent), m_pItemCall(0),m_pMenu(0),m_pAudioSlider(0),m_pTimeLeftL(0),m_pTimePlayedL(0),m_pPlayer(0),m_pContact(0) { setContextMenuPolicy(Qt::CustomContextMenu); m_pCallAgain = new KAction(this); m_pAddContact = new KAction(this); m_pCopy = new KAction(this); m_pEmail = new KAction(this); m_pAddToContact = new KAction(this); m_pBookmark = new KAction(this); m_pCallAgain->setShortcut ( Qt::Key_Enter ); m_pCallAgain->setText ( i18n("Call Again") ); m_pCallAgain->setIcon ( KIcon(ICON_DIALING) ); m_pAddToContact->setShortcut ( Qt::CTRL + Qt::Key_E ); m_pAddToContact->setText ( i18n("Add Number to Contact") ); m_pAddToContact->setIcon ( KIcon("list-resource-add") ); m_pAddToContact->setDisabled ( true ); m_pAddContact->setShortcut ( Qt::CTRL + Qt::Key_E ); m_pAddContact->setText ( i18n("Add Contact") ); m_pAddContact->setIcon ( KIcon("contact-new") ); m_pCopy->setShortcut ( Qt::CTRL + Qt::Key_C ); m_pCopy->setText ( i18n("Copy") ); m_pCopy->setIcon ( KIcon("edit-copy") ); m_pCopy->setDisabled ( true ); m_pEmail->setShortcut ( Qt::CTRL + Qt::Key_M ); m_pEmail->setText ( i18n("Send Email") ); m_pEmail->setIcon ( KIcon("mail-message-new") ); m_pEmail->setDisabled ( true ); m_pBookmark->setShortcut ( Qt::CTRL + Qt::Key_D ); m_pBookmark->setText ( i18n("Bookmark") ); m_pBookmark->setIcon ( KIcon("bookmarks") ); m_pPlay = new QToolButton(this); m_pPlay->setIcon(KIcon("media-playback-start")); m_pPlay->setMinimumSize(30,30); m_pPlay->setMaximumSize(30,30); m_pPlay->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed)); m_pPlay->setVisible(false); m_pRemove = new QToolButton(this); m_pRemove->setIcon(KIcon("list-remove")); m_pRemove->setMinimumSize(30,30); m_pRemove->setMaximumSize(30,30); m_pRemove->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed)); m_pRemove->setVisible(false); connect(m_pCallAgain , SIGNAL(triggered()) , this , SLOT(callAgain() )); connect(m_pAddContact , SIGNAL(triggered()) , this , SLOT(addContact() )); connect(m_pCopy , SIGNAL(triggered()) , this , SLOT(copy() )); connect(m_pEmail , SIGNAL(triggered()) , this , SLOT(sendEmail() )); connect(m_pAddToContact , SIGNAL(triggered()) , this , SLOT(addToContact() )); connect(m_pBookmark , SIGNAL(triggered()) , this , SLOT(bookmark() )); connect(m_pPlay , SIGNAL(clicked() ) , this , SLOT(showRecordPlayer() )); connect(m_pRemove , SIGNAL(clicked() ) , this , SLOT(removeRecording() )); connect(this , SIGNAL(customContextMenuRequested(QPoint)) , this , SLOT(showContext(QPoint) )); m_pIconL = new QLabel( this ); m_pPeerNameL = new QLabel( this ); m_pCallNumberL = new QLabel( this ); m_pLengthL = new QLabel( this ); m_pTimeL = new QLabel( this ); m_pIconL->setMinimumSize(70,0); m_pIconL->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::MinimumExpanding); QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding); m_pMainLayout = new QGridLayout(this); m_pMainLayout->addWidget ( m_pIconL , 0 , 0 , 4 , 1 ); m_pMainLayout->addWidget ( m_pPeerNameL , 0 , 1 ); m_pMainLayout->addWidget ( m_pCallNumberL , 1 , 1 ); m_pMainLayout->addWidget ( m_pTimeL , 2 , 1 ); m_pMainLayout->addItem ( verticalSpacer , 4 , 1 ); m_pMainLayout->addWidget ( m_pPlay , 0 , 2 , 4 , 1 ); m_pMainLayout->addWidget ( m_pRemove , 0 , 3 , 4 , 1 ); m_pMainLayout->addWidget ( m_pLengthL , 0 , 4 , 4 , 1 ); setLayout(m_pMainLayout); setMinimumSize(QSize(50, 30)); setMaximumSize(QSize(300,99999)); setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)); if (!phone.isEmpty()) { getContactInfo(phone); m_pCallNumberL->setText(phone); m_PhoneNumber = phone; } }
void KeyhoteeMainWindow::newMailMessageTo(int contact_id) { auto msg_window = new MailEditor(this); msg_window->addToContact(contact_id); msg_window->setFocusAndShow(); }