You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdesvn/src/svnfrontend/copymoveview_impl.cpp

103 lines
3.6 KiB

/***************************************************************************
* Copyright (C) 2005-2007 by Rajko Albrecht *
* ral@alwins-world.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. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "copymoveview_impl.h"
#include <ksqueezedtextlabel.h>
#include <tqcheckbox.h>
#include <tqlabel.h>
#include <klineedit.h>
#include <tdelocale.h>
#include <kdialogbase.h>
#include <tqvbox.h>
CopyMoveView_impl::CopyMoveView_impl(const TQString&baseName,const TQString&sourceName,bool move,TQWidget* parent, const char* name, WFlags fl)
: CopyMoveView(parent,name,fl)
{
m_BaseName = baseName;
if (m_BaseName.length()>0 && !m_BaseName.endsWith("/")) {
m_BaseName+="/";
}
m_PrefixLabel->setText(m_BaseName);
m_OldNameLabel->setText("<b>"+sourceName+"</b>");
m_OldName = sourceName;
if (m_BaseName.length()>0) {
TQString t = m_OldName.right(m_OldName.length()-m_BaseName.length());
m_NewNameInput->setText(t);
} else {
m_PrefixLabel->hide();
m_NewNameInput->setText(sourceName);
}
if (move) {
m_HeadOneLabel->setText(i18n("Rename/move"));
} else {
m_HeadOneLabel->setText(i18n("Copy"));
m_ForceBox->hide();
}
}
CopyMoveView_impl::~CopyMoveView_impl()
{
}
/*!
\fn CopyMoveView_impl::newName()
*/
TQString CopyMoveView_impl::newName()
{
return m_BaseName+m_NewNameInput->text();
}
/*!
\fn CopyMoveView_impl::force()
*/
bool CopyMoveView_impl::force()
{
return m_ForceBox->isChecked();
}
/*!
\fn CopyMoveView_impl::getMoveCopyTo(bool*ok,bool*force,const TQString&old,const TQString&base,TQWidget*)
*/
TQString CopyMoveView_impl::getMoveCopyTo(bool*ok,bool*force,bool move,
const TQString&old,const TQString&base,TQWidget*parent,const char*name)
{
KDialogBase dlg(parent,name,true,(move?i18n("Move/Rename file/dir"):i18n("Copy file/dir")),
KDialogBase::Ok|KDialogBase::Cancel,
KDialogBase::NoDefault);
TQWidget* Dialog1Layout = dlg.makeVBoxMainWidget();
CopyMoveView_impl*ptr=new CopyMoveView_impl(base,old,(move),Dialog1Layout);
TQString nName = TQString();
dlg.resize( TQSize(500,160).expandedTo(dlg.minimumSizeHint()) );
if (dlg.exec()!=TQDialog::Accepted) {
if (ok) *ok = false;
} else {
if (force) *force = ptr->force();
nName = ptr->newName();
if (ok) *ok=true;
}
return nName;
}
#include "copymoveview_impl.moc"