From e2f541c98dfa4081fa3ab3d28f08ea2309281884 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 15 Mar 2010 17:32:48 +0000 Subject: Added KDE3 version of kdesvn git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdesvn@1103685 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/ksvnwidgets/depthselector.cpp | 97 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/ksvnwidgets/depthselector.cpp (limited to 'src/ksvnwidgets/depthselector.cpp') diff --git a/src/ksvnwidgets/depthselector.cpp b/src/ksvnwidgets/depthselector.cpp new file mode 100644 index 0000000..842adcf --- /dev/null +++ b/src/ksvnwidgets/depthselector.cpp @@ -0,0 +1,97 @@ +/*************************************************************************** + * Copyright (C) 2007 by Rajko Albrecht ral@alwins-world.de * + * http://kdesvn.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 "depthselector.h" +#include "src/svnqt/version_check.hpp" + +#include + +#include +#include +#include +#include + + +DepthSelector::DepthSelector(QWidget *parent, const char *name) + :DepthSettings(parent, name) +{ + if (svn::Version::version_major()>1|| svn::Version::version_minor()>4 ) { + m_recurse = 0L; + m_DepthCombo->setCurrentItem(3); + } else { + delete m_DepthCombo; + m_DepthCombo=0; + DepthFormLayout->removeItem(m_leftspacer); + m_recurse = new QCheckBox( this, "m_RecursiveButton" ); + m_recurse->setChecked( TRUE ); + m_recurse->setText(i18n( "Recursive" )); + DepthFormLayout->addWidget( m_recurse ); + m_recurse->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + DepthFormLayout->addItem(m_leftspacer); + } + DepthFormLayout->setMargin(0); + setMinimumSize(minimumSizeHint()); + adjustSize(); +} + +DepthSelector::~DepthSelector() +{ +} +void DepthSelector::addItemWidget(QWidget*aWidget) +{ + DepthFormLayout->removeItem(m_leftspacer); + aWidget->reparent(this,geometry().topLeft()); + DepthFormLayout->addWidget(aWidget); + aWidget->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + DepthFormLayout->addItem(m_leftspacer); + setMinimumSize(minimumSizeHint()); +} + +/*! + \fn DepthSelector::getDepth()const + */ +svn::Depth DepthSelector::getDepth()const +{ + if (m_DepthCombo) { + switch (m_DepthCombo->currentItem()){ + case 0: + return svn::DepthEmpty; + break; + case 1: + return svn::DepthFiles; + break; + case 2: + return svn::DepthImmediates; + break; + case 3: + default: + return svn::DepthInfinity; + } + } else { + return (m_recurse->isChecked()?svn::DepthInfinity:svn::DepthEmpty); + } +} + +void DepthSelector::hideDepth(bool hide) +{ + QWidget*w = m_DepthCombo? (QWidget*)m_DepthCombo:(QWidget*)m_recurse; + if (hide) w->hide(); else w->show(); +} + +#include "depthselector.moc" -- cgit v1.2.1