Commit b958ac82 authored by Robert Knight's avatar Robert Knight

Add plumbing for terminal display context menus. Add menu item to hide menu...

Add plumbing for terminal display context menus.  Add menu item to hide menu bar.  Remove unused code.

svn path=/branches/work/konsole-split-view/; revision=643465
parent c2d98d13
......@@ -23,6 +23,8 @@
<Action name="split-view"/>
<Action name="detach-view"/>
<Action name="merge-windows"/>
<Separator/>
<Action name="hide-menubar"/>
</Menu>
<Action name="bookmark"/>
<Menu name="settings"><text>Settings</text>
......
......@@ -31,4 +31,11 @@
<Action name="debug-process"/>
</Menu>!-->
</MenuBar>
<Menu name="session-popup-menu">
<Action name="copy"/>
<Action name="paste"/>
<Action name="clear-history-and-reset"/>
<Separator/>
<Action name="close-session"/>
</Menu>
</kpartgui>
......@@ -27,6 +27,7 @@
#include <KKeyDialog>
#include <KLocale>
#include <KMenu>
#include <KMenuBar>
#include <KService>
#include <KToolInvocation>
#include <kstandardaction.h>
......@@ -102,6 +103,11 @@ void KonsoleMainWindow::setupActions()
_bookmarkHandler = new KonsoleBookmarkHandler( collection , bookmarkMenu->menu() , true );
collection->addAction("bookmark" , bookmarkMenu);
// View Menu
QAction* hideMenuBarAction = collection->addAction("hide-menubar");
hideMenuBarAction->setText( i18n("Hide MenuBar") );
connect( hideMenuBarAction , SIGNAL(triggered()) , menuBar() , SLOT(hide()) );
// Settings Menu
KStandardAction::configureNotifications( 0 , 0 , collection );
KStandardAction::keyBindings( this , SLOT(showShortcutsDialog()) , collection );
......
......@@ -1590,33 +1590,3 @@ void Screen::setLineProperty(LineProperty property , bool enable)
lineProperties[cuY] &= ~property;
}
}
#if 0
ScreenCursor::ScreenCursor()
: _cursor(0)
{
}
void ScreenCursor::setCursor(int line)
{
if ( line > 0 )
_cursor = line;
}
int ScreenCursor::cursor() const
{
return _cursor;
}
bool ScreenCursor::atEnd() const
{
// not implemented yet
assert(0);
}
bool ScreenCursor::operator==(const ScreenCursor& other) const
{
return other.characterursor() == cursor();
}
#endif
......@@ -448,32 +448,6 @@ private: // helper
static Character defaultChar;
};
#if 0
class ScreenCursor
{
friend class Screen;
public:
ScreenCursor();
void setCursor(int line);
int cursor() const;
bool atEnd() const;
bool operator==(const ScreenCursor& other) const;
private:
int _cursor;
int _scrolledLines;
};
inline uint qHash(const ScreenCursor& cursor)
{
return qHash(cursor.characterursor());
}
#endif
};
#endif // TESCREEN_H
......@@ -6,7 +6,7 @@
#include <KRun>
#include <KToggleAction>
#include <KUrl>
#include <KXMLGUIFactory>
#include <kdebug.h>
// Konsole
......@@ -58,6 +58,10 @@ SessionController::SessionController(Session* session , TerminalDisplay* view, Q
connect( _session , SIGNAL(destroyed()) , this , SLOT(deleteLater()) );
connect( _view , SIGNAL(destroyed()) , this , SLOT(deleteLater()) );
// listen for popup menu requests
connect( _view , SIGNAL(configureRequest(TerminalDisplay*,int,int,int)) , this,
SLOT(showDisplayContextMenu(TerminalDisplay*,int,int,int)) );
// listen to activity / silence notifications from session
connect( _session , SIGNAL(notifySessionState(Session*,int)) , this ,
SLOT(sessionStateChanged(Session*,int) ));
......@@ -451,6 +455,16 @@ void SessionController::sessionTitleChanged()
//TODO - use _session->displayTitle() here.
setTitle( _session->title() );
}
void SessionController::showDisplayContextMenu(TerminalDisplay* /*display*/ , int state, int x, int y)
{
QMenu* popup = dynamic_cast<QMenu*>(factory()->container("session-popup-menu",this));
Q_ASSERT( popup );
popup->exec( _view->mapToGlobal(QPoint(x,y)) );
}
void SessionController::sessionStateChanged(Session* /*session*/ , int state)
{
//TODO - Share icons across sessions ( possible using a static QHash<QString,QIcon> variable
......@@ -513,8 +527,8 @@ QList<SessionPtr> SessionTask::sessions() const
return _sessions;
}
SaveHistoryTask::SaveHistoryTask()
: SessionTask()
SaveHistoryTask::SaveHistoryTask(QObject* parent)
: SessionTask(parent)
{
}
SaveHistoryTask::~SaveHistoryTask()
......
......@@ -120,6 +120,7 @@ private slots:
void monitorSilence(bool monitor);
// other
void showDisplayContextMenu(TerminalDisplay* display , int state , int x , int y);
void sessionStateChanged(Session* session,int state);
void sessionTitleChanged();
void searchTextChanged(const QString& text);
......@@ -128,19 +129,20 @@ private slots:
// debugging slots
void debugProcess();
private:
void setupActions();
void removeSearchFilter(); // remove and delete the current search filter if set
private:
Session* _session;
TerminalDisplay* _view;
Session* _session;
TerminalDisplay* _view;
KIcon _sessionIcon;
QString _sessionIconName;
int _previousState;
UrlFilter* _viewUrlFilter;
RegExpFilter* _searchFilter;
UrlFilter* _viewUrlFilter;
RegExpFilter* _searchFilter;
KAction* _searchToggleAction;
......@@ -214,7 +216,7 @@ Q_OBJECT
public:
/** Constructs a new task to save session output to URLs */
SaveHistoryTask();
SaveHistoryTask(QObject* parent = 0);
virtual ~SaveHistoryTask();
/**
......@@ -278,7 +280,7 @@ public:
Backwards
};
SearchHistoryTask(QObject* parent);
SearchHistoryTask(QObject* parent = 0);
/** Sets the regular expression which is searched for when execute() is called */
void setRegExp(const QRegExp& regExp);
......
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