Am 04.04.2011 um 13:02 schrieb Stephan Witt:

> Am 04.04.2011 um 11:39 schrieb Abdelrazak Younes:
> 
>> On 04/03/2011 08:38 PM, Jean-Pierre Chrétien wrote:
>>> Hello,
>>> 
>>> Using the spellchecker window, I get this quite often when I hit 'Ignore 
>>> all':
>>> 
>>> <cite>
>>> We reached the end of the document, would you like to continue from the 
>>> beginning?
>>> </cite>
>>> 
>>> If I say yes, it restars at the beginning, which is not what I want.
>>> If I say no, it goes on where I was, which is I want, but it's a bore to 
>>> acknowledge the message all the time.
>>> 
>>> Found nothing on Trac, new bug ?
>> 
>> Yes, new one, please create an entry for it. I probably won't have time to 
>> fix it this week but maybe Stephan will... :-P
> 
> Maybe, but I didn't get the problem...
> 
> "Ignore all" means ignore this word until session ends. It doesn't mean 
> ignore all words.
> So if one hits "Ignore all" the word is temporarily "learned" and the spell 
> checker proceeds.
> If it is the only wrong spelled word then the speller raises the mentioned 
> question.
> If there is another misspelled word the speller stops there. It is as it 
> should, AFAICS.
> 
> Perhaps you want the speller window to dismiss when you answer "no" to the 
> question.
> But this is independent of the "Ignore all" button. Is this what you want?

Can be fixed with the attached patch. Abdel, what do you think?

Stephan

Index: src/frontends/qt4/GuiSpellchecker.h
===================================================================
--- src/frontends/qt4/GuiSpellchecker.h (Revision 38240)
+++ src/frontends/qt4/GuiSpellchecker.h (Arbeitskopie)
@@ -31,12 +31,12 @@
        Q_OBJECT
 
 public:
-       SpellcheckerWidget(GuiView * gv, QWidget * parent = 0);
+       SpellcheckerWidget(GuiView * gv, DockView * dv, QWidget * parent = 0);
        ~SpellcheckerWidget();
        ///
        void updateView();
        ///
-       bool initialiseParams(std::string const & data);
+       bool initialiseParams(std::string const &);
 
 private Q_SLOTS:
        void on_findNextPB_clicked();
@@ -71,7 +71,7 @@
 private:
        ///{
        void updateView();
-       bool initialiseParams(std::string const &) { return true; }
+       bool initialiseParams(std::string const & data) { return 
widget_->initialiseParams(data); }
        void clearParams() {}
        void dispatchParams() {}
        bool isBufferDependent() const { return false; }
Index: src/frontends/qt4/GuiSpellchecker.cpp
===================================================================
--- src/frontends/qt4/GuiSpellchecker.cpp       (Revision 38240)
+++ src/frontends/qt4/GuiSpellchecker.cpp       (Arbeitskopie)
@@ -59,8 +59,8 @@
 
 struct SpellcheckerWidget::Private
 {
-       Private(SpellcheckerWidget * parent)
-               : p(parent) {}
+       Private(SpellcheckerWidget * parent, DockView * dv)
+               : p(parent), dv_(dv), start_(true) {}
        /// update from controller
        void updateSuggestions(docstring_list & words);
        /// move to next position after current word
@@ -75,13 +75,17 @@
        SpellcheckerWidget * p;
        ///
        GuiView * gv_;
+       ///
+       DockView * dv_;
        /// current word being checked and lang code
        WordLangTuple word_;
+       ///
+       bool start_;
 };
 
 
-SpellcheckerWidget::SpellcheckerWidget(GuiView * gv, QWidget * parent)
-       : QTabWidget(parent), d(new Private(this))
+SpellcheckerWidget::SpellcheckerWidget(GuiView * gv, DockView * dv, QWidget * 
parent)
+       : QTabWidget(parent), d(new Private(this, dv))
 {
        d->ui.setupUi(this);
        d->gv_ = gv;
@@ -159,8 +163,10 @@
 {
        BufferView * bv = d->gv_->documentBufferView();
        setEnabled(bv != 0);
-       if (bv && hasFocus())
+       if (bv && hasFocus() && d->start_) {
+               d->start_ = false;
                d->check();
+       }
 }
 
 
@@ -171,8 +177,10 @@
                        qt_("We reached the end of the document, would you like 
to "
                                "continue from the beginning?"),
                        QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
-               if (answer == QMessageBox::No)
+               if (answer == QMessageBox::No) {
+                       dv_->hide();
                        return false;
+               }
                dispatch(FuncRequest(LFUN_BUFFER_BEGIN));
                return true;
 }
@@ -208,6 +216,13 @@
 }
 
 
+bool SpellcheckerWidget::initialiseParams(std::string const &)
+{
+       d->start_ = true;
+       return true;
+}
+
+
 void SpellcheckerWidget::on_ignoreAllPB_clicked()
 {
        /// replace all occurrences of word
@@ -339,7 +354,7 @@
        : DockView(parent, "spellchecker", qt_("Spellchecker"),
                   area, flags)
 {
-       widget_ = new SpellcheckerWidget(&parent);
+       widget_ = new SpellcheckerWidget(&parent, this);
        setWidget(widget_);
        setFocusProxy(widget_);
 }

Reply via email to