# HG changeset patch # User Jari Korhonen # Date 1273837807 -10800 # Node ID 7189e9994a60237aaebb00d38492d6718531b661 # Parent 05e11c4ce616ac163a93842fcb71a2c9395872c3 Ver 0.3.8: Fixed confusing add- button. Remove does no backup. Merge- button enable fixed. diff -r 05e11c4ce616 -r 7189e9994a60 common.h --- a/common.h Fri May 14 13:33:25 2010 +0300 +++ b/common.h Fri May 14 14:50:07 2010 +0300 @@ -6,7 +6,7 @@ #include #define APPNAME "HgExplorer" -#define APPVERSION "0.3.7" +#define APPVERSION "0.3.8" #define MY_ICON_SIZE 32 #define REPOMENU_TITLE "Repository actions" #define WORKFOLDERMENU_TITLE "Workfolder actions" diff -r 05e11c4ce616 -r 7189e9994a60 mainwindow.cpp --- a/mainwindow.cpp Fri May 14 13:33:25 2010 +0300 +++ b/mainwindow.cpp Fri May 14 14:50:07 2010 +0300 @@ -246,7 +246,18 @@ { QStringList params; - params << "add"; + QString currentFile = hgExp -> getCurrentFileListLine(); + + if (isSelectedUntracked(hgExp -> workFolderFileList)) + { + //User wants to add one file + params << "add" << currentFile.mid(2); + } + else + { + //Add all untracked files + params << "add"; + } runner -> startProc(getHgBinaryName(), workFolderPath, params); runningAction = ACT_ADD; @@ -412,7 +423,7 @@ QStringList params; QString currentFile = hgExp -> getCurrentFileListLine(); - params << "revert" << currentFile.mid(2); + params << "revert" << "--no-backup" << currentFile.mid(2); runner -> startProc(getHgBinaryName(), workFolderPath, params); runningAction = ACT_REVERT; @@ -598,7 +609,7 @@ return false; } -void MainWindow::countAMRModifications(QListWidget *workList, int& a, int& m, int& r) +void MainWindow::countAMRNModifications(QListWidget *workList, int& a, int& m, int& r, int& n) { int itemCount = workList -> count(); if (itemCount > 0) @@ -606,6 +617,7 @@ int A= 0; int M=0; int R=0; + int N=0; for (int i = 0; i < workList -> count(); i++) { QListWidgetItem *currItem = workList -> item(i); @@ -623,17 +635,23 @@ { A++; } + else if (tmp == "?") + { + N++; + } } a = A; m = M; r = R; + n = N; } else { a = 0; m = 0; r = 0; + n = 0; } } @@ -870,8 +888,8 @@ hgExp -> enableDisableOtherTabs(); - int a, m, r; - countAMRModifications(hgExp -> workFolderFileList, a, m, r); + int a, m, r, n; + countAMRNModifications(hgExp -> workFolderFileList, a, m, r, n); if (tabPage == WORKTAB) { @@ -898,7 +916,8 @@ hgRevertAct -> setEnabled(false); } - if (!isSelectedUntracked(hgExp -> workFolderFileList)) + //JK 14.5.2010: Fixed confusing add button. Now this is simple: If we have something to add (any non-tracked files), add is enabled. + if (n == 0) { hgAddAct -> setEnabled(false); } @@ -910,7 +929,7 @@ hgResolveListAct -> setEnabled(true); - if (hgExp -> localRepoHeadsList->count() == 1) + if (hgExp -> localRepoHeadsList->count() < 2) { hgMergeAct -> setEnabled(false); } @@ -1005,7 +1024,7 @@ hgRevertAct->setStatusTip(tr("Undo selected working folder file changes (return to local repository version)")); hgAddAct = new QAction(QIcon(":/images/add.png"), tr("Add files"), this); - hgAddAct -> setStatusTip(tr("Add working folder files to local repository (on next commit)")); + hgAddAct -> setStatusTip(tr("Add working folder files (selected one or all yet untracked) to local repository (on next commit)")); hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("Remove file"), this); hgRemoveAct -> setStatusTip(tr("Remove selected working folder file from local repository (on next commit)")); diff -r 05e11c4ce616 -r 7189e9994a60 mainwindow.h --- a/mainwindow.h Fri May 14 13:33:25 2010 +0300 +++ b/mainwindow.h Fri May 14 14:50:07 2010 +0300 @@ -143,7 +143,7 @@ void splitChangeSets(QStringList *list, QString hgLogOutput); int getCommitComment(QString& comment); void presentLongStdoutToUser(QString stdo); - void countAMRModifications(QListWidget *workList, int& a, int& m, int& r); + void countAMRNModifications(QListWidget *workList, int& a, int& m, int& r, int& n); bool isSelectedModified(QListWidget *workList); bool isSelectedUntracked(QListWidget *workList); bool isSelectedLocallyDeleted(QListWidget *workList);