void AccountSettings::slotRemoveCurrentFolder() { QModelIndex selected = ui->_folderList->selectionModel()->currentIndex(); if( selected.isValid() ) { QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString(); qDebug() << "Remove Folder alias " << alias; if( !alias.isEmpty() ) { // remove from file system through folder man // _model->removeRow( selected.row() ); int ret = QMessageBox::question( this, tr("Confirm Folder Remove"), tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>" "<p><b>Note:</b> This will not remove the files from your client.</p>").arg(alias), QMessageBox::Yes|QMessageBox::No ); if( ret == QMessageBox::No ) { return; } FolderMan *folderMan = FolderMan::instance(); folderMan->slotRemoveFolder( alias ); setFolderList(folderMan->map()); emit folderChanged(); slotCheckConnection(); } } }
void AccountSettings::slotRemoveCurrentFolder() { QModelIndex selected = ui->_folderList->selectionModel()->currentIndex(); if( selected.isValid() ) { int row = selected.row(); QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString(); qDebug() << "Remove Folder alias " << alias; if( !alias.isEmpty() ) { // remove from file system through folder man // _model->removeRow( selected.row() ); int ret = QMessageBox::question( this, tr("Confirm Folder Remove"), tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>" "<p><b>Note:</b> This will not remove the files from your client.</p>").arg(alias), QMessageBox::Yes|QMessageBox::No ); if( ret == QMessageBox::No ) { return; } /* Remove the selected item from the timer hash. */ QStandardItem *item = NULL; if( selected.isValid() ) item = _model->itemFromIndex(selected); if( selected.isValid() && item && _hideProgressTimers.contains(item) ) { QTimer *t = _hideProgressTimers[item]; t->stop(); _hideProgressTimers.remove(item); delete(t); } FolderMan *folderMan = FolderMan::instance(); folderMan->slotRemoveFolder( alias ); _model->removeRow(row); // single folder fix to show add-button and hide remove-button slotButtonsSetEnabled(); emit folderChanged(); } } }