# -*- coding: utf-8 -*-

# Copyright (c) 2003 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a dialog to enter the data for a merge operation.
"""

from qt import *

from MergeForm import MergeForm

class CvsMergeDialog(MergeForm):
    """
    Class implementing a dialog to enter the data for a merge operation.
    """
    def __init__(self, taglist, parent = None):
        """
        Constructor
        
        Arguments
        
            taglist -- list of previously entered tags (QStringList)
            
            parent -- parent widget (QWidget)
        """
        MergeForm.__init__(self, parent, None, 1)
       
        dummy = self.trUtf8('dummy')
        
        self.tag1Combo.clear()
        self.tag1Combo.insertStringList(taglist)
        self.tag2Combo.clear()
        self.tag2Combo.insertStringList(taglist)
        
    def enableOkButton(self, text):
        """
        Private method used to enable/disable the OK-button.
        
        Arguments
        
            text -- ignored
        """
        self.okButton.setDisabled(text.isEmpty())
    
    def getParameters(self):
        """
        Public method to retrieve the tag data.
        
        Returns
        
            tuple naming two tag names or two revisions (QString, QString)
        """
        return (self.tag1Combo.currentText(), self.tag2Combo.currentText())
