Skip to content

Commit

Permalink
Bubble: handle link/selection cases of context menu on c++ side
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Jul 11, 2024
1 parent 3429937 commit 449720c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/psirosterwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ PsiRosterWidget::PsiRosterWidget(QWidget *parent) :
connect(filterPageView_, SIGNAL(quitFilteringMode()), SLOT(quitFilteringMode()));
filterPageView_->installEventFilter(this);
filterPageLayout->addWidget(filterPageView_);
connect(filterPageView_, &ContactListView::contactSelected, this, &PsiRosterWidget::contactPick);
}

PsiRosterWidget::~PsiRosterWidget() { }
Expand Down Expand Up @@ -317,6 +318,8 @@ void PsiRosterWidget::setPickContactMode(bool value)
filterPageView_->setActivateAction(value ? ContactListView::SignalSelected : ContactListView::Activate);
}

QList<PsiContact *> PsiRosterWidget::selectedContacts() const { return {}; }

void PsiRosterWidget::clearFilterEdit()
{
if (filterEdit_->text().isEmpty() && !pickContactMode_)
Expand Down
3 changes: 2 additions & 1 deletion src/psirosterwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class PsiRosterWidget : public QWidget {

void setContactList(PsiContactList *contactList);

void setPickContactMode(bool);
void setPickContactMode(bool);
QList<PsiContact *> selectedContacts() const;
signals:
void contactPick(PsiContact *);

Expand Down
3 changes: 3 additions & 0 deletions themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@

function setupContextMenu() {
chatMenu.addItemProvider((event) => {
if (event.target.href || getSelection().toString()) {
return []; // C++ will handle this
}
const isNick = event.target.classList.contains("nick");
let msgNode = undefined;
let msgGroup = isNick? event.target.parentElement.parentElement : event.target;
Expand Down

0 comments on commit 449720c

Please sign in to comment.