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 76 77 78 79 80
|
/***************************************************************************
* Copyright 2007 Dukju Ahn <dukjuahn@gmail.com> *
* Copyright 2007 Andreas Pakulat <apaku@gmx.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "svnimportmetadatawidget.h"
#include "ui_importmetadatawidget.h"
#include <vcs/vcslocation.h>
SvnImportMetadataWidget::SvnImportMetadataWidget( QWidget *parent )
: VcsImportMetadataWidget( parent ), m_ui(new Ui::SvnImportMetadataWidget)
, useSourceDirForDestination( false )
{
m_ui->setupUi( this );
m_ui->srcEdit->setUrl( QUrl() );
connect( m_ui->srcEdit, &KUrlRequester::textChanged, this, &KDevelop::VcsImportMetadataWidget::changed );
connect( m_ui->srcEdit, &KUrlRequester::urlSelected, this, &KDevelop::VcsImportMetadataWidget::changed );
connect( m_ui->dest, &QLineEdit::textChanged, this, &KDevelop::VcsImportMetadataWidget::changed );
connect( m_ui->message, &QTextEdit::textChanged, this, &KDevelop::VcsImportMetadataWidget::changed );
}
SvnImportMetadataWidget::~SvnImportMetadataWidget()
{
delete m_ui;
}
void SvnImportMetadataWidget::setSourceLocation( const KDevelop::VcsLocation& importdir )
{
m_ui->srcEdit->setUrl( importdir.localUrl() );
}
QUrl SvnImportMetadataWidget::source() const
{
return m_ui->srcEdit->url();
}
KDevelop::VcsLocation SvnImportMetadataWidget::destination() const
{
KDevelop::VcsLocation destloc;
QString url = m_ui->dest->text();
if( useSourceDirForDestination ) {
url += QLatin1Char('/') + m_ui->srcEdit->url().fileName();
}
destloc.setRepositoryServer(url);
return destloc;
}
void SvnImportMetadataWidget::setUseSourceDirForDestination( bool b )
{
useSourceDirForDestination = b;
}
void SvnImportMetadataWidget::setSourceLocationEditable( bool enable )
{
m_ui->srcEdit->setEnabled( enable );
}
void SvnImportMetadataWidget::setMessage(const QString& message)
{
m_ui->message->setText(message);
}
QString SvnImportMetadataWidget::message() const
{
return m_ui->message->toPlainText();
}
bool SvnImportMetadataWidget::hasValidData() const
{
return !m_ui->message->toPlainText().isEmpty() && !m_ui->srcEdit->text().isEmpty();
}
|