File indexing completed on 2024-05-12 05:44:24
0001 /*************************************************************************** 0002 * Copyright (C) 2005-2009 by Rajko Albrecht * 0003 * ral@alwins-world.de * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0019 ***************************************************************************/ 0020 #include "checkoutinfo_impl.h" 0021 #include "helpers/ktranslateurl.h" 0022 #include "ksvnwidgets/depthselector.h" 0023 #include "rangeinput_impl.h" 0024 #include "svnqt/url.h" 0025 0026 CheckoutInfo_impl::CheckoutInfo_impl(QWidget *parent) 0027 : QWidget(parent) 0028 { 0029 setupUi(this); 0030 0031 m_RangeInput->setStartOnly(true); 0032 m_RangeInput->setHeadDefault(); 0033 m_TargetSelector->setMode(KFile::LocalOnly | KFile::Directory); 0034 m_UrlEdit->setMode(KFile::Directory); 0035 hideIgnoreKeywords(true); 0036 } 0037 0038 CheckoutInfo_impl::~CheckoutInfo_impl() 0039 { 0040 } 0041 0042 svn::Revision CheckoutInfo_impl::toRevision() const 0043 { 0044 return m_RangeInput->getRange().first; 0045 } 0046 0047 QUrl CheckoutInfo_impl::reposURL() const 0048 { 0049 QUrl uri(m_UrlEdit->url()); 0050 uri.setScheme(svn::Url::transformProtokoll(uri.scheme())); 0051 return uri; 0052 } 0053 0054 QString CheckoutInfo_impl::targetDir() const 0055 { 0056 const QString tgt = m_TargetSelector->url().toLocalFile(); 0057 if (tgt.isEmpty() || !m_CreateDirButton->isChecked()) { 0058 return tgt; 0059 } 0060 // append last source url path to the target directory 0061 const QString _uri = reposURL().path(); 0062 const QVector<QStringRef> l = _uri.splitRef(QLatin1Char('/'), QString::SkipEmptyParts); 0063 if (l.isEmpty()) { 0064 return tgt; 0065 } 0066 return tgt + QLatin1Char('/') + l.last().toString(); 0067 } 0068 0069 bool CheckoutInfo_impl::overwrite() const 0070 { 0071 return m_overwriteButton->isChecked(); 0072 } 0073 0074 /*! 0075 \fn CheckoutInfo_impl::setTargetUrl(const QUrl&) 0076 */ 0077 void CheckoutInfo_impl::setTargetUrl(const QUrl &what) 0078 { 0079 m_TargetSelector->setUrl(what); 0080 } 0081 0082 void CheckoutInfo_impl::setStartUrl(const QUrl &what) 0083 { 0084 m_UrlEdit->setUrl(what); 0085 } 0086 0087 void CheckoutInfo_impl::hideDepth(bool how) 0088 { 0089 if (how) { 0090 m_DepthSelector->setEnabled(false); 0091 m_DepthSelector->hide(); 0092 } else if (!how) { 0093 m_DepthSelector->setEnabled(false); 0094 m_DepthSelector->show(); 0095 } 0096 adjustSize(); 0097 } 0098 0099 void CheckoutInfo_impl::hideOverwrite(bool hide) 0100 { 0101 m_overwriteButton->setHidden(hide); 0102 } 0103 0104 void CheckoutInfo_impl::hideIgnoreKeywords(bool hide) 0105 { 0106 m_IgnoreKeywords->setHidden(hide); 0107 } 0108 0109 bool CheckoutInfo_impl::ignoreKeywords() const 0110 { 0111 return m_IgnoreKeywords->isChecked(); 0112 } 0113 0114 svn::Depth CheckoutInfo_impl::getDepth() const 0115 { 0116 if (m_DepthSelector->isEnabled()) { 0117 return m_DepthSelector->getDepth(); 0118 } 0119 return svn::DepthUnknown; 0120 } 0121 0122 void CheckoutInfo_impl::disableTargetDir(bool how) 0123 { 0124 if (how) { 0125 m_TargetSelector->setEnabled(false); 0126 m_TargetSelector->hide(); 0127 m_TargetLabel->hide(); 0128 } else if (!how) { 0129 m_TargetSelector->setEnabled(true); 0130 m_TargetSelector->show(); 0131 m_TargetLabel->show(); 0132 } 0133 } 0134 0135 void CheckoutInfo_impl::disableOpen(bool how) 0136 { 0137 if (how) { 0138 m_ShowExplorer->setEnabled(false); 0139 m_ShowExplorer->hide(); 0140 } else if (!how) { 0141 m_ShowExplorer->setEnabled(true); 0142 m_ShowExplorer->show(); 0143 } 0144 } 0145 0146 /*! 0147 \fn CheckoutInfo_impl::openAfterJob() 0148 */ 0149 bool CheckoutInfo_impl::openAfterJob() const 0150 { 0151 return m_ShowExplorer->isChecked(); 0152 } 0153 0154 /*! 0155 \fn CheckoutInfo_impl::disableRange(bool how) 0156 */ 0157 void CheckoutInfo_impl::disableRange(bool how) 0158 { 0159 if (how) { 0160 m_RangeInput->setEnabled(false); 0161 m_RangeInput->hide(); 0162 } else { 0163 m_RangeInput->setEnabled(true); 0164 m_RangeInput->show(); 0165 } 0166 } 0167 0168 void CheckoutInfo_impl::urlChanged(const QString &) 0169 { 0170 } 0171 0172 void CheckoutInfo_impl::disableAppend(bool how) 0173 { 0174 m_CreateDirButton->setChecked(!how); 0175 if (how) { 0176 m_CreateDirButton->hide(); 0177 } else { 0178 m_CreateDirButton->show(); 0179 } 0180 } 0181 0182 /*! 0183 \fn CheckoutInfo_impl::ignoreExternals() 0184 */ 0185 bool CheckoutInfo_impl::ignoreExternals() const 0186 { 0187 return m_ignoreExternals->isChecked(); 0188 } 0189 0190 #include "moc_checkoutinfo_impl.cpp"