threads / patch / 15797

patchRework the commit confirmation box a bit

Subject: [QGIT PATCH] Rework the commit confirmation box a bit

## tl;dr

2 messages between Oct 6, 2008 and Oct 6, 2008. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Abdelrazak Younes· Oct 6, 2008, 09:11 UTC · lore
The problem was that the dialog was too big for my whenever too many files
were changed. Now, the list of changed files is only shown whenever they are
less than 20; otherwise it is shown in the detailed text accessible though
the 'Show Detail' button.
---
  src/commitimpl.cpp |   25 ++++++++++++++++++++-----
  1 files changed, 20 insertions(+), 5 deletions(-)
Show changes to src/commitimpl.cpp +20 −5
diff --git a/src/commitimpl.cpp b/src/commitimpl.cpp
index 1540947..def5209 100644
--- a/src/commitimpl.cpp
+++ b/src/commitimpl.cpp
@@ -236,17 +236,32 @@ bool CommitImpl::checkConfirm(SCRef msg, SCRef 
patchName, SCList selFiles, bool
          (git->isStGITStack() ? "refresh top patch with" :
                          "amend last commit with") :
          (git->isStGITStack() ? "create a new patch with" : "commit");
-    QString text("Do you want to " + whatToDo + " the following 
file(s)?\n\n" +
-                 selFiles.join("\n") + "\n\nwith the message:\n\n");
+    QString text("Do you want to " + whatToDo);
+
+    bool const fullList = selFiles.size() < 20;
+    if (fullList) {
+        text.append(" the following file(s)?\n\n" + selFiles.join("\n")
+            + "\n\nwith the message:\n\n");
+    } else {
+        text.append(" those " + QString::number(selFiles.size())
+            + " files the with the message:\n\n");
+    }
+
      text.append(msg);
      if (git->isStGITStack())
          text.append("\n\nAnd patch name: " + patchName);

      QTextCodec::setCodecForCStrings(tc);

-    int but = QMessageBox::question(this, "Commit changes - QGit",
-                                    text, "&Yes", "&No", QString(), 0, 1);
-    return (but != 1);
+    QMessageBox msgBox(this);
+    msgBox.setWindowTitle("Commit changes - QGit");
+    msgBox.setText(text);
+    if (!fullList)
+        msgBox.setDetailedText(selFiles.join("\n"));
+    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+    msgBox.setDefaultButton(QMessageBox::Yes);
+
+    return msgBox.exec() != QMessageBox::No;
  }

  void CommitImpl::pushButtonSettings_clicked() {
-- 
1.6.0.2.1172.ga5ed0
Marco Costalba· Oct 6, 2008, 19:03 UTC · re: Abdelrazak Younes · lore

Re: [QGIT PATCH] Rework the commit confirmation box a bit

On Mon, Oct 6, 2008 at 11:11 AM, Abdelrazak Younes <younes@lyx.org> wrote:
Show 5 quoted lines
> The problem was that the dialog was too big for my whenever too many files
> were changed. Now, the list of changed files is only shown whenever they are
> less than 20; otherwise it is shown in the detailed text accessible though
> the 'Show Detail' button.
> ---
Thanks,
   patch applied and pushed.
Marco

← back to recent threads