[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kspread/ui
From:       Stefan Nikolaus <nikolaus.kde () googlemail ! com>
Date:       2010-06-26 8:17:44
Message-ID: 20100626081744.69843AC8DF () svn ! kde ! org
[Download RAW message or body]

SVN commit 1142957 by nikolaus:

Cleanup:	Simplify CellEditor's constructor.



 M  +1 -2      CellToolBase.cpp  
 M  +7 -5      Editors.cpp  
 M  +3 -5      Editors.h  


--- trunk/koffice/kspread/ui/CellToolBase.cpp #1142956:1142957
@@ -1313,8 +1313,7 @@
         return false;
 
     if (!editor()) {
-        d->cellEditor = new CellEditor(canvas()->canvasWidget(), selection(),
-                                       \
selection()->activeSheet()->map()->settings()->captureAllArrowKeys()); +        \
                d->cellEditor = new CellEditor(this, canvas()->canvasWidget());
         d->cellEditor->setEditorFont(cell.style().font(), true, \
canvas()->viewConverter());  connect(d->cellEditor, SIGNAL(textChanged(const QString \
                &)),
                 d->optionWidget->editor(), SLOT(setText(const QString &)));
--- trunk/koffice/kspread/ui/Editors.cpp #1142956:1142957
@@ -483,6 +483,7 @@
 class CellEditor::Private
 {
 public:
+    CellToolBase*             cellTool;
     Cell                      cell;
     Selection*                selection;
     KTextEdit*                textEdit;
@@ -506,15 +507,16 @@
 };
 
 
-CellEditor::CellEditor(QWidget* parent, Selection* selection, bool \
captureAllKeyEvents) +CellEditor::CellEditor(CellToolBase *cellTool, QWidget* parent)
         : QWidget(parent)
         , d(new Private)
 {
-    d->cell = Cell(selection->activeSheet(), selection->marker());
-    d->selection = selection;
+    d->cellTool = cellTool;
+    d->selection = cellTool->selection();
+    d->cell = Cell(d->selection->activeSheet(), d->selection->marker());
     d->textEdit = new KTextEdit(this);
     d->globalCursorPos = QPoint();
-    d->captureAllKeyEvents = captureAllKeyEvents;
+    d->captureAllKeyEvents = \
d->selection->activeSheet()->map()->settings()->captureAllArrowKeys();  \
d->checkChoice = true;  d->updateChoice = true;
     d->updatingChoice = false;
@@ -536,7 +538,7 @@
     d->textEdit->setLineWidth(0);
     d->textEdit->installEventFilter(this);
 
-    d->highlighter = new FormulaEditorHighlighter(d->textEdit, selection);
+    d->highlighter = new FormulaEditorHighlighter(d->textEdit, d->selection);
 
     d->functionCompletion = new FunctionCompletion(this);
     d->functionCompletionTimer = new QTimer(this);
--- trunk/koffice/kspread/ui/Editors.h #1142956:1142957
@@ -186,12 +186,10 @@
 
     /**
     * Creates a new CellEditor.
-    * @param parent The parent widget.
-    * @param selection The Selection object to associate this cell text editor with
-    * @param captureAllKeyEvents Controls whether or not the text editor swallows \
arrow key events or sends them to the parent canvas instead.  If this is set to true, \
pressing the arrow keys will navigate backwards and forwards through the text in the \
editor.  If it is false, the key events will be sent to the parent canvas which will \
change the cell being edited (depending on the direction of the arrow pressed).  \
Generally this should be set to true if the user double clicks on the cell to edit \
                it, and false if the user initiates editing by typing whilst the cell \
                is selected.
-    * @param _name This parameter is sent to the QObject constructor
+    * \param cellTool the cell tool
+    * \param parent the parent widget
     */
-    explicit CellEditor(QWidget* parent, Selection* selection, bool \
captureAllKeyEvents = false); +    explicit CellEditor(CellToolBase *cellTool, \
QWidget *parent = 0);  ~CellEditor();
 
     const Cell& cell() const;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic