summaryrefslogtreecommitdiffstats
path: root/konsole
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 /konsole
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
Diffstat (limited to 'konsole')
-rw-r--r--konsole/konsole/konsole.cpp57
-rw-r--r--konsole/konsole/konsole.h21
2 files changed, 70 insertions, 8 deletions
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;