@@ -238,6 +238,7 @@ SendMultiRow* SendWidget::createEntry(){
238238 entries.append (sendMultiRow);
239239 ui->scrollAreaWidgetContents ->layout ()->addWidget (sendMultiRow);
240240 connect (sendMultiRow, &SendMultiRow::onContactsClicked, this , &SendWidget::onContactsClicked);
241+ connect (sendMultiRow, &SendMultiRow::onMenuClicked, this , &SendWidget::onMenuClicked);
241242 return sendMultiRow;
242243}
243244
@@ -598,6 +599,9 @@ void SendWidget::onPIVSelected(bool _isPIV){
598599
599600void SendWidget::onContactsClicked (SendMultiRow* entry){
600601 focusedEntry = entry;
602+ if (menu && menu->isVisible ()){
603+ menu->hide ();
604+ }
601605 int height = entry->getEditHeight () * 8 ;
602606 int width = entry->getEditWidth ();
603607
@@ -639,6 +643,55 @@ void SendWidget::onContactsClicked(SendMultiRow* entry){
639643 menuContacts->show ();
640644}
641645
646+ void SendWidget::onMenuClicked (SendMultiRow* entry){
647+ focusedEntry = entry;
648+ if (menuContacts && menuContacts->isVisible ()){
649+ menuContacts->hide ();
650+ }
651+ QPoint pos = entry->pos ();
652+ pos.setX (pos.x () + (entry->width () - entry->getMenuBtnWidth ()));
653+ pos.setY (pos.y () + entry->height () + (entry->getMenuBtnWidth ()));
654+
655+ if (!this ->menu ){
656+ this ->menu = new TooltipMenu (window, this );
657+ this ->menu ->setCopyBtnVisible (false );
658+ this ->menu ->setEditBtnText (tr (" Contacts" ));
659+ this ->menu ->adjustSize ();
660+ connect (this ->menu , &TooltipMenu::message, this , &AddressesWidget::message);
661+ connect (this ->menu , SIGNAL (onEditClicked ()), this , SLOT (onContactMultiClicked ()));
662+ connect (this ->menu , SIGNAL (onDeleteClicked ()), this , SLOT (onDeleteClicked ()));
663+ }else {
664+ this ->menu ->hide ();
665+ }
666+ menu->move (pos);
667+ menu->show ();
668+ }
669+
670+ void SendWidget::onContactMultiClicked (){
671+ // show the contacts dialog.
672+ }
673+
674+ void SendWidget::onDeleteClicked (){
675+ if (focusedEntry) {
676+ focusedEntry->hide ();
677+ focusedEntry->deleteLater ();
678+ int entryNumber = focusedEntry->getNumber ();
679+
680+ // Refresh amount total + rest of rows numbers.
681+ QMutableListIterator<SendMultiRow*> it (entries);
682+ while (it.hasNext ()) {
683+ SendMultiRow* entry = it.next ();
684+ if (focusedEntry == entry){
685+ it.remove ();
686+ } else if (focusedEntry && entry->getNumber () > entryNumber){
687+ entry->setNumber (entry->getNumber () - 1 );
688+ }
689+ }
690+
691+ focusedEntry = nullptr ;
692+ }
693+ }
694+
642695void SendWidget::resizeMenu (){
643696 if (menuContacts && menuContacts->isVisible () && focusedEntry){
644697 int width = focusedEntry->getEditWidth ();
0 commit comments