1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
/***************************************************************************
configurationclasses.h - description
-------------------
begin : Sat Apr 17 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. *
* *
***************************************************************************/
#ifndef CONFIGURATIONCLASSES_H
#define CONFIGURATIONCLASSES_H
// QT
#include <qstring.h>
#include <qstringlist.h>
#include <qdatetime.h>
#include <qmap.h>
#include <qregexp.h>
typedef QMap<QString,QString> KeyValueMap;
// entry strings in the kfilereplacerc file
const QString rcDirectoriesList = "Directories list";
const QString rcFiltersList = "Filters list";
const QString rcRecentFiles = "Recent files";
const QString rcAllStringsMustBeFound = "All strings must be found";
const char rcEncoding[] = "Encoding";
const QString rcCaseSensitive = "Case sensitive";
const QString rcConfirmStrings = "Confirm strings";
const QString rcConfirmFiles = "Confirm files";
const QString rcConfirmDirs = "Confirm directories";
const QString rcFollowSymLinks = "Follow symbolic links";
const QString rcHaltOnFirstOccur = "Halt on first occurrence";
const QString rcIgnoreHidden = "Ignore hidden files";
const QString rcRecursive = "Search/replace in sub folders";
const QString rcVariables = "Enable variables";
const QString rcRegularExpressions = "Enable regular expressions";
const QString rcMinFileSize = "Minimum file size";
const QString rcMaxFileSize = "Maximum file size";
const QString rcValidAccessDate = "Access mode";
const QString rcMinDate = "Minimum access date";
const QString rcMaxDate = "Maximum access date";
const QString rcOwnerUser = "Owner user filters";
const QString rcOwnerGroup = "Owner group filters";
const QString rcSearchMode = "Search only mode";
const QString rcBackupExtension = "Backup file extension";
const QString rcIgnoreFiles = "Ignore files if there is no match";
const QString rcNotifyOnErrors = "NotifyOnErrors";
const QString rcAskConfirmReplace = "Ask confirmation on replace";
const QString rcDontAskAgain = "Don't ask again";
// Default configuration options
const QString EncodingOption = "utf8";
const bool RecursiveOption = true;
const bool CaseSensitiveOption = false;
const bool FollowSymbolicLinksOption = false;
const bool RegularExpressionsOption = false;
const bool VariablesOption = false;
const bool StopWhenFirstOccurenceOption = false;
const bool IgnoreHiddenOption = false;
const int FileSizeOption = -1;
const QString AccessDateOption="unknown";
const QString ValidAccessDateOption="unknown";
const QString OwnerOption="false,Name,Equals To";
const bool SearchModeOption=true;
const QString BackupExtensionOption="false,~";
const bool IgnoreFilesOption = true;
const bool NotifyOnErrorsOption = false;
const bool AskConfirmReplaceOption = false;
// This class stores configuration information
class RCOptions
{
public:
bool m_callResetActions;
bool m_askConfirmReplace,
m_dontAskAgain;
QString m_directories,
m_filters,
m_currentDirectory;
int m_minSize,
m_maxSize;
QString m_dateAccess,
m_minDate,
m_maxDate;
QString m_encoding;
bool m_caseSensitive,
m_recursive,
m_followSymLinks,
m_allStringsMustBeFound,
m_backup,
m_regularExpressions;
bool m_variables,
m_haltOnFirstOccur,
m_ignoreHidden,
m_simulation,
m_searchingOnlyMode;
bool m_ownerUserIsChecked,
m_ownerGroupIsChecked;
QString m_ownerUserType,
m_ownerGroupType,
m_ownerUserValue,
m_ownerGroupValue,
m_ownerUserBool,
m_ownerGroupBool;
QString m_backupExtension;
bool m_ignoreFiles;
KeyValueMap m_mapStringsView;
QString m_quickSearchString,
m_quickReplaceString;
QStringList m_recentStringFileList;
bool m_notifyOnErrors;
public:
RCOptions();
RCOptions& operator=(const RCOptions& ci);
};
class ResultViewEntry
{
private:
QString m_key;
QString m_data;
QRegExp m_rxKey;
bool m_regexp;
bool m_caseSensitive;
int m_pos;
int m_matchedStringsOccurrence;
public:
ResultViewEntry(const QString &nkey, const QString &ndata, bool regexp, bool caseSensitive);
int lineNumber(const QString& line) const ;
int columnNumber(const QString& line) const ;
void incOccurrences();
int occurrences() const ;
bool regexp()const ;
int pos(const QString& line) ;
void incPos();
QString capturedText(const QString& line) ;
QString message(const QString& capturedText, int x, int y) const;
int keyLength() const;
int dataLength() const;
void updateLine(QString& line);
};
#endif
|