From 576d1c39712d993f9e266459b9b7689320f19376 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Tue, 2 Jan 2007 07:48:02 +0000 Subject: [PATCH] * Moved session action layout into a separate XML file. I'm still a bit new to this XMLGUI thingie. * Call 'close()' rather than 'deleteLater()' on main window when last session is closed, makes Konsole app close when last session finishes. * Added ViewProperties class from which SessionController inherits. The ViewContainer has a ViewProperties instance associated with each view, which it uses to determine the title and icon associated with that view. Icons and session titles now show in the tabs. * Added "Monitor for Activity" and "Monitor for Silence" in the new front-end. * Set value of TERM variable before creating session in SessionManager, fixes lots of problems with Linux Console session type. * Add a few CMakeLists.txt files from the new other/ directories to SVN which I forgot in the previous commit. svn path=/branches/work/konsole-split-view/; revision=618811 --- desktop/CMakeLists.txt | 2 +- desktop/konsoleui.rc | 21 ++--- desktop/sessionui.rc | 28 ++++++ developer-doc/kde4/historic/README | 2 + .../kde4/{ => historic}/split-screen-design | 0 konsole/CMakeLists.txt | 1 + konsole/KonsoleApp.cpp | 4 - konsole/KonsoleMainWindow.cpp | 4 +- konsole/SessionController.cpp | 85 ++++++++++++++++++- konsole/SessionController.h | 41 ++++----- konsole/SessionManager.cpp | 7 +- konsole/TESession.cpp | 53 ++---------- konsole/TESession.h | 53 ++++++------ konsole/ViewContainer.cpp | 30 ++++--- konsole/ViewContainer.h | 17 ++-- konsole/ViewManager.cpp | 29 +++++-- konsole/ViewManager.h | 2 +- konsole/ViewProperties.cpp | 44 ++++++++++ konsole/ViewProperties.h | 67 +++++++++++++++ konsole/ViewSplitter.cpp | 5 +- konsole/ViewSplitter.h | 5 ++ other/color-schemes/CMakeLists.txt | 23 +++++ other/keyboard-layouts/CMakeLists.txt | 10 +++ other/sessions/CMakeLists.txt | 10 +++ 24 files changed, 384 insertions(+), 159 deletions(-) create mode 100644 desktop/sessionui.rc create mode 100644 developer-doc/kde4/historic/README rename developer-doc/kde4/{ => historic}/split-screen-design (100%) create mode 100644 konsole/ViewProperties.cpp create mode 100644 konsole/ViewProperties.h create mode 100644 other/color-schemes/CMakeLists.txt create mode 100644 other/keyboard-layouts/CMakeLists.txt create mode 100644 other/sessions/CMakeLists.txt diff --git a/desktop/CMakeLists.txt b/desktop/CMakeLists.txt index 629a3e3f..d9c748e9 100644 --- a/desktop/CMakeLists.txt +++ b/desktop/CMakeLists.txt @@ -7,4 +7,4 @@ install( FILES terminalemulator.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR install( FILES konsolepart.desktop kwrited.desktop konsole-script.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES konsolehere.desktop DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus ) install( FILES kwrited.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) -install( FILES konsole.notifyrc tips konsoleui.rc DESTINATION ${DATA_INSTALL_DIR}/konsole ) +install( FILES konsole.notifyrc tips konsoleui.rc sessionui.rc DESTINATION ${DATA_INSTALL_DIR}/konsole ) diff --git a/desktop/konsoleui.rc b/desktop/konsoleui.rc index fb5ef02e..f6a354a1 100644 --- a/desktop/konsoleui.rc +++ b/desktop/konsoleui.rc @@ -8,29 +8,17 @@ - + Edit - - - - - - - + History - - - - - - + View - - + @@ -49,3 +37,4 @@ + diff --git a/desktop/sessionui.rc b/desktop/sessionui.rc new file mode 100644 index 00000000..f535c936 --- /dev/null +++ b/desktop/sessionui.rc @@ -0,0 +1,28 @@ + + + + + File + + + Edit + + + + + + + History + + + + + + + + View + + + + + diff --git a/developer-doc/kde4/historic/README b/developer-doc/kde4/historic/README new file mode 100644 index 00000000..9d2603ea --- /dev/null +++ b/developer-doc/kde4/historic/README @@ -0,0 +1,2 @@ + +This folder contains historic documentation for Konsole for KDE 4. Historic documentation may provide interesting ideas or background information but is no longer consistent with the actual code or future plans. diff --git a/developer-doc/kde4/split-screen-design b/developer-doc/kde4/historic/split-screen-design similarity index 100% rename from developer-doc/kde4/split-screen-design rename to developer-doc/kde4/historic/split-screen-design diff --git a/konsole/CMakeLists.txt b/konsole/CMakeLists.txt index 7508cc5e..5c8ea4f2 100644 --- a/konsole/CMakeLists.txt +++ b/konsole/CMakeLists.txt @@ -65,6 +65,7 @@ set(konsole_KDEINIT_SRCS TEWidget.cpp ViewContainer.cpp ViewManager.cpp + ViewProperties.cpp ViewSplitter.cpp KonsoleBookmarkHandler.cpp ZModemDialog.cpp diff --git a/konsole/KonsoleApp.cpp b/konsole/KonsoleApp.cpp index da93a3a1..7e12e95d 100644 --- a/konsole/KonsoleApp.cpp +++ b/konsole/KonsoleApp.cpp @@ -87,10 +87,6 @@ void KonsoleApp::createSession(const QString& key , ViewManager* view) { TESession* session = _sessionManager->createSession(key); session->setConnect(true); - - //temporary - test history feature - //session->setHistory( HistoryTypeBuffer(1000) ); - session->run(); view->createView(session); } diff --git a/konsole/KonsoleMainWindow.cpp b/konsole/KonsoleMainWindow.cpp index eed0944c..9b6c64a6 100644 --- a/konsole/KonsoleMainWindow.cpp +++ b/konsole/KonsoleMainWindow.cpp @@ -46,11 +46,11 @@ KonsoleMainWindow::KonsoleMainWindow() setupActions(); // create view manager + setXMLFile("konsoleui.rc"); _viewManager = new ViewManager(this); - connect( _viewManager , SIGNAL(empty()) , this , SLOT(deleteLater()) ); + connect( _viewManager , SIGNAL(empty()) , this , SLOT(close()) ); // create menus - setXMLFile("konsoleui.rc"); createGUI(); } diff --git a/konsole/SessionController.cpp b/konsole/SessionController.cpp index d908b935..38335ae3 100644 --- a/konsole/SessionController.cpp +++ b/konsole/SessionController.cpp @@ -1,7 +1,9 @@ // KDE #include +#include #include +#include #include // Konsole @@ -9,16 +11,29 @@ #include "TEWidget.h" #include "SessionController.h" +KIcon SessionController::_activityIcon; +KIcon SessionController::_silenceIcon; + SessionController::SessionController(TESession* session , TEWidget* view, QObject* parent) - : QObject(parent) - /*ViewProperties(parent) */ + : ViewProperties(parent) , KXMLGUIClient() , _session(session) , _view(view) + , _previousState(-1) { + setXMLFile("sessionui.rc"); setupActions(); + sessionTitleChanged(); + view->installEventFilter(this); + + // listen to activity / silence notifications from session + connect( _session , SIGNAL(notifySessionState(TESession*,int)) , this , + SLOT(sessionStateChanged(TESession*,int) )); + + // list to title and icon changes + connect( _session , SIGNAL(updateTitle()) , this , SLOT(sessionTitleChanged()) ); } bool SessionController::eventFilter(QObject* watched , QEvent* event) @@ -39,8 +54,6 @@ void SessionController::setupActions() KAction* action = 0; KActionCollection* collection = actionCollection(); - setXMLFile("konsoleui.rc"); - // Close Session action = new KAction( KIcon("fileclose"), i18n("&Close Tab") , collection , "close-session" ); connect( action , SIGNAL(triggered()) , this , SLOT(closeSession()) ); @@ -59,6 +72,12 @@ void SessionController::setupActions() action = new KAction( i18n("Clear and Reset") , collection , "clear-and-reset" ); connect( action , SIGNAL(triggered()) , this , SLOT(clearAndReset()) ); + // Monitor + action = new KToggleAction( i18n("Monitor for &Activity") , collection , "monitor-activity" ); + connect( action , SIGNAL(toggled(bool)) , this , SLOT(monitorActivity(bool)) ); + + action = new KToggleAction( i18n("Monitor for &Silence") , collection , "monitor-silence" ); + connect( action , SIGNAL(toggled(bool)) , this , SLOT(monitorSilence(bool)) ); // History action = new KAction( KIcon("find") , i18n("Search History") , collection , "search-history" ); @@ -122,5 +141,63 @@ void SessionController::clearHistory() { _session->clearHistory(); } +void SessionController::monitorActivity(bool monitor) +{ + _session->setMonitorActivity(monitor); +} +void SessionController::monitorSilence(bool monitor) +{ + _session->setMonitorSilence(monitor); +} +void SessionController::sessionTitleChanged() +{ + if ( _sessionIconName != _session->iconName() ) + { + _sessionIconName = _session->iconName(); + _sessionIcon = KIcon( _sessionIconName ); + setIcon( _sessionIcon ); + } + + setTitle( _session->displayTitle() ); +} +void SessionController::sessionStateChanged(TESession* /*session*/ , int state) +{ + //TODO - Share icons across sessions ( possible using a static QHash variable + // to create a cache of icons mapped from icon names? ) + + if ( state == _previousState ) + return; + + _previousState = state; + + if ( state == NOTIFYACTIVITY ) + { + if (_activityIcon.isNull()) + { + _activityIcon = KIcon("activity"); + } + + setIcon(_activityIcon); + } + else if ( state == NOTIFYSILENCE ) + { + if (_silenceIcon.isNull()) + { + _silenceIcon = KIcon("silence"); + } + + setIcon(_silenceIcon); + } + else if ( state == NOTIFYNORMAL ) + { + if ( _sessionIconName != _session->iconName() ) + { + _sessionIconName = _session->iconName(); + _sessionIcon = KIcon( _sessionIconName ); + } + + setIcon( _sessionIcon ); + } +} #include "SessionController.moc" diff --git a/konsole/SessionController.h b/konsole/SessionController.h index 33bad6c3..f66f178a 100644 --- a/konsole/SessionController.h +++ b/konsole/SessionController.h @@ -10,43 +10,21 @@ #include #include +// Konsole +#include "ViewProperties.h" + class QAction; class TESession; class TEWidget; -/** - * Provides information (such as the title and icon) associated with - */ -/*class ViewProperties : public QObject -{ - -public: - ViewProperties(QObject* parent) : QObject(parent) {} - - QIcon icon(); - QString title(); - -signals: - void iconChanged(const QIcon& icon); - void titleChanged(const QString& title); - -protected: - void setTitle(const QString& title); - void setIcon(const QIcon& icon); - -private: - QIcon _icon; - QString _title; -};*/ - /** * Provides the actions associated with a session in the Konsole main menu * and exposes information such as the title and icon associated with the session to view containers. * * Each view should have one SessionController associated with it */ -class SessionController : /*public ViewProperties ,*/ public QObject , public KXMLGUIClient +class SessionController : public ViewProperties , public KXMLGUIClient { Q_OBJECT @@ -81,6 +59,11 @@ private slots: void saveHistory(); void clearHistory(); void closeSession(); + void monitorActivity(bool monitor); + void monitorSilence(bool monitor); + + void sessionStateChanged(TESession* session,int state); + void sessionTitleChanged(); private: void setupActions(); @@ -88,6 +71,12 @@ private: private: TESession* _session; TEWidget* _view; + KIcon _sessionIcon; + QString _sessionIconName; + int _previousState; + + static KIcon _activityIcon; + static KIcon _silenceIcon; }; #endif //SESSIONCONTROLLER_H diff --git a/konsole/SessionManager.cpp b/konsole/SessionManager.cpp index d20ba7a4..fe4dc06a 100644 --- a/konsole/SessionManager.cpp +++ b/konsole/SessionManager.cpp @@ -249,13 +249,14 @@ TESession* SessionManager::createSession(QString configPath ) while (iter.hasNext()) kDebug() << "running " << info->command(false) << ": argument " << iter.next() << endl; - session->setWorkingDirectory( activeSetting(InitialWorkingDirectory).toString() ); + session->setInitialWorkingDirectory( activeSetting(InitialWorkingDirectory).toString() ); session->setProgram( info->command(false) ); session->setArguments( info->arguments() ); session->setTitle( info->name() ); session->setIconName( info->icon() ); session->setSchema( _colorSchemeList->find(activeSetting(ColorScheme).toString()) ); - + session->setTerminalType( info->terminal() ); + //temporary session->setHistory( HistoryTypeBuffer(1000) ); @@ -276,8 +277,6 @@ TESession* SessionManager::createSession(QString configPath ) void SessionManager::sessionTerminated(TESession* session) { -// kDebug() << __FILE__ << ": session finished " << endl; - _sessions.remove(session); } diff --git a/konsole/TESession.cpp b/konsole/TESession.cpp index 67cf8f3b..2b2a538b 100644 --- a/konsole/TESession.cpp +++ b/konsole/TESession.cpp @@ -73,7 +73,6 @@ TESession::TESession() : , zmodemProc(0) , zmodemProgress(0) , encoding_no(0) - , _navigationItem(0) , _colorScheme(0) { //prepare DBus communication @@ -215,17 +214,6 @@ TEWidget* TESession::primaryView() return 0; } -NavigationItem* TESession::navigationItem() -{ - /*if (!_navigationItem) - { - _navigationItem = new SessionNavigationItem(this); - } - return _navigationItem;*/ - assert(0); - return 0; -} - void TESession::addView(TEWidget* widget) { Q_ASSERT( !_views.contains(widget) ); @@ -462,14 +450,6 @@ QString TESession::displayTitle() const return title(); } -/*QString TESession::fullTitle() const -{ - QString res = _title; - if ( !_userTitle.isEmpty() ) - res = _userTitle + " - " + res; - return res; -}*/ - void TESession::monitorTimerDone() { //FIXME: The idea here is that the notification popup will appear to tell the user than output from @@ -525,7 +505,7 @@ void TESession::notifySessionState(int state) emit notifySessionState(this, state); } -void TESession::onContentSizeChange(int height, int width) +void TESession::onContentSizeChange(int /*height*/, int /*width*/) { updateTerminalSize(); } @@ -670,11 +650,6 @@ TEmulation* TESession::getEmulation() // following interfaces might be misplaced /// -//int TESession::schemaNo() -//{ -// return schema_no; -//} - int TESession::encodingNo() { return encoding_no; @@ -695,20 +670,20 @@ int TESession::fontNo() return _fontNo; } -const QString & TESession::Term() const +const QString& TESession::terminalType() const { return term; } -const QString & TESession::SessionId() const +void TESession::setTerminalType(const QString& terminalType) { - return sessionId; + term = terminalType; } -/*void TESession::setSchemaNo(int sn) +const QString & TESession::SessionId() const { - schema_no = sn; -}*/ + return sessionId; +} void TESession::setEncodingNo(int index) { @@ -804,7 +779,7 @@ QString TESession::getPgm() return _program; } -QString TESession::getCwd() +QString TESession::currentWorkingDirectory() { #ifdef HAVE_PROC_CWD if (cwd.isEmpty()) { @@ -1021,18 +996,6 @@ ColorSchema* TESession::schema() return _colorScheme; } -/*QString TESession::schema() -{ - QString currentSchema; - emit getSessionSchema(this, currentSchema); - return currentSchema; -}*/ - -//void TESession::setSchema(const QString &schema) -//{ -// emit setSessionSchema(this, schema); -//} - void TESession::setSchema(ColorSchema* schema) { _colorScheme = schema; diff --git a/konsole/TESession.h b/konsole/TESession.h index 95145768..92e9bf64 100644 --- a/konsole/TESession.h +++ b/konsole/TESession.h @@ -40,7 +40,6 @@ class KProcess; class ZModemDialog; class ColorSchema; -class NavigationItem; /** * TESession represents a Konsole session. @@ -105,16 +104,6 @@ public: */ TEWidget* primaryView(); - /** - * Returns the navigation item for this session. - * The navigation item provides information about the session such as associated title and icon - * for use by widgets which allow the user to select between views belonging to different sessions. - * - * The navigation item also provides actions which can be placed in a menu - * to allow the user to control various aspects of the session. - */ - NavigationItem* navigationItem(); - /** * Returns true if the session has created child processes which have not yet terminated * This call may be expensive if there are a large number of processes running. @@ -131,7 +120,21 @@ public: int schemaNo(); int encodingNo(); int fontNo(); - const QString& Term() const; + + /** + * Returns the value of the TERM environment variable which will be used in the session's + * environment when it is started using the run() method. + * Defaults to "xterm". + */ + const QString& terminalType() const; + /** + * Sets the value of the TERM variable which will be used in the session's environment + * when it is started using the run() method. Changing this once the session has been + * started using run() has no effect + * Defaults to "xterm" if not set explicitly + */ + void setTerminalType(const QString& terminalType); + const QString& SessionId() const; const QString& title() const; const QString& iconName() const; @@ -161,18 +164,15 @@ public: void setProgram(const QString& program); /** Returns the session's current working directory. */ - QString getCwd(); - QString getInitial_cwd() { return initial_cwd; } + QString currentWorkingDirectory(); + QString initialWorkingDirectory() { return initial_cwd; } /** * Sets the initial working directory for the session when it is run * This has no effect once the session has been started. */ - void setWorkingDirectory( const QString& dir ) { initial_cwd = dir; } - //void setInitial_cwd(const QString& _cwd) { initial_cwd=_cwd; } - - - + void setInitialWorkingDirectory( const QString& dir ) { initial_cwd = dir; } + void setHistory(const HistoryType&); const HistoryType& history(); @@ -180,11 +180,15 @@ public: void setMonitorSilence(bool); void setMonitorSilenceSeconds(int seconds); void setMasterMode(bool); -// void setSchemaNo(int sn); - void setEncodingNo(int index); - void setKeymapNo(int kn); + + //TODO - Remove these functions which use indicies to reference keyboard layouts, + // encodings etc. and replace them either with methods that uses pointers or references + // to the font object / keyboard layout object etc. or a QString key + void setEncodingNo(int index); + void setKeymapNo(int kn); + void setFontNo(int fn); + void setKeymap(const QString& _id); - void setFontNo(int fn); void setTitle(const QString& _title); void setIconName(const QString& _iconName); void setIconText(const QString& _iconText); @@ -196,7 +200,6 @@ public: void setAutoClose(bool b) { autoClose = b; } void renameSession(const QString &name); - // Additional functions for DCOP bool closeSession(); void clearHistory(); void feedSession(const QString &text); @@ -331,8 +334,6 @@ private: QColor modifiedBackground; // as set by: echo -en '\033]11;Color\007 int encoding_no; - NavigationItem* _navigationItem; - ColorSchema* _colorScheme; static int lastSessionId; diff --git a/konsole/ViewContainer.cpp b/konsole/ViewContainer.cpp index d8b0b679..84c35b69 100644 --- a/konsole/ViewContainer.cpp +++ b/konsole/ViewContainer.cpp @@ -1,7 +1,7 @@ /* This file is part of the Konsole Terminal. - Copyright (C) 2006 Robert Knight + Copyright (C) 2006-2007 Robert Knight This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,10 +36,12 @@ // Konsole #include "ViewContainer.h" +#include "ViewProperties.h" -void ViewContainer::addView(QWidget* view) //, NavigationItem* item) +void ViewContainer::addView(QWidget* view , ViewProperties* item) { _views << view; + _navigation[view] = item; connect( view , SIGNAL(destroyed(QObject*)) , this , SLOT( viewDestroyed(QObject*) ) ); @@ -71,14 +73,14 @@ const QList ViewContainer::views() return _views; } -NavigationItem* ViewContainer::navigationItem( QWidget* widget ) +ViewProperties* ViewContainer::viewProperties( QWidget* widget ) { Q_ASSERT( _navigation.contains(widget) ); return _navigation[widget]; } -QList ViewContainer::widgetsForItem(NavigationItem* item) const +QList ViewContainer::widgetsForItem(ViewProperties* item) const { return _navigation.keys(item); } @@ -177,10 +179,10 @@ void TabbedViewContainer::prepareColorCells() void TabbedViewContainer::viewAdded( QWidget* view ) { - // NavigationItem* item = navigationItem(view); - // connect( item , SIGNAL(titleChanged(NavigationItem*)) , this , SLOT(updateTitle(NavigationItem*))); - // connect( item , SIGNAL(iconChanged(NavigationItem*) ) , this ,SLOT(updateIcon(NavigationItem*))); - _tabWidget->addTab( view , "Tab" ); //, item->icon() , item->title() ); + ViewProperties* item = viewProperties(view); + connect( item , SIGNAL(titleChanged(ViewProperties*)) , this , SLOT(updateTitle(ViewProperties*))); + connect( item , SIGNAL(iconChanged(ViewProperties*) ) , this ,SLOT(updateIcon(ViewProperties*))); + _tabWidget->addTab( view , item->icon() , item->title() ); } void TabbedViewContainer::viewRemoved( QWidget* view ) { @@ -189,7 +191,7 @@ void TabbedViewContainer::viewRemoved( QWidget* view ) _tabWidget->removeTab( _tabWidget->indexOf(view) ); } -void TabbedViewContainer::updateIcon(NavigationItem* item) +void TabbedViewContainer::updateIcon(ViewProperties* item) { kDebug() << __FUNCTION__ << ": icon changed." << endl; @@ -198,11 +200,11 @@ void TabbedViewContainer::updateIcon(NavigationItem* item) while ( itemIter.hasNext() ) { - //int index = _tabWidget->indexOf( itemIter.next() ); - // _tabWidget->setTabIcon( index , item->icon() ); + int index = _tabWidget->indexOf( itemIter.next() ); + _tabWidget->setTabIcon( index , item->icon() ); } } -void TabbedViewContainer::updateTitle(NavigationItem* item) +void TabbedViewContainer::updateTitle(ViewProperties* item) { kDebug() << __FUNCTION__ << ": title changed." << endl; @@ -211,8 +213,8 @@ void TabbedViewContainer::updateTitle(NavigationItem* item) while ( itemIter.hasNext() ) { - //int index = _tabWidget->indexOf( itemIter.next() ); - //_tabWidget->setTabText( index , item->title() ); + int index = _tabWidget->indexOf( itemIter.next() ); + _tabWidget->setTabText( index , item->title() ); } } diff --git a/konsole/ViewContainer.h b/konsole/ViewContainer.h index 15968bf8..e8e337b0 100644 --- a/konsole/ViewContainer.h +++ b/konsole/ViewContainer.h @@ -30,7 +30,7 @@ class QStackedWidget; class QWidget; -class NavigationItem; +class ViewProperties; // TabbedViewContainer // Qt @@ -66,12 +66,13 @@ public: virtual QWidget* containerWidget() const = 0; /** Adds a new view to the container widget */ - void addView(QWidget* view); //NavigationItem* navigationItem); + void addView(QWidget* view , ViewProperties* navigationItem); + /** Removes a view from the container */ void removeView(QWidget* view); - /** Returns the navigation item associated with a particular view in the container */ - NavigationItem* navigationItem( QWidget* view ); + /** Returns the ViewProperties instance associated with a particular view in the container */ + ViewProperties* viewProperties( QWidget* view ); /** Returns a list of the contained views */ const QList views(); @@ -107,14 +108,14 @@ protected: virtual void viewRemoved(QWidget* view) = 0; /** Returns the widgets which are associated with a particular navigation item */ - QList widgetsForItem( NavigationItem* item ) const; + QList widgetsForItem( ViewProperties* item ) const; private slots: void viewDestroyed(QObject* view); private: QList _views; - QHash _navigation; + QHash _navigation; }; /** @@ -138,8 +139,8 @@ protected: virtual void viewRemoved( QWidget* view ); private slots: - void updateTitle(NavigationItem* item); - void updateIcon(NavigationItem* item); + void updateTitle(ViewProperties* item); + void updateIcon(ViewProperties* item); void selectTabColor(); void prepareColorCells(); diff --git a/konsole/ViewManager.cpp b/konsole/ViewManager.cpp index c6e8dc70..e56cf8b5 100644 --- a/konsole/ViewManager.cpp +++ b/konsole/ViewManager.cpp @@ -126,7 +126,22 @@ void ViewManager::sessionFinished( TESession* session ) _sessionMap.remove(view); delete view; } - } + } + + focusActiveView(); +} + +void ViewManager::focusActiveView() +{ + ViewContainer* container = _viewSplitter->activeContainer(); + if ( container ) + { + QWidget* activeView = container->activeView(); + if ( activeView ) + { + activeView->setFocus(Qt::MouseFocusReason); + } + } } void ViewManager::viewFocused( SessionController* controller ) @@ -161,12 +176,11 @@ void ViewManager::splitView(bool splitView) TESession* session = _sessionMap[(TEWidget*)existingViewIter.next()]; TEWidget* display = createTerminalDisplay(); loadViewSettings(display,session); - createController(session,display); + ViewProperties* properties = createController(session,display); _sessionMap[display] = session; - container->addView(display); - container->setActiveView(display); + container->addView(display,properties); session->addView( display ); } @@ -205,10 +219,10 @@ void ViewManager::createView(TESession* session) ViewContainer* container = containerIter.next(); TEWidget* display = createTerminalDisplay(); loadViewSettings(display,session); - createController(session,display); + ViewProperties* properties = createController(session,display); _sessionMap[display] = session; - container->addView(display); + container->addView(display,properties); session->addView(display); display->setFocus(Qt::MouseFocusReason); @@ -238,8 +252,9 @@ void ViewManager::merge(ViewManager* otherManager) assert(view); + ViewProperties* properties = otherContainer->viewProperties(view); otherContainer->removeView(view); - activeContainer->addView(view); + activeContainer->addView(view,properties); // transfer the session map entries _sessionMap.insert(view,otherManager->_sessionMap[view]); diff --git a/konsole/ViewManager.h b/konsole/ViewManager.h index 59d44453..58110ad1 100644 --- a/konsole/ViewManager.h +++ b/konsole/ViewManager.h @@ -83,7 +83,7 @@ private slots: private: void setupActions(); - + void focusActiveView(); void registerView(TEWidget* view); void unregisterView(TEWidget* view); diff --git a/konsole/ViewProperties.cpp b/konsole/ViewProperties.cpp new file mode 100644 index 00000000..c25b810c --- /dev/null +++ b/konsole/ViewProperties.cpp @@ -0,0 +1,44 @@ +/* + Copyright (C) 2007 by Robert Knight + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. +*/ + +#include "ViewProperties.h" + +void ViewProperties::setTitle(const QString& title) +{ + if ( title != _title ) + { + _title = title; + emit titleChanged(this); + } +} +void ViewProperties::setIcon(const QIcon& icon) +{ + _icon = icon; + emit iconChanged(this); +} +QString ViewProperties::title() +{ + return _title; +} +QIcon ViewProperties::icon() +{ + return _icon; +} + +#include "ViewProperties.moc" diff --git a/konsole/ViewProperties.h b/konsole/ViewProperties.h new file mode 100644 index 00000000..bebbb204 --- /dev/null +++ b/konsole/ViewProperties.h @@ -0,0 +1,67 @@ +/* + Copyright (C) 2007 by Robert Knight + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. +*/ + +#ifndef VIEWPROPERTIES_H +#define VIEWPROPERTIES_H + +// Qt +#include +#include + + +/** + * Provides access to information such as the title and icon associated with a document + * in a view container + */ +class ViewProperties : public QObject +{ +Q_OBJECT + +public: + ViewProperties(QObject* parent) : QObject(parent) {} + + /** Returns the icon associated with a view */ + QIcon icon(); + /** Returns the title associated with a view */ + QString title(); + +signals: + /** Emitted when the icon for a view changes */ + void iconChanged(ViewProperties* properties); + /** Emitted when the title for a view changes */ + void titleChanged(ViewProperties* properties); + +protected: + /** + * Subclasses may call this method to change the title. This causes + * a titleChanged() signal to be emitted + */ + void setTitle(const QString& title); + /** + * Subclasses may call this method to change the icon. This causes + * an iconChanged() signal to be emitted + */ + void setIcon(const QIcon& icon); + +private: + QIcon _icon; + QString _title; +}; + +#endif //VIEWPROPERTIES_H diff --git a/konsole/ViewSplitter.cpp b/konsole/ViewSplitter.cpp index 51629bea..4c56c3d7 100644 --- a/konsole/ViewSplitter.cpp +++ b/konsole/ViewSplitter.cpp @@ -19,6 +19,9 @@ 02110-1301 USA. */ +// Qt +#include + // KDE #include "kdebug.h" @@ -135,7 +138,7 @@ void ViewSplitter::addContainer( ViewContainer* container , } -void ViewSplitter::containerEmpty(ViewContainer* object) +void ViewSplitter::containerEmpty(ViewContainer* /*object*/) { QListIterator containerIter(_containers); diff --git a/konsole/ViewSplitter.h b/konsole/ViewSplitter.h index f4d9a2e7..4c693448 100644 --- a/konsole/ViewSplitter.h +++ b/konsole/ViewSplitter.h @@ -25,6 +25,7 @@ #include #include +class QFocusEvent; class ViewContainer; /** @@ -95,6 +96,10 @@ signals: * TODO: This does not yet work recursively (ie. when splitters inside splitters have empty containers) */ void allContainersEmpty(); + +protected: + //virtual void focusEvent(QFocusEvent* event); + private: // Adds container to splitter's internal list and // connects signals and slots diff --git a/other/color-schemes/CMakeLists.txt b/other/color-schemes/CMakeLists.txt new file mode 100644 index 00000000..1a622d72 --- /dev/null +++ b/other/color-schemes/CMakeLists.txt @@ -0,0 +1,23 @@ +install( FILES + BlackOnLightColor.schema + BlackOnLightYellow.schema + BlackOnWhite.schema + Example.Schema + GreenOnBlack.schema + WhiteOnBlack.schema + README.default.Schema + syscolor.schema + Linux.schema + XTerm.schema + vim.schema + DarkPicture.schema + LightPicture.schema + Transparent.schema + GreenTint.schema + Transparent_MC.schema + GreenTint_MC.schema + Transparent_lightbg.schema + Transparent_darkbg.schema + README.Schema + DESTINATION + ${DATA_INSTALL_DIR}/konsole ) diff --git a/other/keyboard-layouts/CMakeLists.txt b/other/keyboard-layouts/CMakeLists.txt new file mode 100644 index 00000000..8b7c997a --- /dev/null +++ b/other/keyboard-layouts/CMakeLists.txt @@ -0,0 +1,10 @@ +install( FILES + linux.keytab + vt100.keytab + vt420pc.keytab + x11r5.keytab + solaris.keytab + README.KeyTab + README.default.Keytab + DESTINATION + ${DATA_INSTALL_DIR}/konsole ) diff --git a/other/sessions/CMakeLists.txt b/other/sessions/CMakeLists.txt new file mode 100644 index 00000000..58349c85 --- /dev/null +++ b/other/sessions/CMakeLists.txt @@ -0,0 +1,10 @@ + +install( FILES + linux.desktop + mc.desktop + shell.desktop + su.desktop + sumc.desktop + screen.desktop + DESTINATION + ${DATA_INSTALL_DIR}/konsole)