summaryrefslogtreecommitdiffstats
path: root/vcs/subversion/svn_switchwidget.cpp
blob: ec1b603c3233dac96d29bf65fa0f78d3a1772dc9 (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
#include <kurl.h>
#include <klineedit.h>
#include <qcheckbox.h>
#include <qradiobutton.h>

#include "svn_switchwidget.h"
#include "subversion_global.h"

SvnSwitchDlg::SvnSwitchDlg( const SvnGlobal::SvnInfoHolder *holder,
							const QString &wcPath, QWidget *parent )
	: SvnSwitchDlgBase( parent )
	, m_info( holder )
{
	connect( switchOnlyRadio, SIGNAL(clicked()), this, SLOT(resetCurrentRepositoryUrlEdit()) );
	connect( relocationRadio , SIGNAL(clicked()), this, SLOT(resetCurrentRepositoryUrlEdit()) );
	// set switch only
	switchOnlyRadio->setChecked( true );
	wcUrlEdit->setText( wcPath );
	currentUrlEdit->setText( m_info->url.prettyURL() );
}

SvnSwitchDlg::~SvnSwitchDlg()
{}

const QString SvnSwitchDlg::currentUrl()
{
	return currentUrlEdit->text();
}
const QString SvnSwitchDlg::destUrl()
{
	return destUrlEdit->text();
}

bool SvnSwitchDlg::recursive()
{
	return (! nonRecurseCheck->isChecked() );
}
bool SvnSwitchDlg::switchOnly()
{
	return switchOnlyRadio->isChecked();
}
bool SvnSwitchDlg::relocation()
{
	return relocationRadio->isChecked();
}

void SvnSwitchDlg::resetCurrentRepositoryUrlEdit()
{
	if( relocation() ){
		// only ROOT repository url should be given
		currentUrlEdit->setText( m_info->reposRootUrl.prettyURL() );
	} else if( switchOnly() ){
		// the full URL of item should be given
		currentUrlEdit->setText( m_info->url.prettyURL() );
	} else{
		// should not reach here!!
	}
}

#include "svn_switchwidget.moc"