ClearCase: Add setting to not prompt for comment

Change-Id: I30807991e2a839088c9523280eab1dacd22a1bf4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Knut Petter Svendsen
2015-01-02 16:13:57 +01:00
committed by Orgad Shaneh
parent a4890d838d
commit a49134c47a
7 changed files with 59 additions and 18 deletions

View File

@@ -41,7 +41,7 @@
namespace ClearCase {
namespace Internal {
CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, QWidget *parent) :
CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, bool showComment, QWidget *parent) :
QDialog(parent), ui(new Ui::CheckOutDialog), m_actSelector(0)
{
ui->setupUi(this);
@@ -59,6 +59,9 @@ CheckOutDialog::CheckOutDialog(const QString &fileName, bool isUcm, QWidget *par
ui->verticalLayout->insertWidget(1, line);
}
if (!showComment)
hideComment();
ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus();
}
@@ -67,6 +70,14 @@ CheckOutDialog::~CheckOutDialog()
delete ui;
}
void CheckOutDialog::hideComment()
{
ui->lblComment->hide();
ui->txtComment->hide();
ui->verticalLayout->invalidate();
adjustSize();
}
QString CheckOutDialog::activity() const
{
return m_actSelector ? m_actSelector->activity() : QString();

View File

@@ -46,7 +46,7 @@ class CheckOutDialog : public QDialog
Q_OBJECT
public:
explicit CheckOutDialog(const QString &fileName, bool isUcm, QWidget *parent = 0);
explicit CheckOutDialog(const QString &fileName, bool isUcm, bool showComment, QWidget *parent = 0);
~CheckOutDialog();
QString activity() const;
QString comment() const;
@@ -56,6 +56,7 @@ public:
bool isUseHijacked() const;
void hideHijack();
void hideComment();
private slots:
void toggleUnreserved(bool checked);

View File

@@ -1586,7 +1586,7 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
const QString relFile = QDir(topLevel).relativeFilePath(absPath);
const QString file = QDir::toNativeSeparators(relFile);
const QString title = QString::fromLatin1("Checkout %1").arg(file);
CheckOutDialog coDialog(title, m_viewData.isUcm);
CheckOutDialog coDialog(title, m_viewData.isUcm, !m_settings.noComment);
// Only snapshot views can have hijacked files
bool isHijacked = (!m_viewData.isDynamic && (vcsStatus(absPath).status & FileStatus::Hijacked));
@@ -1598,11 +1598,13 @@ bool ClearCasePlugin::vcsOpen(const QString &workingDir, const QString &fileName
FileChangeBlocker fcb(absPath);
QStringList args(QLatin1String("checkout"));
QString comment = coDialog.comment();
if (comment.isEmpty())
const QString comment = coDialog.comment();
if (m_settings.noComment || comment.isEmpty())
args << QLatin1String("-nc");
else
args << QLatin1String("-c") << comment;
args << QLatin1String("-query");
const bool reserved = coDialog.isReserved();
const bool unreserved = !reserved || coDialog.isUnreserved();

View File

@@ -42,6 +42,7 @@ static const char commandKeyC[] = "Command";
static const char historyCountKeyC[] = "HistoryCount";
static const char timeOutKeyC[] = "TimeOut";
static const char autoCheckOutKeyC[] = "AutoCheckOut";
static const char noCommentKeyC[] = "NoComment";
static const char diffTypeKeyC[] = "DiffType";
static const char diffArgsKeyC[] = "DiffArgs";
static const char autoAssignActivityKeyC[] = "AutoAssignActivityName";
@@ -67,6 +68,7 @@ ClearCaseSettings::ClearCaseSettings() :
diffArgs(QLatin1String(defaultDiffArgs)),
autoAssignActivityName(true),
autoCheckOut(true),
noComment(false),
promptToCheckIn(false),
disableIndexer(false),
extDiffAvailable(false),
@@ -81,6 +83,7 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand).toString();
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool();
noComment = settings->value(QLatin1String(noCommentKeyC), false).toBool();
QString sDiffType = settings->value(QLatin1String(diffTypeKeyC), QLatin1String("Graphical")).toString();
switch (sDiffType[0].toUpper().toLatin1()) {
case 'G': diffType = GraphicalDiff; break;
@@ -108,6 +111,7 @@ void ClearCaseSettings::toSettings(QSettings *settings) const
settings->beginGroup(QLatin1String(groupC));
settings->setValue(QLatin1String(commandKeyC), ccCommand);
settings->setValue(QLatin1String(autoCheckOutKeyC), autoCheckOut);
settings->setValue(QLatin1String(noCommentKeyC), noComment);
settings->setValue(QLatin1String(timeOutKeyC), timeOutS);
QString sDiffType;
switch (diffType) {
@@ -136,6 +140,7 @@ bool ClearCaseSettings::equals(const ClearCaseSettings &s) const
&& historyCount == s.historyCount
&& timeOutS == s.timeOutS
&& autoCheckOut == s.autoCheckOut
&& noComment == s.noComment
&& diffType == s.diffType
&& diffArgs == s.diffArgs
&& autoAssignActivityName == s.autoAssignActivityName

View File

@@ -68,6 +68,7 @@ public:
QHash<QString, int> totalFiles;
bool autoAssignActivityName;
bool autoCheckOut;
bool noComment;
bool promptToCheckIn;
bool disableIndexer;
bool extDiffAvailable;

View File

@@ -63,6 +63,7 @@ ClearCaseSettings SettingsPageWidget::settings() const
rc.ccBinaryPath = m_ui.commandPathChooser->path();
rc.timeOutS = m_ui.timeOutSpinBox->value();
rc.autoCheckOut = m_ui.autoCheckOutCheckBox->isChecked();
rc.noComment = m_ui.noCommentCheckBox->isChecked();
if (m_ui.graphicalDiffRadioButton->isChecked())
rc.diffType = GraphicalDiff;
else if (m_ui.externalDiffRadioButton->isChecked())
@@ -82,6 +83,7 @@ void SettingsPageWidget::setSettings(const ClearCaseSettings &s)
m_ui.commandPathChooser->setPath(s.ccCommand);
m_ui.timeOutSpinBox->setValue(s.timeOutS);
m_ui.autoCheckOutCheckBox->setChecked(s.autoCheckOut);
m_ui.noCommentCheckBox->setChecked(s.noComment);
bool extDiffAvailable = !Environment::systemEnvironment().searchInPath(QLatin1String("diff")).isEmpty();
if (extDiffAvailable) {
m_ui.diffWarningLabel->setVisible(false);

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>363</width>
<height>403</height>
<width>512</width>
<height>589</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -65,7 +65,16 @@
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
@@ -190,16 +199,6 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="autoAssignActivityCheckBox">
<property name="toolTip">
<string>Check this if you have a trigger that renames the activity automatically. You will not be prompted for activity name.</string>
</property>
<property name="text">
<string>Aut&amp;o assign activity names</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="promptCheckBox">
<property name="text">
@@ -231,6 +230,26 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="autoAssignActivityCheckBox">
<property name="toolTip">
<string>Check this if you have a trigger that renames the activity automatically. You will not be prompted for activity name.</string>
</property>
<property name="text">
<string>Aut&amp;o assign activity names</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="noCommentCheckBox">
<property name="toolTip">
<string>Check out or check in files with no comment (-nc/omment).</string>
</property>
<property name="text">
<string>Do &amp;not prompt for comment during check out or check in</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>