~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to kbabel/kbabel/kbabelview.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ****************************************************************************
2
 
  This file is part of KBabel
3
 
 
4
 
  Copyright (C) 1999-2000 by Matthias Kiefer
5
 
                            <matthias.kiefer@gmx.de>
6
 
                2002-2005  by Stanislav Visnovsky
7
 
                            <visnovsky@kde.org>
8
 
 
9
 
  This program is free software; you can redistribute it and/or modify
10
 
  it under the terms of the GNU General Public License as published by
11
 
  the Free Software Foundation; either version 2 of the License, or
12
 
  (at your option) any later version.
13
 
 
14
 
  This program 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
17
 
  GNU General Public License for more details.
18
 
 
19
 
  You should have received a copy of the GNU General Public License
20
 
  along with this program; if not, write to the Free Software
21
 
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22
 
 
23
 
  In addition, as a special exception, the copyright holders give
24
 
  permission to link the code of this program with any edition of
25
 
  the Qt library by Trolltech AS, Norway (or with modified versions
26
 
  of Qt that use the same license as Qt), and distribute linked
27
 
  combinations including the two.  You must obey the GNU General
28
 
  Public License in all respects for all of the code used other than
29
 
  Qt. If you modify this file, you may extend this exception to
30
 
  your version of the file, but you are not obligated to do so.  If
31
 
  you do not wish to do so, delete this exception statement from
32
 
  your version.
33
 
 
34
 
**************************************************************************** */
35
 
#ifndef KBABELVIEW_H
36
 
#define KBABELVIEW_H
37
 
 
38
 
class HidingMsgEdit;
39
 
class MsgMultiLineEdit;
40
 
class GotoDialog;
41
 
class QPopupMenu;
42
 
class KLed;
43
 
class FindDialog;
44
 
class ReplaceDialog;
45
 
 
46
 
namespace KBabel
47
 
{
48
 
    class EditCommand;
49
 
    class RegExpExtractor;
50
 
    class FindOptions;
51
 
    class ReplaceOptions;
52
 
}
53
 
 
54
 
class QListBoxItem;
55
 
class QTextView;
56
 
class QTabWidget;
57
 
class KListBox;
58
 
class KSpell;
59
 
class KSpellConfig;
60
 
class KBabelDictBox;
61
 
class KDataToolInfo;
62
 
struct ReplaceOptions;
63
 
struct ModuleInfo;
64
 
 
65
 
#include <kdockwidget.h>
66
 
#include <kurl.h>
67
 
#include <kconfig.h>
68
 
#include <qwidget.h>
69
 
#include <qstrlist.h>
70
 
#include <resources.h>
71
 
 
72
 
#include <catalogview.h>
73
 
#include "kbcatalog.h"
74
 
#include "kbproject.h"
75
 
#include "projectsettings.h"
76
 
 
77
 
class KBabelMW;
78
 
class CommentView;
79
 
class ContextView;
80
 
class KBCatalogListView;
81
 
class CharacterSelectorView;
82
 
class SourceView;
83
 
class TagListView;
84
 
 
85
 
/**
86
 
 * This is the main view class for KBabel.  Most of the non-menu,
87
 
 * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go
88
 
 * here.
89
 
 * @short Main view
90
 
 * @author Matthias Kiefer <matthias.kiefer@gmx.de>
91
 
 * @version 0.1
92
 
 */
93
 
class KBabelView : public QWidget, public KBabel::CatalogView
94
 
