mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
ActivityWidget: implement removeAccount.
This commit is contained in:
parent
ff4a8c9202
commit
aa38f7a4f2
4 changed files with 39 additions and 3 deletions
|
@ -239,13 +239,34 @@ void ActivityListModel::fetchMore(const QModelIndex &)
|
|||
|
||||
void ActivityListModel::slotRefreshActivity(AccountState *ast)
|
||||
{
|
||||
qDebug() << "**** Refreshing" << ast->account()->displayName();
|
||||
if(ast && _activityLists.contains(ast)) {
|
||||
qDebug() << "**** Refreshing Activity list for" << ast->account()->displayName();
|
||||
_activityLists[ast].clear();
|
||||
}
|
||||
startFetchJob(ast);
|
||||
}
|
||||
|
||||
void ActivityListModel::slotRemoveAccount(AccountState *ast )
|
||||
{
|
||||
if( _activityLists.contains(ast) ) {
|
||||
int i = 0;
|
||||
const QString accountToRemove = ast->account()->displayName();
|
||||
|
||||
QMutableListIterator<Activity> it(_finalList);
|
||||
|
||||
while (it.hasNext()) {
|
||||
Activity activity = it.next();
|
||||
if( activity._accName == accountToRemove ) {
|
||||
beginRemoveRows(QModelIndex(), i, i+1);
|
||||
it.remove();
|
||||
endRemoveRows();
|
||||
}
|
||||
}
|
||||
_activityLists.remove(ast);
|
||||
_currentlyFetching.remove(ast);
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================================================================== */
|
||||
|
||||
ActivityWidget::ActivityWidget(QWidget *parent) :
|
||||
|
@ -285,6 +306,11 @@ void ActivityWidget::slotRefresh(AccountState *ptr)
|
|||
_model->slotRefreshActivity(ptr);
|
||||
}
|
||||
|
||||
void ActivityWidget::slotRemoveAccount( AccountState *ptr )
|
||||
{
|
||||
_model->slotRemoveAccount(ptr);
|
||||
}
|
||||
|
||||
// FIXME: Reused from protocol widget. Move over to utilities.
|
||||
QString ActivityWidget::timeString(QDateTime dt, QLocale::FormatType format) const
|
||||
{
|
||||
|
@ -408,6 +434,11 @@ void ActivitySettings::slotCopyToClipboard()
|
|||
emit guiLog(tr("Copied to clipboard"), tr("The %1 has been copied to the clipboard.").arg(theSubject));
|
||||
}
|
||||
|
||||
void ActivitySettings::slotRemoveAccount( AccountState *ptr )
|
||||
{
|
||||
_activityWidget->slotRemoveAccount(ptr);
|
||||
}
|
||||
|
||||
void ActivitySettings::slotRefresh( AccountState* ptr )
|
||||
{
|
||||
_progressIndicator->startAnimation();
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void slotRefreshActivity(AccountState* ast);
|
||||
void slotRemoveAccount( AccountState *ast );
|
||||
|
||||
private slots:
|
||||
void slotActivitiesReceived(const QVariantMap& json);
|
||||
|
@ -126,6 +127,7 @@ public:
|
|||
public slots:
|
||||
void slotOpenFile();
|
||||
void slotRefresh(AccountState* ptr);
|
||||
void slotRemoveAccount( AccountState *ptr );
|
||||
|
||||
signals:
|
||||
void guiLog(const QString&, const QString&);
|
||||
|
@ -151,6 +153,8 @@ public:
|
|||
|
||||
public slots:
|
||||
void slotRefresh( AccountState* ptr );
|
||||
void slotRemoveAccount( AccountState *ptr );
|
||||
|
||||
void slotCopyToClipboard();
|
||||
|
||||
signals:
|
||||
|
|
|
@ -45,7 +45,6 @@ private slots:
|
|||
void slotUpdateInfo();
|
||||
void slotIgnoreFilesEditor();
|
||||
void slotOpenAccountWizard();
|
||||
void slotOpenSyncLog();
|
||||
void slotAccountAddedOrRemoved();
|
||||
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ void SettingsDialog::accountAdded(AccountState *s)
|
|||
connect( accountSettings, SIGNAL(openFolderAlias(const QString&)),
|
||||
_gui, SLOT(slotFolderOpenAction(QString)));
|
||||
|
||||
|
||||
slotRefreshActivity(s);
|
||||
}
|
||||
|
||||
void SettingsDialog::accountRemoved(AccountState *s)
|
||||
|
@ -233,6 +233,8 @@ void SettingsDialog::accountRemoved(AccountState *s)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_activitySettings->slotRemoveAccount(s);
|
||||
}
|
||||
|
||||
void SettingsDialog::customizeStyle()
|
||||
|
|
Loading…
Reference in a new issue