/*************************************************************************** * 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 #include #include #include #include #include #include #include #include "editproperty_impl.h" EditProperty_impl::EditProperty_impl(TQWidget *parent, const char *name) :EditPropsDlgData(parent, name) { /// @TODO Read these values from a text or config file fileProperties += ("svn:eol-style"); fileProperties += ("svn:executable"); fileProperties += ("svn:keywords"); fileProperties += ("svn:needs-lock"); fileProperties += ("svn:mime-type"); fileComments += i18n("One of 'native', 'LF', 'CR', 'CRLF'."); fileComments += i18n("If present, make the file executable.
" "This property can not be set on a directory. " "A non-recursive attempt will fail, and a recursive attempt " "will set the property only on the file children of the folder."); fileComments += i18n("Keywords to be expanded into the contents of a file.
" "They can be inserted into documents by placing a keyword anchor " "which is formatted as $KeywordName$.
" "Valid keywords are:
" "URL/HeadURL The URL for the head revision of the project.
" "Author/LastChangedBy The last person to change the file.
" "Date/LastChangedDate The date/time the object was last modified.
" "Revision/Rev/LastChangedRevision The last revision the object changed.
" "Id A compressed summary of the previous 4 keywords."); fileComments += i18n("Set this to any value (e.g. '*') to enforce locking for this file.
" "The file will be set read-only when checked out or updated, " "indicating that a user must acquire a lock on the file before " "they can edit and commit changes."); fileComments += i18n("The mimetype of the file. Used to determine " "whether to merge the file and how to serve it from " "Apache. A mimetype beginning with 'text/' (or an absent " "mimetype) is treated as text. Anything else is treated as binary."); dirProperties += ("svn:eol-style"); dirProperties += ("svn:executable"); dirProperties += ("svn:externals"); dirProperties += ("svn:ignore"); dirProperties += ("svn:mime-type"); dirProperties += ("bugtraq:label"); dirProperties += ("bugtraq:url"); dirProperties += ("bugtraq:message"); dirProperties += ("bugtraq:warnifnoissue"); dirProperties += ("bugtraq:number"); dirProperties += ("bugtraq:append"); dirProperties += ("bugtraq:logregex"); dirComments += i18n("One of 'native', 'LF', 'CR', 'CRLF'."); dirComments += i18n("If present, make the file executable.
" "This property can not be set on a directory. " "A non-recursive attempt will fail, and a recursive attempt " "will set the property only on the file children of the folder."); /* TRANSLATORS: Do not translate "example" in the URL because this is according TRANSLATORS: to http://www.rfc-editor.org/rfc/rfc2606.txt a reserved URL.*/ dirComments += i18n("A newline separated list of module specifiers, each " "consisting of a relative directory path, optional revision " "flags, and a URL. For example:
" "foo http://example.com/repos/projectA
" "foo/bar -r 1234 http://example.com/repos/projectB"); dirComments += i18n("A newline separated list of file patterns to ignore."); dirComments += i18n("The mimetype of the file. Used to determine " "whether to merge the file and how to serve it from " "Apache. A mimetype beginning with 'text/' (or an absent " "mimetype) is treated as text. Anything else is treated as binary."); dirComments += i18n("Label text to show for the edit box where the user enters the issue number."); /* TRANSLATORS: Do not translate "example" in the URL because this is according TRANSLATORS: to http://www.rfc-editor.org/rfc/rfc2606.txt a reserved URL.*/ dirComments += i18n("URL pointing to the issue tracker. It must contain " "%BUGID% which gets replaced with the bug issue number. Example:
" "http://example.com/mantis/view.php?id=%BUGID%"); dirComments += i18n("String which is appended to a log message when an issue " "number is entered. The string must contain %BUGID% " "which gets replaced with the bug issue number."); dirComments += i18n("Set to 'yes' if a warning shall be shown when " "no issue is entered in the commit dialog. Possible values:
" "'true'/'yes' or 'false'/'no'."); dirComments += i18n("Set to 'false' if your bugtracking system has " "issues which are referenced not by numbers.
" "Possible values: 'true' or 'false'."); dirComments += i18n("Set to 'false' if you want the bugtracking ID " "to be inserted at the top of the log message. The " "default is 'true' which means the bugtracking " "ID is appended to the log message."); dirComments += i18n("Two regular expressions separated by a newline.
" "The first expression is used to find a string referring to an issue, the " "second expression is used to extract the bare bug ID from that string."); m_NameEdit->setAutoCompletion(true); m_NameEdit->setCompletionMode(KGlobalSettings::CompletionPopupAuto); m_NameEdit->setDuplicatesEnabled(false); m_NameEdit->setHistoryItems(fileProperties, true); isDir = false; TQToolTip::add(m_NameEdit, "Select or enter new property"); connect(m_NameEdit, TQT_SIGNAL(activated(const TQString &)), this, TQT_SLOT(updateToolTip(const TQString &))); } EditProperty_impl::~EditProperty_impl() { kdDebug() << "EditProperty_impl got destroyed" << endl; } void EditProperty_impl::updateToolTip(const TQString & selection) { int i; if (isDir) { i = dirProperties.findIndex(selection); if (i >= 0) { comment = dirComments[i]; } else { comment = "No help for this property available"; } } else { i = fileProperties.findIndex(selection); if (i >= 0) { comment = fileComments[i]; } else { comment = "No help for this property available"; } } TQToolTip::add(m_NameEdit, comment); } void EditProperty_impl::setDir(bool dir) { if (dir == isDir) { // Change not necessary return; } if (dir) { m_NameEdit->clearHistory(); m_NameEdit->setHistoryItems(dirProperties, true); } else { m_NameEdit->clearHistory(); m_NameEdit->setHistoryItems(fileProperties, true); } isDir = dir; } TQString EditProperty_impl::propName()const { return m_NameEdit->currentText(); } TQString EditProperty_impl::propValue()const { return m_ValueEdit->text(); } void EditProperty_impl::setPropName(const TQString&n) { m_NameEdit->addToHistory(n); m_NameEdit->setCurrentItem(n); updateToolTip(n); } void EditProperty_impl::setPropValue(const TQString&v) { m_ValueEdit->setText(v); } void EditProperty_impl::showHelp() { TQPoint pos = m_ValueEdit->pos(); pos.setX(pos.x() + m_ValueEdit->width()/2); pos.setY(pos.y() + m_ValueEdit->height()/4); TQWhatsThis::display(comment, mapToGlobal(pos)); } #include "editproperty_impl.moc"