[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:32:54
Message-ID: 20100626083254.23DAAAC8E0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1142975 by nikolaus:

Improve the permutation of the reference fixation action.
    
    - Convert to an action, so the shortcut is configurable.



 M  +11 -6     CellToolBase.cpp  
 M  +0 -13     CellToolBase_p.cpp  
 M  +0 -1      CellToolBase_p.h  
 M  +5 -7      Editors.cpp  


--- trunk/koffice/kspread/ui/CellToolBase.cpp #1142974:1142975
@@ -833,6 +833,15 @@
     connect(action, SIGNAL(triggered(bool)), this, SLOT(breakBeforeRow(bool)));
     action->setIconText(i18n("Row Break"));
     action->setToolTip(i18n("Set a manual page break before the row"));
+
+    // Editor actions:
+    // Set up the permutation of the reference fixations action.
+    action = new KAction(i18n("Permute reference fixation"), this);
+    addAction("permuteFixation", action);
+    action->setShortcut(Qt::Key_F4);
+    // connect on creation of the embedded editor
+    action->setIconText(i18n("Permute fixation"));
+    action->setToolTip(i18n("Permute the fixation of the reference at the text cursor"));
 }
 
 CellToolBase::~CellToolBase()
@@ -1047,12 +1056,6 @@
         d->processF2Key(event);
         return;
         break;
-
-    case Qt::Key_F4:
-        d->processF4Key(event);
-        return;
-        break;
-
     default:
         d->processOtherKey(event);
         return;
@@ -1330,6 +1333,8 @@
     if (!editor()) {
         d->cellEditor = new CellEditor(this, canvas()->canvasWidget());
         d->cellEditor->setEditorFont(cell.style().font(), true, canvas()->viewConverter());
+        connect(action("permuteFixation"), SIGNAL(triggered(bool)),
+                d->cellEditor, SLOT(permuteFixation()));
         connect(d->cellEditor, SIGNAL(textChanged(const QString &)),
                 d->optionWidget->editor(), SLOT(setText(const QString &)));
         connect(d->optionWidget->editor(), SIGNAL(textChanged(const QString &)),
--- trunk/koffice/kspread/ui/CellToolBase_p.cpp #1142974:1142975
@@ -474,19 +474,6 @@
     event->accept(); // QKeyEvent
 }
 
-void CellToolBase::Private::processF4Key(QKeyEvent* event)
-{
-    /* passes F4 to the editor (if any), which will process it
-    */
-    if (q->editor()) {
-        QApplication::sendEvent(q->editor(), event);
-        // Update the cursor position of the external editor.
-        QTextCursor textCursor = optionWidget->editor()->textCursor();
-        textCursor.setPosition(q->editor()->cursorPosition());
-        optionWidget->editor()->setTextCursor(textCursor);
-    }
-}
-
 void CellToolBase::Private::processOtherKey(QKeyEvent *event)
 {
     register Sheet * const sheet = q->selection()->activeSheet();
--- trunk/koffice/kspread/ui/CellToolBase_p.h #1142974:1142975
@@ -113,7 +113,6 @@
     bool processNextKey(QKeyEvent *event);
     void processDeleteKey(QKeyEvent *event);
     void processF2Key(QKeyEvent *event);
-    void processF4Key(QKeyEvent *event);
     void processOtherKey(QKeyEvent *event);
     bool processControlArrowKey(QKeyEvent *event);
     bool formatKeyPress(QKeyEvent *event);
--- trunk/koffice/kspread/ui/Editors.cpp #1142974:1142975
@@ -1057,13 +1057,6 @@
 void CellEditor::keyPressEvent(QKeyEvent *event)
 {
     switch (event->key()) {
-        case Qt::Key_F4:
-            if (!d->selection->referenceSelection()) {
-                return; // do NOT pass to KTextEdit
-            }
-            permuteFixation();
-            event->accept();
-            return;
         case Qt::Key_Left:
         case Qt::Key_Right:
         case Qt::Key_Up:
@@ -1168,6 +1161,11 @@
 
 void CellEditor::permuteFixation()
 {
+    // Nothing to do, if not in reference selection mode.
+    if (!d->selection->referenceSelection()) {
+        return;
+    }
+
     // Search for the last range before or the range at the cursor.
     int index = -1;
     const int cursorPosition = textCursor().position() - 1; // - '='
[prev in list] [next in list] [prev in thread] [next in thread] 

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