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

View File

@@ -46,7 +46,7 @@ class CheckOutDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit CheckOutDialog(const QString &fileName, bool isUcm, QWidget *parent = 0); explicit CheckOutDialog(const QString &fileName, bool isUcm, bool showComment, QWidget *parent = 0);
~CheckOutDialog(); ~CheckOutDialog();
QString activity() const; QString activity() const;
QString comment() const; QString comment() const;
@@ -56,6 +56,7 @@ public:
bool isUseHijacked() const; bool isUseHijacked() const;
void hideHijack(); void hideHijack();
void hideComment();
private slots: private slots:
void toggleUnreserved(bool checked); 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 relFile = QDir(topLevel).relativeFilePath(absPath);
const QString file = QDir::toNativeSeparators(relFile); const QString file = QDir::toNativeSeparators(relFile);
const QString title = QString::fromLatin1("Checkout %1").arg(file); 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 // Only snapshot views can have hijacked files
bool isHijacked = (!m_viewData.isDynamic && (vcsStatus(absPath).status & FileStatus::Hijacked)); 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); FileChangeBlocker fcb(absPath);
QStringList args(QLatin1String("checkout")); 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"); args << QLatin1String("-nc");
else else
args << QLatin1String("-c") << comment; args << QLatin1String("-c") << comment;
args << QLatin1String("-query"); args << QLatin1String("-query");
const bool reserved = coDialog.isReserved(); const bool reserved = coDialog.isReserved();
const bool unreserved = !reserved || coDialog.isUnreserved(); 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 historyCountKeyC[] = "HistoryCount";
static const char timeOutKeyC[] = "TimeOut"; static const char timeOutKeyC[] = "TimeOut";
static const char autoCheckOutKeyC[] = "AutoCheckOut"; static const char autoCheckOutKeyC[] = "AutoCheckOut";
static const char noCommentKeyC[] = "NoComment";
static const char diffTypeKeyC[] = "DiffType"; static const char diffTypeKeyC[] = "DiffType";
static const char diffArgsKeyC[] = "DiffArgs"; static const char diffArgsKeyC[] = "DiffArgs";
static const char autoAssignActivityKeyC[] = "AutoAssignActivityName"; static const char autoAssignActivityKeyC[] = "AutoAssignActivityName";
@@ -67,6 +68,7 @@ ClearCaseSettings::ClearCaseSettings() :
diffArgs(QLatin1String(defaultDiffArgs)), diffArgs(QLatin1String(defaultDiffArgs)),
autoAssignActivityName(true), autoAssignActivityName(true),
autoCheckOut(true), autoCheckOut(true),
noComment(false),
promptToCheckIn(false), promptToCheckIn(false),
disableIndexer(false), disableIndexer(false),
extDiffAvailable(false), extDiffAvailable(false),
@@ -81,6 +83,7 @@ void ClearCaseSettings::fromSettings(QSettings *settings)
ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand).toString(); ccBinaryPath = Utils::Environment::systemEnvironment().searchInPath(ccCommand).toString();
timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt(); timeOutS = settings->value(QLatin1String(timeOutKeyC), defaultTimeOutS).toInt();
autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool(); autoCheckOut = settings->value(QLatin1String(autoCheckOutKeyC), false).toBool();
noComment = settings->value(QLatin1String(noCommentKeyC), false).toBool();
QString sDiffType = settings->value(QLatin1String(diffTypeKeyC), QLatin1String("Graphical")).toString(); QString sDiffType = settings->value(QLatin1String(diffTypeKeyC), QLatin1String("Graphical")).toString();
switch (sDiffType[0].toUpper().toLatin1()) { switch (sDiffType[0].toUpper().toLatin1()) {
case 'G': diffType = GraphicalDiff; break; case 'G': diffType = GraphicalDiff; break;
@@ -108,6 +111,7 @@ void ClearCaseSettings::toSettings(QSettings *settings) const
settings->beginGroup(QLatin1String(groupC)); settings->beginGroup(QLatin1String(groupC));
settings->setValue(QLatin1String(commandKeyC), ccCommand); settings->setValue(QLatin1String(commandKeyC), ccCommand);
settings->setValue(QLatin1String(autoCheckOutKeyC), autoCheckOut); settings->setValue(QLatin1String(autoCheckOutKeyC), autoCheckOut);
settings->setValue(QLatin1String(noCommentKeyC), noComment);
settings->setValue(QLatin1String(timeOutKeyC), timeOutS); settings->setValue(QLatin1String(timeOutKeyC), timeOutS);
QString sDiffType; QString sDiffType;
switch (diffType) { switch (diffType) {
@@ -136,6 +140,7 @@ bool ClearCaseSettings::equals(const ClearCaseSettings &s) const
&& historyCount == s.historyCount && historyCount == s.historyCount
&& timeOutS == s.timeOutS && timeOutS == s.timeOutS
&& autoCheckOut == s.autoCheckOut && autoCheckOut == s.autoCheckOut
&& noComment == s.noComment
&& diffType == s.diffType && diffType == s.diffType
&& diffArgs == s.diffArgs && diffArgs == s.diffArgs
&& autoAssignActivityName == s.autoAssignActivityName && autoAssignActivityName == s.autoAssignActivityName

View File

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

View File

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

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>363</width> <width>512</width>
<height>403</height> <height>589</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@@ -65,7 +65,16 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <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> <number>0</number>
</property> </property>
<item> <item>
@@ -190,16 +199,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="7" column="0">
<widget class="QCheckBox" name="promptCheckBox"> <widget class="QCheckBox" name="promptCheckBox">
<property name="text"> <property name="text">
@@ -231,6 +230,26 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>