mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 13:55:47 +03:00
Adds 'Join' string for call notifications.
- Stores object_type from the api response to check if notification is a call so the primary button text and action is 'Join'. - Puts strings into consts. - Minor change: Improves comments on ActivityListModel. Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
00effb0e2f
commit
4a6b7854f5
5 changed files with 15 additions and 5 deletions
|
@ -35,7 +35,8 @@ int ActivityItemDelegate::_secondaryButtonWidth = 0;
|
||||||
int ActivityItemDelegate::_spaceBetweenButtons = 0;
|
int ActivityItemDelegate::_spaceBetweenButtons = 0;
|
||||||
int ActivityItemDelegate::_timeWidth = 0;
|
int ActivityItemDelegate::_timeWidth = 0;
|
||||||
int ActivityItemDelegate::_buttonHeight = 0;
|
int ActivityItemDelegate::_buttonHeight = 0;
|
||||||
QString ActivityItemDelegate::_remote_share("remote_share");
|
const QString ActivityItemDelegate::_remote_share("remote_share");
|
||||||
|
const QString ActivityItemDelegate::_call("call");
|
||||||
|
|
||||||
int ActivityItemDelegate::iconHeight()
|
int ActivityItemDelegate::iconHeight()
|
||||||
{
|
{
|
||||||
|
@ -164,6 +165,7 @@ void ActivityItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
||||||
// Primary button will be 'More Information' or 'Accept'
|
// Primary button will be 'More Information' or 'Accept'
|
||||||
primaryButton.text = tr("More information");
|
primaryButton.text = tr("More information");
|
||||||
if(objectType == _remote_share) primaryButton.text = tr("Accept");
|
if(objectType == _remote_share) primaryButton.text = tr("Accept");
|
||||||
|
if(objectType == _call) primaryButton.text = tr("Join");
|
||||||
|
|
||||||
primaryButton.rect.setLeft(left - margin * 2 - fm.width(primaryButton.text));
|
primaryButton.rect.setLeft(left - margin * 2 - fm.width(primaryButton.text));
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,8 @@ private:
|
||||||
static int _spaceBetweenButtons;
|
static int _spaceBetweenButtons;
|
||||||
static int _timeWidth;
|
static int _timeWidth;
|
||||||
static int _buttonHeight;
|
static int _buttonHeight;
|
||||||
static QString _remote_share;
|
static const QString _remote_share;
|
||||||
|
static const QString _call;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace OCC
|
} // namespace OCC
|
||||||
|
|
|
@ -217,11 +217,13 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivityListModel::addErrorToActivityList(Activity activity) {
|
void ActivityListModel::addErrorToActivityList(Activity activity) {
|
||||||
|
qCInfo(lcActivity) << "Error successfully added to the notification list: " << activity._subject;
|
||||||
_notificationErrorsLists.prepend(activity);
|
_notificationErrorsLists.prepend(activity);
|
||||||
combineActivityLists();
|
combineActivityLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivityListModel::addNotificationToActivityList(Activity activity) {
|
void ActivityListModel::addNotificationToActivityList(Activity activity) {
|
||||||
|
qCInfo(lcActivity) << "Notification successfully added to the notification list: " << activity._subject;
|
||||||
_notificationLists.prepend(activity);
|
_notificationLists.prepend(activity);
|
||||||
combineActivityLists();
|
combineActivityLists();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
|
const QString ActivityWidget::_accept(tr("Accept"));
|
||||||
|
const QString ActivityWidget::_remote_share("remote_share");
|
||||||
|
|
||||||
ActivityWidget::ActivityWidget(AccountState *accountState, QWidget *parent)
|
ActivityWidget::ActivityWidget(AccountState *accountState, QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, _ui(new Ui::ActivityWidget)
|
, _ui(new Ui::ActivityWidget)
|
||||||
|
@ -186,10 +189,10 @@ void ActivityWidget::slotPrimaryButtonClickedOnListView(const QModelIndex &index
|
||||||
if(!link.isEmpty()){
|
if(!link.isEmpty()){
|
||||||
qCWarning(lcActivity) << "Opening" << link.toString() << "in browser for Notification/Activity" << qvariant_cast<QString>(index.data(ActivityItemDelegate::ActionTextRole));
|
qCWarning(lcActivity) << "Opening" << link.toString() << "in browser for Notification/Activity" << qvariant_cast<QString>(index.data(ActivityItemDelegate::ActionTextRole));
|
||||||
Utility::openBrowser(link, this);
|
Utility::openBrowser(link, this);
|
||||||
} else if(objectType == "remote_share"){
|
} else if(objectType == _remote_share){
|
||||||
QVariant customItem = index.data(ActivityItemDelegate::ActionsLinksRole).toList().first();
|
QVariant customItem = index.data(ActivityItemDelegate::ActionsLinksRole).toList().first();
|
||||||
ActivityLink actionLink = qvariant_cast<ActivityLink>(customItem);
|
ActivityLink actionLink = qvariant_cast<ActivityLink>(customItem);
|
||||||
if(actionLink._label == "Accept"){
|
if(actionLink._label == _accept){
|
||||||
qCWarning(lcActivity) << objectType << "action" << actionLink._label << "for" << qvariant_cast<QString>(index.data(ActivityItemDelegate::ActionTextRole));
|
qCWarning(lcActivity) << objectType << "action" << actionLink._label << "for" << qvariant_cast<QString>(index.data(ActivityItemDelegate::ActionTextRole));
|
||||||
const QString accountName = index.data(ActivityItemDelegate::AccountRole).toString();
|
const QString accountName = index.data(ActivityItemDelegate::AccountRole).toString();
|
||||||
slotSendNotificationRequest(accountName, actionLink._link, actionLink._verb, index.row());
|
slotSendNotificationRequest(accountName, actionLink._link, actionLink._verb, index.row());
|
||||||
|
@ -208,7 +211,7 @@ void ActivityWidget::slotSecondaryButtonClickedOnListView(const QModelIndex &ind
|
||||||
actionLinks << qvariant_cast<ActivityLink>(customItem);
|
actionLinks << qvariant_cast<ActivityLink>(customItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(objectType == "remote_share" && actionLinks.first()._label == "Accept")
|
if(objectType == _remote_share && actionLinks.first()._label == _accept)
|
||||||
actionLinks.removeFirst();
|
actionLinks.removeFirst();
|
||||||
|
|
||||||
if(qvariant_cast<Activity::Type>(index.data(ActivityItemDelegate::ActionRole)) == Activity::Type::NotificationType){
|
if(qvariant_cast<Activity::Type>(index.data(ActivityItemDelegate::ActionRole)) == Activity::Type::NotificationType){
|
||||||
|
|
|
@ -126,6 +126,8 @@ private:
|
||||||
QVBoxLayout *_notificationsLayout;
|
QVBoxLayout *_notificationsLayout;
|
||||||
|
|
||||||
AccountState *_accountState;
|
AccountState *_accountState;
|
||||||
|
static const QString _accept;
|
||||||
|
static const QString _remote_share;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue