Commit 58b704a7 authored by Wojciech Kosowicz's avatar Wojciech Kosowicz
Browse files

Added Ctrl+S shortcut for save action in Kexi

Adding Ctrl + S shorcut for save action in kexi required suppresing
default behavior of this shortcut in KTextEditor
BUG: 334587
FIXED-IN: 2.8.4
REVIEW: 118631
parent ac737974
......@@ -421,11 +421,17 @@ KexiWindow* KexiMainWindow::windowForTab(int tabIndex) const
return windowContainer->window;
}
void KexiMainWindow::setupMainMenuActionShortcut(KAction* action, const char* slot)
void KexiMainWindow::setupMainMenuActionShortcut(KAction* action)
{
if (!action->shortcut().isEmpty()) {
(void)new QShortcut(action->shortcut().primary(), this, slot);
(void)new QShortcut(action->shortcut().alternate(), this, slot);
if (!action->shortcut().primary().isEmpty()) {
QShortcut *s = new QShortcut(action->shortcut().primary(), this);
connect(s, SIGNAL(activated()), action, SLOT(trigger()));
}
if (!action->shortcut().alternate().isEmpty()) {
QShortcut *s = new QShortcut(action->shortcut().alternate(), this);
connect(s, SIGNAL(activated()), action, SLOT(trigger()));
}
}
}
......@@ -467,7 +473,7 @@ void KexiMainWindow::setupActions()
action->setWhatsThis(
i18n("Creates a new project. Currently opened project is not affected."));
connect(action, SIGNAL(triggered()), this, SLOT(slotProjectNew()));
setupMainMenuActionShortcut(action, SLOT(slotProjectNew()));
setupMainMenuActionShortcut(action);
ac->addAction("project_open",
action = new KexiMenuWidgetAction(KStandardAction::Open, this));
......@@ -475,7 +481,7 @@ void KexiMainWindow::setupActions()
action->setWhatsThis(
i18n("Opens an existing project. Currently opened project is not affected."));
connect(action, SIGNAL(triggered()), this, SLOT(slotProjectOpen()));
setupMainMenuActionShortcut(action, SLOT(slotProjectOpen()));
setupMainMenuActionShortcut(action);
#ifdef HAVE_KNEWSTUFF
action = addAction("project_download_examples", koIcon("go-down"),
......@@ -491,7 +497,7 @@ void KexiMainWindow::setupActions()
KIcon(), i18n("Welcome"), this));
addThreeDotsToActionText(action);
connect(action, SIGNAL(triggered()), this, SLOT(slotProjectWelcome()));
setupMainMenuActionShortcut(action, SLOT(slotProjectWelcome()));
setupMainMenuActionShortcut(action);
action->setToolTip(i18n("Show Welcome page"));
action->setWhatsThis(
i18n("Shows Welcome page with list of recently opened projects and other information. "));
......@@ -501,6 +507,7 @@ void KexiMainWindow::setupActions()
d->action_save = KStandardAction::save(this, SLOT(slotProjectSave()), this));
d->action_save->setToolTip(i18n("Save object changes"));
d->action_save->setWhatsThis(i18n("Saves object changes from currently selected window."));
setupMainMenuActionShortcut(d->action_save);
d->action_save_as = addAction("project_saveas", koIcon("document-save-as"),
i18n("Save &As..."));
......@@ -515,7 +522,7 @@ void KexiMainWindow::setupActions()
action = d->action_project_properties = new KexiMenuWidgetAction(
koIcon("document-properties"), i18n("Project Properties"), this));
connect(action, SIGNAL(triggered()), this, SLOT(slotProjectProperties()));
setupMainMenuActionShortcut(action, SLOT(slotProjectProperties()));
setupMainMenuActionShortcut(action);
#else
d->action_project_properties = d->dummy_action;
#endif
......@@ -528,7 +535,7 @@ void KexiMainWindow::setupActions()
action->setWhatsThis(
i18n("Imports, exports or sends project."));
connect(action, SIGNAL(triggered()), this, SLOT(slotProjectImportExportOrSend()));
setupMainMenuActionShortcut(action, SLOT(slotProjectImportExportOrSend()));
setupMainMenuActionShortcut(action);
ac->addAction("project_close",
action = d->action_close = new KexiMenuWidgetAction(
......@@ -536,13 +543,13 @@ void KexiMainWindow::setupActions()
action->setToolTip(i18n("Close the current project"));
action->setWhatsThis(i18n("Closes the current project."));
connect(action, SIGNAL(triggered()), this, SLOT(slotProjectClose()));
setupMainMenuActionShortcut(action, SLOT(slotProjectClose()));
setupMainMenuActionShortcut(action);
ac->addAction("quit",
action = new KexiMenuWidgetAction(KStandardAction::Quit, this));
connect(action, SIGNAL(triggered()), this, SLOT(slotProjectQuit()));
action->setWhatsThis(i18n("Quits Kexi application."));
setupMainMenuActionShortcut(action, SLOT(slotProjectQuit()));
setupMainMenuActionShortcut(action);
#ifdef KEXI_SHOW_UNIMPLEMENTED
d->action_project_relations = addAction("project_relations", koIcon("relation"),
......@@ -914,7 +921,7 @@ void KexiMainWindow::setupActions()
action->setToolTip(i18n("Kexi settings"));
action->setWhatsThis(i18n("Lets you to view and change Kexi settings."));
connect(action, SIGNAL(triggered()), this, SLOT(slotSettings()));
setupMainMenuActionShortcut(action, SLOT(slotSettings()));
setupMainMenuActionShortcut(action);
#else
d->action_settings = d->dummy_action;
#endif
......
......@@ -360,7 +360,7 @@ protected:
void setupPropertyEditor();
void setupMainMenuActionShortcut(KAction* action, const char* slot);
void setupMainMenuActionShortcut(KAction* action);
/*! Creates standard actions like new, open, save ... */
void setupActions();
......
......@@ -109,6 +109,8 @@ KexiEditor::KexiEditor(QWidget *parent)
if (!d->doc)
return;
d->view = d->doc->createView(fr);
// suppresing default saving mechanism of KTextEditor
d->view->action("file_save")->setEnabled(false);
// set word wrap by default
KTextEditor::ConfigInterface *configIface
=
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment