Added more messageboxes for failed fossil operations

FossilOrigin-Name: 2193c91c253a1de2657a19df0aa9a8b6604c7006
This commit is contained in:
Kostas
2015-08-17 08:29:14 +00:00
parent af805db1cb
commit 925ab25ff5
3 changed files with 54 additions and 30 deletions

View File

@ -1,5 +1,5 @@
C More\srefactoring\nAdded\smessageboxes\sfor\sfailed\sfossil\soperations C Added\smore\smessageboxes\sfor\sfailed\sfossil\soperations
D 2015-08-17T07:59:11.634 D 2015-08-17T08:29:14.007
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35 F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
@ -231,7 +231,7 @@ F src/FslSettingsDialog.cpp e00907d493fba469e48a008aecda88426350b5ac
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7 F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261 F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
F src/MainWindow.cpp cf6fbd8899450eb0e2b36cc7164f9bbed158d4a3 F src/MainWindow.cpp fd738336d66824cda5e9a466c40e4ac14a773d02
F src/MainWindow.h f4cffbe4d360d30aa2eeaa25fc6d50d0a39c617f F src/MainWindow.h f4cffbe4d360d30aa2eeaa25fc6d50d0a39c617f
F src/RemoteDialog.cpp 8540cc5e2e41c4127ed8a028d84691604fa6ecac F src/RemoteDialog.cpp 8540cc5e2e41c4127ed8a028d84691604fa6ecac
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
@ -260,7 +260,7 @@ F ui/MainWindow.ui f9774e6dddb9462d8072bffd6c511bee7f470b9d
F ui/RemoteDialog.ui 95a4750d972ed8c49bb10b95db91ff16cfe2dd0b F ui/RemoteDialog.ui 95a4750d972ed8c49bb10b95db91ff16cfe2dd0b
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
F ui/SettingsDialog.ui 47b9a31e28ad523f14a1c4cd361270b6babbdf7d F ui/SettingsDialog.ui 47b9a31e28ad523f14a1c4cd361270b6babbdf7d
P b3dc68271fb2d6fbbe80060d3ec3d206f5f0097f P 4a23244f2aa93ec132a74c5b3a7c04d467596963
R 00cfe48a55ac81ffde7b0af6cc9b02a2 R 22051361a24d2af1d4bfda8b2c0ad21b
U Kostas U Kostas
Z 6a4f874191db12554ccdfebdf92dbb55 Z 3381705577434562ff9ce5a56a9f21b3

View File

@ -1 +1 @@
4a23244f2aa93ec132a74c5b3a7c04d467596963 2193c91c253a1de2657a19df0aa9a8b6604c7006

View File

