diff options
Diffstat (limited to 'src/svnfrontend/fronthelpers')
-rw-r--r-- | src/svnfrontend/fronthelpers/checkoutinfo.ui | 223 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/checkoutinfo_impl.cpp | 211 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/checkoutinfo_impl.h | 56 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/cursorstack.h | 56 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/propertyitem.cpp | 56 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/propertyitem.h | 49 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/propertylist.cpp | 166 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/propertylist.h | 57 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/rangeinput.ui | 285 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/rangeinput_impl.cpp | 193 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/rangeinput_impl.h | 58 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/revisionbutton.ui | 55 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/revisionbuttonimpl.cpp | 75 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/revisionbuttonimpl.h | 51 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/widgetblockstack.cpp | 38 | ||||
-rw-r--r-- | src/svnfrontend/fronthelpers/widgetblockstack.h | 33 |
16 files changed, 1662 insertions, 0 deletions
diff --git a/src/svnfrontend/fronthelpers/checkoutinfo.ui b/src/svnfrontend/fronthelpers/checkoutinfo.ui new file mode 100644 index 0000000..a880bd3 --- /dev/null +++ b/src/svnfrontend/fronthelpers/checkoutinfo.ui @@ -0,0 +1,223 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CheckoutInfo</class> +<widget class="QWidget"> + <property name="name"> + <cstring>CheckoutInfo</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>185</height> + </rect> + </property> + <property name="caption"> + <string>Checkout info</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KURLRequester" row="0" column="1"> + <property name="name"> + <cstring>m_UrlEdit</cstring> + </property> + <property name="showLocalProtocol"> + <bool>true</bool> + </property> + <property name="mode"> + <number>18</number> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>m_TargetLabel</cstring> + </property> + <property name="text"> + <string>Select target directory:</string> + </property> + </widget> + <widget class="KURLRequester" row="1" column="1"> + <property name="name"> + <cstring>m_TargetSelector</cstring> + </property> + <property name="showLocalProtocol"> + <bool>true</bool> + </property> + <property name="mode"> + <number>18</number> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>m_UrlLabel</cstring> + </property> + <property name="text"> + <string>Enter URL:</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + </grid> + </widget> + <widget class="Rangeinput_impl"> + <property name="name"> + <cstring>m_RangeInput</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_CreateDirButton</cstring> + </property> + <property name="text"> + <string>Append source url name to subfolder</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_overwriteButton</cstring> + </property> + <property name="text"> + <string>Overwrite existing</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + <property name="toolTip" stdset="0"> + <string>May existing unversioned items ovewritten</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_ignoreExternals</cstring> + </property> + <property name="text"> + <string>Ignore externals</string> + </property> + <property name="toolTip" stdset="0"> + <string>Ignore externals while operation</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="DepthSelector"> + <property name="name"> + <cstring>m_DepthSelector</cstring> + </property> + <property name="minimumSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>m_ShowExplorer</cstring> + </property> + <property name="text"> + <string>Open after job</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> + <customwidget> + <class>Rangeinput_impl</class> + <header location="local">rangeinput_impl.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <property type="Bool">StartOnly</property> + </customwidget> + <customwidget> + <class>DepthSelector</class> + <header location="local">src/ksvnwidgets/depthselector.h</header> + <sizehint> + <width>-1</width> + <height>30</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082</data> + </image> +</images> +<slots> + <slot access="protected">urlChanged(const QString&)</slot> +</slots> +<layoutdefaults spacing="2" margin="2"/> +<includehints> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>rangeinput_impl.h</includehint> + <includehint>src/ksvnwidgets/depthselector.h</includehint> +</includehints> +</UI> diff --git a/src/svnfrontend/fronthelpers/checkoutinfo_impl.cpp b/src/svnfrontend/fronthelpers/checkoutinfo_impl.cpp new file mode 100644 index 0000000..8d207e7 --- /dev/null +++ b/src/svnfrontend/fronthelpers/checkoutinfo_impl.cpp @@ -0,0 +1,211 @@ +/*************************************************************************** + * 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 "checkoutinfo_impl.h" +#include "rangeinput_impl.h" +#include "src/ksvnwidgets/depthselector.h" +#include "src/svnqt/url.hpp" +#include "helpers/ktranslateurl.h" +#include <kurlrequester.h> +#include <qlabel.h> +#include <qtooltip.h> + +#include <klineedit.h> +#include <qcheckbox.h> +#include <klocale.h> +#include <kdebug.h> + +CheckoutInfo_impl::CheckoutInfo_impl(QWidget *parent, const char *name) + :CheckoutInfo(parent, name) +{ + m_RangeInput->setStartOnly(true); + m_RangeInput->setHeadDefault(); +} + +CheckoutInfo_impl::~CheckoutInfo_impl() +{ +} + +svn::Revision CheckoutInfo_impl::toRevision() +{ + return m_RangeInput->getRange().first; +} + +QString CheckoutInfo_impl::reposURL() +{ + KURL uri(m_UrlEdit->url()); + QString proto = svn::Url::transformProtokoll(uri.protocol()); + if (proto=="file"&&!m_UrlEdit->url().startsWith("ksvn+file:")) { + uri.setProtocol(""); + } else { + uri.setProtocol(proto); + } + return uri.prettyURL(); +} + +QString CheckoutInfo_impl::targetDir() +{ + if (!m_CreateDirButton->isChecked()) { + return m_TargetSelector->url(); + } + QString _uri = reposURL(); + while (_uri.endsWith("/")) { + _uri.truncate(_uri.length()-1); + } + QStringList l = QStringList::split('/',_uri); + if (l.count()==0) { + return m_TargetSelector->url(); + } + return m_TargetSelector->url()+"/"+l[l.count()-1]; +} + +bool CheckoutInfo_impl::overwrite() +{ + return m_overwriteButton->isChecked(); +} + +/*! + \fn CheckoutInfo_impl::setTargetUrl(const QString&) + */ +void CheckoutInfo_impl::setTargetUrl(const QString&what) +{ + m_TargetSelector->setURL(what); +} + +void CheckoutInfo_impl::setStartUrl(const QString&what) +{ + KURL uri(what); + if (uri.protocol()=="file") { + if (what.startsWith("file:")) { + uri.setProtocol("ksvn+file"); + } else { + uri.setProtocol(""); + } + } else { + uri.setProtocol(helpers::KTranslateUrl::makeKdeUrl(uri.protocol())); + } + m_UrlEdit->setURL(uri.prettyURL()); +} + +void CheckoutInfo_impl::hideDepth(bool how,bool overwriteAsRecurse) +{ + if (how) { + m_DepthSelector->setEnabled(false); + m_DepthSelector->hide(); + if (overwriteAsRecurse) { + QToolTip::add( m_overwriteButton, i18n( "Make operation recursive." ) ); + m_overwriteButton->setText(i18n("Recursive")); + } + } else if (!how) { + m_DepthSelector->setEnabled(false); + m_DepthSelector->show(); + m_overwriteButton->setText( tr2i18n( "Overwrite existing" ) ); + QToolTip::add( m_overwriteButton, tr2i18n( "May existing unversioned items ovewritten" ) ); + } + adjustSize(); +} + +svn::Depth CheckoutInfo_impl::getDepth() +{ + if (m_DepthSelector->isEnabled()) { + return m_DepthSelector->getDepth(); + } + return svn::DepthUnknown; +} + +void CheckoutInfo_impl::disableTargetDir(bool how) +{ + if (how) { + m_TargetSelector->setEnabled(false); + m_TargetSelector->hide(); + m_TargetLabel->hide(); + } else if (!how) { + m_TargetSelector->setEnabled(true); + m_TargetSelector->show(); + m_TargetLabel->show(); + } +} + +void CheckoutInfo_impl::disableOpen(bool how) +{ + if (how) { + m_ShowExplorer->setEnabled(false); + m_ShowExplorer->hide(); + } else if (!how) { + m_ShowExplorer->setEnabled(true); + m_ShowExplorer->show(); + } +} + + +/*! + \fn CheckoutInfo_impl::openAfterJob() + */ +bool CheckoutInfo_impl::openAfterJob() +{ + return m_ShowExplorer->isChecked(); +} + +/*! + \fn CheckoutInfo_impl::disableRange(bool how) + */ +void CheckoutInfo_impl::disableRange(bool how) +{ + if (how) { + m_RangeInput->setEnabled(false); + m_RangeInput->hide(); + } else { + m_RangeInput->setEnabled(true); + m_RangeInput->show(); + } +} + +void CheckoutInfo_impl::urlChanged(const QString&) +{ +} + +void CheckoutInfo_impl::disableAppend(bool how) +{ + m_CreateDirButton->setChecked(!how); + if (how) { + m_CreateDirButton->hide(); + } else { + m_CreateDirButton->show(); + } +} + +/*! + \fn CheckoutInfo_impl::ignoreExternals() + */ +bool CheckoutInfo_impl::ignoreExternals() +{ + return m_ignoreExternals->isChecked(); +} + +void CheckoutInfo_impl::disableExternals(bool how) +{ + m_ignoreExternals->setChecked(!how); + if (how) { + m_ignoreExternals->hide(); + } else { + m_ignoreExternals->show(); + } +} + +#include "checkoutinfo_impl.moc" diff --git a/src/svnfrontend/fronthelpers/checkoutinfo_impl.h b/src/svnfrontend/fronthelpers/checkoutinfo_impl.h new file mode 100644 index 0000000..600e179 --- /dev/null +++ b/src/svnfrontend/fronthelpers/checkoutinfo_impl.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef CHECKOUTINFO_IMPL_H +#define CHECKOUTINFO_IMPL_H + +#include "checkoutinfo.h" +#include "src/svnqt/revision.hpp" +#include "src/svnqt/svnqttypes.hpp" +#include "kurl.h" + +class CheckoutInfo_impl: public CheckoutInfo { +Q_OBJECT +public: + CheckoutInfo_impl(QWidget *parent = 0, const char *name = 0); + virtual ~CheckoutInfo_impl(); + + svn::Revision toRevision(); + QString reposURL(); + QString targetDir(); + + bool overwrite(); + svn::Depth getDepth(); + void setStartUrl(const QString&); + + void disableForce(bool how); + void disableTargetDir(bool how); + void disableAppend(bool how); + void disableOpen(bool how); + void disableExternals(bool how); + bool openAfterJob(); + virtual void disableRange(bool how); + void setTargetUrl(const QString&); + bool ignoreExternals(); + void hideDepth(bool hide,bool overwriteAsRecurse); +protected slots: + virtual void urlChanged(const QString&); +}; + +#endif diff --git a/src/svnfrontend/fronthelpers/cursorstack.h b/src/svnfrontend/fronthelpers/cursorstack.h new file mode 100644 index 0000000..471af6e --- /dev/null +++ b/src/svnfrontend/fronthelpers/cursorstack.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * Copyright (C) 2006-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. * + ***************************************************************************/ +/*! + * \file cursorstack.h + * \brief Defines and implements CursorStack + */ +#ifndef __CURSOR_STACK_H +#define __CURSOR_STACK_H + +#include <kapplication.h> +#include <qcursor.h> + +//! Change cursor on stack. +/*! May used in methods where more than returns exists. Cursor will restored on destruction + * of class instance. + */ +class CursorStack +{ +public: + //! Constructor. + /*! + * Create instance and changes the application cursor to \a c + * \param c cursortype to set. + */ + CursorStack(Qt::CursorShape c = Qt::WaitCursor) + { + KApplication::setOverrideCursor(QCursor(c)); + } + //! Destructor. + /*! + * Restores the application cursor to value before construction. + */ + ~CursorStack() + { + KApplication::restoreOverrideCursor(); + } +}; + +#endif diff --git a/src/svnfrontend/fronthelpers/propertyitem.cpp b/src/svnfrontend/fronthelpers/propertyitem.cpp new file mode 100644 index 0000000..0e25d5f --- /dev/null +++ b/src/svnfrontend/fronthelpers/propertyitem.cpp @@ -0,0 +1,56 @@ +#include "propertyitem.h" +#include <klocale.h> +#include <kiconloader.h> + +PropertyListViewItem::PropertyListViewItem(KListView *parent,const QString&aName,const QString&aValue) + : KListViewItem(parent),m_currentName(aName),m_startName(aName),m_currentValue(aValue),m_startValue(aValue),m_deleted(false) +{ + setMultiLinesEnabled(true); + setText(0,startName()); + setText(1,startValue()); +} + +PropertyListViewItem::PropertyListViewItem(KListView *parent) + : KListViewItem(parent),m_currentName(""),m_startName(""),m_currentValue(""),m_startValue(""),m_deleted(false) +{ + setMultiLinesEnabled(true); + setText(0,startName()); + setText(1,startValue()); +} + +PropertyListViewItem::~PropertyListViewItem() +{ +} + +void PropertyListViewItem::checkValue() +{ + m_currentValue=text(1); +} + +void PropertyListViewItem::checkName() +{ + m_currentName=text(0); +} + +bool PropertyListViewItem::different()const +{ + return m_currentName!=m_startName || m_currentValue!=m_startValue || deleted(); +} + +void PropertyListViewItem::deleteIt() +{ + m_deleted = true; + setPixmap(0,KGlobal::iconLoader()->loadIcon("cancel",KIcon::Desktop,16)); +} + +void PropertyListViewItem::unDeleteIt() +{ + m_deleted = false; + setPixmap(0,QPixmap()); +} + +bool PropertyListViewItem::protected_Property(const QString&what) +{ + if (what.compare("svn:special")!=0) return false; + return true; +} diff --git a/src/svnfrontend/fronthelpers/propertyitem.h b/src/svnfrontend/fronthelpers/propertyitem.h new file mode 100644 index 0000000..c630c7c --- /dev/null +++ b/src/svnfrontend/fronthelpers/propertyitem.h @@ -0,0 +1,49 @@ +#ifndef _PROPERTYITEM_H +#define _PROPERTYITEM_H + +#include <klistview.h> + +class PropertiesDlg; +class Propertylist; + +class PropertyListViewItem:public KListViewItem +{ + friend class PropertiesDlg; + friend class Propertylist; + + public: + static const int _RTTI_ = 1001; + PropertyListViewItem(KListView *parent,const QString&,const QString&); + PropertyListViewItem(KListView *parent); + virtual ~PropertyListViewItem(); + + const QString&startName()const{return m_startName;} + const QString&startValue()const{return m_startValue;} + const QString¤tName()const{return m_currentName;} + const QString¤tValue()const{return m_currentValue;} + + void checkValue(); + void checkName(); + void deleteIt(); + void unDeleteIt(); + bool deleted()const{return m_deleted;} + + bool different()const; + + virtual int rtti()const{return _RTTI_;} + + //! Check if a specific property may just internale + /*! + * That means, a property of that may not edit,added or deleted. + * + * This moment it just checks for "svn:special" + * \return true if protected property otherwise false + */ + static bool protected_Property(const QString&); + + protected: + QString m_currentName,m_startName,m_currentValue,m_startValue; + bool m_deleted; +}; + +#endif diff --git a/src/svnfrontend/fronthelpers/propertylist.cpp b/src/svnfrontend/fronthelpers/propertylist.cpp new file mode 100644 index 0000000..8fa3b66 --- /dev/null +++ b/src/svnfrontend/fronthelpers/propertylist.cpp @@ -0,0 +1,166 @@ +/*************************************************************************** + * 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 "propertylist.h" +#include "src/svnfrontend/fronthelpers/propertyitem.h" + +#include <klocale.h> +#include <kdebug.h> +#include <kmessagebox.h> + + +Propertylist::Propertylist(QWidget *parent, const char *name) + : KListView(parent, name),m_commitit(false) +{ + addColumn(i18n("Property")); + addColumn(i18n("Value")); + setShowSortIndicator(true); + setAllColumnsShowFocus (true); + setRootIsDecorated(false); + setSortColumn(0); + setAcceptDrops(false); + connect(this,SIGNAL(itemRenamed(QListViewItem*,const QString&,int)),this,SLOT(slotItemRenamed(QListViewItem*,const QString&,int))); + + connect(this,SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)),this, + SLOT(slotContextMenuRequested(QListViewItem *, const QPoint &, int))); + //setFullWidth( TRUE ); +} + + +Propertylist::~Propertylist() +{ +} + +void Propertylist::displayList(const svn::PathPropertiesMapListPtr&propList,bool editable,const QString&aCur) +{ + viewport()->setUpdatesEnabled(false); + clear(); + setItemsRenameable(editable); + setRenameable(0,editable); + setRenameable(1,editable); + if (propList) { + m_current = aCur; + svn::PathPropertiesMapList::const_iterator lit; + svn::PropertiesMap pmap; + for (lit=propList->begin();lit!=propList->end();++lit) { + pmap = (*lit).second; + /* just want the first one */ + break; + } + svn::PropertiesMap::const_iterator pit; + for (pit=pmap.begin();pit!=pmap.end();++pit) { + PropertyListViewItem * ki = new PropertyListViewItem(this, + pit.key(), + pit.data()); + } + } + viewport()->setUpdatesEnabled(true); + viewport()->repaint(); +} + +void Propertylist::clear() +{ + KListView::clear(); +} + +/*! + \fn PropertiesDlg::slotItemRenamed(QListViewItem*item,const QString & str,int col ) + */ +void Propertylist::slotItemRenamed(QListViewItem*_item,const QString & text,int col ) +{ + if (!_item || _item->rtti()!=PropertyListViewItem::_RTTI_) return; + PropertyListViewItem*item = static_cast<PropertyListViewItem*> (_item); + + kdDebug()<<"Text: "<< text << " in col "<<col << endl; + + if (text.isEmpty()&&col == 0) { + // fresh added + if (item->currentName().isEmpty()) { + delete item; + } else { + item->setText(0,item->currentName()); + } + return; + } + if (PropertyListViewItem::protected_Property(item->text(0)) || + PropertyListViewItem::protected_Property(item->currentName())) { + KMessageBox::error(this,i18n("This property may not set by users.\nRejecting it."),i18n("Protected property")); + item->setText(0,item->currentName()); + item->setText(1,item->currentValue()); + return; + } + if (checkExisting(item->text(0),item)) { + KMessageBox::error(this,i18n("A property with that name exists.\nRejecting it."),i18n("Double property")); + item->setText(0,item->currentName()); + item->setText(1,item->currentValue()); + return; + } + + if (col==0) { + item->checkName(); + } else { + item->checkValue(); + } + if (commitchanges() && item->different()) { + svn::PropertiesMap pm; + QValueList<QString> dels; + pm[item->currentName()]=item->currentValue(); + if (item->currentName()!=item->startName()){ + dels.push_back(item->startName()); + } + emit sigSetProperty(pm,dels,m_current); + } +} + +bool Propertylist::checkExisting(const QString&aName,QListViewItem*it) +{ + if (!it) { + return findItem(aName,0)!=0; + } + QListViewItemIterator iter(this); + while ( iter.current() ) { + if ( iter.current()==it) { + ++iter; + continue; + } + if (iter.current()->text(0)==aName) { + return true; + } + ++iter; + } + return false; +} + +void Propertylist::addCallback(QObject*ob) +{ + if (ob) { + connect(this,SIGNAL(sigSetProperty(const svn::PropertiesMap&,const QValueList<QString>&,const QString&)), + ob,SLOT(slotChangeProperties(const svn::PropertiesMap&,const QValueList<QString>&,const QString&))); + } +} + +/*! + \fn Propertylist::slotContextMenuRequested(QListViewItem *, const QPoint &, int) + */ +void Propertylist::slotContextMenuRequested(QListViewItem *, const QPoint &, int) +{ + /// @todo implement me +} + +#include "propertylist.moc" diff --git a/src/svnfrontend/fronthelpers/propertylist.h b/src/svnfrontend/fronthelpers/propertylist.h new file mode 100644 index 0000000..d3cf245 --- /dev/null +++ b/src/svnfrontend/fronthelpers/propertylist.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef PROPERTYLIST_H +#define PROPERTYLIST_H + +#include <klistview.h> +#include "src/svnqt/svnqttypes.hpp" + +/** + @author +*/ +class Propertylist : public KListView +{ + Q_OBJECT +public: + Propertylist(QWidget *parent = 0, const char *name = 0); + ~Propertylist(); + + bool checkExisting(const QString&aName,QListViewItem*it=0); + bool commitchanges()const{return m_commitit;} + void setCommitchanges(bool how){m_commitit=how;} + void addCallback(QObject*); + +public slots: + virtual void displayList(const svn::PathPropertiesMapListPtr&,bool,const QString&); + virtual void clear(); + +protected slots: + virtual void slotItemRenamed(QListViewItem*item,const QString & str,int col ); + +signals: + void sigSetProperty(const svn::PropertiesMap&,const QValueList<QString>&,const QString&); +protected: + bool m_commitit; + QString m_current; +protected slots: + virtual void slotContextMenuRequested(QListViewItem *, const QPoint &, int); +}; + +#endif diff --git a/src/svnfrontend/fronthelpers/rangeinput.ui b/src/svnfrontend/fronthelpers/rangeinput.ui new file mode 100644 index 0000000..18e8884 --- /dev/null +++ b/src/svnfrontend/fronthelpers/rangeinput.ui @@ -0,0 +1,285 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>RangeInputDlg</class> +<widget class="QWidget"> + <property name="name"> + <cstring>RangeInput</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>397</width> + <height>272</height> + </rect> + </property> + <property name="caption"> + <string>Revisions</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>m_startRevBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Start with revision</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KIntNumInput" row="0" column="2"> + <property name="name"> + <cstring>m_startRevInput</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_startNumberButton</cstring> + </property> + <property name="text"> + <string>N&umber</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>m_startDateButton</cstring> + </property> + <property name="text"> + <string>Date</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_startStartButton</cstring> + </property> + <property name="text"> + <string>S&TART</string> + </property> + </widget> + <widget class="KDateTimeWidget" row="1" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_startDateInput</cstring> + </property> + </widget> + <widget class="QRadioButton" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_startHeadButton</cstring> + </property> + <property name="text"> + <string>HEAD</string> + </property> + </widget> + <widget class="QRadioButton" row="4" column="0"> + <property name="name"> + <cstring>m_startWorkingButton</cstring> + </property> + <property name="text"> + <string>WORKING</string> + </property> + <property name="toolTip" stdset="0"> + <string>Select current working copy changes</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>m_stopRevBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Stop with revision</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KIntNumInput" row="0" column="2"> + <property name="name"> + <cstring>m_endRevInput</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_stopNumberButton</cstring> + </property> + <property name="text"> + <string>Number</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="KDateTimeWidget" row="1" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_stopDateInput</cstring> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>m_stopDateButton</cstring> + </property> + <property name="text"> + <string>Date</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_stopStartButton</cstring> + </property> + <property name="text"> + <string>START</string> + </property> + </widget> + <widget class="QRadioButton" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>m_stopHeadButton</cstring> + </property> + <property name="text"> + <string>HEAD</string> + </property> + </widget> + <widget class="QRadioButton" row="4" column="0"> + <property name="name"> + <cstring>m_stopWorkingButton</cstring> + </property> + <property name="text"> + <string>WORKING</string> + </property> + <property name="toolTip" stdset="0"> + <string>Select current working copy changes</string> + </property> + </widget> + </grid> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>m_startNumberButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>startNumberToggled(bool)</slot> + </connection> + <connection> + <sender>m_startHeadButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>startHeadToggled(bool)</slot> + </connection> + <connection> + <sender>m_startStartButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>startBaseToggled(bool)</slot> + </connection> + <connection> + <sender>m_stopStartButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>stopBaseToggled(bool)</slot> + </connection> + <connection> + <sender>m_stopHeadButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>stopHeadToggled(bool)</slot> + </connection> + <connection> + <sender>m_stopNumberButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>stopNumberToggled(bool)</slot> + </connection> + <connection> + <sender>m_stopDateButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>stopDateToggled(bool)</slot> + </connection> + <connection> + <sender>m_startDateButton</sender> + <signal>toggled(bool)</signal> + <receiver>RangeInput</receiver> + <slot>startDateToggled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>m_startNumberButton</tabstop> + <tabstop>m_startRevInput</tabstop> + <tabstop>m_startStartButton</tabstop> + <tabstop>m_startHeadButton</tabstop> + <tabstop>m_stopNumberButton</tabstop> + <tabstop>m_endRevInput</tabstop> + <tabstop>m_stopStartButton</tabstop> + <tabstop>m_stopHeadButton</tabstop> +</tabstops> +<slots> + <slot access="protected">stopHeadToggled(bool)</slot> + <slot access="protected">stopBaseToggled(bool)</slot> + <slot access="protected">stopNumberToggled(bool)</slot> + <slot access="protected">startHeadToggled(bool)</slot> + <slot access="protected">startBaseToggled(bool)</slot> + <slot access="protected">startNumberToggled(bool)</slot> + <slot access="protected">startDateToggled(bool)</slot> + <slot access="protected">stopDateToggled(bool)</slot> +</slots> +<layoutdefaults spacing="2" margin="2"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kdatetimewidget.h</includehint> + <includehint>kdatewidget.h</includehint> + <includehint>ktimewidget.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kdatetimewidget.h</includehint> + <includehint>kdatewidget.h</includehint> + <includehint>ktimewidget.h</includehint> +</includehints> +</UI> diff --git a/src/svnfrontend/fronthelpers/rangeinput_impl.cpp b/src/svnfrontend/fronthelpers/rangeinput_impl.cpp new file mode 100644 index 0000000..bf18bf9 --- /dev/null +++ b/src/svnfrontend/fronthelpers/rangeinput_impl.cpp @@ -0,0 +1,193 @@ +/*************************************************************************** + * 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 "rangeinput_impl.h" +#include "helpers/sub2qt.h" + +#include <qpushbutton.h> +#include <qlayout.h> +#include <qradiobutton.h> +#include <knuminput.h> +#include <kdatetimewidget.h> +#include <qbuttongroup.h> +#include <klocale.h> +#include <kdebug.h> + +Rangeinput_impl::Rangeinput_impl(QWidget *parent, const char *name) + :RangeInputDlg(parent, name) +{ + m_startRevInput->setRange(0,INT_MAX,1,false); + m_endRevInput->setRange(0,INT_MAX,1,false); + m_startRevInput->setValue(1); + m_endRevInput->setValue(1); + m_startDateInput->setDateTime(QDateTime::currentDateTime ()); + m_stopDateInput->setDateTime(QDateTime::currentDateTime ()); + m_stopDateInput->setEnabled(false); + m_startDateInput->setEnabled(false); + m_stopHeadButton->setChecked(true); +} + +Rangeinput_impl::~Rangeinput_impl() +{ +} + +void Rangeinput_impl::startNumberToggled(bool how) +{ + m_startRevInput->setEnabled(how); + if (how) { + m_startDateInput->setEnabled(!how); + } +} + +void Rangeinput_impl::startBaseToggled(bool how) +{ + if (how) { + m_startRevInput->setEnabled(!how); + m_startDateInput->setEnabled(!how); + } +} + +void Rangeinput_impl::startHeadToggled(bool how) +{ + if (how) { + m_startRevInput->setEnabled(!how); + m_startDateInput->setEnabled(!how); + } +} + +void Rangeinput_impl::setNoWorking(bool aValue) +{ + if (!aValue) { + if (m_startWorkingButton->isChecked()) { + m_startHeadButton->setChecked(false); + } + if (m_stopWorkingButton->isChecked()) { + m_stopHeadButton->setChecked(false); + } + } + m_startWorkingButton->setEnabled(!aValue); + m_stopWorkingButton->setEnabled(!aValue); +} + +void Rangeinput_impl::onHelp() +{ +} + + +void Rangeinput_impl::stopHeadToggled(bool how) +{ + if (how) { + m_endRevInput->setEnabled(!how); + m_stopDateInput->setEnabled(!how); + } +} + + +void Rangeinput_impl::stopBaseToggled(bool how) +{ + if (how) { + m_endRevInput->setEnabled(!how); + m_stopDateInput->setEnabled(!how); + } +} + + +void Rangeinput_impl::stopNumberToggled(bool how) +{ + m_endRevInput->setEnabled(how); + if (how) { + m_stopDateInput->setEnabled(!how); + } +} + +Rangeinput_impl::revision_range Rangeinput_impl::getRange() +{ + revision_range ret; + if (m_startStartButton->isChecked()) { + ret.first = svn::Revision::START; + } else if (m_startHeadButton->isChecked()) { + ret.first = svn::Revision::HEAD; + } else if (m_startNumberButton->isChecked()) { + ret.first = m_startRevInput->value(); + } else if (m_startDateButton->isChecked()) { + ret.first=m_startDateInput->dateTime(); + } else if (m_startWorkingButton->isChecked()) { + ret.first = svn::Revision::WORKING; + } + if (m_stopStartButton->isChecked()) { + ret.second = svn::Revision::START; + } else if (m_stopHeadButton->isChecked()) { + ret.second = svn::Revision::HEAD; + } else if (m_stopNumberButton->isChecked()) { + ret.second = m_endRevInput->value(); + } else if (m_stopDateButton->isChecked()) { + ret.second=m_stopDateInput->dateTime(); + } else if (m_stopWorkingButton->isChecked()) { + ret.second = svn::Revision::WORKING; + } + return ret; +} + +void Rangeinput_impl::stopDateToggled(bool how) +{ + m_stopDateInput->setEnabled(how); + if (how) { + m_endRevInput->setEnabled(!how); + } +} + + +void Rangeinput_impl::startDateToggled(bool how) +{ + m_startDateInput->setEnabled(how); + if (how) { + m_startRevInput->setEnabled(!how); + } +} + + +bool Rangeinput_impl::StartOnly() const +{ + return m_StartOnly; +} + +void Rangeinput_impl::setHeadDefault() +{ + m_stopHeadButton->setChecked(true); + m_startHeadButton->setChecked(true); +} + +void Rangeinput_impl::setStartOnly(bool theValue) +{ + m_StartOnly = theValue; + if (m_StartOnly) { + RangeInputLayout->remove(m_stopRevBox); + m_stopRevBox->hide(); + m_startRevBox->setTitle(i18n("Select revision")); + } else { + RangeInputLayout->add(m_stopRevBox); + m_stopRevBox->show(); + m_startRevBox->setTitle(i18n( "Start with revision" )); + } + updateGeometry(); + setMinimumSize(minimumSizeHint()); + resize( QSize(397, 272).expandedTo(minimumSizeHint()) ); +} + +#include "rangeinput_impl.moc" diff --git a/src/svnfrontend/fronthelpers/rangeinput_impl.h b/src/svnfrontend/fronthelpers/rangeinput_impl.h new file mode 100644 index 0000000..a7ca29e --- /dev/null +++ b/src/svnfrontend/fronthelpers/rangeinput_impl.h @@ -0,0 +1,58 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef RANGEINPUT_IMPL_H +#define RANGEINPUT_IMPL_H + +#include "rangeinput.h" +#include "src/svnqt/revision.hpp" +#include <qpair.h> + +class Rangeinput_impl: public RangeInputDlg { +Q_OBJECT +public: + Rangeinput_impl(QWidget *parent = 0, const char *name = 0); + virtual ~Rangeinput_impl(); + + typedef QPair<svn::Revision,svn::Revision> revision_range; + + revision_range getRange(); + + virtual void setStartOnly(bool theValue); + virtual void setNoWorking(bool aValue); + + + bool StartOnly() const; + void setHeadDefault(); + +protected slots: + virtual void onHelp(); + virtual void stopHeadToggled(bool); + virtual void stopBaseToggled(bool); + virtual void stopNumberToggled(bool); + virtual void startHeadToggled(bool); + virtual void startBaseToggled(bool); + virtual void startNumberToggled(bool); + virtual void stopDateToggled(bool); + virtual void startDateToggled(bool); +protected: + bool m_StartOnly; +}; + +#endif diff --git a/src/svnfrontend/fronthelpers/revisionbutton.ui b/src/svnfrontend/fronthelpers/revisionbutton.ui new file mode 100644 index 0000000..34b7b5a --- /dev/null +++ b/src/svnfrontend/fronthelpers/revisionbutton.ui @@ -0,0 +1,55 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>RevisionButton</class> +<widget class="QWidget"> + <property name="name"> + <cstring>RevisionButton</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>124</width> + <height>28</height> + </rect> + </property> + <property name="caption"> + <string>RevisionButton</string> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="KPushButton"> + <property name="name"> + <cstring>m_RevisionButton</cstring> + </property> + <property name="text"> + <string>-1</string> + </property> + </widget> + </hbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>m_RevisionButton</sender> + <signal>clicked()</signal> + <receiver>RevisionButton</receiver> + <slot>askRevision()</slot> + </connection> +</connections> +<slots> + <slot>askRevision()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/src/svnfrontend/fronthelpers/revisionbuttonimpl.cpp b/src/svnfrontend/fronthelpers/revisionbuttonimpl.cpp new file mode 100644 index 0000000..15a2e6b --- /dev/null +++ b/src/svnfrontend/fronthelpers/revisionbuttonimpl.cpp @@ -0,0 +1,75 @@ +/*************************************************************************** + * 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 "revisionbuttonimpl.h" +#include "src/svnfrontend/fronthelpers/rangeinput_impl.h" +#include "src/settings/kdesvnsettings.h" + +#include <kpushbutton.h> +#include <kdialog.h> +#include <kfiledialog.h> +#include <kapplication.h> +#include <klocale.h> + +#include <qvbox.h> + +RevisionButtonImpl::RevisionButtonImpl(QWidget *parent, const char *name) + :RevisionButton(parent, name),m_Rev(svn::Revision::UNDEFINED),m_noWorking(false) +{ +} + +RevisionButtonImpl::~RevisionButtonImpl() +{ +} + +void RevisionButtonImpl::setRevision(const svn::Revision&aRev) +{ + m_Rev = aRev; + m_RevisionButton->setText(m_Rev.toString()); + emit revisionChanged(); +} + +void RevisionButtonImpl::askRevision() +{ + Rangeinput_impl*rdlg; + int buttons = KDialogBase::Ok|KDialogBase::Cancel; + + KDialogBase * dlg = new KDialogBase(KApplication::activeModalWidget(),"Revinput",true,i18n("Select revision"),buttons); + + if (!dlg) { + return; + } + QWidget* Dialog1Layout = dlg->makeVBoxMainWidget(); + rdlg = new Rangeinput_impl(Dialog1Layout); + rdlg->setStartOnly(true); + rdlg->setNoWorking(m_noWorking); + dlg->resize(dlg->configDialogSize(*(Kdesvnsettings::self()->config()),"log_revisions_dlg")); + if (dlg->exec()==QDialog::Accepted) { + setRevision(rdlg->getRange().first); + } + dlg->saveDialogSize(*(Kdesvnsettings::self()->config()),"log_revisions_dlg",false); + delete dlg; +} + +void RevisionButtonImpl::setNoWorking(bool how) +{ + m_noWorking = how; +} + +#include "revisionbuttonimpl.moc" diff --git a/src/svnfrontend/fronthelpers/revisionbuttonimpl.h b/src/svnfrontend/fronthelpers/revisionbuttonimpl.h new file mode 100644 index 0000000..a8f31a0 --- /dev/null +++ b/src/svnfrontend/fronthelpers/revisionbuttonimpl.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ +#ifndef REVISIONBUTTONIMPL_H +#define REVISIONBUTTONIMPL_H + +#include "revisionbutton.h" +#include "svnqt/revision.hpp" + +class RevisionButtonImpl: public RevisionButton { + Q_OBJECT + +public: + RevisionButtonImpl(QWidget *parent = 0, const char *name = 0); + virtual ~RevisionButtonImpl(); + + virtual void setRevision(const svn::Revision&aRev); + + virtual void setNoWorking(bool); + const svn::Revision& revision()const { + return m_Rev; + } + +protected: + svn::Revision m_Rev; + bool m_noWorking; + +public slots: + virtual void askRevision(); +signals: + void revisionChanged(); + +}; + +#endif diff --git a/src/svnfrontend/fronthelpers/widgetblockstack.cpp b/src/svnfrontend/fronthelpers/widgetblockstack.cpp new file mode 100644 index 0000000..9b8af8f --- /dev/null +++ b/src/svnfrontend/fronthelpers/widgetblockstack.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2006-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 "widgetblockstack.h" + +#include <qwidget.h> + +WidgetBlockStack::WidgetBlockStack(QWidget*w) +{ + if ( (_w=w)) + { + _w->setEnabled(false); + } +} + +WidgetBlockStack::~WidgetBlockStack() +{ + if (_w) + { + _w->setEnabled(true); + } +} diff --git a/src/svnfrontend/fronthelpers/widgetblockstack.h b/src/svnfrontend/fronthelpers/widgetblockstack.h new file mode 100644 index 0000000..88d24c5 --- /dev/null +++ b/src/svnfrontend/fronthelpers/widgetblockstack.h @@ -0,0 +1,33 @@ +/*************************************************************************** + * Copyright (C) 2006-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. * + ***************************************************************************/ +#ifndef __WIDGET_BLOCK_STACK_H +#define __WIDGET_BLOCK_STACK_H + +class QWidget; + +class WidgetBlockStack +{ + QWidget*_w; +public: + WidgetBlockStack(QWidget*); + ~WidgetBlockStack(); +}; + +#endif |