Skip to content

Commit

Permalink
Current version of Psi+ is 1.5.2037
Browse files Browse the repository at this point in the history
It is based on:
* psi: cc3d12bd
* plugins: 7a65467
* psimedia: 478567e
* resources: e32ef4b
  • Loading branch information
tehnick committed Jul 10, 2024
1 parent 787e78e commit c663c01
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/contactlistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,12 @@ void ContactListView::activate(const QModelIndex &index) { itemActivated(index);

void ContactListView::itemActivated(const QModelIndex &index)
{
model()->setData(index, QVariant(true), ContactListModel::ActivateRole);
if (activateAction == Activate) {
model()->setData(index, QVariant(true), ContactListModel::ActivateRole);
} else {
emit contactSelected(
model()->data(index, ContactListModel::ContactListItemRole).value<ContactListItem *>()->contact());
}
}

static QAbstractItemModel *realModel(QAbstractItemModel *model)
Expand Down
6 changes: 6 additions & 0 deletions src/contactlistview.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ class ContactListItemMenu;
class ContactListModel;
class QLineEdit;
class QWidget;
class PsiContact;

class ContactListView : public HoverableTreeView {
Q_OBJECT

public:
enum ActivateAction { Activate, SignalSelected };

ContactListView(QWidget *parent = nullptr);

ContactListModel *realModel() const;
Expand All @@ -47,6 +50,7 @@ class ContactListView : public HoverableTreeView {
void activate(const QModelIndex &index);
void toggleExpandedState(const QModelIndex &index);
void ensureVisible(const QModelIndex &index);
void setActivateAction(ActivateAction action) { activateAction = action; }

// reimplemented
void setModel(QAbstractItemModel *model) override;
Expand All @@ -58,6 +62,7 @@ public slots:
void realExpanded(const QModelIndex &);
void realCollapsed(const QModelIndex &);
void modelItemsUpdated();
void contactSelected(PsiContact *);

protected:
// reimplemented
Expand Down Expand Up @@ -98,6 +103,7 @@ protected slots:
private:
QPointer<ContactListItemMenu> contextMenu_;
bool contextMenuActive_;
ActivateAction activateAction = Activate;
};

#endif // CONTACTLISTVIEW_H
2 changes: 1 addition & 1 deletion src/filesharingproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

#include <cstring>

#define HTTP_CHUNK (512 * 1024 * 1024)
#define HTTP_CHUNK (512 * 1024)

template <typename Impl> class ControlBase : public QObject {

Expand Down
4 changes: 3 additions & 1 deletion src/psicon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,9 @@ void PsiCon::invokeForwardMessage(const Jid &from, const QString &text)

auto roster = new PsiRosterWidget(d->mainwin);
roster->setContactList(d->contactList);
roster->setFilterModeEnabled(true);
roster->setPickContactMode(true);
connect(roster, &PsiRosterWidget::contactPick, this,
[](PsiContact *c) { qDebug("TODO forwarding to: %s", qPrintable(c->jid().full())); });

auto btn = new QPushButton(tr("Forward"));
connect(btn, &QPushButton::clicked, dlg, [this, roster](bool) { qDebug("TODO: implement forwarding"); });
Expand Down
36 changes: 30 additions & 6 deletions src/psirosterwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ void PsiRosterWidget::setContactList(PsiContactList *contactList)
contactListModel_->invalidateLayout();
contactListModel_->setAccountsEnabled(true);
contactListModel_->setGroupsEnabled(PsiOptions::instance()->getOption(enableGroupsOptionPath).toBool());
// connect
#ifdef MODELTEST
new ModelTest(contactListModel_, this);
#endif
Expand Down Expand Up @@ -249,9 +250,19 @@ void PsiRosterWidget::filterEditTextChanged(const QString &text)
#endif
}

void PsiRosterWidget::quitFilteringMode() { setFilterModeEnabled(false); }
void PsiRosterWidget::quitFilteringMode()
{
if (!pickContactMode_) {
setFilterModeEnabled(false);
}
}

void PsiRosterWidget::updateFilterMode() { setFilterModeEnabled(!filterEdit_->text().isEmpty()); }
void PsiRosterWidget::updateFilterMode()
{
if (!pickContactMode_) {
setFilterModeEnabled(!filterEdit_->text().isEmpty());
}
}

void PsiRosterWidget::setFilterModeEnabled(bool enabled)
{
Expand Down Expand Up @@ -297,9 +308,18 @@ void PsiRosterWidget::setFilterModeEnabled(bool enabled)
delete selection;
}

void PsiRosterWidget::setPickContactMode(bool value)
{
pickContactMode_ = value;
if (value) {
setFilterModeEnabled(true);
}
contactListPageView_->setActivateAction(value ? ContactListView::SignalSelected : ContactListView::Activate);
}

void PsiRosterWidget::clearFilterEdit()
{
if (filterEdit_->text().isEmpty())
if (filterEdit_->text().isEmpty() && !pickContactMode_)
setFilterModeEnabled(false);
else
filterEdit_->setText("");
Expand Down Expand Up @@ -332,19 +352,23 @@ bool PsiRosterWidget::eventFilter(QObject *obj, QEvent *e)
filterEdit_->setText(text);
return true;
}
} else if (ke->key() == Qt::Key_F3) {
} else if (ke->key() == Qt::Key_F3 && !pickContactMode_) {
setFilterModeEnabled(!(filterEdit_->isVisible() && filterEdit_->text().isEmpty()));
filterEdit_->setText("");
return true;
}

if (obj == filterEdit_ || obj == filterPageView_ || obj == filterPage_) {
if (ke->key() == Qt::Key_Escape) {
setFilterModeEnabled(false);
if (pickContactMode_) {
deleteLater();
} else {
setFilterModeEnabled(false);
}
return true;
}

if (ke->key() == Qt::Key_Backspace && filterEdit_->text().isEmpty()) {
if (ke->key() == Qt::Key_Backspace && filterEdit_->text().isEmpty() && !pickContactMode_) {
setFilterModeEnabled(false);
return true;
}
Expand Down
6 changes: 6 additions & 0 deletions src/psirosterwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ContactListDragModel;
class PsiContactList;
class PsiContactListView;
class PsiFilteredContactListView;
class PsiContact;
class QLineEdit;
class QMimeData;
class QSortFilterProxyModel;
Expand All @@ -40,6 +41,10 @@ class PsiRosterWidget : public QWidget {

void setContactList(PsiContactList *contactList);

void setPickContactMode(bool);
signals:
void contactPick(PsiContact *);

public slots:
void filterEditTextChanged(const QString &);
void quitFilteringMode();
Expand Down Expand Up @@ -69,6 +74,7 @@ private slots:

ContactListDragModel *contactListModel_;
QSortFilterProxyModel *filterModel_;
bool pickContactMode_ = false;
};

#endif // PSIROSTERWIDGET_H
4 changes: 2 additions & 2 deletions themes/chatview/psi/bubble/Dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ blockquote>div {
}

.reactions_selector {
background-color: #111;
background-color: #033;
}

.context_menu {
background-color: black;
background-color: #033;
}

.context_menu>div+div {
Expand Down
2 changes: 1 addition & 1 deletion themes/chatview/psi/bubble/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@

.context_menu>div {
box-sizing: border-box;
padding: .3rem .5rem;
padding: .3rem 1rem;
}

.context_menu>div+div {
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.2035 (2024-07-08, 8bf57027)
1.5.2037 (2024-07-11, cc3d12bd)

0 comments on commit c663c01

Please sign in to comment.