summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2013-11-16 15:46:35 +0100
committerSlávek Banko <slavek.banko@axis.cz>2013-11-16 15:50:33 +0100
commitc244bac1537175f6219fa778a13acfedeaf8b304 (patch)
tree3a261aa1df6beb374baeec8f8dac23840feb49b9
parent6409e49025dc64eb11490091692d03421c9db1ea (diff)
downloadtdebase-c244bac1537175f6219fa778a13acfedeaf8b304.tar.gz
tdebase-c244bac1537175f6219fa778a13acfedeaf8b304.zip
Add option to enable accelerators in Konsole menu bar
Add default shortcut for show/hide Konsole menu bar This resolves Bug 1701
-rw-r--r--kcontrol/konsole/kcmkonsole.cpp3
-rw-r--r--kcontrol/konsole/kcmkonsoledialog.ui18
-rw-r--r--konsole/konsole/konsole.cpp57
-rw-r--r--konsole/konsole/konsole.h21
4 files changed, 86 insertions, 13 deletions
diff --git a/kcontrol/konsole/kcmkonsole.cpp b/kcontrol/konsole/kcmkonsole.cpp
index 275f06aa2..8c7892083 100644
--- a/kcontrol/konsole/kcmkonsole.cpp
+++ b/kcontrol/konsole/kcmkonsole.cpp
@@ -72,6 +72,7 @@ KCMKonsole::KCMKonsole(TQWidget * parent, const char *name, const TQStringList&)
connect(dialog->line_spacingSB,TQT_SIGNAL(valueChanged(int)), TQT_SLOT( changed() ));
connect(dialog->matchTabWinTitleCB,TQT_SIGNAL(toggled(bool)), TQT_SLOT( changed() ));
connect(dialog->tabsCycleWheel,TQT_SIGNAL(toggled(bool)), TQT_SLOT( changed() ));
+ connect(dialog->menuAccelerators,TQT_SIGNAL(toggled(bool)), TQT_SLOT( changed() ));
connect(dialog->silence_secondsSB,TQT_SIGNAL(valueChanged(int)), TQT_SLOT( changed() ));
connect(dialog->word_connectorLE,TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT( changed() ));
connect(dialog->SchemaEditor1, TQT_SIGNAL(changed()), TQT_SLOT( changed() ));
@@ -97,6 +98,7 @@ void KCMKonsole::load(bool useDefaults)
dialog->bidiCB->setChecked(bidiOrig);
dialog->matchTabWinTitleCB->setChecked(config.readBoolEntry("MatchTabWinTitle",false));
dialog->tabsCycleWheel->setChecked(config.readBoolEntry("TabsCycleWheel",true));
+ dialog->menuAccelerators->setChecked(config.readBoolEntry("MenuAccelerators",false));
dialog->warnCB->setChecked(config.readBoolEntry("WarnQuit",true));
dialog->ctrldragCB->setChecked(config.readBoolEntry("CtrlDrag",true));
dialog->cutToBeginningOfLineCB->setChecked(config.readBoolEntry("CutToBeginningOfLine",false));
@@ -136,6 +138,7 @@ void KCMKonsole::save()
config.writeEntry("EnableBidi", bidiNew);
config.writeEntry("MatchTabWinTitle", dialog->matchTabWinTitleCB->isChecked());
config.writeEntry("TabsCycleWheel", dialog->tabsCycleWheel->isChecked());
+ config.writeEntry("MenuAccelerators", dialog->menuAccelerators->isChecked());
config.writeEntry("WarnQuit", dialog->warnCB->isChecked());
config.writeEntry("CtrlDrag", dialog->ctrldragCB->isChecked());
config.writeEntry("CutToBeginningOfLine", dialog->cutToBeginningOfLineCB->isChecked());
diff --git a/kcontrol/konsole/kcmkonsoledialog.ui b/kcontrol/konsole/kcmkonsoledialog.ui
index b4f698c49..1ce6b2f8f 100644
--- a/kcontrol/konsole/kcmkonsoledialog.ui
+++ b/kcontrol/konsole/kcmkonsoledialog.ui
@@ -178,7 +178,15 @@
<string>Cycle tabs with mouse wheel</string>
</property>
</widget>
- <widget class="KIntNumInput" row="11" column="2">
+ <widget class="TQCheckBox" row="11" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>menuAccelerators</cstring>
+ </property>
+ <property name="text">
+ <string>Enable main menu accelerator keys</string>
+ </property>
+ </widget>
+ <widget class="KIntNumInput" row="12" column="2">
<property name="name">
<cstring>line_spacingSB</cstring>
</property>
@@ -197,7 +205,7 @@
<number>8</number>
</property>
</widget>
- <widget class="TQLabel" row="11" column="0" rowspan="1" colspan="2">
+ <widget class="TQLabel" row="12" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>TextLabel1_4</cstring>
</property>
@@ -216,7 +224,7 @@
<cstring>line_spacingSB</cstring>
</property>
</widget>
- <spacer row="11" column="3">
+ <spacer row="12" column="3">
<property name="name">
<cstring>Spacer2</cstring>
</property>
@@ -233,7 +241,7 @@
</size>
</property>
</spacer>
- <widget class="TQLabel" row="12" column="0">
+ <widget class="TQLabel" row="13" column="0">
<property name="name">
<cstring>SilenceLabel</cstring>
</property>
@@ -252,7 +260,7 @@
<cstring>silence_secondsSB</cstring>
</property>
</widget>
- <widget class="KIntNumInput" row="12" column="1" rowspan="1" colspan="2">
+ <widget class="KIntNumInput" row="13" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>silence_secondsSB</cstring>
</property>
diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp
index 9f694ca72..ef3079654 100644
--- a/konsole/konsole/konsole.cpp
+++ b/konsole/konsole/konsole.cpp
@@ -212,6 +212,18 @@ Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bo
,kWinModule(0)
,menubar(0)
,statusbar(0)
+,m_session_string(i18n("&Session"))
+,m_edit_string(i18n("&Edit"))
+,m_view_string(i18n("&View"))
+,m_bookmarks_string(i18n("&Bookmarks"))
+,m_options_string(i18n("Se&ttings"))
+,m_help_string(i18n("&Help"))
+,m_session_id(-1)
+,m_edit_id(-1)
+,m_view_id(-1)
+,m_bookmarks_id(-1)
+,m_options_id(-1)
+,m_help_id(-1)
,m_session(0)
,m_edit(0)
,m_view(0)
@@ -321,6 +333,7 @@ Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bo
readProperties(config, schema, false);
makeBasicGUI();
+ setMenuAcceleratos();
if (isRestored) {
n_tabbar = wanted_tabbar;
@@ -1074,15 +1087,15 @@ void Konsole::makeBasicGUI()
if (m_bookmarksSession)
connect(m_bookmarksSession,TQT_SIGNAL(aboutToShow()),this,TQT_SLOT(makeGUI()));
- menubar->insertItem(i18n("Session") , m_session);
- menubar->insertItem(i18n("Edit"), m_edit);
- menubar->insertItem(i18n("View"), m_view);
+ m_session_id=menubar->insertItem(m_session_string , m_session);
+ m_edit_id=menubar->insertItem(m_edit_string, m_edit);
+ m_view_id=menubar->insertItem(m_view_string, m_view);
if (m_bookmarks)
- menubar->insertItem(i18n("Bookmarks"), m_bookmarks);
+ m_bookmarks_id=menubar->insertItem(m_bookmarks_string, m_bookmarks);
if (m_options)
- menubar->insertItem(i18n("Settings"), m_options);
+ m_options_id=menubar->insertItem(m_options_string, m_options);
if (m_help)
- menubar->insertItem(i18n("Help"), m_help);
+ m_help_id=menubar->insertItem(m_help_string, m_help);
m_shortcuts = new TDEActionCollection(this);
@@ -1149,7 +1162,7 @@ void Konsole::makeBasicGUI()
masterMode = new TDEToggleAction ( i18n( "Send &Input to All Sessions" ), "remote", 0, TQT_TQOBJECT(this),
TQT_SLOT( slotToggleMasterMode() ), m_shortcuts, "send_input_to_all_sessions" );
- showMenubar = new TDEToggleAction ( i18n( "Show &Menubar" ), "showmenu", 0, TQT_TQOBJECT(this),
+ showMenubar = new TDEToggleAction ( i18n( "Show &Menubar" ), "showmenu", Qt::CTRL+Qt::SHIFT+Qt::ALT+Qt::Key_M, TQT_TQOBJECT(this),
TQT_SLOT( slotToggleMenubar() ), m_shortcuts, "show_menubar" );
showMenubar->setCheckedState( KGuiItem( i18n("Hide &Menubar"), "showmenu", TQString::null, TQString::null ) );
@@ -1628,6 +1641,7 @@ void Konsole::readProperties(TDEConfig* config, const TQString &schema, bool glo
b_xonXoff = config->readBoolEntry("XonXoff",false);
b_matchTabWinTitle = config->readBoolEntry("MatchTabWinTitle",false);
b_mouseWheelScroll = config->readBoolEntry("TabsCycleWheel",true);
+ b_menuAccelerators = config->readBoolEntry("MenuAccelerators",false);
config->setGroup("UTMP");
b_addToUtmp = config->readBoolEntry("AddToUtmp",true);
config->setDesktopGroup();
@@ -2183,6 +2197,7 @@ void Konsole::reparseConfiguration()
}
tabwidget->setMouseWheelScroll(b_mouseWheelScroll);
+ setMenuAcceleratos();
}
// Called via emulation via session
@@ -4427,4 +4442,32 @@ TQPtrList<TEWidget> Konsole::activeTEs()
return ret;
}
+void Konsole::setMenuAcceleratos()
+{
+ if (b_menuAccelerators)
+ {
+ menubar->changeItem(m_session_id, m_session_string);
+ menubar->changeItem(m_edit_id, m_edit_string);
+ menubar->changeItem(m_view_id, m_view_string);
+ if (m_bookmarks)
+ menubar->changeItem(m_bookmarks_id, m_bookmarks_string);
+ if (m_options)
+ menubar->changeItem(m_options_id, m_options_string);
+ if (m_help)
+ menubar->changeItem(m_help_id, m_help_string);
+ }
+ else
+ {
+ menubar->changeItem(m_session_id, TQString(m_session_string).replace(TQRegExp("&([^&])"), "\\1"));
+ menubar->changeItem(m_edit_id, TQString(m_edit_string).replace(TQRegExp("&([^&])"), "\\1"));
+ menubar->changeItem(m_view_id, TQString(m_view_string).replace(TQRegExp("&([^&])"), "\\1"));
+ if (m_bookmarks)
+ menubar->changeItem(m_bookmarks_id, TQString(m_bookmarks_string).replace(TQRegExp("&([^&])"), "\\1"));
+ if (m_options)
+ menubar->changeItem(m_options_id, TQString(m_options_string).replace(TQRegExp("&([^&])"), "\\1"));
+ if (m_help)
+ menubar->changeItem(m_help_id, TQString(m_help_string).replace(TQRegExp("&([^&])"), "\\1"));
+ }
+}
+
#include "konsole.moc"
diff --git a/konsole/konsole/konsole.h b/konsole/konsole/konsole.h
index 7edbf64c0..6bd3a2e81 100644
--- a/konsole/konsole/konsole.h
+++ b/konsole/konsole/konsole.h
@@ -297,6 +297,8 @@ private:
bool eventFilter( TQObject *o, TQEvent *e );
+ void setMenuAcceleratos();
+
TQPtrList<TEWidget> activeTEs();
TQPtrDict<TESession> action2session;
@@ -322,6 +324,22 @@ private:
KMenuBar* menubar;
KStatusBar* statusbar;
+ // Text strings for main menu entries
+ TQString m_session_string;
+ TQString m_edit_string;
+ TQString m_view_string;
+ TQString m_bookmarks_string;
+ TQString m_options_string;
+ TQString m_help_string;
+
+ // Main menu entry ids
+ int m_session_id;
+ int m_edit_id;
+ int m_view_id;
+ int m_bookmarks_id;
+ int m_options_id;
+ int m_help_id;
+
TDEPopupMenu* m_session;
TDEPopupMenu* m_edit;
TDEPopupMenu* m_view;
@@ -338,6 +356,7 @@ private:
TDEPopupMenu* m_tabPopupMenu;
TDEPopupMenu* m_tabPopupTabsMenu;
TDEPopupMenu* m_tabbarPopupMenu;
+ TDEPopupMenu* m_openSelection;
TDEAction *m_zmodemUpload;
TDEToggleAction *monitorActivity, *m_tabMonitorActivity;
@@ -373,7 +392,6 @@ private:
TDEAction *m_closeSession;
TDEAction *m_print;
TDEAction *m_quit;
- TDEPopupMenu *m_openSelection;
TDEActionCollection *m_shortcuts;
@@ -434,6 +452,7 @@ private:
bool b_sessionShortcutsMapped:1;
bool b_matchTabWinTitle:1;
bool b_mouseWheelScroll:1;
+ bool b_menuAccelerators:1;
unsigned int m_histSize;
int m_separator_id;