{
95
 
    Q_OBJECT
96
 
public:
97
 
    /**
98
 
    * Default constructor
99
 
    * @param buildLeds flag, if status leds should be created in editor
100
 
    */
101
 
    KBabelView(KBCatalog* catalog,KBabelMW *parent, KBabel::Project::Ptr project);
102
 
 
103
 
    /**
104
 
    * Destructor
105
 
    */
106
 
    virtual ~KBabelView();
107
 
 
108
 
    /**
109
 
     * @return the view, that has opened file url or 0 if this
110
 
     * file is not opened
111
 
     */
112
 
    static KBabelView *viewForURL(const KURL& url, const QString project);
113
 
 
114
 
    /**
115
 
     * @return the view, that has no opened file url or 0 if there
116
 
     * is no such view
117
 
     */
118
 
    static KBabelView *emptyView(const QString project);
119
 
 
120
 
    KURL currentURL() const;
121
 
    QString project() const { return _project->filename(); }
122
 
    void useProject (KBabel::Project::Ptr project);
123
 
    
124
 
    bool isLastView() const;
125
 
    bool isModified() const;
126
 
    /** the edit mode of the entry-editors*/
127
 
    bool isOverwriteMode() const;
128
 
    bool isReadOnly() const;
129
 
    /** the edit mode of the entry-editors*/
130
 
    void setOverwriteMode(bool ovr);
131
 
    bool isSearching() const;
132
 
 
133
 
    void saveView(KConfig *config);
134
 
    void restoreView(KConfig *config);
135
 
    void saveSession(KConfig*);
136
 
    void restoreSession(KConfig*);
137
 
 
138
 
    void readSettings(KConfig* config);
139
 
    void saveSettings();
140
 
 
141
 
    void readProject(KBabel::Project::Ptr project);
142
 
    void saveProject(KConfig* config);
143
 
 
144
 
    void openTemplate(const KURL& openURL, const KURL& saveURL);
145
 
    bool saveFile(bool checkSyntax=true);
146
 
    bool saveFileAs(KURL url = KURL(), bool checkSyntax=true);
147
 
    bool saveFileSpecial();
148
 
 
149
 
    /**
150
 
    * Checks, if the file has been modified. If true, it askes the user if he wants
151
 
    * to save, discard or cancel. If the users chose save, it saves the file.
152
 
    * @return true, if it is allowed to open a new file. false, if the user wants
153
 
    * to edit the file again.
154
 
    */
155
 
    bool checkModified();
156
 
 
157
 
 
158
 
    /**
159
 
    * Checks syntax of the current catalog. If the catalog is modified it
160
 
    * saves it under a temporary filename ( using @ref Catalog::saveTempFile ).
161
 
    *
162
 
    * @param msgOnlyAtError flag, if a message should be shown, only if
163
 
    * a error occured.
164
 
    * @param question flag, if only a information about the result should
165
 
    * be shown or a question, whether the user wants to continue or cancel
166
 
    *
167
 
    * @return true, if no error occured or if an error occured but the user
168
 
    * wants to continue anyway.
169
 
    */
170
 
    bool checkSyntax(bool msgOnlyAtError, bool question);
171
 
 
172
 
    /**
173
 
    * this is called from the catalog when updating his views.
174
 
    * reimplemented from @ref CatalogView
175
 
    * @param cmd the edit command that has been applied
176
 
    */
177
 
    virtual void update(KBabel::EditCommand* cmd, bool undo=false);
178
 
 
179
 
    KBCatalog* catalog() const{return _catalog;}
180
 
 
181
 
    void processUriDrop(KURL::List& uriList, const QPoint & pos);
182
 
 
183
 
   /**
184
 
   * checks the status of the displayed entry: last, first, fuzzy,...
185
 
   * and emits the appropriate signals
186
 
   */
187
 
   void emitEntryState();
188
 
 
189
 
   void setRMBEditMenu(QPopupMenu*);
190
 
   void setRMBSearchMenu(QPopupMenu*);
191
 
   void setTagsMenu(QPopupMenu*);
192
 
   void setArgsMenu(QPopupMenu*);
193
 
 
194
 
   QPtrList<ModuleInfo> dictionaries();
195
 
   KBabelDictBox* searchView() { return dictBox; }
196
 
 
197
 
   bool autoDiffEnabled() const {return _diffEnabled;}
198
 
 
199
 
public slots:
200
 
   
201
 
   void gotoEntry(const KBabel::DocPosition& pos, bool updateHistory=true);
202
 
 
203
 
    /** opens a filedialog and asks for an url */
204
 
    void open();
205
 
    void open(const KURL& url, const QString & package=QString::null, bool checkModified=true, bool newView=false);
206
 
    void setFilePackage();
207
 
    void revertToSaved();
208
 
 
209
 
    void updateSettings();
210
 
    void updateProjectSettings();
211
 
 
212
 
    void undo();
213
 
    void redo();
214
 
    void textCut();
215
 
    void textCopy();
216
 
    void textPaste();
217
 
    bool findNext();
218
 
    bool findPrev();
219
 
    void find();
220
 
    void findInFile(QCString fileSource, KBabel::FindOptions options);
221
 
    void replaceInFile(QCString fileSource, KBabel::ReplaceOptions options);
222
 
    void replace();
223
 
    void selectAll();
224
 
    void deselectAll();
225
 
    void clear();
226
 
    void msgid2msgstr();
227
 
    void search2msgstr();
228
 
    void plural2msgstr();
229
 
    void gotoFirst();
230
 
    void gotoLast();
231
 
    void gotoNext();
232
 
    void gotoPrev();
233
 
    void gotoEntry();
234
 
    void gotoNextFuzzyOrUntrans();
235
 
    void gotoPrevFuzzyOrUntrans();
236
 
    void gotoNextFuzzy();
237
 
    void gotoPrevFuzzy();
238
 
    void gotoNextUntranslated();
239
 
    void gotoPrevUntranslated();
240
 
    void gotoNextError();
241
 
    void gotoPrevError();
242
 
 
243
 
    void forwardHistory();
244
 
    void backHistory();
245
 
 
246
 
    void spellcheckAll();
247
 
    void spellcheckAllMulti();
248
 
    void spellcheckFromCursor();
249
 
    void spellcheckCurrent();
250
 
    void spellcheckFromCurrent();
251
 
    void spellcheckMarked();
252
 
    void spellcheckCommon();
253
 
 
254
 
    void roughTranslation();
255
 
    void diff();
256
 
    void toggleAutoDiff(bool on);
257
 
    void diffShowOrig();
258
 
    bool openDiffFile();
259
 
    void insertNextTag();
260
 
    void insertNextTagMsgid();
261
 
    void insertNextArg();
262
 
    void insertTagFromTool( const QString& tag );
263
 
    void showTagsMenu();
264
 
    void showArgsMenu();
265
 
    void skipToNextTag();
266
 
    void skipToPreviousTag();
267
 
    void skipToTagFromTool(int index);
268
 
    void wordCount();
269
 
 
270
 
    void removeFuzzyStatus();
271
 
    /** opens the header editor for the po-file */
272
 
    void editHeader();
273
 
 
274
 
    /** checks the syntax of the file by using msgftm */
275
 
    bool checkSyntax();
276
 
 
277
 
    /**
278
 
     * perform all checks listed above
279
 
     */
280
 
    bool checkAll();
281
 
 
282
 
    void stopSearch();
283
 
    void startSearch();
284
 
    void startSelectionSearch();
285
 
    void startSearch(const QString id);
286
 
    void startSelectionSearch(const QString id);
287
 
 
288
 
    void configureDictionary(const QString id);
289
 
    void editDictionary(const QString id);
290
 
    void aboutDictionary(const QString id);
291
 
 
292
 
    /** 
293
 
     * this was originally protected, but we need this to expose for
294
 
     * KBabelMW forwarding
295
 
     */
296
 
    virtual void wheelEvent(QWheelEvent*);
297
 
    
298
 
protected:
299
 
    virtual void dragEnterEvent(QDragEnterEvent *event);
300
 
    virtual void dropEvent(QDropEvent *event);
301
 
    virtual bool eventFilter(QObject*, QEvent* event);
302
 
 
303
 
signals:
304
 
    /** emited when a fuzzy catalogentry is shown */
305
 
    void signalFuzzyDisplayed(bool);
306
 
    /** emited when a untranslated catalogentry is shown */
307
 
    void signalUntranslatedDisplayed(bool);
308
 
    void signalFaultyDisplayed(bool);
309
 
    /** emited when the first catalogentry is shown */
310
 
    void signalFirstDisplayed(bool firstEntry, bool firstForm);
311
 
    /** emited when the last catalog entry is shown */
312
 
    void signalLastDisplayed(bool lastEntry, bool lastForm);
313
 
    
314
 
    void signalNextTag( int index );
315
 
    
316
 
    /**
317
 
    * emited when a new entry is shown
318
 
    * pos: position (index and plural form) of the currently shown entry
319
 
    */
320
 
    void signalDisplayed(const KBabel::DocPosition& pos);
321
 
 
322
 
    /**
323
 
    * emited when new entry is displayed and there is no
324
 
    * fuzzy entry afterwards in the catalog
325
 
    */
326
 
    void signalFuzzyAfterwards(bool);
327
 
    /**
328
 
    * emited when new entry is displayed and there is no
329
 
    * fuzzy entry in front of it in the catalog
330
 
    */
331
 
    void signalFuzzyInFront(bool);
332
 
    /**
333
 
    * emited when new entry is displayed and there is no
334
 
    * untranslated entry afterwards in the catalog
335
 
    */
336
 
    void signalUntranslatedAfterwards(bool);
337
 
    /**
338
 
    * emited when new entry is displayed and there is no
339
 
    * fuzzy entry in fornt of it in the catalog
340
 
    */
341
 
    void signalUntranslatedInFront(bool);
342
 
 
343
 
    void signalErrorAfterwards(bool);
344
 
    void signalErrorInFront(bool);
345
 
 
346
 
    /**
347
 
     * Use this signal to change the content of the statusbar
348
 
     */
349
 
    void signalChangeStatusbar(const QString& text);
350
 
    /**
351
 
     * Use this signal to change the content of the caption
352
 
     */
353
 
    void signalChangeCaption(const QString& text);
354
 
 
355
 
    void signalNewFileOpened(KURL url);
356
 
 
357
 
    void signalResetProgressBar(QString,int);
358
 
    void signalProgress(int);
359
 
    void signalClearProgressBar();
360
 
 
361
 
    void signalSearchActive(bool);
362
 
 
363
 
    void signalDiffEnabled(bool);
364
 
 
365
 
    void signalForwardHistory(bool have);
366
 
    void signalBackHistory(bool have);
367
 
 
368
 
    void ledColorChanged(const QColor& color);
369
 
 
370
 
    void signalDictionariesChanged();
371
 
 
372
 
    void signalMsgstrChanged();
373
 
 
374
 
    void signalNextTagAvailable(bool);
375
 
    void signalTagsAvailable(bool);
376
 
 
377
 
    void signalNextArgAvailable(bool);
378
 
    void signalArgsAvailable(bool);
379
 
 
380
 
    void signalCursorPosChanged(int line, int col);
381
 
 
382
 
    void signalSpellcheckDone(int result);
383
 
 
384
 
    void signalCopy();
385
 
    void signalCut();
386
 
    void signalPaste();
387
 
    void signalSelectAll();
388
 
 
389
 
private:
390
 
   /**
391
 
   * inserts the content of the current catalog entry into
392
 
   * the fields in the view
393
 
   * @param delay flag, if the auto search should be started delayed
394
 
   * this is useful when a new file is opened
395
 
   * @param formID number of the plural form to be displayed. Use 0 for
396
 
   * no plural form
397
 
   */
398
 
   void updateEditor(int formID=0, bool delay=false);
399
 
 
400
 
   void initDockWidgets();
401
 
   
402
 
   void startSearch(bool delay);
403
 
 
404
 
   /**
405
 
    * makes some checks like checkings arguments and accels etc
406
 
    * @param onlyWhenChanged flag, if message should only be shown
407
 
    * when status changed
408
 
    */
409
 
   void autoCheck(bool onlyWhenChanged);
410
 
 
411
 
   /**
412
 
    * Create instances of tools currently setup for autochecks
413
 
    */
414
 
   void setupAutoCheckTools();
415
 
 
416
 
   /**
417
 
    * internal function to find next string given with @ref FindDialog
418
 
    * starting at position pos
419
 
    * @return true, if search was successful
420
 
    */
421
 
   bool findNext_internal(KBabel::DocPosition& pos, bool forReplace=false, bool mark=true);
422
 
   /**
423
 
    * internal function to find previous string given with @ref FindDialog
424
 
    * starting at position pos
425
 
    * @return true, if search was successful
426
 
    */
427
 
   bool findPrev_internal(KBabel::DocPosition& pos, bool forReplace=false, bool mark=true);
428
 
 
429
 
   /**
430
 
    * makes the real work
431
 
    * @param autoDiff flag, if called from @ref autoDiff()
432
 
    */
433
 
   void diffInternal(bool autoDiff);
434
 
 
435
 
   /**
436
 
    * @param autoDiff flag, if called from @ref autoDiff()
437
 
    */
438
 
   bool openDiffFile(bool autoDiff);
439
 
 
440
 
   /**
441
 
    * Inserts a text into the msgstr (into the current form) using undoable commands.
442
 
    * if @param clearFirst is set to true, it will clear the contents of msgstr before inserting
443
 
    */
444
 
   void modifyMsgstrText(const uint offset, const QString& text, bool clearFirst=false);
445
 
 
446
 
protected slots:
447
 
   bool validateUsingTool( const KDataToolInfo & info, const QString & command );
448
 
   void modifyUsingTool( const KDataToolInfo & info, const QString & command );
449
 
   void modifyCatalogUsingTool( const KDataToolInfo & info, const QString & command );
450
 
 
451
 
private slots:
452
 
   void msgstrPluralFormChanged (uint index);
453
 
   void autoRemoveFuzzyStatus();
454
 
 
455
 
   /** connected to the catalog. it is called when a new file is opened*/
456
 
   void newFileOpened(bool readOnly);
457
 
 
458
 
   void showError(const QString& message);
459
 
 
460
 
   void toggleFuzzyLed(bool on);
461
 
   void toggleUntransLed(bool on);
462
 
   void toggleErrorLed(bool on);
463
 
 
464
 
   void forwardMsgstrEditCmd(KBabel::EditCommand*);
465
 
 
466
 
   /**
467
 
   * called from a signal from ReplaceDialog to replace the
468
 
   * current found string. After that it searches the next string
469
 
   */
470
 
   void replaceNext();
471
 
   /**
472
 
   * called from a signal from ReplaceDialog to replace
473
 
   * all without asking anymore.
474
 
   */
475
 
   void replaceAll();
476
 
   /**
477
 
   * called from a signal from ReplaceDialog to go to next
478
 
   * string to replace
479
 
   */
480
 
   void findNextReplace();
481
 
 
482
 
   /**
483
 
   * makes some checks like checkings arguments and accels etc
484
 
   */
485
 
   void autoCheck();
486
 
 
487
 
   void autoDiff();
488
 
 
489
 
   /**
490
 
    * called, when text in msgstrEdit changes to inform
491
 
    * the dictionary about the changes
492
 
    */
493
 
   void informDictionary();
494
 
   void setNewLanguage();
495
 
 
496
 
   void forwardProgressStart(const QString& msg);
497
 
   void forwardSearchStart();
498
 
   void forwardSearchStop();
499
 
 
500
 
   /**
501
 
    * checks if there is are fuzzy entries in front or behind
502
 
    * the current entry and emits the appropriate signals
503
 
    */
504
 
   void checkFuzzies();
505
 
   /**
506
 
    * checks if there is are untranslated entries in front or behind
507
 
    * the current entry and emits the appropriate signals
508
 
    */
509
 
   void checkUntranslated();
510
 
 
511
 
   /** inserts the nth tag from the available tags into msgstr*/
512
 
   void insertTag(int n);
513
 
 
514
 
   /** visually display the tag to be inserted next */
515
 
   void selectTag();
516
 
 
517
 
   void updateTags();
518
 
 
519
 
   /** inserts the nth argument from the available arguments into msgstr*/
520
 
   void insertArg(int n);
521
 
 
522
 
   void updateArgs();
523
 
   void insertChar(QChar ch);
524
 
 
525
 
   void showTryLaterMessageBox();
526
 
 
527
 
   void dummy(KSpell*) {}
528
 
 
529
 
private:
530
 
   static QPtrList<KBabelView> *viewList;
531
 
 
532
 
   HidingMsgEdit* msgstrEdit;
533
 
   HidingMsgEdit* msgidLabel;
534
 
   KBabelDictBox* dictBox;
535
 
   GotoDialog* _gotoDialog;
536
 
   FindDialog* _findDialog;
537
 
   FindDialog* _replaceDialog;
538
 
   ReplaceDialog* _replaceAskDialog;
539
 
 
540
 
   QPopupMenu* _dropMenu;
541
 
 
542
 
   KLed* _fuzzyLed;
543
 
   KLed* _untransLed;
544
 
   KLed* _errorLed;
545
 
 
546
 
   KBCatalog* _catalog;
547
 
   uint _currentIndex;
548
 
   KBabel::DocPosition _currentPos;
549
 
 
550
 
   KBabel::SpellcheckSettings _spellcheckSettings;
551
 
 
552
 
   bool _autoSearchTempDisabled;
553
 
 
554
 
   QValueList<uint> _backHistory;
555
 
   QValueList<uint> _forwardHistory;
556
 
 
557
 
   // flag to not beep, when switching to the next entry, because
558
 
   // go -> next or prev entry was used.
559
 
   bool _dontBeep;
560
 
 
561
 
   /**
562
 
   * position in document were find or replace function
563
 
   * started to search
564
 
   */
565
 
   KBabel::DocPosition _findStartPos;
566
 
   /**
567
 
   * the string that was marked during the last search
568
 
   */
569
 
   QString _lastFoundString;
570
 
 
571
 
   /*
572
 
   * flag, if internal find functions should break at end or ask for
573
 
   * beginning at the other end of the document
574
 
   */
575
 
   bool _findBreakAtEnd;
576
 
 
577
 
   /*
578
 
   * flag, if we search backwards and the direction was already
579
 
   * changed (see findNext and findPrev)
580
 
   */   
581
 
   bool _redirectedBackSearch;
582
 
 
583
 
   bool _showTryLaterBox;
584
 
 
585
 
   KBabel::DocPosition _replacePos;
586
 
   int _replaceLen;
587
 
   int _replacesTotal;
588
 
   bool _replaceWasAtEnd;
589
 
   /** contains the diff to the offset, where we started to search */
590
 
   int _replaceExtraOffset;
591
 
 
592
 
   /** appId for a source of the next files to be searched */
593
 
   QCString _fileSource;
594
 
 
595
 
   QStringList _tags;
596
 
   QPopupMenu *_tagsMenu;
597
 
 
598
 
   QStringList _args;
599
 
   QPopupMenu *_argsMenu;
600
 
 
601
 
   bool _diffEnabled;
602
 
   bool _loadingDiffFile;
603
 
   bool _diffing;
604
 
 
605
 
   /*
606
 
    * flag, set if editing KDE documentation PO-file
607
 
    */
608
 
   bool _editingDocumentation;
609
 
   QPtrList<KDataTool> _autocheckTools;
610
 
 
611
 
//spellcheck things
612
 
private:
613
 
   struct Position
614
 
   {
615
 
      uint index;
616
 
      uint form;
617
 
      uint pos;
618
 
      uint end;
619
 
   };
620
 
 
621
 
   enum SpellWhat{All,AllMulti,Current,Marked,Begin,End,BeginCurrent};
622
 
 
623
 
   struct
624
 
   {
625
 
      KSpell *kspell;
626
 
      KSpellConfig* config;
627
 
      QStringList wordList;
628
 
      bool active;
629
 
      int misspelled;
630
 
      int replaced;
631
 
      int posCorrection;
632
 
      uint lastIndex;
633
 
      QPtrList<Position> posDict;
634
 
      SpellWhat what2Check;
635
 
 
636
 
      // the last word, that was misspelled
637
 
      uint lastPos;
638
 
      // the position correction in the last word.
639
 
      // needed if words with '-' are treated as seperate words
640
 
      int inWordCorrection;
641
 
 
642
 
      QStringList origWords;
643
 
      QStringList newWords;
644
 
 
645
 
      QStringList ignoreList;
646
 
      QStringList newIgnoreList;
647
 
   } spell;
648
 
 
649
 
    struct {
650
 
        KSpell *kspell;
651
 
        KSpellConfig* config;
652
 
    } spell2;                   // on-the-fly spellchecking
653
 
 
654
 
    //DictSpellChecker * flyspell;
655
 
 
656
 
 
657
 
   /**
658
 
    * Marks a misspelled word in the editor.
659
 
    * After that, the cursor is at the beginning of the
660
 
    * marked text
661
 
    * @param orig the original word as given from KSpell
662
 
    * @param pos the position of the word in the StringList
663
 
    * spell.wordList
664
 
    *
665
 
    * @returns false, if the there is a synchronization error,
666
 
    * means the word has not been found in the editor.
667
 
    */
668
 
   bool markMisspelled(const QString &orig, unsigned int pos);
669
 
 
670
 
private slots:
671
 
   void spellcheck();
672
 
   void cancelSpellcheck();
673
 
   void spellStart(KSpell*);
674
 
   void spellMisspelled(const QString &orig, const QStringList &sug, unsigned int pos);
675
 
   void spellCorrected(const QString &orig, const QString &newWord, unsigned int pos);
676
 
   void spellResult(bool);
677
 
   void spellCleanDone();
678
 
   void spellAddIgnore(const QString &);
679
 
   // initialize spellchecking struct
680
 
   void cleanUpSpellStruct();
681
 
   void slotAutoSaveTimeout( );
682
 
 
683
 
private:
684
 
   void addSpellcheckWords(uint pos, QString text, uint index, uint form);
685
 
 
686
 
private:
687
 
   // configuration file
688
 
   KSharedConfig::Ptr _config;
689
 
   // project file
690
 
   KBabel::Project::Ptr _project;
691
 
   
692
 
   KBabel::RegExpExtractor* _tagExtractor;
693
 
   KBabel::RegExpExtractor* _argExtractor;
694
 
 
695
 
   QTimer * autoSaveTimer;
696
 
   int _autoSaveDelay;
697
 
 
698
 
   int _currentTag;
699
 
   
700
 
   KBabelMW* m_mainwindow;
701
 
   CommentView* m_commentview;
702
 
   ContextView* m_contextview;
703
 
   KBCatalogListView* m_cataloglistview;
704
 
   
705
 
   CharacterSelectorView* m_charselectorview;
706
 
   TagListView* m_taglistview;
707
 
   SourceView* m_sourceview;
708
 
   
709
 
   bool m_overwrite;
710
 
};
711
 
 
712
 
#endif // KBABELVIEW_H