mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
ActivityWidget: display if the server does not support acitivities.
If the server does not have the activities app enabled, it says so now. Fix for #4163
This commit is contained in:
parent
421c6a92f3
commit
94e7c762bf
3 changed files with 46 additions and 1 deletions
|
@ -182,6 +182,10 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json, int stat
|
|||
|
||||
_activityLists[ai] = list;
|
||||
|
||||
if( statusCode == 999 ) {
|
||||
emit accountWithoutActivityApp(ai);
|
||||
}
|
||||
|
||||
combineActivityLists();
|
||||
}
|
||||
|
||||
|
@ -269,7 +273,10 @@ ActivityWidget::ActivityWidget(QWidget *parent) :
|
|||
_ui->_activityList->setAlternatingRowColors(true);
|
||||
_ui->_activityList->setModel(_model);
|
||||
|
||||
_ui->_headerLabel->setText(tr("Server Activities"));
|
||||
showLabels();
|
||||
|
||||
connect(_model, SIGNAL(accountWithoutActivityApp(AccountState*)),
|
||||
this, SLOT(slotAccountWithoutActivityApp(AccountState*)));
|
||||
|
||||
_copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
|
||||
_copyBtn->setToolTip( tr("Copy the activity list to the clipboard."));
|
||||
|
@ -296,6 +303,30 @@ void ActivityWidget::slotRemoveAccount( AccountState *ptr )
|
|||
_model->slotRemoveAccount(ptr);
|
||||
}
|
||||
|
||||
void ActivityWidget::showLabels()
|
||||
{
|
||||
QString t = tr("Server Activities");
|
||||
_ui->_headerLabel->setTextFormat(Qt::RichText);
|
||||
_ui->_headerLabel->setText(t);
|
||||
|
||||
t.clear();
|
||||
QSetIterator<QString> i(_accountsWithoutActivities);
|
||||
while (i.hasNext() ) {
|
||||
t.append( tr("<br/>Account %1 does not have activities enabled.").arg(i.next()));
|
||||
}
|
||||
_ui->_bottomLabel->setTextFormat(Qt::RichText);
|
||||
_ui->_bottomLabel->setText(t);
|
||||
}
|
||||
|
||||
void ActivityWidget::slotAccountWithoutActivityApp(AccountState *ast)
|
||||
{
|
||||
if( ast && ast->account() ) {
|
||||
_accountsWithoutActivities.insert(ast->account()->displayName());
|
||||
}
|
||||
|
||||
showLabels();
|
||||
}
|
||||
|
||||
// FIXME: Reused from protocol widget. Move over to utilities.
|
||||
QString ActivityWidget::timeString(QDateTime dt, QLocale::FormatType format) const
|
||||
{
|
||||
|
|
|
@ -112,6 +112,9 @@ public slots:
|
|||
private slots:
|
||||
void slotActivitiesReceived(const QVariantMap& json, int statusCode);
|
||||
|
||||
signals:
|
||||
void accountWithoutActivityApp(AccountState* ast);
|
||||
|
||||
private:
|
||||
void startFetchJob(AccountState* s);
|
||||
void combineActivityLists();
|
||||
|
@ -142,6 +145,7 @@ public slots:
|
|||
void slotOpenFile(QModelIndex indx);
|
||||
void slotRefresh(AccountState* ptr);
|
||||
void slotRemoveAccount( AccountState *ptr );
|
||||
void slotAccountWithoutActivityApp(AccountState *ast);
|
||||
|
||||
signals:
|
||||
void guiLog(const QString&, const QString&);
|
||||
|
@ -149,10 +153,13 @@ signals:
|
|||
void rowsInserted();
|
||||
|
||||
private:
|
||||
void showLabels();
|
||||
QString timeString(QDateTime dt, QLocale::FormatType format) const;
|
||||
Ui::ActivityWidget *_ui;
|
||||
QPushButton *_copyBtn;
|
||||
|
||||
QSet<QString> _accountsWithoutActivities;
|
||||
|
||||
ActivityListModel *_model;
|
||||
};
|
||||
|
||||
|
|
|
@ -25,6 +25,13 @@
|
|||
<widget class="QListView" name="_activityList"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="_bottomLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDialogButtonBox" name="_dialogButtonBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
Loading…
Reference in a new issue