diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp
index 3ee69a7baf..1bf56d70df 100644
--- a/src/mirall/application.cpp
+++ b/src/mirall/application.cpp
@@ -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 %1?").arg(alias),
- QMessageBox::Yes|QMessageBox::No );
+ int ret = QMessageBox::question( 0, tr("Confirm Folder Remove"), tr("Do you really want to remove upload folder %1?").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
diff --git a/src/mirall/statusdialog.cpp b/src/mirall/statusdialog.cpp
index 2acfd46969..351c14e333 100644
--- a/src/mirall/statusdialog.cpp
+++ b/src/mirall/statusdialog.cpp
@@ -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()
diff --git a/src/mirall/statusdialog.h b/src/mirall/statusdialog.h
index e3be52b3cd..2890ac9212 100644
--- a/src/mirall/statusdialog.h
+++ b/src/mirall/statusdialog.h
@@ -89,7 +89,6 @@ public slots:
void slotAddSync();
void slotAddFolder( Folder* );
void slotUpdateFolderState( Folder* );
- void slotFolderRemoved( Folder* );
void slotCheckConnection();
protected slots: