summaryrefslogtreecommitdiffstats
path: root/vcs/subversion/svn_copywidget.cpp
blob: e781ca10143d14535ef38b072dcae735d81b27cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "svn_copywidget.h"
#include <klineedit.h>
#include <kurl.h>
#include "subversion_global.h"
#include <kurlrequester.h>
#include <knuminput.h>
#include <kcombobox.h>
#include <tqradiobutton.h>

SvnCopyDialog::SvnCopyDialog( const TQString &reqPath, SvnGlobal::SvnInfoHolder *holder, TQWidget *tqparent )
	: SvnCopyDialogBase( tqparent )
	, m_holder(holder)
{
	reqEdit->setText( reqPath );

	connect( urlRadio, TQT_SIGNAL(clicked()), this, TQT_SLOT(setSourceAsUrl()) );
	connect( pathRadio, TQT_SIGNAL(clicked()), this, TQT_SLOT(setSourceAsLocalPath()) );
	connect( revnumRadio, TQT_SIGNAL(toggled(bool)), revnumInput, TQT_SLOT(setEnabled(bool)) );
	connect( revnumRadio, TQT_SIGNAL(toggled(bool)), revkindCombo, TQT_SLOT(setDisabled(bool)) );
	
	// In many cases, users copy from reository to repository. This is for making tag/branche.
	// The case where copying from local path to repository may be lesser than the above one.
	// Thus, by default retrieve the repository URL of the given local path
	urlRadio->setChecked( true );
	srcEdit->setText( m_holder->url.prettyURL() );
	// Also, revision is set to HEAD by default
	revkindRadio->setChecked( true );
	revkindCombo->insertItem( "HEAD" );
}

SvnCopyDialog::~SvnCopyDialog()
{
}

KURL SvnCopyDialog::sourceUrl()
{
	return KURL( srcEdit->text() );
}

int SvnCopyDialog::revision()
{
	if( revnumRadio->isChecked() )
		return revnumInput->value();
	else
		return -1;
}

TQString SvnCopyDialog::revKind()
{
	if( revkindRadio->isChecked() )
		return revkindCombo->currentText();
	else
		return TQString("");
}

KURL SvnCopyDialog::destUrl()
{
	return KURL( destRequester->url() );
}

void SvnCopyDialog::setSourceAsUrl()
{
	srcEdit->setText( m_holder->url.prettyURL() );
	revkindCombo->clear();
	revkindCombo->insertItem( "HEAD" );
}

void SvnCopyDialog::setSourceAsLocalPath()
{
	srcEdit->setText( reqEdit->text() );
	revkindCombo->clear();
	revkindCombo->insertItem( "WORKING" );
}

#include "svn_copywidget.moc"