diff mainwindow.cpp @ 362:73fb5ef55744

Merge from branch "feature_91b". Really fixes #91
author Chris Cannam
date Thu, 17 Mar 2011 17:34:40 +0000
parents 550650bbb959 4cd753e083cc
children f89e50d748ed
line wrap: on
line diff
--- a/mainwindow.cpp	Thu Mar 17 16:36:02 2011 +0000
+++ b/mainwindow.cpp	Thu Mar 17 17:34:40 2011 +0000
@@ -783,6 +783,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;
@@ -2313,6 +2367,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)));