summaryrefslogtreecommitdiffstats
path: root/tdefilereplace/configurationclasses.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-01-27 01:06:46 -0600
committerTimothy Pearson <[email protected]>2013-01-27 01:06:46 -0600
commitef2264e9790ae7e700ad3cf5fb3dbad05efd98d8 (patch)
treeac4650a642d502c458d0b654c8b731739ce601dc /tdefilereplace/configurationclasses.cpp
parenta32b928478b59d4fa8b8495bbad6864476c129b1 (diff)
downloadtdewebdev-ef2264e9790ae7e700ad3cf5fb3dbad05efd98d8.tar.gz
tdewebdev-ef2264e9790ae7e700ad3cf5fb3dbad05efd98d8.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdefilereplace/configurationclasses.cpp')
-rw-r--r--tdefilereplace/configurationclasses.cpp188
1 files changed, 188 insertions, 0 deletions
diff --git a/tdefilereplace/configurationclasses.cpp b/tdefilereplace/configurationclasses.cpp
new file mode 100644
index 00000000..f0c6bcc4
--- /dev/null
+++ b/tdefilereplace/configurationclasses.cpp
@@ -0,0 +1,188 @@
+/***************************************************************************
+ configurationclasses.cpp - description
+ -------------------
+ begin : Sat Sep 11 2004
+ copyright : (C) 2004 Emiliano Gulmini
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+// QT
+
+// KDE
+
+// local
+#include "configurationclasses.h"
+#include "whatthis.h"
+
+using namespace whatthisNameSpace;
+
+//RCOptions Class
+RCOptions::RCOptions()
+{
+ m_searchingOnlyMode = false;
+}
+
+RCOptions& RCOptions::operator=(const RCOptions& ci)
+{
+ //m_callResetActions = ci.m_callResetActions;
+
+ m_directories = ci.m_directories;
+ m_filters = ci.m_filters;
+ m_currentDirectory = ci.m_currentDirectory;
+ m_minSize = ci.m_minSize;
+ m_maxSize = ci.m_maxSize;
+
+ m_dateAccess = ci.m_dateAccess;
+ m_minDate = ci.m_minDate;
+ m_maxDate = ci.m_maxDate;
+
+ m_caseSensitive = ci.m_caseSensitive;
+ m_recursive = ci.m_recursive;
+ m_followSymLinks = ci.m_followSymLinks;
+ m_allStringsMustBeFound = ci.m_allStringsMustBeFound;
+ m_backup = ci.m_backup;
+ m_backupExtension = ci.m_backupExtension;
+ m_ignoreFiles = ci.m_ignoreFiles;
+ m_regularExpressions = ci.m_regularExpressions;
+
+ m_variables = ci.m_variables;
+ m_haltOnFirstOccur = ci.m_haltOnFirstOccur;
+ m_ignoreHidden = ci.m_ignoreHidden;
+ m_simulation = ci.m_simulation;
+ m_searchingOnlyMode = ci.m_searchingOnlyMode;
+
+ m_ownerUserIsChecked = ci.m_ownerUserIsChecked;
+ m_ownerGroupIsChecked = ci.m_ownerGroupIsChecked;
+
+ m_ownerUserBool = ci.m_ownerUserBool;
+ m_ownerGroupBool = ci.m_ownerGroupBool;
+
+ m_ownerUserType = ci.m_ownerUserType;
+ m_ownerGroupType = ci.m_ownerGroupType;
+
+ m_ownerUserValue = ci.m_ownerUserValue;
+ m_ownerGroupValue = ci.m_ownerGroupValue;
+
+ m_mapStringsView = ci.m_mapStringsView;
+
+ m_quickSearchString = ci.m_quickSearchString;
+ m_quickReplaceString = ci.m_quickReplaceString;
+
+ m_recentStringFileList = ci.m_recentStringFileList;
+
+ m_notifyOnErrors = ci.m_notifyOnErrors;
+
+ return (*this);
+}
+
+//ResultViewEntry Class
+ResultViewEntry::ResultViewEntry(TQString nkey, TQString ndata, bool regexp, bool caseSensitive)
+{
+ m_caseSensitive = caseSensitive;
+ m_regexp = regexp;
+
+ if(regexp)
+ {
+ m_rxKey = TQRegExp("("+nkey+")", caseSensitive, false);
+ }
+ else
+ {
+ m_key = nkey;
+ }
+ m_data = ndata;
+ m_matchedStringsOccurrence = 0;
+ m_pos = 0;
+}
+
+int ResultViewEntry::lineNumber(const TQString& line) const
+{
+ return line.mid(0,m_pos).contains('\n')+1;
+}
+
+int ResultViewEntry::columnNumber(const TQString& line) const
+{
+ return(m_pos - line.findRev('\n',m_pos));
+}
+
+void ResultViewEntry::incOccurrences()
+{
+ m_matchedStringsOccurrence++;
+}
+
+int ResultViewEntry::occurrences() const
+{
+ return m_matchedStringsOccurrence;
+}
+
+bool ResultViewEntry::regexp()const
+{
+ return m_regexp;
+}
+
+int ResultViewEntry::pos(const TQString& line)
+{
+ if(m_regexp)
+ m_pos = m_rxKey.search(line,m_pos);
+ else
+ m_pos = line.find(m_key, m_pos, m_caseSensitive);
+
+ return m_pos;
+}
+
+void ResultViewEntry::incPos()
+{
+ int kl = keyLength(),
+ dl = dataLength();
+
+ if(kl < dl)
+ m_pos += kl;
+ else
+ m_pos += dl;
+
+}
+
+TQString ResultViewEntry::capturedText(const TQString& line)
+{
+ TQString cap;
+
+ if(m_regexp)
+ cap = m_rxKey.cap(1);
+ else
+ cap =line.mid(m_pos,m_key.length());
+
+ return cap;
+}
+
+TQString ResultViewEntry::message(const TQString& capturedText, int x, int y) const
+{
+ TQString data = m_data;
+ //return i18n(" captured text \"%1\" replaced with \"%2\" at line: %3, column: %4 ").arg(capturedText).arg(data).arg(TQString::number(x,10)).arg(TQString::number(y,10));
+ return i18n(" Line:%3,Col:%4 - \"%1\" -> \"%2\"").arg(capturedText).arg(data).arg(TQString::number(x,10)).arg(TQString::number(y,10));
+}
+
+int ResultViewEntry::keyLength() const
+{
+ if(m_regexp)
+ return m_rxKey.matchedLength();
+ else
+ return m_key.length();
+}
+
+int ResultViewEntry::dataLength() const
+{
+ return m_data.length();
+}
+
+void ResultViewEntry::updateLine(TQString& line)
+{
+ line.insert(m_pos, m_data);
+ line.remove(m_pos + dataLength(), keyLength());
+}