You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
189 lines
4.7 KiB
189 lines
4.7 KiB
15 years ago
|
/***************************************************************************
|
||
|
configurationclasses.cpp - description
|
||
|
-------------------
|
||
|
begin : Sat Sep 11 2004
|
||
|
copyright : (C) 2004 Emiliano Gulmini
|
||
|
email : emi_barbarossa@yahoo.it
|
||
|
***************************************************************************/
|
||
|
|
||
|
/***************************************************************************
|
||
|
* *
|
||
|
* 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
|
||
15 years ago
|
ResultViewEntry::ResultViewEntry(TQString nkey, TQString ndata, bool regexp, bool caseSensitive)
|
||
15 years ago
|
{
|
||
|
m_caseSensitive = caseSensitive;
|
||
|
m_regexp = regexp;
|
||
|
|
||
|
if(regexp)
|
||
|
{
|
||
15 years ago
|
m_rxKey = TQRegExp("("+nkey+")", caseSensitive, false);
|
||
15 years ago
|
}
|
||
|
else
|
||
|
{
|
||
|
m_key = nkey;
|
||
|
}
|
||
|
m_data = ndata;
|
||
|
m_matchedStringsOccurrence = 0;
|
||
|
m_pos = 0;
|
||
|
}
|
||
|
|
||
15 years ago
|
int ResultViewEntry::lineNumber(const TQString& line) const
|
||
15 years ago
|
{
|
||
14 years ago
|
return line.mid(0,m_pos).contains('\n')+1;
|
||
15 years ago
|
}
|
||
|
|
||
15 years ago
|
int ResultViewEntry::columnNumber(const TQString& line) const
|
||
15 years ago
|
{
|
||
14 years ago
|
return(m_pos - line.findRev('\n',m_pos));
|
||
15 years ago
|
}
|
||
|
|
||
|
void ResultViewEntry::incOccurrences()
|
||
|
{
|
||
|
m_matchedStringsOccurrence++;
|
||
|
}
|
||
|
|
||
|
int ResultViewEntry::occurrences() const
|
||
|
{
|
||
|
return m_matchedStringsOccurrence;
|
||
|
}
|
||
|
|
||
|
bool ResultViewEntry::regexp()const
|
||
|
{
|
||
|
return m_regexp;
|
||
|
}
|
||
|
|
||
15 years ago
|
int ResultViewEntry::pos(const TQString& line)
|
||
15 years ago
|
{
|
||
|
if(m_regexp)
|
||
|
m_pos = m_rxKey.search(line,m_pos);
|
||
|
else
|
||
14 years ago
|
m_pos = line.find(m_key, m_pos, m_caseSensitive);
|
||
15 years ago
|
|
||
|
return m_pos;
|
||
|
}
|
||
|
|
||
|
void ResultViewEntry::incPos()
|
||
|
{
|
||
|
int kl = keyLength(),
|
||
|
dl = dataLength();
|
||
|
|
||
|
if(kl < dl)
|
||
|
m_pos += kl;
|
||
|
else
|
||
|
m_pos += dl;
|
||
|
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString ResultViewEntry::capturedText(const TQString& line)
|
||
15 years ago
|
{
|
||
15 years ago
|
TQString cap;
|
||
15 years ago
|
|
||
|
if(m_regexp)
|
||
|
cap = m_rxKey.cap(1);
|
||
|
else
|
||
|
cap =line.mid(m_pos,m_key.length());
|
||
|
|
||
|
return cap;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString ResultViewEntry::message(const TQString& capturedText, int x, int y) const
|
||
15 years ago
|
{
|
||
15 years ago
|
TQString data = m_data;
|
||
13 years ago
|
//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));
|
||
15 years ago
|
}
|
||
|
|
||
|
int ResultViewEntry::keyLength() const
|
||
|
{
|
||
|
if(m_regexp)
|
||
|
return m_rxKey.matchedLength();
|
||
|
else
|
||
|
return m_key.length();
|
||
|
}
|
||
|
|
||
|
int ResultViewEntry::dataLength() const
|
||
|
{
|
||
|
return m_data.length();
|
||
|
}
|
||
|
|
||
15 years ago
|
void ResultViewEntry::updateLine(TQString& line)
|
||
15 years ago
|
{
|
||
|
line.insert(m_pos, m_data);
|
||
|
line.remove(m_pos + dataLength(), keyLength());
|
||
|
}
|