@ -1543,7 +1543,9 @@ void MainWindow::on_actionCommit_triggered()
if(commit_files.size() != all_modified_files.size()) if(commit_files.size() != all_modified_files.size())
files = commit_files; files = commit_files;
fossil().commitFiles(files, msg, branch_name, private_branch); if(!fossil().commitFiles(files, msg, branch_name, private_branch))
QMessageBox::critical(this, tr("Error"), tr("Could not commit changes."), QMessageBox::Ok);
refresh(); refresh();
} }
@ -1561,7 +1563,9 @@ void MainWindow::on_actionAdd_triggered()
return; return;
// Do Add // Do Add
fossil().addFiles(selection); if(!fossil().addFiles(selection))
QMessageBox::critical(this, tr("Error"), tr("Could not add files."), QMessageBox::Ok);
refresh(); refresh();
} }
@ -1586,7 +1590,10 @@ void MainWindow::on_actionDelete_triggered()
// Remove repository files // Remove repository files
if(!repo_files.empty()) if(!repo_files.empty())
fossil().removeFiles(repo_files, remove_local); {
if(!fossil().removeFiles(repo_files, remove_local))
QMessageBox::critical(this, tr("Error"), tr("Could not remove files."), QMessageBox::Ok);
}
// Remove unknown local files if selected // Remove unknown local files if selected
if(remove_local) if(remove_local)
@ -1615,7 +1622,9 @@ void MainWindow::on_actionRevert_triggered()
return; return;
// Do Revert // Do Revert
fossil().revertFiles(modified_files); if(!fossil().revertFiles(modified_files))
QMessageBox::critical(this, tr("Error"), tr("Could not revert files."), QMessageBox::Ok);
refresh(); refresh();
} }
@ -1644,7 +1653,8 @@ void MainWindow::on_actionRename_triggered()
} }
// Do Rename // Do Rename
fossil().renameFile(fi_before.filePath(), fi_after.filePath(), true); if(!fossil().renameFile(fi_before.filePath(), fi_after.filePath(), true))
QMessageBox::critical(this, tr("Error"), tr("Could not rename file '%0' to '%1'").arg(fi_before.filePath(), fi_after.filePath()), QMessageBox::Ok);
refresh(); refresh();
} }
@ -1676,7 +1686,8 @@ void MainWindow::on_actionUndo_triggered()
QStringList res; QStringList res;
// Do test Undo // Do test Undo
fossil().undoRepository(res, true); if(!fossil().undoRepository(res, true))
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
if(res.length()>0 && res[0]=="No undo or redo is available") if(res.length()>0 && res[0]=="No undo or redo is available")
return; return;
@ -1685,7 +1696,8 @@ void MainWindow::on_actionUndo_triggered()
return; return;
// Do Undo // Do Undo
fossil().undoRepository(res, false); if(!fossil().undoRepository(res, false))
QMessageBox::critical(this, tr("Error"), tr("Could not undo changes."), QMessageBox::Ok);
refresh(); refresh();
} }
@ -1782,7 +1794,6 @@ void MainWindow::on_actionFossilSettings_triggered()
QString value = it.value().Value.toString(); QString value = it.value().Value.toString();
fossil().setFossilSetting(name, value, type == Settings::Setting::TYPE_FOSSIL_GLOBAL); fossil().setFossilSetting(name, value, type == Settings::Setting::TYPE_FOSSIL_GLOBAL);
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -2137,7 +2148,8 @@ void MainWindow::on_actionCreateStash_triggered()
} }
// Do Stash // Do Stash
fossil().stashNew(stashed_files, stash_name, revert); if(!fossil().stashNew(stashed_files, stash_name, revert))
QMessageBox::critical(this, tr("Error"), tr("Could not create stash."), QMessageBox::Ok);
refresh(); refresh();
} }
@ -2164,6 +2176,7 @@ void MainWindow::on_actionApplyStash_triggered()
if(!fossil().stashApply(*id_it)) if(!fossil().stashApply(*id_it))
{ {
log(tr("Stash application aborted due to errors")+"\n"); log(tr("Stash application aborted due to errors")+"\n");
QMessageBox::critical(this, tr("Error"), tr("Could not apply stash."), QMessageBox::Ok);
return; return;
} }
} }
@ -2177,6 +2190,7 @@ void MainWindow::on_actionApplyStash_triggered()
if(!fossil().stashDrop(*id_it)) if(!fossil().stashDrop(*id_it))
{ {
log(tr("Stash deletion aborted due to errors")+"\n"); log(tr("Stash deletion aborted due to errors")+"\n");
QMessageBox::critical(this, tr("Error"), tr("Could not delete stash."), QMessageBox::Ok);
return; return;
} }
} }
@ -2205,6 +2219,7 @@ void MainWindow::on_actionDeleteStash_triggered()
if(!fossil().stashDrop(*id_it)) if(!fossil().stashDrop(*id_it))
{ {
log(tr("Stash deletion aborted due to errors")+"\n"); log(tr("Stash deletion aborted due to errors")+"\n");
QMessageBox::critical(this, tr("Error"), tr("Could not delete stash."), QMessageBox::Ok);
return; return;
} }
} }
@ -2225,7 +2240,8 @@ void MainWindow::on_actionDiffStash_triggered()
Q_ASSERT(id_it!=getWorkspace().getStashes().end()); Q_ASSERT(id_it!=getWorkspace().getStashes().end());
// Run diff // Run diff
fossil().stashDiff(*id_it); if(!fossil().stashDiff(*id_it))
QMessageBox::critical(this, tr("Error"), tr("Could not diff stash."), QMessageBox::Ok);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -2372,7 +2388,8 @@ void MainWindow::dropEvent(QDropEvent *event)
return; return;
// Do Add // Do Add
fossil().addFiles(newfiles); if(!fossil().addFiles(newfiles))
QMessageBox::critical(this, tr("Error"), tr("Could not add files."), QMessageBox::Ok);
refresh(); refresh();
} }
@ -2580,7 +2597,7 @@ void MainWindow::mergeRevision(const QString &defaultRevision)
// Do test merge // Do test merge
if(!fossil().branchMerge(res, revision, integrate, force, true)) if(!fossil().branchMerge(res, revision, integrate, force, true))
{ {
QMessageBox::critical(this, tr("Error"), tr("Merge Failed."), QMessageBox::Ok); QMessageBox::critical(this, tr("Error"), tr("Merge failed."), QMessageBox::Ok);
return; return;
} }
@ -2588,10 +2605,10 @@ void MainWindow::mergeRevision(const QString &defaultRevision)
return; return;
// Do update // Do update
if(fossil().branchMerge(res, revision, integrate, force, false)) if(!fossil().branchMerge(res, revision, integrate, force, false))
log(tr("Merge completed. Don't forget to commit!")+"\n"); QMessageBox::critical(this, tr("Error"), tr("Merge failed."), QMessageBox::Ok);
else else
QMessageBox::critical(this, tr("Error"), tr("Merge Failed."), QMessageBox::Ok); log(tr("Merge completed. Don't forget to commit!")+"\n");
refresh(); refresh();
} }
@ -2678,7 +2695,8 @@ void MainWindow::on_actionPushRemote_triggered()
if(!url.isLocalFile()) if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore()); KeychainGet(this, url, *settings.GetStore());
fossil().pushRepository(url); if(!fossil().pushRepository(url))
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -2695,7 +2713,8 @@ void MainWindow::on_actionPullRemote_triggered()
if(!url.isLocalFile()) if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore()); KeychainGet(this, url, *settings.GetStore());
fossil().pullRepository(url); if(!fossil().pullRepository(url))
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -2705,7 +2724,7 @@ void MainWindow::on_actionPush_triggered()
if(url.isEmpty()) if(url.isEmpty())
{ {
QMessageBox::critical(this, tr("Error"), tr("A default remote repository has not been specified."), QMessageBox::Ok ); QMessageBox::critical(this, tr("Error"), tr("A default remote repository has not been specified."), QMessageBox::Ok);
return; return;
} }
@ -2713,7 +2732,8 @@ void MainWindow::on_actionPush_triggered()
if(!url.isLocalFile()) if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore()); KeychainGet(this, url, *settings.GetStore());
fossil().pushRepository(url); if(!fossil().pushRepository(url))
QMessageBox::critical(this, tr("Error"), tr("Could not push to the remote repository."), QMessageBox::Ok);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -2723,7 +2743,7 @@ void MainWindow::on_actionPull_triggered()
if(url.isEmpty()) if(url.isEmpty())
{ {
QMessageBox::critical(this, tr("Error"), tr("A default remote repository has not been specified."), QMessageBox::Ok ); QMessageBox::critical(this, tr("Error"), tr("A default remote repository has not been specified."), QMessageBox::Ok);
return; return;
} }
@ -2731,7 +2751,8 @@ void MainWindow::on_actionPull_triggered()
if(!url.isLocalFile()) if(!url.isLocalFile())
KeychainGet(this, url, *settings.GetStore()); KeychainGet(this, url, *settings.GetStore());
fossil().pullRepository(url); if(!fossil().pullRepository(url))
QMessageBox::critical(this, tr("Error"), tr("Could not pull from the remote repository."), QMessageBox::Ok);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -2753,7 +2774,10 @@ void MainWindow::on_actionSetDefaultRemote_triggered()
// which breaks commits due to a missing password when autosync is enabled // which breaks commits due to a missing password when autosync is enabled
// so only set the remote url when there is no password set // so only set the remote url when there is no password set
if(url.password().isEmpty()) if(url.password().isEmpty())
fossil().setRemoteUrl(url); {
if(!fossil().setRemoteUrl(url))
QMessageBox::critical(this, tr("Error"), tr("Could not set the remote repository."), QMessageBox::Ok);
}
} }
updateWorkspaceView(); updateWorkspaceView();
@ -2772,7 +2796,7 @@ void MainWindow::on_actionAddRemote_triggered()
KeychainDelete(this, url, *settings.GetStore()); KeychainDelete(this, url, *settings.GetStore());
if(!KeychainSet(this, url, *settings.GetStore())) if(!KeychainSet(this, url, *settings.GetStore()))
QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok ); QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok);
} }
url.setPassword(""); url.setPassword("");