• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • kasten
  • controllers
  • view
  • replace
replacetool.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Kasten module, made within the KDE community.
3 
4  Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef REPLACETOOL_H
24 #define REPLACETOOL_H
25 
26 // libfinddialog
27 #include <kfinddirection.h>
28 // Kasten core
29 #include <abstracttool.h>
30 // Okteta core
31 #include <address.h>
32 
33 namespace Okteta {
34 class AbstractByteArrayModel;
35 }
36 
37 
38 namespace Kasten2
39 {
40 
41 namespace If {
42 class ReplaceUserQueryable;
43 }
44 class ByteArrayView;
45 
46 
47 // TODO: is queryAgent needed, or should the tool better be a state machine? same with search tool
48 class ReplaceTool : public AbstractTool
49 {
50  Q_OBJECT
51 
52  public:
53  ReplaceTool();
54  virtual ~ReplaceTool();
55 
56  public: // AbstractTool API
57 // virtual AbstractModel* targetModel() const;
58  virtual QString title() const;
59 
60  virtual void setTargetModel( AbstractModel* model );
61 
62  public: // status
63  QByteArray searchData() const;
64  QByteArray replaceData() const;
65 // Qt::CaseSensitivity caseSensitivity() const;
66  bool hasSelectedData() const;
67  QString charCodingName() const;
68 
69  bool isApplyable() const; // candidate for AbstractTool API
70 
71  public: // actions
72  void replace( KFindDirection direction, bool fromCursor, bool inSelection );
73 
74  public:
75  void setUserQueryAgent( If::ReplaceUserQueryable* userQueryAgent );
76 
77  public Q_SLOTS: // settings
78  void setSearchData( const QByteArray& searchData );
79  void setReplaceData( const QByteArray& replaceData );
80  void setCaseSensitivity( Qt::CaseSensitivity caseSensitivity );
81  void setDoPrompt( int doPrompt );
82 
83  Q_SIGNALS:
84  void isApplyableChanged( bool isApplyable ); // candidate for AbstractTool API
85  void finished( bool previousFound, int noOfReplacements );
86 
87  protected:
88  void doReplace( KFindDirection direction, Okteta::Address startIndex );
89 
90  protected Q_SLOTS:
91  void onReadOnlyChanged( bool isReadOnly );
92 
93  protected: // settings
94  QByteArray mSearchData;
95  QByteArray mReplaceData;
96  Qt::CaseSensitivity mCaseSensitivity;
97  bool mDoPrompt :1;
98 
99  protected: // status
100  bool mPreviousFound :1;
101  bool mDoWrap :1;
102  Okteta::Address mReplaceFirstIndex;
103  Okteta::Address mReplaceLastIndex;
104 
105  protected: //
106  If::ReplaceUserQueryable* mUserQueryAgent;
107 
108  protected: // target
109  ByteArrayView* mByteArrayView;
110  Okteta::AbstractByteArrayModel* mByteArrayModel;
111 };
112 
113 
114 inline QByteArray ReplaceTool::searchData() const { return mSearchData; }
115 inline QByteArray ReplaceTool::replaceData() const { return mReplaceData; }
116 // inline Qt::CaseSensitivity ReplaceTool::caseSensitivity() const { return mCaseSensitivity; }
117 
118 }
119 
120 #endif
Kasten2::ReplaceTool::setTargetModel
virtual void setTargetModel(AbstractModel *model)
Definition: replacetool.cpp:68
Okteta::Address
qint32 Address
Definition: address.h:34
Okteta::AbstractByteArrayModel
could it be useful to hide the data access behind an iterator? * class KDataBufferIterator { public: ...
Definition: abstractbytearraymodel.h:79
Kasten2::ReplaceTool::mUserQueryAgent
If::ReplaceUserQueryable * mUserQueryAgent
Definition: replacetool.h:106
Kasten2::ReplaceTool::searchData
QByteArray searchData() const
Definition: replacetool.h:114
Kasten2::ReplaceTool::replace
void replace(KFindDirection direction, bool fromCursor, bool inSelection)
Definition: replacetool.cpp:136
Kasten2::ReplaceTool::isApplyableChanged
void isApplyableChanged(bool isApplyable)
Kasten2::ReplaceTool::mReplaceData
QByteArray mReplaceData
Definition: replacetool.h:95
Kasten2::ReplaceTool::mCaseSensitivity
Qt::CaseSensitivity mCaseSensitivity
Definition: replacetool.h:96
Kasten2::ReplaceTool::mByteArrayModel
Okteta::AbstractByteArrayModel * mByteArrayModel
Definition: replacetool.h:110
Kasten2::ReplaceTool::finished
void finished(bool previousFound, int noOfReplacements)
Kasten2::If::ReplaceUserQueryable
Definition: replaceuserqueryable.h:41
Kasten2::ReplaceTool::mPreviousFound
bool mPreviousFound
Definition: replacetool.h:100
Kasten2::ReplaceTool::mReplaceLastIndex
Okteta::Address mReplaceLastIndex
Definition: replacetool.h:103
Kasten2::ReplaceTool::doReplace
void doReplace(KFindDirection direction, Okteta::Address startIndex)
Definition: replacetool.cpp:178
Kasten2::ReplaceTool::title
virtual QString title() const
Definition: replacetool.cpp:62
kfinddirection.h
Kasten2::ReplaceTool::ReplaceTool
ReplaceTool()
Definition: replacetool.cpp:44
address.h
Kasten2::ReplaceTool
Definition: replacetool.h:48
Kasten2::ReplaceTool::setReplaceData
void setReplaceData(const QByteArray &replaceData)
Definition: replacetool.cpp:109
Kasten2::ReplaceTool::mByteArrayView
ByteArrayView * mByteArrayView
Definition: replacetool.h:109
Kasten2::ReplaceTool::mSearchData
QByteArray mSearchData
Definition: replacetool.h:94
Kasten2::ReplaceTool::hasSelectedData
bool hasSelectedData() const
Definition: replacetool.cpp:64
Kasten2::ReplaceTool::setSearchData
void setSearchData(const QByteArray &searchData)
Definition: replacetool.cpp:98
Kasten2::KFindDirection
KFindDirection
Definition: kfinddirection.h:29
Kasten2::ReplaceTool::setUserQueryAgent
void setUserQueryAgent(If::ReplaceUserQueryable *userQueryAgent)
Definition: replacetool.cpp:93
Kasten2::ReplaceTool::setCaseSensitivity
void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
Definition: replacetool.cpp:120
Kasten2::ReplaceTool::onReadOnlyChanged
void onReadOnlyChanged(bool isReadOnly)
Definition: replacetool.cpp:287
Kasten2::ReplaceTool::charCodingName
QString charCodingName() const
Definition: replacetool.cpp:65
Kasten2::ReplaceTool::mReplaceFirstIndex
Okteta::Address mReplaceFirstIndex
Definition: replacetool.h:102
Kasten2::ReplaceTool::~ReplaceTool
virtual ~ReplaceTool()
Definition: replacetool.cpp:295
Kasten2::ReplaceTool::mDoWrap
bool mDoWrap
Definition: replacetool.h:101
Kasten2::AbstractTool
Definition: abstracttool.h:40
Kasten2::AbstractModel
Definition: abstractmodel.h:40
Kasten2::ByteArrayView
Definition: bytearrayview.h:51
Kasten2::ReplaceTool::mDoPrompt
bool mDoPrompt
Definition: replacetool.h:97
Kasten2::ReplaceTool::setDoPrompt
void setDoPrompt(int doPrompt)
Definition: replacetool.cpp:131
Kasten2::ReplaceTool::replaceData
QByteArray replaceData() const
Definition: replacetool.h:115
Kasten2::ReplaceTool::isApplyable
bool isApplyable() const
Definition: replacetool.cpp:53
abstracttool.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:09 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

Skip menu "okteta"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal