mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Fixed crash when removing folders.
Simplified code to achieve that, removed a slot from status dia.
This commit is contained in:
parent
16a9a73ea3
commit
b7eae107ae
@ -262,18 +262,21 @@ void Application::slotAddFolder()
|
||||
_folderMan->restoreEnabledFolders();
|
||||
}
|
||||
|
||||
/*
|
||||
* the folder is to be removed. The slot is called from a signal emitted by
|
||||
* the status dialog, which removes the folder from its list by itself.
|
||||
*/
|
||||
void Application::slotRemoveFolder( const QString& alias )
|
||||
{
|
||||
int ret = QMessageBox::question( 0, tr("Confirm Folder Remove"), tr("Do you really want to remove upload folder <i>%1</i>?").arg(alias),
|
||||
QMessageBox::Yes|QMessageBox::No );
|
||||
int ret = QMessageBox::question( 0, tr("Confirm Folder Remove"), tr("Do you really want to remove upload folder <i>%1</i>?").arg(alias),
|
||||
QMessageBox::Yes|QMessageBox::No );
|
||||
|
||||
if( ret == QMessageBox::No ) {
|
||||
return;
|
||||
}
|
||||
if( ret == QMessageBox::No ) {
|
||||
return;
|
||||
}
|
||||
|
||||
_folderMan->slotRemoveFolder( alias );
|
||||
_folderMan->slotRemoveFolder( alias );
|
||||
|
||||
_statusDialog->slotFolderRemoved( _folderMan->folder(alias) );
|
||||
}
|
||||
|
||||
#ifdef HAVE_FETCH_AND_PUSH
|
||||
|
||||
@ -252,24 +252,6 @@ void StatusDialog::slotUpdateFolderState( Folder *folder )
|
||||
}
|
||||
}
|
||||
|
||||
void StatusDialog::slotFolderRemoved( Folder *folder )
|
||||
{
|
||||
QStandardItem *item = 0;
|
||||
int row = 0;
|
||||
|
||||
item = _model->item( row );
|
||||
|
||||
while( item ) {
|
||||
if( item->data( FolderViewDelegate::FolderAliasRole ) == folder->alias() ) {
|
||||
break;
|
||||
}
|
||||
item = _model->item( ++row );
|
||||
}
|
||||
if( item ) {
|
||||
_model->removeRow( row );
|
||||
}
|
||||
}
|
||||
|
||||
void StatusDialog::folderToModelItem( QStandardItem *item, Folder *f )
|
||||
{
|
||||
QIcon icon = _theme->folderIcon( f->backend(), 48 );
|
||||
@ -289,14 +271,16 @@ void StatusDialog::folderToModelItem( QStandardItem *item, Folder *f )
|
||||
|
||||
void StatusDialog::slotRemoveFolder()
|
||||
{
|
||||
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
||||
if( selected.isValid() ) {
|
||||
QString alias = _model->data( selected, FolderViewDelegate::FolderAliasRole ).toString();
|
||||
qDebug() << "Remove Folder alias " << alias;
|
||||
if( !alias.isEmpty() ) {
|
||||
emit(removeFolderAlias( alias ));
|
||||
QModelIndex selected = _folderList->selectionModel()->currentIndex();
|
||||
if( selected.isValid() ) {
|
||||
QString alias = _model->data( selected, FolderViewDelegate::FolderAliasRole ).toString();
|
||||
qDebug() << "Remove Folder alias " << alias;
|
||||
if( !alias.isEmpty() ) {
|
||||
// remove from file system through folder man
|
||||
emit(removeFolderAlias( alias ));
|
||||
_model->removeRow( selected.row() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StatusDialog::slotFetchFolder()
|
||||
|
||||
@ -89,7 +89,6 @@ public slots:
|
||||
void slotAddSync();
|
||||
void slotAddFolder( Folder* );
|
||||
void slotUpdateFolderState( Folder* );
|
||||
void slotFolderRemoved( Folder* );
|
||||
void slotCheckConnection();
|
||||
|
||||
protected slots:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user