diff --git a/src/Application.cpp b/src/Application.cpp index d2b4c01e..b4295d26 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -45,6 +45,7 @@ using namespace Konsole; +#if 0 #ifdef Q_WS_X11 Application::Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colormap) : KUniqueApplication(display,visual,colormap) @@ -52,7 +53,8 @@ Application::Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colorm init(); } #endif - +#endif + Application::Application() : KUniqueApplication() { init(); diff --git a/src/Application.h b/src/Application.h index ec963809..0899ac91 100644 --- a/src/Application.h +++ b/src/Application.h @@ -48,11 +48,14 @@ class Application : public KUniqueApplication Q_OBJECT public: +#if 0 /** Constructs a new Konsole application. */ #ifdef Q_WS_X11 Application(Display* display , Qt::HANDLE visual, Qt::HANDLE colormap); +#endif #endif + /** Constructs a new Konsole application. */ Application(); virtual ~Application(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0bc637ad..eff36901 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,45 +55,45 @@ endif(KONSOLE_GENERATE_LINEFONT) set(konsole_KDEINIT_SRCS ${sessionadaptors_SRCS} + Application.cpp BlockArray.cpp + BookmarkHandler.cpp ColorScheme.cpp ColorSchemeEditor.cpp EditProfileDialog.cpp + Emulation.cpp Filter.cpp + History.cpp HistorySizeDialog.cpp IncrementalSearchBar.cpp - KeyboardTranslator.cpp KeyBindingEditor.cpp - Application.cpp - BookmarkHandler.cpp + KeyboardTranslator.cpp MainWindow.cpp + ManageProfilesDialog.cpp ProcessInfo.cpp - ScreenWindow.cpp - SessionController.cpp - ShellCommand.cpp Profile.cpp ProfileList.cpp ProfileListWidget.cpp - SessionManager.cpp - ManageProfilesDialog.cpp - History.cpp Pty.cpp + RemoteConnectionDialog.cpp Screen.cpp + ScreenWindow.cpp Session.cpp + SessionController.cpp + SessionManager.cpp + ShellCommand.cpp TabTitleFormatAction.cpp - TerminalDisplay.cpp - Vt102Emulation.cpp - Emulation.cpp - RemoteConnectionDialog.cpp TerminalCharacterDecoder.cpp + TerminalDisplay.cpp ViewContainer.cpp ViewManager.cpp ViewProperties.cpp ViewSplitter.cpp + Vt102Emulation.cpp + XKB.cpp ZModemDialog.cpp konsole_wcwidth.cpp - start.cpp - XKB.cpp + main.cpp ) diff --git a/src/Emulation.cpp b/src/Emulation.cpp index bdc49c84..e1b48566 100644 --- a/src/Emulation.cpp +++ b/src/Emulation.cpp @@ -1,8 +1,9 @@ /* This file is part of Konsole, an X terminal. - Copyright (C) 1996 by Matthias Ettrich - Copyright (C) 1997,1998 by Lars Doelle + Copyright (C) 2007 Robert Knight + Copyright (C) 1997,1998 by Lars Doelle + Copyright (C) 1996 by Matthias Ettrich 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 @@ -20,51 +21,6 @@ 02110-1301 USA. */ -/*! \class Emulation - - \brief Mediator between TerminalDisplay and Screen. - - This class is responsible to scan the escapes sequences of the terminal - emulation and to map it to their corresponding semantic complements. - Thus this module knows mainly about decoding escapes sequences and - is a stateless device w.rendition.t. the semantics. - - It is also responsible to refresh the TerminalDisplay by certain rules. - - \sa TerminalDisplay \sa Screen - - \par A note on refreshing - - Although the modifications to the current _screen image could immediately - be propagated via `TerminalDisplay' to the graphical surface, we have chosen - another way here. - - The reason for doing so is twofold. - - First, experiments show that directly displaying the operation results - in slowing down the overall performance of emulations. Displaying - individual characters using X11 creates a lot of overhead. - - Second, by using the following refreshing method, the _screen operations - can be completely separated from the displaying. This greatly simplifies - the programmer's task of coding and maintaining the _screen operations, - since one need not worry about differential modifications on the - display affecting the operation of concern. - - We use a refreshing algorithm here that has been adoped from rxvt/kvt. - - By this, refreshing is driven by a timer, which is (re)started whenever - a new bunch of data to be interpreted by the emulation arives at `receiveData'. - As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger - refresh. This rule suits both bulk display operation as done by curses as - well as individual characters typed. - - We start also a second time which is never restarted. If repeatedly - restarting of the first timer could delay continuous output indefinitly, - the second timer guarantees that the output is refreshed with at least - a fixed rate. -*/ - // Own #include "Emulation.h" @@ -102,7 +58,7 @@ using namespace Konsole; /* */ /* ------------------------------------------------------------------------- */ -#define CNTL(c) ((c)-'@') +//#define CNTL(c) ((c)-'@') /*! */ diff --git a/src/ManageProfilesDialog.cpp b/src/ManageProfilesDialog.cpp index 8902e928..a812017a 100644 --- a/src/ManageProfilesDialog.cpp +++ b/src/ManageProfilesDialog.cpp @@ -58,14 +58,11 @@ ManageProfilesDialog::ManageProfilesDialog(QWidget* parent) connect( SessionManager::instance() , SIGNAL(profileChanged(const QString&)) , this, SLOT(updateTableModel()) ); - // ensure that session names are fully visible - _ui->sessionTable->resizeColumnToContents(0); - _ui->sessionTable->resizeColumnToContents(1); - // resize the session table to the full width of the table - _ui->sessionTable->horizontalHeader()->setStretchLastSection(true); _ui->sessionTable->horizontalHeader()->setHighlightSections(false); - + + _ui->sessionTable->resizeColumnsToContents(); + // setup buttons connect( _ui->newSessionButton , SIGNAL(clicked()) , this , SLOT(newType()) ); connect( _ui->editSessionButton , SIGNAL(clicked()) , this , SLOT(editSelected()) ); @@ -76,8 +73,23 @@ ManageProfilesDialog::ManageProfilesDialog(QWidget* parent) void ManageProfilesDialog::showEvent(QShowEvent* event) { - qDebug() << "Session table size: " << _ui->sessionTable->size(); - qDebug() << "Session table size hint: " << _ui->sessionTable->sizeHint(); + Q_ASSERT( _ui->sessionTable->model() ); + + // try to ensure that all the text in all the columns is visible initially. + // FIXME: this is not a good solution, look for a more correct way to do this + + int totalWidth = 0; + int columnCount = _ui->sessionTable->model()->columnCount(); + + for ( int i = 0 ; i < columnCount ; i++ ) + totalWidth += _ui->sessionTable->columnWidth(i); + + // the margin is added to account for the space taken by the resize grips + // between the columns, this ensures that a horizontal scroll bar is not added + // automatically + int margin = style()->pixelMetric( QStyle::PM_HeaderGripMargin ) * columnCount; + _ui->sessionTable->setMinimumWidth( totalWidth + margin ); + _ui->sessionTable->horizontalHeader()->setStretchLastSection(true); } ManageProfilesDialog::~ManageProfilesDialog() diff --git a/src/ManageProfilesDialog.ui b/src/ManageProfilesDialog.ui index 6e9adbbd..d948e008 100644 --- a/src/ManageProfilesDialog.ui +++ b/src/ManageProfilesDialog.ui @@ -5,7 +5,7 @@ 0 0 - 515 + 645 315 diff --git a/src/Screen.cpp b/src/Screen.cpp index 0fe1c834..d48c5ef7 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -458,9 +458,9 @@ void Screen::setDefaultMargins() /* - Clarifying rendition here and in TerminalDisplay. + Clarifying rendition here and in the display. - currently, TerminalDisplay's color table is + currently, the display's color table is 0 1 2 .. 9 10 .. 17 dft_fg, dft_bg, dim 0..7, intensive 0..7 diff --git a/src/Screen.h b/src/Screen.h index ca1f3e1e..173a0be3 100644 --- a/src/Screen.h +++ b/src/Screen.h @@ -95,7 +95,7 @@ public: // these are all `Screen' operations void setCursorY (int y); void setCursorX (int x); void setCursorYX (int y, int x); - void setMargins (int t, int b); + void setMargins (int topLine , int bottomLine); int topMargin() const; int bottomMargin() const; @@ -227,7 +227,7 @@ public: // these are all `Screen' operations * @param line The line index of the first character in the selection. * @param columnmode TODO: Document me */ - void setSelectionStart(/*const ScreenCursor& cursor ,*/ const int column, const int line, const bool columnmode); + void setSelectionStart(const int column, const int line, const bool columnmode); /** * Sets the end of the current selection. @@ -235,7 +235,7 @@ public: // these are all `Screen' operations * @param column The column index of the last character in the selection. * @param line The line index of the last character in the selection. */ - void setSelectionEnd(/*const ScreenCursor& cursor ,*/ const int column, const int line); + void setSelectionEnd(const int column, const int line); /** * Retrieves the start of the selection or the cursor position if there @@ -261,7 +261,7 @@ public: // these are all `Screen' operations * @param column TODO: Document me * @param line TODO: Document me */ - bool isSelected(/*const ScreenCursor& cursor ,*/ const int column,const int line); + bool isSelected(const int column,const int line); /** * Convenience method. Returns the currently selected text. @@ -270,17 +270,6 @@ public: // these are all `Screen' operations */ QString selectedText(bool preserve_line_breaks); - /** - * Copies the entire output history, including the characters currently on screen - * into a text stream. - * - * @param stream An output stream which receives the history text - * @param decoder A decoder which converts terminal characters into text. PlainTextDecoder - * is the most commonly used decoder which coverts characters into plain - * text with no formatting. - */ - //void writeToStream(QTextStream* stream , TerminalCharacterDecoder* decoder); - /** * Copies part of the output to a stream. * diff --git a/src/SessionController.cpp b/src/SessionController.cpp index fbbaf681..b4d9a9be 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -671,11 +671,6 @@ void SessionController::searchHistory(bool showSearchBar) } setFindNextPrevEnabled(true); - - SessionTask* task = new SearchHistoryTask(_view->screenWindow()); - task->setAutoDelete(true); - task->addSession( _session ); - task->execute(); } else { @@ -703,8 +698,14 @@ void SessionController::searchTextChanged(const QString& text) // update search. this is called even when the text is // empty to clear the view's filters - beginSearch(text , SearchHistoryTask::Forwards); + beginSearch(text , SearchHistoryTask::ForwardsSearch); } +void SessionController::searchCompleted(bool success) +{ + if ( _searchBar ) + _searchBar->setFoundMatch(success); +} + void SessionController::beginSearch(const QString& text , int direction) { Q_ASSERT( _searchBar ); @@ -717,30 +718,21 @@ void SessionController::beginSearch(const QString& text , int direction) if ( !regExp.isEmpty() ) { - SearchHistoryTask* task = new SearchHistoryTask(_view->screenWindow(),this); - + SearchHistoryTask* task = new SearchHistoryTask(this); + + connect( task , SIGNAL(completed(bool)) , this , SLOT(searchCompleted(bool)) ); + task->setRegExp(regExp); - task->setMatchCase( _searchBar->matchCase() ); - task->setMatchRegExp( _searchBar->matchRegExp() ); task->setSearchDirection( (SearchHistoryTask::SearchDirection)direction ); task->setAutoDelete(true); - task->addSession( _session ); + task->addScreenWindow( _session , _view->screenWindow() ); task->execute(); } _searchFilter->setRegExp(regExp); _view->processFilters(); - // color search bar to indicate whether a match was found - if ( _searchFilter->hotSpots().count() > 0 ) - { - _searchBar->setFoundMatch(true); - } - else - { - _searchBar->setFoundMatch(false); - } - // TODO - Optimise by only updating affected regions + // TODO - Optimise by only updating affected regions _view->update(); } void SessionController::highlightMatches(bool highlight) @@ -761,13 +753,13 @@ void SessionController::findNextInHistory() { Q_ASSERT( _searchBar ); - beginSearch(_searchBar->searchText(),SearchHistoryTask::Forwards); + beginSearch(_searchBar->searchText(),SearchHistoryTask::ForwardsSearch); } void SessionController::findPreviousInHistory() { Q_ASSERT( _searchBar ); - beginSearch(_searchBar->searchText(),SearchHistoryTask::Backwards); + beginSearch(_searchBar->searchText(),SearchHistoryTask::BackwardsSearch); } void SessionController::showHistoryOptions() { @@ -1092,29 +1084,44 @@ void SaveHistoryTask::jobResult(KJob* job) delete info.decoder; // notify the world that the task is done - emit completed(); + emit completed(true); if ( autoDelete() ) deleteLater(); } - +void SearchHistoryTask::addScreenWindow( Session* session , ScreenWindow* searchWindow ) +{ + _windows.insert(session,searchWindow); +} void SearchHistoryTask::execute() { - Q_ASSERT( sessions().first() ); + QMapIterator< SessionPtr , ScreenWindowPtr > iter(_windows); + + while ( iter.hasNext() ) + { + iter.next(); + executeOnScreenWindow( iter.key() , iter.value() ); + } +} + +void SearchHistoryTask::executeOnScreenWindow( SessionPtr session , ScreenWindowPtr window ) +{ + Q_ASSERT( session ); + Q_ASSERT( window ); - Emulation* emulation = sessions().first()->emulation(); + Emulation* emulation = session->emulation(); int selectionColumn = 0; int selectionLine = 0; - _screenWindow->getSelectionEnd(selectionColumn , selectionLine); + window->getSelectionEnd(selectionColumn , selectionLine); if ( !_regExp.isEmpty() ) { int pos = -1; - const bool forwards = ( _direction == Forwards ); - const int startLine = selectionLine + _screenWindow->currentLine() + ( forwards ? 1 : -1 ); - const int lastLine = _screenWindow->lineCount() - 1; + const bool forwards = ( _direction == ForwardsSearch ); + const int startLine = selectionLine + window->currentLine() + ( forwards ? 1 : -1 ); + const int lastLine = window->lineCount() - 1; QString string; //text stream to read history into string for pattern or regular expression searching @@ -1129,17 +1136,9 @@ void SearchHistoryTask::execute() //this balances the need to retrieve lots of data from the history each time //(for efficient searching) //without using silly amounts of memory if the history is very large. - const int maxDelta = qMin(_screenWindow->lineCount(),10000); + const int maxDelta = qMin(window->lineCount(),10000); int delta = forwards ? maxDelta : -maxDelta; - //setup case sensitivity and regular expression if enabled - _regExp.setCaseSensitivity( _matchCase ? Qt::CaseSensitive : Qt::CaseInsensitive ); - - if (_matchRegExp) - _regExp.setPatternSyntax(QRegExp::RegExp); - else - _regExp.setPatternSyntax(QRegExp::FixedString); - int endLine = line; bool hasWrapped = false; // set to true when we reach the top/bottom // of the output and continue from the other @@ -1148,6 +1147,8 @@ void SearchHistoryTask::execute() //loop through history in blocks of lines. do { + // ensure that application does not appear to hang + // if searching through a lengthy output QApplication::processEvents(); // calculate lines to search in this iteration @@ -1197,7 +1198,10 @@ void SearchHistoryTask::execute() if ( pos != -1 ) { int findPos = qMin(line,endLine) + string.left(pos + 1).count(QChar('\n')); - highlightResult(findPos); + highlightResult(window,findPos); + + emit completed(true); + return; } @@ -1208,12 +1212,14 @@ void SearchHistoryTask::execute() } while ( startLine != endLine ); // if no match was found, clear selection to indicate this - _screenWindow->clearSelection(); - _screenWindow->notifyOutputChanged(); + window->clearSelection(); + window->notifyOutputChanged(); } + + emit completed(false); } -void SearchHistoryTask::highlightResult(int findPos) +void SearchHistoryTask::highlightResult(ScreenWindowPtr window , int findPos) { //work out how many lines into the current block of text the search result was found //- looks a little painful, but it only has to be done once per search. @@ -1221,41 +1227,21 @@ void SearchHistoryTask::highlightResult(int findPos) qDebug() << "Found result at line " << findPos; //update display to show area of history containing selection - _screenWindow->scrollTo(findPos); - _screenWindow->setSelectionStart( 0 , findPos - _screenWindow->currentLine() , false ); - _screenWindow->setSelectionEnd( _screenWindow->columnCount() , findPos - _screenWindow->currentLine() ); - //qDebug() << "Current line " << _screenWindow->currentLine(); - _screenWindow->setTrackOutput(false); - _screenWindow->notifyOutputChanged(); - //qDebug() << "Post update current line " << _screenWindow->currentLine(); + window->scrollTo(findPos); + window->setSelectionStart( 0 , findPos - window->currentLine() , false ); + window->setSelectionEnd( window->columnCount() , findPos - window->currentLine() ); + //qDebug() << "Current line " << window->currentLine(); + window->setTrackOutput(false); + window->notifyOutputChanged(); + //qDebug() << "Post update current line " << window->currentLine(); } -SearchHistoryTask::SearchHistoryTask(ScreenWindow* window , QObject* parent) +SearchHistoryTask::SearchHistoryTask(QObject* parent) : SessionTask(parent) - , _matchRegExp(false) - , _matchCase(false) - , _direction(Forwards) - , _screenWindow(window) + , _direction(ForwardsSearch) { } - -void SearchHistoryTask::setMatchCase( bool matchCase ) -{ - _matchCase = matchCase; -} -bool SearchHistoryTask::matchCase() const -{ - return _matchCase; -} -void SearchHistoryTask::setMatchRegExp( bool matchRegExp ) -{ - _matchRegExp = matchRegExp; -} -bool SearchHistoryTask::matchRegExp() const -{ - return _matchRegExp; -} void SearchHistoryTask::setSearchDirection( SearchDirection direction ) { _direction = direction; diff --git a/src/SessionController.h b/src/SessionController.h index f45764ad..986ecedd 100644 --- a/src/SessionController.h +++ b/src/SessionController.h @@ -66,14 +66,17 @@ class TerminalCharacterDecoder; typedef QPointer SessionPtr; /** - * 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. + * Provides the menu actions to manipulate a single terminal session and view pair. + * The actions provided by this class are defined in the sessionui.rc XML file. * - * Each view should have one SessionController associated with it + * SessionController monitors the session and provides access to basic information + * about the session such as title(), icon() and currentDir(). SessionController + * provides notifications of activity in the session via the activity() signal. * - * The SessionController will delete itself if either the view or the session is destroyed, for - * this reason it is recommended that other classes which need a pointer to a SessionController - * use QPointer rather than SessionController* + * When the controlled view receives the focus, the focused() signal is emitted + * with a pointer to the controller. This can be used by main application window + * which contains the view to plug the controller's actions into the menu when + * the view is focused. */ class SessionController : public ViewProperties , public KXMLGUIClient { @@ -93,8 +96,11 @@ public: QPointer view() { return _view; } /** - * Sets the widget used for searches through the session's history. - * The widget will be shown when the user clicks on the "Search History" menu action. + * Sets the widget used for searches through the session's output. + * + * When the user clicks on the "Search Output" menu action the @p searchBar 's + * show() method will be called. The SessionController will then connect to the search + * bar's signals to update the search when the widget's controls are pressed. */ void setSearchBar( IncrementalSearchBar* searchBar ); /** @@ -135,8 +141,9 @@ public slots: * This may not succeed if the foreground program does not understand * the command sent to it ( 'cd path' for local URLs ) or is not * responding to input. - * - * TODO: Only handles URLs using the file:/// protocol at present. + * + * openUrl() currently supports urls for local paths and those + * using the 'ssh' protocol ( eg. ssh://joebloggs@hostname ) */ void openUrl( const KUrl& url ); @@ -172,6 +179,7 @@ private slots: void sessionStateChanged(int state); void sessionTitleChanged(); void searchTextChanged(const QString& text); + void searchCompleted(bool success); void searchClosed(); // called when the user clicks on the // history search bar's close button @@ -270,8 +278,10 @@ signals: * Emitted when the task has completed. * Depending on the task this may occur just before execute() returns, or it * may occur later + * + * @param success Indicates whether the task completed successfully or not */ - void completed(); + void completed(bool success); protected: @@ -329,71 +339,75 @@ private: class SearchHistoryThread; /** * A task which searches through the output of sessions for matches for a given regular expression. - * - * TODO - Implementation requirements: - * Must provide progress feedback to the user when searching very large output logs. + * SearchHistoryTask operates on ScreenWindow instances rather than sessions added by addSession(). + * A screen window can be added to the list to search using addScreenWindow() * - * - Remember where the search got to when it reaches the end of the output in each session - * calling execute() subsequently should continue the search. - * This allows the class to be used for both the "Search history for text" - * and new-in-KDE-4 "Monitor output for text" actions + * When execute() is called, the search begins in the direction specified by searchDirection(), + * starting at the position of the current selection. * - * TODO: Implement this + * FIXME - This is not a proper implementation of SessionTask, in that it ignores sessions specified + * with addSession() + * + * TODO - Implementation requirements: + * May provide progress feedback to the user when searching very large output logs. */ class SearchHistoryTask : public SessionTask { Q_OBJECT public: + /** + * This enum describes the strategies available for searching through the + * session's output. + */ enum SearchDirection { - Forwards, - Backwards + /** Searches forwards through the output, starting at the current selection. */ + ForwardsSearch, + /** Searches backwars through the output, starting at the current selection. */ + BackwardsSearch }; - explicit SearchHistoryTask(ScreenWindow* window , QObject* parent = 0); + /** + * Constructs a new search task. + */ + explicit SearchHistoryTask(QObject* parent = 0); + + /** Adds a screen window to the list to search when execute() is called. */ + void addScreenWindow( Session* session , ScreenWindow* searchWindow); /** Sets the regular expression which is searched for when execute() is called */ void setRegExp(const QRegExp& regExp); /** Returns the regular expression which is searched for when execute() is called */ QRegExp regExp() const; - - void setMatchCase(bool matchCase); - bool matchCase() const; - void setMatchRegExp(bool matchRegExp); - bool matchRegExp() const; + + /** Specifies the direction to search in when execute() is called. */ void setSearchDirection( SearchDirection direction ); + /** Returns the current search direction. See setSearchDirection(). */ SearchDirection searchDirection() const; - virtual void execute(); - -signals: /** - * Emitted when a match for the regular expression is found in a session's output. - * The line numbers are given as offsets from the start of the history + * Performs a search through the session's history, starting at the position + * of the current selection, in the direction specified by setSearchDirection(). + * + * If it finds a match, the ScreenWindow specified in the constructor is + * scrolled to the position where the match occurred and the selection + * is set to the matching text. execute() then returns immediately. * - * @param session The session in which a match for regExp() was found. - * @param startLine The line in the output where the matched text starts - * @param startColumn The column in the output where the matched text starts - * @param endLine The line in the output where the matched text ends - * @param endColumn The column in the output where the matched text ends + * To continue the search looking for further matches, call execute() again. */ - void foundMatch(Session* session , - int startLine , - int startColumn , - int endLine , - int endColumn ); - + virtual void execute(); + private: - void highlightResult(int position); + typedef QPointer ScreenWindowPtr; + + void executeOnScreenWindow( SessionPtr session , ScreenWindowPtr window ); + void highlightResult( ScreenWindowPtr window , int position); + QMap< SessionPtr , ScreenWindowPtr > _windows; QRegExp _regExp; - bool _matchRegExp; - bool _matchCase; SearchDirection _direction; - ScreenWindow* _screenWindow; - static QPointer _thread; }; diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index ac47e409..5b4be888 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -681,13 +681,26 @@ void SessionManager::sessionProfileChanged() void SessionManager::sessionProfileCommandReceived(const QString& text) { + // FIXME: This is inefficient, it creates a new profile instance for + // each set of changes applied. Instead a new profile should be created + // only the first time changes are applied to a session + Session* session = qobject_cast(sender()); Q_ASSERT( session ); ProfileCommandParser parser; QHash changes = parser.parse(text); - changeProfile(session->profileKey(),changes,false); + Profile* newProfile = new Profile( profile(session->profileKey()) ); + + QHashIterator iter(changes); + while ( iter.hasNext() ) + { + iter.next(); + newProfile->setProperty(iter.key(),iter.value()); + } + + session->setProfileKey( addProfile(newProfile) ); } QKeySequence SessionManager::shortcut(const QString& profileKey) const diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 5dc15c66..df6e5dd8 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -145,7 +145,8 @@ const ColorEntry* TerminalDisplay::colorTable() const void TerminalDisplay::setColorTable(const ColorEntry table[]) { - for (int i = 0; i < TABLE_COLORS; i++) _colorTable[i] = table[i]; + for (int i = 0; i < TABLE_COLORS; i++) + _colorTable[i] = table[i]; QPalette p = palette(); p.setColor( backgroundRole(), defaultBackColor() ); @@ -622,12 +623,16 @@ void TerminalDisplay::drawCharacters(QPainter& painter, if ( _blinking && (style->rendition & RE_BLINK) ) return; - // setup bold + // setup bold and underline bool useBold = style->rendition & RE_BOLD || style->isBold(_colorTable); + bool useUnderline = style->rendition & RE_UNDERLINE; + QFont font = painter.font(); - if ( font.bold() != useBold ) + if ( font.bold() != useBold + || font.underline() != useUnderline ) { font.setBold(useBold); + font.setUnderline(useUnderline); painter.setFont(font); } diff --git a/src/ViewManager.h b/src/ViewManager.h index 987d14e2..d16239c6 100644 --- a/src/ViewManager.h +++ b/src/ViewManager.h @@ -49,15 +49,16 @@ class ViewSplitter; * one or more terminal displays and a navigation widget ( eg. tabs or a list ) * to allow the user to navigate between the displays in that container. * - * The view manager provides facilities to construct display widgets for a terminal - * session and also to construct the SessionController which provides the menus and other - * user interface elements specific to that display/session pair. - * - * The view manager provides a number of actions ( defined in the 'konsoleui.rc' XML file ) + * The view manager provides menu actions ( defined in the 'konsoleui.rc' XML file ) * to manipulate the views and view containers - for example, actions to split the view * left/right or top/bottom, detach a view from the current window and navigate between * views and containers. These actions are added to the collection specified in the - * constructor. + * ViewManager's constructor. + * + * The view manager provides facilities to construct display widgets for a terminal + * session and also to construct the SessionController which provides the menus and other + * user interface elements specific to each display/session pair. + * */ class ViewManager : public QObject { diff --git a/src/ViewProperties.h b/src/ViewProperties.h index d72575f0..4f2a414b 100644 --- a/src/ViewProperties.h +++ b/src/ViewProperties.h @@ -32,7 +32,7 @@ namespace Konsole /** * Encapsulates user-visible information about the terminal session currently being displayed in a view, - * such as the icon and title associated with that session. + * such as the associated title and icon. * * This can be used by navigation widgets in a ViewContainer sub-class to provide a tab, label or other * item for switching between views. diff --git a/src/start.cpp b/src/main.cpp similarity index 99% rename from src/start.cpp rename to src/main.cpp index fba87054..d51e7adb 100644 --- a/src/start.cpp +++ b/src/main.cpp @@ -40,9 +40,12 @@ using namespace Konsole; // fills the KAboutData structure with information about contributors to // Konsole void fillAboutData(KAboutData& aboutData); + +#if 0 #ifdef Q_WS_X11 void getDisplayInformation(Display*& display , Visual*& visual , Colormap& colormap); #endif +#endif // *** // @@ -83,6 +86,7 @@ extern "C" int KDE_EXPORT kdemain(int argc,char** argv) exit(0); } +#if 0 #ifdef Q_WS_X11 //Display* display = 0; Display* display = XOpenDisplay(0); @@ -98,8 +102,10 @@ extern "C" int KDE_EXPORT kdemain(int argc,char** argv) Application app(display,Qt::HANDLE(visual),Qt::HANDLE(colormap)); #else Application app; +#endif #endif + Application app; return app.exec(); } @@ -168,6 +174,7 @@ void fillAboutData(KAboutData& aboutData) } +#if 0 // code taken from the Qt 4 graphics dojo examples #ifdef Q_WS_X11 void getDisplayInformation(Display*& display , Visual*& visual , Colormap& colormap) @@ -206,3 +213,6 @@ void getDisplayInformation(Display*& display , Visual*& visual , Colormap& color } } #endif +#endif + + diff --git a/src/startup-notes b/src/startup-notes deleted file mode 100644 index 32cc316f..00000000 --- a/src/startup-notes +++ /dev/null @@ -1,21 +0,0 @@ -These are some notes on the existing implementation of the Konsole front-end: - -TODO: Remove me when the new Konsole front-end is in-place - -This is the absolute barebones code needed to start a terminal session and display it -in a new window on screen. - -KonsoleMainWindow* window = new KonsoleMainWindow(); -TESession* s = _sessionManager->createSession(); -TEWidget* display = new TEWidget(0); -s->setConnect(true); -s->run(); -display->setMinimumSize(200,200); -display->setBellMode(0); -display->setVTFont( QFont("Monospace") ); -display->setTerminalSizeHint(true); -display->setSize(80,40); -s->addView(display); -window->setCentralWidget(display); -window->show(); -