Mercurial > hg > easyhg
diff mainwindow.cpp @ 361:4cd753e083cc feature_91b
Add Rename and Copy to right-button menu on file status widget.
(This is the real feature 91 -- I bungled the feature number with the earlier feature_91 branch, which actually addressed feature 106.)
author | Chris Cannam |
---|---|
date | Thu, 17 Mar 2011 17:34:23 +0000 |
parents | ea6f76c0aa76 |
children | 73fb5ef55744 |
line wrap: on
line diff
--- a/mainwindow.cpp Thu Mar 17 13:52:57 2011 +0000 +++ b/mainwindow.cpp Thu Mar 17 17:34:23 2011 +0000 @@ -781,6 +781,60 @@ } +void MainWindow::hgRenameFiles(QStringList files) +{ + QString renameTo; + + QString file; + if (files.empty()) return; + file = files[0]; + + if (ConfirmCommentDialog::confirmAndGetShortComment + (this, + tr("Rename"), + tr("Rename <code>%1</code> to:").arg(xmlEncode(file)), + renameTo, + tr("Rename"))) { + + if (renameTo != "" && renameTo != file) { + + QStringList params; + + params << "rename" << "--" << file << renameTo; + + m_runner->requestAction(HgAction(ACT_RENAME_FILE, m_workFolderPath, params)); + } + } +} + + +void MainWindow::hgCopyFiles(QStringList files) +{ + QString copyTo; + + QString file; + if (files.empty()) return; + file = files[0]; + + if (ConfirmCommentDialog::confirmAndGetShortComment + (this, + tr("Copy"), + tr("Copy <code>%1</code> to:").arg(xmlEncode(file)), + copyTo, + tr("Copy"))) { + + if (copyTo != "" && copyTo != file) { + + QStringList params; + + params << "copy" << "--" << file << copyTo; + + m_runner->requestAction(HgAction(ACT_COPY_FILE, m_workFolderPath, params)); + } + } +} + + void MainWindow::hgMarkFilesResolved(QStringList files) { QStringList params; @@ -2302,6 +2356,12 @@ connect(m_hgTabs, SIGNAL(revertFiles(QStringList)), this, SLOT(hgRevertFiles(QStringList))); + connect(m_hgTabs, SIGNAL(renameFiles(QStringList)), + this, SLOT(hgRenameFiles(QStringList))); + + connect(m_hgTabs, SIGNAL(copyFiles(QStringList)), + this, SLOT(hgCopyFiles(QStringList))); + connect(m_hgTabs, SIGNAL(addFiles(QStringList)), this, SLOT(hgAddFiles(QStringList)));