From c59d7596c4452f8cb2212db6275be567e3d0e596 Mon Sep 17 00:00:00 2001 From: kostas Date: Sat, 27 Aug 2011 20:22:36 +0000 Subject: [PATCH] - Corrected saving of active workspace - Double-clicking a file now opens the file - Corrected fossil error status parsing on windows - Alternative method for storing the checkin messaage temporary file, since on windows fossil cannot access it. FossilOrigin-Name: ebc405be8ad1ef5d86dff36a352528ccb363b3c9 --- MainWindow.cpp | 47 +++++++++++++++++++++++++++++++---------------- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/MainWindow.cpp b/MainWindow.cpp index 9639a56..a6e1e6a 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -500,7 +500,7 @@ MainWindow::RepoStatus MainWindow::getRepoStatus() QStringList res; int exit_code = EXIT_FAILURE; - // We need to differentiate the reason why fossil has failed + // We need to determine the reason why fossil has failed // so we delay processing of the exit_code if(!runFossilRaw(QStringList() << "info", &res, &exit_code, SILENT_STATUS)) return REPO_NOT_FOUND; @@ -509,11 +509,12 @@ MainWindow::RepoStatus MainWindow::getRepoStatus() for(QStringList::iterator it=res.begin(); it!=res.end(); ++it) { - QStringList tokens = it->split(":"); - if(tokens.length()!=2) + int col_index = it->indexOf(':'); + if(col_index==-1) continue; - QString key = tokens[0].trimmed(); - QString value = tokens[1].trimmed(); + + QString key = it->left(col_index).trimmed(); + QString value = it->mid(col_index+1).trimmed(); if(key=="fossil") { @@ -642,14 +643,12 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int else last_line = buffer; - QChar cc = buffer[last_line_start]; - last_line = last_line.trimmed(); // Check if we have a query bool ends_qmark = !last_line.isEmpty() && last_line[last_line.length()-1]=='?'; bool have_yn_query = last_line.toLower().indexOf("y/n")!=-1; - int have_yna_query = last_line.toLower().indexOf("a=always/y/n")!=-1; + int have_yna_query = last_line.toLower().indexOf("a=always/y/n")!=-1 || last_line.toLower().indexOf("yes/no/all")!=-1; bool have_query = ends_qmark && (have_yn_query || have_yna_query); // Flush only the unneccessary part of the buffer to the log @@ -800,6 +799,8 @@ void MainWindow::saveSettings() qsettings.setValue("Path", workspaceHistory[i]); if(getCurrentWorkspace() == workspaceHistory[i]) qsettings.setValue("Active", true); + else + qsettings.remove("Active"); } qsettings.endArray(); @@ -937,7 +938,7 @@ void MainWindow::on_actionHistory_triggered() //------------------------------------------------------------------------------ void MainWindow::on_tableView_doubleClicked(const QModelIndex &/*index*/) { - on_actionDiff_triggered(); + on_actionOpenFile_triggered(); } //------------------------------------------------------------------------------ @@ -980,16 +981,30 @@ void MainWindow::on_actionCommit_triggered() // Do commit commitMessages.push_front(msg); - + QString comment_fname; { - QTemporaryFile comment_file; - comment_file.open(); - comment_file.write(msg.toUtf8()); - comment_file.close(); - - runFossil(QStringList() << "commit" << "--message-file" << QuotePath(comment_file.fileName()) << QuotePaths(modified_files) ); + QTemporaryFile temp_file; + if(!temp_file.open()) + { + QMessageBox::critical(this, tr("Error"), tr("Could not generate comment file"), QMessageBox::Ok ); + return; + } + comment_fname = temp_file.fileName(); } + QFile comment_file(comment_fname); + if(!comment_file.open(QIODevice::WriteOnly)) + { + QMessageBox::critical(this, tr("Error"), tr("Could not generate comment file"), QMessageBox::Ok ); + return; + } + + comment_file.write(msg.toUtf8()); + comment_file.close(); + + runFossil(QStringList() << "commit" << "--message-file" << QuotePath(comment_fname) << QuotePaths(modified_files) ); + QFile::remove(comment_fname); + refresh(); } diff --git a/manifest b/manifest index 982f4d3..8d76261 100644 --- a/manifest +++ b/manifest @@ -1,12 +1,12 @@ -C Dialog\srefactoring\nExtended\sthe\ssettings\sdialog\nReorganized\sthe\sworkspace\smanagement\scode\nFixed\sissue\swhere\sthe\sprevious\scurrent\sdirectory\swas\sin\seffect\seven\sin\snew\sworkspaces\nImproved\sthe\slog\sresponsiveness\son\slong\sfossil\soperations\n -D 2011-08-08T14:44:31.214 +C -\sCorrected\ssaving\sof\sactive\sworkspace\n-\sDouble-clicking\sa\sfile\snow\sopens\sthe\sfile\n-\sCorrected\sfossil\serror\sstatus\sparsing\son\swindows\n-\sAlternative\smethod\sfor\sstoring\sthe\scheckin\smessaage\stemporary\sfile,\ssince\son\swindows\sfossil\scannot\saccess\sit.\n +D 2011-08-27T20:22:36.138 F CommitDialog.cpp a1fcdc94933f4e1a144224c7c70f1e067d3ee31e F CommitDialog.h 0550b1b652924ae54b6f6c9274cad2d4c491808a F CommitDialog.ui 5067623f6af6f5a42c87df903278e383e945e154 F FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7 -F MainWindow.cpp c6f682988e59727d5235fbb821e34746724b1220 +F MainWindow.cpp c94e1ca92238e61aa20d2bcaa3451aa68cdf85cb F MainWindow.h 104f575b6fffe43880849c9ce8c8b986292e4d6c F MainWindow.ui 2f08596fe34f5496af90f6d355d4de857e77ad8a F RepoDialog.cpp 8f20e1511526973555c774350ec413dcecf51c9e @@ -173,7 +173,7 @@ F icons/fuel.icns 81e535004b62db801a02f3e15d0a33afc9d4070b F icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038 F main.cpp 360c3ec843cd72dcaf735b7fb6f51f5639830959 F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53 -P 81e1f4c7ec00176abd9d467add266f84b0e63059 -R ea0388f9e4683051a59d562c7fbdaf7c +P 945c841fba73be1355611554499e68a878b95359 +R 2034ab2c52807f06ab2b39767ab83cca U kostas -Z 1ba1cb23226ee30525026ffe7669a4da +Z e3cac8897a587ebf0fedbe6a8cd8165b diff --git a/manifest.uuid b/manifest.uuid index 7bef897..f5a1a13 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -945c841fba73be1355611554499e68a878b95359 \ No newline at end of file +ebc405be8ad1ef5d86dff36a352528ccb363b3c9 \ No newline at end of file