Commit 24b1e02a authored by Robert Knight's avatar Robert Knight

Add hide/show menu bar action to session context menu. Add shortcut (...

Add hide/show menu bar action to session context menu.  Add shortcut ( Ctrl+Shift+F11 ) to full screen mode action.  Update 'Change Profile' sub-menu in session context menu when the list of favorite sessions is changed in the Manage Profiles dialog.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=669221
parent e7f1b790
......@@ -76,6 +76,9 @@ The KDE 4.0 TODO List:
then the operation ( checkout, update, remove etc. )
could be included as well.
== BUGS ==
== NON-ESSENTIAL FEATURES ==
- Automatic switching of profiles on
......
......@@ -34,7 +34,7 @@
<Action name="detach-view"/>
<Action name="merge-windows"/>
<Separator/>
<Action name="hide-menubar"/>
<Action name="show-menubar"/>
<Action name="view-full-screen"/>
</Menu>
<Action name="bookmark"/>
......
......@@ -32,6 +32,7 @@
#include <KMenu>
#include <KMenuBar>
#include <KService>
#include <KToggleAction>
#include <KToggleFullScreenAction>
#include <KToolInvocation>
#include <kstandardaction.h>
......@@ -96,6 +97,7 @@ void MainWindow::activeViewChanged(SessionController* controller)
// set the current session's search bar
controller->setSearchBar( searchBar() );
controller->setShowMenuAction( _toggleMenuBarAction );
// listen for title changes from the current session
if ( _pluggedController )
......@@ -173,12 +175,17 @@ void MainWindow::setupActions()
// default which cannot be overridden
// View Menu
QAction* hideMenuBarAction = collection->addAction("hide-menubar");
hideMenuBarAction->setText( i18n("Hide MenuBar") );
connect( hideMenuBarAction , SIGNAL(triggered()) , menuBar() , SLOT(hide()) );
_toggleMenuBarAction = new KToggleAction(this);
_toggleMenuBarAction->setText( i18n("Show Menu Bar") );
_toggleMenuBarAction->setIcon( KIcon("show-menu") );
_toggleMenuBarAction->setCheckedState( KGuiItem("Hide Menu Bar","show-menu") );
_toggleMenuBarAction->setChecked( !menuBar()->isHidden() );
connect( _toggleMenuBarAction , SIGNAL(toggled(bool)) , menuBar() , SLOT(setVisible(bool)) );
collection->addAction("show-menubar",_toggleMenuBarAction);
KToggleFullScreenAction* fullScreenAction = new KToggleFullScreenAction(this);
fullScreenAction->setWindow(this);
fullScreenAction->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_F11 );
collection->addAction("view-full-screen",fullScreenAction);
connect( fullScreenAction , SIGNAL(toggled(bool)) , this , SLOT(viewFullScreen(bool)) );
//TODO - Implmement this correctly
......
......@@ -26,6 +26,8 @@
// KDE
#include <KXmlGuiWindow>
class KToggleAction;
namespace Konsole
{
......@@ -118,6 +120,8 @@ class MainWindow : public KXmlGuiWindow
ViewManager* _viewManager;
BookmarkHandler* _bookmarkHandler;
IncrementalSearchBar* _searchBar;
KToggleAction* _toggleMenuBarAction;
QPointer<SessionController> _pluggedController;
};
......
......@@ -69,6 +69,7 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
, KXMLGUIClient()
, _session(session)
, _view(view)
, _profileList(0)
, _previousState(-1)
, _viewUrlFilter(0)
, _searchFilter(0)
......@@ -352,6 +353,11 @@ IncrementalSearchBar* SessionController::searchBar() const
return _searchBar;
}
void SessionController::setShowMenuAction(QAction* action)
{
actionCollection()->addAction("show-menubar",action);
}
void SessionController::setupActions()
{
QAction* action = 0;
......@@ -469,11 +475,6 @@ void SessionController::setupActions()
action->setShortcut( QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_X) );
connect( action , SIGNAL(triggered()) , this , SLOT(clearHistoryAndReset()) );
// Menu
action = collection->addAction("show-menubar");
action->setText( i18n("Show Menubar") );
connect( action , SIGNAL(toggled(bool)) , this , SIGNAL(showMenuBarToggle(bool)) );
// Profile Options
action = collection->addAction("edit-current-profile");
action->setText( i18n("Edit Current Profile...") );
......@@ -496,10 +497,13 @@ void SessionController::prepareChangeProfileMenu()
{
if ( _changeProfileMenu->isEmpty() )
{
ProfileList* list = new ProfileList(false,this);
connect( list , SIGNAL(profileSelected(const QString&)) , this , SLOT(changeProfile(const QString&)) );
_changeProfileMenu->addActions(list->actions());
_profileList = new ProfileList(false,this);
connect( _profileList , SIGNAL(profileSelected(const QString&)) ,
this , SLOT(changeProfile(const QString&)) );
}
_changeProfileMenu->clear();
_changeProfileMenu->addActions(_profileList->actions());
}
void SessionController::updateCodecAction()
{
......
......@@ -56,6 +56,7 @@ class Session;
class ScreenWindow;
class TerminalDisplay;
class IncrementalSearchBar;
class ProfileList;
class UrlFilter;
class RegExpFilter;
......@@ -86,9 +87,7 @@ public:
SessionController(Session* session , TerminalDisplay* view, QObject* parent);
~SessionController();
/** Reimplemented to watch for events happening to the view */
virtual bool eventFilter(QObject* watched , QEvent* event);
/** Returns the session associated with this controller */
QPointer<Session> session() { return _session; }
/** Returns the view associated with this controller */
......@@ -104,9 +103,18 @@ public:
*/
IncrementalSearchBar* searchBar() const;
/**
* Sets the action displayed in the session's context menu to hide or
* show the menu bar.
*/
void setShowMenuAction(QAction* action);
// reimplemented
virtual KUrl url() const;
// Reimplemented to watch for events happening to the view
virtual bool eventFilter(QObject* watched , QEvent* event);
signals:
/**
* Emitted when the view associated with the controller is focused.
......@@ -194,6 +202,9 @@ private:
private:
QPointer<Session> _session;
QPointer<TerminalDisplay> _view;
ProfileList* _profileList;
KIcon _sessionIcon;
QString _sessionIconName;
int _previousState;
......
Markdown is supported
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