Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.1784
Browse files Browse the repository at this point in the history
It is based on:
* psi: 6796eaa4
* plugins: 3c71dec
* psimedia: 478567e
* resources: c35f1e3
  • Loading branch information
tehnick committed Apr 22, 2024
1 parent 51eefc2 commit 42c2f8c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/eventdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,14 @@ void EventDlg::init()
d->w_http_id->hide();

// data form
d->xdata = new XDataWidget(d->psi, this, d->pa->client(), d->jid);
d->xdata_form = new QWidget(this);
d->xdata = new XDataWidget(d->psi, this, d->pa->client(), d->jid);
d->xdata_form = new QWidget(this);
d->xdata_form->setFocusProxy(d->xdata);
QVBoxLayout *vb_xdata = new QVBoxLayout(d->xdata_form);
d->xdata_instruction = new QLabel(d->xdata_form);
vb_xdata->addWidget(d->xdata_instruction);
vb_xdata->addWidget(d->xdata);
vb1->addStretch();
vb1->addWidget(d->xdata_form);
d->xdata_form->hide();

Expand Down Expand Up @@ -1730,6 +1732,12 @@ void EventDlg::updateEvent(const PsiEvent::Ptr &e)

// show data form
d->xdata->setForm(form, false);
auto xdfLFW = d->xdata->lastFocusabelWidget();
if (xdfLFW) {
setTabOrder(d->le_subj, d->xdata_form);
setTabOrder(xdfLFW, d->pb_form_submit); // FIXME doesn't work? why?
}
d->xdata_form->setFocus();
d->xdata_form->show();

// set instructions
Expand Down
19 changes: 19 additions & 0 deletions src/xdata_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class XDataField {

virtual XData::Field field() const { return _field; }

virtual QWidget *focusProxy() const { return nullptr; }

QString labelText(QString str = ": ") const
{
QString text = _field.label();
Expand Down Expand Up @@ -299,6 +301,8 @@ class XDataField_TextSingle : public XDataField {
return f;
}

QWidget *focusProxy() const { return edit; }

protected:
QLineEdit *edit;
};
Expand Down Expand Up @@ -388,6 +392,8 @@ class XDataField_ListSingle : public XDataField {
return f;
}

QWidget *focusProxy() const { return combo; }

private:
QComboBox *combo;
};
Expand Down Expand Up @@ -457,6 +463,8 @@ class XDataField_ListMulti : public XDataField {
return f;
}

QWidget *focusProxy() const { return list; }

private:
QListWidget *list;
};
Expand Down Expand Up @@ -506,6 +514,8 @@ class XDataField_TextMulti : public XDataField {
return f;
}

QWidget *focusProxy() const { return edit; }

private:
QTextEdit *edit;
};
Expand Down Expand Up @@ -645,6 +655,7 @@ void XDataWidget::setFields(const XData::FieldList &f)
// FIXME
QGridLayout *grid = new QGridLayout(fields);
grid->setSpacing(3);
bool focusSet = false;

XData::FieldList::ConstIterator it = f.begin();
for (; it != f.end(); ++it) {
Expand Down Expand Up @@ -682,6 +693,14 @@ void XDataWidget::setFields(const XData::FieldList &f)
f = new XDataField_TextSingle(*it, grid, this);
}
fields_.append(f);
auto proxy = f->focusProxy();
if (proxy) {
if (!focusSet) {
setFocusProxy(proxy);
focusSet = true;
}
lastFocusableWidget_ = proxy;
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/xdata_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class XDataWidget : public QWidget {
XMPP::XData::FieldList fields() const;
XDataField *fieldByVar(const QString &) const;

inline QWidget *lastFocusabelWidget() const { return lastFocusableWidget_; }

protected slots:
void linkActivated(const QString &);

Expand All @@ -71,6 +73,7 @@ protected slots:
XMPP::Jid owner_;
bool consistent_;
XMPP::Stanza::Error consistencyError_;
QWidget *lastFocusableWidget_ = nullptr;
};

#endif // XDATAWIDGET_H
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.1783 (2024-04-22, f8658677)
1.5.1784 (2024-04-22, 6796eaa4)

0 comments on commit 42c2f8c

Please sign in to comment.