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

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

"""
Module implementing a dialog to enter the logout data for CVS.
"""

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from Ui_CvsLogoutDialog import Ui_CvsLogoutDialog
from Config import ConfigCvsProtocols

class CvsLogoutDialog(QDialog, Ui_CvsLogoutDialog):
    """
    Class implementing a dialog to enter the logout data for CVS.
    """
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent parent widget (QWidget)
        """
        QDialog.__init__(self, parent)
        self.setupUi(self)
        
        self.buttonBox.button(QDialogButtonBox.Ok).setText(self.trUtf8("Logout"))
        
        self.validator = QIntValidator(self)
        self.validator.setObjectName("portValidator")
        self.portEdit.setValidator(self.validator)
        
        self.protocolComboBox.addItems(ConfigCvsProtocols)
        
    def getData(self):
        """
        Public slot to retrieve the data entered into the dialog.
        
        @return a tuple of 5 strings (protocol, username, 
            remote hostname, remote port and repository).
        """
        return (unicode(self.protocolComboBox.currentText()),
            unicode(self.usernameEdit.text()),
            unicode(self.hostEdit.text()),
            unicode(self.portEdit.text()),
            unicode(self.repositoryEdit.text())
        )
