[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:33:21
Message-ID: 20100626083321.3EA3AAC8DF () svn ! kde ! org
[Download RAW message or body]
SVN commit 1142976 by nikolaus:
Cell Tool: Set the default shortcut of the modify cell action to F2.
- Remove the hard-coded F2 key from CellToolBase and ExternalEditor.
M +11 -8 CellToolBase.cpp
M +0 -12 CellToolBase_p.cpp
M +0 -1 CellToolBase_p.h
M +0 -4 Editors.cpp
--- trunk/koffice/kspread/ui/CellToolBase.cpp #1142975:1142976
@@ -745,7 +745,7 @@
action = new KAction(KIcon("cell_edit"), i18n("Modify Cell"), this);
addAction("editCell", action);
- action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
+ action->setShortcuts(QList<QKeySequence>() << Qt::Key_F2 << QKeySequence(Qt::CTRL + Qt::Key_M));
connect(action, SIGNAL(triggered(bool)), this, SLOT(edit()));
action->setToolTip(i18n("Edit the highlighted cell"));
@@ -1052,10 +1052,6 @@
return;
break;
- case Qt::Key_F2:
- d->processF2Key(event);
- return;
- break;
default:
d->processOtherKey(event);
return;
@@ -2806,11 +2802,18 @@
void CellToolBase::edit()
{
- if (editor())
- return;
-
+ // Not yet in edit mode?
+ if (!editor()) {
createEditor(false /* keep content */);
+ } else {
+ // Switch focus.
+ if (editor()->hasFocus()) {
+ d->optionWidget->editor()->setFocus();
+ } else {
+ editor()->setFocus();
}
+ }
+}
void CellToolBase::cut()
{
--- trunk/koffice/kspread/ui/CellToolBase_p.cpp #1142975:1142976
@@ -462,18 +462,6 @@
event->accept(); // QKeyEvent
}
-void CellToolBase::Private::processF2Key(QKeyEvent* event)
-{
- optionWidget->editor()->setFocus();
- if (q->editor()) {
- // Update the cursor position of the external editor.
- QTextCursor textCursor = optionWidget->editor()->textCursor();
- textCursor.setPosition(q->editor()->cursorPosition());
- optionWidget->editor()->setTextCursor(textCursor);
- }
- event->accept(); // QKeyEvent
-}
-
void CellToolBase::Private::processOtherKey(QKeyEvent *event)
{
register Sheet * const sheet = q->selection()->activeSheet();
--- trunk/koffice/kspread/ui/CellToolBase_p.h #1142975:1142976
@@ -112,7 +112,6 @@
bool processPriorKey(QKeyEvent *event);
bool processNextKey(QKeyEvent *event);
void processDeleteKey(QKeyEvent *event);
- void processF2Key(QKeyEvent *event);
void processOtherKey(QKeyEvent *event);
bool processControlArrowKey(QKeyEvent *event);
bool formatKeyPress(QKeyEvent *event);
--- trunk/koffice/kspread/ui/Editors.cpp #1142975:1142976
@@ -1581,10 +1581,6 @@
event->accept();
return;
}
- if (event->key() == Qt::Key_F2) {
- // Switch the focus back to the embedded editor.
- d->cellTool->editor()->setFocus();
- }
// call inherited handler
KTextEdit::keyPressEvent(event);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic