Commit 0e1cfb1b 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 dd100fec
......@@ -402,11 +402,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()));
}
}
}
......@@ -456,7 +462,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));
......@@ -464,7 +470,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"),
......@@ -480,7 +486,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. "));
......@@ -490,6 +496,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..."));
......@@ -504,7 +511,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
......@@ -521,7 +528,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(
......@@ -529,13 +536,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"),
......@@ -937,7 +944,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
......
......@@ -402,7 +402,7 @@ protected:
void setupPropertyEditor();
void setupMainMenuActionShortcut(KAction* action, const char* slot);
void setupMainMenuActionShortcut(KAction* action);
/*! Creates standard actions like new, open, save ... */
void setupActions();
......
......@@ -110,6 +110,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