# # # patch "src/view/dialogs/CommitRevision.cpp" # from [bba8d6475e14a2003cad91417b9bdd901ac15f55] # to [525828662cd94b0fd99bf74bff7fcc56b48eff96] # # patch "src/view/dialogs/CommitRevision.h" # from [82f533b5b65f320a31dd7c1e728d72564b3f2915] # to [49e29696d84af23841bc2377b41183228dddb9cb] # ============================================================ --- src/view/dialogs/CommitRevision.cpp bba8d6475e14a2003cad91417b9bdd901ac15f55 +++ src/view/dialogs/CommitRevision.cpp 525828662cd94b0fd99bf74bff7fcc56b48eff96 @@ -19,9 +19,8 @@ ***************************************************************************/ #include "CommitRevision.h" -#include "Monotone.h" #include "Settings.h" -#include "Guitone.h" +#include "MonotoneUtil.h" #include "WorkspaceCommitter.h" #include @@ -29,17 +28,18 @@ #include #include -CommitRevision::CommitRevision(QWidget* parent) : Dialog(parent) +CommitRevision::CommitRevision(QWidget * parent, const WorkspacePath & workspace) + : Dialog(parent), workspacePath(workspace) { setupUi(this); Dialog::init(); - + // OSX sheet-alike dialog setWindowFlags(Qt::Sheet); - + QStringList entries = Settings::getItemList("ChangelogEntries"); QRegExp re("\\s+"); - + for (int i=0, j=entries.size(); iinsertItem(i, shortened, QVariant(entry)); } - - revModel = new GetRevision(this); + + revModel = new GetRevision(this, MonotoneUtil::getDatabaseFile(workspacePath)); changeView->setModel(revModel); revModel->readRevision(QString()); - + connect( revModel, SIGNAL(revisionRead()), this, SLOT(revisionRead()) ); - + connect( previousChangelogEntryList, SIGNAL(currentIndexChanged(int)), this, SLOT(setChangelogEntryFromList(int)) ); - + connect( changesAgainstParent, SIGNAL(currentIndexChanged(const QString &)), revModel, SLOT(showChangesAgainstParent(const QString &)) ); - + // initialize the text view with the most recent entry setChangelogEntryFromList(0); } @@ -87,9 +87,9 @@ void CommitRevision::accept() void CommitRevision::accept() { Settings::addItemToList("ChangelogEntries", changelogEntry->toPlainText(), 10); - - QString branch = MonotoneDelegate::getBranchName(this, QString()); - + + QString branch = MonotoneUtil::getBranchName(workspacePath, QString()); + if (branch.isEmpty() && !checkAltBranch->isChecked()) { QMessageBox::critical( @@ -101,7 +101,7 @@ void CommitRevision::accept() checkAltBranch->setChecked(true); return; } - + if (checkAltBranch->isChecked()) { QString altBranchStr = altBranch->text().trimmed(); @@ -117,9 +117,9 @@ void CommitRevision::accept() } branch = altBranchStr; } - + QString author; - + if (checkAltAuthor->isChecked()) { QString altAuthorStr = altAuthor->text().trimmed(); @@ -135,9 +135,9 @@ void CommitRevision::accept() } author = altAuthorStr; } - - QStringList keys = MonotoneDelegate::getPrivateKeyList(this); - + + QStringList keys = MonotoneUtil::getPrivateKeyList(MonotoneUtil::getDatabaseFile(workspacePath)); + if (keys.size() == 0) { QMessageBox::critical( @@ -150,14 +150,14 @@ void CommitRevision::accept() ); return; } - + QString selectedKey = keys.at(0); - + if (keys.size() > 1) { bool ok; QString key = QInputDialog::getItem( - this, tr("Please select a key"), + this, tr("Please select a key"), tr("More than one private key is available.\n" "Please select the key with which you like to sign this commit:"), keys, 0, false, &ok); @@ -167,12 +167,10 @@ void CommitRevision::accept() } selectedKey = key; } - - WorkspaceCommitter committer( - this, selectedKey, branch, author, changelogEntry->toPlainText() - ); - - if (!committer.run()) + + WorkspaceCommitter committer(workspacePath); + + if (!committer.run(selectedKey, branch, author, changelogEntry->toPlainText())) { QMessageBox::critical( this, @@ -185,7 +183,7 @@ void CommitRevision::accept() done(0); return; } - + done(1); } @@ -201,7 +199,7 @@ void CommitRevision::revisionRead() ); reject(); } - + changesAgainstParent->addItems(revModel->getParentRevisions()); } ============================================================ --- src/view/dialogs/CommitRevision.h 82f533b5b65f320a31dd7c1e728d72564b3f2915 +++ src/view/dialogs/CommitRevision.h 49e29696d84af23841bc2377b41183228dddb9cb @@ -27,15 +27,16 @@ class CommitRevision : public Dialog, pr class CommitRevision : public Dialog, private Ui::CommitRevision { - Q_OBJECT + Q_OBJECT public: - CommitRevision(QWidget*); - ~CommitRevision(); + CommitRevision(QWidget *, const WorkspacePath &); + ~CommitRevision(); private: GetRevision * revModel; - + WorkspacePath workspacePath; + private slots: void setChangelogEntryFromList(int); void revisionRead();