Chris@102: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@102: Chris@102: /* Chris@102: EasyMercurial Chris@102: Chris@102: Based on hgExplorer by Jari Korhonen Chris@102: Copyright (c) 2010 Jari Korhonen Chris@102: Copyright (c) 2010 Chris Cannam Chris@102: Copyright (c) 2010 Queen Mary, University of London Chris@102: Chris@102: This program is free software; you can redistribute it and/or Chris@102: modify it under the terms of the GNU General Public License as Chris@102: published by the Free Software Foundation; either version 2 of the Chris@102: License, or (at your option) any later version. See the file Chris@102: COPYING included with this distribution for more information. Chris@102: */ Chris@102: Chris@102: #include "confirmcommentdialog.h" Chris@102: Chris@102: #include Chris@102: #include Chris@102: Chris@102: bool ConfirmCommentDialog::confirmFilesAction(QWidget *parent, Chris@102: QString title, Chris@102: QString introText, Chris@102: QString introTextWithCount, Chris@102: QStringList files) Chris@102: { Chris@102: QString text; Chris@102: if (files.size() <= 10) { Chris@102: text = "" + introText; Chris@102: text += ""; Chris@102: foreach (QString file, files) { Chris@102: text += file + "
"; Chris@102: } Chris@102: text += "
"; Chris@102: } else { Chris@102: text = "" + introText.arg(files.size()); Chris@102: } Chris@102: return (QMessageBox::information(parent, Chris@102: title, Chris@102: text, Chris@102: QMessageBox::Ok | QMessageBox::Cancel, Chris@102: QMessageBox::Ok) Chris@102: == QMessageBox::Ok); Chris@102: } Chris@102: Chris@102: bool ConfirmCommentDialog::confirmAndComment(QWidget *parent, Chris@102: QString title, Chris@102: QString introText, Chris@102: QString introTextWithCount, Chris@102: QStringList files, Chris@102: QString &comment) Chris@102: { Chris@102: QString text; Chris@102: if (files.size() <= 10) { Chris@102: text = "" + introText; Chris@103: text += "

    "; Chris@102: foreach (QString file, files) { Chris@103: text += "
  • " + file + "
  • "; Chris@102: } Chris@103: text += "

Please enter your comment:"; Chris@102: } else { Chris@102: text = "" + introText.arg(files.size()); Chris@102: } Chris@102: return confirmAndComment(parent, title, text, comment); Chris@102: } Chris@102: Chris@102: bool ConfirmCommentDialog::confirmAndComment(QWidget *parent, Chris@102: QString title, Chris@102: QString introText, Chris@102: QString &comment) Chris@102: { Chris@102: bool ok = false; Chris@103: //!!! ok, for comments need more than one line Chris@102: comment = QInputDialog::getText(parent, title, introText, Chris@102: QLineEdit::Normal, comment, &ok); Chris@102: return ok; Chris@102: }